ATLAS Offline Software
Loading...
Searching...
No Matches
LArTimePhysPrediction.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
11#include "GaudiKernel/ToolHandle.h"
15#include "CaloDetDescr/CaloDetDescrElement.h"
20#include "GaudiKernel/INTupleSvc.h"
21#include "GaudiKernel/NTuple.h"
22#include "GaudiKernel/IToolSvc.h"
23#include <TMath.h>
24
26using CaliWaveIt = LArCaliWaveContainer::LArCaliWaves::const_iterator;
27
28LArTimePhysPrediction::LArTimePhysPrediction (const std::string& name, ISvcLocator* pSvcLocator) :
29 AthAlgorithm(name, pSvcLocator),
30 m_CaloDepthTool(nullptr),
31 m_nt(nullptr)
32{
33 declareProperty("KeyInput", m_keyinput="LArCaliWave");
34 declareProperty("KeyOutput", m_keyoutput="LArPhysCaliTdiff");
35 declareProperty("vLCalib_EMB",m_vLCalib_EMB);
36 declareProperty("vEtaMin_EMB",m_vEtaMin_EMB);
37 declareProperty("vEtaMax_EMB",m_vEtaMax_EMB);
38 declareProperty("vLCalib_EMEC",m_vLCalib_EMEC = 0);
39 declareProperty("vLCalib_HEC",m_vLCalib_HEC = 0);
40 declareProperty("vLSignal_EMB",m_vLSignal_EMB);
41 declareProperty("vLSignal_EMEC",m_vLSignal_EMEC = 0);
42 declareProperty("vLSignal_HEC",m_vLSignal_HEC = 0);
43 declareProperty("vLSignal_FCAL",m_vLSignal_FCAL);
44 declareProperty("vDeltaTTC_EMB",m_vDeltaTTC_EMB);
45 declareProperty("vDeltaTTC_EC",m_vDeltaTTC_EC);
46 declareProperty("vDeltaTTC_ECC_SPEC",m_vDeltaTTC_ECC_SPEC);
47 declareProperty("vDeltaTTC_ECA_SPEC",m_vDeltaTTC_ECA_SPEC);
48 declareProperty("sCalib",m_sCalib=5.5);
49 declareProperty("sSignal",m_sSignal=5.5);
50 declareProperty("sPig",m_sPig=5.5);
51 declareProperty("sLTP",m_sLTP=5.5);
52 declareProperty("nchannels_max",m_nchannels_max=1000000);
53 declareProperty("GroupingType",m_groupingType="SubDetector");
54}
55
57= default;
58
60{
61 ATH_MSG_INFO ( "LArTimePhysPrediction in initialize()" );
62 ATH_CHECK( m_thistSvc.retrieve() );
63
64 ATH_CHECK( m_cablingKey.initialize() );
65 ATH_CHECK( m_calibMapKey.initialize() );
66 ATH_CHECK( m_caloMgrKey.initialize() );
67
68 //Initialize ntuples
69 NTupleFilePtr file1(ntupleSvc(),"/NTUPLES/FILE1");
70 if (!file1){
71 ATH_MSG_ERROR ( "Could not get NTupleFilePtr: failed" );
72 return StatusCode::FAILURE;
73 }
74 NTuplePtr nt(ntupleSvc(),"/NTUPLES/FILE1/MyNtuple");
75 if (!nt) {
76 nt=ntupleSvc()->book("/NTUPLES/FILE1/MyNtuple",CLID_ColumnWiseTuple,"Timing ntuple");
77 }
78 if (!nt){
79 ATH_MSG_ERROR ( "Booking of NTuple failed" );
80 return StatusCode::FAILURE;
81 }
82
83 m_nt=nt;
84
85 //Book leaves
86 ATH_CHECK( nt->addItem("Chid",m_Chid) );
87 ATH_CHECK( nt->addItem("Channel",m_Channel) );
88 ATH_CHECK( nt->addItem("CalibLine",m_CalibLine) );
89 ATH_CHECK( nt->addItem("is_lar_em",m_is_lar_em) );
90 ATH_CHECK( nt->addItem("is_lar_hec",m_is_lar_hec) );
91 ATH_CHECK( nt->addItem("is_lar_fcal",m_is_lar_fcal) );
92 ATH_CHECK( nt->addItem("pos_neg",m_pos_neg) );
93 ATH_CHECK( nt->addItem("barrel_ec",m_barrel_ec) );
94 ATH_CHECK( nt->addItem("FT",m_FT) );
95 ATH_CHECK( nt->addItem("FEBid",m_FEBid) );
96 ATH_CHECK( nt->addItem("slot",m_slot) );
97 ATH_CHECK( nt->addItem("eta",m_eta) );
98 ATH_CHECK( nt->addItem("phi",m_phi) );
99 ATH_CHECK( nt->addItem("layer",m_layer) );
100 ATH_CHECK( nt->addItem("real_eta",m_real_eta) );
101 ATH_CHECK( nt->addItem("real_phi",m_real_phi) );
102 ATH_CHECK( nt->addItem("t0",m_t0) );
103 ATH_CHECK( nt->addItem("tcali",m_tcali) );
104 ATH_CHECK( nt->addItem("tCalibPredicted",m_tCalibPredicted) );
105 ATH_CHECK( nt->addItem("CalibCables",m_CalibCables) );
106 ATH_CHECK( nt->addItem("SignalCables",m_SignalCables) );
107 ATH_CHECK( nt->addItem("TOF",m_TOF) );
108 ATH_CHECK( nt->addItem("DeltaTTC",m_DeltaTTC) );
109 ATH_CHECK( nt->addItem("tPhysPredicted",m_tPhysPredicted) );
110
111 return StatusCode::SUCCESS;
112}
113
115{
116 ATH_MSG_INFO ( "LArTimePhysPrediction in stop()" );
117 //Intermediate variables declaration (should be removed in an updated version)
118 const double meter2ns = 3.33564095;
119 int Channel;
120 int CalibLine;
121 double tphys;
122 double tcali;
123 double dt;
124 double TOF;
125 double CalibCables=0;
126 double LSignalFCAL=0;
127 double DeltaTTC;
128 double t0;
129 int barrel_ec;
130 int layer;
131 int eta;
132 int phi;
133 int FT;
134 int slot;
135 int pos_neg;
136 double real_eta;
137 double real_phi;
138 double radius=0;
139
140 //Retrieve the LArCaliwaveContainer
141 const LArCaliWaveContainer* larCaliWaveContainer = nullptr;
142 ATH_CHECK( detStore()->retrieve(larCaliWaveContainer, m_keyinput) );
143 ATH_MSG_INFO ( "Loaded LArCaliWaveContainer with key = " << m_keyinput );
144
145 //Create the LArPhysCaliTdiffComplete object
146 //LArPhysCaliTdiffComplete *larPhysCaliTdiffComplete = new LArPhysCaliTdiffComplete();
147 //ATH_CHECK( larPhysCaliTdiffComplete->setGroupingType(m_groupingType,msg()) );
148 //ATH_CHECK( larPhysCaliTdiffComplete->initialize() );
149
150 IAlgTool* algTool = nullptr;
151 ATH_CHECK( toolSvc()->retrieveTool("CaloDepthTool", algTool, this) );
152 m_CaloDepthTool=dynamic_cast<CaloDepthTool*>(algTool);
153 ATH_MSG_INFO ( "CaloDepthTool retrieved with name " << m_CaloDepth );
154
156 ATH_CHECK(clHdl.isValid());
157 const LArCalibLineMapping *clCont{*clHdl};
158
160 ATH_CHECK(cablingHdl.isValid());
161 const LArOnOffIdMapping* cabling{*cablingHdl};
162
164 ATH_CHECK(caloMgrHandle.isValid());
165 const CaloDetDescrManager* caloDDM{*caloMgrHandle};
166
167 //Define helpers
168 LArWaveHelper larWaveHelper;
169
170 const LArOnlineID* onlineHelper = nullptr;
171 ATH_CHECK( detStore()->retrieve(onlineHelper, "LArOnlineID") );
172
173 const CaloCell_ID* caloCID = nullptr;
174 ATH_CHECK( detStore()->retrieve(caloCID, "CaloCell_ID") );
175
176 //Get identifiers
177 const LArEM_ID* emId = caloCID->em_idHelper();
178 const LArHEC_ID* hecId = caloCID->hec_idHelper();
179 const LArFCAL_ID* fcalId = caloCID->fcal_idHelper();
180
181 //------------------------------------------------------------------------------------------------------------------------------
182 //--------------Start to loop on the LArCaliWaveContainer------------------------------------------------------------------------
183 for ( unsigned gain_it = CaloGain::LARHIGHGAIN ; gain_it < CaloGain::LARNGAIN ; ++gain_it ) { // Gains
184
185 CaliCellIt cell_it = larCaliWaveContainer->begin(gain_it) ;
186 CaliCellIt cell_it_e = larCaliWaveContainer->end(gain_it) ;
187
188 if ( cell_it == cell_it_e ) {
189 ATH_MSG_DEBUG ( "LArCaliWaveContainer (key = " << m_keyinput << ") has no wave with gain = " << gain_it );
190 continue;
191 } else {
192 ATH_MSG_INFO ( "Processing LArCaliWaveContainer (key = " << m_keyinput << ") in gain = " << gain_it );
193 }
194
195 //counters for channels and waves
196 int nchannels = 0;
197
198 for ( ; cell_it != cell_it_e; ++cell_it) { // Channels
199
200 if(nchannels==m_nchannels_max){continue;}
201 std::cout << "nchannels " << nchannels << std::endl;
202 nchannels++;
203
204 CaliWaveIt wave_it = cell_it->begin();
205 CaliWaveIt wave_it_e = cell_it->end();
206 if ( wave_it == wave_it_e ) {
207 ATH_MSG_DEBUG ( "Empty channel found..." );
208 continue; // skip empty channels
209 }
210
211 //use HWIdentifier
212 HWIdentifier chid = cell_it.channelId();
213
214 Identifier id;
215
216 try {
217 id = cabling->cnvToIdentifier(chid);
218 } catch ( const LArID_Exception& ) {
219 ATH_MSG_ERROR ( "LArCabling exception caught for channel " << MSG::hex << chid << MSG::dec );
220 continue;
221 }
222
223 Channel = onlineHelper->channel(chid);
224
225 const std::vector<HWIdentifier>& calibLineV = clCont->calibSlotLine(chid);
226 std::vector<HWIdentifier>::const_iterator calibLineIt = calibLineV.begin();
227 CalibLine = onlineHelper->channel(*calibLineIt) ;
228
229 //indexes eta/phi/layer
230 if (emId->is_lar_em(id)) {
231 eta=emId->eta(id);
232 phi=emId->phi(id);
233 layer=emId->sampling(id);}
234 else if (hecId->is_lar_hec(id)) {
235 eta=hecId->eta(id);
236 phi=hecId->phi(id);
237 layer=hecId->sampling(id);}
238 else if (fcalId->is_lar_fcal(id)) {
239 eta=fcalId->eta(id);
240 phi=fcalId->phi(id);
241 layer=fcalId->module(id);}
242 else {
243 ATH_MSG_INFO ( "cell not in the calorimeters " );
244 continue;
245 }
246
247 //identification using the online helper (common to all LAr calorimeters)
248 pos_neg = onlineHelper->pos_neg(chid);
249 barrel_ec = onlineHelper->barrel_ec(chid);
250 FT = onlineHelper->feedthrough(chid);
251 slot = onlineHelper->slot(chid);
252
253 //get the FT online identifier
254 HWIdentifier febid = onlineHelper->feb_Id(chid);
256
257 //real eta and phi: need the hash identifier
258 IdentifierHash theHash = caloCID->calo_cell_hash(id) ;
259 const CaloDetDescrElement* theDDE = caloDDM->get_element(theHash) ;
260
261 if(theDDE==nullptr) {
262 ATH_MSG_INFO ( "CellIndex = " << theHash << " has a DDE pointer NULL " );
263 continue;
264 }
265
266 real_eta = theDDE->eta();
267 real_phi = theDDE->phi();
268 CaloCell_ID::CaloSample sample = theDDE->getSampling();//ok for EMB and EMEC
269 //retrieve/compute the shower depth
270 //use the "best" available parametrisation of the shower depth at the time of development
271 //WARNING: use the CaloDepthTool's convention radius=r(barrel), radius=z(end-cap)
272 //for HEC and FCAL: lengths could be moved in the job options
273 if(emId->is_lar_em(id) && m_CaloDepthTool){
274 radius = CaloDepthTool::cscopt2_parametrized(sample,real_eta,real_phi,caloDDM);
275 }
276 else if(hecId->is_lar_hec(id)){//assumption: "arrival point" = middle of the compartment
277 if(layer==0) radius=4398.;
278 if(layer==1) radius=4806.;
279 if(layer==2) radius=5359.;
280 if(layer==3) radius=5840.;
281 }
282 else if(fcalId->is_lar_fcal(id)){//assumption: "arrival point" = middle of the compartment
283 if(layer==1) {radius=4916.;LSignalFCAL=m_vLSignal_FCAL[0];}
284 if(layer==2) {radius=5366.;LSignalFCAL=m_vLSignal_FCAL[1];}
285 if(layer==3) {radius=5816.;LSignalFCAL=m_vLSignal_FCAL[2];}
286 }
287
288 for ( ; wave_it != wave_it_e; ++wave_it) { // DACs <==> iterator = the caliwave
289
290 //initialize tphys
291 tphys=-999.;
292
293 //----step 1: get the calibration time
294 dt = wave_it->getDt();
295 tcali = dt * larWaveHelper.getMax(*wave_it);
296 //modified version of getT0
297 const unsigned Nbase=5;
298 double rT0=0.;
299 double asamp1=0.;
300 double asamp2=0.;
301 double base = larWaveHelper.getBaseline(*wave_it,Nbase);
302 double amax = larWaveHelper.getMaxAmp(*wave_it);
303 unsigned int imax=larWaveHelper.getMax(*wave_it);
304
305 for (unsigned int i=1; i<imax ; i++) {
306 asamp1=wave_it->getSample(i);
307 asamp2=wave_it->getSample(i-1);
308 if((asamp1-base)>amax*0.10 && (asamp2-base)<amax*0.10)
309 rT0 = i-1+(0.01*amax-(asamp2-base))/(asamp1-asamp2);
310 }
311 t0=rT0;
312
313 //----step 2: compute the TOF
314 if(emId->is_lar_em(id) && barrel_ec==0) TOF = fabs(radius)*TMath::CosH(real_eta)* meter2ns/1000;//EMB
315 else TOF = fabs(radius)/TMath::TanH(fabs(real_eta))* meter2ns/1000;//EC
316
317 //----step 3: deduction of the propagation time due to the propagation of the calibration pulse
318 //from the pulse until the calibration board
319 if(emId->is_lar_em(id) && barrel_ec==0){//EMB
320 for(int ieta=0;ieta<16;ieta++){
321 if(fabs(real_eta)>ieta*0.1 && fabs(real_eta)<(ieta+1)*0.1) CalibCables=0.7*m_sPig+m_vLCalib_EMB[layer][ieta]*m_sCalib;
322 }
323 }
324 else if(emId->is_lar_em(id) && abs(barrel_ec)==1) CalibCables=0.9*m_sPig+m_vLCalib_EMEC*m_sCalib;//EMEC
325 else if(hecId->is_lar_hec(id)) CalibCables=m_vLCalib_HEC*m_sCalib;//HEC
326 else if(fcalId->is_lar_fcal(id)) CalibCables=-LSignalFCAL*m_sSignal;//FCAL
327
328 //----step 4: deduction of the propagation times due to the optical fibers from USA15 to FEC
329 if(emId->is_lar_em(id) && barrel_ec==0){
330 if(pos_neg==1) DeltaTTC=m_vDeltaTTC_EMB[1][FT];//EMBA
331 else DeltaTTC=m_vDeltaTTC_EMB[0][FT];//EMBC
332 }
333 else {
334 if(real_eta>0) DeltaTTC=m_vDeltaTTC_EC[1][FT];//ECA
335 else DeltaTTC=m_vDeltaTTC_EC[0][FT];//ECC
336 //correction for special crates
337 //A FTs 2/3
338 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==2 && real_eta>0 && slot<11) DeltaTTC=m_vDeltaTTC_ECA_SPEC[0][0];
339 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==2 && real_eta>0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==3 && real_eta>0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECA_SPEC[0][1];
340 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==3 && real_eta>0) DeltaTTC=m_vDeltaTTC_ECA_SPEC[0][2];
341 //A FTs 9/10
342 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==9 && real_eta>0 && slot<11) DeltaTTC=m_vDeltaTTC_ECA_SPEC[1][0];
343 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==9 && real_eta>0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==10 && real_eta>0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECA_SPEC[1][1];
344 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==10 && real_eta>0) DeltaTTC=m_vDeltaTTC_ECA_SPEC[1][2];
345 //A FTs 15/16
346 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==15 && real_eta>0 && slot<11) DeltaTTC=m_vDeltaTTC_ECA_SPEC[2][0];
347 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==15 && real_eta>0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==16 && real_eta>0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECA_SPEC[2][1];
348 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==16 && real_eta>0) DeltaTTC=m_vDeltaTTC_ECA_SPEC[2][2];
349 //A FTs 21/22
350 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==21 && real_eta>0 && slot<11) DeltaTTC=m_vDeltaTTC_ECA_SPEC[3][0];
351 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==21 && real_eta>0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==21 && real_eta>0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECA_SPEC[3][1];
352 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==22 && real_eta>0) DeltaTTC=m_vDeltaTTC_ECA_SPEC[3][2];
353 //C FTs 2/3
354 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==2 && real_eta<0 && slot<11) DeltaTTC=m_vDeltaTTC_ECC_SPEC[0][0];
355 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==2 && real_eta<0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==3 && real_eta<0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECC_SPEC[0][1];
356 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==3 && real_eta>0) DeltaTTC=m_vDeltaTTC_ECC_SPEC[0][2];
357 //C FTs 9/10
358 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==9 && real_eta<0 && slot<11) DeltaTTC=m_vDeltaTTC_ECC_SPEC[1][0];
359 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==9 && real_eta<0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==10 && real_eta<0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECC_SPEC[1][1];
360 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==10 && real_eta<0) DeltaTTC=m_vDeltaTTC_ECC_SPEC[1][2];
361 //C FTs 15/16
362 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==15 && real_eta<0 && slot<11) DeltaTTC=m_vDeltaTTC_ECC_SPEC[2][0];
363 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==15 && real_eta<0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==16 && real_eta<0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECC_SPEC[2][1];
364 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==16 && real_eta<0) DeltaTTC=m_vDeltaTTC_ECC_SPEC[2][2];
365 //C FTs 21/22
366 if(emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==21 && real_eta<0 && slot<11) DeltaTTC=m_vDeltaTTC_ECC_SPEC[3][0];
367 if((emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==21 && real_eta<0 && slot>10) || (emId->is_lar_em(id) && abs(barrel_ec)==1 && FT==21 && real_eta<0 && slot<3)) DeltaTTC=m_vDeltaTTC_ECC_SPEC[3][1];
368 if(hecId->is_lar_hec(id) && abs(barrel_ec)==1 && FT==22 && real_eta<0) DeltaTTC=m_vDeltaTTC_ECC_SPEC[3][2];
369 }
370
371 //----step 5: computation of tphys
372 //tphys=tcali-CalibCables+TOF-DeltaTTC;
373 //add the effect from LTP cables: LTPI->LTP and LTP->LTP (hard coded)
374 //for A-C sides difference: a 8 ns is set (derived from September 2008 splash events)
375 if(pos_neg==1 && emId->is_lar_em(id) && abs(barrel_ec)==0) tphys=tcali-CalibCables+TOF+DeltaTTC+8+0.3*m_sLTP;//EMBA
376 else if(pos_neg==0 && emId->is_lar_em(id) && abs(barrel_ec)==0) tphys=tcali-CalibCables+TOF+DeltaTTC+0.3*m_sLTP;//EMBC
377 else if(pos_neg==1 && emId->is_lar_em(id) && abs(barrel_ec)==1) tphys=tcali-CalibCables+TOF+DeltaTTC+8;//EMECA
378 else if(real_eta>0 && (emId->is_lar_hec(id)||emId->is_lar_fcal(id))) tphys=tcali-CalibCables+TOF+DeltaTTC+8+0.3*m_sLTP;//HEC,FCAL A
379 else if(real_eta<0 && (emId->is_lar_hec(id)||emId->is_lar_fcal(id))) tphys=tcali-CalibCables+TOF+DeltaTTC+0.3*m_sLTP;//HEC,FCAL C
380 else tphys=tcali-CalibCables+TOF+DeltaTTC;//EMECC
381
382 //prediction of the expected calibration time
383 //not finalized (EMEC signal cables lengths not implemented)
384 if(emId->is_lar_em(id) && abs(barrel_ec)==0){//EMB
385 for(int ieta=0;ieta<16;ieta++){
386 if(fabs(real_eta)>ieta*0.1 && fabs(real_eta)<(ieta+1)*0.1 && (layer==0 || (layer==1 && fabs(real_eta)<0.6))) m_SignalCables=0.9*m_sPig+m_vLSignal_EMB[layer][ieta]*m_sSignal;
387 else if(fabs(real_eta)>ieta*0.1 && fabs(real_eta)<(ieta+1)*0.1) m_SignalCables=0.7*m_sPig+m_vLSignal_EMB[layer][ieta]*m_sSignal;
388 }
389 }
390 else if(emId->is_lar_em(id) && abs(barrel_ec)==1) m_SignalCables=0.9*m_sPig+m_vLSignal_EMEC*m_sSignal;//EMEC
391 else if(hecId->is_lar_hec(id)) m_SignalCables=m_vLSignal_HEC*m_sSignal;//HEC
392 else if(fcalId->is_lar_fcal(id)) m_SignalCables=0.;//FCAL
393
394 m_tCalibPredicted=m_SignalCables+CalibCables+tcali-t0;
395 if(fcalId->is_lar_fcal(id))m_tCalibPredicted=tcali-t0;
396
397 //fill larPhysCaliTdiffComplete (needed to fill the DB)
398 //larPhysCaliTdiffComplete->set(chid,gain_it,tphys);
399
400 //for debugging purposes: check the computed times
428
429 //write the ntuple
430 if(emId->is_lar_em(id)) m_is_lar_em=1;
431 else m_is_lar_em=0;
432 if(emId->is_lar_hec(id)) m_is_lar_hec=1;
433 else m_is_lar_hec=0;
434 if(emId->is_lar_fcal(id)) m_is_lar_fcal=1;
435 else m_is_lar_fcal=0;
437 m_Channel=Channel;
438 m_CalibLine=CalibLine;
439 m_pos_neg=pos_neg;
440 m_barrel_ec=barrel_ec;
441 m_FT=FT;
442 m_slot=slot;
443 m_eta=eta;
444 m_phi=phi;
445 m_layer=layer;
446 m_real_eta=real_eta;
447 m_real_phi=real_phi;
448 m_t0=t0;
449 m_tcali=tcali;
450 m_CalibCables=CalibCables;
451 m_TOF=TOF;
452 m_DeltaTTC=DeltaTTC;
453 m_tPhysPredicted=tphys;
454 //m_SignalCables: already filled
455 //m_tCalibPredicted: already filled (computation to be finalized)
456
457 ATH_MSG_VERBOSE ( "Try to write to ntuple " );
458 ATH_CHECK( ntupleSvc()->writeRecord(m_nt) );
459 ATH_MSG_VERBOSE ( "wave written to ntuple" );
460 } // end of loop over DACs
461
462 }// end of loop over Channels
463
464 } // end of loop over Gains
465
466 // Record LArPhysCaliTdiffComplete (needed to fill the DB)
484
485 //-----------------------------------end of the main loop-------------------------------------------------------------------------
486 //--------------------------------------------------------------------------------------------------------------------------------
487
488 ATH_MSG_INFO ( "end of stop" );
489 return StatusCode::SUCCESS ;
490}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Declaration of CaloDepthTool.
Definition of CaloDetDescrManager.
Definition of CaloDetDescriptor.
LArCaliWaveContainer::LArCaliWaves::const_iterator CaliWaveIt
LArCaliWaveContainer::ConstConditionsMapIterator CaliCellIt
static Double_t t0
INTupleSvc * ntupleSvc()
int imax(int i, int j)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
bool is_lar_em(Identifier id) const
bool is_lar_fcal(Identifier id) const
bool is_lar_hec(Identifier id) const
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition CaloCell_ID.h:75
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition CaloCell_ID.h:63
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
Definition CaloCell_ID.h:69
Implementation of the ICaloDepthTool interface.Given a Track direction, checks if it is in the Calori...
static double cscopt2_parametrized(const CaloCell_ID::CaloSample sample, const double eta, const double phi, const CaloDetDescrManager *caloDD)
Same as cscopt with the outermost EMB2 point excluded.
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
value_type get_compact() const
Get the compact id.
This is a "hash" representation of an Identifier.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Liquid Argon Cumulative Wave Container.
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
ConditionsMap::const_iterator ConstConditionsMapIterator
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
int eta(const Identifier id) const
return eta according to :
int phi(const Identifier id) const
return phi according to :
int sampling(const Identifier id) const
return sampling according to :
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
int phi(const Identifier id) const
phi [0,15]
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
int phi(const Identifier id) const
return phi[0,63] outer part [0,31] inner part
int eta(const Identifier id) const
return eta [0,9] outer part [0,3] inner part
int sampling(const Identifier id) const
return sampling [0,3] (only 0 for supercells)
Helper class for LArHEC offline identifiers.
Definition LArHEC_ID.h:76
Exception class for LAr Identifiers.
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
NTuple::Item< double > m_TOF
std::vector< std::vector< double > > m_vDeltaTTC_EMB
NTuple::Item< double > m_real_phi
NTuple::Item< double > m_SignalCables
SG::ReadCondHandleKey< LArCalibLineMapping > m_calibMapKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
NTuple::Item< double > m_CalibCables
std::vector< std::vector< double > > m_vDeltaTTC_ECA_SPEC
virtual StatusCode stop() override
NTuple::Item< double > m_t0
NTuple::Item< long > m_is_lar_em
NTuple::Item< long > m_is_lar_hec
NTuple::Item< long > m_layer
NTuple::Item< double > m_DeltaTTC
NTuple::Item< long > m_phi
NTuple::Item< long > m_barrel_ec
std::vector< double > m_vEtaMin_EMB
NTuple::Item< long > m_pos_neg
NTuple::Item< long > m_eta
LArTimePhysPrediction(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< std::vector< double > > m_vLSignal_EMB
NTuple::Item< long > m_slot
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
NTuple::Item< double > m_real_eta
NTuple::Item< long > m_FEBid
NTuple::Item< double > m_tPhysPredicted
virtual StatusCode initialize() override
NTuple::Item< long > m_Channel
NTuple::Item< double > m_tCalibPredicted
std::vector< std::vector< double > > m_vDeltaTTC_ECC_SPEC
NTuple::Item< long > m_Chid
std::vector< std::vector< double > > m_vLCalib_EMB
NTuple::Item< long > m_is_lar_fcal
NTuple::Item< double > m_tcali
ServiceHandle< ITHistSvc > m_thistSvc
NTuple::Item< long > m_FT
std::vector< double > m_vEtaMax_EMB
std::vector< std::vector< double > > m_vDeltaTTC_EC
std::vector< double > m_vLSignal_FCAL
NTuple::Item< long > m_CalibLine
double getMaxAmp(const LArWave &theWave) const
double getBaseline(const LArWave &theWave, unsigned nBase) const
unsigned int getMax(const LArWave &theWave) const
return index of maximum sample
std::string base
Definition hcg.cxx:81
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18