ATLAS Offline Software
LArWaves2Ntuple.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 LArWaves2Ntuple::LArWaves2Ntuple(const std::string& name, ISvcLocator* pSvcLocator): LArCond2NtupleBase(name, pSvcLocator)
10 {
11 
12  declareProperty("SaveDerivedInfo",m_saveDerivedInfo=false);
13 }
14 
16 = default;
17 
19 
21  if (sc.isFailure())
22  return sc;
23 
24  sc=m_nt->addItem("flag",m_flag,0,1000);
25  if (sc!=StatusCode::SUCCESS) {
26  ATH_MSG_ERROR( "addItem 'Flag' failed" );
27  return StatusCode::FAILURE;
28  }
29 
30  sc=m_nt->addItem("timeIndex",m_timeIndex,0,100000);
31  if (sc!=StatusCode::SUCCESS) {
32  ATH_MSG_ERROR( "addItem 'timeIndex' failed" );
33  return StatusCode::FAILURE;
34  }
35 
36  sc=m_nt->addItem("Dt",m_dt,0.,25.);
37  if (sc!=StatusCode::SUCCESS) {
38  ATH_MSG_ERROR( "addItem 'Dt' failed" );
39  return StatusCode::FAILURE;
40  }
41 
42  sc=m_nt->addItem("Time",m_timeIndex,m_time);
43  if (sc!=StatusCode::SUCCESS) {
44  ATH_MSG_ERROR( "addItem 'Time' failed" );
45  return StatusCode::FAILURE;
46  }
47 
48  sc=m_nt->addItem("Amplitude",m_timeIndex,m_ampliPulse);
49  if (sc!=StatusCode::SUCCESS) {
50  ATH_MSG_ERROR( "addItem failed" );
51  return StatusCode::FAILURE;
52  }
53 
54  sc=m_nt->addItem("Error",m_timeIndex,m_errorPulse);
55  if (sc!=StatusCode::SUCCESS) {
56  ATH_MSG_ERROR( "addItem 'Error' failed" );
57  return StatusCode::FAILURE;
58  }
59 
60  sc=m_nt->addItem("Triggers",m_timeIndex,m_triggers);
61  if (sc!=StatusCode::SUCCESS) {
62  ATH_MSG_ERROR( "addItem 'Triggers' failed" );
63  return StatusCode::FAILURE;
64  }
65 
66  if ( m_saveDerivedInfo ) {
67  sc=m_nt->addItem("Baseline",m_baseline,0.,1200.);
68  if (sc!=StatusCode::SUCCESS) {
69  ATH_MSG_ERROR( "addItem 'Baseline' failed" );
70  return StatusCode::FAILURE;
71  }
72 
73  sc=m_nt->addItem("TmaxAmp",m_tmaxAmp,0.,4095.);
74  if (sc!=StatusCode::SUCCESS) {
75  ATH_MSG_ERROR( "addItem 'TmaxAmp' failed" );
76  return StatusCode::FAILURE;
77  }
78 
79  sc=m_nt->addItem("MaxAmp",m_maxAmp,0.,4095.);
80  if (sc!=StatusCode::SUCCESS) {
81  ATH_MSG_ERROR( "addItem 'MaxAmp' failed" );
82  return StatusCode::FAILURE;
83  }
84 
85  sc=m_nt->addItem("PosLobe",m_posLobe,0.,100.);
86  if (sc!=StatusCode::SUCCESS) {
87  ATH_MSG_ERROR( "addItem 'PosLobe' failed" );
88  return StatusCode::FAILURE;
89  }
90 
91  sc=m_nt->addItem("T0",m_rT0,20.,100.);
92  if (sc!=StatusCode::SUCCESS) {
93  ATH_MSG_ERROR( "addItem 'RT0' failed" );
94  return StatusCode::FAILURE;
95  }
96 
97  sc=m_nt->addItem("Width",m_width,0.,125.);
98  if (sc!=StatusCode::SUCCESS) {
99  ATH_MSG_ERROR( "addItem 'Width' failed" );
100  return StatusCode::FAILURE;
101  }
102  }
103  return StatusCode::SUCCESS;
104 }
105 
106 
107 bool LArWaves2Ntuple::fillWave(const HWIdentifier chid, const LArWaveCumul& wave) {
108  fillFromIdentifier(chid);
109  m_flag = wave.getFlag();
110  m_dt = wave.getDt();
111 
112  for (m_timeIndex=0; m_timeIndex<(long)wave.getSize(); m_timeIndex++ ) {
117  }
118 
119  if ( m_saveDerivedInfo ) { // additional (derived) information, computed on the fly...
122  // please note the 'dt' normalization in the following!
123  m_tmaxAmp = m_dt * m_waveHelper.getMax(wave);
124  m_width = m_dt * m_waveHelper.getWidth(wave);
125  m_rT0 = m_dt * m_waveHelper.getT0(wave);
127  }
128  return true;
129 }
130 
LArWaveHelper::getSumRegion
double getSumRegion(const LArWave &theWave, unsigned iFirst, unsigned iLast) const
Definition: LArWaveHelper.cxx:370
LArWaves2Ntuple::m_flag
NTuple::Item< long > m_flag
Definition: LArWaves2Ntuple.h:39
LArWaves2Ntuple::initialize
StatusCode initialize()
Definition: LArWaves2Ntuple.cxx:18
LArWaveCumul
Definition: LArWaveCumul.h:30
LArWave::getSize
size_t getSize() const
number of time samples
Definition: LArWave.h:62
LArWave::getFlag
unsigned getFlag() const
flag: ...
Definition: LArWave.h:178
LArWaveHelper::getWidth
double getWidth(const LArWave &theWave) const
Definition: LArWaveHelper.cxx:209
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArWaveHelper::getBaseline
double getBaseline(const LArWave &theWave, unsigned nBase) const
Definition: LArWaveHelper.cxx:347
LArWaves2Ntuple::m_posLobe
NTuple::Item< double > m_posLobe
Definition: LArWaves2Ntuple.h:51
LArWaves2Ntuple::fillWave
bool fillWave(const HWIdentifier chid, const LArWaveCumul &wave)
Definition: LArWaves2Ntuple.cxx:107
LArWave::getDt
const double & getDt() const
delta time
Definition: LArWave.h:50
LArWaveHelper::getMaxAmp
double getMaxAmp(const LArWave &theWave) const
Definition: LArWaveHelper.cxx:129
LArWaves2Ntuple::m_tmaxAmp
NTuple::Item< double > m_tmaxAmp
Definition: LArWaves2Ntuple.h:48
LArWaveHelper::getMax
unsigned int getMax(const LArWave &theWave) const
return index of maximum sample
Definition: LArWaveHelper.cxx:89
HWIdentifier
Definition: HWIdentifier.h:13
LArCond2NtupleBase::initialize
StatusCode initialize()
Definition: LArCond2NtupleBase.cxx:33
LArWave::getTime
double getTime(const unsigned i) const
time
Definition: LArWave.h:172
LArCond2NtupleBase
Definition: LArCond2NtupleBase.h:32
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LArWaves2Ntuple::m_waveHelper
LArWaveHelper m_waveHelper
Definition: LArWaves2Ntuple.h:56
LArWave::getSample
const double & getSample(const unsigned int i) const
Amplitude per time bin.
Definition: LArWave.h:53
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArWaves2Ntuple::m_dt
NTuple::Item< double > m_dt
Definition: LArWaves2Ntuple.h:41
LArWaves2Ntuple.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArWaves2Ntuple::m_baseline
NTuple::Item< double > m_baseline
Definition: LArWaves2Ntuple.h:50
LArCond2NtupleBase::m_nt
NTuple::Tuple * m_nt
Definition: LArCond2NtupleBase.h:68
LArWaves2Ntuple::m_errorPulse
NTuple::Array< double > m_errorPulse
Definition: LArWaves2Ntuple.h:44
LArWaves2Ntuple::m_triggers
NTuple::Array< int > m_triggers
Definition: LArWaves2Ntuple.h:45
LArWaves2Ntuple::m_rT0
NTuple::Item< double > m_rT0
Definition: LArWaves2Ntuple.h:52
LArWaves2Ntuple::m_maxAmp
NTuple::Item< double > m_maxAmp
Definition: LArWaves2Ntuple.h:49
LArWaveHelper::getZeroCross
unsigned getZeroCross(const LArWave &theWave) const
Definition: LArWaveHelper.cxx:421
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
LArWaves2Ntuple::m_timeIndex
NTuple::Item< long > m_timeIndex
Definition: LArWaves2Ntuple.h:40
LArWaves2Ntuple::m_width
NTuple::Item< double > m_width
Definition: LArWaves2Ntuple.h:53
LArCond2NtupleBase::fillFromIdentifier
bool fillFromIdentifier(const HWIdentifier &id)
Definition: LArCond2NtupleBase.cxx:288
LArWaves2Ntuple::~LArWaves2Ntuple
~LArWaves2Ntuple()
LArWaveCumul::getError
double getError(unsigned i) const
error per time bin
Definition: LArWaveCumul.h:143
LArWaves2Ntuple::m_ampliPulse
NTuple::Array< double > m_ampliPulse
Definition: LArWaves2Ntuple.h:43
LArWaveCumul.h
LArWaves2Ntuple::m_time
NTuple::Array< double > m_time
Definition: LArWaves2Ntuple.h:42
LArWaves2Ntuple::m_saveDerivedInfo
bool m_saveDerivedInfo
Definition: LArWaves2Ntuple.h:37
LArWaves2Ntuple::LArWaves2Ntuple
LArWaves2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArWaves2Ntuple.cxx:9
LArWaveHelper::getT0
double getT0(const LArWave &theWave) const
Definition: LArWaveHelper.cxx:162
LArWaveCumul::getTrigger
int getTrigger(unsigned i) const
trigger per time bin
Definition: LArWaveCumul.h:157