1 #include <calobase/TowerInfoDefs.h>
25 R__LOAD_LIBRARY(libcalo_io.so)
27 namespace myAnalysis {
29 void init(
const string& input_CEMC,
const string& outputFile =
"event-display/test.json",
const string& input_HCALIN =
"",
const string& input_HCALOUT =
"");
82 const float eta_map[] = {-1.05417, -0.9625, -0.870833,-0.779167,-0.6875, -0.595833,-0.504167,-0.4125,
83 -0.320833,-0.229167,-0.1375, -0.0458333,0.0458333,0.1375, 0.229167, 0.320833,
84 0.4125, 0.504167, 0.595833, 0.6875, 0.779167, 0.870833, 0.9625, 1.05417};
86 const float phi_map[] = {0.0490874, 0.147262, 0.245437, 0.343612, 0.441786, 0.539961, 0.638136, 0.736311,
87 0.834486, 0.93266, 1.03084, 1.12901, 1.22718, 1.32536, 1.42353, 1.52171,
88 1.61988, 1.71806, 1.81623, 1.91441, 2.01258, 2.11076, 2.20893, 2.30711,
89 2.40528, 2.50346, 2.60163, 2.69981, 2.79798, 2.89616, 2.99433, 3.09251,
90 3.19068, 3.28885, 3.38703, 3.4852, 3.58338, 3.68155, 3.77973, 3.8779,
91 3.97608, 4.07425, 4.17243, 4.2706, 4.36878, 4.46695, 4.56513, 4.6633,
92 4.76148, 4.85965, 4.95783, 5.056, 5.15418, 5.25235, 5.35052, 5.4487,
93 5.54687, 5.64505, 5.74322, 5.8414, 5.93957, 6.03775, 6.13592, 6.2341};
100 void myAnalysis::init(
const string& input_CEMC,
const string& outputFile,
const string& input_HCALIN,
const string& input_HCALOUT) {
103 if(!input_HCALIN.empty())
finput_HCALIN = TFile::Open(input_HCALIN.c_str());
104 if(!input_HCALOUT.empty())
finput_HCALOUT = TFile::Open(input_HCALOUT.c_str());
110 output.open(outputFile.c_str());
133 \"type\": \"Collision\",\n \
140 \"INNERTRACKER\": {\n \
141 \"type\": \"3D\",\n \
144 \"color\": 16777215\n \
148 \"type\": \"PROJECTIVE\",\n \
154 \"color\": 16766464,\n \
155 \"transparent\": 0.6,\n \
156 \"scaleminmax\": false\n \
160 \"type\": \"PROJECTIVE\",\n \
162 \"rmin\": 117.27,\n \
163 \"rmax\": 134.42,\n \
166 \"color\": 4290445312,\n \
167 \"transparent\": 0.6,\n \
168 \"scaleminmax\": false\n \
172 \"type\": \"PROJECTIVE\",\n \
175 \"rmax\": 274.317,\n \
178 \"color\": 24773,\n \
179 \"transparent\": 0.6,\n \
180 \"scaleminmax\": true\n \
190 bool first_entry =
true;
191 vector<Float_t>*
ADC = 0;
192 vector<Int_t>* chan = 0;
199 tree_CEMC->SetBranchAddress(
"chan",&chan);
201 UInt_t nchannels = ADC->size();
203 for(UInt_t
j = 0;
j < nchannels; ++
j) {
205 Float_t ADC_val = ADC->at(
j)/16;
211 cout <<
"CEMC invalid channel number: " << channel << endl;
219 h2ADC_CEMC->SetBinContent(etabin+1, phibin+1, ADC_val);
222 max_ADC = max(max_ADC, ADC_val);
231 output <<
"\"CEMC\": [{ \"eta\": " << eta <<
", \"phi\": " << phi <<
" , \"e\": " << e <<
"}\n";
234 else output <<
",{ \"eta\": " << eta <<
", \"phi\": " << phi <<
" , \"e\": " << e <<
"}\n";
237 cout <<
"CEMC Max ADC: " << max_ADC << endl;
240 else output <<
"\"CEMC\": [{}],\n";
252 UInt_t nchannels = ADC->size();
254 for(UInt_t
j = 0;
j < nchannels; ++
j) {
255 Float_t ADC_val = ADC->at(
j);
260 cout <<
"HCALIN invalid channel number: " << channel << endl;
268 h2ADC_HCALIN->SetBinContent(etabin+1, phibin+1, ADC_val);
271 max_ADC = max(max_ADC, ADC_val);
277 output <<
"\"HCALIN\": [{ \"eta\": " << eta <<
", \"phi\": " << phi <<
" , \"e\": " << e <<
"}\n";
280 else output <<
",{ \"eta\": " << eta <<
", \"phi\": " << phi <<
" , \"e\": " << e <<
"}\n";
283 cout <<
"HCALIN Max ADC: " << max_ADC << endl;
286 else output <<
"\"HCALIN\": [{}],\n";
298 UInt_t nchannels = ADC->size();
300 for(UInt_t
j = 0;
j < nchannels; ++
j) {
301 Float_t ADC_val = ADC->at(
j);
307 cout <<
"HCALOUT invalid channel number: " << channel << endl;
318 max_ADC = max(max_ADC, ADC_val);
324 output <<
"\"HCALOUT\": [{ \"eta\": " << eta <<
", \"phi\": " << phi <<
" , \"e\": " << e <<
"}\n";
327 else output <<
",{ \"eta\": " << eta <<
", \"phi\": " << phi <<
" , \"e\": " << e <<
"}\n";
332 cout <<
"HCALOUT Max ADC: " << max_ADC << endl;
335 else output <<
"\"HCALOUT\": [{}]\n";
342 \"INNERTRACKER\": []\n \
346 auto c1 =
new TCanvas();
352 c1->SetCanvasSize(1000, 1500);
354 c1->SetLeftMargin(.12);
355 c1->SetRightMargin(.15);
358 string outputFile =
"event-display/plots-" + run +
"-" +
event +
".pdf";
359 c1->Print((outputFile +
"[").c_str(),
"pdf portrait");
363 h2ADC_CEMC->SetTitle((
"ADC CEMC, Run: " + run +
", event: " + event).c_str());
370 auto tline =
new TLine();
372 for (UInt_t
i = 0;
i < 32; ++
i) {
375 for (UInt_t
i = 0;
i < 12; ++
i) {
378 c1->Print((outputFile).c_str(),
"pdf portrait");
381 c1->SetCanvasSize(1500, 1000);
383 hADC_CEMC->SetTitle((
"ADC CEMC, Run: " + run +
", event: " + event).c_str());
385 c1->Print((outputFile).c_str(),
"pdf portrait");
393 c1->SetCanvasSize(1000, 1500);
396 h2ADC_HCALIN->SetTitle((
"ADC HCALIN, Run: " + run +
", event: " + event).c_str());
398 c1->Print((outputFile).c_str(),
"pdf portrait");
400 c1->SetCanvasSize(1500, 1000);
402 hADC_HCALIN->SetTitle((
"ADC HCALIN, Run: " + run +
", event: " + event).c_str());
404 c1->Print((outputFile).c_str(),
"pdf portrait");
414 c1->SetCanvasSize(1000, 1500);
417 h2ADC_HCALOUT->SetTitle((
"ADC HCALOUT, Run: " + run +
", event: " + event).c_str());
419 c1->Print((outputFile).c_str(),
"pdf portrait");
421 c1->SetCanvasSize(1500, 1000);
423 hADC_HCALOUT->SetTitle((
"ADC HCALOUT, Run: " + run +
", event: " + event).c_str());
425 c1->Print((outputFile).c_str(),
"pdf portrait");
433 c1->Print((outputFile +
"]").c_str(),
"pdf portrait");
450 cout <<
"channel: " <<
channel <<
", etabin: " << etabin <<
", phibin: " << phibin << endl;
452 max_eta = max(max_eta, etabin);
453 max_phi = max(max_phi, phibin);
455 cout <<
"max etabin: " << max_eta <<
", max phibin: " << max_phi << endl;
460 const string& input_CEMC,
461 const string& outputFile=
"event-display/test.json",
462 const string& input_HCALIN =
"",
463 const string& input_HCALOUT =
"") {
470 int main(
int argc,
char* argv[]) {
471 if(argc < 1 || argc > 7){
472 cout <<
"usage: ./bin/event-display run event input_CEMC outputFile input_HCALIN input_HCALOUT" << endl;
473 cout <<
"run: run number." << endl;
474 cout <<
"event: event number." << endl;
475 cout <<
"input_CEMC: Location of CEMC root file." << endl;
476 cout <<
"outputFile: output json file. Default = event-display/test.json." << endl;
477 cout <<
"input_HCALIN: Location of HCALIN root file." << endl;
478 cout <<
"input_HCALOUT: Location of HCALOUT root file." << endl;
485 string output =
"event-display/test.json";
486 string input_HCALIN =
"";
487 string input_HCALOUT =
"";
496 input_CEMC = argv[3];
502 input_HCALIN = argv[5];
505 input_HCALOUT = argv[6];
507 event_display(run, event, input_CEMC, output, input_HCALIN, input_HCALOUT);
509 cout <<
"done" << endl;