added index = id*nCh + ch in ClassDet.h

This commit is contained in:
splitPoleDAQ 2024-01-27 01:22:37 -05:00
parent 5be76136bd
commit 2bb08d1ce9
3 changed files with 53 additions and 19 deletions

View File

@ -4,27 +4,30 @@
#include <TH2.h>
#include <TStyle.h>
// TH2F * hsx3IDVch;
// // TH2F * hqqqIDVch;
// // TH2F * hpcIDVch;
TH2F * hsx3IDVch;
// TH2F * hqqqIDVch;
// TH2F * hpcIDVch;
// TH2F * hsx3VpcIndex;
TH2F * hsx3VpcIndex;
// TH2F * hsx3EVIndex;
void Analyzer::Begin(TTree * /*tree*/){
TString option = GetOption();
// hsx3IDVch = new TH2F("hsx3IDVch", "sx3 ID vs ch; ch ; ID", 24, 0, 24, 12, 0, 12);
// // hqqqIDVch = new TH2F("hqqqIDVch", "qqq ID vs ch; ch ; ID", 4, 0, 4, 32, 0, 32);
// // hpcIDVch = new TH2F("hpcIDVch", "pc ID vs ch; ch ; ID", 2, 0, 2, 24, 0, 24);
hsx3IDVch = new TH2F("hsx3IDVch", "sx3 ID vs ch; ch ; ID", 24, 0, 24, 12, 0, 12);
// hqqqIDVch = new TH2F("hqqqIDVch", "qqq ID vs ch; ch ; ID", 4, 0, 4, 32, 0, 32);
// hpcIDVch = new TH2F("hpcIDVch", "pc ID vs ch; ch ; ID", 2, 0, 2, 24, 0, 24);
// hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc", 24*12, 0, 24*12, 48, 0, 48);
hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc", 24*12, 0, 24*12, 48, 0, 48);
}
Bool_t Analyzer::Process(Long64_t entry){
if( entry > 1) return kTRUE;
printf("################### ev : %llu \n", entry);
b_sx3Multi->GetEntry(entry);
b_sx3ID->GetEntry(entry);
b_sx3Ch->GetEntry(entry);
@ -41,11 +44,19 @@ Bool_t Analyzer::Process(Long64_t entry){
b_pcE->GetEntry(entry);
b_pcT->GetEntry(entry);
sx3.CalIndex();
qqq.CalIndex();
pc.CalIndex();
sx3.Print();
// //======================= SX3
// for( int i = 0; i < sx3.multi; i ++){
// for( int j = 0; j < pc.multi; j++){
// hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] );
// }
// }
//======================= SX3
for( int i = 0; i < sx3.multi; i ++){
sx3.Print();
}
return kTRUE;
}

View File

@ -73,6 +73,9 @@ void Analyzer::Init(TTree *tree){
fChain->SetBranchAddress("evID", &evID, &b_eventID);
fChain->SetBranchAddress("run", &run, &b_run);
sx3.SetDetDimension(24,12);
qqq.SetDetDimension(4,32);
pc.SetDetDimension(2,24);
fChain->SetBranchAddress("sx3Multi", &sx3.multi, &b_sx3Multi);
fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID);
@ -84,11 +87,11 @@ void Analyzer::Init(TTree *tree){
fChain->SetBranchAddress("qqqCh", &qqq.ch, &b_qqqCh);
fChain->SetBranchAddress("qqqE", &qqq.e, &b_qqqE);
fChain->SetBranchAddress("qqqT", &qqq.t, &b_qqqT);
fChain->SetBranchAddress("pcMulti", &pc.multi, &b_pcMulti);
fChain->SetBranchAddress("pcID", &pc.id, &b_pcID);
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
fChain->SetBranchAddress("pcMulti", &pc.multi, &b_pcMulti);
fChain->SetBranchAddress("pcID", &pc.id, &b_pcID);
fChain->SetBranchAddress("pcCh", &pc.ch, &b_pcCh);
fChain->SetBranchAddress("pcE", &pc.e, &b_pcE);
fChain->SetBranchAddress("pcT", &pc.t, &b_pcT);
}

View File

@ -15,6 +15,8 @@ public:
unsigned short e[MAXMULTI];
unsigned long long t[MAXMULTI];
unsigned short index[MAXMULTI]; // id * 12 + ch;
void Clear(){
multi = 0;
for( int i = 0; i < MAXMULTI; i++){
@ -22,15 +24,33 @@ public:
ch[i] = 0;
e[i] = 0;
t[i] = 0;
index[i] = 0;
}
}
void Print(){
printf("=============================== multi : %u\n", multi);
for( int i = 0; i < multi; i++) {
printf(" %3d | %2d-%2d %5u %llu \n", i, id[i], ch[i], e[i], t[i]);
printf(" %3d | %2d-%-2d(%5d) %5u %15llu \n", i, id[i], ch[i], index[i], e[i], t[i]);
}
}
void SetDetDimension(unsigned short maxID, unsigned maxCh){
nID = maxID;
nCh = maxCh;
}
void CalIndex(){
for( int i = 0; i < multi; i++){
index[i] = id[i] * nCh + ch[i] ;
}
}
private:
unsigned short nID;
unsigned short nCh;
};