ATLAS Offline Software
Loading...
Searching...
No Matches
CBNTAA_TBTPValidation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9#include "TBEvent/TBPhase.h"
10#include "TBEvent/TBEventInfo.h"
11#include "TBEvent/TBBPCCont.h"
15#include "TBEvent/TBTDC.h"
16#include "TBEvent/TBTrack.h"
18#include "TBEvent/TBMWPCCont.h"
19
20
21CBNTAA_TBTPValidation::CBNTAA_TBTPValidation(const std::string & name, ISvcLocator * pSvcLocator) : CBNT_TBRecBase(name, pSvcLocator)
22{
23 declareProperty("NeverReturnFailure", m_neverReturnFailure=false);
24
25 // TBADCRawCont
26 declareProperty("ContainerKey1",m_containerKey1="ADCRawCont");
27 m_adc=NULL;
30 // TBTDCRawCont
31 declareProperty("ContainerKey2",m_containerKey2="TDCRawCont");
32 m_tdc_raw=NULL;
36 // TBPhase
37 declareProperty("ContainerKey3",m_containerKey3="TBPhase");
38 m_phase=NULL;
39 m_phaseind=NULL;
40 m_dTtoWAC=NULL;
41 // TBEventInfo
42 declareProperty("m_containerKey4",m_containerKey4="TBEventInfo");
43 m_ev_number=NULL;
44 m_ev_clock=NULL;
45 m_ev_type=NULL;
46 m_run_num=NULL;
47 m_beam_moment=NULL;
48 m_beam_part=NULL;
49 m_cryoX=NULL;
50 m_cryoAngle=NULL;
51 m_tableY=NULL;
52 // TBBPCCont
53 declareProperty("m_containerKey5",m_containerKey5="BPCCont");
54 m_xPos=NULL;
55 m_yPos=NULL;
56 m_xErr=NULL;
57 m_yErr=NULL;
58 m_xPulse=NULL;
59 m_yPulse=NULL;
60 m_hitnumber=NULL;
61 m_xPosOverflow=NULL;
62 m_yPosOverflow=NULL;
68 // TBLArDigitContainer
69 declareProperty("m_containerKey6",m_containerKey6="FREE");
70 m_channelID=NULL;
71 m_gain=NULL;
72 m_nSamples=NULL;
73 m_samples=NULL;
74 // TBScintillatorCont
75 declareProperty("m_containerKey7",m_containerKey7="ScintillatorCont");
76 m_signal_scint=NULL;
82 // TBTailCatcher
83 declareProperty("m_containerKey8",m_containerKey8="TailCatcher");
84 m_signals=NULL;
85 m_signal_tCatch=NULL;
91 // TBTDC
92 declareProperty("m_containerKey9",m_containerKey9="TBTDC");
93 m_tdc_TBTDC=NULL;
94 m_tdcmin_TBTDC=NULL;
95 m_scale_TBTDC=NULL;
96 m_phase_TBTDC=NULL;
97 // TBTrack
98 declareProperty("m_containerKey10",m_containerKey10="Track");
99 m_hitNumberU=NULL;
100 m_hitNumberV=NULL;
101 m_residualu=NULL;
102 m_residualv=NULL;
103 m_chi2=NULL;
104 m_chi2u=NULL;
105 m_chi2v=NULL;
106 m_angle=NULL;
107 m_uslope=NULL;
108 m_vslope=NULL;
109 m_uintercept=NULL;
110 m_vintercept=NULL;
111 m_cryou=NULL;
112 m_cryov=NULL;
113 m_cryow=NULL;
114 // TBTriggerPatternUnit
115 declareProperty("m_containerKey11",m_containerKey11="TBTrigPat");
116 m_triggerWord=NULL;
117 m_triggers=NULL;
118 // TBMWPCCont
119 declareProperty("m_containerKey12",m_containerKey12="MWPCCont");
120 m_cPos=NULL;
121 m_cErr=NULL;
122 m_isX=NULL;
123 m_clusterSize_c=NULL;
124 m_cPosOverflow=NULL;
127}
128
129
131{//Clean up arrays of ntuple entries (if they have been booked)
132
133 // TBADCRawCont
134 if (m_adc) delete m_adc;
137 // TBTDCRawCont
138 if (m_tdc_raw) delete m_tdc_raw;
142 // TBPhase
143 if (m_phase) delete m_phase;
144 if (m_phaseind) delete m_phaseind;
145 if (m_dTtoWAC) delete m_dTtoWAC;
146 // TBEventInfo
147 if (m_ev_number) delete m_ev_number;
148 if (m_ev_clock) delete m_ev_clock;
149 if (m_ev_type) delete m_ev_type;
150 if (m_run_num) delete m_run_num;
151 if (m_beam_moment) delete m_beam_moment;
152 if (m_beam_part) delete m_beam_part;
153 if (m_cryoX) delete m_cryoX;
154 if (m_cryoAngle) delete m_cryoAngle;
155 if (m_tableY) delete m_tableY;
156 // TBBPCCont
157 if (m_xPos) delete m_xPos;
158 if (m_yPos) delete m_yPos;
159 if (m_xErr) delete m_xErr;
160 if (m_yErr) delete m_yErr;
161 if (m_xPulse) delete m_xPulse;
162 if (m_yPulse) delete m_yPulse;
163 if (m_hitnumber) delete m_hitnumber;
164 if (m_xPosOverflow) delete m_xPosOverflow;
165 if (m_yPosOverflow) delete m_yPosOverflow;
171 // TBLArDigitContainer
172 if (m_channelID) delete m_channelID;
173 if (m_gain) delete m_gain;
174 if (m_nSamples) delete m_nSamples;
175 if (m_samples) delete m_samples;
176 // TBScintillatorCont
177 if (m_signal_scint) delete m_signal_scint;
183 // TBTailCatcher
184 if (m_signals) delete m_signals;
191 // TBTDC
192 if (m_tdc_TBTDC) delete m_tdc_TBTDC;
193 if (m_tdcmin_TBTDC) delete m_tdcmin_TBTDC;
194 if (m_scale_TBTDC) delete m_scale_TBTDC;
195 if (m_phase_TBTDC) delete m_phase_TBTDC;
196 // TBTrack
197 if (m_hitNumberU) delete m_hitNumberU;
198 if (m_hitNumberV) delete m_hitNumberV;
199 if (m_residualu) delete m_residualu;
200 if (m_residualv) delete m_residualv;
201 if (m_chi2) delete m_chi2;
202 if (m_chi2u) delete m_chi2u;
203 if (m_chi2v) delete m_chi2v;
204 if (m_angle) delete m_angle;
205 if (m_uslope) delete m_uslope;
206 if (m_vslope) delete m_vslope;
207 if (m_uintercept) delete m_uintercept;
208 if (m_vintercept) delete m_vintercept;
209 if (m_cryou) delete m_cryou;
210 if (m_cryov) delete m_cryov;
211 if (m_cryow) delete m_cryow;
212 // TBTriggerPatternUnit
213 if (m_triggerWord) delete m_triggerWord;
214 if (m_triggers) delete m_triggers;
215 // TBMWPCCont
216 if (m_cPos) delete m_cPos;
217 if (m_cErr) delete m_cErr;
218 if (m_isX) delete m_isX;
220 if (m_cPosOverflow) delete m_cPosOverflow;
223}
224
225
226
228{
229 ATH_MSG_DEBUG ( "in initialize()" );
230
231 // TBADCRawCont
232 addBranch("TBTPValid_TBADCRaw_m_adc",m_adc);
233 addBranch("TBTPValid_TBADCRaw_tbDetectorName",m_tbDetectorName_TBADCRawCont);
234 addBranch("TBTPValid_TBADCRaw_overflow",m_overflow_TBADCRawCont);
235 // TBTDCRawCont
236 addBranch("TBTPValid_TBTDCRaw_tdc",m_tdc_raw);
237 addBranch("TBTPValid_TBTDCRaw_underThreshold",m_underThreshold_raw);
238 addBranch("TBTPValid_TBTDCRaw_tbDetectorName",m_tbDetectorName_TBTDCRawCont);
239 addBranch("TBTPValid_TBTDCRaw_overflow",m_overflow_TBTDCRawCont);
240 // TBPhase
241 addBranch("TBTPValid_TBPhase_phase",m_phase);
242 addBranch("TBTPValid_TBPhase_phaseind",m_phaseind);
243 addBranch("TBTPValid_TBPhase_dTtoWAC",m_dTtoWAC);
244 // TBEventInfo
245 addBranch("TBTPValid_TBEventInfo_ev_number", m_ev_number);
246 addBranch("TBTPValid_TBEventInfo_ev_clock", m_ev_clock);
247 addBranch("TBTPValid_TBEventInfo_ev_type", m_ev_type);
248 addBranch("TBTPValid_TBEventInfo_run_num", m_run_num);
249 addBranch("TBTPValid_TBEventInfo_beam_moment", m_beam_moment);
250 addBranch("TBTPValid_TBEventInfo_beam_part", m_beam_part);
251 addBranch("TBTPValid_TBEventInfo_cryoX", m_cryoX);
252 addBranch("TBTPValid_TBEventInfo_cryoAngle", m_cryoAngle);
253 addBranch("TBTPValid_TBEventInfo_tableY", m_tableY);
254 // TBBPCCont
255 addBranch("TBTPValid_TBBPCCont_xPos", m_xPos);
256 addBranch("TBTPValid_TBBPCCont_yPos", m_yPos);
257 addBranch("TBTPValid_TBBPCCont_xErr", m_xErr);
258 addBranch("TBTPValid_TBBPCCont_yErr", m_yErr);
259 addBranch("TBTPValid_TBBPCCont_xPulse", m_xPulse);
260 addBranch("TBTPValid_TBBPCCont_yPulse", m_yPulse);
261 addBranch("TBTPValid_TBBPCCont_hitnumber", m_hitnumber);
262 addBranch("TBTPValid_TBBPCCont_xPosOverflow", m_xPosOverflow);
263 addBranch("TBTPValid_TBBPCCont_yPosOverflow", m_yPosOverflow);
264 addBranch("TBTPValid_TBBPCCont_xPulseOverflow", m_xPulseOverflow);
265 addBranch("TBTPValid_TBBPCCont_yPulseOverflow", m_yPulseOverflow);
266 addBranch("TBTPValid_TBBPCCont_overflowSetFlag", m_overflowSetFlag);
267 addBranch("TBTPValid_TBBPCCont_tbDetectorName", m_tbDetectorName_TBBPCCont);
268 addBranch("TBTPValid_TBBPCCont_overflow", m_overflow_TBBPCCont);
269 // TBLArDigitContainer
270 addBranch("TBTPValid_TBLArDigitContainer_channelID", m_channelID);
271 addBranch("TBTPValid_TBLArDigitContainer_gain", m_gain);
272 addBranch("TBTPValid_TBLArDigitContainer_nSamples", m_nSamples);
273 addBranch("TBTPValid_TBLArDigitContainer_samples", m_samples);
274 // TBScintillatorCont
275 addBranch("TBTPValid_TBScintillatorCont_signal", m_signal_scint);
276 addBranch("TBTPValid_TBScintillatorCont_time_signal", m_time_signal_scint);
277 addBranch("TBTPValid_TBScintillatorCont_signal_overflow", m_signal_overflow_scint);
278 addBranch("TBTPValid_TBScintillatorCont_time_overflow", m_time_overflow_scint);
279 addBranch("TBTPValid_TBScintillatorCont_tbDetectorName", m_tbDetectorName_TBScintillatorCont);
280 addBranch("TBTPValid_TBScintillatorCont_overflow", m_overflow_TBScintillatorCont);
281 // TBTailCatcher
282 addBranch("TBTPValid_TBTailCatcher_signals", m_signals);
283 addBranch("TBTPValid_TBTailCatcher_signal", m_signal_tCatch);
284 addBranch("TBTPValid_TBTailCatcher_time_signal", m_time_signal_tCatch);
285 addBranch("TBTPValid_TBTailCatcher_signal_overflow", m_signal_overflow_tCatch);
286 addBranch("TBTPValid_TBTailCatcher_time_overflow", m_time_overflow_tCatch);
287 addBranch("TBTPValid_TBTailCatcher_tbDetectorName", m_tbDetectorName_TBTailCatcher);
288 addBranch("TBTPValid_TBTailCatcher_overflow", m_overflow_TBTailCatcher);
289 // TBTDC
290 addBranch("TBTPValid_TBTDC_tdc", m_tdc_TBTDC);
291 addBranch("TBTPValid_TBTDC_tdcmin", m_tdcmin_TBTDC);
292 addBranch("TBTPValid_TBTDC_scale", m_scale_TBTDC);
293 addBranch("TBTPValid_TBTDC_phase", m_phase_TBTDC);
294 // TBTrack
295 addBranch("TBTPValid_TBTrack_hitNumberU", m_hitNumberU);
296 addBranch("TBTPValid_TBTrack_hitNumberV", m_hitNumberV);
297 addBranch("TBTPValid_TBTrack_residualu", m_residualu);
298 addBranch("TBTPValid_TBTrack_residualv", m_residualv);
299 addBranch("TBTPValid_TBTrack_chi2", m_chi2);
300 addBranch("TBTPValid_TBTrack_chi2u", m_chi2u);
301 addBranch("TBTPValid_TBTrack_chi2v", m_chi2v);
302 addBranch("TBTPValid_TBTrack_angle", m_angle);
303 addBranch("TBTPValid_TBTrack_uslope", m_uslope);
304 addBranch("TBTPValid_TBTrack_vslope", m_vslope);
305 addBranch("TBTPValid_TBTrack_uintercept", m_uintercept);
306 addBranch("TBTPValid_TBTrack_vintercept", m_vintercept);
307 addBranch("TBTPValid_TBTrack_cryou", m_cryou);
308 addBranch("TBTPValid_TBTrack_cryov", m_cryov);
309 addBranch("TBTPValid_TBTrack_cryow", m_cryow);
310 // TBTriggerPatternUnit
311 addBranch("TBTPValid_TBTriggerPatternUnit_triggerWord", m_triggerWord);
312 addBranch("TBTPValid_TBTriggerPatternUnit_triggers", m_triggers);
313 // TBMWPCCont
314 addBranch("TBTPValid_TBMWPCCont_cPos", m_cPos);
315 addBranch("TBTPValid_TBMWPCCont_cErr", m_cErr);
316 addBranch("TBTPValid_TBMWPCCont_isX", m_isX);
317 addBranch("TBTPValid_TBMWPCCont_clusterSize_c", m_clusterSize_c);
318 addBranch("TBTPValid_TBMWPCCont_cPosOverflow", m_cPosOverflow);
319 addBranch("TBTPValid_TBMWPCCont_tbDetectorName", m_tbDetectorName_TBMWPCCont);
320 addBranch("TBTPValid_TBMWPCCont_overflow", m_overflow_TBMWPCCont);
321
322 return StatusCode::SUCCESS;
323
324}
325
326
328{
329 // ----------------------------------------------------------------------------------------------------
330 // TBADCRawCont
331 // ----------------------------------------------------------------------------------------------------
332 const TBADCRawCont * adcCont;
333 StatusCode sc = evtStore()->retrieve(adcCont,m_containerKey1);
334 if (sc.isFailure()) {
335 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBADCRawCont from StoreGate! key= " << m_containerKey1 << "\033[0m" );
336 } else {
337 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBADCRawCont ( StoreGate key =" << m_containerKey1 << " ) ..."<< "\033[0m" );
338
339 const unsigned nADC = (TBADCRawCont::size_type)adcCont->size();
340 m_adc->resize(nADC);
341 m_tbDetectorName_TBADCRawCont->resize(nADC);
342 m_overflow_TBADCRawCont->resize(nADC);
343
344 unsigned NtupleVectorIndex = 0;
345 for (const TBADCRaw* adc : *adcCont) {
346 (*m_adc)[NtupleVectorIndex] = adc-> getADC();
347 (*m_tbDetectorName_TBADCRawCont)[NtupleVectorIndex] = adc-> getDetectorName();
348 (*m_overflow_TBADCRawCont)[NtupleVectorIndex] = adc-> isOverflow();
349 }
350 }
351
352 // ----------------------------------------------------------------------------------------------------
353 // TBTDCRawCont
354 // ----------------------------------------------------------------------------------------------------
355 const TBTDCRawCont * tdcCont;
356 sc = evtStore()->retrieve(tdcCont,m_containerKey2);
357 if (sc.isFailure()) {
358 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBTDCRawCont from StoreGate! key= " << m_containerKey2 << "\033[0m" );
359 } else {
360 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBTDCRawCont ( StoreGate key =" << m_containerKey2 << " ) ..."<< "\033[0m" );
361
362 const unsigned nTDC = (TBTDCRawCont::size_type)tdcCont->size();
363 m_tdc_raw->resize(nTDC);
364 m_underThreshold_raw->resize(nTDC);
365 m_tbDetectorName_TBTDCRawCont->resize(nTDC);
366 m_overflow_TBTDCRawCont->resize(nTDC);
367
368 unsigned NtupleVectorIndex = 0;
369 for (const TBTDCRaw* tdc : *tdcCont) {
370 (*m_tdc_raw)[NtupleVectorIndex] = tdc-> getTDC();
371 (*m_underThreshold_raw)[NtupleVectorIndex] = tdc-> isUnderThreshold();
372 (*m_tbDetectorName_TBTDCRawCont)[NtupleVectorIndex] = tdc-> getDetectorName();
373 (*m_overflow_TBTDCRawCont)[NtupleVectorIndex] = tdc-> isOverflow();
374 }
375 }
376
377 // ----------------------------------------------------------------------------------------------------
378 // TBPhase
379 // ----------------------------------------------------------------------------------------------------
380 const TBPhase * phase = nullptr;
381 sc = evtStore()->retrieve(phase,m_containerKey3);
382 if (sc.isFailure()) {
383 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBPhase from StoreGate! key= " << m_containerKey3 << "\033[0m" );
384 } else {
385 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBPhase ( StoreGate key =" << m_containerKey3 << " ) ..."<< "\033[0m" );
386
387 m_phase ->resize(1);
388 m_phaseind ->resize(1);
389 m_dTtoWAC ->resize(1);
390
391 (*m_phase)[0] = phase-> getPhase();
392 (*m_phaseind)[0] = phase-> getPhaseind();
393 (*m_dTtoWAC)[0] = phase-> getdTtoWACSigned();
394 }
395
396 // ----------------------------------------------------------------------------------------------------
397 // TBEventInfo
398 // ----------------------------------------------------------------------------------------------------
399 const TBEventInfo * EventInfo = nullptr;
400 sc = evtStore()->retrieve(EventInfo,m_containerKey4);
401 if (sc.isFailure()) {
402 ATH_MSG_ERROR ( "\033[31m" << "- Can not read EventInfo from StoreGate! key= " << m_containerKey4 << "\033[0m" );
403 } else {
404 ATH_MSG_DEBUG ( "\033[34m" << "- Going over EventInfo ( StoreGate key =" << m_containerKey4 << " ) ..."<< "\033[0m" );
405
406 m_ev_number ->resize(1);
407 m_ev_clock ->resize(1);
408 m_ev_type ->resize(1);
409 m_run_num ->resize(1);
410 m_beam_moment ->resize(1);
411 m_beam_part ->resize(1);
412 m_cryoX ->resize(1);
413 m_cryoAngle ->resize(1);
414 m_tableY ->resize(1);
415
416 (*m_ev_number)[0] = EventInfo-> getEventNum();
417 (*m_ev_clock)[0] = EventInfo-> getEventClock();
418 (*m_ev_type)[0] = EventInfo-> getEventType();
419 (*m_run_num)[0] = EventInfo-> getRunNum();
420 (*m_beam_moment)[0] = EventInfo-> getBeamMomentum();
421 (*m_beam_part)[0] = EventInfo-> getBeamParticle();
422 (*m_cryoX)[0] = EventInfo-> getCryoX();
423 (*m_cryoAngle)[0] = EventInfo-> getCryoAngle();
424 (*m_tableY)[0] = EventInfo-> getTableY();
425 }
426
427
428 // ----------------------------------------------------------------------------------------------------
429 // TBBPCCont
430 // ----------------------------------------------------------------------------------------------------
431 const TBBPCCont * BPCCont = nullptr;
432 sc = evtStore()->retrieve(BPCCont,m_containerKey5);
433 if (sc.isFailure()) {
434 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBBPCCont from StoreGate! key= " << m_containerKey5 << "\033[0m" );
435 } else {
436 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBBPCCont ( StoreGate key =" << m_containerKey5 << " ) ..."<< "\033[0m" );
437
438 const unsigned nBPCCont = (TBBPCCont::size_type)BPCCont->size();
439 m_xPos ->resize(nBPCCont);
440 m_yPos ->resize(nBPCCont);
441 m_xErr ->resize(nBPCCont);
442 m_yErr ->resize(nBPCCont);
443 m_xPulse ->resize(nBPCCont);
444 m_yPulse ->resize(nBPCCont);
445 m_hitnumber ->resize(nBPCCont);
446 m_xPosOverflow ->resize(nBPCCont);
447 m_yPosOverflow ->resize(nBPCCont);
448 m_xPulseOverflow ->resize(nBPCCont);
449 m_yPulseOverflow ->resize(nBPCCont);
450 m_overflowSetFlag ->resize(nBPCCont);
451 m_tbDetectorName_TBBPCCont ->resize(nBPCCont);
452 m_overflow_TBBPCCont ->resize(nBPCCont);
453
454 unsigned NtupleVectorIndex = 0;
455 for (const TBBPC* bpc : *BPCCont) {
456 (*m_xPos)[NtupleVectorIndex] = bpc-> getXPos();
457 (*m_yPos)[NtupleVectorIndex] = bpc-> getYPos();
458 (*m_xErr)[NtupleVectorIndex] = bpc-> getXErr();
459 (*m_yErr)[NtupleVectorIndex] = bpc-> getYErr();
460 (*m_xPulse)[NtupleVectorIndex] = bpc-> getXPulse();
461 (*m_yPulse)[NtupleVectorIndex] = bpc-> getYPulse();
462 (*m_hitnumber)[NtupleVectorIndex] = bpc-> getHitNbr();
463 (*m_xPosOverflow)[NtupleVectorIndex] = bpc-> isXPosOverflow();
464 (*m_yPosOverflow)[NtupleVectorIndex] = bpc-> isYPosOverflow();
465 (*m_xPulseOverflow)[NtupleVectorIndex] = bpc-> isXPulseOverflow();
466 (*m_yPulseOverflow)[NtupleVectorIndex] = bpc-> isYPulseOverflow();
467 (*m_overflowSetFlag)[NtupleVectorIndex] = false;//bpc-> m_overflowSetFlag ;
468 (*m_tbDetectorName_TBBPCCont)[NtupleVectorIndex] = bpc-> getDetectorName();
469 (*m_overflow_TBBPCCont)[NtupleVectorIndex] = bpc-> isOverflow();
470 }
471 }
472
473
474 // ----------------------------------------------------------------------------------------------------
475 // TBLArDigitContainer // FIXME !!! probably does not work right.... //
476 // ----------------------------------------------------------------------------------------------------
477 const TBLArDigitContainer * LArDigitContainer = nullptr;
479 if (sc.isFailure()) {
480 ATH_MSG_ERROR ( "\033[31m" << "- Can not read LArDigitContainer from StoreGate! key= " << m_containerKey6 << "\033[0m" );
481 } else {
482 ATH_MSG_DEBUG ( "\033[34m" << "- Going over LArDigitContainer ( StoreGate key =" << m_containerKey6 << " ) ..."<< "\033[0m" );
483
484 const unsigned nLArDigits = (TBLArDigitContainer::size_type)LArDigitContainer->size();
485 m_channelID->resize(nLArDigits);
486 m_gain->resize(nLArDigits);
487 m_nSamples->resize(nLArDigits);
488 if (nLArDigits)
489 m_samples->reserve( ( (*(LArDigitContainer->begin()))->nsamples() ) * nLArDigits);
490
491 unsigned NtupleVectorIndex = 0;
492 for (const LArDigit* larDigit : *LArDigitContainer) {
493 (*m_channelID)[NtupleVectorIndex] = larDigit->hardwareID().get_identifier32().get_compact() ;
494 (*m_gain)[NtupleVectorIndex] = (unsigned char)larDigit->gain();
495
496 unsigned nM_samples = larDigit->nsamples();
497 (*m_nSamples)[NtupleVectorIndex] = nM_samples;
498
499 m_samples->assign (larDigit->samples().begin(),
500 larDigit->samples().end());
501 }
502 }
503
504
505 // ----------------------------------------------------------------------------------------------------
506 // TBScintillatorCont
507 // ----------------------------------------------------------------------------------------------------
508 const TBScintillatorCont * ScintillatorCont = nullptr;
509 sc = evtStore()->retrieve(ScintillatorCont,m_containerKey7);
510 if (sc.isFailure()) {
511 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBScintillatorCont from StoreGate! key= " << m_containerKey7 << "\033[0m" );
512 } else {
513 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBScintillatorCont ( StoreGate key =" << m_containerKey7 << " ) ..."<< "\033[0m" );
514
515 const unsigned nScintillators = (TBScintillatorCont::size_type)ScintillatorCont->size();
516 m_signal_scint ->resize(nScintillators);
517 m_time_signal_scint ->resize(nScintillators);
518 m_signal_overflow_scint ->resize(nScintillators);
519 m_time_overflow_scint ->resize(nScintillators);
520 m_tbDetectorName_TBScintillatorCont ->resize(nScintillators);
521 m_overflow_TBScintillatorCont ->resize(nScintillators);
522
523
524 unsigned NtupleVectorIndex = 0;
525 TBScintillatorCont::const_iterator it_TBScintillatorCont = ScintillatorCont->begin();
526 TBScintillatorCont::const_iterator last_TBScintillatorCont = ScintillatorCont->end();
527 for(;it_TBScintillatorCont!=last_TBScintillatorCont;++it_TBScintillatorCont,NtupleVectorIndex++) {
528 // scint->isTimeOverflow() is not a constant method, and so we define here
529 // 'TBScintillator * scint' instead of the usual 'const TBScintillator * scint'
530 // since for a const TBScintillator all methods need to be const as well...
531 const TBScintillator * scint = (*it_TBScintillatorCont);
532
533 (*m_signal_scint)[NtupleVectorIndex] = scint-> getSignal();
534 (*m_time_signal_scint)[NtupleVectorIndex] = scint-> getTimeSignal();
535 (*m_signal_overflow_scint)[NtupleVectorIndex] = scint-> isSignalOverflow();
536 (*m_time_overflow_scint)[NtupleVectorIndex] = scint-> isTimeOverflow();
537 (*m_tbDetectorName_TBScintillatorCont)[NtupleVectorIndex] = scint-> getDetectorName();
538 (*m_overflow_TBScintillatorCont)[NtupleVectorIndex] = scint-> isOverflow();
539 }
540 }
541
542
543 // ----------------------------------------------------------------------------------------------------
544 // TBTailCatcher
545 // ----------------------------------------------------------------------------------------------------
546 const TBTailCatcher * TailCatcher = nullptr;
547 sc = evtStore()->retrieve(TailCatcher,m_containerKey8);
548 if (sc.isFailure()) {
549 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBTailCatcher from StoreGate! key= " << m_containerKey8 << "\033[0m" );
550 } else {
551 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBTailCatcher ( StoreGate key =" << m_containerKey8 << " ) ..."<< "\033[0m" );
552
553 const unsigned nTailCatchers = (TBTailCatcher::size_type)TailCatcher->size();
554 m_signals ->resize(nTailCatchers);
555 m_signal_tCatch ->resize(nTailCatchers);
556 m_time_signal_tCatch ->resize(nTailCatchers);
557 m_signal_overflow_tCatch ->resize(nTailCatchers);
558 m_time_overflow_tCatch ->resize(nTailCatchers);
559 m_tbDetectorName_TBTailCatcher ->resize(nTailCatchers);
560 m_overflow_TBTailCatcher ->resize(nTailCatchers);
561
562 (*m_signals) = TailCatcher->getSignals();
563
564 unsigned NtupleVectorIndex = 0;
565 TBTailCatcher::const_iterator it_TailCatcher = TailCatcher->begin();
566 TBTailCatcher::const_iterator last_TailCatcher = TailCatcher->end();
567 for(;it_TailCatcher!=last_TailCatcher;++it_TailCatcher,NtupleVectorIndex++) {
568 // scint->isTimeOverflow() is not a constant method, and so we define here
569 // 'TBScintillator * scint' instead of the usual 'const TBScintillator * scint'
570 // since for a const TBScintillator all methods need to be const as well...
571 const TBScintillator * scint = (*it_TailCatcher);
572
573 (*m_signal_tCatch)[NtupleVectorIndex] = scint-> getSignal();
574 (*m_time_signal_tCatch)[NtupleVectorIndex] = scint-> getTimeSignal();
575 (*m_signal_overflow_tCatch)[NtupleVectorIndex] = scint-> isSignalOverflow();
576 (*m_time_overflow_tCatch)[NtupleVectorIndex] = scint-> isTimeOverflow();
577 (*m_tbDetectorName_TBTailCatcher)[NtupleVectorIndex] = scint-> getDetectorName();
578 (*m_overflow_TBTailCatcher)[NtupleVectorIndex] = scint-> isOverflow();
579 }
580 }
581
582
583 // ----------------------------------------------------------------------------------------------------
584 // TBTDC
585 // ----------------------------------------------------------------------------------------------------
586 const TBTDC * TDC = nullptr;
587 sc = evtStore()->retrieve(TDC,m_containerKey9);
588 if (sc.isFailure()) {
589 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBTDC from StoreGate! key= " << m_containerKey9 << "\033[0m" );
590 } else {
591 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBTDC ( StoreGate key =" << m_containerKey9 << " ) ..."<< "\033[0m" );
592
593 m_tdc_TBTDC ->resize(1);
594 m_tdcmin_TBTDC ->resize(1);
595 m_scale_TBTDC ->resize(1);
596 m_phase_TBTDC ->resize(1);
597
598 (*m_tdc_TBTDC)[0] = TDC-> tdc();
599 (*m_tdcmin_TBTDC)[0] = TDC-> tdcmin();
600 (*m_scale_TBTDC)[0] = TDC-> scale();
601 (*m_phase_TBTDC)[0] = TDC-> phase();
602 }
603
604
605 // ----------------------------------------------------------------------------------------------------
606 // TBTrack
607 // ----------------------------------------------------------------------------------------------------
608 const TBTrack * Track = nullptr;
609 sc = evtStore()->retrieve(Track,m_containerKey10);
610 if (sc.isFailure()) {
611 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBTrack from StoreGate! key= " << m_containerKey10 << "\033[0m" );
612 } else {
613 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBTrack ( StoreGate key =" << m_containerKey10 << " ) ..."<< "\033[0m" );
614
615 m_hitNumberU ->resize(1);
616 m_hitNumberV ->resize(1);
617 m_chi2 ->resize(1);
618 m_chi2u ->resize(1);
619 m_chi2v ->resize(1);
620 m_angle ->resize(1);
621 m_uslope ->resize(1);
622 m_vslope ->resize(1);
623 m_uintercept ->resize(1);
624 m_vintercept ->resize(1);
625 m_cryou ->resize(1);
626 m_cryov ->resize(1);
627 m_cryow ->resize(1);
628
629 (*m_hitNumberU)[0] = Track-> getHitNumberU();
630 (*m_hitNumberV)[0] = Track-> getHitNumberV();
631 (*m_chi2)[0] = Track-> getChi2_global();
632 (*m_chi2u)[0] = Track-> getChi2_u();
633 (*m_chi2v)[0] = Track-> getChi2_v();
634 (*m_angle)[0] = Track-> getAngle();
635 (*m_uslope)[0] = Track-> getUslope();
636 (*m_vslope)[0] = Track-> getVslope();
637 (*m_uintercept)[0] = Track-> getUintercept();
638 (*m_vintercept)[0] = Track-> getVintercept();
639 (*m_cryou)[0] = Track-> getCryoHitu();
640 (*m_cryov)[0] = Track-> getCryoHitv();
641 (*m_cryow)[0] = Track-> getCryoHitw();
642 (*m_residualu) = Track-> getResidualu();
643 (*m_residualv) = Track-> getResidualv();
644 }
645
646
647 // ----------------------------------------------------------------------------------------------------
648 // TBTriggerPatternUnit
649 // ----------------------------------------------------------------------------------------------------
650 const TBTriggerPatternUnit * TriggerPatternUnit = nullptr;
651 sc = evtStore()->retrieve(TriggerPatternUnit,m_containerKey11);
652 if (sc.isFailure()) {
653 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBTriggerPatternUnit from StoreGate! key= " << m_containerKey11 << "\033[0m" );
654 } else {
655 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBTriggerPatternUnit ( StoreGate key =" << m_containerKey11 << " ) ..."<< "\033[0m" );
656
657 m_triggerWord->resize(1);
658 (*m_triggerWord)[0] = TriggerPatternUnit-> getTriggerWord();
659
660 (*m_triggers) = TriggerPatternUnit-> getTriggers();
661 }
662
663
664 // ----------------------------------------------------------------------------------------------------
665 // TBMWPCCont
666 // ----------------------------------------------------------------------------------------------------
667 const TBMWPCCont * MWPCCont = nullptr;
668 sc = evtStore()->retrieve(MWPCCont,m_containerKey12);
669 if (sc.isFailure()) {
670 ATH_MSG_ERROR ( "\033[31m" << "- Can not read TBMWPCCont from StoreGate! key= " << m_containerKey12 << "\033[0m" );
671 } else {
672 ATH_MSG_DEBUG ( "\033[34m" << "- Going over TBMWPCCont ( StoreGate key =" << m_containerKey12 << " ) ..."<< "\033[0m" );
673
674 const unsigned nMWPCCont = (TBMWPCCont::size_type)MWPCCont->size();
675 m_cPos ->resize(nMWPCCont);
676 m_cErr ->resize(nMWPCCont);
677 m_isX ->resize(nMWPCCont);
678 m_clusterSize_c ->resize(nMWPCCont);
679 m_cPosOverflow ->resize(nMWPCCont);
680 m_tbDetectorName_TBMWPCCont ->resize(nMWPCCont);
681 m_overflow_TBMWPCCont ->resize(nMWPCCont);
682
683 unsigned NtupleVectorIndex = 0;
684 TBMWPCCont::const_iterator it_TBMWPCCont = MWPCCont->begin();
685 TBMWPCCont::const_iterator last_TBMWPCCont = MWPCCont->end();
686 for(;it_TBMWPCCont!=last_TBMWPCCont;++it_TBMWPCCont,NtupleVectorIndex++) {
687 const TBMWPC * mwpc = (*it_TBMWPCCont);
688
689 (*m_cPos)[NtupleVectorIndex] = mwpc-> getCPos();
690 (*m_cErr)[NtupleVectorIndex] = mwpc-> getCErr();
691 (*m_isX)[NtupleVectorIndex] = mwpc-> isX();
692 (*m_clusterSize_c)[NtupleVectorIndex] = mwpc-> getClusterSizeC();
693 (*m_tbDetectorName_TBMWPCCont)[NtupleVectorIndex] = mwpc-> getDetectorName();
694 (*m_overflow_TBMWPCCont)[NtupleVectorIndex] = mwpc-> isOverflow();
695
696 // ------------------------------------------------------------------------------------------------
697 // for some reason a stright forward definition of m_cPosOverflow as
698 // std::vector < std::vector<bool> > m_cPosOverflow;
699 // does not work. perhaps due to the fact that std::vector<bool> is nonconforming (not
700 // really a vector of bool variables, but some ). instead we defined
701 // std::vector < std::vector<unsigned> > m_cPosOverflow;
702 // and now need to convert the bool constituents of the vectors to unsigned
703 // ------------------------------------------------------------------------------------------------
704 unsigned nBools = mwpc->isCPosOverflow().size(); //lenght of the vector of bool in TBMWPC
705 std::vector<unsigned> cPosOverflowNow(nBools); //defines lenght and initializes to zero
706
707 for (unsigned nBoolNow=0; nBoolNow<nBools; nBoolNow++)
708 if(mwpc->isCPosOverflow()[nBoolNow])
709 cPosOverflowNow[nBoolNow] = 1;
710
711 (*m_cPosOverflow)[NtupleVectorIndex] = cPosOverflowNow;
712 cPosOverflowNow.clear();
713 // ------------------------------------------------------------------------------------------------
714 }
715 }
716
717 return StatusCode::SUCCESS;
718}
719
720
722{
723
724 // TBADCRawCont
725 if (m_adc) m_adc->clear();
728 // TBTDCRawCont
729 if (m_tdc_raw) m_tdc_raw->clear();
733 // TBPhase
734 if (m_phase) m_phase->clear();
735 if (m_phaseind) m_phaseind->clear();
736 if (m_dTtoWAC) m_dTtoWAC->clear();
737 // TBEventInfo
738 if (m_ev_number) m_ev_number->clear();
739 if (m_ev_clock) m_ev_clock->clear();
740 if (m_ev_type) m_ev_type->clear();
741 if (m_run_num) m_run_num->clear();
742 if (m_beam_moment) m_beam_moment->clear();
743 if (m_beam_part) m_beam_part->clear();
744 if (m_cryoX) m_cryoX->clear();
745 if (m_cryoAngle) m_cryoAngle->clear();
746 if (m_tableY) m_tableY->clear();
747 // TBBPCCont
748 if (m_xPos) m_xPos->clear();
749 if (m_yPos) m_yPos->clear();
750 if (m_xErr) m_xErr->clear();
751 if (m_yErr) m_yErr->clear();
752 if (m_xPulse) m_xPulse->clear();
753 if (m_yPulse) m_yPulse->clear();
754 if (m_hitnumber) m_hitnumber->clear();
755 if (m_xPosOverflow) m_xPosOverflow->clear();
756 if (m_yPosOverflow) m_yPosOverflow->clear();
762 // TBLArDigitContainer
763 if (m_channelID) m_channelID->clear();
764 if (m_gain) m_gain->clear();
765 if (m_nSamples) m_nSamples->clear();
766 if (m_samples) m_samples->clear();
767 // TBScintillatorCont
768 if (m_signal_scint) m_signal_scint->clear();
774 // TBTailCatcher
775 if (m_signals) m_signals->clear();
776 if (m_signal_tCatch) m_signal_tCatch->clear();
782 // TBTDC
783 if (m_tdc_TBTDC) m_tdc_TBTDC->clear();
784 if (m_tdcmin_TBTDC) m_tdcmin_TBTDC->clear();
785 if (m_scale_TBTDC) m_scale_TBTDC->clear();
786 if (m_phase_TBTDC) m_phase_TBTDC->clear();
787 // TBTrack
788 if (m_hitNumberU) m_hitNumberU->clear();
789 if (m_hitNumberV) m_hitNumberV->clear();
790 if (m_residualu) m_residualu->clear();
791 if (m_residualv) m_residualv->clear();
792 if (m_chi2) m_chi2->clear();
793 if (m_chi2u) m_chi2u->clear();
794 if (m_chi2v) m_chi2v->clear();
795 if (m_angle) m_angle->clear();
796 if (m_uslope) m_uslope->clear();
797 if (m_vslope) m_vslope->clear();
798 if (m_uintercept) m_uintercept->clear();
799 if (m_vintercept) m_vintercept->clear();
800 if (m_cryou) m_cryou->clear();
801 if (m_cryov) m_cryov->clear();
802 if (m_cryow) m_cryow->clear();
803 // TBTriggerPatternUnit
804 if (m_triggerWord) m_triggerWord->clear();
805 if (m_triggers) m_triggers->clear();
806 // TBMWPCCont
807 if (m_cPos) m_cPos->clear();
808 if (m_cErr) m_cErr->clear();
809 if (m_isX) m_isX->clear();
810 if (m_clusterSize_c) m_clusterSize_c->clear();
811 if (m_cPosOverflow) m_cPosOverflow->clear();
814
815 return StatusCode::SUCCESS;
816}
817
818
820{
821 ATH_MSG_DEBUG ( "in finalize()" );
822 return StatusCode::SUCCESS;
823}
824
825std::string CBNTAA_TBTPValidation::add_name(const char* base, const std::string& extension) {
826 std::string retval(base);
827 for (unsigned i=0;i<extension.size();i++) {
828 const char& ch=extension[i];
829 if (ch=='=' || ch==':' || ch=='/')
830 continue; //Inore these characters
831 else if (ch=='-')
832 retval.append("m");//replace by letter m
833 else if (ch=='+')
834 retval.append("p");//replace by letter p
835 else
836 retval.append(1,ch);
837 }
838 return retval;
839}
float getTDC(const AFP_SiDigi &digi)
Definition AFP_SiDigi.h:25
float getADC(const AFP_SiDigi &digi)
Definition AFP_SiDigi.h:29
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
static Double_t sc
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
std::vector< signal_type_TBBPCCont > * m_yPos
std::vector< float > * m_time_signal_scint
std::vector< unsigned short > * m_samples
std::vector< signal_type_TBBPCCont > * m_xErr
std::vector< int > * m_ev_number
std::vector< bool > * m_signal_overflow_scint
virtual StatusCode CBNT_finalize()
std::vector< double > * m_cryou
std::string add_name(const char *base, const std::string &extension)
std::vector< double > * m_chi2v
std::vector< unsigned char > * m_gain
std::vector< bool > * m_underThreshold_raw
std::vector< signal_type_TBBPCCont > * m_yErr
virtual StatusCode CBNT_execute()
std::vector< unsigned int > * m_adc
std::vector< unsigned int > * m_run_num
std::vector< double > * m_residualv
std::vector< std::string > * m_tbDetectorName_TBTDCRawCont
std::vector< int > * m_phase_TBTDC
std::vector< float > * m_scale_TBTDC
std::vector< bool > * m_overflow_TBTailCatcher
std::vector< double > * m_uintercept
std::vector< std::vector< float > > * m_cErr
std::vector< float > * m_cryoX
std::vector< bool > * m_overflow_TBScintillatorCont
std::vector< signal_type_TBBPCCont > * m_yPulse
std::vector< bool > * m_overflowSetFlag
std::vector< bool > * m_overflow_TBTDCRawCont
std::vector< double > * m_uslope
std::vector< bool > * m_xPulseOverflow
std::vector< double > * m_chi2u
std::vector< short > * m_hitnumber
std::vector< int > * m_tdcmin_TBTDC
std::vector< bool > * m_yPulseOverflow
std::vector< float > * m_cryoAngle
std::vector< std::string > * m_beam_part
std::vector< signal_type_TBBPCCont > * m_xPos
std::vector< std::vector< float > > * m_clusterSize_c
std::vector< unsigned int > * m_tdc_raw
std::vector< bool > * m_isX
std::vector< std::vector< unsigned > > * m_cPosOverflow
std::vector< std::string > * m_tbDetectorName_TBMWPCCont
std::vector< double > * m_cryow
std::vector< std::string > * m_tbDetectorName_TBScintillatorCont
std::vector< bool > * m_xPosOverflow
std::vector< short > * m_phaseind
std::vector< int > * m_ev_clock
std::vector< double > * m_cryov
std::vector< std::string > * m_tbDetectorName_TBADCRawCont
std::vector< bool > * m_overflow_TBADCRawCont
std::vector< int > * m_ev_type
std::vector< int > * m_tdc_TBTDC
std::vector< double > * m_signals
std::vector< float > * m_dTtoWAC
std::vector< double > * m_angle
std::vector< float > * m_tableY
std::vector< float > * m_beam_moment
std::vector< double > * m_residualu
std::vector< std::vector< float > > * m_cPos
std::vector< bool > * m_overflow_TBBPCCont
std::vector< unsigned int > * m_triggerWord
std::vector< int > * m_hitNumberV
std::vector< double > * m_vintercept
std::vector< bool > * m_triggers
std::vector< bool > * m_signal_overflow_tCatch
std::vector< bool > * m_time_overflow_tCatch
std::vector< double > * m_chi2
virtual StatusCode CBNT_initialize()
std::vector< float > * m_phase
std::vector< bool > * m_time_overflow_scint
std::vector< unsigned int > * m_channelID
std::vector< float > * m_signal_scint
std::vector< bool > * m_yPosOverflow
std::vector< int > * m_hitNumberU
std::vector< std::string > * m_tbDetectorName_TBTailCatcher
std::vector< std::string > * m_tbDetectorName_TBBPCCont
CBNTAA_TBTPValidation(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< double > * m_vslope
std::vector< float > * m_signal_tCatch
std::vector< float > * m_time_signal_tCatch
std::vector< bool > * m_overflow_TBMWPCCont
std::vector< signal_type_TBBPCCont > * m_xPulse
std::vector< unsigned short > * m_nSamples
void addBranch(const std::string &branchname, T &obj, const std::string &leaflist)
CBNT_TBRecBase(const std::string &name, ISvcLocator *pSvcLocator)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:861
typename DataVectorBase< TBADCRaw >::Base::size_type size_type
Definition DataVector.h:837
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
This class provides general information about an event.
Container class for LArDigit.
Liquid Argon digit base class.
Definition LArDigit.h:25
"TBEvent/TBADCRawCont.h"
Data object holding adc measurement.
Definition TBADCRaw.h:21
"TBEvent/TBBPCCont.h"
Definition TBBPCCont.h:17
Definition TBBPC.h:23
"TBEvent/TBMWPCCont.h"
Definition TBMWPCCont.h:17
const std::vector< bool > & isCPosOverflow() const
Definition TBMWPC.h:78
"TBEvent/TBScintillatorCont.h"
"TBEvent/TBTDCRawCont.h"
Data object holding tdc measurement.
Definition TBTDCRaw.h:21
Definition TBTDC.h:17
const std::vector< signal_type > & getSignals() const
std::string base
Definition hcg.cxx:83