add spltpole.C/h in Aux

This commit is contained in:
splitPoleDAQ 2024-07-17 16:02:36 -04:00
parent c4263ab06c
commit 064c99256b
3 changed files with 286 additions and 3 deletions

3
.gitignore vendored
View File

@ -24,9 +24,6 @@ FSU2CAEN
data data
splitpole.C
splitpole.h
*.d *.d
*.pcm *.pcm

185
Aux/splitpole.C Normal file
View File

@ -0,0 +1,185 @@
#define splitpole_cxx
#include "splitpole.h"
#include <TH2.h>
#include <TH1.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TMath.h>
#include "../analyzers/SplitPoleHit.h"
namespace ChMap{
const short ScinR = 0;
const short ScinL = 1;
const short dFR = 8;
const short dFL = 9;
const short dBR = 10;
const short dBL = 11;
const short Cathode = 7;
const short AnodeF = 13;
const short AnodeB = 15;
};
const double c = 299.792458; // mm/ns
const double pi = M_PI;
const double deg2rad = pi/180.;
SplitPoleHit hit;
TH2F * PID;
TH2F * coin;
TH1F * hMulti;
TH1F * hF;
TH1F * hB;
TH1F * hXavg;
TH2F * hFocal;
TH2F * hXavgVQ;
TH2F * haha;
TH1F * hEx;
ULong64_t t1, t2;
#define XMIN -20
#define XMAX 100
void splitpole::Begin(TTree * /*tree*/){
TString option = GetOption();
PID = new TH2F("hPID", "PID; Scin_X ; AnodeB", 200, 0, 30000, 100, 0, 70000);
coin = new TH2F("hCoin", "Coincident ", 16, 0, 16, 16, 0, 16);
hMulti = new TH1F("hMulti", "Multiplicity", 16, 0, 16);
hF = new TH1F("hF", "Front delay line position", 600, XMIN, XMAX);
hB = new TH1F("hB", "Back delay line position", 600, XMIN, XMAX);
hXavg = new TH1F("hAvg", "Xavg", 600, XMIN, XMAX);
hFocal = new TH2F("hFocal", "Front vs Back ", 200, XMIN, XMAX, 200, XMIN, XMAX);
hXavgVQ = new TH2F("hXavgVQ", "Xavg vs Q ", 200, XMIN, XMAX, 200, 0, 40000);
haha = new TH2F("haha", "", 400, XMIN, XMAX, 400, -50, 50);
hEx = new TH1F("hEx", "Ex; Ex [MeV]; count/100 keV", 250, -5, 20);
hit.SetMassTablePath("../analyzers/mass20.txt");
hit.CalConstants("12C", "12C", "4He", 80, 5); // 80MeV, 5 deg
hit.CalZoffset(1.41); // 1.41 T
t1 = 0;
t2 = 0;
}
Bool_t splitpole::Process(Long64_t entry){
b_multi->GetEntry(entry);
b_ch->GetEntry(entry);
b_e->GetEntry(entry);
b_e2->GetEntry(entry);
b_e_t->GetEntry(entry);
b_e_f->GetEntry(entry);
//if( multi < 9) return kTRUE;
hit.ClearData();
hMulti->Fill(multi);
for( int i = 0; i < multi; i++){
t2 = e_t[i];
if( t2 < t1 ) printf("entry %lld-%d, timestamp is not in order. %llu, %llu\n", entry, i, t2, t1);
if( i == 0 ) t1 = e_t[i];
if( ch[i] == ChMap::ScinR ) {hit.eSR = e[i]; hit.tSR = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::ScinL ) {hit.eSL = e[i]; hit.tSL = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::dFR ) {hit.eFR = e[i]; hit.tFR = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::dFL ) {hit.eFL = e[i]; hit.tFL = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::dBR ) {hit.eBR = e[i]; hit.tBR = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::dBL ) {hit.eBL = e[i]; hit.tBL = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::Cathode ) {hit.eCath = e[i]; hit.tCath = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::AnodeF ) {hit.eAF = e[i]; hit.tAF = e_t[i] + e_f[i]/1000.;}
if( ch[i] == ChMap::AnodeB ) {hit.eAB = e[i]; hit.tAB = e_t[i] + e_f[i]/1000.;}
for( int j = i+1; j < multi; j++){
coin->Fill(ch[i], ch[j]);
}
}
unsigned int dQ = hit.eAB; // delta Q
unsigned int Qt = hit.eSR; // total Q
if( Qt > 0 && dQ > 0 ) {
PID->Fill(Qt, dQ);
}
// if( hit.eAF < 50000 ) return kTRUE;
// if( hit.eCath == 0 ) return kTRUE;
// if( hit.eCath > 13000 ) return kTRUE;
hit.CalData();
if( !TMath::IsNaN(hit.x1) || !TMath::IsNaN(hit.x2) ) {
hFocal->Fill(hit.x1, hit.x2);
hF->Fill(hit.x1);
hB->Fill(hit.x2);
hXavg->Fill(hit.xAvg);
hXavgVQ->Fill(hit.xAvg, dQ);
for( int i = 0; i < 400; i++){
double y = -50 + 100/400.*i;
double x = (y/42.8625 + 0.5)* ( hit.x2-hit.x1) + hit.x1;
haha->Fill(x,y);
}
double ex = hit.Rho2Ex( (hit.xAvg/100 + 0.363) );
//if( XMIN < hit.xAvg && hit.xAvg < XMAX) printf("x1 : %6.2f, x2 : %6.2f, xAvg %6.2f cm , ex : %f \n", hit.x1, hit.x2, hit.xAvg, ex);
hEx->Fill(ex);
}
return kTRUE;
}
void splitpole::Terminate(){
TCanvas * canvas = new TCanvas("cc", "Split-Pole", 1800, 1200);
gStyle->SetOptStat("neiou");
canvas->Divide(3, 3);
canvas->cd(1); PID->Draw("colz");
//canvas->cd(2); coin->Draw("colz");
canvas->cd(2); haha->Draw("colz");
canvas->cd(3); hF->Draw();
canvas->cd(4); hB->Draw();
canvas->cd(5); hXavgVQ->Draw("colz");
canvas->cd(6); hXavg->Draw("colz");
canvas->cd(7); hEx->Draw();
canvas->cd(8); coin->Draw("colz");
canvas->cd(9); canvas->cd(9)->SetLogy(); hMulti->Draw();
}

101
Aux/splitpole.h Normal file
View File

@ -0,0 +1,101 @@
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Wed Jun 14 15:51:03 2023 by ROOT version 6.26/04
// from TTree tree/temp_036.root
// found on file: temp_036.root
//////////////////////////////////////////////////////////
#ifndef splitpole_h
#define splitpole_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
// Header file for the classes stored in the TTree if any.
#define MaxMulti 100
class splitpole : public TSelector {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
// Fixed size dimensions of array or collections stored in the TTree if any.
// Declaration of leaf types
ULong64_t evID;
UShort_t multi;
UShort_t bd[MaxMulti]; //[multi]
UShort_t ch[MaxMulti]; //[multi]
UShort_t e[MaxMulti]; //[multi]
UShort_t e2[MaxMulti]; //[multi]
ULong64_t e_t[MaxMulti]; //[multi]
UShort_t e_f[MaxMulti]; //[multi]
// List of branches
TBranch *b_event_ID; //!
TBranch *b_multi; //!
TBranch *b_bd; //!
TBranch *b_ch; //!
TBranch *b_e; //!
TBranch *b_e2; //!
TBranch *b_e_t; //!
TBranch *b_e_f; //!
splitpole(TTree * /*tree*/ =0) : fChain(0) { }
virtual ~splitpole() { }
virtual Int_t Version() const { return 2; }
virtual void Begin(TTree *tree);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
virtual void SetOption(const char *option) { fOption = option; }
virtual void SetObject(TObject *obj) { fObject = obj; }
virtual void SetInputList(TList *input) { fInput = input; }
virtual TList *GetOutputList() const { return fOutput; }
virtual void SlaveTerminate();
virtual void Terminate();
ClassDef(splitpole,0);
};
#endif
#ifdef splitpole_cxx
void splitpole::Init(TTree *tree){
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("evID", &evID, &b_event_ID);
fChain->SetBranchAddress("multi", &multi, &b_multi);
fChain->SetBranchAddress("bd", bd, &b_bd);
fChain->SetBranchAddress("ch", ch, &b_ch);
fChain->SetBranchAddress("e", e, &b_e);
fChain->SetBranchAddress("e2", e2, &b_e2);
fChain->SetBranchAddress("e_t", e_t, &b_e_t);
fChain->SetBranchAddress("e_f", e_f, &b_e_f);
}
Bool_t splitpole::Notify(){
return kTRUE;
}
void splitpole::SlaveBegin(TTree * /*tree*/){
TString option = GetOption();
}
void splitpole::SlaveTerminate(){
}
#endif // #ifdef splitpole_cxx