From 2bb08d1ce9f371fb40908a9c83dcfa733873c149 Mon Sep 17 00:00:00 2001 From: splitPoleDAQ Date: Sat, 27 Jan 2024 01:22:37 -0500 Subject: [PATCH] added index = id*nCh + ch in ClassDet.h --- Analyzer.C | 37 ++++++++++++++++++++++++------------- Analyzer.h | 13 ++++++++----- ClassDet.h | 22 +++++++++++++++++++++- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/Analyzer.C b/Analyzer.C index 0c19d30..37718f1 100644 --- a/Analyzer.C +++ b/Analyzer.C @@ -4,27 +4,30 @@ #include #include -// 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); @@ -40,12 +43,20 @@ Bool_t Analyzer::Process(Long64_t entry){ b_pcCh->GetEntry(entry); b_pcE->GetEntry(entry); b_pcT->GetEntry(entry); - - //======================= SX3 - for( int i = 0; i < sx3.multi; i ++){ - sx3.Print(); - } + 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] ); + // } + // } + return kTRUE; } diff --git a/Analyzer.h b/Analyzer.h index 4a550db..64b359d 100644 --- a/Analyzer.h +++ b/Analyzer.h @@ -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); } diff --git a/ClassDet.h b/ClassDet.h index 4466e6f..9ae9e6b 100644 --- a/ClassDet.h +++ b/ClassDet.h @@ -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; + };