Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Prototype2_DSTReader.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Prototype2_DSTReader.C
1 #define Prototype2_DSTReader_cxx
2 // The class definition in Prototype2_DSTReader.h has been generated automatically
3 // by the ROOT utility TTree::MakeSelector(). This class is derived
4 // from the ROOT class TSelector. For more information on the TSelector
5 // framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
6 
7 // The following methods are defined in this file:
8 // Begin(): called every time a loop on the tree starts,
9 // a convenient place to create your histograms.
10 // SlaveBegin(): called after Begin(), when on PROOF called only on the
11 // slave servers.
12 // Process(): called for each event, in this function you decide what
13 // to read and fill your histograms.
14 // SlaveTerminate: called at the end of the loop on the tree, when on PROOF
15 // called only on the slave servers.
16 // Terminate(): called at the end of the loop on the tree,
17 // a convenient place to draw/fit your histograms.
18 //
19 // To use this file, try the following session on your Tree T:
20 //
21 // Root > T->Process("Prototype2_DSTReader.C")
22 // Root > T->Process("Prototype2_DSTReader.C","some options")
23 // Root > T->Process("Prototype2_DSTReader.C+")
24 //
25 
26 #include "Prototype2_DSTReader.h"
27 #include <TH2.h>
28 #include <TStyle.h>
29 #include <iostream>
30 
31 using namespace std;
32 
33 void
34 Prototype2_DSTReader::Begin(TTree * /*tree*/)
35 {
36  // The Begin() function is called at the start of the query.
37  // When running with PROOF Begin() is only called on the client.
38  // The tree argument is deprecated (on PROOF 0 is passed).
39 
40  TString option = GetOption();
41 
42  fout.open(fOption, ios_base::out);
43 }
44 
45 void
47 {
48  // The SlaveBegin() function is called after the Begin() function.
49  // When running with PROOF SlaveBegin() is called on each slave server.
50  // The tree argument is deprecated (on PROOF 0 is passed).
51 
52  TString option = GetOption();
53 
54 }
55 
56 Bool_t
58 {
59  // The Process() function is called for each entry in the tree (or possibly
60  // keyed object in the case of PROOF) to be processed. The entry argument
61  // specifies which entry in the currently loaded tree is to be processed.
62  // It can be passed to either Prototype2_DSTReader::GetEntry() or TBranch::GetEntry()
63  // to read either all or the required parts of the data. When processing
64  // keyed objects with PROOF, the object is already loaded and is available
65  // via the fObject pointer.
66  //
67  // This function should contain the "body" of the analysis. It can contain
68  // simple or elaborate selection criteria, run algorithms on the data
69  // of the event and typically fill histograms.
70  //
71  // The processing can be stopped by calling Abort().
72  //
73  // Use fStatus to set the return value of TTree::Process().
74  //
75  // The return value is currently not used.
76 
77  if (entry % 100 == 0)
78  cout << "Prototype2_DSTReader::Process - " << entry << ", output : "
79  << fOption << endl;
80 
81  GetEntry(entry);
82 
83 // for (int t = 0; t < kMaxTOWER_CALIB_CEMC; ++t)
84 // {
85 // typedef unsigned int keytype;
86 // static unsigned int calo_idbits = 8;
87 // static unsigned int tower_idbits = sizeof(keytype) * 8 - calo_idbits;
88 // static unsigned int index1_idbits = tower_idbits / 2;
89 // const int calo_tower_id = TOWER_CALIB_CEMC_towerid[t];
90 // const int col = (calo_tower_id >> index1_idbits) & 0xFFF;
91 // const int row = calo_tower_id & 0xFFF;
92 //
94 // if ((abs(col - 2) <= 2 && abs(row - 1) <= 2))
95 // {
96 // fout << TOWER_CALIB_CEMC_energy[t] << "\t";
97 // }
98 //
99 // }
100 
101  for (int t = 0; t < kMaxTOWER_CALIB_CEMC; ++t)
102  {
103  fout << TOWER_CALIB_CEMC_energy[t] << "\t";
104  }
105  for (int t = 0; t < kMaxTOWER_CALIB_LG_HCALIN; ++t)
106  {
107  fout << TOWER_CALIB_LG_HCALIN_energy[t] << "\t";
108  }
109  for (int t = 0; t < kMaxTOWER_CALIB_LG_HCALOUT; ++t)
110  {
111  fout << TOWER_CALIB_LG_HCALOUT_energy[t] << "\t";
112  }
113  fout << endl;
114 
115  return kTRUE;
116 }
117 
118 void
120 {
121  // The SlaveTerminate() function is called after all entries or objects
122  // have been processed. When running with PROOF SlaveTerminate() is called
123  // on each slave server.
124 
125 }
126 
127 void
129 {
130  // The Terminate() function is the last function to be called during
131  // a query. It always runs on the client, it can be used to present
132  // the results graphically or save the results to file.
133 
134  fout.close();
135 }