CMS 3D CMS Logo

TB06Tree Class Reference

#include <Calibration/EcalTBTools/interface/TB06Tree.h>

List of all members.

Public Member Functions

void check ()
void reset (float crystal[11][21])
void store (const int &tableIsMoving, const int &run, const int &event, const int &S6adc, const double &xhodo, const double &yhodo, const double &xslope, const double &yslope, const double &xquality, const double &yquality, const int &icMax, const int &ietaMax, const int &iphiMax, const double &beamEnergy, const double ampl[49])
 to be called at each loop
 TB06Tree (const std::string &fileName="TB06Tree.root", const std::string &treeName="Analysis")
 ctor
 ~TB06Tree ()
 dtor

Private Attributes

TClonesArray * m_data
int m_dataSize
TFile * m_file
TTree * m_tree


Detailed Description

Definition at line 14 of file TB06Tree.h.


Constructor & Destructor Documentation

TB06Tree::TB06Tree ( const std::string &  fileName = "TB06Tree.root",
const std::string &  treeName = "Analysis" 
)

ctor

Definition at line 9 of file TB06Tree.cc.

References dir, m_data, m_file, and m_tree.

00010                                                :
00011   m_file (0), m_tree (0), m_data (0), m_dataSize (0)  
00012 {
00013   TDirectory *dir = gDirectory ;
00014   m_file = new TFile (fileName.c_str (),"RECREATE") ;
00015   m_file->cd () ;
00016   m_tree = new TTree (treeName.c_str(),"Analysis tree") ;
00017   m_tree->SetAutoSave (10000000) ;
00018   dir->cd () ;
00019 
00020   //  m_tree->cd () ;
00021   m_data = new TClonesArray (TB06Reco::Class (), 1) ;
00022   m_data->ExpandCreateFast (1) ;
00023 
00024   //  m_tree->Branch ("EGCO", &m_data, 64000, 2) ;
00025   m_tree->Branch ("TB06O", &m_data, 64000, 2) ;
00026   m_tree->Print () ;
00027  
00028 }

TB06Tree::~TB06Tree (  ) 

dtor

Definition at line 33 of file TB06Tree.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), m_data, m_file, and m_tree.

00034 {
00035   std::cout << "[TB06Tree][dtor] saving TTree " << m_tree->GetName ()
00036             << " with " << m_tree->GetEntries () << " entries"
00037             << " on file: " << m_file->GetName () << std::endl ;
00038 
00039   m_file->Write () ;
00040   delete m_tree ;
00041   m_file->Close () ;
00042   delete m_file ;
00043   delete m_data ;
00044 }


Member Function Documentation

void TB06Tree::check (  ) 

Definition at line 137 of file TB06Tree.cc.

References TB06Reco::convFactor, GenMuonPlsPt100GeV_cfg::cout, eta, TB06Reco::event, TB06Reco::localMap, m_data, TB06Reco::MEXTLenergy, TB06Reco::MEXTLeta, TB06Reco::MEXTLphi, phi, TB06Reco::run, TB06Reco::tableIsMoving, TB06Reco::xHodo, TB06Reco::xQualityHodo, TB06Reco::xSlopeHodo, TB06Reco::yHodo, TB06Reco::yQualityHodo, and TB06Reco::ySlopeHodo.

00138 {
00139   TB06Reco * entry = static_cast<TB06Reco*> (m_data->AddrAt (0)) ;
00140 
00141   std::cout << "[TB06Tree][check]reading . . . \n" ;
00142   std::cout << "[TB06Tree][check] entry->run: " << entry->run << "\n" ;
00143   std::cout << "[TB06Tree][check] entry->event: " << entry->event << "\n" ;
00144   std::cout << "[TB06Tree][check] entry->tableIsMoving: " << entry->tableIsMoving << "\n" ;
00145   std::cout << "[TB06Tree][check] entry->MEXTLeta: " << entry->MEXTLeta << "\n" ;
00146   std::cout << "[TB06Tree][check] entry->MEXTLphi: " << entry->MEXTLphi << "\n" ;
00147   std::cout << "[TB06Tree][check] entry->MEXTLenergy: " << entry->MEXTLenergy << "\n" ;
00148 
00149   for (int eta = 0 ; eta<7 ; ++eta)
00150       for (int phi = 0 ; phi<7 ; ++phi)
00151         std::cout << "[TB06Tree][check]   entry->localMap[" << eta
00152                   << "][" << phi << "]: "
00153                   << entry->localMap[eta][phi] << "\n" ;
00154 
00155   std::cout << "[TB06Tree][check] entry->xHodo: " << entry->xHodo << "\n" ;
00156   std::cout << "[TB06Tree][check] entry->yHodo: " << entry->yHodo << "\n" ;
00157   std::cout << "[TB06Tree][check] entry->xSlopeHodo: " << entry->xSlopeHodo << "\n" ;
00158   std::cout << "[TB06Tree][check] entry->ySlopeHodo: " << entry->ySlopeHodo << "\n" ;
00159   std::cout << "[TB06Tree][check] entry->xQualityHodo: " << entry->xQualityHodo << "\n" ;
00160   std::cout << "[TB06Tree][check] entry->yQualityHodo: " << entry->yQualityHodo << "\n" ;
00161   std::cout << "[TB06Tree][check] entry->convFactor: " << entry->convFactor << "\n" ;
00162 
00163   /* to be implemented with the right variables
00164   std::cout << "[TB06Tree][check] ------------------------" << std::endl ;
00165   std::cout << "[TB06Tree][check] " << entry->variable_name << std::endl ;
00166   */
00167 }

void TB06Tree::reset ( float  crystal[11][21]  ) 

Definition at line 122 of file TB06Tree.cc.

References eta, and phi.

00123 {
00124   for (int eta =0 ; eta<11 ; ++eta)    
00125     {
00126       for (int phi =0 ; phi<21 ; ++phi) 
00127         {
00128           crystal[eta][phi] = -999. ;  
00129         }   
00130     }
00131 }

void TB06Tree::store ( const int tableIsMoving,
const int run,
const int event,
const int S6adc,
const double &  xhodo,
const double &  yhodo,
const double &  xslope,
const double &  yslope,
const double &  xquality,
const double &  yquality,
const int icMax,
const int ietaMax,
const int iphiMax,
const double &  beamEnergy,
const double  ampl[49] 
)

to be called at each loop

Definition at line 50 of file TB06Tree.cc.

References TB06Reco::beamEnergy, TB06Reco::convFactor, eta, TB06Reco::event, TB06Reco::localMap, m_data, m_tree, TB06Reco::MEXTLenergy, TB06Reco::MEXTLeta, TB06Reco::MEXTLindex, TB06Reco::MEXTLphi, phi, TB06Reco::reset(), TB06Reco::run, TB06Reco::S6ADC, TB06Reco::tableIsMoving, TB06Reco::xHodo, TB06Reco::xQualityHodo, TB06Reco::xSlopeHodo, TB06Reco::yHodo, TB06Reco::yQualityHodo, and TB06Reco::ySlopeHodo.

00060 {
00061 
00062   m_data->Clear () ;
00063   TB06Reco * entry = static_cast<TB06Reco*> (m_data->AddrAt (0)) ;
00064 
00065   entry->reset () ;
00066   //  reset (entry->myCalibrationMap) ;
00067 
00068   entry->tableIsMoving = tableIsMoving ;
00069   entry->run = run ;
00070   entry->event = event ;
00071   entry->S6ADC = S6adc ;
00072 
00073   entry->MEXTLindex = icMax ;
00074   entry->MEXTLeta = ietaMax ;
00075   entry->MEXTLphi = iphiMax ;
00076   entry->MEXTLenergy = ampl[24] ;
00077   entry->beamEnergy = beamEnergy ;
00078 
00079   for (int eta = 0 ; eta<7 ; ++eta)
00080     for (int phi = 0 ; phi<7 ; ++phi)
00081       {
00082         // FIXME capire l'orientamento di phi!
00083         // FIXME capire se eta, phi iniziano da 1 o da 0
00084         entry->localMap[eta][phi] = ampl[eta*7+phi] ;
00085       }
00086 
00087   entry->xHodo = xhodo ;
00088   entry->yHodo = yhodo ;
00089   entry->xSlopeHodo = xslope ;
00090   entry->ySlopeHodo = yslope ;
00091   entry->xQualityHodo = xquality ;
00092   entry->yQualityHodo = yquality ;
00093 
00094   entry->convFactor = 0. ;
00095 
00096   /*
00097   // loop over the 5x5 see (1)
00098   for (int xtal=0 ; xtal<25 ; ++xtal) 
00099     {
00100       int ieta = xtal/5 + 3 ;
00101       int iphi = xtal%5 + 8 ;
00102       entry->myCalibrationMap[ieta][iphi] = ampl[xtal] ;
00103     } // loop over the 5x5
00104 
00105   entry->electron_Tr_Pmag_ = beamEnergy ;
00106   
00107         entry->centralCrystalEta_ = ietaMax ;
00108         entry->centralCrystalPhi_ = iphiMax ;
00109         entry->centralCrystalEnergy_ = ampl[12] ; 
00110 
00111   // this is a trick
00112   entry->electron_Tr_Peta_ = xhodo ;
00113   entry->electron_Tr_Pphi_ = yhodo ;
00114   */
00115   m_tree->Fill () ;
00116 }


Member Data Documentation

TClonesArray* TB06Tree::m_data [private]

Definition at line 42 of file TB06Tree.h.

Referenced by check(), store(), TB06Tree(), and ~TB06Tree().

int TB06Tree::m_dataSize [private]

Definition at line 43 of file TB06Tree.h.

TFile* TB06Tree::m_file [private]

Definition at line 39 of file TB06Tree.h.

Referenced by TB06Tree(), and ~TB06Tree().

TTree* TB06Tree::m_tree [private]

Definition at line 40 of file TB06Tree.h.

Referenced by store(), TB06Tree(), and ~TB06Tree().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:07 2009 for CMSSW by  doxygen 1.5.4