|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "CLHEP/Units/SystemOfUnits.h"
19 #include "GaudiKernel/ThreadLocalContext.h"
31 m_DataLocation(
"FREE"),
32 m_ChannelContainerName(
"LArRawChannels"),
36 m_ConvertADCToHighGain(false),
38 m_initialTimeSampleShift(0),
56 m_SamplingPeriodeUpperLimit(0),
57 m_SamplingPeriodeLowerLimit(0),
105 for (
int i=0;
i<30;
i++) {
176 return StatusCode::SUCCESS;
183 const EventContext& ctx = Gaudi::Hive::currentContext();
197 oflHVCorr = *oflHVCorrHdl;
200 return StatusCode::FAILURE;
207 return StatusCode::FAILURE;
214 float globalTimeOffset=0;
229 if (
sc.isFailure()) {
230 ATH_MSG_WARNING (
"Can't retrieve LArShape from Conditions Store" << std::endl
231 <<
"Quality factor will not be caluclated." );
247 const TBPhase* theTBPhase =
nullptr;
259 if (
sc.isSuccess()) globalTimeOffset = larGlobalTimeOffset->
TimeOffset();
263 if (
sc.isFailure()) larFebTimeOffset=NULL;
268 larRawChannelContainer->reserve(digitContainer->
size());
271 ATH_MSG_ERROR (
"Can't record LArRawChannelContainer in StoreGate" );
295 const std::vector<short>& samples=
digit->samples();
296 const unsigned nSamples=samples.size();
304 int region = -99999 ;
308 id =
cabling->cnvToIdentifier(chid);
310 ATH_MSG_DEBUG (
"A Cabling exception was caught for channel 0x!"
319 <<
" [ Layer = " <<
layer <<
" - Eta = " <<
eta
320 <<
" - Phi = " <<
phi <<
" - Region = " << region <<
" ] " );
325 for (
unsigned iSample=0;iSample<samples.size();iSample++) {
336 msg() <<
". Skipping channel." <<
endmsg;
338 }
else if ( nSatur>-1 ) {
347 float pedestalAverage;
355 <<
" [ Layer = " <<
layer <<
" - Eta = " <<
eta <<
" - Phi = " <<
phi <<
" - Region = " << region <<
" ]"
356 <<
" Gain = " <<
gain <<
". Skipping channel." );
365 << MSG::dec <<
" Gain=" <<
gain <<
". Using time sample " <<
m_iPedestal );
368 pedestalAverage=pedestal;
376 float febTimeOffset=0;
378 if (larFebTimeOffset)
379 febTimeOffset=larFebTimeOffset->
TimeOffset(febid);
380 double timeShift=PhaseTime+globalTimeOffset+febTimeOffset;
383 <<
" phase=" << PhaseTime <<
" Feb=" << febTimeOffset
384 <<
" Global=" << globalTimeOffset;
388 timeShift+=ofcTimeOffset;
396 timeSampleShift -= 1;
402 timeSampleShift += 1;
410 ATH_MSG_ERROR ( noEnergy <<
". Time offset out of range for channel 0x" << MSG::hex << chid.
get_compact() << MSG::dec
418 ATH_MSG_ERROR ( noEnergy <<
". Negative time sample (" << timeSampleShift <<
") shift for channel 0x" << MSG::hex << chid.
get_compact() << MSG::dec
419 <<
" Found. Skipping channel." );
433 if ( OFCTimeBin < 0 ) {
434 ATH_MSG_ERROR (
"Channel " << MSG::hex << chid.
get_compact() << MSG::dec <<
" asks for OFC bin = " << OFCTimeBin <<
". Set to 0." );
441 ofc_a=larOFC->
OFC_a(chid,
gain,OFCTimeBin);
446 if (ofc_a.size()==0) {
449 <<
" [ Layer = " <<
layer <<
" - Eta = " <<
eta <<
" - Phi = " <<
phi <<
" - Region = " << region <<
" ]"
450 <<
" Time bin = " << OFCTimeBin <<
", Gain = " <<
gain <<
". Skipping channel." );
453 if (ofc_a.size()+timeSampleShift>
nSamples) {
456 if (timeSampleShift==0)
458 << ofc_a.size() <<
" samples. Skipping Channel ");
461 <<
" samples left, but have OFCs for " << ofc_a.size() <<
" samples. Skipping Channel ");
467 for (
unsigned i=0;
i<(ofc_a.size());
i++)
468 ADCPeak+=(samples[
i+timeSampleShift]-pedestalAverage)*ofc_a.
at(
i);
476 if (ramp.size()==0) {
479 <<
" [ Layer = " <<
layer <<
" - Eta = " <<
eta <<
" - Phi = " <<
phi <<
" - Region = " << region <<
" ]"
480 <<
" Gain = " <<
gain <<
". Skipping channel." );
487 ATH_MSG_DEBUG (
"Bad ramp for channel " << chid <<
" (ramp[1] = " << ramp[1] <<
"): skip this channel" );
491 float ADCPeakPower=ADCPeak;
496 for (
unsigned i=1;
i<ramp.size();
i++)
498 ADCPeakPower*=ADCPeak;
513 float hvCorr = oflHVCorr-> HVScaleCorr(chid);
520 ofc_b=larOFC->
OFC_b(chid,
gain,OFCTimeBin);
521 if (ofc_b.size() != ofc_a.size()) {
524 <<
" Gain "<<
gain <<
" found. Time not calculated." );
527 <<
" not equal to OFC for energy size " << ofc_a.size()
528 <<
" Time not calculated " );
531 for (
unsigned i=0;
i<(ofc_b.size());
i++)
532 time+=(samples[
i+timeSampleShift]-pedestalAverage)*ofc_b.
at(
i);
551 if (shape.size() < ofc_a.size()) {
554 <<
" Gain "<<
gain <<
". Quality factor not calculated." );
557 <<
"smaller than OFC size " << ofc_a.size()
558 <<
"for channel 0x" << MSG::hex << chid.
get_compact()
559 << MSG::dec <<
". Quality factor not calculated." );
564 if (
time!=0 && shapeDer.size()!=shape.size()) {
566 ATH_MSG_DEBUG (
"Shape-Derivative has different size than Shape for channel 0x" << MSG::hex << chid.
get_compact() << MSG::dec
567 <<
". Derivative not taken into accout for quality factor." );
570 if (
time==0 || shapeDer.size()!=shape.size() ) {
571 for (
unsigned i=0;
i<(ofc_a.size());
i++)
572 quality+=((samples[
i+timeSampleShift]-pedestalAverage)-shape[
i]*ADCPeak)*
573 ((samples[
i+timeSampleShift]-pedestalAverage)-shape[
i]*ADCPeak);
576 for (
unsigned i=0;
i<(ofc_a.size());
i++)
577 quality+=((samples[
i+timeSampleShift]-pedestalAverage)-((shape[
i]-shapeDer[
i]*
time)*ADCPeak))*
578 ((samples[
i+timeSampleShift]-pedestalAverage)-((shape[
i]-shapeDer[
i]*
time)*ADCPeak));
598 iquality = ((
int)(quality) ) & 0xFFFF;
599 iprovenance=iprovenance | 0x2000;
604 larRawChannelContainer->push_back(larRawChannel);
608 <<
" e=" <<
energy <<
" t=" <<
time <<
" Q=" << quality );
611 ATH_MSG_DEBUG ( ntot_raw <<
" channels successfully processed, (" << highE <<
" with high energy)" );
615 ATH_MSG_ERROR (
"Too many channels (" <<BadTiming<<
" !) have a bad timing !!" );
616 ATH_MSG_ERROR (
"OFC time constants should be revisited !!!" );
618 larRawChannelContainer->clear();
624 ATH_MSG_ERROR ( saturation <<
" saturating channels were found. Event is skipped." );
625 larRawChannelContainer->clear();
681 msg() << msglvl <<
" *** Error & Warning summary for this event *** " << std::endl;
684 msg() << msglvl <<
" " << noEnergy <<
" out of "
685 << digitContainer->
size() <<
" channel(s) skipped due to a lack of basic calibration constants."
689 msg() << msglvl <<
" " << noTime <<
" out of "
690 << highE <<
" high-enegy channel(s) have no time-info due to a lack of Optimal Filtering Coefficients."
694 msg() << msglvl <<
" " << noShape <<
" out of "
695 << highE <<
" high-enegy channel(s) have no quality factor due to a lack of shape."
699 msg() << msglvl <<
" " << noShapeDer <<
" out of "
700 << highE <<
" high-enegy channel(s) lack the derivative of the shape. Not taken into accout for Quality factor."
705 msg() << MSG::ERROR <<
" " << saturation <<
" out of "
706 << digitContainer->
size() <<
" channel(s) showed saturations. The complete event was skipped." << std::endl;
708 msg() << MSG::ERROR <<
" " << saturation <<
" out of "
709 << digitContainer->
size() <<
" channel(s) showed saturations and were skipped." << std::endl;
711 msg() << MSG::WARNING <<
" " << saturation <<
" out of "
712 << digitContainer->
size() <<
" channel(s) showed saturations." << std::endl;
720 return StatusCode::SUCCESS;
745 msg() << msglvl <<
" *** Error & Warning Summary for all events *** " << std::endl ;
775 ATH_MSG_INFO (
"TBECLArRawChannelBuilder finished without errors or warnings." );
782 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
virtual StatusCode execute() override
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
const LArOnlineID * m_onlineHelper
SG::ReadCondHandleKey< ILArHVScaleCorr > m_offlineHVScaleCorrKey
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)
virtual float TimeOffset(const HWIdentifier fId) const =0
virtual OFCRef_t OFC_b(const HWIdentifier &id, int gain, int tbin=0) const =0
float round(const float toRound, const unsigned int decimals)
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
std::string m_ChannelContainerName
value_type get_compact() const
Get the compact id.
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 :
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
TBECLArRawChannelBuilder(const std::string &name, ISvcLocator *pSvcLocator)
const CaloCell_ID * m_calo_id
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::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
SG::ReadCondHandleKey< ILArOFC > m_ofcKey
Property: OFC coefficients (conditions input).
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
virtual float timeOffset(const HWIdentifier &CellID, int gain) const =0
value_type at(size_t i) const
Vector indexing with bounds check.
msgSvc
Provide convenience handles for various services.
Liquid Argon digit base class.
double m_SamplingPeriodeLowerLimit
Liquid Argon ROD output object base class.
Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old LArRawChannelContainer
::StatusCode StatusCode
StatusCode definition for legacy code.
int m_pedestalFallbackMode
virtual float TimeOffset() const =0
unsigned m_skipSaturCells
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
virtual StatusCode finalize() override
StatusCode initialize(bool used=true)
Wrapper to avoid constant divisions when using units.
double m_SamplingPeriodeUpperLimit
std::string m_DataLocation
def time(flags, cells_name, *args, **kw)
#define ATH_MSG_WARNING(x)
bool m_ConvertADCToHighGain
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Container class for LArDigit.
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)
int m_initialTimeSampleShift
virtual StatusCode initialize() override
std::string debugPrint(const IDC_Container *container, unsigned numprint=25)
Diagnostic output of Identifiable Containers.
size_type size() const noexcept
Returns the number of elements in the collection.
Exception class for LAr Identifiers.
Proxy for accessing a range of float values like a vector.
Container for LArRawChannel (IDC using LArRawChannelCollection)
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0