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

This class provides conversion between ROD data and LArRawChannels. More...

#include <LArRodDecoder.h>

Inheritance diagram for LArRodDecoder:
Collaboration diagram for LArRodDecoder:

Public Member Functions

 LArRodDecoder (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor Standard AlgTool constructor.
virtual ~LArRodDecoder ()
 Destructor.
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override
void setsecfeb (HWIdentifier feb)
uint32_t fillCollectionHLT (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, LArCellCollection &coll, LArRodBlockStructure *&providedRodBlockStructure, uint16_t &rodMinorVersion, uint32_t &robBlockType) const
void fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, LArRawChannelContainer &coll, const CaloGain::CaloGain gain) const
void fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, LArDigitContainer &coll, const CaloGain::CaloGain gain) const
void fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, LArAccumulatedCalibDigitContainer &coll, const CaloGain::CaloGain gain, const LArCalibLineMapping &calibLineMapping) const
void fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, LArAccumulatedDigitContainer &coll, const CaloGain::CaloGain gain) const
void fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, LArCalibDigitContainer &coll, const CaloGain::CaloGain gain, const LArCalibLineMapping &calibLineMapping, const LArOnOffIdMapping &onOffIdMapping) const
void fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, LArFebHeaderContainer &coll, const CaloGain::CaloGain) const
template<class T>
bool check_valid (const T *frag, MsgStream &log) 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 sysInitialize () override
 Perform system initialization for an algorithm.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()

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< StoreGateSvc > StoreGateSvc_t

Private Member Functions

LArRodBlockStructure * prepareBlockStructure1 (const uint16_t rodMinorVersion, const uint32_t robBlockType) const
LArRodBlockStructure * prepareBlockStructure (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, const CaloGain::CaloGain RequestedGain) const
std::unique_ptr< LArRodBlockStructure > makeBlockStructure (unsigned int rodBlockType, unsigned int rodMinorVersion) const
void setCellEnergy (LArCell *element, int energy, int time, int quality, CaloGain::CaloGain gain) const
void writeFebInfo (LArCellCollection &m_coll, LArFebEnergy &febene) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::EventInfo > m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}
float m_LArCellEthreshold
bool m_readtdc
bool m_febExchange
unsigned int m_febId1
unsigned int m_febId2
unsigned int m_febIdHLT = 0U
int m_firstSample
std::vector< int > m_vFTPreselection
std::vector< int > m_vBEPreselection
std::vector< int > m_vPosNegPreselection
std::vector< unsigned int > m_vFinalPreselection
uint32_t m_StatusMask
uint32_t m_StatusNMask = 0U
const LArOnlineID * m_onlineHelper
std::vector< std::string > m_LArCellCorrNames
std::vector< unsigned int > m_IgnoreCheckFEBs
std::vector< const CaloCellCorrection * > m_LArCellCorrTools
double m_delayScale
SG::SlotSpecificObj< std::vector< std::unique_ptr< LArRodBlockStructure > > > m_blstructs ATLAS_THREAD_SAFE
bool m_MultiDSPMode
bool m_CheckSum
unsigned short m_requiredPhysicsNSamples
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

This class provides conversion between ROD data and LArRawChannels.

Author
H. Ma
Version
0-0-1 , Oct 7, 2002

Modified, Dec 4, 2002 Create either LArRawChannel or LArCell.

Modified, Jan 02, 2003 Moved Encoding part to LArROD_Encoder.

Modified, Jul 23, 2003 by R. Lafaye Added LArDigit support Build on the same structure as LArROD_Encoder No longer an AlgTool

Modified, Aug 5 2003 by W. Lampl Have now functionality to decode:

Modified, Aug 7 2003 by W. Lampl Made a template-function for LArRawChannelCollection and LArRawCellCollection

Modified, Aug 17 2003 by W. Lampl Introduce ability to decode different ROD format versions by using a map of LArRodBlockStructures

Modified, Sept 9 2003 by W. Lampl Change implementation of multiple-version feature. A ROD block type/version is now written as second word of the fragment. Replace std::map by c-style array to increase performance

Modified, Sept 28 2003 by W. Lampl Adapt for new constructor of LArRawChannels. (Needs also gain as parameter)

Modified, November 10 2005 by D.O. Damazio Inclusion of new RodBlock format (Bertrand Laforge). Inclusion of methods for fast decoding of data.

Modified,January 04 2006 by I. Wingerter Inclusion of Accumulated Calib Digit

Modified, May 03 2006 by I. Aracena Inclusion of fillCollectionHLTFeb

Modified, Dec 03 2006 by G. Rosenbaum Loop over all possible pusled calib lines and make isPulsed int which stores which lines 1-4 have been pulsed. (needed for HEC)

Modified Aug 16 2009 by W. Lampl Remove internal accumlation of LArAccumulatedCalibDigit. They are now put in the event store for each substep and contain only data of this substep.

Definition at line 127 of file LArRodDecoder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArRodDecoder()

LArRodDecoder::LArRodDecoder ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor Standard AlgTool constructor.

Definition at line 26 of file LArRodDecoder.cxx.

27 : AthAlgTool(type,name,parent),
29 m_readtdc(false),
31 {
32 declareInterface< LArRodDecoder >( this );
33 declareProperty("IgnoreCheckFEBs",m_IgnoreCheckFEBs);
34 declareProperty("CellCorrections",m_LArCellCorrNames );
35 declareProperty("LArCellEthreshold",m_LArCellEthreshold );
36 declareProperty("ReadTDC",m_readtdc);
37 declareProperty("DelayScale",m_delayScale=(25./240.)*CLHEP::ns);
38 declareProperty("FebExchange", m_febExchange=0); //FIXME: Very ugly hack! See explanation in .h file
39 declareProperty("FebId1", m_febId1=0);
40 declareProperty("FebId2", m_febId2=0);
41 declareProperty("FirstSample", m_firstSample=0); //FIXME: Very ugly hack! See explanation in .h file
42
43 declareProperty("BEPreselection",m_vBEPreselection,"For channel-selection: Barrel=0, Endcap=1");
44 declareProperty("PosNegPreselection",m_vPosNegPreselection,"For channel-selection: C-Side:0, A-Side: 1");
45 declareProperty("FTNumPreselection",m_vFTPreselection,"For channel-selection: Feedthrough numbers (e.g. 0 - 31 for barrel)");
46 declareProperty("MultiDSPMode", m_MultiDSPMode=false);
47 declareProperty("CheckSum", m_CheckSum=false);
48 declareProperty("StatusMask", m_StatusMask=0x00000212);
49 declareProperty("RequiredPhysicsNSamples", m_requiredPhysicsNSamples = 0);
50}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< std::string > m_LArCellCorrNames
std::vector< int > m_vFTPreselection
const LArOnlineID * m_onlineHelper
std::vector< unsigned int > m_IgnoreCheckFEBs
unsigned int m_febId1
float m_LArCellEthreshold
unsigned short m_requiredPhysicsNSamples
std::vector< int > m_vBEPreselection
unsigned int m_febId2
uint32_t m_StatusMask
std::vector< int > m_vPosNegPreselection

◆ ~LArRodDecoder()

LArRodDecoder::~LArRodDecoder ( )
virtual

Destructor.

Definition at line 53 of file LArRodDecoder.cxx.

54{
55}

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode initialize LArRodDecoder::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

◆ check_valid()

template<class T>
bool LArRodDecoder::check_valid ( const T * frag,
MsgStream & log ) const
inline

Definition at line 244 of file LArRodDecoder.h.

245{
246 bool ret=false;
247 try {
248 ret=frag->check();
249 }
250 catch (eformat::Issue& ex) {
251 msg(MSG::WARNING) << "Exception while checking eformat fragment validity: " << ex.what() << endmsg;
252 ret=false;
253 }
254 return ret;
255
256}
#define endmsg
MsgStream & msg() const

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ fillCollection() [1/6]

void LArRodDecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
LArAccumulatedCalibDigitContainer & coll,
const CaloGain::CaloGain gain,
const LArCalibLineMapping & calibLineMapping ) const

Definition at line 494 of file LArRodDecoder.cxx.

500{ // Accumulated Digit pointer
501 LArAccumulatedCalibDigit * dg=0 ;
502 CaloGain::CaloGain calogain;
503 uint32_t gain, ntrigger;
504 int dac, delay, NStep=-1, StepIndex=-1;
505 bool ispulsed;
506 uint16_t ispulsed_int;
507 int bitShift;
508 uint32_t FirstGoodFEB=1;
509 int fcNb;
510 std::vector< uint64_t > samplesSum;
511 std::vector< uint64_t > samples2Sum;
512
513 LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
514 if (!BlStruct) return;
515 do
516 {
517 // IWS 24.01.2006 protection against NULL events (null pointer to rawdata block)
518 if (!BlStruct->hasCalibBlock())
519 {
520 ATH_MSG_DEBUG("No Calib Data for this FEB - NULL event");
521 continue;
522 }
523 if(FirstGoodFEB)
524 {
525 FirstGoodFEB=0;
526 }
527 HWIdentifier fId(Identifier32(BlStruct->getFEBID()));
528 unsigned int fId32 = fId.get_identifier32().get_compact();
529 // RL 20.09.2006 protection against 0 FebId
530 if (!fId32){
531 ATH_MSG_DEBUG("Bad FebID=0x" << std::hex << BlStruct->getFEBID() << " found for this FEB, skipping it!" << std::dec);
532 continue;
533 }
534 // RL 04.17.2008 skip check for some FEBs
535 int do_check=1;
536 std::vector<unsigned int>::const_iterator it_feb = m_IgnoreCheckFEBs.begin();
537 std::vector<unsigned int>::const_iterator it_feb_end = m_IgnoreCheckFEBs.end();
538 for(; it_feb!=it_feb_end;++it_feb)
539 if(fId==*it_feb) {
540 do_check=0;
541 break;
542 }
543 if(do_check) {
544 //WL 31.10.2007 //check RodStatus-word to catch corrupt events
545 if (BlStruct->getStatus() & m_StatusNMask) {
546 ATH_MSG_WARNING("RodStatus&0x" << std::hex << m_StatusNMask << " indicates corrupt data for FEB "<< std::hex << fId32 << std::dec <<". Ignored.");
547 continue;
548 }
549 }
550 // RL 05.11.2007 checksum
551 if(m_CheckSum) {
552 uint32_t onsum = BlStruct->onlineCheckSum();
553 uint32_t offsum = BlStruct->offlineCheckSum();
554 if(onsum!=offsum) {
555 ATH_MSG_WARNING("Checksum error:");
556 ATH_MSG_WARNING(" online checksum = " << MSG::hex << onsum);
557 ATH_MSG_WARNING(" offline checksum = " << MSG::hex << offsum);
558 continue;
559 }
560 }
561 if(m_febExchange) {
562 if (fId32 == m_febId1) {
563 fId = HWIdentifier(Identifier32(m_febId2));
564 fId32 = fId.get_identifier32().get_compact();
565 }
566 else if(fId32 == m_febId2) {
567 fId = HWIdentifier(Identifier32(m_febId1));
568 fId32 = fId.get_identifier32().get_compact();
569 }
570 }
571
572 if (m_vFinalPreselection.size()) {
573 unsigned int ftId=m_onlineHelper->feedthrough_Id(fId).get_identifier32().get_compact();
574 if (!std::binary_search(m_vFinalPreselection.begin(), m_vFinalPreselection.end(),ftId)) {
575 ATH_MSG_DEBUG("Feedthrough with id " << std::hex << ftId << std::dec <<" not in preselection. Ignored.");
576 continue;
577 }
578 }
579 int NthisFebChannel=m_onlineHelper->channelInSlotMax(fId);
580 uint32_t idum=0;
581 while (BlStruct->getNextAccumulatedCalibDigit(fcNb,samplesSum,samples2Sum,idum,gain))
582 {
583 ispulsed_int=0;
584 bitShift=0;
585 if (fcNb>=NthisFebChannel)continue;
586 if (samplesSum.size()==0) continue; // Ignore missing cells
587 HWIdentifier cId = m_onlineHelper->channel_Id(fId,fcNb);
588 calogain=(CaloGain::CaloGain)gain;
589 ntrigger=BlStruct->getNTrigger();
590 dac=BlStruct->getDAC();
591 delay=BlStruct->getDelay();
592 NStep=BlStruct->getNStep();
593 if(!NStep) NStep=1; // To be able to decode v6 code
594 StepIndex=BlStruct->getStepIndex();
595 // 08.08.2005 IWS get calib line
596 const std::vector<HWIdentifier>& calibChannelIDs = calibLineMapping.calibSlotLine(cId);
597 if (calibChannelIDs.size()==0) {
598 samplesSum.clear();
599 samples2Sum.clear();
600 continue;// connected channel
601 }
602 //GR: Loop over all the calib chans instead of just looking at the first one and set four bit isPulsed int
603 for(std::vector<HWIdentifier>::const_iterator csl_it=calibChannelIDs.begin(); csl_it!=calibChannelIDs.end();++csl_it){
604 uint32_t calibLine = m_onlineHelper->channel(*csl_it);
605 ispulsed=BlStruct->getPulsed(calibLine);
606 ispulsed_int=( ispulsed_int | ((uint16_t)ispulsed<<bitShift) );
607 bitShift++;
608 }
609
610 dg=new LArAccumulatedCalibDigit(cId, calogain, samplesSum, samples2Sum, ntrigger, dac, delay,
611 (uint16_t)ispulsed_int, NStep, StepIndex);
612
613 coll.push_back(dg);
614 } // End while
615 }//End do loop of FEBs
616 while (BlStruct->nextFEB()); //Get NextFeb
617}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
double delay(std::size_t d)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
virtual uint16_t getNStep() const
virtual uint32_t hasCalibBlock() const
virtual uint16_t getDelay() const
virtual bool getPulsed(unsigned channelNumber) const
virtual uint16_t getDAC() const
virtual int getNextAccumulatedCalibDigit(int &channelNumber, std::vector< uint64_t > &SamplesSum, std::vector< uint64_t > &Samples2Sum, uint32_t &nStepTriggers, uint32_t &gain)
virtual uint16_t getStepIndex() const
virtual uint16_t getNTrigger() const
virtual uint32_t offlineCheckSum() const
virtual uint32_t getStatus() const
virtual uint32_t onlineCheckSum() const
std::vector< unsigned int > m_vFinalPreselection
uint32_t m_StatusNMask
LArRodBlockStructure * prepareBlockStructure(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const uint32_t *p, uint32_t n, const CaloGain::CaloGain RequestedGain) const
setWord1 uint16_t
setEventNumber uint32_t

◆ fillCollection() [2/6]

void LArRodDecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
LArAccumulatedDigitContainer & coll,
const CaloGain::CaloGain gain ) const

Definition at line 619 of file LArRodDecoder.cxx.

621{ // Accumulated Digit pointer
622 LArAccumulatedDigit * dg=0 ;
623 CaloGain::CaloGain calogain;
624 uint32_t gain, ntrigger;
625 int fcNb;
626 std::vector<uint64_t> sampleSum;
627 std::vector< uint64_t > sampleSquare;
628
629 LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
630 if (!BlStruct) return;
631 do
632 {
633 // IWS 24.01.2006 protection against NULL events (null pointer to rawdata block)
634 if (!BlStruct->hasAccumBlock()) {
635 ATH_MSG_DEBUG("No Accum Data for this FEB - NULL event");
636 continue;
637 }
638 HWIdentifier fId(Identifier32(BlStruct->getFEBID()));
639 unsigned int fId32 = fId.get_identifier32().get_compact();
640 // RL 20.09.2006 protection against 0 FebId
641 if (!fId32) {
642 ATH_MSG_DEBUG("Bad FebID=0x" << std::hex << BlStruct->getFEBID() << " found for this FEB, skipping it!" << std::dec);
643 continue;
644 }
645 // RL 04.17.2008 skip check for some FEBs
646 int do_check=1;
647 std::vector<unsigned int>::const_iterator it_feb = m_IgnoreCheckFEBs.begin();
648 std::vector<unsigned int>::const_iterator it_feb_end = m_IgnoreCheckFEBs.end();
649 for(; it_feb!=it_feb_end;++it_feb)
650 if(fId==*it_feb) {
651 do_check=0;
652 break;
653 }
654 if(do_check) {
655 //WL 31.10.2007 //check RodStatus-word to catch corrupt events
656 if (BlStruct->getStatus() & m_StatusNMask) {
657 ATH_MSG_WARNING("RodStatus&0x" << std::hex << m_StatusNMask << " indicates corrupt data for FEB "<< std::hex << fId32 << std::dec <<". Ignored.");
658 continue;
659 }
660 }
661 // RL 05.11.2007 checksum
662 if(m_CheckSum) {
663 uint32_t onsum = BlStruct->onlineCheckSum();
664 uint32_t offsum = BlStruct->offlineCheckSum();
665 if(onsum!=offsum) {
666 ATH_MSG_WARNING("Checksum error:");
667 ATH_MSG_WARNING(" online checksum = " << MSG::hex << onsum);
668 ATH_MSG_WARNING(" offline checksum = " << MSG::hex << offsum);
669 continue;
670 }
671 }
672 if(m_febExchange) {
673 if (fId32 == m_febId1) {
674 fId = HWIdentifier(Identifier32(m_febId2));
675 fId32 = fId.get_identifier32().get_compact();
676 }
677 else if(fId32 == m_febId2) {
678 fId = HWIdentifier(Identifier32(m_febId1));
679 fId32 = fId.get_identifier32().get_compact();
680 }
681 }
682
683 if (m_vFinalPreselection.size()) {
684 unsigned int ftId=m_onlineHelper->feedthrough_Id(fId).get_identifier32().get_compact();
685 if (!std::binary_search(m_vFinalPreselection.begin(), m_vFinalPreselection.end(),ftId)) {
686 ATH_MSG_DEBUG("Feedthrough with id " << std::hex << ftId << std::dec <<" not in preselection. Ignored.");
687 continue;
688 }
689 }
690 int NthisFebChannel=m_onlineHelper->channelInSlotMax(fId);
691 ntrigger=BlStruct->getNTrigger();
692 while (BlStruct->getNextAccumulatedDigit(fcNb,sampleSum,sampleSquare,gain)) {
693 if (fcNb>=NthisFebChannel)continue;
694 if (sampleSquare.size()==0) continue; // Ignore missing cells
695 HWIdentifier cId = m_onlineHelper->channel_Id(fId,fcNb);
696 calogain=(CaloGain::CaloGain)gain;
697 dg=new LArAccumulatedDigit(cId,calogain,sampleSum,sampleSquare,ntrigger);
698 coll.push_back(dg);
699 } // End while
700 }//End do loop of FEBs
701 while (BlStruct->nextFEB()); //Get NextFeb
702}
virtual uint32_t hasAccumBlock() const
virtual int getNextAccumulatedDigit(int &channelNumber, std::vector< uint64_t > &SamplesSum, std::vector< uint64_t > &corr2Sum, uint32_t &gain)

◆ fillCollection() [3/6]

void LArRodDecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
LArCalibDigitContainer & coll,
const CaloGain::CaloGain gain,
const LArCalibLineMapping & calibLineMapping,
const LArOnOffIdMapping & onOffIdMapping ) const

Definition at line 305 of file LArRodDecoder.cxx.

312{ // CalibDigit pointer
313 LArCalibDigit * dg=0 ;
315 CaloGain::CaloGain calogain;
316 int fcNb;
318 bool ispulsed;
319 std::vector<short> samples;
320
321 ATH_MSG_VERBOSE("FillCollection for LArCalibDigitContainer is called.");
322 LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
323 if (!BlStruct) return;
324 if (BlStruct->canSetCalibration()) {
325 dac=BlStruct->getDAC();
326 delay=BlStruct->getDelay();
327 do
328 {
329 // IWS 24.01.2006 protection against NULL events (null pointer to rawdata block)
330 if (!BlStruct->hasRawDataBlock()) {
331 ATH_MSG_DEBUG("No Raw Data for this FEB - NULL event for FEBID " << std::hex << BlStruct->getFEBID());
332 continue;
333 }
334 HWIdentifier fId(Identifier32(BlStruct->getFEBID()));
335 unsigned int fId32 = fId.get_identifier32().get_compact();
336 // RL 20.09.2006 protection against 0 FebId
337 if (!fId32){
338 ATH_MSG_DEBUG("Bad FebID=0x"<< std::hex << BlStruct->getFEBID() << " found for this FEB, skipping it!");
339 continue;
340 }
341 // RL 04.17.2008 skip check for some FEBs
342 int do_check=1;
343 std::vector<unsigned int>::const_iterator it_feb = m_IgnoreCheckFEBs.begin();
344 std::vector<unsigned int>::const_iterator it_feb_end = m_IgnoreCheckFEBs.end();
345 for(; it_feb!=it_feb_end;++it_feb)
346 if(fId==*it_feb) {
347 do_check=0;
348 break;
349 }
350 if(do_check) {
351 //WL 31.10.2007 //check RodStatus-word to catch corrupt events
352 if (BlStruct->getStatus() & m_StatusNMask) {
353 msg(MSG::WARNING) << "RodStatus&0x" << std::hex << m_StatusNMask << " indicates corrupt data for FEB "<< std::hex << fId32 << std::dec <<". Ignored." << endmsg;
354 continue;
355 }
356 }
357 // RL 05.11.2007 checksum
358 if(m_CheckSum) {
359 uint32_t onsum = BlStruct->onlineCheckSum();
360 uint32_t offsum = BlStruct->offlineCheckSum();
361 if(onsum!=offsum) {
362 msg(MSG::WARNING) << "Checksum error:" << endmsg;
363 msg(MSG::WARNING) << " online checksum = " << MSG::hex << onsum << endmsg;
364 msg(MSG::WARNING) << " offline checksum = " << MSG::hex << offsum << endmsg;
365 continue;
366 }
367 }
368 if(m_febExchange) {
369 if (fId32 == m_febId1) {
370 fId = HWIdentifier(Identifier32(m_febId2));
371 fId32 = fId.get_identifier32().get_compact();
372 }
373 else if(fId32 == m_febId2) {
374 fId = HWIdentifier(Identifier32(m_febId1));
375 fId32 = fId.get_identifier32().get_compact();
376 }
377 }
378
379 if (m_vFinalPreselection.size()) {
380 unsigned int ftId=m_onlineHelper->feedthrough_Id(fId).get_identifier32().get_compact();
381 if (!std::binary_search(m_vFinalPreselection.begin(), m_vFinalPreselection.end(),ftId)) {
382 ATH_MSG_DEBUG("Feedthrough with id 0x" << std::hex << ftId << std::dec <<" not in preselection. Ignored.");
383 continue;
384 }
385 }
386 const int NthisFebChannel=m_onlineHelper->channelInSlotMax(fId);
387 while (BlStruct->getNextRawData(fcNb,samples,gain))
388 {if (fcNb>=NthisFebChannel)
389 continue;
390 if (samples.size()==0) continue; // Ignore missing cells
391 HWIdentifier cId = m_onlineHelper->channel_Id(fId,fcNb);
392 ispulsed=BlStruct->getPulsed(fcNb);
393
394 calogain=(CaloGain::CaloGain)gain;
395 dg = new LArCalibDigit(cId, calogain, samples, dac, delay, ispulsed);
396 samples.clear();
397 coll.push_back(dg);
398 }
399 }
400 while (BlStruct->nextFEB()); //Get NextFeb
401 }
402 else {//Not a calibration data block, try to get from database
403 ATH_MSG_VERBOSE("Not LArCalibDigit data block found. Building it using DB values");
404 //1st step, get Calib board config object
405 const LArCalibParams* calibParams = nullptr;
406 StatusCode sc=detStore()->retrieve(calibParams);
407 if (sc.isFailure())
408 {msg(MSG::ERROR) << "Cannot load LArCalibParams from DetStore!" << endmsg;
409 return;
410 }
411 //2st step, get Event number
412 SG::ReadHandle<xAOD::EventInfo> evt(m_evt);
413 if (!evt.isValid()) {
414 ATH_MSG_ERROR("Cannot get EventInfo");
415 return; //Return empty container.
416 }
417 const unsigned eventNb=evt->eventNumber();
418 const std::vector<HWIdentifier>* calibChannelIDs;
419 do { //Loop over all FEBs in this ROD
420
421 // IWS 24.01.2006 protection against NULL events (null pointer to rawdata block)
422 if (!BlStruct->hasRawDataBlock()) {
423 ATH_MSG_DEBUG("No Raw Data for this FEB - NULL event for FEBID 0x" << std::hex << BlStruct->getFEBID() << std::dec);
424 continue;
425 }
426 HWIdentifier fId(Identifier32(BlStruct->getFEBID()));
427 unsigned int fId32 = fId.get_identifier32().get_compact();
428 // RL 20.09.2006 protection against 0 FebId
429 if (!fId32) {
430 ATH_MSG_DEBUG("Bad FebID=0x" << std::hex << BlStruct->getFEBID() << " found for this FEB, skipping it!" << std::dec);
431 continue;
432 }
433 if(m_febExchange) {
434 if (fId32 == m_febId1) {
435 fId = HWIdentifier(Identifier32(m_febId2));
436 fId32 = fId.get_identifier32().get_compact();
437 }
438 else if(fId32 == m_febId2) {
439 fId = HWIdentifier(Identifier32(m_febId1));
440 fId32 = fId.get_identifier32().get_compact();
441 }
442 }
443 fcNb=0;
444 HWIdentifier cId;
445 do { //Search for the first connected channel of this FEB (probably the first one...)
446 fcNb++;
447 cId = m_onlineHelper->channel_Id(fId,fcNb);
448 calibChannelIDs=&calibLineMapping.calibSlotLine(cId);
449 }
450 while ( (!onOffIdMapping.isOnlineConnected(cId) || calibChannelIDs->size()==0) && fcNb<128); // This is the right conditions to exit the loop!
451
452 if ( calibChannelIDs->size()==0 ) {
453 msg(MSG::ERROR) << "Cannot get calibration Channel ID for FEB " << std::hex << fId32 << std::dec << endmsg;
454 return;
455 }
456
459
460 std::vector<HWIdentifier>::const_iterator csl_it=calibChannelIDs->begin();
461 //Derive DAC and Delay value from this channel
462 dac=calibParams->DAC(eventNb,*csl_it);
463 delay=calibParams->Delay(eventNb,*csl_it);
464
465 //Now start looping over channels in FEB
466 const int NthisFebChannel=m_onlineHelper->channelInSlotMax(fId);
467
468 fcNb=0;
469 while (BlStruct->getNextRawData(fcNb,samples,gain))
470 {
471 if (fcNb>=NthisFebChannel) continue;
472 if (samples.size()==0) continue; // Ignore missing cells
473 cId = m_onlineHelper->channel_Id(fId,fcNb);
474 calibChannelIDs=&calibLineMapping.calibSlotLine(cId);
475 //For the time being, I assume we are in H8 and have only one calib channel per FEB channel
476
477 if (calibChannelIDs->size()!=0) {
478 csl_it=calibChannelIDs->begin();
479 ispulsed=calibParams->isPulsed(eventNb,*csl_it);
480
481 } else ispulsed=0;
482 calogain=(CaloGain::CaloGain)gain;
483 dg = new LArCalibDigit(cId, calogain, samples, dac, delay, ispulsed);
484 samples.clear();
485
486 coll.push_back(dg);
487 }
488 }
489 while (BlStruct->nextFEB()); //Get NextFeb
490 }
492}
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_VERBOSE(x,...)
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
void setDelayScale(const double scale)
set delay scale
unsigned Delay(const unsigned event, const HWIdentifier calibLineID) const
bool isPulsed(const unsigned event, const HWIdentifier calibLineID) const
unsigned DAC(const unsigned event, const HWIdentifier calibLineID) const
bool isOnlineConnected(const HWIdentifier &sid) const
Test whether a HWIdentifier is connected of not (inline) .
virtual uint32_t hasRawDataBlock() const
virtual bool canSetCalibration()
virtual int getNextRawData(int &channelNumber, std::vector< short > &samples, uint32_t &gain)
SG::ReadHandleKey< xAOD::EventInfo > m_evt
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ fillCollection() [4/6]

void LArRodDecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
LArDigitContainer & coll,
const CaloGain::CaloGain gain ) const

Definition at line 125 of file LArRodDecoder.cxx.

127{ // Digit pointer
128 LArDigit * dg=0 ;
129 CaloGain::CaloGain calogain;
131 int fcNb;
132 std::vector<short> samples;
133 LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
134 if (!BlStruct) return;
135
136 do {
137 HWIdentifier fId( Identifier32(BlStruct->getFEBID()) );
138 unsigned int fId32 = fId.get_identifier32().get_compact();
139 if (!m_onlineHelper->isValidId(fId)) {
140 ATH_MSG_WARNING("Invalid FEB identifer 0x" << std::hex << fId32 << std::dec << ". Skipping");
141 continue;
142 }
143 if(m_febExchange) {
144 if (fId32 == m_febId1) {
145 fId = HWIdentifier(Identifier32(m_febId2));
146 fId32 = fId.get_identifier32().get_compact();
147 }
148 else if(fId32 == m_febId2) {
149 fId = HWIdentifier(Identifier32(m_febId1));
150 fId32 = fId.get_identifier32().get_compact();
151 }
152 }
153
154 // IWS 24.01.2006 protection against NULL events (null pointer to rawdata block)
155 if (!BlStruct->hasRawDataBlock())
156 {
157 ATH_MSG_DEBUG("No Raw Data for this FEB - NULL event for FEBID 0x"<< std::hex << BlStruct->getFEBID() << std::dec);
158 continue;
159 }
160
161 // RL 04.17.2008 skip check for some FEBs
162 int do_check=1;
163 std::vector<unsigned int>::const_iterator it_feb = m_IgnoreCheckFEBs.begin();
164 std::vector<unsigned int>::const_iterator it_feb_end = m_IgnoreCheckFEBs.end();
165 for(; it_feb!=it_feb_end;++it_feb)
166 if(fId==*it_feb) {
167 do_check=0;
168 break;
169 }
170 if(do_check) {
171 //WL 31.10.2007 //check RodStatus-word to catch corrupt events
172 if (BlStruct->getStatus() & m_StatusNMask) {
173 ATH_MSG_WARNING("RodStatus&0x" << std::hex << m_StatusNMask << " indicates corrupt data for FEB "<< std::hex << fId32 << std::dec <<". Ignored.");
174 continue;
175 }
176 }
177 // RL 05.11.2007 checksum
178 if(m_CheckSum) {
179 const uint32_t onsum = BlStruct->onlineCheckSum();
180 const uint32_t offsum = BlStruct->offlineCheckSum();
181 if(onsum!=offsum) {
182 ATH_MSG_WARNING("Checksum error for FEB: " << MSG::hex << fId32);
183 ATH_MSG_WARNING(" online checksum = " << MSG::hex << onsum);
184 ATH_MSG_WARNING(" offline checksum = " << MSG::hex << offsum << MSG::dec);
185 continue;
186 }
187 }
188
189 if (m_vFinalPreselection.size()) {
190 const unsigned int ftId=m_onlineHelper->feedthrough_Id(fId).get_identifier32().get_compact();
191 if (!std::binary_search(m_vFinalPreselection.begin(), m_vFinalPreselection.end(),ftId)) {
192 ATH_MSG_DEBUG("Feedthrough with id 0x" << MSG::hex << ftId << MSG::dec <<" not in preselection. Ignored.");
193 continue;
194 }
195 }
196 const int NthisFebChannel=m_onlineHelper->channelInSlotMax(fId);
197 while (BlStruct->getNextRawData(fcNb,samples,gain))
198 {
199 if (fcNb>=NthisFebChannel)
200 continue;
201 if (samples.size()==0) continue; // Ignore missing cells
202 HWIdentifier cId = m_onlineHelper->channel_Id(fId,fcNb);
203 calogain=(CaloGain::CaloGain)gain;
204 dg = new LArDigit(cId, calogain, std::move(samples));
205 samples.clear();
206 coll.push_back(dg);
207 }
208 }
209 while (BlStruct->nextFEB()); //Get NextFeb
210}

◆ fillCollection() [5/6]

void LArRodDecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
LArFebHeaderContainer & coll,
const CaloGain::CaloGain RequestedGain ) const

Definition at line 704 of file LArRodDecoder.cxx.

706{
707 LArFebHeader* larFebHeader;
708 HWIdentifier FEBID;
709
710 LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
711 if (!BlStruct) return;
712
713 do{
714 //Read first FEB. The header of this feb is combined with the ROD-Header
715
716 FEBID=HWIdentifier(Identifier32(BlStruct->getFEBID()));
717 unsigned int FEBID32 = FEBID.get_identifier32().get_compact();
718 if (!m_onlineHelper->isValidId(FEBID)) {
719 ATH_MSG_WARNING("Invalid FEB identifer " << std:: hex << FEBID32 << std::dec << ". Skipping");
720 continue;
721 }
722
723 if(m_febExchange) {
724 if (FEBID32 == m_febId1) {
725 FEBID = HWIdentifier(Identifier32(m_febId2));
726 FEBID32 = FEBID.get_identifier32().get_compact();
727 }
728 else if(FEBID32 == m_febId2) {
729 FEBID = HWIdentifier(Identifier32(m_febId1));
730 FEBID32 = FEBID.get_identifier32().get_compact();
731 }
732 }
733
734 if (m_vFinalPreselection.size()) {
735 const unsigned int ftId=m_onlineHelper->feedthrough_Id(FEBID).get_identifier32().get_compact();
736 if (!std::binary_search(m_vFinalPreselection.begin(), m_vFinalPreselection.end(),ftId)) {
737 ATH_MSG_DEBUG("Feedthrough with id 0x" << std::hex << ftId << std::dec <<" not in preselection. Ignored.");
738 continue;
739 }
740 }
741
742
743
744 larFebHeader=new LArFebHeader(FEBID);
745 //setROD header data
746
747 larFebHeader->SetFormatVersion(robFrag.rod_version());
748 larFebHeader->SetSourceId(robFrag.rod_source_id());
749 larFebHeader->SetRunNumber(robFrag.rod_run_no());
750 larFebHeader->SetELVL1Id(robFrag.rod_lvl1_id());
751 larFebHeader->SetBCId(robFrag.rod_bc_id());
752 larFebHeader->SetLVL1TigType(robFrag.rod_lvl1_trigger_type());
753 larFebHeader->SetDetEventType(robFrag.rod_detev_type());
754
755 //set DSP data
756 const unsigned nsample=BlStruct->getNumberOfSamples();
757 const uint32_t status= BlStruct->getStatus();
758 larFebHeader->SetDspCodeVersion(BlStruct->getDspCodeVersion());
759 larFebHeader->SetDspEventCounter(BlStruct->getDspEventCounter());
760 larFebHeader->SetRodResults1Size(BlStruct->getResults1Size());
761 larFebHeader->SetRodResults2Size(BlStruct->getResults2Size());
762 larFebHeader->SetRodRawDataSize(BlStruct->getRawDataSize());
763 larFebHeader->SetNbSweetCells1(BlStruct->getNbSweetCells1());
764 larFebHeader->SetNbSweetCells2(BlStruct->getNbSweetCells2());
765 larFebHeader->SetNbSamples(nsample);
766 larFebHeader->SetOnlineChecksum(BlStruct->onlineCheckSum());
767 larFebHeader->SetOfflineChecksum(BlStruct->offlineCheckSum());
768
769 if(!BlStruct->hasControlWords()) {
770 larFebHeader->SetFebELVL1Id(robFrag.rod_lvl1_id());
771 larFebHeader->SetFebBCId(robFrag.rod_bc_id());
772 } else {
773 const uint16_t evtid = BlStruct->getCtrl1(0) & 0x1f;
774 const uint16_t bcid = BlStruct->getCtrl2(0) & 0x1fff;
775
776 larFebHeader->SetFebELVL1Id(evtid);
777 larFebHeader->SetFebBCId(bcid);
778 for(int iadc=0;iadc<16;iadc++) {
779 larFebHeader->SetFebCtrl1(BlStruct->getCtrl1(iadc));
780 larFebHeader->SetFebCtrl2(BlStruct->getCtrl2(iadc));
781 larFebHeader->SetFebCtrl3(BlStruct->getCtrl3(iadc));
782 }
783 for(unsigned int i = 0; i<nsample; i++ ) {
784 larFebHeader->SetFebSCA(BlStruct->getRadd(0,i) & 0xff);
785 }
786 }
787 larFebHeader->SetRodStatus(status);
788 coll.push_back(larFebHeader);
789
790 } while (BlStruct->nextFEB()); //Get NextFeb
791}
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
void SetRodResults1Size(const uint16_t size)
set the ROD block sizes
void SetOnlineChecksum(const uint32_t checksum)
void SetNbSweetCells2(const uint16_t n)
void SetRodStatus(const uint32_t status)
set the ROD Status
void SetFebBCId(const uint16_t bcid)
set the FEB Bunch Crossing ID
void SetFebCtrl2(const uint16_t ctrl2)
set the FEB Control Word #2
void SetFormatVersion(const uint32_t formatVersion)
set the format version
void SetOfflineChecksum(const uint32_t checksum)
void SetFebSCA(const uint16_t sca)
set the SCA's
void SetDetEventType(const uint32_t detEvType)
set the Detector event type ID
void SetDspEventCounter(const uint32_t eventCounter)
set the Event number counted by the DSP code
void SetLVL1TigType(const uint32_t lvl1ttype)
set the Level1 trigger type ID
void SetRodRawDataSize(const uint16_t size)
void SetFebCtrl3(const uint16_t ctrl3)
set the FEB Control Word #3
void SetFebCtrl1(const uint16_t ctrl1)
set the FEB Control Word #1
void SetBCId(const uint16_t bcid)
set the Bunch Crossing ID
void SetFebELVL1Id(const uint16_t elvl1Id)
set the FEB Event ID
void SetRunNumber(const uint32_t runNumber)
set the run number
void SetSourceId(const uint32_t sourceID)
set the source Id
void SetRodResults2Size(const uint16_t size)
void SetDspCodeVersion(const uint32_t codeVersion)
set the version of the DSP code
void SetNbSweetCells1(const uint16_t n)
set the number of samples and cells above thresholds
void SetNbSamples(const uint16_t n)
void SetELVL1Id(const uint16_t elvl1Id)
set the EventID
virtual uint16_t getCtrl1(uint32_t adc) const
virtual uint16_t getCtrl3(uint32_t adc) const
virtual uint16_t getResults1Size() const
virtual uint16_t getRawDataSize() const
virtual uint32_t getDspCodeVersion() const
virtual uint16_t getCtrl2(uint32_t adc) const
virtual uint32_t getRadd(uint32_t adc, uint32_t sample) const
virtual uint16_t getNbSweetCells2() const
virtual uint32_t getNumberOfSamples() const
virtual uint32_t hasControlWords() const
virtual uint16_t getResults2Size() const
virtual uint16_t getNbSweetCells1() const
virtual int32_t getDspEventCounter() const
status
Definition merge.py:16
setEventNumber setTimeStamp bcid

◆ fillCollection() [6/6]

void LArRodDecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
LArRawChannelContainer & coll,
const CaloGain::CaloGain gain ) const

Definition at line 215 of file LArRodDecoder.cxx.

217{
218 int32_t energy;
219 int32_t time;
220 int32_t quality;
222 int fcNb;
223 HWIdentifier cId;
224 LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
225 if (!BlStruct) return;
226
227 do {
228 HWIdentifier fId( Identifier32(BlStruct->getFEBID()) );
229 unsigned int fId32 = fId.get_identifier32().get_compact();
230 if (!m_onlineHelper->isValidId(fId)) {
231 ATH_MSG_WARNING("Invalid FEB identifer " << std::hex << fId32 << std::dec << ". Skipping");
232 continue;
233 }
234
235 if(m_febExchange) {
236 if (fId32 == m_febId1) {
237 fId = HWIdentifier(Identifier32(m_febId2));
238 fId32 = fId.get_identifier32().get_compact();
239 }
240 else if(fId32 == m_febId2) {
241 fId = HWIdentifier(Identifier32(m_febId1));
242 fId32 = fId.get_identifier32().get_compact();
243 }
244 }
245 if (!BlStruct->hasPhysicsBlock()) {
246 ATH_MSG_DEBUG("No Physics Data for this FEB - NULL event for FEBID 0x" << std::hex << BlStruct->getFEBID() << std::dec);
247 continue;
248 }
249
250 // RL 04.17.2008 skip check for some FEBs
251 int do_check=1;
252 std::vector<unsigned int>::const_iterator it_feb = m_IgnoreCheckFEBs.begin();
253 std::vector<unsigned int>::const_iterator it_feb_end = m_IgnoreCheckFEBs.end();
254 for(; it_feb!=it_feb_end;++it_feb)
255 if(fId==*it_feb) {
256 do_check=0;
257 break;
258 }
259 if(do_check) {
260 //WL 31.10.2007 //check RodStatus-word to catch corrupt events
261 if (BlStruct->getStatus() & m_StatusNMask) {
262 ATH_MSG_WARNING("RodStatus&0x" << std::hex << m_StatusNMask << " indicates corrupt data for FEB "<< std::hex << fId32 << std::dec <<". Ignored.");
263 continue;
264 }
265 }
266
267 // RL 05.11.2007 checksum
268 if(m_CheckSum) {
269 const uint32_t onsum = BlStruct->onlineCheckSum();
270 const uint32_t offsum = BlStruct->offlineCheckSum();
271 if(onsum!=offsum) {
272 ATH_MSG_WARNING("Checksum error:");
273 ATH_MSG_WARNING(" online checksum = " << MSG::hex << onsum);
274 ATH_MSG_WARNING(" offline checksum = " << MSG::hex << offsum);
275 continue;
276 }
277 }
278
279 if (m_vFTPreselection.size()) {
280 int ftId=m_onlineHelper->feedthrough_Id(fId).get_identifier32().get_compact();
281 if (!std::binary_search(m_vFTPreselection.begin(), m_vFTPreselection.end(),ftId)) {
282 ATH_MSG_DEBUG("Feedthrough with id " << std::hex << ftId << std::dec <<" not in preselection. Ignored.");
283 continue;
284 }
285 }
286 const int NthisFebChannel=m_onlineHelper->channelInSlotMax(fId);
287 while (BlStruct->getNextEnergy(fcNb,energy,time,quality,gain)) {
288 if (fcNb>=NthisFebChannel)
289 continue;
290 cId = m_onlineHelper->channel_Id(fId,fcNb);
291 uint16_t iquality = 0;
292 uint16_t iprovenance = 0x1000;
293 if (quality>0) {
294 iprovenance |= 0x2000;
295 iquality = (quality & 0xFFFF);
296 }
297 LArRawChannel chan(cId, energy, time, iquality, iprovenance, (CaloGain::CaloGain)gain);
298 coll.push_back(chan);
299 }
300 }
301 while (BlStruct->nextFEB()); //Get NextFeb
302}
virtual uint32_t hasPhysicsBlock() const
virtual int getNextEnergy(int &channelNumber, int32_t &energy, int32_t &time, int32_t &quality, uint32_t &gain)
time(flags, cells_name, *args, **kw)

◆ fillCollectionHLT()

uint32_t LArRodDecoder::fillCollectionHLT ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
LArCellCollection & coll,
LArRodBlockStructure *& providedRodBlockStructure,
uint16_t & rodMinorVersion = rMV,
uint32_t & robBlockType = rBT ) const
inline

Definition at line 262 of file LArRodDecoder.h.

266{
267 LArCell *collElem=0; //Pointer to a new element to be added to the collection
268 uint32_t error = 0;
269
270#ifndef NDEBUG
271 ATH_MSG_VERBOSE("Prepare LArRodBlockStructure. Got a fragment of size " << n);
272#endif
273 const uint32_t blocksize=p[0]; //First word contains block size
274 if (blocksize>n) {
275 msg(MSG::ERROR) << "Got truncated ROD Fragment!" << endmsg;
276 // First Bit is truncated (see also below)
277 error|= 0x1;
278 return error;
279 }
280
281 //Get version and blocktype form header
282 eformat::helper::Version ver(robFrag.rod_version());
283 const uint16_t rMV_present=ver.minor_version();
284 const uint32_t rBT_present=robFrag.rod_detev_type()&0xff;
285
286 LArRodBlockStructure* BlStruct(nullptr);
287 if ( !providedRodBlockStructure || (rodMinorVersion!=rMV_present) || (robBlockType!=rBT_present) ){
288 BlStruct = prepareBlockStructure1 (rMV_present, rBT_present);
289 if (!BlStruct) {
290 // Second Bit is block empty or unknown
291 error|= 0x2;
292 return error;
293 }
294 providedRodBlockStructure = BlStruct;
295 rodMinorVersion = rMV_present;
296 robBlockType = rBT_present;
297 } else BlStruct = providedRodBlockStructure;
298
299 BlStruct->setFragment(p,n);
300 for(LArCellCollection::iterator ii=coll.begin();ii!=coll.end();++ii)
301 (*ii)->setEnergyFast(0.0);
302
303 int32_t energy(0);
304 int32_t time;
305 int32_t quality;
307 CaloGain::CaloGain calogain;
308 int fcNb;
309 int nfeb;
310 calogain=CaloGain::LARNGAIN;
311 if(!BlStruct->setGain(calogain)){
312 ATH_MSG_DEBUG("Setting the Gain Problem");
313 }
314
315 int feb_number=0;
316 do //Loop over FEB's
317 {
318 HWIdentifier fId(BlStruct->getFEBID());
319 if (!(fId.get_identifier32().get_compact())) {
320#ifndef NDEBUG
321 ATH_MSG_DEBUG("Bad FebID=0x"<< std::hex << BlStruct->getFEBID() << std::dec << " found for this FEB, skipping it!");
322#endif
323 // Third Bit is FEB ID issue (disabled - use 0x20 instead)
324 //error|= 0x4;
325 continue;
326 }
327 // RL 05.11.2007 checksum
328 if(m_CheckSum) {
329 uint32_t onsum = BlStruct->onlineCheckSum();
330 uint32_t offsum = BlStruct->offlineCheckSum();
331 if(onsum!=offsum) {
332 msg(MSG::WARNING) << "Checksum error:" << endmsg;
333 msg(MSG::WARNING) << " online checksum = 0x" << MSG::hex << onsum << endmsg;
334 msg(MSG::WARNING) << " offline checksum = 0x" << MSG::hex << offsum << MSG::dec << endmsg;
335 // Fourth Bit CheckSum issue (maybe disabled!)
336 error|= 0x8;
337 continue;
338 }
339 }
340 feb_number++;
341
342 if ( BlStruct->hasPhysicsBlock() ) {
343 if ( fId == m_febIdHLT ) nfeb = 128; // This is the second feb
344 else nfeb = 0;
345 int NthisFebChannel=128 ; // m_onlineHelper->channelInSlotMax(fId);
346 uint16_t iquality;
347 uint16_t iprovenance;
348 while (BlStruct->getNextEnergy(fcNb,energy,time,quality,gain)) {
349 if (fcNb>=NthisFebChannel) continue;
350 collElem = coll[fcNb+nfeb];
351 iprovenance=0x1000; // data comes from DSP computation
352 iquality=0;
353 if ( quality>=0 ) { iprovenance|= 0x2000; iquality=(quality& 0xffff);}
354 // time converted to ns
355 collElem->set(energy, time*1e-3, iquality, iprovenance, (CaloGain::CaloGain)gain);
356 }
357 continue;
358 }
359 }
360 while (BlStruct->nextFEB()); //Get NextFeb
361 // Error meaning data corruption. Maybe in any FEB
362 if ( BlStruct->report_error() ) error |= 0x1;
363 // error of uncompatible number of cells is bit 5
364 unsigned int collection_size = coll.size();
365 if ( feb_number== 0 && collection_size>0 ) error |= 0x20;
366 if ( feb_number== 1 && collection_size !=128 ) error |= 0x20;
367 if ( feb_number== 2 && collection_size !=256 ) error |= 0x20;
368 return error;
369}
void set(const CaloDetDescrElement *caloDDE, const Identifier &ID)
Fast method to change the identity of a cell.
Definition CaloCell.h:511
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:865
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.
bool setFragment(const uint32_t *p, uint32_t n)
unsigned int m_febIdHLT
LArRodBlockStructure * prepareBlockStructure1(const uint16_t rodMinorVersion, const uint32_t robBlockType) const
@ LARNGAIN
Definition CaloGain.h:19

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ interfaceID()

const InterfaceID & LArRodDecoder::interfaceID ( )
static

Definition at line 57 of file LArRodDecoder.cxx.

58{ return IID_ILArRodDecoder; }
static const InterfaceID IID_ILArRodDecoder("LArRodDecoder", 1, 0)

◆ makeBlockStructure()

std::unique_ptr< LArRodBlockStructure > LArRodDecoder::makeBlockStructure ( unsigned int rodBlockType,
unsigned int rodMinorVersion ) const
private

Definition at line 870 of file LArRodDecoder.cxx.

872{
873 switch (rodBlockType) {
874 case 2:
875 break;
876
877 case 3:
878 // RodBlockType 3 = Test mode
879 //return std::make_unique<LArRodBlockTransparentV0<LArRodBlockHeaderTransparentV0> >(this->msgSvc().get());
880 break;
881
882 case 4:
883 // RodBlockType 4 = Physics mode
884 switch (rodMinorVersion) {
885 case 10: // Physics mode v5 16.06.2008 for LHC
886 case 11: // Physics mode v5 16.06.2008 for LHC
887 {
888 auto bl = std::make_unique<LArRodBlockPhysicsV5>(this->msgSvc().get());
890 bl->setRequiredNSamples(m_requiredPhysicsNSamples);
891 }
892 return bl;
893 }
894 case 12: // Physics mode v5 09.03.2011 for LHC
895 {
896 auto bl = std::make_unique<LArRodBlockPhysicsV6>(this->msgSvc().get());
898 bl->setRequiredNSamples(m_requiredPhysicsNSamples);
899 }
900 return bl;
901 }
902 default:
903 break;
904 }
905 break;
906
907 case 5:
908 // RodBlockType 5 = Physics simulation mode
909 // Physics mode v3 11.04.2005 for simulation
910 //return std::make_unique<LArRodBlockPhysicsV3>(this->msgSvc().get());
911 break;
912
913 case 6:
914 // RodBlockType 6 = Physics test mode
915 break;
916
917 case 7:
918 // RodBlockType 7 = Calibration mode
919 break;
920
921 case 10:
922 // RodBlockType 10 = Accumulated mode (used for pre-processed pedestal runs)
923 // Accumulated mode v3 10.06.2008
924 //return std::make_unique<LArRodBlockAccumulatedV3>(this->msgSvc().get());
925 break;
926
927 default:
928 break;
929 }
930
931 return std::unique_ptr<LArRodBlockStructure>();
932}
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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.

◆ prepareBlockStructure()

LArRodBlockStructure * LArRodDecoder::prepareBlockStructure ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const uint32_t * p,
uint32_t n,
const CaloGain::CaloGain RequestedGain ) const
private

Definition at line 829 of file LArRodDecoder.cxx.

831{
832#ifndef NDEBUG
833 ATH_MSG_DEBUG("Prepare LArRodBlockStructure. Got a fragement of size " << n);
834#endif
835
836 //Get version and blocktype form header
837 eformat::helper::Version ver(robFrag.rod_version());
838 const uint16_t rodMinorVersion=ver.minor_version();
839 const uint32_t rodBlockType=robFrag.rod_detev_type()&0xff;
840 LArRodBlockStructure* BlStruct = prepareBlockStructure1 (rodMinorVersion, rodBlockType);
841 if (!BlStruct) {
842 return nullptr;
843 }
844
845 if (!BlStruct->setFragment(p,n)) {
846 constexpr int maxMess = 100;
847 static std::atomic<int> nMess = 1;
848 int thismess = nMess++;
849 if (thismess <= maxMess) {
850 ATH_MSG_ERROR("Could not set fragment (wrong number of samples in data ?) - container will not be filled");
851 if (thismess == maxMess)
852 ATH_MSG_ERROR("This message will not be repeated");
853 }
854 return NULL;
855 }
856#ifndef NDEBUG
857 ATH_MSG_VERBOSE("Set Fragment at address "<< &(p[0]) << " " << p[5]);
858#endif
859
860 BlStruct->setGain(RequestedGain); //Will be ignored if BlockStructure does not support fixed gains.
861 //FIXME: Very ugly hack! See explanation in LArRodDecoder.h
862 if (m_firstSample) {
863 BlStruct->setFirstSample(m_firstSample);
864 }
865 return BlStruct;
866}
virtual int setGain(const int GainValue)
void setFirstSample(const int rearrangeFirstSample)

◆ prepareBlockStructure1()

LArRodBlockStructure * LArRodDecoder::prepareBlockStructure1 ( const uint16_t rodMinorVersion,
const uint32_t robBlockType ) const
private

Definition at line 795 of file LArRodDecoder.cxx.

796{
797 const unsigned MAXMINOR = 12;
798 const unsigned MAXTYPE = 10;
799
800 if (rodMinorVersion > MAXMINOR || robBlockType > MAXTYPE) {
801 ATH_MSG_ERROR("Bad Rod block type " << robBlockType
802 << " / " << rodMinorVersion);
803 return nullptr;
804 }
805 std::vector<std::unique_ptr<LArRodBlockStructure> >& blstructs =
806 *m_blstructs.get();
807 unsigned int index = robBlockType * (MAXMINOR+1) + rodMinorVersion;
808 if (blstructs.empty()) {
809 blstructs.resize ((MAXMINOR+1)*(MAXTYPE+1));
810 }
811 if (!blstructs[index]) {
812 blstructs[index] = makeBlockStructure (robBlockType, rodMinorVersion);
813 }
814 if (!blstructs[index]) {
815 ATH_MSG_ERROR("Bad Rod block type " << robBlockType
816 << " / " << rodMinorVersion);
817 return nullptr;
818 }
819
820#ifndef NDEBUG
821 ATH_MSG_DEBUG("Found version " << rodMinorVersion << " of Rod block type " << robBlockType);
822#endif
823
824 return blstructs[index].get();
825}
std::unique_ptr< LArRodBlockStructure > makeBlockStructure(unsigned int rodBlockType, unsigned int rodMinorVersion) const
str index
Definition DeMoScan.py:362

◆ 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< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setCellEnergy()

void LArRodDecoder::setCellEnergy ( LArCell * element,
int energy,
int time,
int quality,
CaloGain::CaloGain gain ) const
inlineprivate

Definition at line 371 of file LArRodDecoder.h.

374{
375 // Set energy, time, quality and hardware gain
376 element->set((float)energy, (float)time, (double)quality, gain);
377}

◆ setsecfeb()

void LArRodDecoder::setsecfeb ( HWIdentifier feb)
inline

Definition at line 145 of file LArRodDecoder.h.

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ writeFebInfo()

void LArRodDecoder::writeFebInfo ( LArCellCollection & m_coll,
LArFebEnergy & febene ) const
inlineprivate

Definition at line 379 of file LArRodDecoder.h.

381 {
382 coll.addfebenergy(febene);
383 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

SG::SlotSpecificObj<std::vector<std::unique_ptr<LArRodBlockStructure> > > m_blstructs LArRodDecoder::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 236 of file LArRodDecoder.h.

◆ m_CheckSum

bool LArRodDecoder::m_CheckSum
private

Definition at line 239 of file LArRodDecoder.h.

◆ m_delayScale

double LArRodDecoder::m_delayScale
private

Definition at line 234 of file LArRodDecoder.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_evt

SG::ReadHandleKey<xAOD::EventInfo> LArRodDecoder::m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}
private

Definition at line 210 of file LArRodDecoder.h.

210{this, "EvtInfo", "EventInfo", "EventInfo name"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_febExchange

bool LArRodDecoder::m_febExchange
private

Definition at line 213 of file LArRodDecoder.h.

◆ m_febId1

unsigned int LArRodDecoder::m_febId1
private

Definition at line 214 of file LArRodDecoder.h.

◆ m_febId2

unsigned int LArRodDecoder::m_febId2
private

Definition at line 214 of file LArRodDecoder.h.

◆ m_febIdHLT

unsigned int LArRodDecoder::m_febIdHLT = 0U
private

Definition at line 214 of file LArRodDecoder.h.

◆ m_firstSample

int LArRodDecoder::m_firstSample
private

Definition at line 216 of file LArRodDecoder.h.

◆ m_IgnoreCheckFEBs

std::vector<unsigned int> LArRodDecoder::m_IgnoreCheckFEBs
private

Definition at line 231 of file LArRodDecoder.h.

◆ m_LArCellCorrNames

std::vector<std::string> LArRodDecoder::m_LArCellCorrNames
private

Definition at line 230 of file LArRodDecoder.h.

◆ m_LArCellCorrTools

std::vector<const CaloCellCorrection*> LArRodDecoder::m_LArCellCorrTools
private

Definition at line 232 of file LArRodDecoder.h.

◆ m_LArCellEthreshold

float LArRodDecoder::m_LArCellEthreshold
private

Definition at line 211 of file LArRodDecoder.h.

◆ m_MultiDSPMode

bool LArRodDecoder::m_MultiDSPMode
private

Definition at line 238 of file LArRodDecoder.h.

◆ m_onlineHelper

const LArOnlineID* LArRodDecoder::m_onlineHelper
private

Definition at line 229 of file LArRodDecoder.h.

◆ m_readtdc

bool LArRodDecoder::m_readtdc
private

Definition at line 212 of file LArRodDecoder.h.

◆ m_requiredPhysicsNSamples

unsigned short LArRodDecoder::m_requiredPhysicsNSamples
private

Definition at line 240 of file LArRodDecoder.h.

◆ m_StatusMask

uint32_t LArRodDecoder::m_StatusMask
private

Definition at line 228 of file LArRodDecoder.h.

◆ m_StatusNMask

uint32_t LArRodDecoder::m_StatusNMask = 0U
private

Definition at line 228 of file LArRodDecoder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vBEPreselection

std::vector<int> LArRodDecoder::m_vBEPreselection
private

Definition at line 225 of file LArRodDecoder.h.

◆ m_vFinalPreselection

std::vector<unsigned int> LArRodDecoder::m_vFinalPreselection
private

Definition at line 227 of file LArRodDecoder.h.

◆ m_vFTPreselection

std::vector<int> LArRodDecoder::m_vFTPreselection
private

Definition at line 224 of file LArRodDecoder.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.

◆ m_vPosNegPreselection

std::vector<int> LArRodDecoder::m_vPosNegPreselection
private

Definition at line 226 of file LArRodDecoder.h.


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