Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:14:35

0001 #define Prototype2_DSTReader_cxx
0002 // The class definition in Prototype2_DSTReader.h has been generated automatically
0003 // by the ROOT utility TTree::MakeSelector(). This class is derived
0004 // from the ROOT class TSelector. For more information on the TSelector
0005 // framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
0006 
0007 // The following methods are defined in this file:
0008 //    Begin():        called every time a loop on the tree starts,
0009 //                    a convenient place to create your histograms.
0010 //    SlaveBegin():   called after Begin(), when on PROOF called only on the
0011 //                    slave servers.
0012 //    Process():      called for each event, in this function you decide what
0013 //                    to read and fill your histograms.
0014 //    SlaveTerminate: called at the end of the loop on the tree, when on PROOF
0015 //                    called only on the slave servers.
0016 //    Terminate():    called at the end of the loop on the tree,
0017 //                    a convenient place to draw/fit your histograms.
0018 //
0019 // To use this file, try the following session on your Tree T:
0020 //
0021 // Root > T->Process("Prototype2_DSTReader.C")
0022 // Root > T->Process("Prototype2_DSTReader.C","some options")
0023 // Root > T->Process("Prototype2_DSTReader.C+")
0024 //
0025 
0026 #include "Prototype2_DSTReader.h"
0027 #include <TH2.h>
0028 #include <TStyle.h>
0029 #include <iostream>
0030 
0031 using namespace std;
0032 
0033 void
0034 Prototype2_DSTReader::Begin(TTree * /*tree*/)
0035 {
0036   // The Begin() function is called at the start of the query.
0037   // When running with PROOF Begin() is only called on the client.
0038   // The tree argument is deprecated (on PROOF 0 is passed).
0039 
0040   TString option = GetOption();
0041 
0042   fout.open(fOption, ios_base::out);
0043 }
0044 
0045 void
0046 Prototype2_DSTReader::SlaveBegin(TTree * /*tree*/)
0047 {
0048   // The SlaveBegin() function is called after the Begin() function.
0049   // When running with PROOF SlaveBegin() is called on each slave server.
0050   // The tree argument is deprecated (on PROOF 0 is passed).
0051 
0052   TString option = GetOption();
0053 
0054 }
0055 
0056 Bool_t
0057 Prototype2_DSTReader::Process(Long64_t entry)
0058 {
0059   // The Process() function is called for each entry in the tree (or possibly
0060   // keyed object in the case of PROOF) to be processed. The entry argument
0061   // specifies which entry in the currently loaded tree is to be processed.
0062   // It can be passed to either Prototype2_DSTReader::GetEntry() or TBranch::GetEntry()
0063   // to read either all or the required parts of the data. When processing
0064   // keyed objects with PROOF, the object is already loaded and is available
0065   // via the fObject pointer.
0066   //
0067   // This function should contain the "body" of the analysis. It can contain
0068   // simple or elaborate selection criteria, run algorithms on the data
0069   // of the event and typically fill histograms.
0070   //
0071   // The processing can be stopped by calling Abort().
0072   //
0073   // Use fStatus to set the return value of TTree::Process().
0074   //
0075   // The return value is currently not used.
0076 
0077   if (entry % 100 == 0)
0078     cout << "Prototype2_DSTReader::Process - " << entry << ", output : "
0079         << fOption << endl;
0080 
0081   GetEntry(entry);
0082 
0083 //  for (int t = 0; t < kMaxTOWER_CALIB_CEMC; ++t)
0084 //    {
0085 //      typedef unsigned int keytype;
0086 //      static unsigned int calo_idbits = 8;
0087 //      static unsigned int tower_idbits = sizeof(keytype) * 8 - calo_idbits;
0088 //      static unsigned int index1_idbits = tower_idbits / 2;
0089 //      const int calo_tower_id = TOWER_CALIB_CEMC_towerid[t];
0090 //      const int col = (calo_tower_id >> index1_idbits) & 0xFFF;
0091 //      const int row = calo_tower_id & 0xFFF;
0092 //
0093 ////      (abs(TOWER_CALIB_CEMC.get_column()-2)<=2 && abs(TOWER_CALIB_CEMC.get_row()-1)<=2 )
0094 //      if ((abs(col - 2) <= 2 && abs(row - 1) <= 2))
0095 //        {
0096 //          fout << TOWER_CALIB_CEMC_energy[t] << "\t";
0097 //        }
0098 //
0099 //    }
0100 
0101   for (int t = 0; t < kMaxTOWER_CALIB_CEMC; ++t)
0102     {
0103       fout << TOWER_CALIB_CEMC_energy[t] << "\t";
0104     }
0105   for (int t = 0; t < kMaxTOWER_CALIB_LG_HCALIN; ++t)
0106     {
0107       fout << TOWER_CALIB_LG_HCALIN_energy[t] << "\t";
0108     }
0109   for (int t = 0; t < kMaxTOWER_CALIB_LG_HCALOUT; ++t)
0110     {
0111       fout << TOWER_CALIB_LG_HCALOUT_energy[t] << "\t";
0112     }
0113   fout << endl;
0114 
0115   return kTRUE;
0116 }
0117 
0118 void
0119 Prototype2_DSTReader::SlaveTerminate()
0120 {
0121   // The SlaveTerminate() function is called after all entries or objects
0122   // have been processed. When running with PROOF SlaveTerminate() is called
0123   // on each slave server.
0124 
0125 }
0126 
0127 void
0128 Prototype2_DSTReader::Terminate()
0129 {
0130   // The Terminate() function is the last function to be called during
0131   // a query. It always runs on the client, it can be used to present
0132   // the results graphically or save the results to file.
0133 
0134   fout.close();
0135 }