Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EMCalCalib_TestBeam.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EMCalCalib_TestBeam.C
1 #include "EMCalCalib_TestBeam.h"
2 #include <fun4all/SubsysReco.h>
7 #include <phool/getClass.h>
11 #include <g4main/PHG4VtxPoint.h>
12 #include <g4main/PHG4Particle.h>
13 #include <g4hough/SvtxVertexMap.h>
14 #include <calobase/RawTowerContainer.h>
15 #include <calobase/RawTowerGeomContainer.h>
16 #include <calobase/RawTower.h>
17 #include <calobase/RawClusterContainer.h>
18 #include <calobase/RawCluster.h>
19 #include <g4eval/CaloEvalStack.h>
22 #include <g4eval/CaloTruthEval.h>
23 #include <g4eval/SvtxEvalStack.h>
24 #include <TNtuple.h>
25 #include <TFile.h>
26 #include <TH1F.h>
27 #include <TH2F.h>
28 #include <TVector3.h>
29 #include <TLorentzVector.h>
30 #include <exception>
31 #include <stdexcept>
32 #include <iostream>
33 #include <vector>
34 #include <set>
35 #include <algorithm>
36 #include <cassert>
37 #include <cmath>
38 
39 
40 using namespace std;
41 // TFile *f_TB=new TFile("output_Tower21_UIUC_2ndenergyscan_Production_0510_MIP_set4_Cosmic_16GeV_2280_hodo_tree11_Jul13.root","RECREATE");
42 
43 //TFile *f_TB=new TFile("output_0degree_45degree_energyscan_minus16GeV_2861_hodo_tree7_Jun17.root","RECREATE");
44  TFile *f_TB=new TFile("output_test.root","RECREATE");
45 
47 
48  SubsysReco("EMCalCalib_TestBeam"), _T_EMCalTrk(NULL), _filename(filename), _ievent(0)
49 
50 {
51 
52  Emax_t=0;
53  verbosity = 0;
54 
55 
56  test1=new TTree("test1","trial file");
57  test1->Branch("Etotal_t",&Etotal_t,"Etotal_t/F");
58  test1->Branch("Emax_t",&Emax_t,"Emax_t/F");
59  test1->Branch("E3by3_t",&E3by3_t,"E3by3_t/F");
60  test1->Branch("E5by5_t",&E5by5_t,"E5by5_t/F");
61  test1->Branch("C1_t",&C1_t,"C1_t/F");
62  test1->Branch("C2_inner_t",&C2_inner_t,"C2_inner_t/F");
63  test1->Branch("C2_outer_t",&C2_outer_t,"C2_outer_t/F");
64  test1->Branch("C2_inner_new_t",&C2_inner_new_t,"C2_inner_new_t/F");
65  test1->Branch("C2_outer_new_t",&C2_outer_new_t,"C2_outer_new_t/F");
66 
67  test1->Branch("Veto1_t",&Veto1_t,"Veto1_t/F");
68  test1->Branch("Veto2_t",&Veto2_t,"Veto2_t/F");
69  test1->Branch("Veto3_t",&Veto3_t,"Veto3_t/F");
70  test1->Branch("Veto4_t",&Veto4_t,"Veto4_t/F");
71  test1->Branch("Horz_HODO_R0_t",&Horz_HODO_R0_t,"Horz_HODO_R0_t/F");
72  test1->Branch("Horz_HODO_R1_t",&Horz_HODO_R1_t,"Horz_HODO_R1_t/F");
73  test1->Branch("Horz_HODO_R2_t",&Horz_HODO_R2_t,"Horz_HODO_R2_t/F");
74  test1->Branch("Horz_HODO_R3_t",&Horz_HODO_R3_t,"Horz_HODO_R3_t/F");
75  test1->Branch("Horz_HODO_R4_t",&Horz_HODO_R4_t,"Horz_HODO_R4_t/F");
76  test1->Branch("Horz_HODO_R5_t",&Horz_HODO_R5_t,"Horz_HODO_R5_t/F");
77  test1->Branch("Horz_HODO_R6_t",&Horz_HODO_R6_t,"Horz_HODO_R6_t/F");
78  test1->Branch("Horz_HODO_R7_t",&Horz_HODO_R7_t,"Horz_HODO_R7_t/F");
79  test1->Branch("Vert_HODO_R0_t",&Vert_HODO_R0_t,"Vert_HODO_R0_t/F");
80  test1->Branch("Vert_HODO_R1_t",&Vert_HODO_R1_t,"Vert_HODO_R1_t/F");
81  test1->Branch("Vert_HODO_R2_t",&Vert_HODO_R2_t,"Vert_HODO_R2_t/F");
82  test1->Branch("Vert_HODO_R3_t",&Vert_HODO_R3_t,"Vert_HODO_R3_t/F");
83  test1->Branch("Vert_HODO_R4_t",&Vert_HODO_R4_t,"Vert_HODO_R4_t/F");
84  test1->Branch("Vert_HODO_R5_t",&Vert_HODO_R5_t,"Vert_HODO_R5_t/F");
85  test1->Branch("Vert_HODO_R6_t",&Vert_HODO_R6_t,"Vert_HODO_R6_t/F");
86  test1->Branch("Vert_HODO_R7_t",&Vert_HODO_R7_t,"Vert_HODO_R7_t/F");
87  test1->Branch("TowerID_t",&TowerID_t,"TowerID_t/F");
88  test1->Branch("Tower_column_t",&Tower_column_t,"Tower_column_t/F");
89  test1->Branch("Tower_row_t",&Tower_row_t,"Tower_row_t/F");
90  test1->Branch("TowerE_column_0_t",&TowerE_column_0_t,"TowerE_column_0_t/F");
91  test1->Branch("TowerE_column_1_t",&TowerE_column_1_t,"TowerE_column_1_t/F");
92  test1->Branch("TowerE_column_2_t",&TowerE_column_2_t,"TowerE_column_2_t/F");
93  test1->Branch("TowerE_column_3_t",&TowerE_column_3_t,"TowerE_column_3_t/F");
94  test1->Branch("TowerE_column_4_t",&TowerE_column_4_t,"TowerE_column_4_t/F");
95  test1->Branch("TowerE_column_5_t",&TowerE_column_5_t,"TowerE_column_5_t/F");
96  test1->Branch("TowerE_column_6_t",&TowerE_column_6_t,"TowerE_column_6_t/F");
97  test1->Branch("TowerE_column_7_t",&TowerE_column_7_t,"TowerE_column_7_t/F");
98  test1->Branch("TowerE_row_0_t",&TowerE_row_0_t,"TowerE_row_0_t/F");
99  test1->Branch("TowerE_row_1_t",&TowerE_row_1_t,"TowerE_row_1_t/F");
100  test1->Branch("TowerE_row_2_t",&TowerE_row_2_t,"TowerE_row_2_t/F");
101  test1->Branch("TowerE_row_3_t",&TowerE_row_3_t,"TowerE_row_3_t/F");
102  test1->Branch("TowerE_row_4_t",&TowerE_row_4_t,"TowerE_row_4_t/F");
103  test1->Branch("TowerE_row_5_t",&TowerE_row_5_t,"TowerE_row_5_t/F");
104  test1->Branch("TowerE_row_6_t",&TowerE_row_6_t,"TowerE_row_6_t/F");
105  test1->Branch("TowerE_row_7_t",&TowerE_row_7_t,"TowerE_row_7_t/F");
106  test1->Branch("HorzTowerID_t",&HorzTowerID_t,"HorzTowerID_t/F");
107  test1->Branch("VertTowerID_t",&VertTowerID_t,"VertTowerID_t/F");
108  test1->Branch("SaveHoriz_TowerID0_t",&SaveHoriz_TowerID0_t,"SaveHoriz_TowerID0_t/F");
109  test1->Branch("SaveHoriz_TowerID1_t",&SaveHoriz_TowerID1_t,"SaveHoriz_TowerID1_t/F");
110  test1->Branch("SaveHoriz_TowerID2_t",&SaveHoriz_TowerID2_t,"SaveHoriz_TowerID2_t/F");
111  test1->Branch("SaveHoriz_TowerID3_t",&SaveHoriz_TowerID3_t,"SaveHoriz_TowerID3_t/F");
112  test1->Branch("SaveHoriz_TowerID4_t",&SaveHoriz_TowerID4_t,"SaveHoriz_TowerID4_t/F");
113  test1->Branch("SaveHoriz_TowerID5_t",&SaveHoriz_TowerID5_t,"SaveHoriz_TowerID5_t/F");
114  test1->Branch("SaveHoriz_TowerID6_t",&SaveHoriz_TowerID6_t,"SaveHoriz_TowerID6_t/F");
115  test1->Branch("SaveHoriz_TowerID7_t",&SaveHoriz_TowerID7_t,"SaveHoriz_TowerID7_t/F");
116  test1->Branch("SaveVert_TowerID0_t",&SaveVert_TowerID0_t,"SaveVert_TowerID0_t/F");
117  test1->Branch("SaveVert_TowerID1_t",&SaveVert_TowerID1_t,"SaveVert_TowerID1_t/F");
118  test1->Branch("SaveVert_TowerID2_t",&SaveVert_TowerID2_t,"SaveVert_TowerID2_t/F");
119  test1->Branch("SaveVert_TowerID3_t",&SaveVert_TowerID3_t,"SaveVert_TowerID3_t/F");
120  test1->Branch("SaveVert_TowerID4_t",&SaveVert_TowerID4_t,"SaveVert_TowerID4_t/F");
121  test1->Branch("SaveVert_TowerID5_t",&SaveVert_TowerID5_t,"SaveVert_TowerID5_t/F");
122  test1->Branch("SaveVert_TowerID6_t",&SaveVert_TowerID6_t,"SaveVert_TowerID6_t/F");
123  test1->Branch("SaveVert_TowerID7_t",&SaveVert_TowerID7_t,"SaveVert_TowerID7_t/F");
124 
125 
126 }
127 
128 
130 
131 {
132 
133 
134 
135 }
136 
137 
138 int
140 {
141 
142  _ievent = 0;
143  Emax_t=0;
144  Etotal_t=0;
145  E3by3_t=0;
146  E5by5_t=0;
147  C1_t=0;
148  C2_inner_t=0;
149  C2_outer_t=0;
150  C2_inner_new_t=0;
151  C2_outer_new_t=0;
152 
153  Veto1_t=0;
154  Veto2_t=0;
155  Veto3_t=0;
156  Veto4_t=0;
157  Horz_HODO_R0_t=0;
158  Horz_HODO_R1_t=0;
159  Horz_HODO_R2_t=0;
160  Horz_HODO_R3_t=0;
161  Horz_HODO_R4_t=0;
162  Horz_HODO_R5_t=0;
163  Horz_HODO_R6_t=0;
164  Horz_HODO_R7_t=0;
165 
166  Vert_HODO_R0_t=0;
167  Vert_HODO_R1_t=0;
168  Vert_HODO_R2_t=0;
169  Vert_HODO_R3_t=0;
170  Vert_HODO_R4_t=0;
171  Vert_HODO_R5_t=0;
172  Vert_HODO_R6_t=0;
173  Vert_HODO_R7_t=0;
174  TowerID_t=0;
175  Tower_column_t=0;
176  Tower_row_t=0;
185  TowerE_row_0_t=0;
186  TowerE_row_1_t=0;
187  TowerE_row_2_t=0;
188  TowerE_row_3_t=0;
189  TowerE_row_4_t=0;
190  TowerE_row_5_t=0;
191  TowerE_row_6_t=0;
192  TowerE_row_7_t=0;
193  HorzTowerID_t=0;
194  VertTowerID_t=0;
211 
212 
213  PHNodeIterator iter(topNode);
214 
215  PHCompositeNode *dstNode = static_cast<PHCompositeNode*>(iter.findFirst(
216 
217  "PHCompositeNode", "DST"));
218 
219  if (!dstNode)
220 
221  {
222 
223  std::cerr << PHWHERE << "DST Node missing, doing nothing." << std::endl;
224 
225  throw runtime_error(
226 
227  "Failed to find DST node in EmcRawTowerBuilder::CreateNodes");
228  }
229 
231 
232 }
233 
234 
235 int
236 
238 
239 {
240  // test1->Write();
241  f_TB->Write();
242 
243  cout << "EMCalCalib::End - write to " << _filename << endl;
244 
246 
247 
249 
250  assert(hm);
251 
252 
253 
254 
255  // help index files with TChain
256 
257  TTree * T_Index = new TTree("T_Index", "T_Index");
258 
259  assert(T_Index);
260 
261  T_Index->Write();
262 
264 
265 }
266 
267 
268 int
269 
271 
272 {
273 
274  _ievent = 0;
275  Emax_t=0;
276  Etotal_t=0;
277  E3by3_t=0;
278  E5by5_t=0;
279  C1_t=0;
280  C2_inner_t=0;
281  C2_outer_t=0;
282 
283  C2_inner_new_t=0;
284  C2_outer_new_t=0;
285 
286  Veto1_t=0;
287  Veto2_t=0;
288  Veto3_t=0;
289  Veto4_t=0;
290 
291  Horz_HODO_R0_t=0;
292  Horz_HODO_R1_t=0;
293  Horz_HODO_R2_t=0;
294  Horz_HODO_R3_t=0;
295  Horz_HODO_R4_t=0;
296  Horz_HODO_R5_t=0;
297  Horz_HODO_R6_t=0;
298  Horz_HODO_R7_t=0;
299 
300  Vert_HODO_R0_t=0;
301  Vert_HODO_R1_t=0;
302  Vert_HODO_R2_t=0;
303  Vert_HODO_R3_t=0;
304  Vert_HODO_R4_t=0;
305  Vert_HODO_R5_t=0;
306  Vert_HODO_R6_t=0;
307  Vert_HODO_R7_t=0;
308  TowerID_t=0;
309  Tower_column_t=0;
310  Tower_row_t=0;
319  TowerE_row_0_t=0;
320  TowerE_row_1_t=0;
321  TowerE_row_2_t=0;
322  TowerE_row_3_t=0;
323  TowerE_row_4_t=0;
324  TowerE_row_5_t=0;
325  TowerE_row_6_t=0;
326  TowerE_row_7_t=0;
327  HorzTowerID_t=0;
328  VertTowerID_t=0;
345 
346 
347 
348 
349  cout << "EMCalCalib_TestBeam::get_HistoManager - Making PHTFileServer " << _filename
350 
351  << endl;
352 
353  PHTFileServer::get().open(_filename, "RECREATE");
354 
355 
356 
357 
358  cout << "EMCalCalib_TestBeam::Init - Process tower occupancies" << endl;
359 
360  Init_Tower(topNode); //goes here 4-14-2016
361 
362 
363 
364 
365 
366 
368 
369 }
370 
371 
372 int
373 
375 
376 {
377 
378 
379  if (verbosity > 0)
380 
381  cout << "EMCalCalib_TestBeam::process_event() entered" << endl;
382 
383 
384 
385 
386  process_event_Tower(topNode);
387 
389 
390 }
391 
392 
393 
394 
395 
397 
399 
400 {
401 
402 
404 
405  Fun4AllHistoManager *hm = se->getHistoManager("EMCalAna_HISTOS");
406 
407 
408  if (not hm)
409 
410  {
411 
412  cout
413 
414  << "EMCalCalib::get_HistoManager - Making Fun4AllHistoManager EMCalAna_HISTOS"
415 
416  << endl;
417 
418  hm = new Fun4AllHistoManager("EMCalAna_HISTOS");
419 
420  se->registerHistoManager(hm);
421 
422  }
423 
424 
425  assert(hm);
426 
427 
428  return hm;
429 
430 }
431 
432 
433 int
434 
436 
437 {
438 
440 
441  assert(hm);
442 
443 
444 
446 
447 }
448 
449 
450 int
451 
453 
454 {
455 
456  const string detector("CEMC");
457  const string chrenkov1("C1");
458  const string chrenkov2("C2");
459  const string HODO_V("HODO_VERTICAL");
460  const string HODO_H("HODO_HORIZONTAL");
461  const string VETO("TRIGGER_VETO");
462 
463  cout << "EMCalCalib::process_event_Tower() entered !!" << endl;
464 
465  string towernodename = "TOWER_CALIB_" + detector;
466  string towernodename1="TOWER_CALIB_" + chrenkov1;
467  string towernodename2="TOWER_CALIB_" + chrenkov2;
468 
469  string towernodename3="TOWER_CALIB_" + HODO_V;
470  string towernodename4="TOWER_CALIB_" + HODO_H;
471 
472  string towernodename5="TOWER_CALIB_" + VETO;
473 
474  string towernodename6="TOWER_RAW_"+ chrenkov2;
475 
476  // Grab the towers
477 
478  RawTowerContainer* towers = findNode::getClass<RawTowerContainer>(topNode, towernodename.c_str());
479  RawTowerContainer* towers_sub1 = findNode::getClass<RawTowerContainer>(topNode, towernodename1.c_str());
480  RawTowerContainer* towers_sub2 = findNode::getClass<RawTowerContainer>(topNode, towernodename2.c_str());
481  RawTowerContainer* towers_sub3= findNode::getClass<RawTowerContainer>(topNode,towernodename3.c_str());
482  RawTowerContainer* towers_sub4= findNode::getClass<RawTowerContainer>(topNode,towernodename4.c_str());
483  RawTowerContainer* towers_sub5= findNode::getClass<RawTowerContainer>(topNode,towernodename5.c_str());
484 
485 
486  Float_t Emax=0;
487  Float_t eta_max=0;
488  Float_t phi_max=0;
489  Float_t energy_tower=0;
490  Float_t sumE=0;
491  Float_t saveHoriz=0;
492  Float_t saveVert=0;
493 
494  Float_t energy_chrenk1=0;
495 
496  Float_t energy_chrenk2_C2inner=0;
497  Float_t energy_chrenk2_C2outer=0;
498  Float_t energy_chrenk2_C2inner_new=0;//new as of 6-23
499  Float_t energy_chrenk2_C2outer_new=0;//new as of 6-23
500 
501  Float_t Horizontal_HODO_R0=abs(towers_sub4->getTower(0,0)->get_energy());
502  Float_t Horizontal_HODO_R1=abs(towers_sub4->getTower(0,1)->get_energy());
503  Float_t Horizontal_HODO_R2=abs(towers_sub4->getTower(0,2)->get_energy());
504  Float_t Horizontal_HODO_R3=abs(towers_sub4->getTower(0,3)->get_energy());
505  Float_t Horizontal_HODO_R4=abs(towers_sub4->getTower(0,4)->get_energy());
506  Float_t Horizontal_HODO_R5=abs(towers_sub4->getTower(0,5)->get_energy());
507  Float_t Horizontal_HODO_R6=abs(towers_sub4->getTower(0,6)->get_energy());
508  Float_t Horizontal_HODO_R7=abs(towers_sub4->getTower(0,7)->get_energy());
509 
510  Float_t Vertical_HODO_R0=abs(towers_sub3->getTower(0,0)->get_energy());
511  Float_t Vertical_HODO_R1=abs(towers_sub3->getTower(0,1)->get_energy());
512  Float_t Vertical_HODO_R2=abs(towers_sub3->getTower(0,2)->get_energy());
513  Float_t Vertical_HODO_R3=abs(towers_sub3->getTower(0,3)->get_energy());
514  Float_t Vertical_HODO_R4=abs(towers_sub3->getTower(0,4)->get_energy());
515  Float_t Vertical_HODO_R5=abs(towers_sub3->getTower(0,5)->get_energy());
516  Float_t Vertical_HODO_R6=abs(towers_sub3->getTower(0,6)->get_energy());
517  Float_t Vertical_HODO_R7=abs(towers_sub3->getTower(0,7)->get_energy());
518 
519  Float_t Veto_Trig0=abs(towers_sub5->getTower(0,0)->get_energy());
520  Float_t Veto_Trig1=abs(towers_sub5->getTower(0,1)->get_energy());
521  Float_t Veto_Trig2=abs(towers_sub5->getTower(0,2)->get_energy());
522  Float_t Veto_Trig3=abs(towers_sub5->getTower(0,3)->get_energy());
523 
524  Float_t SaveHoriz_TowerID0=abs(towers_sub3->getTower(0,0)->get_id());
525  Float_t SaveHoriz_TowerID1=abs(towers_sub3->getTower(0,1)->get_id());
526  Float_t SaveHoriz_TowerID2=abs(towers_sub3->getTower(0,2)->get_id());
527  Float_t SaveHoriz_TowerID3=abs(towers_sub3->getTower(0,3)->get_id());
528  Float_t SaveHoriz_TowerID4=abs(towers_sub3->getTower(0,4)->get_id());
529  Float_t SaveHoriz_TowerID5=abs(towers_sub3->getTower(0,5)->get_id());
530  Float_t SaveHoriz_TowerID6=abs(towers_sub3->getTower(0,6)->get_id());
531  Float_t SaveHoriz_TowerID7=abs(towers_sub3->getTower(0,7)->get_id());
532 
533  Float_t SaveVert_TowerID0=abs(towers_sub4->getTower(0,0)->get_id());
534  Float_t SaveVert_TowerID1=abs(towers_sub4->getTower(0,1)->get_id());
535  Float_t SaveVert_TowerID2=abs(towers_sub4->getTower(0,2)->get_id());
536  Float_t SaveVert_TowerID3=abs(towers_sub4->getTower(0,3)->get_id());
537  Float_t SaveVert_TowerID4=abs(towers_sub4->getTower(0,4)->get_id());
538  Float_t SaveVert_TowerID5=abs(towers_sub4->getTower(0,5)->get_id());
539  Float_t SaveVert_TowerID6=abs(towers_sub4->getTower(0,6)->get_id());
540  Float_t SaveVert_TowerID7=abs(towers_sub4->getTower(0,7)->get_id());
541 
542 
543 
544  Float_t ColumnE_0=abs(towers->getTower(0,0)->get_energy()+ towers->getTower(0,1)->get_energy() +
545  towers->getTower(0,2)->get_energy()+towers->getTower(0,3)->get_energy()+
546  towers->getTower(0,4)->get_energy()+towers->getTower(0,5)->get_energy()+
547  towers->getTower(0,6)->get_energy()+towers->getTower(0,7)->get_energy());
548 
549  Float_t ColumnE_1=abs(towers->getTower(1,0)->get_energy()+ towers->getTower(1,1)->get_energy() +
550  towers->getTower(1,2)->get_energy()+towers->getTower(1,3)->get_energy()+
551  towers->getTower(1,4)->get_energy()+towers->getTower(1,5)->get_energy()+
552  towers->getTower(1,6)->get_energy()+towers->getTower(1,7)->get_energy());
553 
554  Float_t ColumnE_2=abs(towers->getTower(2,0)->get_energy()+ towers->getTower(2,1)->get_energy() +
555  towers->getTower(2,2)->get_energy()+towers->getTower(2,3)->get_energy()+
556  towers->getTower(2,4)->get_energy()+towers->getTower(2,5)->get_energy()+
557  towers->getTower(2,6)->get_energy()+towers->getTower(2,7)->get_energy());
558 
559  Float_t ColumnE_3=abs(towers->getTower(3,0)->get_energy()+ towers->getTower(3,1)->get_energy() +
560  towers->getTower(3,2)->get_energy()+towers->getTower(3,3)->get_energy()+
561  towers->getTower(3,4)->get_energy()+towers->getTower(3,5)->get_energy()+
562  towers->getTower(3,6)->get_energy()+towers->getTower(3,7)->get_energy());
563 
564  Float_t ColumnE_4=abs(towers->getTower(4,0)->get_energy()+ towers->getTower(4,1)->get_energy() +
565  towers->getTower(4,2)->get_energy()+towers->getTower(4,3)->get_energy()+
566  towers->getTower(4,4)->get_energy()+towers->getTower(4,5)->get_energy()+
567  towers->getTower(4,6)->get_energy()+towers->getTower(4,7)->get_energy());
568 
569  Float_t ColumnE_5=abs(towers->getTower(5,0)->get_energy()+ towers->getTower(5,1)->get_energy() +
570  towers->getTower(5,2)->get_energy()+towers->getTower(5,3)->get_energy()+
571  towers->getTower(5,4)->get_energy()+towers->getTower(5,5)->get_energy()+
572  towers->getTower(5,6)->get_energy()+towers->getTower(5,7)->get_energy());
573 
574  Float_t ColumnE_6=abs(towers->getTower(6,0)->get_energy()+ towers->getTower(6,1)->get_energy() +
575  towers->getTower(6,2)->get_energy()+towers->getTower(6,3)->get_energy()+
576  towers->getTower(6,4)->get_energy()+towers->getTower(6,5)->get_energy()+
577  towers->getTower(6,6)->get_energy()+towers->getTower(6,7)->get_energy());
578 
579  Float_t ColumnE_7=abs(towers->getTower(7,0)->get_energy()+ towers->getTower(7,1)->get_energy() +
580  towers->getTower(7,2)->get_energy()+towers->getTower(7,3)->get_energy()+
581  towers->getTower(7,4)->get_energy()+towers->getTower(7,5)->get_energy()+
582  towers->getTower(7,6)->get_energy()+towers->getTower(7,7)->get_energy());
583 
584  Float_t RowE_0=abs(towers->getTower(0,0)->get_energy()+ towers->getTower(1,0)->get_energy() +
585  towers->getTower(2,0)->get_energy()+towers->getTower(3,0)->get_energy()+
586  towers->getTower(4,0)->get_energy()+towers->getTower(5,0)->get_energy()+
587  towers->getTower(6,0)->get_energy()+towers->getTower(7,0)->get_energy());
588 
589  Float_t RowE_1=abs(towers->getTower(0,1)->get_energy()+ towers->getTower(1,1)->get_energy() +
590  towers->getTower(2,1)->get_energy()+towers->getTower(3,1)->get_energy()+
591  towers->getTower(4,1)->get_energy()+towers->getTower(5,1)->get_energy()+
592  towers->getTower(6,1)->get_energy()+towers->getTower(7,1)->get_energy());
593 
594  Float_t RowE_2=abs(towers->getTower(0,2)->get_energy()+ towers->getTower(1,2)->get_energy()+
595  towers->getTower(2,2)->get_energy()+towers->getTower(3,2)->get_energy()+
596  towers->getTower(4,2)->get_energy()+towers->getTower(5,2)->get_energy()+
597  towers->getTower(6,2)->get_energy()+towers->getTower(7,2)->get_energy());
598 
599  Float_t RowE_3=abs(towers->getTower(0,3)->get_energy()+ towers->getTower(1,3)->get_energy() +
600  towers->getTower(2,3)->get_energy()+towers->getTower(3,3)->get_energy()+
601  towers->getTower(4,3)->get_energy()+towers->getTower(5,3)->get_energy()+
602  towers->getTower(6,3)->get_energy()+towers->getTower(7,3)->get_energy());
603 
604  Float_t RowE_4=abs(towers->getTower(0,4)->get_energy()+ towers->getTower(1,4)->get_energy() +
605  towers->getTower(2,4)->get_energy()+towers->getTower(3,4)->get_energy()+
606  towers->getTower(4,4)->get_energy()+towers->getTower(5,4)->get_energy()+
607  towers->getTower(6,4)->get_energy()+towers->getTower(7,4)->get_energy());
608 
609  Float_t RowE_5=abs(towers->getTower(0,5)->get_energy()+ towers->getTower(1,5)->get_energy() +
610  towers->getTower(2,5)->get_energy()+towers->getTower(3,5)->get_energy()+
611  towers->getTower(4,5)->get_energy()+towers->getTower(5,5)->get_energy()+
612  towers->getTower(6,5)->get_energy()+towers->getTower(7,5)->get_energy());
613 
614  Float_t RowE_6=abs(towers->getTower(0,6)->get_energy()+ towers->getTower(1,6)->get_energy() +
615  towers->getTower(2,6)->get_energy()+towers->getTower(3,6)->get_energy()+
616  towers->getTower(4,6)->get_energy()+towers->getTower(5,6)->get_energy()+
617  towers->getTower(6,6)->get_energy()+towers->getTower(7,6)->get_energy());
618 
619  Float_t RowE_7=abs(towers->getTower(0,7)->get_energy()+ towers->getTower(1,7)->get_energy() +
620  towers->getTower(2,7)->get_energy()+towers->getTower(3,7)->get_energy()+
621  towers->getTower(4,7)->get_energy()+towers->getTower(5,7)->get_energy()+
622  towers->getTower(6,7)->get_energy()+towers->getTower(7,7)->get_energy());
623 
624 
625 
626  Veto1_t=Veto_Trig0;
627  Veto2_t=Veto_Trig1;
628  Veto3_t=Veto_Trig2;
629  Veto4_t=Veto_Trig3;
630 
631 
632 
633 
634  SaveHoriz_TowerID0_t=SaveHoriz_TowerID0;
635  SaveHoriz_TowerID1_t=SaveHoriz_TowerID1;
636  SaveHoriz_TowerID2_t=SaveHoriz_TowerID2;
637  SaveHoriz_TowerID3_t=SaveHoriz_TowerID3;
638  SaveHoriz_TowerID4_t=SaveHoriz_TowerID4;
639  SaveHoriz_TowerID5_t=SaveHoriz_TowerID5;
640  SaveHoriz_TowerID6_t=SaveHoriz_TowerID6;
641  SaveHoriz_TowerID7_t=SaveHoriz_TowerID7;
642  SaveVert_TowerID0_t=SaveVert_TowerID0;
643  SaveVert_TowerID1_t=SaveVert_TowerID1;
644  SaveVert_TowerID2_t=SaveVert_TowerID2;
645  SaveVert_TowerID3_t=SaveVert_TowerID3;
646  SaveVert_TowerID4_t=SaveVert_TowerID4;
647  SaveVert_TowerID5_t=SaveVert_TowerID5;
648  SaveVert_TowerID6_t=SaveVert_TowerID6;
649  SaveVert_TowerID7_t=SaveVert_TowerID7;
650 
651  energy_chrenk1=towers_sub1->getTower(0,0)->get_energy();
652  cout<<endl;
653  energy_chrenk2_C2inner=towers_sub2->getTower(0)->get_energy();
654  energy_chrenk2_C2outer=towers_sub2->getTower(1)->get_energy();
655 
656  //use the following two lines for the joint HCAL/EMCAL scan
657 
658  // energy_chrenk2_C2inner_new=towers_sub2->getTower(10)->get_energy();
659  //energy_chrenk2_C2outer_new=towers_sub2->getTower(11)->get_energy();
660 
661 
662 
663 
664  C1_t=energy_chrenk1;
665  C2_inner_t=energy_chrenk2_C2inner;
666  C2_outer_t=energy_chrenk2_C2outer;
667  C2_inner_new_t=energy_chrenk2_C2inner_new;
668  C2_outer_new_t=energy_chrenk2_C2outer_new;
669 
670 
672  //conditional energy cuts to HODOSCOPES
674  Vert_HODO_R0_t=Vertical_HODO_R0;
675  Vert_HODO_R1_t=Vertical_HODO_R1;
676  Vert_HODO_R2_t=Vertical_HODO_R2;
677  Vert_HODO_R3_t=Vertical_HODO_R3;
678  Vert_HODO_R4_t=Vertical_HODO_R4;
679  Vert_HODO_R5_t=Vertical_HODO_R5;
680  Vert_HODO_R6_t=Vertical_HODO_R6;
681  Vert_HODO_R7_t=Vertical_HODO_R7;
682 
683  //store the horizontal hodos in tree
684  // if(Horizontal_HODO_R0>30)
685  Horz_HODO_R0_t=Horizontal_HODO_R0;
686  Horz_HODO_R1_t=Horizontal_HODO_R1;
687  Horz_HODO_R2_t=Horizontal_HODO_R2;
688  Horz_HODO_R3_t=Horizontal_HODO_R3;
689  Horz_HODO_R4_t=Horizontal_HODO_R4;
690  Horz_HODO_R5_t=Horizontal_HODO_R5;
691  Horz_HODO_R6_t=Horizontal_HODO_R6;
692  Horz_HODO_R7_t=Horizontal_HODO_R7;
693 
694 
695  //store the column in tree
696  TowerE_column_0_t=ColumnE_0;
697  TowerE_column_1_t=ColumnE_1;
698  TowerE_column_2_t=ColumnE_2;
699  TowerE_column_3_t=ColumnE_3;
700  TowerE_column_4_t=ColumnE_4;
701  TowerE_column_5_t=ColumnE_5;
702  TowerE_column_6_t=ColumnE_6;
703  TowerE_column_7_t=ColumnE_7;
704 
705  //store the row in tree
706  TowerE_row_0_t=RowE_0;
707  TowerE_row_1_t=RowE_1;
708  TowerE_row_2_t=RowE_2;
709  TowerE_row_3_t=RowE_3;
710  TowerE_row_4_t=RowE_4;
711  TowerE_row_5_t=RowE_5;
712  TowerE_row_6_t=RowE_6;
713  TowerE_row_7_t=RowE_7;
714 
715 
716  // Float_t getTowerID=0;
717  Float_t getHorzTowerID=0;
718  Float_t getVertTowerID=0;
719 
720 
721 
722  //loop through to find Emax
723 for (int i=0; i<8;i++){//eta (x)
724  for (int j=0; j<8;j++){//phi(y)
725  energy_tower=abs(towers->getTower(i,j)->get_energy());
726  getHorzTowerID=towers_sub4->getTower(0,j)->get_id();
727  getVertTowerID=towers_sub3->getTower(0,j)->get_id();
728 
729 
730  if (energy_tower>Emax &&energy_tower>0 )
731  {
732  Emax=energy_tower;//stores the max energy value here
733  Emax_t=Emax;
734  eta_max=i;
735  phi_max=j;
736  }
737  sumE=sumE+energy_tower;
738  saveHoriz=getHorzTowerID;
739  saveVert=getVertTowerID;
740  Etotal_t=sumE;
741  HorzTowerID_t=saveHoriz;
742  VertTowerID_t=saveVert;
743 
744 
745 
746 
747 
748 
749 
750  }//end j
751 
752 
753 
754  }//end i
755 
756 //for 3by3 array
757  Float_t tower_x_1_y_1=0;
758  Float_t tower_x_1_y=0;
759  Float_t tower_x_1_yplus1=0;
760 
761  Float_t tower_x_y_1=0;
762  Float_t tower_x_yplus1=0;
763 
764  Float_t tower_xplus1_y_1=0;
765  Float_t tower_xplus1_y=0;
766  Float_t tower_xplus1_yplus1=0;
767 
768  //for 3by3 && 5by5 array
769  Float_t tower_x_2_y_2=0;
770  Float_t tower_x_2_y_1=0;
771  Float_t tower_x_2_y=0;
772  Float_t tower_x_2_yplus1=0;
773  Float_t tower_x_2_yplus2=0;
774 
775  Float_t tower_x_1_y_2=0;
776  Float_t tower_x_1_yplus2=0;
777 
778  Float_t tower_x_y_2=0;
779  Float_t tower_x_yplus2=0;
780 
781  Float_t tower_xplus1_y_2=0;
782  Float_t tower_xplus1_yplus2=0;
783 
784  Float_t tower_xplus2_y_2=0;
785  Float_t tower_xplus2_y_1=0;
786  Float_t tower_xplus2_y=0;
787  Float_t tower_xplus2_yplus1=0;
788  Float_t tower_xplus2_yplus2=0;
789 
790 
791  Float_t E_3by3=0;
792  Float_t E_5by5=0;
793 
794  RawTowerContainer* towersmax = findNode::getClass<RawTowerContainer>(topNode, towernodename.c_str());
795 
796  //pass through data to grab row info
797  for (int i=0;i<8;i++)
798  {
799  for (int j=0;j<8;j++)
800  {
801  if (i==eta_max&&j==phi_max)
802  { Tower_row_t=towers_sub4->getTower(0,j)->get_id();
803  Tower_column_t=towers_sub3->getTower(0,0)->get_id();
804  }
805  }
806  }
807 
808 
809 //2nd loop through the data with Emax
810  for (int i=2; i<6;i++){//eta (x)
811  for (int j=2; j<6;j++){//phi(y)
812  if (i==eta_max&&j==phi_max)
813  {
814  //for 3by3 array
815  tower_x_1_y_1=towersmax->getTower(i-1,j-1)->get_energy();
816  tower_x_1_y=towersmax->getTower(i-1,j)->get_energy();
817  tower_x_1_yplus1=towersmax->getTower(i-1,j+1)->get_energy();
818 
819  tower_x_y_1=towersmax->getTower(i,j-1)->get_energy();
820  tower_x_yplus1=towersmax->getTower(i,j+1)->get_energy();
821 
822  tower_xplus1_y_1=towersmax->getTower(i+1,j-1)->get_energy();
823  tower_xplus1_y=towersmax->getTower(i+1,j)->get_energy();
824  tower_xplus1_yplus1=towersmax->getTower(i+1,j+1)->get_energy();
825 
826  //for 5by5 array
827  tower_x_2_y_2=towersmax->getTower(i-2,j-2)->get_energy();
828  tower_x_2_y_1=towersmax->getTower(i-2,j-1)->get_energy();
829  tower_x_2_y=towersmax->getTower(i-2,j)->get_energy();
830  tower_x_2_yplus1=towersmax->getTower(i-2,j+1)->get_energy();
831  tower_x_2_yplus2=towersmax->getTower(i-2,j+2)->get_energy();
832 
833  tower_x_1_y_2=towersmax->getTower(i-1,j-2)->get_energy();
834  tower_x_1_yplus2=towersmax->getTower(i-1,j+2)->get_energy();
835 
836  tower_x_y_2=towersmax->getTower(i,j-2)->get_energy();
837  tower_x_yplus2=towersmax->getTower(i,j+2)->get_energy();
838 
839  tower_xplus1_y_2=towersmax->getTower(i+1,j-2)->get_energy();
840  tower_xplus1_yplus2=towersmax->getTower(i+1,j+2)->get_energy();
841 
842  tower_xplus2_y_2=towersmax->getTower(i+2,j-2)->get_energy();
843  tower_xplus2_y_1=towersmax->getTower(i+2,j-1)->get_energy();
844  tower_xplus2_y=towersmax->getTower(i+2,j)->get_energy();
845  tower_xplus2_yplus1=towersmax->getTower(i+2,j+1)->get_energy();
846  tower_xplus2_yplus2=towersmax->getTower(i+2,j+2)->get_energy();
847 
848  // getTowerID=towersmax->getTower(i,j)->get_id();
849 
850 
851  E_3by3=tower_x_1_y_1+tower_x_1_y+tower_x_1_yplus1+tower_x_y_1+
852  tower_x_yplus1+ tower_xplus1_y_1+ tower_xplus1_y+ tower_xplus1_yplus1+Emax;
853 
854  E_5by5=tower_x_1_y_1+tower_x_1_y+tower_x_1_yplus1+tower_x_y_1+
855  tower_x_yplus1+tower_xplus1_y_1+ tower_xplus1_y+ tower_xplus1_yplus1+
856  tower_x_2_y_2+tower_x_2_y_1+tower_x_2_y+ tower_x_2_yplus1+
857  tower_x_2_yplus2+tower_x_1_y_2+tower_x_1_yplus2+ tower_x_y_2+
858  tower_x_yplus2+tower_xplus1_y_2+tower_xplus1_yplus2+tower_xplus2_y_2+
859  tower_xplus2_y_1+tower_xplus2_y+tower_xplus2_yplus1+tower_xplus2_yplus2+Emax;
860 
861  E3by3_t=E_3by3;
862  E5by5_t=E_5by5;
863 
864  }
865 
866 
867 
868  }
869  }
870 
871  // TowerID_t=getTowerID;
872  TowerE_column_0_t=ColumnE_0;
873  TowerE_column_1_t=ColumnE_1;
874  TowerE_column_2_t=ColumnE_2;
875  TowerE_column_3_t=ColumnE_3;
876  TowerE_column_4_t=ColumnE_4;
877  TowerE_column_5_t=ColumnE_5;
878  TowerE_column_6_t=ColumnE_6;
879  TowerE_column_7_t=ColumnE_7;
880 
881  TowerE_row_0_t=RowE_0;
882  TowerE_row_1_t=RowE_1;
883  TowerE_row_2_t=RowE_2;
884  TowerE_row_3_t=RowE_3;
885  TowerE_row_4_t=RowE_4;
886  TowerE_row_5_t=RowE_5;
887  TowerE_row_6_t=RowE_6;
888  TowerE_row_7_t=RowE_7;
889 
890  HorzTowerID_t=getHorzTowerID;
891 
892  VertTowerID_t=getVertTowerID;
893 
894  cout<<"HERE IS sum E :"<<sumE<<"Here is the eta max : "
895  <<eta_max<<" Here is phi max : "<<phi_max<<endl;
896  cout<<"HERE IS tower E :"<<energy_tower<<"E max :"<<Emax<<endl;
897 
898 
899  test1->Fill();
900 
902 
903 
904 }
905