CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TB06Tree Class Reference

#include <TB06Tree.h>

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 More...
 
 TB06Tree (const std::string &fileName="TB06Tree.root", const std::string &treeName="Analysis")
 ctor More...
 
 ~TB06Tree ()
 dtor More...
 

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::TB06Tree ( const std::string &  fileName = "TB06Tree.root",
const std::string &  treeName = "Analysis" 
)

ctor

Definition at line 8 of file TB06Tree.cc.

References HLT_2024v14_cff::Class, DeadROC_duringRun::dir, MillePedeFileConverter_cfg::fileName, m_data, m_file, and m_tree.

9  : m_file(nullptr), m_tree(nullptr), m_data(nullptr), m_dataSize(0) {
10  TDirectory *dir = gDirectory;
11  m_file = new TFile(fileName.c_str(), "RECREATE");
12  m_file->cd();
13  m_tree = new TTree(treeName.c_str(), "Analysis tree");
14  m_tree->SetAutoSave(10000000);
15  dir->cd();
16 
17  // m_tree->cd () ;
18  m_data = new TClonesArray(TB06Reco::Class(), 1);
19  m_data->ExpandCreateFast(1);
20 
21  // m_tree->Branch ("EGCO", &m_data, 64000, 2) ;
22  m_tree->Branch("TB06O", &m_data, 64000, 2);
23  m_tree->Print();
24 }
int m_dataSize
Definition: TB06Tree.h:46
TFile * m_file
Definition: TB06Tree.h:42
TTree * m_tree
Definition: TB06Tree.h:43
TClonesArray * m_data
Definition: TB06Tree.h:45

◆ ~TB06Tree()

TB06Tree::~TB06Tree ( )

dtor

Definition at line 28 of file TB06Tree.cc.

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

28  {
29  std::cout << "[TB06Tree][dtor] saving TTree " << m_tree->GetName() << " with " << m_tree->GetEntries() << " entries"
30  << " on file: " << m_file->GetName() << std::endl;
31 
32  m_file->Write();
33  delete m_tree;
34  m_file->Close();
35  delete m_file;
36  delete m_data;
37 }
TFile * m_file
Definition: TB06Tree.h:42
TTree * m_tree
Definition: TB06Tree.h:43
TClonesArray * m_data
Definition: TB06Tree.h:45

Member Function Documentation

◆ check()

void TB06Tree::check ( )

Definition at line 124 of file TB06Tree.cc.

References gather_cfg::cout, mps_splice::entry, PVValHelper::eta, m_data, and phi.

124  {
125  TB06Reco *entry = static_cast<TB06Reco *>(m_data->AddrAt(0));
126 
127  std::cout << "[TB06Tree][check]reading . . . \n";
128  std::cout << "[TB06Tree][check] entry->run: " << entry->run << "\n";
129  std::cout << "[TB06Tree][check] entry->event: " << entry->event << "\n";
130  std::cout << "[TB06Tree][check] entry->tableIsMoving: " << entry->tableIsMoving << "\n";
131  std::cout << "[TB06Tree][check] entry->MEXTLeta: " << entry->MEXTLeta << "\n";
132  std::cout << "[TB06Tree][check] entry->MEXTLphi: " << entry->MEXTLphi << "\n";
133  std::cout << "[TB06Tree][check] entry->MEXTLenergy: " << entry->MEXTLenergy << "\n";
134 
135  for (int eta = 0; eta < 7; ++eta)
136  for (int phi = 0; phi < 7; ++phi)
137  std::cout << "[TB06Tree][check] entry->localMap[" << eta << "][" << phi << "]: " << entry->localMap[eta][phi]
138  << "\n";
139 
140  std::cout << "[TB06Tree][check] entry->xHodo: " << entry->xHodo << "\n";
141  std::cout << "[TB06Tree][check] entry->yHodo: " << entry->yHodo << "\n";
142  std::cout << "[TB06Tree][check] entry->xSlopeHodo: " << entry->xSlopeHodo << "\n";
143  std::cout << "[TB06Tree][check] entry->ySlopeHodo: " << entry->ySlopeHodo << "\n";
144  std::cout << "[TB06Tree][check] entry->xQualityHodo: " << entry->xQualityHodo << "\n";
145  std::cout << "[TB06Tree][check] entry->yQualityHodo: " << entry->yQualityHodo << "\n";
146  std::cout << "[TB06Tree][check] entry->convFactor: " << entry->convFactor << "\n";
147 
148  /* to be implemented with the right variables
149  std::cout << "[TB06Tree][check] ------------------------" << std::endl ;
150  std::cout << "[TB06Tree][check] " << entry->variable_name << std::endl ;
151  */
152 }
TClonesArray * m_data
Definition: TB06Tree.h:45

◆ reset()

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

Definition at line 114 of file TB06Tree.cc.

References PVValHelper::eta, and phi.

Referenced by MatrixReader.MatrixReader::__init__(), data_sources.json_list::__next__(), and MatrixReader.MatrixReader::showRaw().

114  {
115  for (int eta = 0; eta < 11; ++eta) {
116  for (int phi = 0; phi < 21; ++phi) {
117  crystal[eta][phi] = -999.;
118  }
119  }
120 }

◆ store()

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 42 of file TB06Tree.cc.

References TB06Analysis_cfi::beamEnergy, mps_splice::entry, PVValHelper::eta, edmPickEvents::event, m_data, m_tree, phi, and writedatasetfile::run.

56  {
57  m_data->Clear();
58  TB06Reco *entry = static_cast<TB06Reco *>(m_data->AddrAt(0));
59 
60  entry->reset();
61  // reset (entry->myCalibrationMap) ;
62 
63  entry->tableIsMoving = tableIsMoving;
64  entry->run = run;
65  entry->event = event;
66  entry->S6ADC = S6adc;
67 
68  entry->MEXTLindex = icMax;
69  entry->MEXTLeta = ietaMax;
70  entry->MEXTLphi = iphiMax;
71  entry->MEXTLenergy = ampl[24];
72  entry->beamEnergy = beamEnergy;
73 
74  for (int eta = 0; eta < 7; ++eta)
75  for (int phi = 0; phi < 7; ++phi) {
76  // FIXME capire l'orientamento di phi!
77  // FIXME capire se eta, phi iniziano da 1 o da 0
78  entry->localMap[eta][phi] = ampl[eta * 7 + phi];
79  }
80 
81  entry->xHodo = xhodo;
82  entry->yHodo = yhodo;
83  entry->xSlopeHodo = xslope;
84  entry->ySlopeHodo = yslope;
85  entry->xQualityHodo = xquality;
86  entry->yQualityHodo = yquality;
87 
88  entry->convFactor = 0.;
89 
90  /*
91  // loop over the 5x5 see (1)
92  for (int xtal=0 ; xtal<25 ; ++xtal)
93  {
94  int ieta = xtal/5 + 3 ;
95  int iphi = xtal%5 + 8 ;
96  entry->myCalibrationMap[ieta][iphi] = ampl[xtal] ;
97  } // loop over the 5x5
98 
99  entry->electron_Tr_Pmag_ = beamEnergy ;
100 
101  entry->centralCrystalEta_ = ietaMax ;
102  entry->centralCrystalPhi_ = iphiMax ;
103  entry->centralCrystalEnergy_ = ampl[12] ;
104 
105  // this is a trick
106  entry->electron_Tr_Peta_ = xhodo ;
107  entry->electron_Tr_Pphi_ = yhodo ;
108  */
109  m_tree->Fill();
110 }
TTree * m_tree
Definition: TB06Tree.h:43
TClonesArray * m_data
Definition: TB06Tree.h:45

Member Data Documentation

◆ m_data

TClonesArray* TB06Tree::m_data
private

Definition at line 45 of file TB06Tree.h.

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

◆ m_dataSize

int TB06Tree::m_dataSize
private

Definition at line 46 of file TB06Tree.h.

◆ m_file

TFile* TB06Tree::m_file
private

Definition at line 42 of file TB06Tree.h.

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

◆ m_tree

TTree* TB06Tree::m_tree
private

Definition at line 43 of file TB06Tree.h.

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