ATLAS Offline Software
Loading...
Searching...
No Matches
LArRawChannelSimpleBuilder Class Reference

CTB simplified LArRawChannelBuilder using hardcoded calib. constants. More...

#include <LArRawChannelSimpleBuilder.h>

Inheritance diagram for LArRawChannelSimpleBuilder:

Public Member Functions

 LArRawChannelSimpleBuilder (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) const override
virtual StatusCode finalize () override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"}
SG::ReadCondHandleKey< LArADC2MeVm_adc2mevKey { this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" }
const LArEM_IDm_emId
const LArFCAL_IDm_fcalId
const LArHEC_IDm_hecId
const LArOnlineIDm_onlineHelper
ToolHandle< LArParabolaPeakRecoToolm_peakParabolaTool
SG::ReadHandleKey< LArDigitContainerm_DataLocation { this, "DataLocation", "FREE", "" }
SG::WriteHandleKey< LArRawChannelContainerm_ChannelContainerName { this, "LArRawChannelContainerName", "LArRawChannels", "" }
int m_imaxSamp
std::string m_mode
std::string m_FCALmodeTime
float m_cubicAdcCut
bool m_useRampDB
bool m_usePedestalDB
int m_averageSamplesEM
int m_averageSamplesHEC
int m_averageSamplesFCAL
float m_averageScaleEM
float m_averageScaleHEC
float m_averageScaleFCAL
float m_ADCtoMeVFCAL [3] {}
float m_ADCtoMeVHEC [2] {}
float m_ADCtoMeVEMECInner [2] {}
float m_ADCtoMeVEMECOuter [4] {}
float m_ADCtoMeVEMB [4] {}
unsigned int m_iPedestal
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

CTB simplified LArRawChannelBuilder using hardcoded calib. constants.

Author
Walter Lampl
Rob McPherson
Sandrine Laplace

Definition at line 35 of file LArRawChannelSimpleBuilder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArRawChannelSimpleBuilder()

LArRawChannelSimpleBuilder::LArRawChannelSimpleBuilder ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 23 of file LArRawChannelSimpleBuilder.cxx.

23 :
24 AthReentrantAlgorithm(name, pSvcLocator),
25 m_emId(nullptr),
26 m_fcalId(nullptr),
27 m_hecId(nullptr),
28 m_onlineHelper(nullptr),
29 m_peakParabolaTool("LArParabolaPeakTool"),
30 m_iPedestal(0)// jobO ?
31{
32 //m_useIntercept={false,false,false,false};
33 declareProperty("maxSamp",m_imaxSamp=8);
34 declareProperty("RecoMode",m_mode="CUBIC");
35 declareProperty("CubicRecoTimeModeFCAL",m_FCALmodeTime="LINEAR");
36 declareProperty("CubicAdcCut",m_cubicAdcCut=15.0);
37 declareProperty("PedestalSample",m_iPedestal=0);
38 declareProperty("UsePedestalDB",m_usePedestalDB=false);
39 declareProperty("UseRampDB",m_useRampDB=false);
40 declareProperty("AverageSamplesEM",m_averageSamplesEM=5);
41 declareProperty("AverageSamplesHEC",m_averageSamplesHEC=5);
42 declareProperty("AverageSamplesFCAL",m_averageSamplesFCAL=3);
43 declareProperty("AverageScaleEM",m_averageScaleEM=2.6);
44 declareProperty("AverageScaleHEC",m_averageScaleHEC=2.6);
45 declareProperty("AverageScaleFCAL",m_averageScaleFCAL=1.8);
46
47 // m_peakParabolaTool = NULL ; // FIXME RS use empty ToolHandle - python
48
49 m_ADCtoMeVFCAL[0] = 87.0 * MeV; // FCAL1 High gain
50 m_ADCtoMeVFCAL[1] = 117.0 * MeV; // FCAL2 High gain
51 m_ADCtoMeVFCAL[2] = 193.0 * MeV; // FCAL3 High gain
52 m_ADCtoMeVHEC[0] = 136.0 / 9.8 * MeV; // HEC 1 Medium gain from Monika. Need / 9.8 ??
53 m_ADCtoMeVHEC[1] = 136.0 / 9.8 * MeV; // HEC 2 Medium gain from Monika. Need / 9.8 ??
54 // m_ADCtoMeVEMECInner[0] = 25.22 * MeV; // EMEC High gain from Pascal, approximate
55 // m_ADCtoMeVEMECInner[1] = 19.4 * MeV; // EMEC High gain from Pascal, approximate
56 m_ADCtoMeVEMECInner[0] = 20.0 * MeV; // EMEC IW s=1 High gain : fixed 18/8/2004 RMcP
57 m_ADCtoMeVEMECInner[1] = 20.0 * MeV; // EMEC IW s=2 High gain : fixed 18/8/2004 RMcP
58 m_ADCtoMeVEMECOuter[0] = 16.0 * MeV; // EMEC OW pre, s=0
59 m_ADCtoMeVEMECOuter[1] = 16.0 * MeV; // EMEC OW s=1 High gain from Monika, approximate
60 m_ADCtoMeVEMECOuter[2] = 16.0 * MeV; // EMEC OW s=2 High gain from Monika, approximate
61 m_ADCtoMeVEMECOuter[3] = 16.0 * MeV; // EMEC OW s=3 High gain from Monika, approximate
62 m_ADCtoMeVEMB[0] = 7.0 * MeV; // EMB pre, s=0 High gain from Isabelle, approximate
63 m_ADCtoMeVEMB[1] = 2.5 * MeV; // EMB s=1 High gain from Isabelle, approximate
64 m_ADCtoMeVEMB[2] = 18.0 * MeV; // EMB s=2 High gain from Isabelle, approximate
65 m_ADCtoMeVEMB[3] = 9.0 * MeV; // EMB s=3 High gain from Isabelle, approximate
66
67
68}
static const double MeV
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< LArParabolaPeakRecoTool > m_peakParabolaTool

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

62{
63 return 0;
64}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode LArRawChannelSimpleBuilder::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 103 of file LArRawChannelSimpleBuilder.cxx.

104{
105 ATH_MSG_DEBUG( "In execute" );
106
107 //Retrieve Digit Container
108 ATH_MSG_DEBUG( "About to retrieve LArDigitContainer with key " << m_DataLocation );
109 SG::ReadHandle<LArDigitContainer> digitContainer (m_DataLocation, ctx);
110 ATH_MSG_DEBUG( "1) LArDigitContainer container size = " << digitContainer->size() );
111
112 ATH_MSG_DEBUG( "2) LArDigitContainer container size = " << digitContainer->size() );
113 if( digitContainer->empty() ) {
114 ATH_MSG_INFO( "Empty LArDigitContainer container." );
115 return StatusCode::SUCCESS;
116 }
117
118 auto larRawChannelContainer = std::make_unique<LArRawChannelContainer>();
119
120 //Pointer to conditions data objects
121 const ILArPedestal* larPedestal=nullptr;
122 if (m_usePedestalDB) {
123 if (detStore()->retrieve(larPedestal).isFailure()) {
124 larPedestal=nullptr;
125 ATH_MSG_DEBUG( "No pedestal found in database. Use default values." );
126 }
127 }
128
129 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey, ctx};
130 const LArOnOffIdMapping* cabling{*cablingHdl};
131 if(!cabling) {
132 ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key() );
133 return StatusCode::FAILURE;
134 }
135
136 const LArADC2MeV* adc2mev = nullptr;
137 if (m_useRampDB) {
138 SG::ReadCondHandle<LArADC2MeV> adc2mevH (m_adc2mevKey, ctx);
139 adc2mev = *adc2mevH;
140 }
141
142 //loop twice over the digits. In the first pass the best window is
143 //found for the averaged signal. In the second pass the full raw
144 //channel is created and the averaging in the window found in the
145 //first path is used in case the cubic fit fails or the max ADC is
146 //below threshold
147
148 int nMinEM(0),nMinHEC(0),nMinFCAL(0);
149 std::vector<float> fSumEM,fSumHEC,fSumFCAL;
150 std::vector<float> *pSum = nullptr;
151
152 fSumEM.resize(0);
153 fSumHEC.resize(0);
154 fSumFCAL.resize(0);
155
156 for(int iloop=0;iloop<2;iloop++) {
157
158 //Now all data is available, start loop over Digit Container
159 ATH_MSG_DEBUG( "Loop over Digit Container " );
160
161 for (const LArDigit* digit : *digitContainer) {
162
163 //Get data from LArDigit
164 const std::vector<short>& samples = digit->samples();
165 unsigned int nSamples = samples.size();
166 const HWIdentifier chid = digit->channelID();
167 const CaloGain::CaloGain gain = digit->gain();
168
169
170 float thePedestal=-1;
171 if (larPedestal) {
172 float DBpedestal =larPedestal->pedestal(chid,gain);
173 if (DBpedestal <= (1.+LArElecCalib::ERRORCODE))
174 thePedestal=DBpedestal;
175 }
176 if (thePedestal<0) {
177 thePedestal = (float)samples[m_iPedestal];
178 ATH_MSG_DEBUG( "No pedestal found for this cell. Use default value " << thePedestal );
179 }
180 //>>>> PL June 20, 2004: subtract pedestal first, assume first sample ->JO?
181 std::vector<float> mySamples;
182 mySamples.resize(samples.size());
183 // FIXME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! only for 5 leading noise samples!
184
185 // log << MSG::INFO
186 // << "pedestal " << thePedestal << endmsg;
187 for ( unsigned int i=0; i<samples.size(); i++ )
188 {
189 mySamples[i] = ((float)samples[i]) - thePedestal;
190 }
191 //<<<<
192
193 float GainFactor;
194 if( gain == CaloGain::LARLOWGAIN ) {
195 GainFactor = 9.8*9.8;
196 } else if (gain == CaloGain::LARMEDIUMGAIN ) {
197 GainFactor = 9.8;
198 } else if (gain == CaloGain::LARHIGHGAIN ) {
199 GainFactor = 1.0;
200 } else {
201 GainFactor = 1.0;
202 ATH_MSG_ERROR( "Channel " << chid << "unknown gain: " << gain );
203 }
204
205 // Get hardware identifier for later use.
206 HWIdentifier FebID = m_onlineHelper->feb_Id(chid);
207 unsigned int channel = m_onlineHelper->channel(chid);
208 ATH_MSG_DEBUG( std::hex << " FebID / chid / channel = " << FebID << " / " << chid << " / " << channel );
209
210 // And note if this is an FCAL channel with fast pulses (cubic fails)
211 // EM and HEC are also tested to adjust the signal range for averaging
212 bool isFCAL = false;
213 bool isEM = false;
214 bool isHEC = false;
215 int nMin = 0;
216 unsigned int nAverage = 1;
217 float myScale = 1;
218 try {
219 const Identifier id = cabling->cnvToIdentifier(chid);
220 if (m_fcalId->is_lar_fcal(id)) {
221 isFCAL = true;
222 nMin = nMinFCAL;
223 pSum = &fSumFCAL;
224 nAverage = m_averageSamplesFCAL;
225 myScale = m_averageScaleFCAL;
226 }
227 else if (m_emId->is_lar_em(id)) {
228 isEM = true;
229 nMin = nMinEM;
230 pSum = &fSumEM;
231 nAverage = m_averageSamplesEM;
232 myScale = m_averageScaleEM;
233 }
234 else if (m_hecId->is_lar_hec(id)) {
235 isHEC = true;
236 nMin = nMinHEC;
237 pSum = &fSumHEC;
238 nAverage = m_averageSamplesHEC;
239 myScale = m_averageScaleHEC;
240 }
241 }
242 //catch( LArOnlID_Exception & except)
243 catch (LArID_Exception & execpt) {
244 ATH_MSG_DEBUG (" is disconnected.");
245 // The question now being: do we want to skip this channel???
246 // Probably yes, so do so. RMcP 9 June 2006
247 continue;
248 }
249 // In the unrealistic case, that pSum is still not defined
250 if(!pSum) continue;
251
252 // Find peak time sample and scaled average for selected sample range
253 // (i.e. poor man's digital filter)
254
255 // sanity checks
256 if ( nAverage > nSamples ) {
257 ATH_MSG_WARNING( " Number of samples to average ("
258 << nAverage << ") is larger than total number of samples ("
259 << nSamples << ")! adjusting nAverage ... " );
260 nAverage = nSamples;
261 }
262
263
264 if ( iloop == 0 ) {
265
266 if ( pSum->empty())
267// pSum->resize(nSamples-nAverage+1,0);
268 pSum->resize(nSamples,0);
269
270 for( unsigned i=0;i<nSamples-nAverage+1;i++ ) {
271 for( unsigned j=0;j<nAverage;j++ ) {
272 (*pSum)[i] += mySamples[i+j];
273 }
274 }
275 }
276 else {
277 float maxADCPeak = 0.;
278 unsigned int iPeakSamp = 0;
279 float averagedADC = 0;
280 for( unsigned i=0;i<nSamples;i++ ) {
281 if ( maxADCPeak < mySamples[i] )
282 {
283 maxADCPeak = mySamples[i];
284 iPeakSamp = i;
285 }
286 if ( (int)i >= nMin && i < nMin+nAverage )
287 averagedADC += mySamples[i];
288 }
289 averagedADC /= myScale;
290
291 bool CubicFailed = false;
292 float ADCPeak=0.;
293 float time=0;
294
295
296 // maximum amplitude/variable time slice method
297 if( m_mode == "MAX" )
298 {
299 ADCPeak = maxADCPeak;
300 time = ((float)iPeakSamp) * 25.0 * nanosecond;
301 }
302
303
304 // other choices are different for FCAL and others
305 else {
306
307 // first, deal with FCAL: only one reconstruction is available
308 if(isFCAL && m_mode == "CUBIC" &&
309 ! ( CubicFailed = maxADCPeak <= m_cubicAdcCut ) ) {
310
311 ATH_MSG_DEBUG( " Special reconstruction for FCAL." );
312
313 unsigned int it0;
314
315 const float invT[3][3]
316 = { { 1, 0, 0 },
317 { -1.5, 2, -0.5 },
318 { 0.5, -1, 0.5 } };
319
320 // peak slice very early
321 if ( iPeakSamp <= 1 ) {
322 it0 = 1;
323 } else if ( iPeakSamp >= nSamples - 1 ) { // peak is late
324 it0 = nSamples - 3;
325 } else { // peak in safe region
326 it0 = iPeakSamp - 1;
327 }
328
329 // Quadratic interpolation using
330 // 3 samples to be used start at 0 <= t0 <= nsamples-3
331 float A[3] = {0, 0, 0};
332 float dtmax = 0.0;
333 // S = TA -> A = inv(T)S
334 for (int ia = 0; ia < 3; ia++)
335 for (int it = 0; it < 3; it++)
336 A[ia] += invT[ia][it] * mySamples[it0+it];
337
338 // fit parameters
339 if ( not ( CubicFailed = ( A[2] == 0 ) ) ) {
340 dtmax = -1.0 * A[1] / 2.0 / A[2];
341 if ( ! ( CubicFailed = ( dtmax < 0 || dtmax > 2 ) ) ) {
342 //time = (float(it0) + dtmax) * 25.0 * nanosecond; // nsec
343 time=dtmax*25.0*ns;
344 for(int ia = 0; ia < 3; ia++)
345 ADCPeak += A[ia] * pow(dtmax, ia);
346 }
347 }
348
349 // Now use jobOptions to pick time and height of FCAL pulses
350 if( m_FCALmodeTime == "LINEAR" ) {
351 float weightSum = 0.;
352 float timeSum = 0.;
353 for( int it=0; it<3; it++) {
354 timeSum += float(mySamples[it0+it]) * float(it);
355 weightSum += float(mySamples[it0+it]);
356 }
357 time = (float(it0) + timeSum / weightSum) * 25.0 * nanosecond;
358 // ADCPeak = mySamples[iPeakSamp];
359 ADCPeak = mySamples[m_imaxSamp];
360 CubicFailed = false;
361 }
362
363 // then, deal with non-FCAL
364 } else if(not isFCAL || m_mode != "CUBIC" ) {
365
366 // bias-corrected parabola extrapolation for selected channels
367 if ( m_mode == "PARABOLA" &&
368 ! ( CubicFailed = maxADCPeak <= m_cubicAdcCut ) ) {
369 if( m_peakParabolaTool) {
370 int layer = 0;
371 try {
372 const Identifier id = cabling->cnvToIdentifier(chid);
373 ATH_MSG_DEBUG( std::hex << " id = " << id );
374 if (m_emId->is_em_barrel(id)) {
375 layer= m_emId->sampling(id);
376 }
377 }
378 catch (LArID_Exception & execpt){
379 ATH_MSG_DEBUG( std::hex
380 << " Cannot get offline identifier from online ID = " << chid );
381 }
382
383 std::vector<float> peak =m_peakParabolaTool->peak(samples,layer,thePedestal);
384 if(peak.size() >1){
385 ADCPeak = peak[0]-thePedestal;
386 if (peak.size()==2)time = peak[1];
387 else time = peak[2];
388 }else{
389 ATH_MSG_DEBUG( "No pic is computed from Parabola. Use scaled average of selected samples" );
390 ADCPeak = averagedADC;
391 time = -99.;
392 }
393 }else{
394 ATH_MSG_FATAL( "No parabola tool available ! Choose another mode" );
395 }
396 }
397
398 // cubic extrapolation for selected channels
399 else if ( m_mode == "CUBIC" &&
400 ! ( CubicFailed = maxADCPeak <= m_cubicAdcCut ) ) {
401
402 unsigned int it0;
403 const float invT[4][4]
404 = { { 1, 0, 0, 0},
405 { -1.83333, 3, -1.5, 0.333333},
406 { 1, -2.5, 2, -0.5},
407 {-0.166666, 0.5, -0.5, 0.166666} };
408
409 // peak slice very early
410 if ( iPeakSamp <= 1 ) {
411 it0 = m_iPedestal + 1;
412 } else if ( iPeakSamp >= nSamples - 2 ) { // peak is late
413 it0 = nSamples - 4;
414 } else { // peak in safe region
415 it0 = ( mySamples[iPeakSamp-2] > mySamples[iPeakSamp+2] )
416 ? iPeakSamp - 2
417 : iPeakSamp - 1;
418 }
419
420 // 4 samples to be used start at 0 <= t0 <= nsamples-4
421 float A[4] = {0, 0, 0, 0};
422 float dtmax = 0.0;
423 float disc;
424 // S = TA -> A = inv(T)S
425 for (int ia = 0; ia < 4; ia++)
426 for (int it = 0; it < 4; it++)
427 A[ia] += invT[ia][it] * mySamples[it0+it];
428
429 // fit parameters
430 disc = A[2]*A[2] - 3*A[1]*A[3];
431 if ( ! ( CubicFailed = ( disc < 0 || A[3] == 0 ) ) ) {
432 dtmax = (-A[2]-std::sqrt(disc))/(A[3]*3);
433 if ( ! ( CubicFailed = ( dtmax < 0 || dtmax > 3 ) ) ) {
434 time = (float(it0) + dtmax) * 25.0 * nanosecond; // nsec
435 for(int ia = 0; ia < 4; ia++)
436 ADCPeak += A[ia] * pow(dtmax, ia);
437 }
438 }
439 }
440 }
441 }
442
443 // fixed time slice or insufficient signal for cubic fit : use scaled average of selected samples
444 if(m_mode == "FIXED" || CubicFailed ) {
445 ADCPeak = averagedADC;
446 time = -99. ;
447 }
448
449 ATH_MSG_DEBUG( "Flag: "
450 << CubicFailed
451 << " Detector: "
452 << (isEM?"EM":(isHEC?"HEC":(isFCAL?"FCAL":"none")))
453 << " Mode: "
454 << m_mode
455 << " Signal: "
456 << ADCPeak
457 << " Peak: "
458 << maxADCPeak
459 << " PeakSample: "
460 << iPeakSamp
461 );
462
463 float energy=-9999;
464 if (m_useRampDB) {
465 float ADCPeakPower=ADCPeak;
466 //ADC2MeV (a.k.a. Ramp)
467 LArVectorProxy ramp = adc2mev->ADC2MEV(chid,gain);
468 //Check ramp coefficents
469 if (ramp.size()>1 && ramp[1]<500 && ramp[1]>0) {
470 energy=0;
471 for (unsigned i=1;i<ramp.size();i++)
472 {energy+=ramp[i]*ADCPeakPower; //pow(ADCPeak,i);
473 //std::cout << "Step "<< i <<":" << ramp[i] << " * " << pow(ADCPeak,i) << "Sum=" << energy << std::endl;
474 ADCPeakPower*=ADCPeak;
475 }
476 }
477 }
478 if (energy==-9999) {
479 ATH_MSG_DEBUG( "No Ramp found for this cell. Use default values" );
480 //Apply default values
481 // Now must get subdetector ID and feed in here ...
482 float ADCtoMeV = 10.0;
483
484 // HWIdentifier FebID = m_onlineHelper->feb_Id(chid);
485 // unsigned int channel = m_onlineHelper->channel(chid);
486 // MSG::hex(log) << MSG::DEBUG
487 // << " FebID / chid / channel = " << FebID << " / " << chid << " / " << channel << endmsg;
488
489 try {
490 const Identifier id = cabling->cnvToIdentifier(chid);
491
492 ATH_MSG_DEBUG( std::hex << " id = " << id );
493
494 if (m_emId->is_em_barrel(id)) {
495 const int layer= m_emId->sampling(id);
496 const int eta=m_emId->eta(id);
497 ADCtoMeV = m_ADCtoMeVEMB[layer];
498 if (layer==2 && eta<32)
499 ADCtoMeV=ADCtoMeV*(12./18.); //Correct for lead thickness
500 ATH_MSG_DEBUG( " in EMB s="<< layer <<", using ADCtoMeV = " << ADCtoMeV );
501 } else if (m_emId->is_em_endcap_inner(id)) {
502 // m_emId->sampling(id);
503 ADCtoMeV = m_ADCtoMeVEMECInner[m_emId->sampling(id)-1];
504 ATH_MSG_DEBUG( " in EMEC inner s="<<m_emId->sampling(id)<<", using ADCtoMeV = " << ADCtoMeV );
505 } else if (m_emId->is_em_endcap_outer(id)) {
506 // m_emId->sampling(id);
507 // ADCtoMeV = m_ADCtoMeVEMECOuter[m_emId->sampling(id)-1];
508 ADCtoMeV = m_ADCtoMeVEMECOuter[m_emId->sampling(id)];
509 ATH_MSG_DEBUG( " in EMEC outer s="<<m_emId->sampling(id)<<", using ADCtoMeV = " << ADCtoMeV );
510 } else if (m_fcalId->is_lar_fcal(id)) {
511 // m_fcalId->module(chid);
512 ADCtoMeV = m_ADCtoMeVFCAL[m_fcalId->module(id)-1];
513 ATH_MSG_DEBUG( " in FCAL m=" << m_fcalId->module(id)<<", using ADCtoMeV = " << ADCtoMeV );
514 } else if (m_hecId->is_lar_hec(id)) {
515 // m_layer[m_cellIndex]=m_hecId->sampling(id);
516 ADCtoMeV = m_ADCtoMeVHEC[0];
517 ATH_MSG_DEBUG( " in HEC s="<<m_hecId->sampling(id)<<", using ADCtoMeV = " << ADCtoMeV );
518 }
519 }
520 //catch( LArOnlID_Exception & except)
521 catch (LArID_Exception & execpt)
522 {
523 ATH_MSG_DEBUG( " is disconnected. Set ADCtoMeV to 1" );
524 ADCtoMeV=1;
525 }
526 energy = ADCPeak * ADCtoMeV * GainFactor;
527 }
528 uint16_t iquality=0;
529 uint16_t iprovenance=0;
530
531 time*=1000; //Convert to picoseconds
532 //Make LArRawChannel Object with new data
533 LArRawChannel larRawChannel(chid,(int)energy,(int)time,iquality,iprovenance, gain);
534 larRawChannelContainer->add(larRawChannel); //Add to container
535 }
536 }// End loop over LArDigits
537 if ( iloop == 0 ) {
538 // select the best windows for the event
539 unsigned int i;
540 float tmpSum = 0;
541
542 if ( !fSumEM.empty() ) {
543 for(i=0;i<fSumEM.size();i++) {
544 if (i == 0 || fSumEM[i] > tmpSum ) {
545 nMinEM = i;
546 tmpSum = fSumEM[i];
547 }
548 }
549 ATH_MSG_DEBUG( "Found best EM window starting at sample <" << nMinEM << ">" );
550 }
551
552 for(i=0;i<fSumHEC.size();i++) {
553 if (i == 0 || fSumHEC[i] > tmpSum ) {
554 nMinHEC = i;
555 tmpSum = fSumHEC[i];
556 }
557 }
558 if ( !fSumHEC.empty() ) {
559 ATH_MSG_DEBUG( "Found best HEC window starting at sample <" << nMinHEC << ">" );
560 }
561
562 for(i=0;i<fSumFCAL.size();i++) {
563 if (i == 0 || fSumFCAL[i] > tmpSum ) {
564 nMinFCAL = i;
565 tmpSum = fSumFCAL[i];
566 }
567 }
568 if ( !fSumFCAL.empty() ) {
569 ATH_MSG_DEBUG( "Found best FCAL window starting at sample <" << nMinFCAL << ">" );
570 }
571
572 }
573 }// End of double loop over Digit containers
574
575 ATH_MSG_DEBUG( "Finished loop over Digit Container " );
576
577 // Put this LArRawChannel container in the transient store
578 ATH_CHECK( SG::makeHandle (m_ChannelContainerName, ctx).record (std::move (larRawChannelContainer)) );
579
580 return StatusCode::SUCCESS;
581}
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
virtual float pedestal(const HWIdentifier &id, int gain) const =0
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
Definition LArADC2MeV.h:32
SG::ReadHandleKey< LArDigitContainer > m_DataLocation
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
SG::WriteHandleKey< LArRawChannelContainer > m_ChannelContainerName
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ LARLOWGAIN
Definition CaloGain.h:18
@ LARHIGHGAIN
Definition CaloGain.h:18
time(flags, cells_name, *args, **kw)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ layer
Definition HitInfo.h:79
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
constexpr int pow(int x)
Definition conifer.h:27
bool isFCAL(const xAOD::CaloCluster *cluster)
return true if the cluster (or the majority of its energy) is in the FCAL0
setWord1 uint16_t

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

88{
89 // If we didn't find any symlinks to add, just return the collection
90 // from the base class. Otherwise, return the extended collection.
91 if (!m_extendedExtraObjects.empty()) {
93 }
95}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ finalize()

StatusCode LArRawChannelSimpleBuilder::finalize ( )
overridevirtual

Definition at line 583 of file LArRawChannelSimpleBuilder.cxx.

584{//Error and Warning Summary for this job:
585
586 ATH_MSG_INFO( "LArRawChannelSimpleBuilder finished." );
587
588 return StatusCode::SUCCESS;
589}

◆ initialize()

StatusCode LArRawChannelSimpleBuilder::initialize ( )
overridevirtual

Definition at line 70 of file LArRawChannelSimpleBuilder.cxx.

71{
72 ATH_MSG_DEBUG( "In Initialize." );
73
74 ATH_CHECK( m_adc2mevKey.initialize (m_useRampDB) );
75
76 if ( m_mode == "PARABOLA"){
77 if (m_peakParabolaTool.retrieve().isFailure())
78 {
79 ATH_MSG_ERROR( "Can't get LArParabolaPeakRecoTool" );
80 return StatusCode::SUCCESS;
81 }
82 ATH_MSG_DEBUG( "LArParabolaPeakRecoTool retrieved with success!" );
83 }
84
85 const CaloCell_ID* idHelper = nullptr;
86 ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
87 m_emId=idHelper->em_idHelper();
88 m_fcalId=idHelper->fcal_idHelper();
89 m_hecId=idHelper->hec_idHelper();
90
91 ATH_CHECK(m_cablingKey.initialize());
92
93 ATH_CHECK( detStore()->retrieve(m_onlineHelper, "LArOnlineID") );
94
95
96 ATH_CHECK( m_DataLocation.initialize() );
97 ATH_CHECK( m_ChannelContainerName.initialize() );
98 return StatusCode::SUCCESS;
99}
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition CaloCell_ID.h:75
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

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

75{
76 return BaseAlg::sysExecute (ctx);
77}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

105 {
107
108 if (sc.isFailure()) {
109 return sc;
110 }
111
112 ServiceHandle<ICondSvc> cs("CondSvc",name());
113 for (auto h : outputHandles()) {
114 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
115 // do this inside the loop so we don't create the CondSvc until needed
116 if ( cs.retrieve().isFailure() ) {
117 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
118 return StatusCode::SUCCESS;
119 }
120 if (cs->regHandle(this,*h).isFailure()) {
122 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
123 << " with CondSvc");
124 }
125 }
126 }
127 return sc;
128}
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_adc2mevKey

SG::ReadCondHandleKey<LArADC2MeV> LArRawChannelSimpleBuilder::m_adc2mevKey { this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" }
private

Definition at line 49 of file LArRawChannelSimpleBuilder.h.

50{ this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" };

◆ m_ADCtoMeVEMB

float LArRawChannelSimpleBuilder::m_ADCtoMeVEMB[4] {}
private

Definition at line 75 of file LArRawChannelSimpleBuilder.h.

75{};

◆ m_ADCtoMeVEMECInner

float LArRawChannelSimpleBuilder::m_ADCtoMeVEMECInner[2] {}
private

Definition at line 73 of file LArRawChannelSimpleBuilder.h.

73{};

◆ m_ADCtoMeVEMECOuter

float LArRawChannelSimpleBuilder::m_ADCtoMeVEMECOuter[4] {}
private

Definition at line 74 of file LArRawChannelSimpleBuilder.h.

74{};

◆ m_ADCtoMeVFCAL

float LArRawChannelSimpleBuilder::m_ADCtoMeVFCAL[3] {}
private

Definition at line 71 of file LArRawChannelSimpleBuilder.h.

71{};

◆ m_ADCtoMeVHEC

float LArRawChannelSimpleBuilder::m_ADCtoMeVHEC[2] {}
private

Definition at line 72 of file LArRawChannelSimpleBuilder.h.

72{};

◆ m_averageSamplesEM

int LArRawChannelSimpleBuilder::m_averageSamplesEM
private

Definition at line 68 of file LArRawChannelSimpleBuilder.h.

◆ m_averageSamplesFCAL

int LArRawChannelSimpleBuilder::m_averageSamplesFCAL
private

Definition at line 68 of file LArRawChannelSimpleBuilder.h.

◆ m_averageSamplesHEC

int LArRawChannelSimpleBuilder::m_averageSamplesHEC
private

Definition at line 68 of file LArRawChannelSimpleBuilder.h.

◆ m_averageScaleEM

float LArRawChannelSimpleBuilder::m_averageScaleEM
private

Definition at line 69 of file LArRawChannelSimpleBuilder.h.

◆ m_averageScaleFCAL

float LArRawChannelSimpleBuilder::m_averageScaleFCAL
private

Definition at line 69 of file LArRawChannelSimpleBuilder.h.

◆ m_averageScaleHEC

float LArRawChannelSimpleBuilder::m_averageScaleHEC
private

Definition at line 69 of file LArRawChannelSimpleBuilder.h.

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArRawChannelSimpleBuilder::m_cablingKey {this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"}
private

Definition at line 48 of file LArRawChannelSimpleBuilder.h.

48{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};

◆ m_ChannelContainerName

SG::WriteHandleKey<LArRawChannelContainer> LArRawChannelSimpleBuilder::m_ChannelContainerName { this, "LArRawChannelContainerName", "LArRawChannels", "" }
private

Definition at line 61 of file LArRawChannelSimpleBuilder.h.

62{ this, "LArRawChannelContainerName", "LArRawChannels", "" };

◆ m_cubicAdcCut

float LArRawChannelSimpleBuilder::m_cubicAdcCut
private

Definition at line 66 of file LArRawChannelSimpleBuilder.h.

◆ m_DataLocation

SG::ReadHandleKey<LArDigitContainer> LArRawChannelSimpleBuilder::m_DataLocation { this, "DataLocation", "FREE", "" }
private

Definition at line 59 of file LArRawChannelSimpleBuilder.h.

60{ this, "DataLocation", "FREE", "" };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_emId

const LArEM_ID* LArRawChannelSimpleBuilder::m_emId
private

Definition at line 51 of file LArRawChannelSimpleBuilder.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_fcalId

const LArFCAL_ID* LArRawChannelSimpleBuilder::m_fcalId
private

Definition at line 52 of file LArRawChannelSimpleBuilder.h.

◆ m_FCALmodeTime

std::string LArRawChannelSimpleBuilder::m_FCALmodeTime
private

Definition at line 65 of file LArRawChannelSimpleBuilder.h.

◆ m_hecId

const LArHEC_ID* LArRawChannelSimpleBuilder::m_hecId
private

Definition at line 53 of file LArRawChannelSimpleBuilder.h.

◆ m_imaxSamp

int LArRawChannelSimpleBuilder::m_imaxSamp
private

Definition at line 63 of file LArRawChannelSimpleBuilder.h.

◆ m_iPedestal

unsigned int LArRawChannelSimpleBuilder::m_iPedestal
private

Definition at line 77 of file LArRawChannelSimpleBuilder.h.

◆ m_mode

std::string LArRawChannelSimpleBuilder::m_mode
private

Definition at line 64 of file LArRawChannelSimpleBuilder.h.

◆ m_onlineHelper

const LArOnlineID* LArRawChannelSimpleBuilder::m_onlineHelper
private

Definition at line 54 of file LArRawChannelSimpleBuilder.h.

◆ m_peakParabolaTool

ToolHandle<LArParabolaPeakRecoTool> LArRawChannelSimpleBuilder::m_peakParabolaTool
private

Definition at line 56 of file LArRawChannelSimpleBuilder.h.

◆ m_usePedestalDB

bool LArRawChannelSimpleBuilder::m_usePedestalDB
private

Definition at line 67 of file LArRawChannelSimpleBuilder.h.

◆ m_useRampDB

bool LArRawChannelSimpleBuilder::m_useRampDB
private

Definition at line 67 of file LArRawChannelSimpleBuilder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: