CMS 3D CMS Logo

Public Member Functions | Private Attributes

TB06Tree Class Reference

#include <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.

                                               :
  m_file (0), m_tree (0), m_data (0), m_dataSize (0)  
{
  TDirectory *dir = gDirectory ;
  m_file = new TFile (fileName.c_str (),"RECREATE") ;
  m_file->cd () ;
  m_tree = new TTree (treeName.c_str(),"Analysis tree") ;
  m_tree->SetAutoSave (10000000) ;
  dir->cd () ;

  //  m_tree->cd () ;
  m_data = new TClonesArray (TB06Reco::Class (), 1) ;
  m_data->ExpandCreateFast (1) ;

  //  m_tree->Branch ("EGCO", &m_data, 64000, 2) ;
  m_tree->Branch ("TB06O", &m_data, 64000, 2) ;
  m_tree->Print () ;
 
}
TB06Tree::~TB06Tree ( )

dtor

Definition at line 33 of file TB06Tree.cc.

References gather_cfg::cout, m_data, m_file, and m_tree.

{
  std::cout << "[TB06Tree][dtor] saving TTree " << m_tree->GetName ()
            << " with " << m_tree->GetEntries () << " entries"
            << " on file: " << m_file->GetName () << std::endl ;

  m_file->Write () ;
  delete m_tree ;
  m_file->Close () ;
  delete m_file ;
  delete m_data ;
}

Member Function Documentation

void TB06Tree::check ( )

Definition at line 137 of file TB06Tree.cc.

References TB06Reco::convFactor, gather_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.

{
  TB06Reco * entry = static_cast<TB06Reco*> (m_data->AddrAt (0)) ;

  std::cout << "[TB06Tree][check]reading . . . \n" ;
  std::cout << "[TB06Tree][check] entry->run: " << entry->run << "\n" ;
  std::cout << "[TB06Tree][check] entry->event: " << entry->event << "\n" ;
  std::cout << "[TB06Tree][check] entry->tableIsMoving: " << entry->tableIsMoving << "\n" ;
  std::cout << "[TB06Tree][check] entry->MEXTLeta: " << entry->MEXTLeta << "\n" ;
  std::cout << "[TB06Tree][check] entry->MEXTLphi: " << entry->MEXTLphi << "\n" ;
  std::cout << "[TB06Tree][check] entry->MEXTLenergy: " << entry->MEXTLenergy << "\n" ;

  for (int eta = 0 ; eta<7 ; ++eta)
      for (int phi = 0 ; phi<7 ; ++phi)
        std::cout << "[TB06Tree][check]   entry->localMap[" << eta
                  << "][" << phi << "]: "
                  << entry->localMap[eta][phi] << "\n" ;

  std::cout << "[TB06Tree][check] entry->xHodo: " << entry->xHodo << "\n" ;
  std::cout << "[TB06Tree][check] entry->yHodo: " << entry->yHodo << "\n" ;
  std::cout << "[TB06Tree][check] entry->xSlopeHodo: " << entry->xSlopeHodo << "\n" ;
  std::cout << "[TB06Tree][check] entry->ySlopeHodo: " << entry->ySlopeHodo << "\n" ;
  std::cout << "[TB06Tree][check] entry->xQualityHodo: " << entry->xQualityHodo << "\n" ;
  std::cout << "[TB06Tree][check] entry->yQualityHodo: " << entry->yQualityHodo << "\n" ;
  std::cout << "[TB06Tree][check] entry->convFactor: " << entry->convFactor << "\n" ;

  /* to be implemented with the right variables
  std::cout << "[TB06Tree][check] ------------------------" << std::endl ;
  std::cout << "[TB06Tree][check] " << entry->variable_name << std::endl ;
  */
}
void TB06Tree::reset ( float  crystal[11][21])

Definition at line 122 of file TB06Tree.cc.

References eta(), and phi.

{
  for (int eta =0 ; eta<11 ; ++eta)    
    {
      for (int phi =0 ; phi<21 ; ++phi) 
        {
          crystal[eta][phi] = -999. ;  
        }   
    }
}
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(), event(), TB06Reco::event, TB06Reco::localMap, m_data, m_tree, TB06Reco::MEXTLenergy, TB06Reco::MEXTLeta, TB06Reco::MEXTLindex, TB06Reco::MEXTLphi, phi, TB06Reco::reset(), TB06Reco::run, DTTTrigCorrFirst::run, TB06Reco::S6ADC, TB06Reco::tableIsMoving, TB06Reco::xHodo, TB06Reco::xQualityHodo, TB06Reco::xSlopeHodo, TB06Reco::yHodo, TB06Reco::yQualityHodo, and TB06Reco::ySlopeHodo.

{

  m_data->Clear () ;
  TB06Reco * entry = static_cast<TB06Reco*> (m_data->AddrAt (0)) ;

  entry->reset () ;
  //  reset (entry->myCalibrationMap) ;

  entry->tableIsMoving = tableIsMoving ;
  entry->run = run ;
  entry->event = event ;
  entry->S6ADC = S6adc ;

  entry->MEXTLindex = icMax ;
  entry->MEXTLeta = ietaMax ;
  entry->MEXTLphi = iphiMax ;
  entry->MEXTLenergy = ampl[24] ;
  entry->beamEnergy = beamEnergy ;

  for (int eta = 0 ; eta<7 ; ++eta)
    for (int phi = 0 ; phi<7 ; ++phi)
      {
        // FIXME capire l'orientamento di phi!
        // FIXME capire se eta, phi iniziano da 1 o da 0
        entry->localMap[eta][phi] = ampl[eta*7+phi] ;
      }

  entry->xHodo = xhodo ;
  entry->yHodo = yhodo ;
  entry->xSlopeHodo = xslope ;
  entry->ySlopeHodo = yslope ;
  entry->xQualityHodo = xquality ;
  entry->yQualityHodo = yquality ;

  entry->convFactor = 0. ;

  /*
  // loop over the 5x5 see (1)
  for (int xtal=0 ; xtal<25 ; ++xtal) 
    {
      int ieta = xtal/5 + 3 ;
      int iphi = xtal%5 + 8 ;
      entry->myCalibrationMap[ieta][iphi] = ampl[xtal] ;
    } // loop over the 5x5

  entry->electron_Tr_Pmag_ = beamEnergy ;
  
        entry->centralCrystalEta_ = ietaMax ;
        entry->centralCrystalPhi_ = iphiMax ;
        entry->centralCrystalEnergy_ = ampl[12] ; 

  // this is a trick
  entry->electron_Tr_Peta_ = xhodo ;
  entry->electron_Tr_Pphi_ = yhodo ;
  */
  m_tree->Fill () ;
}

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().