ATLAS Offline Software
MMTriggerToolTree.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Athena/Gaudi includes
6 #include "GaudiKernel/ITHistSvc.h"
7 #include "GaudiKernel/IIncidentSvc.h"
8 
10 
11 
12 // local includes
14 
15 // local includes
16 #include "TTree.h"
17 
18 namespace NSWL1 {
19 
20  void MMTriggerTool::handle(const Incident& inc) {
21  if( inc.type()==IncidentType::BeginEvent ) {
22  ATH_MSG_DEBUG( "Handling..." );
23  this->clear_ntuple_variables();
24  }
25  }
26 
28  m_trigger_diamond_ntrig = new std::vector<unsigned int>();
29  m_trigger_diamond_bc = new std::vector<int>();
30  m_trigger_diamond_sector = new std::vector<char>();
31  m_trigger_diamond_stationPhi = new std::vector<int>();
32  m_trigger_diamond_totalCount = new std::vector<unsigned int>();
33  m_trigger_diamond_realCount = new std::vector<unsigned int>();
34  m_trigger_diamond_XbkgCount = new std::vector<unsigned int>();
35  m_trigger_diamond_UVbkgCount = new std::vector<unsigned int>();
36  m_trigger_diamond_XmuonCount = new std::vector<unsigned int>();
37  m_trigger_diamond_UVmuonCount = new std::vector<unsigned int>();
38  m_trigger_diamond_iX = new std::vector<int>();
39  m_trigger_diamond_iU = new std::vector<int>();
40  m_trigger_diamond_iV = new std::vector<int>();
41  m_trigger_diamond_age = new std::vector<int>();
42  m_trigger_diamond_mx = new std::vector<double>();
43  m_trigger_diamond_my = new std::vector<double>();
44  m_trigger_diamond_Uavg = new std::vector<double>();
45  m_trigger_diamond_Vavg = new std::vector<double>();
46  m_trigger_diamond_mxl = new std::vector<double>();
47  m_trigger_diamond_theta = new std::vector<double>();
48  m_trigger_diamond_eta = new std::vector<double>();
49  m_trigger_diamond_dtheta = new std::vector<double>();
50  m_trigger_diamond_phi = new std::vector<double>();
51  m_trigger_diamond_phiShf = new std::vector<double>();
52  m_trigger_diamond_TP_phi_id = new std::vector<uint8_t>();
53  m_trigger_diamond_TP_R_id = new std::vector<uint8_t>();
54  m_trigger_diamond_TP_dTheta_id = new std::vector<uint8_t>();
55 
56  m_trigger_RZslopes = new std::vector<double>();
57  m_trigger_trueEtaRange = new std::vector<double>();
58  m_trigger_truePtRange = new std::vector<double>();
59 
60  m_trigger_VMM = new std::vector<int>();
61  m_trigger_plane = new std::vector<int>();
62  m_trigger_station = new std::vector<int>();
63  m_trigger_strip = new std::vector<int>();
64  m_trigger_slope = new std::vector<double>();
65  m_trigger_trueThe = new std::vector<double>();
66  m_trigger_truePhi = new std::vector<double>();
67  m_trigger_trueDth = new std::vector<double>();
68  m_trigger_trueEtaEnt = new std::vector<double>();
69  m_trigger_trueTheEnt = new std::vector<double>();
70  m_trigger_truePhiEnt = new std::vector<double>();
71  m_trigger_trueEtaPos = new std::vector<double>();
72  m_trigger_trueThePos = new std::vector<double>();
73  m_trigger_truePhiPos = new std::vector<double>();
74 
75  m_NSWMM_dig_stationName = new std::vector<std::string>();
76  m_NSWMM_dig_stationEta = new std::vector<int>();
77  m_NSWMM_dig_stationPhi = new std::vector<int>();
78  m_NSWMM_dig_multiplet = new std::vector<int>();
79  m_NSWMM_dig_gas_gap = new std::vector<int>();
80  m_NSWMM_dig_channel = new std::vector<int>();
81 
82  m_NSWMM_dig_time = new std::vector< std::vector<float> >;
83  m_NSWMM_dig_charge = new std::vector< std::vector<float> >;
84  m_NSWMM_dig_stripPosition = new std::vector< std::vector<int> >;
85  m_NSWMM_dig_stripLposX = new std::vector< std::vector<double> >;
86  m_NSWMM_dig_stripLposY = new std::vector< std::vector<double> >;
87  m_NSWMM_dig_stripGposX = new std::vector< std::vector<double> >;
88  m_NSWMM_dig_stripGposY = new std::vector< std::vector<double> >;
89  m_NSWMM_dig_stripGposZ = new std::vector< std::vector<double> >;
90 
91  if (m_tree) {
92  m_tree->Branch("MM_diamond_bc", &m_trigger_diamond_bc);
93  m_tree->Branch("MM_diamond_ntrig", &m_trigger_diamond_ntrig);
94  m_tree->Branch("MM_diamond_sector", &m_trigger_diamond_sector);
95  m_tree->Branch("MM_diamond_stationPhi", &m_trigger_diamond_stationPhi);
96  m_tree->Branch("MM_diamond_totalCount", &m_trigger_diamond_totalCount);
97  m_tree->Branch("MM_diamond_realCount", &m_trigger_diamond_realCount);
98  m_tree->Branch("MM_diamond_XbkgCount", &m_trigger_diamond_XbkgCount);
99  m_tree->Branch("MM_diamond_UVbkgCount", &m_trigger_diamond_UVbkgCount);
100  m_tree->Branch("MM_diamond_XmuonCount", &m_trigger_diamond_XmuonCount);
101  m_tree->Branch("MM_diamond_UVmuonCount", &m_trigger_diamond_UVmuonCount);
102  m_tree->Branch("MM_diamond_iX", &m_trigger_diamond_iX);
103  m_tree->Branch("MM_diamond_iU", &m_trigger_diamond_iU);
104  m_tree->Branch("MM_diamond_iV", &m_trigger_diamond_iV);
105  m_tree->Branch("MM_diamond_age", &m_trigger_diamond_age);
106  m_tree->Branch("MM_diamond_mx", &m_trigger_diamond_mx);
107  m_tree->Branch("MM_diamond_my", &m_trigger_diamond_my);
108  m_tree->Branch("MM_diamond_Uavg", &m_trigger_diamond_Uavg);
109  m_tree->Branch("MM_diamond_Vavg", &m_trigger_diamond_Vavg);
110  m_tree->Branch("MM_diamond_mxl", &m_trigger_diamond_mxl);
111  m_tree->Branch("MM_diamond_theta", &m_trigger_diamond_theta);
112  m_tree->Branch("MM_diamond_eta", &m_trigger_diamond_eta);
113  m_tree->Branch("MM_diamond_dtheta", &m_trigger_diamond_dtheta);
114  m_tree->Branch("MM_diamond_phi", &m_trigger_diamond_phi);
115  m_tree->Branch("MM_diamond_phiShf", &m_trigger_diamond_phiShf);
116  m_tree->Branch("MM_diamond_TP_phi_id", &m_trigger_diamond_TP_phi_id);
117  m_tree->Branch("MM_diamond_TP_R_id", &m_trigger_diamond_TP_R_id);
118  m_tree->Branch("MM_diamond_TP_dTheta_id", &m_trigger_diamond_TP_dTheta_id);
119 
120  m_tree->Branch("MM_RZslopes", &m_trigger_RZslopes);
121  m_tree->Branch("MM_trueEtaRange", &m_trigger_trueEtaRange);
122  m_tree->Branch("MM_truePtRange", &m_trigger_truePtRange);
123 
124  m_tree->Branch("MM_VMM", &m_trigger_VMM);
125  m_tree->Branch("MM_plane", &m_trigger_plane);
126  m_tree->Branch("MM_station", &m_trigger_station);
127  m_tree->Branch("MM_strip", &m_trigger_strip);
128  m_tree->Branch("MM_slope", &m_trigger_slope);
129  m_tree->Branch("MM_trueThe", &m_trigger_trueThe);
130  m_tree->Branch("MM_truePhi", &m_trigger_truePhi);
131  m_tree->Branch("MM_trueDth", &m_trigger_trueDth);
132  m_tree->Branch("MM_trueEtaEnt", &m_trigger_trueEtaEnt);
133  m_tree->Branch("MM_trueTheEnt", &m_trigger_trueTheEnt);
134  m_tree->Branch("MM_truePhiEnt", &m_trigger_truePhiEnt);
135  m_tree->Branch("MM_trueEtaPos", &m_trigger_trueEtaPos);
136  m_tree->Branch("MM_trueThePos", &m_trigger_trueThePos);
137  m_tree->Branch("MM_truePhiPos", &m_trigger_truePhiPos);
138 
139  m_tree->Branch("Digits_MM_stationName", &m_NSWMM_dig_stationName);
140  m_tree->Branch("Digits_MM_stationEta", &m_NSWMM_dig_stationEta);
141  m_tree->Branch("Digits_MM_stationPhi", &m_NSWMM_dig_stationPhi);
142  m_tree->Branch("Digits_MM_multiplet", &m_NSWMM_dig_multiplet);
143  m_tree->Branch("Digits_MM_gas_gap", &m_NSWMM_dig_gas_gap);
144  m_tree->Branch("Digits_MM_channel", &m_NSWMM_dig_channel);
145 
146  m_tree->Branch("Digits_MM_time", &m_NSWMM_dig_time);
147  m_tree->Branch("Digits_MM_charge", &m_NSWMM_dig_charge);
148  m_tree->Branch("Digits_MM_stripPosition", &m_NSWMM_dig_stripPosition);
149  m_tree->Branch("Digits_MM_stripLposX", &m_NSWMM_dig_stripLposX);
150  m_tree->Branch("Digits_MM_stripLposY", &m_NSWMM_dig_stripLposY);
151  m_tree->Branch("Digits_MM_stripGposX", &m_NSWMM_dig_stripGposX);
152  m_tree->Branch("Digits_MM_stripGposY", &m_NSWMM_dig_stripGposY);
153  m_tree->Branch("Digits_MM_stripGposZ", &m_NSWMM_dig_stripGposZ);
154  } else {
155  return StatusCode::FAILURE;
156  }
157 
158  return StatusCode::SUCCESS;
159  }
160 
162  //clear the ntuple variables
163  if(m_tree==0) return;
164 
165  m_trigger_diamond_bc->clear();
166  m_trigger_diamond_ntrig->clear();
167  m_trigger_diamond_sector->clear();
168  m_trigger_diamond_stationPhi->clear();
169  m_trigger_diamond_totalCount->clear();
170  m_trigger_diamond_realCount->clear();
171  m_trigger_diamond_XbkgCount->clear();
172  m_trigger_diamond_UVbkgCount->clear();
173  m_trigger_diamond_XmuonCount->clear();
174  m_trigger_diamond_UVmuonCount->clear();
175  m_trigger_diamond_iX->clear();
176  m_trigger_diamond_iU->clear();
177  m_trigger_diamond_iV->clear();
178  m_trigger_diamond_age->clear();
179  m_trigger_diamond_mx->clear();
180  m_trigger_diamond_my->clear();
181  m_trigger_diamond_Uavg->clear();
182  m_trigger_diamond_Vavg->clear();
183  m_trigger_diamond_mxl->clear();
184  m_trigger_diamond_theta->clear();
185  m_trigger_diamond_eta->clear();
186  m_trigger_diamond_dtheta->clear();
187  m_trigger_diamond_phi->clear();
188  m_trigger_diamond_phiShf->clear();
189  m_trigger_diamond_TP_phi_id->clear();
190  m_trigger_diamond_TP_R_id->clear();
191  m_trigger_diamond_TP_dTheta_id->clear();
192 
193  m_trigger_RZslopes->clear();
194  m_trigger_trueEtaRange->clear();
195  m_trigger_truePtRange->clear();
196 
197  m_trigger_VMM->clear();
198  m_trigger_plane->clear();
199  m_trigger_station->clear();
200  m_trigger_strip->clear();
201  m_trigger_slope->clear();
202  m_trigger_trueThe->clear();
203  m_trigger_truePhi->clear();
204  m_trigger_trueDth->clear();
205  m_trigger_trueEtaEnt->clear();
206  m_trigger_trueTheEnt->clear();
207  m_trigger_truePhiEnt->clear();
208  m_trigger_trueEtaPos->clear();
209  m_trigger_trueThePos->clear();
210  m_trigger_truePhiPos->clear();
211 
212  // information of the module down to the channel closest to the initial G4 hit
213  // size of vector is m_NSWMM_nDigits
214  m_NSWMM_dig_stationName->clear();
215  m_NSWMM_dig_stationEta->clear();
216  m_NSWMM_dig_stationPhi->clear();
217  m_NSWMM_dig_multiplet->clear();
218  m_NSWMM_dig_gas_gap->clear();
219  m_NSWMM_dig_channel->clear();
220 
221  // vectors of size m_NSWMM_nDigits that hold vectors in which an entry
222  // corresponds to a strip that was decided to be fired by the digit
223  // (information from VMM chip response emulation)
224  m_NSWMM_dig_time->clear();
225  m_NSWMM_dig_charge->clear();
226  m_NSWMM_dig_stripPosition->clear();
227  m_NSWMM_dig_stripLposX->clear();
228  m_NSWMM_dig_stripLposY->clear();
229  m_NSWMM_dig_stripGposX->clear();
230  m_NSWMM_dig_stripGposY->clear();
231  m_NSWMM_dig_stripGposZ->clear();
232  }
233  void MMTriggerTool::fillNtuple(const histogramDigitVariables& histDigVars) const {
234 
235  *m_NSWMM_dig_stationName = histDigVars.NSWMM_dig_stationName;
236  *m_NSWMM_dig_stationEta = histDigVars.NSWMM_dig_stationEta;
237  *m_NSWMM_dig_stationPhi = histDigVars.NSWMM_dig_stationPhi;
238  *m_NSWMM_dig_multiplet = histDigVars.NSWMM_dig_multiplet;
239  *m_NSWMM_dig_gas_gap = histDigVars.NSWMM_dig_gas_gap;
240  *m_NSWMM_dig_channel = histDigVars.NSWMM_dig_channel;
241  *m_NSWMM_dig_time = histDigVars.NSWMM_dig_time;
242  *m_NSWMM_dig_charge = histDigVars.NSWMM_dig_charge;
243  *m_NSWMM_dig_stripPosition = histDigVars.NSWMM_dig_stripPosition;
244  *m_NSWMM_dig_stripLposX = histDigVars.NSWMM_dig_stripLposX;
245  *m_NSWMM_dig_stripLposY = histDigVars.NSWMM_dig_stripLposY;
246  *m_NSWMM_dig_stripGposX = histDigVars.NSWMM_dig_stripGposX;
247  *m_NSWMM_dig_stripGposY = histDigVars.NSWMM_dig_stripGposY;
248  *m_NSWMM_dig_stripGposZ = histDigVars.NSWMM_dig_stripGposZ;
249  }
250 }//end namespace
histogramDigitVariables::NSWMM_dig_stripLposY
std::vector< std::vector< double > > NSWMM_dig_stripLposY
Definition: MMLoadVariables.h:42
AthMsgStreamMacros.h
histogramDigitVariables::NSWMM_dig_channel
std::vector< int > NSWMM_dig_channel
Definition: MMLoadVariables.h:36
histogramDigitVariables::NSWMM_dig_multiplet
std::vector< int > NSWMM_dig_multiplet
Definition: MMLoadVariables.h:34
NSWL1::MMTriggerTool::clear_ntuple_variables
void clear_ntuple_variables()
clear the variables used in the analysis ntuple
Definition: MMTriggerToolTree.cxx:161
histogramDigitVariables::NSWMM_dig_stripGposX
std::vector< std::vector< double > > NSWMM_dig_stripGposX
Definition: MMLoadVariables.h:43
NSWL1::MMTriggerTool::book_branches
StatusCode book_branches()
book the branches
Definition: MMTriggerToolTree.cxx:27
histogramDigitVariables::NSWMM_dig_stripGposY
std::vector< std::vector< double > > NSWMM_dig_stripGposY
Definition: MMLoadVariables.h:44
histogramDigitVariables::NSWMM_dig_stationEta
std::vector< int > NSWMM_dig_stationEta
Definition: MMLoadVariables.h:32
NSWL1::MMTriggerTool::handle
virtual void handle(const Incident &inc)
Definition: MMTriggerToolTree.cxx:20
histogramDigitVariables::NSWMM_dig_stripPosition
std::vector< std::vector< int > > NSWMM_dig_stripPosition
Definition: MMLoadVariables.h:40
MMTriggerTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
histogramDigitVariables::NSWMM_dig_stationName
std::vector< std::string > NSWMM_dig_stationName
Definition: MMLoadVariables.h:31
histogramDigitVariables::NSWMM_dig_stationPhi
std::vector< int > NSWMM_dig_stationPhi
Definition: MMLoadVariables.h:33
NSWL1::MMTriggerTool::fillNtuple
void fillNtuple(const histogramDigitVariables &histDigVars) const
Definition: MMTriggerToolTree.cxx:233
histogramDigitVariables::NSWMM_dig_gas_gap
std::vector< int > NSWMM_dig_gas_gap
Definition: MMLoadVariables.h:35
histogramDigitVariables
Definition: MMLoadVariables.h:30
histogramDigitVariables::NSWMM_dig_stripGposZ
std::vector< std::vector< double > > NSWMM_dig_stripGposZ
Definition: MMLoadVariables.h:45
histogramDigitVariables::NSWMM_dig_stripLposX
std::vector< std::vector< double > > NSWMM_dig_stripLposX
Definition: MMLoadVariables.h:41
histogramDigitVariables::NSWMM_dig_charge
std::vector< std::vector< float > > NSWMM_dig_charge
Definition: MMLoadVariables.h:39
histogramDigitVariables::NSWMM_dig_time
std::vector< std::vector< float > > NSWMM_dig_time
Definition: MMLoadVariables.h:38
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9