![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "CLHEP/Units/SystemOfUnits.h"
18 #include "GaudiKernel/ThreadLocalContext.h"
29 m_onlineHelper(nullptr),
31 m_initialTimeSampleShift(0),
49 m_SamplingPeriodeUpperLimit(0),
50 m_SamplingPeriodeLowerLimit(0),
53 , m_pedestalKey(
"LArPedestal")
54 , m_shapesKey(
"LArShape")
96 return StatusCode::FAILURE;
150 return StatusCode::SUCCESS;
157 const EventContext& ctx = Gaudi::Hive::currentContext();
176 return StatusCode::FAILURE;
191 auto larRawChannelContainer = std::make_unique<LArRawChannelContainer>();
192 larRawChannelContainer->reserve(digitContainer->
size());
221 int region = -99999 ;
225 id =
cabling->cnvToIdentifier(chid);
227 ATH_MSG_DEBUG(
"A Cabling exception was caught for channel 0x!"
242 for (
unsigned iSample=0;iSample<
samples.size();iSample++) {
253 msg() <<
". Skipping channel." <<
endmsg;
255 }
else if ( nSatur>-1 ) {
263 float pedestalAverage;
271 <<
" [ Layer = " <<
layer <<
" - Eta = " <<
eta <<
" - Phi = " <<
phi <<
" - Region = " << region <<
" ]"
272 <<
" Gain = " <<
gain <<
". Skipping channel." );
281 << MSG::dec <<
" Gain=" <<
gain <<
". Using time sample " <<
m_iPedestal );
285 pedestalAverage=pedestal;
296 timeShift+=ofcTimeOffset;
304 timeSampleShift += 1;
310 timeSampleShift -= 1;
318 ATH_MSG_ERROR( noEnergy <<
". Time offset out of range for channel 0x" << MSG::hex << chid.
get_compact() << MSG::dec
326 ATH_MSG_ERROR( noEnergy <<
". Negative time sample (" << timeSampleShift <<
") shift for channel 0x" << MSG::hex << chid.
get_compact() << MSG::dec
327 <<
" Found. Skipping channel." );
341 if ( OFCTimeBin < 0 ) {
342 ATH_MSG_ERROR(
"Channel " << MSG::hex << chid.
get_compact() << MSG::dec <<
" asks for OFC bin = " << OFCTimeBin <<
". Set to 0." );
349 ofc_a=larOFC->
OFC_a(chid,
gain,OFCTimeBin);
354 if (ofc_a.size()==0) {
357 <<
" [ Layer = " <<
layer <<
" - Eta = " <<
eta <<
" - Phi = " <<
phi <<
" - Region = " << region <<
" ]"
358 <<
" Time bin = " << OFCTimeBin <<
", Gain = " <<
gain <<
". Skipping channel." );
361 if (ofc_a.size()+timeSampleShift>
nSamples) {
365 if (timeSampleShift==0)
367 << ofc_a.size() <<
" samples. Skipping Channel " );
370 <<
" samples left, but have OFCs for " << ofc_a.size() <<
" samples. Skipping Channel " );
377 for (
unsigned i=0;
i<(ofc_a.size());
i++)
378 ADCPeak+=(
samples[
i+timeSampleShift]-pedestalAverage)*ofc_a.
at(
i);
380 ATH_MSG_VERBOSE(
"ADC Height calculated " << ADCPeak <<
" TimeBin=" << OFCTimeBin );
385 if (ramp.size()==0) {
388 <<
" [ Layer = " <<
layer <<
" - Eta = " <<
eta <<
" - Phi = " <<
phi <<
" - Region = " << region <<
" ]"
389 <<
" Gain = " <<
gain <<
". Skipping channel." );
398 ATH_MSG_DEBUG(
"Bad ramp for channel " << chid <<
" (ramp[1] = " << ramp[1] <<
"): skip this channel" );
402 float ADCPeakPower=ADCPeak;
407 for (
unsigned i=1;
i<ramp.size();
i++)
410 ADCPeakPower*=ADCPeak;
416 ofc_b=larOFC->
OFC_b(chid,
gain,OFCTimeBin);
417 if (ofc_b.size() != ofc_a.size()) {
421 <<
" Gain "<<
gain <<
" found. Time not calculated." );
424 <<
" not equal to OFC for energy size " << ofc_a.size()
425 <<
" Time not calculated " );
429 for (
unsigned i=0;
i<(ofc_b.size());
i++)
452 id =
cabling->cnvToIdentifier(chid);
458 ATH_MSG_DEBUG(
"A Cabling exception was caught for channel 0x!"
468 <<
" Gain "<<
gain <<
". Quality factor not calculated." );
471 <<
"smaller than OFC size " << ofc_a.size()
472 <<
"for channel 0x" << MSG::hex << chid.
get_compact()
473 << MSG::dec <<
". Quality factor not calculated." );
479 if (
time!=0 && shapeDer.size()!=shape.size()) {
481 ATH_MSG_DEBUG(
"Shape-Derivative has different size than Shape for channel 0x" << MSG::hex << chid.
get_compact() << MSG::dec
482 <<
". Derivative not taken into accout for quality factor." );
485 if (
time==0 || shapeDer.size()!=shape.size() ) {
486 for (
unsigned i=0;
i<(ofc_a.size());
i++)
491 for (
unsigned i=0;
i<(ofc_a.size());
i++)
512 iqual = ( (
int)(quality) ) & 0xFFFF;
513 iprov = iprov | 0x2000;
517 larRawChannelContainer->push_back(larRawChannel);
520 <<
" e=" <<
energy <<
" t=" <<
time <<
" Q=" << quality );
523 ATH_MSG_DEBUG( ntot_raw <<
" channels successfully processed, (" << highE <<
" with high energy)" );
527 ATH_MSG_ERROR(
"Too many channels (" <<BadTiming<<
" !) have a bad timing !!" );
528 ATH_MSG_ERROR(
"OFC time constants should be revisited !!!" );
530 larRawChannelContainer->clear();
536 ATH_MSG_ERROR( saturation <<
" saturating channels were found. Event is skipped." );
537 larRawChannelContainer->clear();
591 else if (noTime || noShape || noShapeDer || saturation)
596 msg() << msglvl <<
" *** Error & Warning summary for this event *** " << std::endl;
599 msg() << msglvl <<
" " << noEnergy <<
" out of "
600 << digitContainer->size() <<
" channel(s) skipped due to a lack of basic calibration constants."
604 msg() << msglvl <<
" " << noTime <<
" out of "
605 << highE <<
" high-enegy channel(s) have no time-info due to a lack of Optimal Filtering Coefficients."
609 msg() << msglvl <<
" " << noShape <<
" out of "
610 << highE <<
" high-enegy channel(s) have no quality factor due to a lack of shape."
614 msg() << msglvl <<
" " << noShapeDer <<
" out of "
615 << highE <<
" high-enegy channel(s) lack the derivative of the shape. Not taken into accout for Quality factor."
620 msg() << MSG::ERROR <<
" " << saturation <<
" out of "
621 << digitContainer->size() <<
" channel(s) showed saturations. The complete event was skipped." << std::endl;
623 msg() << MSG::ERROR <<
" " << saturation <<
" out of "
624 << digitContainer->size() <<
" channel(s) showed saturations and were skipped." << std::endl;
626 msg() << MSG::WARNING <<
" " << saturation <<
" out of "
627 << digitContainer->size() <<
" channel(s) showed saturations." << std::endl;
634 return StatusCode::SUCCESS;
665 msg() << msglvl <<
" *** Error & Warning Summary for all events *** " << std::endl ;
695 ATH_MSG_INFO(
"LArRawChannelBuilder finished without errors or warnings." );
702 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
int m_initialTimeSampleShift
virtual float pedestal(const HWIdentifier &id, int gain) const =0
int phi(const Identifier id) const
return phi according to :
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
Scalar phi() const
phi method
const LArEM_ID * em_idHelper() const
access to EM idHelper
Scalar eta() const
pseudorapidity method
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
virtual OFCRef_t OFC_b(const HWIdentifier &id, int gain, int tbin=0) const =0
float round(const float toRound, const unsigned int decimals)
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
double m_SamplingPeriodeLowerLimit
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
bool msgLvl(const MSG::Level lvl) const
int region(const Identifier id) const
return region according to :
int sampling(const Identifier id) const
return sampling according to :
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
unsigned m_skipSaturCells
int eta(const Identifier id) const
return eta according to :
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Handle class for recording to StoreGate.
virtual float timeOffset(const HWIdentifier &CellID, int gain) const =0
SG::WriteHandleKey< LArRawChannelContainer > m_ChannelContainerName
value_type at(size_t i) const
Vector indexing with bounds check.
msgSvc
Provide convenience handles for various services.
Liquid Argon digit base class.
Liquid Argon ROD output object base class.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::string m_pedestalKey
bool is_lar_hec(Identifier id) const
Helper class for offline cell identifiers.
virtual StatusCode finalize() override
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
double m_SamplingPeriodeUpperLimit
int m_pedestalFallbackMode
const LArOnlineID * m_onlineHelper
StatusCode initialize(bool used=true)
virtual StatusCode execute() override
SG::ReadHandleKey< LArDigitContainer > m_dataLocation
value_type get_compact(void) const
Get the compact id.
def time(flags, cells_name, *args, **kw)
virtual StatusCode initialize() override
virtual OFCRef_t OFC_a(const HWIdentifier &id, int gain, int tbin=0) const =0
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
SG::ReadCondHandleKey< ILArOFC > m_ofcKey
Property: OFC coefficients (conditions input).
Handle class for reading from StoreGate.
size_type size() const noexcept
Returns the number of elements in the collection.
LArRawChannelBuilder(const std::string &name, ISvcLocator *pSvcLocator)
Exception class for LAr Identifiers.
Proxy for accessing a range of float values like a vector.
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0