42int main(
int argc,
char** argv)
45 const char *mcFilename = argv[1];
46 const char *sipmFilename = argv[2];
48 bool isMultithreading =
false;
52 threadID = std::stoi(argv[3]);
53 isMultithreading =
true;
57 cout <<
"BarST>> Start" << endl;
59 cout <<
"BarWT" << threadID <<
">> Start" << endl;
68 unique_ptr<TFile> mcFile(TFile::Open(mcFilename,
"READ"));
69 TTree *lyso = mcFile->Get<TTree>(
"lyso");
71 lyso->SetBranchStatus(
"*",
false);
73 lyso->SetBranchStatus(
"Event",
true);
74 lyso->SetBranchStatus(
"NHits_F",
true);
75 lyso->SetBranchStatus(
"NHits_B",
true);
76 lyso->SetBranchStatus(
"T_F",
true);
77 lyso->SetBranchStatus(
"Ch_F",
true);
78 lyso->SetBranchStatus(
"T_B",
true);
79 lyso->SetBranchStatus(
"Ch_B",
true);
82 Int_t fNHits_F, fNHits_B;
83 vector<Double_t> *fT_F = 0, *fT_B = 0;
84 vector<Int_t> *fCh_F = 0, *fCh_B = 0;
86 lyso->SetBranchAddress(
"Event", &fEvent);
87 lyso->SetBranchAddress(
"NHits_F", &fNHits_F);
88 lyso->SetBranchAddress(
"NHits_B", &fNHits_B);
89 lyso->SetBranchAddress(
"Ch_F", &fCh_F);
90 lyso->SetBranchAddress(
"Ch_B", &fCh_B);
91 lyso->SetBranchAddress(
"T_F", &fT_F);
92 lyso->SetBranchAddress(
"T_B", &fT_B);
95 Int_t nEntries = lyso->GetEntries();
96 bar->SetEvents(nEntries);
99 cout <<
"BarST>> Trees loaded. Starting Bartender for " << nEntries <<
" events" << endl;
101 cout <<
"BarWT" << threadID <<
">> Trees loaded. Starting Bartender for " << nEntries <<
" events" << endl;
104 auto start_chrono = chrono::high_resolution_clock::now();
107 bar->SetSamplingTimes();
110 for(Int_t k = 0; k < nEntries; k++)
116 for(Int_t j = 0; j < fNHits_F; j++)
117 bar->SetFrontWaveform(fCh_F->data()[j], fT_F->data()[j]);
119 for(Int_t j = 0; j < fNHits_B; j++)
126 if(nEntries < 10 || k % (nEntries / 10) == 0)
128 if(!isMultithreading)
129 cout <<
"\rBarST>> Processed " << k + 1 <<
" events" << flush;
131 cout <<
"\rBarWT" << threadID <<
">> Processed " << k + 1 <<
" events" << flush;
138 auto end_chrono = chrono::high_resolution_clock::now();
139 chrono::duration<double> duration = end_chrono - start_chrono;
142 if(!isMultithreading)
144 Bartender_Summary(sipmFilename, bar->
GetID(), duration.count());
148 lyso->ResetBranchAddresses();
149 delete fT_F, fT_B, fCh_F, fCh_B;