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

View File

@ -73,6 +73,9 @@ void Analyzer::Init(TTree *tree){
fChain->SetBranchAddress("evID", &evID, &b_eventID); fChain->SetBranchAddress("evID", &evID, &b_eventID);
fChain->SetBranchAddress("run", &run, &b_run); 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("sx3Multi", &sx3.multi, &b_sx3Multi);
fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID); fChain->SetBranchAddress("sx3ID", &sx3.id, &b_sx3ID);

View File

@ -15,6 +15,8 @@ public:
unsigned short e[MAXMULTI]; unsigned short e[MAXMULTI];
unsigned long long t[MAXMULTI]; unsigned long long t[MAXMULTI];
unsigned short index[MAXMULTI]; // id * 12 + ch;
void Clear(){ void Clear(){
multi = 0; multi = 0;
for( int i = 0; i < MAXMULTI; i++){ for( int i = 0; i < MAXMULTI; i++){
@ -22,15 +24,33 @@ public:
ch[i] = 0; ch[i] = 0;
e[i] = 0; e[i] = 0;
t[i] = 0; t[i] = 0;
index[i] = 0;
} }
} }
void Print(){ void Print(){
printf("=============================== multi : %u\n", multi); printf("=============================== multi : %u\n", multi);
for( int i = 0; i < multi; i++) { 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;
}; };