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

Decodes the different TileCal ROD subfragment types in bytestream data and fills TileDigitsContainer, TileRawChannelContainer or TileL2Container. More...

#include <TileROD_Decoder.h>

Inheritance diagram for TileROD_Decoder:

Classes

struct  D0CellsHLT

Public Types

enum  TileFragStatus {
  ALL_OK =0 , CRC_ERR =1 , ALL_FF =0x10 , ALL_00 =0x20 ,
  NO_FRAG =0x40 , NO_ROB =0x80
}
typedef eformat::ROBFragment< const uint32_t * > ROBData
 convert ROD Data words into either TileCell or TileRawChannel.

Public Member Functions

 TileROD_Decoder (const std::string &type, const std::string &name, const IInterface *parent)
 constructor
virtual ~TileROD_Decoder ()
 destructor
virtual StatusCode initialize ()
virtual StatusCode finalize ()
template<class COLLECTION>
void fillCollection (const ROBData *rob, COLLECTION &v, typename TileROD_Helper::ContainerForCollection< COLLECTION >::type *container=nullptr) const
 This method calls the unpacking methods to decode the ROD data and fills the TileDigitsContainer and/or the TileRawChannelContainer.
uint32_t fillCollectionHLT (const ROBData *rob, TileCellCollection &v, D0CellsHLT &d0cells, TileCellCollection *MBTS, const TileHid2RESrcID *hid2reHLT) const
void fillCollectionL2 (const ROBData *rob, TileL2Container &v) const
void fillCollectionL2ROS (const ROBData *rob, TileL2Container &v) const
void fillTileLaserObj (const ROBData *rob, TileLaserObject &v) const
void fillCollection_TileMuRcv_RawChannel (const ROBData *rob, TileRawChannelCollection &v) const
void fillCollection_TileMuRcv_Digi (const ROBData *rob, TileDigitsCollection &v) const
void fillContainer_TileMuRcv_Decision (const ROBData *rob, TileMuonReceiverContainer &v) const
void fillCollection_FELIX_Digi (const ROBData *rob, TileDigitsCollection &v) const
void setLaserVersion (TileLaserObject &laserObject) const
void loadRw2Cell (const int section, const std::vector< int > &vec)
void loadMBTS (std::map< unsigned int, unsigned int > &mapMBTS, int MBTS_channel)
const TileHWIDgetTileHWID () const
const TileFragHashhashFunc () const
StatusCode convert (const RawEvent *re, TileL2Container *L2Cnt) const
StatusCode convertLaser (const RawEvent *re, TileLaserObject *TileLaserObj) const
StatusCode convertTMDBDecision (const RawEvent *re, TileMuonReceiverContainer *tileMuRcv) const
void mergeD0cellsHLT (const D0CellsHLT &d0cells, TileCellCollection &) const
void loadRw2Pmt (const int section, const std::vector< int > &vec)
void printErrorCounter (bool printIfNoError)
int getErrorCounter ()
void printWarningCounter (bool printIfNoWarning)
int getWarningCounter ()
const TileHid2RESrcIDgetHid2reHLT ()
const TileHid2RESrcIDgetHid2re ()
void setUseFrag0 (bool f)
void setUseFrag1 (bool f)
void setUseFrag4 (bool f)
void setUseFrag5Raw (bool f)
void setUseFrag5Reco (bool f)
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 ()
 AlgTool 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 std::vector< TileCell * > pCellVec
typedef std::vector< TileDigits * > pDigiVec
typedef std::vector< TileBeamElem * > pBeamVec
typedef std::vector< TileRawChannel * > pRwChVec
typedef std::vector< TileFastRawChannelFRwChVec
typedef std::vector< std::vector< uint32_t > > DigitsMetaData_t
typedef std::vector< std::vector< uint32_t > > RawChannelMetaData_t
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

const uint32_t * getOFW (int fragId, int unit) const
 getOFW returns Optimal Filtering Weights for Frag5 decoder loaded from COOL for correspondent units.
void unpack_frag0 (uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
 unpack_frag0 decodes tile subfragment type 0x0.
void unpack_frag1 (uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
 unpack_frag1 decodes tile subfragment type 0x1.
void unpack_frag2 (uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag2 decodes tile subfragment type 0x2.
void unpack_frag3 (uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag3 decodes tile subfragment type 0x3.
void unpack_frag4 (uint32_t version, uint32_t sizeOverhead, unsigned int unit, RawChannelMetaData_t &rawchannelMetaData, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag4 decodes tile subfragment type 0x4.
void unpack_frag5 (uint32_t version, uint32_t sizeOverhead, unsigned int unit, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, pRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag5 decodes tile subfragment type 0x4.
void unpack_frag6 (uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
 unpack_frag6 decodes tile subfragment type 0x6.
void unpack_frag3HLT (uint32_t version, uint32_t sizeOverhead, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag3HLT decodes tile subfragment type 0x3 for the high level trigger (HLT).
void unpack_frag2HLT (uint32_t version, uint32_t sizeOverhead, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag2HLT decodes tile subfragment type 0x2 for the high level trigger (HLT).
void unpack_frag4HLT (uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag4HLT decodes tile subfragment type 0x4 for the high level trigger (HLT).
void unpack_frag5HLT (uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
 unpack_frag5HLT decodes tile subfragment type 0x5 for the high level trigger (HLT).
void unpack_fragA (uint32_t version, RawChannelMetaData_t &rawchannelMetaData, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
 unpack_fragA decodes tile subfragment type 0XA.
void unpack_fragAHLT (uint32_t version, const uint32_t *p, uint16_t rob_bcid, uint16_t &mask, int fragID, int demoType) const
 unpack_fragAHLT decodes tile subfragment type 0XA.
void unpack_frag10 (uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag10 decodes tile subfragment type 0x10.
void unpack_frag11 (uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag11 decodes tile subfragment type 0x11.
void unpack_frag12 (uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag12 decodes tile subfragment type 0x12.
void unpack_frag13 (uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag13 decodes tile subfragment type 0x13.
void unpack_frag14 (uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag14 decodes tile subfragment type 0x14.
void unpack_frag15 (uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag15 decodes tile subfragment type 0x15.
bool unpack_frag4L2 (uint32_t version, uint32_t sizeOverhead, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag4L2 decodes tile subfragment type 0x4 and extract transverse energy from this fragment
bool unpack_frag5L2 (uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
 unpack_frag5L2 decodes tile subfragment type 0x5 and extract transverse energy from this fragment
void unpack_frag16 (uint32_t version, const uint32_t *p, TileLaserObject &v) const
 unpack_frag16 decodes tile subfragment type 0x16 or 0x20.
void unpack_frag17 (uint32_t version, uint32_t sizeOverhead, const uint32_t *p, TileLaserObject &v) const
 unpack_frag17 decodes tile subfragment type 0x17 or 0x20.
void unpack_brod (uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pBeamVec &pBeam, int fragID) const
 unpack_brod decodes all ancillary tile subfragments coming from beam ROD at the testbeam or LASTROD in normal ATLAS configuration
void unpack_frag40 (uint32_t collid, uint32_t version, const uint32_t *p, int size, TileDigitsCollection &coll) const
 unpacking methods dedicated to the TMDB ROD format sub-fragments 0x40 0x41 0x42
void unpack_frag41 (uint32_t collid, uint32_t version, const uint32_t *p, int size, TileRawChannelCollection &coll) const
void unpack_frag42 (uint32_t sourceid, uint32_t version, const uint32_t *p, int size, TileMuonReceiverContainer &v) const
void make_copy (uint32_t bsflags, TileFragHash::TYPE rChType, TileRawChannelUnit::UNIT rChUnit, DigitsMetaData_t &digitsMetaData, RawChannelMetaData_t &rawchannelMetaData, const ROBData *rob, pDigiVec &pDigits, pRwChVec &pChannel, TileBeamElemCollection &v, TileBeamElemContainer *container) const
void make_copy (uint32_t bsflags, TileFragHash::TYPE rChType, TileRawChannelUnit::UNIT rChUnit, DigitsMetaData_t &digitsMetaData, RawChannelMetaData_t &rawchannelMetaData, const ROBData *rob, pDigiVec &pDigits, pRwChVec &pChannel, TileDigitsCollection &v, TileDigitsContainer *container) const
void make_copy (uint32_t bsflags, TileFragHash::TYPE rChType, TileRawChannelUnit::UNIT rChUnit, DigitsMetaData_t &digitsMetaData, RawChannelMetaData_t &rawchannelMetaData, const ROBData *rob, pDigiVec &pDigits, pRwChVec &pChannel, TileRawChannelCollection &v, TileRawChannelContainer *container) const
uint32_t make_copyHLT (bool of2, TileRawChannelUnit::UNIT rChUnit, bool correctAmplitude, const FRwChVec &pChannel, TileCellCollection &v, const uint16_t DQuality, D0CellsHLT &d0cells, TileCellCollection *MBTS) const
std::vector< uint32_t > get_correct_data (const uint32_t *p) const
void make_copy (const ROBData *rob, pBeamVec &pBeam, TileBeamElemCollection &v) const
void make_copy (const ROBData *rob, pBeamVec &pBeam, TileDigitsCollection &v) const
void make_copy (const ROBData *rob, pBeamVec &pBeam, TileRawChannelCollection &v) const
void make_copy (const ROBData *rob, pBeamVec &pBeam, TileCellCollection &v) const
template<typename ELEMENT>
void delete_vec (std::vector< ELEMENT * > &v) const
template<typename ELEMENT, class COLLECTION>
void copy_vec (std::vector< ELEMENT * > &v, COLLECTION &coll) const
bool checkBit (const uint32_t *p, int chan) const
 check the bitmap for a channel
void updateAmpThreshold (int run=-1)
void initHid2re ()
void initHid2reHLT ()
const uint32_t * get_data (const ROBData *rob) const
uint32_t data_size (const ROBData *rob, uint32_t &error) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

TileRawChannel2Bytes5 m_rc2bytes5
TileRawChannel2Bytes4 m_rc2bytes4
TileRawChannel2Bytes2 m_rc2bytes2
TileRawChannel2Bytes m_rc2bytes
TileDigits2Bytes m_d2Bytes
const TileHWIDm_tileHWID = nullptr
Gaudi::Property< bool > m_useFrag0 {this, "useFrag0", true, "Use frag0"}
Gaudi::Property< bool > m_useFrag1 {this, "useFrag1", true, "Use frag1"}
Gaudi::Property< bool > m_useFrag4 {this, "useFrag4", true, "User frag4"}
Gaudi::Property< bool > m_useFrag5Raw {this, "useFrag5Raw", false, "Use frag5 raw"}
Gaudi::Property< bool > m_useFrag5Reco {this, "useFrag5Reco", false, "Use frag5 reco"}
Gaudi::Property< bool > m_ignoreFrag4HLT {this, "ignoreFrag4HLT", false, "Ignore frag4 HLT"}
Gaudi::Property< float > m_allowedTimeMin
Gaudi::Property< float > m_allowedTimeMax
Gaudi::Property< float > m_ampMinThresh
Gaudi::Property< float > m_timeMinThresh
Gaudi::Property< float > m_timeMaxThresh
Gaudi::Property< unsigned int > m_fullTileRODs
Gaudi::Property< std::vector< int > > m_demoFragIDs
Gaudi::Property< bool > m_verbose {this, "VerboseOutput", false, "Print extra information"}
Gaudi::Property< bool > m_calibrateEnergy {this, "calibrateEnergy", true, "Convert ADC counts to pCb for RawChannels"}
Gaudi::Property< bool > m_suppressDummyFragments {this, "suppressDummyFragments", false, "Suppress dummy fragments"}
Gaudi::Property< bool > m_maskBadDigits
Gaudi::Property< int > m_maxWarningPrint {this, "MaxWarningPrint", 1000, "Maximum warning messages to print"}
Gaudi::Property< int > m_maxErrorPrint {this, "MaxErrorPrint", 1000, "Maximum error messages to print"}
SG::ReadCondHandleKey< TileHid2RESrcIDm_hid2RESrcIDKey
ToolHandle< TileCondToolTimingm_tileToolTiming
ToolHandle< TileCondToolOfcCoolm_tileCondToolOfcCool
ToolHandle< TileCondToolEmscalem_tileToolEmscale
ToolHandle< ITileBadChanToolm_tileBadChanTool
ToolHandle< TileL2Builderm_L2Builder
ServiceHandle< TileCablingSvcm_cablingSvc
float m_ampMinThresh_pC
 correct amplitude if it's above amplitude threshold (in pC)
float m_ampMinThresh_MeV
 correct amplitude if it's above amplitude threshold (in MeV)
std::vector< uint32_t > m_OFWeights[4 *TileCalibUtils::MAX_DRAWERIDXATLAS_THREAD_SAFE
std::atomic< const uint32_t * > m_OFPtrs[4 *TileCalibUtils::MAX_DRAWERIDXATLAS_THREAD_SAFE
std::mutex m_OFWeightMutex
std::mutex m_HidMutex
std::vector< int > m_Rw2Cell [4]
std::vector< int > m_Rw2Pmt [4]
TileFragHash m_hashFunc
bool m_of2Default
std::map< unsigned int, unsigned int > m_mapMBTS
int m_MBTS_channel = 0
std::atomic< int > m_WarningCounter
std::atomic< int > m_ErrorCounter
TileHid2RESrcIDm_hid2re
TileHid2RESrcIDm_hid2reHLT
std::vector< int > m_list_of_masked_drawers
unsigned int m_maxChannels
bool m_checkMaskedDrawers
int m_runPeriod
std::vector< int > m_demoChanLB
std::vector< int > m_demoChanEB
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

Friends

class TileHid2RESrcID

Detailed Description

Decodes the different TileCal ROD subfragment types in bytestream data and fills TileDigitsContainer, TileRawChannelContainer or TileL2Container.

Author
A. Solodkov
Version
0-0-1 , Oct 17, 2002

Modified, Dec 20, 2002 Create either TileRawChannel or TileCell.

Modified, Jan 15, 2003 Moved Encoding part to TileROD_Encoder.

Modified, Sep 7, 2003 Decoding of Testbeam data added

Definition at line 119 of file TileROD_Decoder.h.

Member Typedef Documentation

◆ DigitsMetaData_t

typedef std::vector<std::vector<uint32_t> > TileROD_Decoder::DigitsMetaData_t
private

Definition at line 242 of file TileROD_Decoder.h.

◆ FRwChVec

typedef std::vector<TileFastRawChannel> TileROD_Decoder::FRwChVec
private

Definition at line 235 of file TileROD_Decoder.h.

◆ pBeamVec

typedef std::vector<TileBeamElem *> TileROD_Decoder::pBeamVec
private

Definition at line 233 of file TileROD_Decoder.h.

◆ pCellVec

typedef std::vector<TileCell *> TileROD_Decoder::pCellVec
private

Definition at line 231 of file TileROD_Decoder.h.

◆ pDigiVec

typedef std::vector<TileDigits *> TileROD_Decoder::pDigiVec
private

Definition at line 232 of file TileROD_Decoder.h.

◆ pRwChVec

typedef std::vector<TileRawChannel *> TileROD_Decoder::pRwChVec
private

Definition at line 234 of file TileROD_Decoder.h.

◆ RawChannelMetaData_t

typedef std::vector<std::vector<uint32_t> > TileROD_Decoder::RawChannelMetaData_t
private

Definition at line 244 of file TileROD_Decoder.h.

◆ ROBData

convert ROD Data words into either TileCell or TileRawChannel.

Definition at line 153 of file TileROD_Decoder.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ TileFragStatus

Enumerator
ALL_OK 
CRC_ERR 
ALL_FF 
ALL_00 
NO_FRAG 
NO_ROB 

Definition at line 226 of file TileROD_Decoder.h.

Constructor & Destructor Documentation

◆ TileROD_Decoder()

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

constructor

Definition at line 39 of file TileROD_Decoder.cxx.

41 : AthAlgTool(type, name, parent)
44 , m_of2Default(true)
46 , m_ErrorCounter (0)
47 , m_hid2re(nullptr)
48 , m_hid2reHLT(nullptr)
51 , m_runPeriod(0){
52
53 declareInterface<TileROD_Decoder>(this);
54
55 for (std::atomic<const uint32_t*>& p : m_OFPtrs) {
56 p = nullptr;
57 }
58}
AthAlgTool()
Default constructor:
static const unsigned int MAX_CHAN
Number of channels in drawer.
float m_ampMinThresh_pC
correct amplitude if it's above amplitude threshold (in pC)
TileHid2RESrcID * m_hid2re
unsigned int m_maxChannels
TileHid2RESrcID * m_hid2reHLT
std::atomic< int > m_ErrorCounter
float m_ampMinThresh_MeV
correct amplitude if it's above amplitude threshold (in MeV)
std::atomic< int > m_WarningCounter

◆ ~TileROD_Decoder()

TileROD_Decoder::~TileROD_Decoder ( )
virtual

destructor

Definition at line 78 of file TileROD_Decoder.cxx.

78 {
79 if (m_hid2re) delete m_hid2re;
80 if (m_hid2reHLT) delete m_hid2reHLT;
81}

Member Function Documentation

◆ checkBit()

bool TileROD_Decoder::checkBit ( const uint32_t * p,
int chan ) const
private

check the bitmap for a channel

Definition at line 232 of file TileROD_Decoder.cxx.

232 {
233 // chan = (0,47)
234 int a = chan / 32;
235 int r = chan % 32;
236 // a = (0,1), r = ( 0, 31 )
237 return *(p + a) & (1 << r);
238
239}
static Double_t a
int r
Definition globals.cxx:22

◆ convert()

StatusCode TileROD_Decoder::convert ( const RawEvent * re,
TileL2Container * L2Cnt ) const

Definition at line 3027 of file TileROD_Decoder.cxx.

3027 {
3028
3029 ATH_MSG_DEBUG( "Reading L2 data from ByteStream" );
3030
3031 if (!re) {
3032 ATH_MSG_FATAL( "RawEvent passed to 'convert'-function is a null pointer!" );
3033 return StatusCode::FAILURE;
3034 }
3035
3036 //bool eValid = re->check_tree();
3037 //if (! eValid) return StatusCode::FAILURE;
3038
3039 // const VDETF& vdetf = re->compounds(); //Get subdetector fragements from the raw event.
3040 uint32_t total_sub = re->nchildren();
3041
3042 if (msgLvl(MSG::VERBOSE)) {
3043 msg(MSG::VERBOSE) << "Full Event: " << endmsg;
3044 msg(MSG::VERBOSE) << MSG::hex << "Full source ID: " << re->source_id()
3045 << MSG::dec << endmsg;
3046 msg(MSG::VERBOSE) << "Fragment size in words: " << re->fragment_size_word() << endmsg;
3047 msg(MSG::VERBOSE)<< "# of rob frags: " << total_sub << endmsg;
3048 }
3049
3050 for (uint32_t i_rob = 0; i_rob < total_sub; ++i_rob) {
3051 const uint32_t* p_rob;
3052 re->child(p_rob, i_rob);
3053 const eformat::ROBFragment<const uint32_t*> robFrag(p_rob);
3054
3055 eformat::helper::SourceIdentifier id = eformat::helper::SourceIdentifier(robFrag.source_id());
3056 unsigned int subDetId = id.subdetector_id();
3057
3058 if (subDetId >= 0x50 && subDetId < 0x60) { //Select Tile-Subdetectors
3059 fillCollectionL2(&robFrag, *L2Cnt);
3060 }
3061 }
3062
3063 // Debug
3064
3065 if (msgLvl(MSG::VERBOSE)) {
3066 msg(MSG::VERBOSE) << "convertL2: " << L2Cnt->size()
3067 << " TileL2 objects created" << endmsg;
3069 TileL2Container::const_iterator last = L2Cnt->end();
3070
3071 int num = 0;
3072 for (; ind != last; ++ind) {
3073 msg(MSG::VERBOSE) << "Ind " << num++ << " " << (std::string) (*(*ind)) << endmsg;
3074 }
3075 }
3076
3077 return StatusCode::SUCCESS;
3078}
const boost::regex re(r_e)
#define endmsg
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() const noexcept
size_type size() const noexcept
void fillCollectionL2(const ROBData *rob, TileL2Container &v) const
setEventNumber uint32_t

◆ convertLaser()

StatusCode TileROD_Decoder::convertLaser ( const RawEvent * re,
TileLaserObject * TileLaserObj ) const

Definition at line 3261 of file TileROD_Decoder.cxx.

3261 {
3262
3263 ATH_MSG_DEBUG( "Reading TileLaser data from ByteStream" );
3264
3265 setLaserVersion(*laserObject);
3266
3267 if (!re) {
3268 ATH_MSG_FATAL( "RawEvent passed to 'convert'-function is a null pointer!" );
3269 return StatusCode::FAILURE;
3270 }
3271
3272 //bool eValid = re->check_tree();
3273 //if (! eValid) return StatusCode::FAILURE;
3274
3275 // const VDETF& vdetf = re->compounds(); //Get subdetector fragments from the raw event.
3276 uint32_t total_sub = re->nchildren();
3277
3278 if (msgLvl(MSG::VERBOSE)) {
3279 msg(MSG::VERBOSE) << "Full Event: " << endmsg;
3280 msg(MSG::VERBOSE) << MSG::hex << "Full source ID: " << re->source_id() << MSG::dec << endmsg;
3281 msg(MSG::VERBOSE) << "Fragment size in words: " << re->fragment_size_word() << endmsg;
3282 msg(MSG::VERBOSE) << "# of rob frags: " << total_sub << endmsg;
3283 }
3284
3285 for (uint32_t i_rob = 0; i_rob < total_sub; ++i_rob) {
3286 const uint32_t* p_rob;
3287 re->child(p_rob, i_rob);
3288 const eformat::ROBFragment<const uint32_t*> robFrag(p_rob);
3289
3290 eformat::helper::SourceIdentifier id = eformat::helper::SourceIdentifier(
3291 robFrag.rod_source_id());
3292 unsigned int subDetId = id.subdetector_id();
3293
3294 if (subDetId >= 0x50 && subDetId < 0x60) { //Select Tile-Subdetectors
3295 fillTileLaserObj(&robFrag, *laserObject);
3296 }
3297 }
3298
3299 return StatusCode::SUCCESS;
3300} // end of convertLaser()
void fillTileLaserObj(const ROBData *rob, TileLaserObject &v) const
void setLaserVersion(TileLaserObject &laserObject) const

◆ convertTMDBDecision()

StatusCode TileROD_Decoder::convertTMDBDecision ( const RawEvent * re,
TileMuonReceiverContainer * tileMuRcv ) const

Definition at line 4593 of file TileROD_Decoder.cxx.

4594{
4595
4596 ATH_MSG_DEBUG( " TileROD_Decoder::convertTMDBDecision " );
4597
4598 if (!re) {
4599 ATH_MSG_FATAL( "RawEvent passed to 'convert'-function is a null pointer!" );
4600 return StatusCode::FAILURE;
4601 }
4602
4603 uint32_t total_sub = re->nchildren();
4604
4605 for (uint32_t i_rob = 0; i_rob < total_sub; ++i_rob) {
4606 const uint32_t* p_rob;
4607 re->child(p_rob, i_rob);
4608 const eformat::ROBFragment<const uint32_t*> robFrag(p_rob);
4609
4610 //eformat::helper::SourceIdentifier id = eformat::helper::SourceIdentifier(robFrag.source_id());
4611 uint32_t sourceid = robFrag.source_id();
4612 uint32_t modid = sourceid >> 16;
4613 //ATH_MSG_VERBOSE( MSG::hex<<" sourceId: 0x"<< robFrag.source_id() <<MSG::dec );
4614
4615 if ((modid == 0x51 || modid == 0x52 || modid == 0x53 || modid == 0x54) && (sourceid & 0xf00)) {
4616 fillContainer_TileMuRcv_Decision(&robFrag, *tileMuRcv);
4617 }
4618 }
4619
4620 return StatusCode::SUCCESS;
4621}
void fillContainer_TileMuRcv_Decision(const ROBData *rob, TileMuonReceiverContainer &v) const

◆ copy_vec()

template<typename ELEMENT, class COLLECTION>
void TileROD_Decoder::copy_vec ( std::vector< ELEMENT * > & v,
COLLECTION & coll ) const
inlineprivate

Definition at line 696 of file TileROD_Decoder.h.

696 {
697 typedef typename std::vector<ELEMENT *>::const_iterator ELEMENT_const_iterator;
698
699 ELEMENT_const_iterator iCh = v.begin();
700 ELEMENT_const_iterator iEnd = v.end();
701 for (; iCh != iEnd; ++iCh) coll.push_back(*iCh);
702}

◆ data_size()

uint32_t TileROD_Decoder::data_size ( const ROBData * rob,
uint32_t & error ) const
inlineprivate

Definition at line 620 of file TileROD_Decoder.h.

620 {
621 uint32_t size = rob->rod_ndata();
622 uint32_t max_allowed_size = rob->rod_fragment_size_word();
623 uint32_t delta = rob->rod_header_size_word() + rob->rod_trailer_size_word();
624 if (max_allowed_size > delta)
625 max_allowed_size -= delta;
626 else
627 max_allowed_size = 0;
628 if (size < 3 && size > 0) {
629 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
631 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
632 << " ROD " << rob->rod_source_id() << MSG::dec
633 << " has unexpected data size: " << size << " - assuming zero size " );
634 }
635 return 0;
636 } else if (rob->rod_header_size_word() >= rob->rod_fragment_size_word()) {
637 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
639 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
640 << " ROD " << rob->rod_source_id() << MSG::dec
641 << " has unexpected header size: " << rob->rod_header_size_word()
642 << " bigger than full size " << rob->rod_fragment_size_word()
643 << " - assuming no data " );
644 }
645 return 0;
646 } else if (size > max_allowed_size) {
647 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
648
649 if (size - rob->rod_trailer_size_word() < max_allowed_size) {
651 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
652 << " ROD " << rob->rod_source_id() << MSG::dec
653 << " data size " << size << " is longer than allowed size " << max_allowed_size
654 << " - assuming that ROD trailer is shorter: "
655 << rob->rod_trailer_size_word()-(size-max_allowed_size)
656 << " words instead of " << rob->rod_trailer_size_word());
657 }
658 max_allowed_size = size;
659 } else if (size - rob->rod_trailer_size_word() == max_allowed_size) {
661 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
662 << " ROD " << rob->rod_source_id() << MSG::dec
663 << " data size " << size << " is longer than allowed size " << max_allowed_size
664 << " - assuming that ROD trailer ("
665 << rob->rod_trailer_size_word()
666 << " words) is absent");
667 }
668 max_allowed_size = size;
669 } else {
670 max_allowed_size += rob->rod_trailer_size_word();
672 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
673 << " ROD " << rob->rod_source_id() << MSG::dec
674 << " has unexpected data size: " << size
675 << " - assuming data size = " << max_allowed_size << " words and no ROD trailer at all" );
676 }
677 }
678 return max_allowed_size;
679 } else {
680 return size;
681 }
682 }
#define ATH_MSG_WARNING(x)
Gaudi::Property< int > m_maxWarningPrint

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ 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>

◆ delete_vec()

template<typename ELEMENT>
void TileROD_Decoder::delete_vec ( std::vector< ELEMENT * > & v) const
inlineprivate

Definition at line 686 of file TileROD_Decoder.h.

686 {
687 typedef typename std::vector<ELEMENT *>::const_iterator ELEMENT_const_iterator;
688
689 ELEMENT_const_iterator iCh = v.begin();
690 ELEMENT_const_iterator iEnd = v.end();
691 for (; iCh != iEnd; ++iCh) delete (*iCh);
692 v.clear();
693}

◆ 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()

template<class COLLECTION>
void TileROD_Decoder::fillCollection ( const ROBData * rob,
COLLECTION & v,
typename TileROD_Helper::ContainerForCollection< COLLECTION >::type * container = nullptr ) const

This method calls the unpacking methods to decode the ROD data and fills the TileDigitsContainer and/or the TileRawChannelContainer.

fill either TileDigitsCollection or TileRawChannelCollection or TileCellCollection or TileBeamElemCollection from a BLOCK of integers

Definition at line 904 of file TileROD_Decoder.h.

907{
908 //
909 // get info from ROD header
910 //
911 // if (msgLvl(MSG::VERBOSE)) {
912 // msg(MSG::VERBOSE) << "ROD header info: " << endmsg
913 // msg(MSG::VERBOSE) << " Format Vers. " << MSG::hex << "0x" << rob->rod_version() << MSG::dec << endmsg;
914 // msg(MSG::VERBOSE) << " Source ID " << MSG::hex << "0x" << rob->rod_source_id() << MSG::dec << endmsg;
915 // msg(MSG::VERBOSE) << " Source ID str " << eformat::helper::SourceIdentifier(rob->source_id()).human().c_str() << endmsg;
916 // msg(MSG::VERBOSE) << " Run number " << (int) rob->rod_run_no() << endmsg;
917 // msg(MSG::VERBOSE) << " Level1 ID " << rob->rod_lvl1_id() << endmsg;
918 // msg(MSG::VERBOSE) << " BCID " << rob->rod_bc_id() << endmsg;
919 // msg(MSG::VERBOSE) << " Lvl1 TrigType " << rob->rod_lvl1_trigger_type() << endmsg;
920 // msg(MSG::VERBOSE) << " Event Type " << rob->rod_detev_type() << endmsg;
921 // msg(MSG::VERBOSE) << " Fragment size " << rob->rod_fragment_size_word() << endmsg;
922 // msg(MSG::VERBOSE) << " Header size " << rob->rod_header_size_word() << endmsg;
923 // msg(MSG::VERBOSE) << " Trailer size " << rob->rod_trailer_size_word() << endmsg;
924 // msg(MSG::VERBOSE) << " N data " << rob->rod_ndata() << endmsg;
925 // msg(MSG::VERBOSE) << " N status " << rob->rod_nstatus() << endmsg;
926 // msg(MSG::VERBOSE) << " Status pos " << rob->rod_status_position() << endmsg;
927 // }
928
929 uint32_t version = rob->rod_version() & 0xFFFF;
930
931 bool isBeamROD = false;
932 // figure out which fragment we want to unpack
933 TileRawChannelCollection::ID frag_id = v.identify();
934 SG::ReadCondHandle<TileHid2RESrcID> hid2re{m_hid2RESrcIDKey};
935 const std::vector<uint32_t> & drawer_info = hid2re->getDrawerInfo(frag_id);
936 int bs_frag_id = drawer_info.size()>1 ? static_cast<int>(drawer_info[1]) : frag_id;
937 int drawer_type = drawer_info.size()>2 ? static_cast<int>(drawer_info[2]) : -1;
938
939 uint32_t mask = 0xFFFF;
940
941 // special conversion for sub-fragments in beam ROD
942 if (frag_id < 0x100) {
943 isBeamROD = true;
944 mask = 0xFF; // this is needed for TB 2003, when beam frag_id >= 0x400
945 }
946
947 // find all fragments with given Fragment ID
948 // and possibly with different types
949 std::vector<const uint32_t *> pFrag;
950 pFrag.reserve(5);
951
952 uint32_t error = 0;
953 uint32_t wc = 0;
954 uint32_t size = data_size(rob, error);
955 const uint32_t * p = get_data(rob);
956
957 // 2 extra words in every frag by default (frag id + frag size)
958 // but for all data after 2005 it is set to 3 later in the code
959 uint32_t sizeOverhead = 2;
960
961 // bool skipWords = ( ! isBeamROD && version == 0x1 );
962 // std::cout << " *(p) = 0x" << std::hex << (*(p)) << std::dec << std::endl;
963 if (size) {
964 bool V3format = (*(p) == 0xff1234ff); // additional frag marker since Sep 2005
965 V3format |= (*(p) == 0x00123400); // additional frag marker since Sep 2005 (can appear in buggy ROD frags)
966 if (!V3format && version>0xff) {
967 V3format = true;
969 ATH_MSG_WARNING("fillCollection: corrupted frag separator 0x" << MSG::hex << (*p) << " instead of 0xff1234ff in ROB 0x" << rob->rod_source_id() << MSG::dec );
970 }
971 if (V3format) {
972 ++p; // skip frag marker
973 sizeOverhead = 3;
974 } else {
975 sizeOverhead = 2;
976 }
977 }
978
979 //std::cout << std::hex << " frag_id " << frag_id << " mask " << mask
980 // << " version " << version << " sizeOverhead " << sizeOverhead
981 // << " skipWords " << skipWords << " V3format " << V3format
982 // << std::dec << std::endl;
983 //std::cout << " size is "<< size << std::endl;
984
985 while (wc < size) { // iterator over all words in a ROD
986
987 // first word is frag size
988 uint32_t count = *(p);
989 // second word is frag ID (16 bits) frag type (8 bits) and additional flags
990 uint32_t idAndType = *(p + 1);
991 int frag = (idAndType & mask);
992 int type = (idAndType & 0xF00000) >> 16; // note special mask, we ignore one digit, keep only 0x10, 0x20, 0x30, ...
993
994 if (count < sizeOverhead || count > size - wc) {
995 int cnt = 0;
996 for (; wc < size; ++wc, ++cnt, ++p) {
997 if ((*p) == 0xff1234ff) {
998 ++cnt;
999 ++wc;
1000 ++p;
1001 break;
1002 }
1003 }
1004 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1005 msg(MSG::WARNING) << "Frag 0x" << MSG::hex << frag << MSG::dec
1006 << " has unexpected size: " << count;
1007 if (wc < size) {
1008 msg(MSG::WARNING) << " skipping " << cnt << " words to the next frag" << endmsg;
1009 } else {
1010 msg(MSG::WARNING) << " ignoring " << cnt << " words till the end of ROD frag" << endmsg;
1011 }
1012 }
1013 continue;
1014 }
1015
1016 if (type != 0x10 && frag == bs_frag_id) pFrag.push_back(p);
1017
1018 p += count;
1019 wc += count;
1020
1021 //std::cout << " frag ="<<frag<<" type = "<<type<<" count="<<count<<std::endl;
1022
1023 // this is not needed anymore, since we can't read very old BS files anyhow.
1024 //if ( skipWords && type == 0 && wc < size ) { // special treatment of preROD output with digits
1025 // wc+=7; p+=7; // skip extra header
1026 //}
1027 }
1028
1029 if (wc != size) {
1030 // check word count
1031 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1032 ATH_MSG_WARNING( "Incorrect ROD size: " << wc << " words instead of " << size );
1033 }
1034 assert(0);
1035 // return;
1036 }
1037
1038 static const bool unpackDigits = std::is_same_v<COLLECTION, TileDigitsCollection>;
1039 static const bool unpackChannels = std::is_same_v<COLLECTION, TileRawChannelCollection>;
1040
1041 if (isBeamROD) {
1042
1043 pBeamVec pBeam;
1044 pBeam.reserve(16);
1045
1046 std::vector<const uint32_t *>::const_iterator it = pFrag.begin();
1047 std::vector<const uint32_t *>::const_iterator itEnd = pFrag.end();
1048
1049 for (; it != itEnd; ++it) {
1050
1051 p = (*it);
1052
1053 unpack_brod(version, sizeOverhead, p, pBeam, frag_id);
1054 }
1055
1056 make_copy(rob, pBeam, v);
1057
1058 } else {
1059
1060 pDigiVec pDigits;
1061 pRwChVec pChannel;
1062 pChannel.reserve(48);
1063
1064 // initialize meta data storage
1065 DigitsMetaData_t digitsMetaData (7);
1066 RawChannelMetaData_t rawchannelMetaData (7);
1067 for (unsigned int i = 0; i < 7; ++i) {
1068 digitsMetaData[i].reserve(16);
1069 rawchannelMetaData[i].reserve(2);
1070 }
1071
1072 // now unpack all channels in all fragments
1073 // and fill temporary array of TileDigits and/or TileRawChannels
1074
1075 std::vector<const uint32_t *>::const_iterator it = pFrag.begin();
1076 std::vector<const uint32_t *>::const_iterator itEnd = pFrag.end();
1077
1078 uint32_t bsflags = 0;
1081
1082 for (; it != itEnd; ++it) {
1083
1084 p = (*it);
1085 // first word is frag size
1086 // uint32_t count = *(p);
1087 // second word is frag ID (16 bits) frag type (8 bits) and additional flags
1088 uint32_t idAndType = *(p + 1);
1089 int type = (idAndType & 0x00FF0000) >> 16;
1090
1091 ATH_MSG_VERBOSE( "Unpacking frag: 0x" << MSG::hex << (idAndType & 0xFFFF)
1092 << " type " << type << MSG::dec );
1093
1094 switch (type) {
1095 case 0:
1096 if (unpackDigits && m_useFrag0) unpack_frag0(version, sizeOverhead, digitsMetaData, p, pDigits, frag_id, drawer_type);
1097 break;
1098 case 1:
1099 if (unpackDigits && m_useFrag1) unpack_frag1(version, sizeOverhead, digitsMetaData, p, pDigits, frag_id, drawer_type);
1100 break;
1101 case 2:
1102 if (unpackChannels && m_useFrag4) unpack_frag2(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
1103 break;
1104 case 3:
1105 if (unpackChannels && m_useFrag4) unpack_frag3(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
1106 break;
1107 case 4:
1108 if (unpackChannels && m_useFrag4) {
1109 bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest
1110 int unit = (idAndType & 0xC0000000) >> 30;
1111
1112 int DataType = (idAndType & 0x30000000) >> 28;
1113
1114 if (DataType < 3) { // real data
1115
1116 // only one bit for type and next 2 bits for number of iterations
1117 //int AlgoType = (idAndType & 0x4000000) >> 26;
1118 //if (AlgoType == 0) rChType = TileFragHash::OF1Filter;
1119 //else rChType = TileFragHash::OF2Filter;
1120 // always set special type, which means now that OF is done inside DSP
1122
1123 // Attention! Switching to Online Units for release 14.2.0
1124 rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data
1125 // rChUnit = (TileRawChannelUnit::UNIT) ( unit );
1126
1127 } else { // simulated data
1128
1129 // all 3 bits for type
1130 int AlgoType = (idAndType & 0x7000000) >> 24;
1131 rChType = (TileFragHash::TYPE) AlgoType;
1132
1133 rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data
1134
1135 if (!m_demoFragIDs.empty()) {
1136 const_cast<Gaudi::Property<std::vector<int>> &> ( m_demoFragIDs ) = {}; // No demonstator cabling in MC
1137 ATH_MSG_INFO("Disable channel remapping for demonstrator in MC");
1138 }
1139 }
1140
1141 unpack_frag4(version, sizeOverhead, unit, rawchannelMetaData, p, pChannel, frag_id, drawer_type);
1142 }
1143 break;
1144
1145 case 5:
1147 bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest
1148 int unit = (idAndType & 0xC0000000) >> 30;
1149
1150 // always set special type, which means now that OF is done inside DSP
1152
1154 unpack_frag5(version, sizeOverhead, unit,
1155 digitsMetaData,
1156 p, pDigits, pChannel, frag_id, drawer_type);
1157 }
1158 break;
1159
1160 case 6:
1161 break;
1162
1163 case 0xA:
1164 if (unpackChannels) unpack_fragA(version, rawchannelMetaData, p, pChannel, frag_id, drawer_type);
1165 break;
1166
1167 default:
1168 int frag = idAndType & 0xFFFF;
1169 ATH_MSG_WARNING( "Unknown frag type=" << type << " for frag=" << frag );
1170 assert(0);
1171 break;
1172 }
1173 } // end of all frags
1174
1175 make_copy(bsflags, rChType, rChUnit, digitsMetaData, rawchannelMetaData,
1176 rob, pDigits, pChannel, v, container);
1177 }
1178
1179 return;
1180}
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
TYPE
initialize
Gaudi::Property< bool > m_useFrag1
void make_copy(uint32_t bsflags, TileFragHash::TYPE rChType, TileRawChannelUnit::UNIT rChUnit, DigitsMetaData_t &digitsMetaData, RawChannelMetaData_t &rawchannelMetaData, const ROBData *rob, pDigiVec &pDigits, pRwChVec &pChannel, TileBeamElemCollection &v, TileBeamElemContainer *container) const
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
void unpack_frag5(uint32_t version, uint32_t sizeOverhead, unsigned int unit, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag5 decodes tile subfragment type 0x4.
std::vector< TileDigits * > pDigiVec
Gaudi::Property< bool > m_useFrag4
Gaudi::Property< int > m_maxErrorPrint
void unpack_frag3(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag3 decodes tile subfragment type 0x3.
void unpack_frag4(uint32_t version, uint32_t sizeOverhead, unsigned int unit, RawChannelMetaData_t &rawchannelMetaData, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag4 decodes tile subfragment type 0x4.
void unpack_frag1(uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
unpack_frag1 decodes tile subfragment type 0x1.
std::vector< std::vector< uint32_t > > RawChannelMetaData_t
Gaudi::Property< bool > m_useFrag5Reco
Gaudi::Property< std::vector< int > > m_demoFragIDs
void unpack_frag2(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag2 decodes tile subfragment type 0x2.
const uint32_t * get_data(const ROBData *rob) const
std::vector< std::vector< uint32_t > > DigitsMetaData_t
std::vector< TileRawChannel * > pRwChVec
void unpack_frag0(uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
unpack_frag0 decodes tile subfragment type 0x0.
std::vector< TileBeamElem * > pBeamVec
Gaudi::Property< bool > m_useFrag5Raw
Gaudi::Property< bool > m_useFrag0
uint32_t data_size(const ROBData *rob, uint32_t &error) const
void unpack_brod(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pBeamVec &pBeam, int fragID) const
unpack_brod decodes all ancillary tile subfragments coming from beam ROD at the testbeam or LASTROD i...
void unpack_fragA(uint32_t version, RawChannelMetaData_t &rawchannelMetaData, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_fragA decodes tile subfragment type 0XA.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ fillCollection_FELIX_Digi()

void TileROD_Decoder::fillCollection_FELIX_Digi ( const ROBData * rob,
TileDigitsCollection & v ) const

Definition at line 4528 of file TileROD_Decoder.cxx.

4528 {
4529
4530 ATH_MSG_DEBUG( "TileROD_Decoder::fillCollection_FELIX_Digi" );
4531
4532 uint32_t version = rob->rod_version() & 0xFFFF;
4533 uint32_t sizeOverhead = 3; // Sub fragment marker, size, and (id + type)
4534
4535 SG::ReadCondHandle<TileHid2RESrcID> hid2re{m_hid2RESrcIDKey};
4536
4537 // initialize meta data storage
4538 DigitsMetaData_t digitsMetaData(9);
4539 RawChannelMetaData_t rawchannelMetaData;
4540
4541 pDigiVec pDigits;
4542 pRwChVec pChannel;
4543
4544 uint32_t error = 0;
4545 uint32_t size = data_size(rob, error);
4546 const uint32_t* data = get_data(rob);
4547 const uint32_t* const end_data = data + size;
4548
4549 int frag_id = coll.identify();
4550 const std::vector<uint32_t> & drawer_info = hid2re->getDrawerInfo(frag_id);
4551 int bs_frag_id = drawer_info.size()>1 ? static_cast<int>(drawer_info[1]) : frag_id;
4552 int drawer_type = drawer_info.size()>2 ? static_cast<int>(drawer_info[2]) : -1;
4553
4554 while (data < end_data) { // iterator over all words for a robid
4555 // first word is the start of the tile subfragment in v3format it is 0xff1234ff
4556 if ((*data) == 0xff1234ff) {
4557 uint32_t count = *(data + 1); // first word is frag size
4558 uint32_t idAndType = *(data + 2); // second word is frag ID and frag type
4559 int frag = (idAndType & 0x0FFF); // remove the offset
4560 int type = (idAndType>>16)& 0xFF; // note special mask, we ignore one digit, keep only 0x10, 0x20, 0x30, ...
4561 if (type == 0x06 && (frag == bs_frag_id)) {
4562 ++data;
4563 ATH_MSG_DEBUG( MSG::hex << "Found FELIX sub-fragment ID=0x" << frag
4564 <<" type=0x" << type << MSG::dec
4565 << " size=" << count );
4566 std::vector<uint32_t> correct_data = get_correct_data(data);
4567 unpack_frag6(version, sizeOverhead, digitsMetaData, correct_data.data(), pDigits, frag_id, drawer_type);
4568 // store metadata for this collection
4569 // size, fragID, BCID
4570 digitsMetaData[0].push_back(count);
4571 digitsMetaData[0].push_back(frag);
4572 digitsMetaData[0].push_back(0);
4573 break;
4574 } else {
4575 // carry on looping to search for 0x60
4576 data += count;
4577 }
4578 }
4579 ++data;
4580 }
4581
4582 uint32_t bsflags = 0;
4585
4586 make_copy(bsflags, rChType, rChUnit, digitsMetaData, rawchannelMetaData,
4587 rob, pDigits, pChannel, coll, nullptr);
4588
4589}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::vector< uint32_t > get_correct_data(const uint32_t *p) const
void unpack_frag6(uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
unpack_frag6 decodes tile subfragment type 0x6.

◆ fillCollection_TileMuRcv_Digi()

void TileROD_Decoder::fillCollection_TileMuRcv_Digi ( const ROBData * rob,
TileDigitsCollection & v ) const

Definition at line 4398 of file TileROD_Decoder.cxx.

4398 {
4399
4400 ATH_MSG_DEBUG( " TileROD_Decoder::fillCollection_TileMuRcv_Digi " );
4401
4402 int wc = 0;
4403 bool b_sof = false;
4404 bool b_digiTmdb = false;
4405
4406 uint32_t version = rob->rod_version() & 0xFFFF;
4407 uint32_t sourceid = rob->rod_source_id();
4408 int size = rob->rod_ndata();
4409
4410 uint32_t sfrag_version = 0x0;
4411 uint32_t sfrag_type = 0x0;
4412 int sfrag_size = 0;
4413
4414 const uint32_t *p = get_data(rob);
4415
4416 ATH_MSG_DEBUG( " Trying DECODER over source ID: "<<MSG::hex<<" 0x"<<sourceid<<MSG::dec<<" size of full fragment: "<<size );
4417
4418 while ( wc < size ) { // iterator over all words for a robid
4419 // first word is the start of the tile subfragment in v3format it is 0xff1234ff
4420 if ((*p) == 0xff1234ff) b_sof=true;
4421
4422 ATH_MSG_DEBUG( " Start of sub-fragment word: "<<MSG::hex<<(*p)<<MSG::dec<<" false/true: "<<b_sof );
4423
4424 if (b_sof) {
4425 // second word is frag size
4426 sfrag_size = *(p+1);
4427 // third word is frag version (16-bits) + type (16-bits)
4428 sfrag_version = *(p+2) & 0xFFFF;
4429 sfrag_type = *(p+2) >> 16;
4430 b_sof = false;
4431 }
4432
4433 if (sfrag_type==0x40) {
4434 b_digiTmdb = true;
4435 ATH_MSG_DEBUG( MSG::hex<<" DECODER sub-fragment VERSION= 0x"<<sfrag_version<<" TYPE= 0x"<<sfrag_type<< MSG::dec<<" SIZE="<<sfrag_size<<" FOUND! " );
4436 // type and version are identified and we move to the end of the loop
4437 wc += size-wc;
4438 p += 3;
4439 } else {
4440 // carry on looping to search for 0x40
4441 wc++;
4442 p++;
4443 }
4444 }
4445
4446 if ( b_digiTmdb ) {
4447 // the TMDB raw channel 0x40
4448 uint32_t collID = coll.identify();
4449 unpack_frag40( collID, version, p, sfrag_size-3, coll);
4450 }
4451
4452 //delete_vec(digi);
4453
4454 return;
4455
4456}
void unpack_frag40(uint32_t collid, uint32_t version, const uint32_t *p, int size, TileDigitsCollection &coll) const
unpacking methods dedicated to the TMDB ROD format sub-fragments 0x40 0x41 0x42

◆ fillCollection_TileMuRcv_RawChannel()

void TileROD_Decoder::fillCollection_TileMuRcv_RawChannel ( const ROBData * rob,
TileRawChannelCollection & v ) const

Definition at line 4458 of file TileROD_Decoder.cxx.

4458 {
4459
4460 ATH_MSG_DEBUG( " TileROD_Decoder::fillCollection_TileMuRcv_RawChannel " );
4461
4462 int wc = 0;
4463 bool b_sof = false;
4464 bool b_rcTmdb = false;
4465
4466 uint32_t version = rob->rod_version() & 0xFFFF;
4467 uint32_t sourceid = rob->rod_source_id();
4468 int size = rob->rod_ndata();
4469 int offset = 0;
4470
4471 uint32_t sfrag_version = 0x0;
4472 uint32_t sfrag_type = 0x0;
4473 int sfrag_size = 0;
4474
4475 const uint32_t *p = get_data(rob);
4476
4477 ATH_MSG_DEBUG( " Trying DECODER over source ID: "<<MSG::hex<<" 0x"<<sourceid<<MSG::dec<<" size of full fragment: "<<size );
4478
4479 while ( wc < size ) { // iterator over all words in a robid
4480 // first word is the start of the tile subfragment in v3format it is 0xff1234ff
4481 if ((*p) == 0xff1234ff) b_sof=true;
4482 ATH_MSG_DEBUG( " Start of sub-fragment word : "<<MSG::hex<< (*p)<<MSG::dec<<" false/true : "<<b_sof );
4483 // if at the start of the fragment than we should find more information about this (sub-)fragment in the following two words
4484 if (b_sof) {
4485 // second word is frag size
4486 sfrag_size = *(p+1);
4487 // third word is frag version (16-bits) + type (16-bits)
4488 sfrag_version = *(p+2) & 0xFFFF;
4489 sfrag_type = *(p+2) >> 16;
4490 b_sof=false;
4491 }
4492 // for tmdb we will start to have a fragment with three sub-fragments ordered as 0x40 0x41 0x42
4493 // we investigate if there are any of type 0x40 before going on 0x41
4494 // like this the loop is faster since we can access the size of this sub-fragment
4495 //
4496 if (sfrag_type==0x40) {
4497 ATH_MSG_DEBUG(MSG::hex<<" DECODER sub-fragment VERSION= 0x"<<sfrag_version<<" TYPE= 0x"<<sfrag_type<<MSG::dec<<" SIZE="<<sfrag_size<<" FOUND! Keep on looking for 0x41.");
4498 offset = sfrag_size;
4499 wc += offset;
4500 p += offset;
4501 } else if (sfrag_type==0x41) {
4502 b_rcTmdb = true;
4503 ATH_MSG_DEBUG(MSG::hex<<" DECODER sub-fragment VERSION= 0x"<<sfrag_version<<" TYPE= 0x"<<sfrag_type<<MSG::dec<<" SIZE="<<sfrag_size<<" FOUND!");
4504 // type and version are identified and we move to the end of the loop
4505 wc += size-wc;
4506 p+=3;
4507 } else {
4508 ATH_MSG_DEBUG(MSG::hex<<" DECODER sub-fragment VERSION= 0x"<<sfrag_version<<" TYPE= 0x"<<sfrag_type<<MSG::dec<<" SIZE="<<sfrag_size<<" FOUND!");
4509 // carry on looping to search for 0x41
4510 wc++;
4511 p++;
4512 }
4513 }
4514
4515 if ( b_rcTmdb ) {
4516 // the TMDB raw channel 0x41
4517 //
4518 uint32_t collID = coll.identify();
4519 unpack_frag41( collID, version, p, sfrag_size-3, coll);
4520 }
4521
4522 //delete_vec(rc);
4523
4524return;
4525}
void unpack_frag41(uint32_t collid, uint32_t version, const uint32_t *p, int size, TileRawChannelCollection &coll) const

◆ fillCollectionHLT()

uint32_t TileROD_Decoder::fillCollectionHLT ( const ROBData * rob,
TileCellCollection & v,
D0CellsHLT & d0cells,
TileCellCollection * MBTS,
const TileHid2RESrcID * hid2reHLT ) const

Definition at line 3410 of file TileROD_Decoder.cxx.

3415{
3416 uint32_t version = rob->rod_version() & 0xFFFF;
3417 // Resets error flag
3418 uint32_t error = 0x0;
3419
3420 // figure out which fragment we want to unpack
3421 TileRawChannelCollection::ID frag_id = v.identify();
3422 const std::vector<uint32_t> & drawer_info = hid2reHLT->getDrawerInfo(frag_id);
3423 int bs_frag_id = drawer_info.size()>1 ? static_cast<int>(drawer_info[1]) : frag_id;
3424 int drawer_type = drawer_info.size()>2 ? static_cast<int>(drawer_info[2]) : -1;
3425
3426 /*
3427 if (frag_id < 0x100) { // BEAM ROD frag - nothing to do
3428 m_error|=0x10000;
3429 return;
3430 }
3431 */
3432
3433 uint32_t wc = 0;
3434 uint32_t size = data_size(rob, error);
3435 const uint32_t * p = get_data(rob);
3436 // prepare bcid with one extra bit set for comparison with bcid in DQ fragment
3437 uint16_t rob_bcid = ((rob->rod_bc_id() & 0x7FFF) | 0x8000);
3438
3439 uint32_t sizeOverhead = 2;
3440 if (size) {
3441 bool V3format = (*(p) == 0xff1234ff); // additional frag marker since Sep 2005
3442 if (!V3format && version>0xff) {
3443 V3format = true;
3445 ATH_MSG_WARNING("fillCollectionHLT: corrupted frag separator 0x" << MSG::hex << (*p) << " instead of 0xff1234ff in ROB 0x" << rob->rod_source_id() << MSG::dec );
3446 }
3447 if (V3format) {
3448 ++p; // skip frag marker
3449 sizeOverhead = 3;
3450 } else {
3451 sizeOverhead = 2;
3452 }
3453 }
3454 bool of2 = m_of2Default;
3455 bool correctAmplitude = false;
3457 uint16_t DQuality = 0x0;
3458 bool fragFound = false;
3459 bool DQfragMissing = true;
3460
3461 FRwChVec pChannel;
3462 pChannel.reserve (m_maxChannels);
3463
3464 while (wc < size) { // iterator over all words in a ROD
3465
3466 // first word is frag size
3467 uint32_t count = *(p);
3468 // second word is frag ID (16 bits) frag type (8 bits) and additional flags
3469 uint32_t idAndType = *(p + 1);
3470 int frag = (idAndType & 0xFFFF);
3471 int type = (idAndType & 0xFF0000) >> 16;
3472
3473 if (count < sizeOverhead || count > size - wc) {
3474 int cnt = 0;
3475 for (; wc < size; ++wc, ++cnt, ++p) {
3476 if ((*p) == 0xff1234ff) {
3477 ++cnt;
3478 ++wc;
3479 ++p;
3480 break;
3481 }
3482 }
3483 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3484 msg(MSG::WARNING) << "Frag: " << MSG::hex << "0x" << frag << MSG::dec
3485 << " has unexpected size: " << count;
3486 if (wc < size) {
3487 msg(MSG::WARNING) << " skipping " << cnt << " words to the next frag" << endmsg;
3488 } else {
3489 msg(MSG::WARNING) << " ignoring " << cnt << " words till the end of ROD frag" << endmsg;
3490 }
3491 }
3492 error |= 0x10000;
3493 continue;
3494 }
3495
3496 //if (frag == frag_id && ((type > 1 && type < 6) || type==0xa)) { // proper fragment found - unpack it
3497 if (frag == bs_frag_id) { // proper fragment found - unpack it
3498
3499 switch (type) {
3500 case 2:
3501 fragFound = true;
3502 DQfragMissing = false;
3503 correctAmplitude = false;
3504 unpack_frag2HLT(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
3505 break;
3506 case 3:
3507 fragFound = true;
3508 DQfragMissing = false;
3509 correctAmplitude = false;
3510 unpack_frag3HLT(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
3511 break;
3512 case 4:
3513 if (!m_ignoreFrag4HLT && !fragFound) {
3514 fragFound = true;
3515 int unit = (idAndType & 0xC0000000) >> 30;
3516
3517 int DataType = (idAndType & 0x30000000) >> 28;
3518
3519 if (DataType < 3) { // real data
3520
3521 of2 = ((idAndType & 0x4000000) != 0);
3522 int nIter = (idAndType & 0x3000000) >> 24;
3523 correctAmplitude = (!nIter); // automatic detection of nIter
3524 rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data
3525
3526 } else { // simulated data
3527
3528 DQfragMissing = false;
3529 correctAmplitude = false;
3530 rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data
3531 if (!m_demoFragIDs.empty()) {
3532 const_cast<Gaudi::Property<std::vector<int>> &> ( m_demoFragIDs ) = {}; // No demonstator cabling in MC
3533 ATH_MSG_INFO("Disable channel remapping for demonstrator in MC");
3534 }
3535 }
3536
3537 unpack_frag4HLT(version, sizeOverhead, unit, p, pChannel, frag_id, drawer_type);
3538 }
3539 break;
3540
3541 case 5:
3542 if (!fragFound) {
3543 fragFound = true;
3544 int unit = (idAndType & 0xC0000000) >> 30;
3545
3546 of2 = ((idAndType & 0x4000000) != 0);
3547 correctAmplitude = true; // fragment 5 will appear only if there is no iterations, so correction required
3549
3550 unpack_frag5HLT(version, sizeOverhead, unit, p, pChannel, frag_id, drawer_type);
3551 }
3552 break;
3553
3554 case 0xa:
3555 DQfragMissing = false;
3556 unpack_fragAHLT(version, p, rob_bcid, DQuality, frag_id, drawer_type);
3557 break;
3558
3559 default:
3560 // Just ignore it
3561 break;
3562 }
3563 }
3564 p += count;
3565 wc += count;
3566 }
3567
3568 bool masked_drawer = m_checkMaskedDrawers ? m_tileBadChanTool->isDrawerMasked(frag_id) : false;
3569
3570 if (DQfragMissing && !masked_drawer) error |= 0x40000;
3571
3572 if (fragFound) {
3573 if (masked_drawer) DQuality = 0x0;
3574 error |= make_copyHLT(of2, rChUnit, correctAmplitude,
3575 pChannel, v, DQuality, d0cells, MBTS);
3576 } else if (!masked_drawer) error |= 0x20000;
3577
3578 return error;
3579}
const std::vector< uint32_t > & getDrawerInfo(int frag_id) const
uint32_t make_copyHLT(bool of2, TileRawChannelUnit::UNIT rChUnit, bool correctAmplitude, const FRwChVec &pChannel, TileCellCollection &v, const uint16_t DQuality, D0CellsHLT &d0cells, TileCellCollection *MBTS) const
void unpack_frag4HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag4HLT decodes tile subfragment type 0x4 for the high level trigger (HLT).
std::vector< TileFastRawChannel > FRwChVec
void unpack_fragAHLT(uint32_t version, const uint32_t *p, uint16_t rob_bcid, uint16_t &mask, int fragID, int demoType) const
unpack_fragAHLT decodes tile subfragment type 0XA.
ToolHandle< ITileBadChanTool > m_tileBadChanTool
void unpack_frag3HLT(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag3HLT decodes tile subfragment type 0x3 for the high level trigger (HLT).
void unpack_frag5HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag5HLT decodes tile subfragment type 0x5 for the high level trigger (HLT).
Gaudi::Property< bool > m_ignoreFrag4HLT
void unpack_frag2HLT(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag2HLT decodes tile subfragment type 0x2 for the high level trigger (HLT).
setWord1 uint16_t

◆ fillCollectionL2()

void TileROD_Decoder::fillCollectionL2 ( const ROBData * rob,
TileL2Container & v ) const

Definition at line 3080 of file TileROD_Decoder.cxx.

3080 {
3081 uint32_t version = rob->rod_version() & 0xFFFF;
3082
3083 uint32_t error = 0;
3084 uint32_t wc = 0;
3085 uint32_t size = data_size(rob, error);
3086 const uint32_t * p = get_data(rob);
3087 int fragmin = 0xFFF, fragmax = -1;
3088
3089 int counter = 0;
3090
3091 uint32_t sizeOverhead = 2;
3092 if (size) {
3093 bool V3format = (*(p) == 0xff1234ff); // additional frag marker since Sep 2005
3094 if (!V3format && version>0xff) {
3095 V3format = true;
3097 ATH_MSG_WARNING("fillCollectionL2( corrupted frag separator 0x" << MSG::hex << (*p) << " instead of 0xff1234ff in ROB 0x" << rob->rod_source_id() << MSG::dec );
3098 }
3099 if (V3format) {
3100 ++p; // skip frag marker
3101 sizeOverhead = 3;
3102 } else {
3103 sizeOverhead = 2;
3104 }
3105 }
3106
3107 SG::ReadCondHandle<TileHid2RESrcID> hid2re{m_hid2RESrcIDKey};
3108
3109 int DataType = 0;
3110 while (wc < size) { // iterator over all words in a ROD
3111
3112 // first word is frag size
3113 uint32_t count = *(p);
3114 // second word is frag ID and frag type
3115 uint32_t idAndType = *(p + 1);
3116 uint32_t bs_frag_id = idAndType & 0xFFFF;
3117 int frag = hid2re->getOfflineFragID(bs_frag_id);
3118 if (frag<0) frag = bs_frag_id;
3119 const std::vector<uint32_t> & drawer_info = hid2re->getDrawerInfo(frag);
3120 int drawer_type = drawer_info.size()>2 ? static_cast<int>(drawer_info[2]) : -1;
3121 if (frag < fragmin) fragmin = frag;
3122 if (frag > fragmax) fragmax = frag;
3123 DataType = (idAndType & 0x30000000) >> 28;
3124
3125 int type = (*(p + 1) >> 16) & 0xFF;
3126
3127 if (count < sizeOverhead || count > size - wc) {
3128 int cnt = 0;
3129 for (; wc < size; ++wc, ++cnt, ++p) {
3130 if ((*p) == 0xff1234ff) {
3131 ++cnt;
3132 ++wc;
3133 ++p;
3134 break;
3135 }
3136 }
3137 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3138 msg(MSG::WARNING) << "Frag " << MSG::hex << "0x" << frag
3139 << MSG::dec << " has unexpected size: " << count;
3140 if (wc < size) {
3141 msg(MSG::WARNING) << " skipping " << cnt << " words to the next frag" << endmsg;
3142 } else {
3143 msg(MSG::WARNING) << " ignoring " << cnt << " words till the end of ROD frag" << endmsg;
3144 }
3145 }
3146 continue;
3147 }
3148
3149 if (type == 4) { // frag4 which contains sum Et at the end
3150
3151 if (unpack_frag4L2(version, sizeOverhead, p, v, frag, drawer_type)) {
3152 counter++;
3153 }
3154
3155 } else if (type == 5 && m_useFrag5Reco) { // new fragment which contains sum Et
3156
3157 if (unpack_frag5L2(version, p, v, frag, drawer_type)) {
3158 counter++;
3159 }
3160
3161 } else if ((type >> 4) == 1) { // all frags 0x10-0x15 are MET or MTag frags
3162
3163 counter++;
3164
3165 switch (type) {
3166
3167 case 0x10:
3168 unpack_frag10(version, p, v, frag, drawer_type);
3169 break;
3170 case 0x11:
3171 unpack_frag11(version, p, v, frag, drawer_type);
3172 break;
3173 case 0x12:
3174 unpack_frag12(version, p, v, frag, drawer_type);
3175 break;
3176 case 0x13:
3177 unpack_frag13(version, p, v, frag, drawer_type);
3178 break;
3179 case 0x14:
3180 unpack_frag14(version, p, v, frag, drawer_type);
3181 break;
3182 case 0x15:
3183 unpack_frag15(version, p, v, frag, drawer_type);
3184 break;
3185
3186 default:
3187 int frag = *(p + 1) & 0xFFFF;
3188 ATH_MSG_WARNING( "Unknown frag type=" << type << " for frag=" << frag << " bs_frag=" << bs_frag_id);
3189 assert(0);
3190 break;
3191 }
3192 }
3193
3194 p += count;
3195 wc += count;
3196 }
3197
3198 if (wc != size) {
3199 // check word count
3200 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3201 ATH_MSG_WARNING( "Incorrect ROD size: " << wc << " words instead of " << size );
3202 }
3203 assert(0);
3204 // return;
3205 }
3206
3207 if (DataType >= 3 && counter == 0 && !m_L2Builder.empty()) {
3208 if (m_L2Builder->process(fragmin, fragmax, &v).isFailure()) {
3209 ATH_MSG_ERROR( "Failure in " << m_L2Builder );
3210 return;
3211 }
3212 }
3213
3214 return;
3215}
#define ATH_MSG_ERROR(x)
void unpack_frag11(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag11 decodes tile subfragment type 0x11.
void unpack_frag14(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag14 decodes tile subfragment type 0x14.
void unpack_frag15(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag15 decodes tile subfragment type 0x15.
void unpack_frag12(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag12 decodes tile subfragment type 0x12.
void unpack_frag10(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag10 decodes tile subfragment type 0x10.
ToolHandle< TileL2Builder > m_L2Builder
bool unpack_frag4L2(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag4L2 decodes tile subfragment type 0x4 and extract transverse energy from this fragment
bool unpack_frag5L2(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag5L2 decodes tile subfragment type 0x5 and extract transverse energy from this fragment
void unpack_frag13(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag13 decodes tile subfragment type 0x13.

◆ fillCollectionL2ROS()

void TileROD_Decoder::fillCollectionL2ROS ( const ROBData * rob,
TileL2Container & v ) const

Definition at line 3217 of file TileROD_Decoder.cxx.

3217 {
3218 uint32_t error = 0;
3219 uint32_t size = data_size(rob, error);
3220 const uint32_t * p = get_data(rob);
3221 const uint32_t ROB_to_decode = ((*p) & 0xFFFF); // Multiply by two
3222 const uint32_t virtualROBJump = ((*p) >> 16) >> 2; // Divide by four (four drawer-1ROB)
3223 if (size < ROB_to_decode * virtualROBJump + 1) {
3224 ATH_MSG_ERROR( "Declared size =" << size
3225 << "; virtualROBJump=" << virtualROBJump
3226 << "; ROB_to_decode=" << ROB_to_decode );
3227 return;
3228 }
3229 p++; // Jump first word
3230
3231 SG::ReadCondHandle<TileHid2RESrcID> hid2re{m_hid2RESrcIDKey};
3232
3233 std::vector<float> sumE(3, 0.0);
3234 uint32_t idAndType, bs_frag_id;
3235 int frag, hash, unit;
3236
3237 for (size_t irob = 0; irob < ROB_to_decode; ++irob) {
3238 for (size_t drawInRob = 0; drawInRob < virtualROBJump; ++drawInRob) {
3239
3240 idAndType = *(p++);
3241 bs_frag_id = idAndType & 0xFFF;
3242 frag = hid2re->getOfflineFragID(bs_frag_id);
3243 if (frag<0) frag = bs_frag_id;
3244
3245 hash = m_hashFunc(frag);
3246 if (hash > -1) {
3247 unit = (idAndType >> (32 - 2)) & 0x3;
3248 sumE[0] = Frag5_unpack_bin2sum(unit, (int)(*(p++)));
3249 sumE[1] = Frag5_unpack_bin2sum(unit, (int)(*(p++)));
3250 sumE[2] = Frag5_unpack_bin2sum(unit, (int)(*(p++)));
3251
3252 (v[hash])->setEt(std::vector<float>(sumE)); //copy since looping
3253 } else {
3254 p += 3;
3255 }
3256 } // End of drawInRob loop
3257 } // End of rob loop
3258
3259}
#define Frag5_unpack_bin2sum(unit, amp_bin)
unpack_bin2sum
TileFragHash m_hashFunc

◆ fillContainer_TileMuRcv_Decision()

void TileROD_Decoder::fillContainer_TileMuRcv_Decision ( const ROBData * rob,
TileMuonReceiverContainer & v ) const

Definition at line 4623 of file TileROD_Decoder.cxx.

4623 {
4624
4625 ATH_MSG_DEBUG( "TileROD_Decoder::fillContainer_TileMuRcv_Decision" );
4626
4627 int wc = 0;
4628 bool b_sof = false;
4629 bool b_deciTmdb = false;
4630
4631 uint32_t version = rob->rod_version() & 0xFFFF;
4632 uint32_t sourceid = rob->rod_source_id();
4633 int size = rob->rod_ndata();
4634 int offset = 0;
4635
4636 uint32_t sfrag_version = 0x0;
4637 uint32_t sfrag_type = 0x0;
4638 int sfrag_size = 0;
4639
4640 const uint32_t *p = get_data(rob);
4641 std::vector<const uint32_t *> pFragTmdb;
4642
4643 ATH_MSG_DEBUG( " Trying DECODER over source ID: " << MSG::hex
4644 << " 0x" << sourceid << MSG::dec
4645 << " full fragment size " << size );
4646
4647 while ( wc < size ) { // iterator over all words in a ROD
4648 // first word is the start of the tile subfragment in v3format it is 0xff1234ff
4649 if ((*p) == 0xff1234ff) b_sof=true;
4650
4651 ATH_MSG_DEBUG( " start of sub-fragment word : " << MSG::hex << (*p) << MSG::dec << " false/true : " << b_sof );
4652
4653 if (b_sof) {
4654 // second word is frag size
4655 sfrag_size = *(p + 1);
4656 // third word is frag version [31-16] and type [15-0]
4657 sfrag_version = *(p + 2) & 0xFFFF;
4658 sfrag_type = *(p + 2) >> 16;
4659 b_sof = false;
4660 }
4661 // for tmdb we will start to have three sub-fragments ordered as 0x40 0x41 0x42
4662 // we investigate if there are any of type 0x40,0x41 before going on 0x42
4663 // like this the loop is faster since we can access the size of this two sub-fragments
4664 if (sfrag_type == 0x40) {
4665 ATH_MSG_DEBUG( MSG::hex << " DECODER sub-fragment VERSION=" << sfrag_version
4666 << " TYPE=" << sfrag_type << MSG::dec
4667 << " SIZE=" << sfrag_size
4668 << " FOUND! Keep on looking for 0x42.");
4669 offset = sfrag_size;
4670 wc += offset;
4671 p += offset;
4672 } else if (sfrag_type == 0x41) {
4673 ATH_MSG_DEBUG( MSG::hex << " DECODER sub-fragment VERSION=" << sfrag_version
4674 << " TYPE=" << sfrag_type << MSG::dec
4675 <<" SIZE=" << sfrag_size
4676 << " FOUND! Keep on looking for 0x42.");
4677 offset = sfrag_size;
4678 wc += offset;
4679 p += offset;
4680 } else if (sfrag_type == 0x42) {
4681 b_deciTmdb = true;
4682 ATH_MSG_DEBUG( MSG::hex << " DECODER sub-fragment VERSION=" << sfrag_version
4683 << " TYPE=" << sfrag_type << MSG::dec
4684 << " SIZE=" <<sfrag_size << " FOUND!");
4685 wc += size - wc;
4686 p += 3;
4687 } else {
4688 ++p;
4689 ++wc;
4690 }
4691 }
4692 // the TMDB result 0x42
4693 //
4694 if (b_deciTmdb) unpack_frag42( sourceid, version, p, sfrag_size-3, cont);
4695
4696return;
4697}
void unpack_frag42(uint32_t sourceid, uint32_t version, const uint32_t *p, int size, TileMuonReceiverContainer &v) const

◆ fillTileLaserObj()

void TileROD_Decoder::fillTileLaserObj ( const ROBData * rob,
TileLaserObject & v ) const

Definition at line 3302 of file TileROD_Decoder.cxx.

3302 {
3303 // v.setBCID(-999); // TileLaserObject default tag -> Laser only if BCID != -999
3304
3305 uint32_t version = rob->rod_version() & 0xFFFF;
3306
3307 uint32_t error = 0;
3308 uint32_t wc = 0;
3309 uint32_t size = data_size(rob, error);
3310 const uint32_t * p = get_data(rob);
3311
3312 ATH_MSG_DEBUG(" Version = " << version <<
3313 " wc = " << wc <<
3314 " size = " << size <<
3315 " pointer = " << p );
3316
3317 if (!size) {
3318 ATH_MSG_DEBUG(" Nothing to unpack");
3319 return;
3320 }
3321
3322 uint32_t sizeOverhead = 2;
3323 bool V3format = (*(p) == 0xff1234ff); // additional frag marker since Sep 2005
3324 if (!V3format && version>0) {
3325 V3format = true;
3327 ATH_MSG_WARNING("fillTileLaserObj: corrupted frag separator 0x" << MSG::hex << (*p) << " instead of 0xff1234ff in ROB 0x" << rob->rod_source_id() << MSG::dec );
3328 }
3329 if (V3format) {
3330 ++p; // skip frag marker
3331 sizeOverhead = 3;
3332 } else {
3333 sizeOverhead = 2;
3334 }
3335
3336 if(V3format) ATH_MSG_DEBUG("tile flag found! size overhead = " << sizeOverhead);
3337 else ATH_MSG_DEBUG("tile flag not found! size overhead = " << sizeOverhead);
3338
3339 while (wc < size) { // iterator over all words in a ROD
3340 // first word is frag size
3341 uint32_t count = *(p);
3342 // second word is frag ID and frag type
3343 int frag = *(p + 1) & 0xFFFF;
3344 int type = *(p + 1) >> 16;
3345
3346 ATH_MSG_DEBUG( wc << " / " << size << " HEX = 0x" << MSG::hex << count << " DEC = " << MSG::dec << count << " ( FRAG , TYPE ) = " << frag << " , " << type );
3347
3348 if (count < sizeOverhead || count > size - wc) {
3349 int cnt = 0;
3350 for (; wc < size; ++wc, ++cnt, ++p) {
3351 if ((*p) == 0xff1234ff) {
3352 ATH_MSG_DEBUG( "DATA POINTER: HEX = " << MSG::hex << (*p) << " DEC = " << MSG::dec << (*p) );
3353 ++cnt;
3354 ++wc;
3355 ++p;
3356 break;
3357 }
3358 }
3359 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3360 msg(MSG::WARNING) << "Frag: " << MSG::hex << "0x" << frag << MSG::dec
3361 << " has unexpected size: " << count;
3362 if (wc < size) {
3363 msg(MSG::WARNING) << " skiping " << cnt << " words to the next frag" << endmsg;
3364 } else {
3365 msg(MSG::WARNING) << " ignoring " << cnt << " words till the end of ROD frag" << endmsg;
3366 }
3367 }
3368 continue;
3369 }
3370
3371 ATH_MSG_DEBUG( "DECODER" << " " << "FRAG=" << frag << " TYPE=" << type << " SIZE=" << size << " FOUND!" );
3372
3373 if (frag == 0x16 && type == 0x20){
3374
3375 const int LASTROD_BCID = rob->rod_bc_id();
3376 v.setBCID(LASTROD_BCID);
3377
3378 if (size>29){
3379 ATH_MSG_DEBUG("UNPACKING FRAG16");
3380 unpack_frag16(version, p, v);
3381 } else if (size>24) {
3382 ATH_MSG_DEBUG("UNPACKING NEW FRAG16");
3383 unpack_frag17(version, sizeOverhead, p, v);
3384 }
3385 }
3386
3387 if (frag == 0x17 && type == 0x20){
3388
3389 const int LASTROD_BCID = rob->rod_bc_id();
3390 v.setBCID(LASTROD_BCID);
3391
3392 ATH_MSG_DEBUG("UNPACKING FRAG17");
3393 unpack_frag17(version, sizeOverhead, p, v);
3394 } // IF
3395
3396 p += count;
3397 wc += count;
3398 }
3399
3400 if (wc != size) {
3401 // check word count
3402 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3403 ATH_MSG_WARNING("Incorrect ROD size: " << wc << " words instead of " << size );
3404 }
3405 assert(0);
3406 // return;
3407 }
3408} //end of FillLaserObj
void unpack_frag16(uint32_t version, const uint32_t *p, TileLaserObject &v) const
unpack_frag16 decodes tile subfragment type 0x16 or 0x20.
void unpack_frag17(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, TileLaserObject &v) const
unpack_frag17 decodes tile subfragment type 0x17 or 0x20.

◆ finalize()

StatusCode TileROD_Decoder::finalize ( )
virtual

Definition at line 220 of file TileROD_Decoder.cxx.

220 {
221 for (unsigned int i = 0; i < 4; ++i) {
222 m_Rw2Cell[i].clear();
223 m_Rw2Pmt[i].clear();
224 }
228 return StatusCode::SUCCESS;
229}
std::vector< int > m_Rw2Pmt[4]
void printWarningCounter(bool printIfNoWarning)
std::vector< int > m_Rw2Cell[4]
std::vector< int > m_list_of_masked_drawers
void printErrorCounter(bool printIfNoError)

◆ get_correct_data()

std::vector< uint32_t > TileROD_Decoder::get_correct_data ( const uint32_t * p) const
private

Definition at line 1083 of file TileROD_Decoder.cxx.

1083 {
1084
1085 uint32_t size = (*p) - 1; // The size of fragment - start of the Tile subfragment (in v3format it is 0xff1234ff)
1086
1087 std::vector<uint32_t> data;
1088 data.reserve(size);
1089 const uint32_t* data_end = p + size;
1090
1091 // The first 2 words (size and fragmentID with type) are correct (just copy)
1092 data.push_back(*p);
1093 data.push_back(*(++p));
1094
1095 ++p;
1096 while (p < data_end) {
1097 uint32_t ppr_size = (*p) - 2; // The size of PPr packet
1098 // The first 2 words (FELIX header) of each MD fragment are correct (just copy)
1099 data.push_back(*(p));
1100 data.push_back(*(++p));
1101
1102 ++p;
1103 std::for_each(p, p + ppr_size, [&data] (uint32_t v) {
1104 data.push_back((ntohs(v >> 16) << 16) | (ntohs(v & 0xFFFF)));
1105 });
1106
1107 p += ppr_size;
1108 }
1109
1110 return data;
1111}

◆ get_data()

const uint32_t * TileROD_Decoder::get_data ( const ROBData * rob) const
inlineprivate

Definition at line 609 of file TileROD_Decoder.h.

609 {
610 const uint32_t * p;
611 if (rob->rod_status_position()==0 &&
612 rob->rod_nstatus() + rob->rod_header_size_word() + rob->rod_trailer_size_word() >= rob->rod_fragment_size_word()) {
613 rob->rod_status(p);
614 } else {
615 rob->rod_data(p);
616 }
617 return p;
618 }

◆ getErrorCounter()

int TileROD_Decoder::getErrorCounter ( )

Definition at line 103 of file TileROD_Decoder.cxx.

103 {
104 return m_ErrorCounter;
105}

◆ getHid2re()

const TileHid2RESrcID * TileROD_Decoder::getHid2re ( )
inline

Definition at line 214 of file TileROD_Decoder.h.

214 {
215 std::lock_guard<std::mutex> lock (m_HidMutex);
216 if (!m_hid2re) initHid2re();
217 return m_hid2re;
218 }
std::mutex m_HidMutex

◆ getHid2reHLT()

const TileHid2RESrcID * TileROD_Decoder::getHid2reHLT ( )
inline

Definition at line 210 of file TileROD_Decoder.h.

210 {
211 return m_hid2reHLT;
212 }

◆ getOFW()

const uint32_t * TileROD_Decoder::getOFW ( int fragId,
int unit ) const
private

getOFW returns Optimal Filtering Weights for Frag5 decoder loaded from COOL for correspondent units.

Coefficients automatically stored in memory, thus for next calls nothing loaded again. Once loaded in memory coefficients will be kept there and freed only by destructor method.

Definition at line 4322 of file TileROD_Decoder.cxx.

4323{
4324 if (unit >> 2) {
4325 ATH_MSG_WARNING( "Wrong online reconstruction units for getOFW: unit=" << unit
4326 << " => assume unit=" << (unit & 3) );
4327 unit &= 3;
4328 }
4329
4331 size_t id = (drawerIdx << 2 | unit);
4332 const uint32_t* ofptr = m_OFPtrs[id];
4333 if (ofptr) {
4334 return ofptr;
4335 }
4336
4337 std::lock_guard<std::mutex> lock (m_OFWeightMutex);
4338 ofptr = m_OFPtrs[id];
4339 if (ofptr) {
4340 return ofptr;
4341 }
4342
4343 const EventContext &ctx = Gaudi::Hive::currentContext();
4344
4345 std::vector<uint32_t>& ofw = m_OFWeights[id];
4346
4347 ATH_MSG_DEBUG("getOFC fragId: 0x" << MSG::hex << fragId << MSG::dec << " Unit: " << unit);
4350
4351 bool of2 = true;
4352 std::vector<double> a(7), b(7), c(7), g(7), dg(7);
4353
4354 for (int ch = 0; ch < 48; ++ch) {
4355 for (int gain = 0; gain < 2; ++gain) {
4356 float phase = -m_tileToolTiming->getSignalPhase(drawerIdx, ch, gain);
4357 TileOfcWeightsStruct weights;
4358 if (m_tileCondToolOfcCool->getOfcWeights(drawerIdx, ch, gain, phase, of2, weights, ctx).isFailure())
4359 {
4360 ATH_MSG_ERROR( "getOfcWeights fails" );
4361 return nullptr;
4362 }
4363
4364 double calib = m_tileToolEmscale->channelCalibOnl(drawerIdx, ch, gain, 1.0, chan_unit);
4365
4366 if (unit != 0 && gain) calib *= 64.0;
4367
4368 for (int i = 0; i < 7; ++i) {
4369 a[i] = weights.w_a[i];
4370 b[i] = weights.w_b[i];
4371 c[i] = weights.w_c[i];
4372 g[i] = weights.g[i];
4373 dg[i] = weights.dg[i];
4374 }
4375 Format6(a, b, c, g, dg
4376 , ch // channel
4377 , 0 // phase = 0 poskol'ku ne ponyal kak okruglyat'
4378 , calib // calibration
4379 , ofw
4380 , false // verbose
4381 );
4382 } // gain
4383 } // ch
4384
4385 ofptr = m_OFPtrs[id] = ofw.data();
4386
4387 return ofptr;
4388}
bool Format6(const std::vector< double > &a, const std::vector< double > &b, const std::vector< double > &c, const std::vector< double > &g, const std::vector< double > &h, unsigned int channel_index, int phase, double calibration, std::vector< unsigned int > &OFC, bool verbose)
Format6.
Definition TileOFC.cxx:270
static unsigned int getDrawerIdxFromFragId(unsigned int fragId)
Returns a drawer hash from fragId This function assumes drawer context (i.e.
std::mutex m_OFWeightMutex
ToolHandle< TileCondToolOfcCool > m_tileCondToolOfcCool
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
ToolHandle< TileCondToolTiming > m_tileToolTiming

◆ getTileHWID()

const TileHWID * TileROD_Decoder::getTileHWID ( ) const
inline

Definition at line 187 of file TileROD_Decoder.h.

187{ return m_tileHWID;}
const TileHWID * m_tileHWID

◆ getWarningCounter()

int TileROD_Decoder::getWarningCounter ( )

Definition at line 99 of file TileROD_Decoder.cxx.

99 {
100 return m_WarningCounter;
101}

◆ hashFunc()

const TileFragHash * TileROD_Decoder::hashFunc ( ) const
inline

Definition at line 188 of file TileROD_Decoder.h.

188{ return &m_hashFunc; }

◆ initHid2re()

void TileROD_Decoder::initHid2re ( )
private

Definition at line 4267 of file TileROD_Decoder.cxx.

4267 {
4268 if (m_hid2re) return;
4269
4270 ATH_MSG_DEBUG( "initHid2re() for run " << m_fullTileRODs );
4271
4272 m_hid2re = new TileHid2RESrcID(m_tileHWID,m_fullTileRODs); // setting normal frag2RODmap and map dedicated to TMDB
4273
4274 // Check whether we want to overwrite default ROB IDs
4275
4276 SmartIF<IProperty> propertyServer{service("ByteStreamCnvSvc")};
4277 if (propertyServer) {
4278
4279 std::vector<std::string> vecProp;
4280 StringArrayProperty vecProperty("ROD2ROBmap", vecProp);
4281
4282 if (propertyServer->getProperty(&vecProperty).isSuccess()) {
4283
4284 if (vecProperty.value().size() % 2 == 1) {
4285 ATH_MSG_DEBUG( "Length of ROD2ROBmap is and odd value, "
4286 << " means that we'll scan event for all fragments to create proper map" );
4287
4288 SmartIF<IROBDataProviderSvc> robSvc{service("ROBDataProviderSvc")};
4289 if (robSvc) {
4290 const eformat::FullEventFragment<const uint32_t*> * event = robSvc->getEvent(Gaudi::Hive::currentContext());
4291 try {
4292 event->check_tree();
4293 m_hid2re->setROD2ROBmap(event, m_of2Default, msg());
4294 } catch (...) {
4295 ATH_MSG_DEBUG( "Bad event, mapping might be incomplete! " );
4296 // bad event, but process anyhow (well, till next bug report )
4297 m_hid2re->setROD2ROBmap(event, m_of2Default, msg());
4298 }
4299 }
4300 } else if (vecProperty.value().size() == 0) {
4301 ATH_MSG_DEBUG( "Length of ROD2ROBmap vector is zero, "
4302 << " means that predefined mapping for run " << m_fullTileRODs << " will be used " );
4303 } else {
4304 ATH_MSG_DEBUG( "Apply additional remapping for " << vecProperty.value().size()/2 << " fragments from jobOptions ");
4305 m_hid2re->setROD2ROBmap(vecProperty.value(), msg());
4306 }
4307 }
4308 }
4309
4310 m_hid2re->printSpecial(msg());
4311}
friend class TileHid2RESrcID
Gaudi::Property< unsigned int > m_fullTileRODs

◆ initHid2reHLT()

void TileROD_Decoder::initHid2reHLT ( )
private

Definition at line 4313 of file TileROD_Decoder.cxx.

4313 {
4314 if (m_hid2reHLT) return;
4315
4316 ATH_MSG_DEBUG( "initHid2reHLT() for run " << m_fullTileRODs );
4317
4318 m_hid2reHLT = new TileHid2RESrcID(m_tileHWID,m_fullTileRODs); // setting a frag2RODmap and map dedicated to TMDB
4319}

◆ initialize()

StatusCode TileROD_Decoder::initialize ( )
virtual

Definition at line 107 of file TileROD_Decoder.cxx.

107 {
108
109 m_rc2bytes5.setVerbose(m_verbose);
110 m_rc2bytes2.setVerbose(m_verbose);
111 m_rc2bytes.setVerbose(m_verbose);
112 m_d2Bytes.setVerbose(m_verbose);
113
114 // retrieve TileHWID helper from det store
115 ATH_CHECK( detStore()->retrieve(m_tileHWID, "TileHWID") );
116 ATH_CHECK( m_hid2RESrcIDKey.initialize() );
117
119 //=== get TileCondToolOfcCool
120 ATH_CHECK( m_tileCondToolOfcCool.retrieve() );
121
122 //=== get TileToolTiming
123 ATH_CHECK( m_tileToolTiming.retrieve() );
124 }
125 else {
126 m_tileCondToolOfcCool.disable();
127 m_tileToolTiming.disable();
128 }
129
130 //=== get TileCondToolEmscale
131 ATH_CHECK( m_tileToolEmscale.retrieve(DisableTool{m_tileToolEmscale.empty()}) );
132
133 //=== get TileBadChanTool
134 if ( m_tileBadChanTool.empty() ) {
135 m_tileBadChanTool.disable();
136 } else {
137 ATH_CHECK( m_tileBadChanTool.retrieve() );
138 }
139
140 // Tile cabling service
141 ATH_CHECK( m_cablingSvc.retrieve() );
142 const TileCablingService *cablingService = m_cablingSvc->cablingService();
143 m_maxChannels = cablingService->getMaxChannels();
144 m_runPeriod = cablingService->runPeriod();
145 std::ostringstream os;
146 if (m_runPeriod==3) {
147 if ( m_demoFragIDs.empty() ) {
148 std::vector<int> v = { 0x10d }; // LBA14 is demonstrator in RUN3
150 }
151 os << " in RUN3";
152 }
153
154 if ( !m_demoFragIDs.empty() ) {
156 os << " (frag IDs):";
157 for (int fragID : m_demoFragIDs) {
158 if (fragID>0)
159 os << " 0x" << std::hex << fragID << std::dec;
160 else
161 os << " " << fragID;
162 }
163 ATH_MSG_INFO("Enable channel remapping for demonstrator modules" << os.str());
164 }
165
166 m_Rw2Cell[0].reserve(m_maxChannels);
167 m_Rw2Cell[1].reserve(m_maxChannels);
170 m_Rw2Pmt[0].reserve(m_maxChannels);
171 m_Rw2Pmt[1].reserve(m_maxChannels);
174
175
176 ATH_CHECK( m_L2Builder.retrieve(DisableTool{m_L2Builder.empty()}) );
177
179
180 // Initialize
181 this->m_hashFunc.initialize(m_tileHWID);
182
183 this->initHid2reHLT();
184
185 // prepare remapping from channel numbers in demonstrator to channel numbers in legacy drawers
186 if (!m_demoFragIDs.empty()) {
187 for (int i=0; i<24; ++i) {
188 m_demoChanLB.push_back(i);
189 m_demoChanEB.push_back(i);
190 }
191 for (int i=24; i<48; i+=3) {
192 m_demoChanLB.push_back(i+2);
193 m_demoChanLB.push_back(i+1);
194 m_demoChanLB.push_back(i);
195 }
196 m_demoChanEB.push_back(31);
197 m_demoChanEB.push_back(32);
198 m_demoChanEB.push_back(30);
199 m_demoChanEB.push_back(35);
200 m_demoChanEB.push_back(33);
201 m_demoChanEB.push_back(34);
202 m_demoChanEB.push_back(38);
203 m_demoChanEB.push_back(37);
204 m_demoChanEB.push_back(41);
205 m_demoChanEB.push_back(40);
206 m_demoChanEB.push_back(39);
207 m_demoChanEB.push_back(36);
208 for (int i=24; i<30; ++i) {
209 m_demoChanEB.push_back(i);
210 }
211 for (int i=42; i<48; ++i) {
212 m_demoChanEB.push_back(i);
213 }
214 }
215
216 return StatusCode::SUCCESS;
217}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
int getMaxChannels(void) const
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
std::vector< int > m_demoChanEB
void updateAmpThreshold(int run=-1)
TileRawChannel2Bytes5 m_rc2bytes5
TileRawChannel2Bytes m_rc2bytes
TileDigits2Bytes m_d2Bytes
Gaudi::Property< bool > m_verbose
ServiceHandle< TileCablingSvc > m_cablingSvc
std::vector< int > m_demoChanLB
TileRawChannel2Bytes2 m_rc2bytes2
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ 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 & TileROD_Decoder::interfaceID ( )
static

AlgTool InterfaceID.

Definition at line 83 of file TileROD_Decoder.cxx.

83 {
85}
static const InterfaceID IID_ITileROD_Decoder("TileROD_Decoder", 1, 0)

◆ loadMBTS()

void TileROD_Decoder::loadMBTS ( std::map< unsigned int, unsigned int > & mapMBTS,
int MBTS_channel )

Definition at line 4261 of file TileROD_Decoder.cxx.

4261 {
4262 m_mapMBTS = mapMBTS;
4263 m_MBTS_channel = MBTS_channel;
4264 return;
4265}
std::map< unsigned int, unsigned int > m_mapMBTS

◆ loadRw2Cell()

void TileROD_Decoder::loadRw2Cell ( const int section,
const std::vector< int > & vec )
inline

Definition at line 179 of file TileROD_Decoder.h.

179 {
180 // std::cout << vec.size() << std::endl;
181 for (unsigned int i = 0; i < vec.size(); ++i) {
182 // std::cout << vec[i] << std::endl;
183 m_Rw2Cell[section].push_back(vec[i]);
184 }
185 }
std::vector< size_t > vec
void section(const std::string &sec)

◆ loadRw2Pmt()

void TileROD_Decoder::loadRw2Pmt ( const int section,
const std::vector< int > & vec )
inline

Definition at line 196 of file TileROD_Decoder.h.

196 {
197 for (unsigned int i = 0; i < vec.size(); ++i) {
198 // std::cout << vec[i] << std::endl;
199 m_Rw2Pmt[section].push_back(vec[i]);
200 }
201 }

◆ make_copy() [1/7]

void TileROD_Decoder::make_copy ( const ROBData * rob,
pBeamVec & pBeam,
TileBeamElemCollection & v ) const
inlineprivate

Definition at line 865 of file TileROD_Decoder.h.

866 {
867 copy_vec(pBeam, v);
868
869 v.setLvl1Id(rob->rod_lvl1_id());
870 v.setLvl1Type(rob->rod_lvl1_trigger_type());
871 v.setDetEvType(rob->rod_detev_type());
872 v.setRODBCID(rob->rod_bc_id());
873}
void copy_vec(std::vector< ELEMENT * > &v, COLLECTION &coll) const

◆ make_copy() [2/7]

void TileROD_Decoder::make_copy ( const ROBData * rob,
pBeamVec & pBeam,
TileCellCollection & v ) const
inlineprivate

Definition at line 890 of file TileROD_Decoder.h.

891 {
892 // do nothing
893 delete_vec(pBeam);
894}
void delete_vec(std::vector< ELEMENT * > &v) const

◆ make_copy() [3/7]

void TileROD_Decoder::make_copy ( const ROBData * rob,
pBeamVec & pBeam,
TileDigitsCollection & v ) const
inlineprivate

Definition at line 876 of file TileROD_Decoder.h.

877 {
878 // do nothing
879 delete_vec(pBeam);
880}

◆ make_copy() [4/7]

void TileROD_Decoder::make_copy ( const ROBData * rob,
pBeamVec & pBeam,
TileRawChannelCollection & v ) const
inlineprivate

Definition at line 883 of file TileROD_Decoder.h.

884 {
885 // do nothing
886 delete_vec(pBeam);
887}

◆ make_copy() [5/7]

void TileROD_Decoder::make_copy ( uint32_t bsflags,
TileFragHash::TYPE rChType,
TileRawChannelUnit::UNIT rChUnit,
DigitsMetaData_t & digitsMetaData,
RawChannelMetaData_t & rawchannelMetaData,
const ROBData * rob,
pDigiVec & pDigits,
pRwChVec & pChannel,
TileBeamElemCollection & v,
TileBeamElemContainer * container ) const
inlineprivate

Definition at line 850 of file TileROD_Decoder.h.

858{
859 // do nothing
860 delete_vec(pDigits);
861 delete_vec(pChannel);
862}

◆ make_copy() [6/7]

void TileROD_Decoder::make_copy ( uint32_t bsflags,
TileFragHash::TYPE rChType,
TileRawChannelUnit::UNIT rChUnit,
DigitsMetaData_t & digitsMetaData,
RawChannelMetaData_t & rawchannelMetaData,
const ROBData * rob,
pDigiVec & pDigits,
pRwChVec & pChannel,
TileDigitsCollection & v,
TileDigitsContainer * container ) const
inlineprivate

Definition at line 705 of file TileROD_Decoder.h.

715{
716 copy_vec(pDigits, v); // Digits stored
717
718 if (pChannel.size() > 0) { // RawChannels deleted
719 delete_vec(pChannel);
720 }
721
722 v.setLvl1Id(rob->rod_lvl1_id());
723 v.setLvl1Type(rob->rod_lvl1_trigger_type());
724 v.setDetEvType(rob->rod_detev_type());
725 v.setRODBCID(rob->rod_bc_id());
726
728 for (size_t j=0; j<digitsMetaData[6].size(); ++j) {
729 status |= digitsMetaData[6][j];
730 }
731
732 if (v.size() > 0) {
733 // Set meta data
734 v.setFragSize(digitsMetaData[0][0]);
735 v.setFragBCID(digitsMetaData[0][2] | (status<<16));
736
737 v.setFragExtraWords(digitsMetaData[1]);
738
739 v.setFragChipHeaderWords(digitsMetaData[2]);
740 v.setFragChipCRCWords(digitsMetaData[3]);
741
742 if (v.isCalibMode()) {
743 v.setFragChipHeaderWordsHigh(digitsMetaData[4]);
744 v.setFragChipCRCWordsHigh(digitsMetaData[5]);
745 }
746 if (m_verbose) v.printExtra();
747 } else if ( digitsMetaData[0].size() == 0 ) {
748 // no useful digi fragment or no data inside fragment
750 v.setFragBCID(0xDEAD | (status<<16));
751 v.setFragSize(0);
752 }
753
754 if (status!=TileFragStatus::ALL_OK)
755 ATH_MSG_DEBUG( "Status for drawer 0x" << MSG::hex << v.identify() << " in Digi frag is 0x" << status << MSG::dec);
756}
status
Definition merge.py:16

◆ make_copy() [7/7]

void TileROD_Decoder::make_copy ( uint32_t bsflags,
TileFragHash::TYPE rChType,
TileRawChannelUnit::UNIT rChUnit,
DigitsMetaData_t & digitsMetaData,
RawChannelMetaData_t & rawchannelMetaData,
const ROBData * rob,
pDigiVec & pDigits,
pRwChVec & pChannel,
TileRawChannelCollection & v,
TileRawChannelContainer * container ) const
inlineprivate

Definition at line 759 of file TileROD_Decoder.h.

769{
770 if (pChannel.size() > 0) { // take available raw channels
771 // and store in collection
772 if (container) {
773 ATH_MSG_VERBOSE( "RawChannel unit is " << rChUnit
774 << " - setting unit in TileRawChannelContainer " );
775 container->set_unit(rChUnit);
776 container->set_type(rChType);
777 container->set_bsflags(bsflags);
778 } else {
779 ATH_MSG_ERROR( "Can't set unit=" << rChUnit << " in TileRawChannelContainer" );
780 }
781
782 copy_vec(pChannel, v);
783
784 if (pDigits.size() > 0) delete_vec(pDigits); // Digits deleted
785
786 } else {
787
788 if (pDigits.size() > 0) { // convert digits to raw channels
789 // and store directly in collection
790 ATH_MSG_VERBOSE( " No reco frag in BS " );
791 //m_RCBuilder->build(pDigits.begin(),pDigits.end(),(&v));
792
793 delete_vec(pDigits); // Digits deleted
794
795 } else {
796 ATH_MSG_DEBUG( "data for drawer 0x" << MSG::hex << v.identify() << MSG::dec << " not found in BS" );
797 }
798 rawchannelMetaData[6].push_back(TileFragStatus::NO_FRAG);
799 HWIdentifier drawerID = m_tileHWID->drawer_id(v.identify());
800 for (unsigned int ch = 0; ch < m_maxChannels; ++ch) {
801 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch, 0);
802 v.push_back(new TileRawChannel(adcID, 0.0, -100.0, 31));
803 }
804
805 }
806
807 v.setLvl1Id(rob->rod_lvl1_id());
808 v.setLvl1Type(rob->rod_lvl1_trigger_type());
809 v.setDetEvType(rob->rod_detev_type());
810 v.setRODBCID(rob->rod_bc_id());
811
812 if (rChUnit < TileRawChannelUnit::OnlineOffset && rChType > TileFragHash::OptFilterDsp) { // set good status for BS from MC
813 rawchannelMetaData[0].push_back(0);
814 rawchannelMetaData[0].push_back(0xDEAD);
815 rawchannelMetaData[5].push_back(0xFFFF);
816 rawchannelMetaData[5].push_back(0xFFFF);
817 }
818
819 for (unsigned int i = 0; i < 6; ++i) {
820 for (size_t j=rawchannelMetaData[i].size(); j<2; ++j) {
821 rawchannelMetaData[i].push_back(0);
822 }
823 }
824
825 uint32_t status = (rawchannelMetaData[0][0] & 0x1) ? TileFragStatus::CRC_ERR : TileFragStatus::ALL_OK ;
826 for (size_t j=0; j<rawchannelMetaData[6].size(); ++j) {
827 status |= rawchannelMetaData[6][j];
828 }
829 if (status>TileFragStatus::CRC_ERR)
830 ATH_MSG_DEBUG( "Status for drawer 0x" << MSG::hex << v.identify() << " is 0x" << status << MSG::dec);
831
832 v.setFragGlobalCRC(status);
833 v.setFragDSPBCID(rawchannelMetaData[0][1]);
834 v.setFragBCID(rawchannelMetaData[1][0]);
835 v.setFragMemoryPar(rawchannelMetaData[1][1]);
836 v.setFragSstrobe(rawchannelMetaData[2][0]);
837 v.setFragDstrobe(rawchannelMetaData[2][1]);
838 v.setFragHeaderBit(rawchannelMetaData[3][0]);
839 v.setFragHeaderPar(rawchannelMetaData[3][1]);
840 v.setFragSampleBit(rawchannelMetaData[4][0]);
841 v.setFragSamplePar(rawchannelMetaData[4][1]);
842 v.setFragFEChipMask(rawchannelMetaData[5][0]);
843 if (std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), v.identify()))
844 v.setFragRODChipMask(rawchannelMetaData[5][0]);
845 else
846 v.setFragRODChipMask(rawchannelMetaData[5][1]);
847}
void set_bsflags(uint32_t bsflags)

◆ make_copyHLT()

uint32_t TileROD_Decoder::make_copyHLT ( bool of2,
TileRawChannelUnit::UNIT rChUnit,
bool correctAmplitude,
const FRwChVec & pChannel,
TileCellCollection & v,
const uint16_t DQuality,
D0CellsHLT & d0cells,
TileCellCollection * MBTS ) const
private

Definition at line 3581 of file TileROD_Decoder.cxx.

3589{
3590 typedef FRwChVec::const_iterator ITERATOR;
3591 // int gain = 0;
3592 float ener, time, qual = 0;
3593 TileCell* pCell;
3594 std::vector<TileCell*> cell2Double;
3595 cell2Double.reserve(23);
3596
3597 uint32_t error = 0;
3598
3599 if (DQuality == 0xffff) error |= 0x80000;
3600
3601 TileRawChannelCollection::ID frag_id = (v.identify() & 0x0FFF);
3602 int ros = (frag_id >> 8);
3603 int drawer = (frag_id & 0x3F);
3604 int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
3605 unsigned int channelIdx;
3606 unsigned int adcIdx;
3607 bool recalibrate = (rChUnit != TileRawChannelUnit::OnlineMegaElectronVolts && rChUnit != TileRawChannelUnit::MegaElectronVolts);
3608
3609 int sec = ros - 1; // 0-3 for barrel +/- and EB +/-
3610
3611 if (pChannel.size() > 0) { // convert raw channels to cells
3612
3613 // Zero all cell energies
3614 /*
3615 for (unsigned int cell = 0; cell < v.size(); ++cell) {
3616 ((TileCell*) v[cell])->setEnergy_nonvirt(0.0F, 0.0F, 0, CaloGain::INVALIDGAIN);
3617 ((TileCell*) v[cell])->setTime_nonvirt(-100.0F); // Just to mark a non-initialized cell
3618 ((TileCell*) v[cell])->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 0);
3619 ((TileCell*) v[cell])->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 1);
3620 }
3621 */
3622
3623 for (TileCell* cell : v) {
3624 cell->setEnergy_nonvirt(0.0F, 0.0F, 0, CaloGain::INVALIDGAIN);
3625 cell->setTime_nonvirt(-100.0F); // Just to mark a non-initialized cell
3626 cell->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 0);
3627 cell->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 1);
3628 }
3629
3630
3631 int idxraw = drawer * m_maxChannels;
3632
3633 ITERATOR rawItr = pChannel.begin();
3634 ITERATOR end = pChannel.end();
3635
3636 if (sec < 2) { // special treatment of first PMT in pos/neg barrel which belongs to D0 cell
3637 idxraw = 0;
3638 channelIdx = rawItr->channel();
3639 bool no_dmu_mask = true;
3640 if (DQuality) {
3641 if (DQuality >> (channelIdx / 3) & 0x1) no_dmu_mask = false;
3642 }
3643
3644 adcIdx = rawItr->adc();
3645 qual = rawItr->quality();
3646 bool do_mask = false;
3647 if ((qual < QUALITY_THRESHOLD) && no_dmu_mask) {
3648 ener = rawItr->amplitude();
3649 time = rawItr->time();
3650 // FIXME:: To speed up HLT processing we keep OnlineMegaElectronVolts
3651 // but this means that we can end up with different units (online or offline)
3652 if (recalibrate && ener!=0.0F) {
3653 ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, rChUnit,
3655 }
3656 // parabolic correction for good but slightly out-of-time signals
3657 if (correctAmplitude) {
3658 if (time<m_allowedTimeMin || time>m_allowedTimeMax) {
3659 ener = 0.0F;
3660 time = 0.0F;
3661 } else if (ener > m_ampMinThresh_MeV
3662 && time > m_timeMinThresh
3663 && time < m_timeMaxThresh) {
3664 ener *= TileRawChannelBuilder::correctAmp(time,of2);
3665 }
3666 }
3667 } else {
3668 // ignore energy from bad channel
3669 ener = 0.0F;
3670 time = 0.0F;
3671 do_mask = true;
3672 }
3673
3674 if (sec > 0) { // sec=1 - negative
3675 d0cells.m_D0channeg[drawer].set(channelIdx, adcIdx, ener, time, qual);
3676 d0cells.m_D0Existneg[drawer] = true;
3677 d0cells.m_D0Maskneg[drawer] = do_mask;
3678 } else { // sec=0 - positive
3679 d0cells.m_D0chanpos[drawer].set(channelIdx, adcIdx, ener, time, qual);
3680 d0cells.m_D0Existpos[drawer] = true;
3681 d0cells.m_D0Maskpos[drawer] = do_mask;
3682 }
3683 ++rawItr; // done with first channel in barrel, go to second
3684 ++idxraw;
3685 }
3686
3687 int MBTS_chan=((ros>2)?-1:43);
3688
3689 for (; rawItr != end; ++rawItr) {
3690 const TileFastRawChannel* rawPtr = &*rawItr;
3691 const int rw2cell = m_Rw2Cell[sec][idxraw];
3692 if (rw2cell != -1) {
3693 // Get Variables
3694 pCell = v[rw2cell];
3695 channelIdx = rawPtr->channel();
3696 bool no_dmu_mask = true;
3697 if (DQuality) {
3698 if (DQuality >> (channelIdx / 3) & 0x1) no_dmu_mask = false;
3699 }
3700 adcIdx = rawPtr->adc();
3701 qual = rawPtr->quality();
3702 time = 0.0F;
3703 if (no_dmu_mask && (qual < QUALITY_THRESHOLD)) {
3704 // gain = adcIdx;
3705 ener = rawPtr->amplitude();
3706 time = rawPtr->time();
3707 // FIXME:: To speed up HLT processing we keep OnlineMegaElectronVolts
3708 // but this means that we can end up with different units (online or offline)
3709 if (recalibrate && ener!=0.0F) {
3710 ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, rChUnit,
3712 }
3713 // parabolic correction for good but slightly out-of-time signals
3714 if (correctAmplitude) {
3715 if (time<m_allowedTimeMin || time>m_allowedTimeMax) {
3716 ener = 0.0F;
3717 time = 0.0F;
3718 } else if (ener > m_ampMinThresh_MeV
3719 && time > m_timeMinThresh
3720 && time < m_timeMaxThresh) {
3721 ener *= TileRawChannelBuilder::correctAmp(time,of2);
3722 }
3723 }
3724 unsigned char qbit = qbitfun(time,m_allowedTimeMin,m_allowedTimeMax);
3725 if (pCell->time() != -100.0F) pCell->setTime(time, m_Rw2Pmt[sec][idxraw]);
3726 else pCell->setTime_nonvirt(time);
3727
3728 pCell->setQuality_nonvirt(std::min(255, abs((int) qual)), qbit, m_Rw2Pmt[sec][idxraw]);
3729 pCell->addEnergy(ener, m_Rw2Pmt[sec][idxraw], adcIdx);
3730
3731 if (pCell->caloDDE()->onl2() == TileHWID::NOT_VALID_HASH)
3732 pCell->setQuality_nonvirt(0, 0, 1);
3733
3734 } else if (pCell->caloDDE()->onl2() != TileHWID::NOT_VALID_HASH) {
3735 pCell->addEnergy(0.0F, m_Rw2Pmt[sec][idxraw], 0U);
3736 pCell->setQuality_nonvirt((unsigned char) 255, 0, m_Rw2Pmt[sec][idxraw]);
3737 cell2Double.push_back(pCell); // have to double later
3738 } else { // Mask it here for Gap
3739 // (pCell)->setEnergy_nonvirt(0.0F, 0.0F, 0, CaloGain::INVALIDGAIN);
3740 pCell->setTime_nonvirt(0.0F);
3741 pCell->setQuality_nonvirt(static_cast<unsigned char>(qual), 0, 1);
3742 }
3743 } else if (MBTS_chan<0) MBTS_chan=rawPtr->channel();// end of if
3744 ++idxraw;
3745 //if ( DQuality ) idxraw1++;
3746 } // End of for TileRawChannel
3747
3748 if (MBTS_chan==4) { // assign zero energy and high gain to second PMT in special C10
3749 pCell = v[m_Rw2Cell[sec][5]]; // find cell with channel 5 connected
3750 pCell->addEnergy(0., 1-m_Rw2Pmt[sec][5], 1);
3751 }
3752
3753 if (MBTS && MBTS_chan >= 0) {
3754 auto it = m_mapMBTS.find (frag_id);
3755 unsigned int idx = it != m_mapMBTS.end() ? it->second : 0u;
3756 if (idx < (*MBTS).size()) { // MBTS present (always last channel)
3757 TileCell* pCell = (*MBTS)[idx];
3758 const TileFastRawChannel& rawCh = pChannel[MBTS_chan];
3759 channelIdx = rawCh.channel();
3760 adcIdx = rawCh.adc();
3761 float ener = rawCh.amplitude();
3762 float time = rawCh.time();
3763 float qual = rawCh.quality();
3764 if (qual < QUALITY_THRESHOLD) {
3765 if (rChUnit==TileRawChannelUnit::MegaElectronVolts) { // go back to pC - not standard configuration
3766 ener /= m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, 1.0, // calibrate to PicoCoulombs
3768 } else {
3769 ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, // calibrate to PicoCoulombs
3771 }
3772 // parabolic correction for good but slightly out-of-time signals
3773 if (correctAmplitude) {
3774 if (time<m_allowedTimeMin || time>m_allowedTimeMax) {
3775 ener = 0.0F;
3776 time = 0.0F;
3777 } else if (ener > m_ampMinThresh_pC
3778 && time > m_timeMinThresh
3779 && time < m_timeMaxThresh) {
3780 ener *= TileRawChannelBuilder::correctAmp(time,of2);
3781 }
3782 }
3783 } else {
3784 // ignore energy from bad channel
3785 ener = 0.0F;
3786 time = -100.0F;
3787 }
3788 pCell->setEnergy(ener, 0.0F);
3789 pCell->setTime_nonvirt(time);
3790 unsigned char qbit = qbitfun(time,m_allowedTimeMin,m_allowedTimeMax);
3791 pCell->setQuality_nonvirt(std::min(255, abs((int) qual)), qbit, 0);
3792 } // End of if idx
3793
3794 } // End of if MBTS
3795
3796 } // end of if vec<TileRawChannel>::size > 0)
3797
3798 for (std::vector<TileCell*>::const_iterator d_it = cell2Double.begin();
3799 d_it != cell2Double.end(); ++d_it) {
3800
3801 // int gain = 0;
3802 // if ((*d_it)->gain1() == 1 || (*d_it)->gain2() == 1) gain = 1;
3803 int gain = (*d_it)->gain1() | (*d_it)->gain2();
3804 unsigned char qual = (*d_it)->qual1() & (*d_it)->qual2();
3805
3806 float ener = (*d_it)->e();
3807 float time = (*d_it)->time();
3808 unsigned char qbit = qbitfun(time,m_allowedTimeMin,m_allowedTimeMax);
3809
3810 (*d_it)->setEnergy_nonvirt(ener, ener, gain, gain);
3811 (*d_it)->setQuality_nonvirt(qual, qbit, 0);
3812 (*d_it)->setQuality_nonvirt(qual, qbit, 1);
3813 if (time == -100.0F) (*d_it)->setTime_nonvirt(0.0F);
3814 }
3815
3816 return error;
3817}
unsigned char qbitfun(float t, float a, float b)
const float QUALITY_THRESHOLD
float time() const
get time (data member)
Definition CaloCell.h:368
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
IdentifierHash onl2() const
cell online identifier 2
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
void setQuality_nonvirt(unsigned char qual, unsigned char qbit, int pmt)
Definition TileCell.h:272
void addEnergy(float e, int pmt, int gain)
set energy and gain for one PMT
Definition TileCell.cxx:145
void setTime_nonvirt(float t)
Definition TileCell.h:244
virtual void setEnergy(float ene) override final
set total energy, reset eneDiff to zero (final override of CaloCell method)
Definition TileCell.cxx:123
virtual void setTime(float t) override final
set cell time, reset timeDiff
Definition TileCell.h:251
unsigned int adc(void) const
float time(void) const
float quality(void) const
float amplitude(void) const
unsigned int channel(void) const
@ NOT_VALID_HASH
Definition TileHWID.h:314
Gaudi::Property< float > m_allowedTimeMin
Gaudi::Property< float > m_timeMinThresh
Gaudi::Property< float > m_allowedTimeMax
Gaudi::Property< float > m_timeMaxThresh
static double correctAmp(double phase, bool of2=true)
Amplitude correction factor according to the time when using weights for tau=0 without iterations.
@ INVALIDGAIN
Definition CaloGain.h:18
time(flags, cells_name, *args, **kw)
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

◆ mergeD0cellsHLT()

void TileROD_Decoder::mergeD0cellsHLT ( const D0CellsHLT & d0cells,
TileCellCollection & v ) const

Definition at line 4192 of file TileROD_Decoder.cxx.

4194{
4195 TileRawChannelCollection::ID frag_id = (v.identify() & 0x0FFF);
4196 int ros = (frag_id >> 8);
4197 bool barrel ( (ros==1) || (ros==2) );
4198 if ( !barrel ) return; // Only in barrel
4199 int drawer = (frag_id & 0xFF);
4200 TileCell* pCell = d0cells.m_cells[drawer];
4201 if ( !pCell ) return;
4202
4203 if (d0cells.m_D0Maskpos[drawer] && d0cells.m_D0Maskneg[drawer]) {
4204
4205 // both channels are bad - mask whole cell
4206 (pCell)->setEnergy_nonvirt(0.0F, 0.0F, 0, 0);
4207 (pCell)->setTime_nonvirt(0.0F);
4208 (pCell)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 0);
4209 (pCell)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 1);
4210
4211 } else if (d0cells.m_D0Maskpos[drawer]) {
4212
4213 // first(positive) channel is bad, second(negative) is good
4214 float amp2 = d0cells.m_D0channeg[drawer].amplitude();
4215 float time2 = d0cells.m_D0channeg[drawer].time();
4216 int gain2 = d0cells.m_D0channeg[drawer].adc();
4217 unsigned char qual2 = d0cells.m_D0channeg[drawer].quality();
4218 unsigned char qbit2 = qbitfun(time2,m_allowedTimeMin,m_allowedTimeMax);
4219
4220 (pCell)->setEnergy(amp2, amp2, gain2, gain2);
4221 (pCell)->setTime(time2);
4222 (pCell)->setQuality(qual2, qbit2, 0);
4223 (pCell)->setQuality(qual2, qbit2, 1);
4224
4225 } else {
4226
4227 // first(positive) channel is good
4228 float amp1 = d0cells.m_D0chanpos[drawer].amplitude();
4229 float time1 = d0cells.m_D0chanpos[drawer].time();
4230 int gain1 = d0cells.m_D0chanpos[drawer].adc();
4231 unsigned char qual1 = d0cells.m_D0chanpos[drawer].quality();
4232 unsigned char qbit1 = qbitfun(time1,m_allowedTimeMin,m_allowedTimeMax);
4233
4234 if (d0cells.m_D0Maskneg[drawer]) {
4235
4236 // second channel is bad, first is good
4237 (pCell)->setEnergy(amp1, amp1, gain1, gain1);
4238 (pCell)->setTime(time1);
4239 (pCell)->setQuality(qual1, qbit1, 0);
4240 (pCell)->setQuality(qual1, qbit1, 1);
4241
4242 } else {
4243
4244 // second(negative) channel is good
4245 float amp2 = d0cells.m_D0channeg[drawer].amplitude();
4246 float time2 = d0cells.m_D0channeg[drawer].time();
4247 int gain2 = d0cells.m_D0channeg[drawer].adc();
4248 unsigned char qual2 = d0cells.m_D0channeg[drawer].quality();
4249 unsigned char qbit2 = qbitfun(time2,m_allowedTimeMin,m_allowedTimeMax);
4250
4251 // both channels are good
4252 (pCell)->setEnergy(amp1, amp2, gain1, gain2);
4253 (pCell)->setTime(time1);
4254 (pCell)->setTime(time2, 1);
4255 (pCell)->setQuality(qual1, qbit1, 0);
4256 (pCell)->setQuality(qual2, qbit2, 1);
4257 }
4258 }
4259}

◆ 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.

◆ printErrorCounter()

void TileROD_Decoder::printErrorCounter ( bool printIfNoError)

Definition at line 93 of file TileROD_Decoder.cxx.

93 {
94 if (printIfNoError || m_ErrorCounter > 0) {
95 ATH_MSG_WARNING( "Found " << m_ErrorCounter << " errors in decoding words");
96 }
97}

◆ printWarningCounter()

void TileROD_Decoder::printWarningCounter ( bool printIfNoWarning)

Definition at line 87 of file TileROD_Decoder.cxx.

87 {
88 if (printIfNoWarning || m_WarningCounter > 0) {
89 ATH_MSG_WARNING( "Found " << m_WarningCounter << " warnings in decoding words");
90 }
91}

◆ 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 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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setLaserVersion()

void TileROD_Decoder::setLaserVersion ( TileLaserObject & laserObject) const
inline

Definition at line 175 of file TileROD_Decoder.h.

175 {
176 laserObject.setVersion((m_runPeriod >= 2) ? -2 : -1);
177 }
void setVersion(const int version)

◆ setUseFrag0()

void TileROD_Decoder::setUseFrag0 ( bool f)
inline

Definition at line 220 of file TileROD_Decoder.h.

◆ setUseFrag1()

void TileROD_Decoder::setUseFrag1 ( bool f)
inline

Definition at line 221 of file TileROD_Decoder.h.

221{ m_useFrag1 = f; }

◆ setUseFrag4()

void TileROD_Decoder::setUseFrag4 ( bool f)
inline

Definition at line 222 of file TileROD_Decoder.h.

222{ m_useFrag4 = f; }

◆ setUseFrag5Raw()

void TileROD_Decoder::setUseFrag5Raw ( bool f)
inline

Definition at line 223 of file TileROD_Decoder.h.

223{ m_useFrag5Raw = f; }

◆ setUseFrag5Reco()

void TileROD_Decoder::setUseFrag5Reco ( bool f)
inline

Definition at line 224 of file TileROD_Decoder.h.

224{ m_useFrag5Reco = f; }

◆ 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 >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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.

◆ unpack_brod()

void TileROD_Decoder::unpack_brod ( uint32_t version,
uint32_t sizeOverhead,
const uint32_t * p,
pBeamVec & pBeam,
int fragID ) const
private

unpack_brod decodes all ancillary tile subfragments coming from beam ROD at the testbeam or LASTROD in normal ATLAS configuration

Definition at line 2788 of file TileROD_Decoder.cxx.

2793{
2794 // first word is frag size
2795 int count = *(p);
2796 // second word is frag ID and frag type
2797 uint32_t idAndType = *(p + 1);
2798 int bs_frag = idAndType & 0xFFFF;
2799 bool is16ChannelType = (idAndType >> 16) & 1; // V775N, V792N
2800 bool is32ChannelType = (idAndType >> 17) & 1; // V775, V792
2801
2802 p += 2; // 2 words so far
2803 int datasize = count - sizeOverhead; // can be 2 or 3 words less
2804
2805 if (msgLvl(MSG::VERBOSE)) {
2806 msg(MSG::VERBOSE) << "Unpacking Beam Elements, ID=0x" << MSG::hex << frag_id << " BS frag=0x" << bs_frag
2807 << ", size=" << MSG::dec << datasize;
2808 for (int ch = 0; ch < datasize; ++ch) {
2809 if (0 == ch % 8) msg(MSG::VERBOSE) << endmsg;
2810 msg(MSG::VERBOSE) << p[ch] << " ";
2811 }
2812 msg(MSG::VERBOSE) << endmsg;
2813 }
2814
2815 if (datasize <= 0) return;
2816
2817 int frag = (frag_id>=0) ? frag_id : bs_frag;
2818 frag &= 0xff; // reset upper byte, because it's different in 2003 and 2004
2819 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
2820 TileBeamElem* rc;
2821
2822 switch (bs_frag) {
2823
2824 /* ************************************************************************************* */
2825 /* LeCroy 1176 16bit 1ns TDC FRAG in Tile Beam crate or in Common Beam crate */
2826 case BEAM_TDC_FRAG:
2827 case COMMON_TDC1_FRAG:
2828 case COMMON_TDC2_FRAG: {
2829 if (!(is16ChannelType || is32ChannelType)) {
2830 uint32_t prev = 0xFF;
2831 std::vector<uint32_t> adc;
2832 for (int c = 0; c < datasize; ++c) {
2833 uint32_t time = *p & 0xFFFF;
2834 uint32_t flag = *p >> 16;
2835 uint32_t chan = (flag >> 1) & 0x0F;
2836 uint32_t bad = (flag >> 5) & 0x01;
2837 if (!bad) {
2838 if (prev != 0xFF) {
2839 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, prev, 0);
2840 rc = new TileBeamElem(adcID, adc);
2841 pBeam.push_back(rc);
2842 adc.clear();
2843 }
2844 prev = chan;
2845 }
2846 adc.push_back(time);
2847 ++p;
2848 }
2849 if (prev != 0xFF) {
2850 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, prev, 0);
2851 rc = new TileBeamElem(adcID, adc);
2852 pBeam.push_back(rc);
2853 }
2854 break;
2855 }
2856 // Fall through to default
2857 [[fallthrough]]; // silent the warning on fall through
2858 }
2859
2860 /* ************************************************************************************* */
2861 /* CAEN V775 or V775N 12 bit TDC (1count=35psec) in common beam crate */
2862 case COMMON_TOF_FRAG: {
2863
2864 uint32_t prev = 0xFF;
2865 std::vector<uint32_t> adc;
2866 for (int c = 0; c < datasize; ++c) {
2867 uint32_t chan = is16ChannelType ? (*p >> 17) & 0x3FF // take 10 bits, but 6 upper bits should be 0
2868 : (*p >> 16) & 0x7FF; // take 11 bits, but 6 upper bits should be 0
2869 if (chan > 31) {
2870 continue; // skip header or end of block
2871 }
2872 uint32_t time = *p & 0x1FFF; // uppermost bit is overflow flag
2873 if (prev != chan && ((is16ChannelType && chan < 16) || (is32ChannelType && chan < 32))) {
2874 if (prev != 0xFF) { // channel >= 32 can be only in corrupted data
2875 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, prev, 0);
2876 rc = new TileBeamElem(adcID, adc);
2877 pBeam.push_back(rc);
2878 adc.clear();
2879 }
2880 prev = chan;
2881 }
2882 adc.push_back(time);
2883 ++p;
2884 }
2885 if ((is16ChannelType && prev < 16) || (is32ChannelType && prev < 32)) {
2886 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, prev, 0);
2887 rc = new TileBeamElem(adcID, adc);
2888 pBeam.push_back(rc);
2889 }
2890 }
2891 break;
2892
2893 /* ************************************************************************************* */
2894 /* ADDERS FRAG */
2895 case ADD_FADC_FRAG: {
2896
2897 uint32_t val, channel[16][16];
2898 int nmodule = 4, nchan, nsamp, ch;
2899
2900 nchan = nmodule * 4;
2901 nsamp = datasize / nmodule;
2902
2903 ATH_MSG_VERBOSE(" Adders: nmod=" << nmodule << ", nchan=" << nchan
2904 << ", nsamp=" << nsamp);
2905
2906 if (nmodule * nsamp == datasize) {
2907 /* Unpack DATA */
2908 for (int m = 0; m < nmodule; ++m) {
2909 /* extract all samples for 4 channels in the module */
2910 for (int s = 0; s < nsamp; ++s) {
2911 val = *p;
2912 for (int c = 0; c < 4; ++c) {
2913 ch = m * 4 + c;
2914 if (ch < nchan)
2915 channel[ch][s] = val & 0xFF;
2916 val >>= 8;
2917 }
2918 ++p;
2919 }
2920 }
2921 /* ***** */
2922 for (ch = 0; ch < nchan; ++ch) {
2923 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch, 0);
2924 std::vector<uint32_t> adc;
2925 adc.reserve(nsamp);
2926 for (int s = 0; s < nsamp; ++s) {
2927 adc.push_back(channel[ch][s]);
2928 }
2929 rc = new TileBeamElem(adcID, adc);
2930 pBeam.push_back(rc);
2931 }
2932 } else {
2933 ATH_MSG_WARNING("unpack_brod => Unexpected Adders size: " << MSG::dec
2934 << datasize);
2935 return;
2936 }
2937 } break;
2938
2939#ifndef LASER_OBJ_FRAG
2940#define LASER_OBJ_FRAG 0x016
2941#endif
2942#ifndef LASER2_OBJ_FRAG
2943#define LASER2_OBJ_FRAG 0x017
2944#endif
2945
2946 case LASER_OBJ_FRAG:
2947 case LASER2_OBJ_FRAG: {
2948
2949 std::vector<uint32_t> digits;
2950 for (int ch = 0; ch < datasize; ++ch) {
2951 digits.push_back((*p));
2952 ++p;
2953 }
2954 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, 0, 0);
2955 rc = new TileBeamElem(adcID, digits);
2956 pBeam.push_back(rc);
2957 }
2958 break;
2959
2960 /* ************************************************************************************* */
2961 /* CAEN V792 or V792N 12 bit ADC in common beam crate */
2962 case COMMON_ADC1_FRAG:
2963 case COMMON_ADC2_FRAG: {
2964
2965 if (is16ChannelType || is32ChannelType) {
2966 uint32_t prev = 0xFF;
2967 std::vector<uint32_t> adc;
2968 for (int c = 0; c < datasize; ++c) {
2969 uint32_t chan = is16ChannelType ? (*p >> 17) & 0x3FF // take 10 bits, but 6 upper bits should be 0
2970 : (*p >> 16) & 0x7FF; // take 11 bits, but 6 upper bits should be 0
2971
2972 if (chan > 31) {
2973 continue; // skip header or end of block
2974 }
2975 uint32_t amplitude = *p & 0x1FFF; // uppermost bit is overflow flag
2976 if (prev != chan && ((is16ChannelType && chan < 16) || (is32ChannelType && chan < 32))) {
2977 if (prev != 0xFF) { // channel >= 32 can be only in corrupted data
2978 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, prev, 0);
2979 rc = new TileBeamElem(adcID, adc);
2980 pBeam.push_back(rc);
2981 adc.clear();
2982 }
2983 prev = chan;
2984 }
2985 adc.push_back(amplitude);
2986 ++p;
2987 }
2988 if ((is16ChannelType && prev < 16) || (is32ChannelType && prev < 32)) {
2989 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, prev, 0);
2990 rc = new TileBeamElem(adcID, adc);
2991 pBeam.push_back(rc);
2992 }
2993 break;
2994 }
2995 // Fall through to default
2996 [[fallthrough]]; // silent the warning on fall through
2997 }
2998
2999 /* ************************************************************************************* */
3000 /* OTHER FRAGS: ONE WORD = ONE CHANNEL */
3001 default: {
3002
3003 int chmax = (datasize > 16) ? 15 : datasize;
3004 for (int ch = 0; ch < chmax; ++ch) {
3005 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch, 0);
3006 rc = new TileBeamElem(adcID, (*p));
3007 pBeam.push_back(rc);
3008 ++p;
3009 }
3010 if (chmax != datasize) {
3011 std::vector<uint32_t> digits;
3012 for (int ch = chmax; ch < datasize; ++ch) {
3013 digits.push_back((*p));
3014 ++p;
3015 }
3016 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, chmax, 0);
3017 rc = new TileBeamElem(adcID, digits);
3018 pBeam.push_back(rc);
3019 }
3020 }
3021 break;
3022 }
3023
3024 return;
3025}
static Double_t rc
#define LASER2_OBJ_FRAG
#define LASER_OBJ_FRAG
Definition TileTBFrag.h:49
#define COMMON_TDC2_FRAG
Definition TileTBFrag.h:47
#define COMMON_ADC1_FRAG
Definition TileTBFrag.h:43
#define COMMON_ADC2_FRAG
Definition TileTBFrag.h:44
#define COMMON_TDC1_FRAG
Definition TileTBFrag.h:46
#define BEAM_TDC_FRAG
Definition TileTBFrag.h:23
#define COMMON_TOF_FRAG
Definition TileTBFrag.h:45
#define ADD_FADC_FRAG
Definition TileTBFrag.h:29
bool flag
Definition master.py:29

◆ unpack_frag0()

void TileROD_Decoder::unpack_frag0 ( uint32_t version,
uint32_t sizeOverhead,
DigitsMetaData_t & digitsMetaData,
const uint32_t * p,
pDigiVec & pDigits,
int frag_id,
int drawer_type ) const
private

unpack_frag0 decodes tile subfragment type 0x0.

Unpack TileDigits stored in ROD.

This subfragment contains the tile raw digits from the 48 read-out channels of a tilecal module.

Assume that mode (calib/normal) is the same for every invocation.

Definition at line 246 of file TileROD_Decoder.cxx.

250 {
251 int gain = 0;
252 int n;
253
254 // pointer to current data word
255 const uint32_t *data;
256 // current chip #
257 int chip;
258 // channel #
259 int channel;
260
261 // first word is full frag size, first two words are not data
262 int size = *(p) - sizeOverhead;
263 // second word is frag ID (0x100-0x4ff) and frag type
264 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
265 bool remap = (drawer_type > 0) || std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), frag);
266 const std::vector<int> & chmap = (frag<0x300) ? m_demoChanLB : m_demoChanEB;
267
268 // Position of first data word, ignore 2 frag header words
269 data = p + 2;
270
273
274 for (int i = 0; i < size; ++i) {
275 uint32_t w = data[i];
276 if (allFF && w!=0xFFFFFFFF) {
278 if (all00 == TileFragStatus::ALL_OK) break;
279 }
280 if (all00 && w != 0) {
282 if (allFF == TileFragStatus::ALL_OK) break;
283 }
284 }
285
286 uint32_t status = (all00 | allFF);
287 digitsMetaData[6].push_back( status );
288
289 // check that fragment is not dummy
291 return; // nothing reasonable found
292 }
293
294 // if (msgLvl(MSG::VERBOSE))
295 // msg(MSG::VERBOSE) << "version=" << version << " size: " << (*p) << " " << size;
296 if (sizeOverhead == 2 && (version == 0x2 || version == 0x1)) { /* can not guess number of samples from size */
297 if (size > 178 && size < 205)
298 size = 179; /* we expect this number (9+2)*16+2 */
299 else if (size > 274 && size < 405) size = 275; /* we expect this number (7*2+3)*16+2 */
300 ++data; // ignore first word coming from drawer
301 }
302
303 // if (msgLvl(MSG::VERBOSE))
304 // msg(MSG::VERBOSE) << size << endmsg;
305
306 // number of chips in the data, only 16 is expected
307 int chipCount = 16;
308 // one chip contains 3 channels
309 int channelCount = chipCount * 3;
310 // size of 'block'. In normal mode one block is header and chipCount words with samples and CRC word
311 // In calib mode one block is header word, <chipCount> low gain samples, header, <chipCount> high gain and CRC word
312 int blockSize = size / chipCount;
313 // deplacement of high gain samples in calib mode
314 int gainOffset = 0;
315 // calculate number of words per chip including header and excluding CRC
316 int wordsPerChip = 0;
317 // number of data words per chip, excluding header and CRC
318 int dataWordsPerChip = 0;
319 // real number of channels and chips
320 // int channelCountReal,chipCountReal;
321
322 // Digitizer mode doesn't change between events
323 static std::atomic<int> savedDigiMode = -1;
324
325 int digiMode = savedDigiMode;
326
327 if (digiMode < 0 && size > 0) { // try to find digi mode until good mode is found
328 digiMode = m_d2Bytes.getDigiMode(data, chipCount, blockSize);
329 savedDigiMode = digiMode;
330 }
331
332 if (digiMode > 0 || (digiMode < 0 && blockSize == 17)) {
333 // calibration mode
334 // 2X number of chips
335 // chipCount <<= 1;
336 // channelCount = chipCount*3;
337
338 // lengt with header and without CRC
339 wordsPerChip = (blockSize - 1) / 2;
340 // lengt without header and CRC
341 dataWordsPerChip = wordsPerChip - 1;
342
343 //channelCountReal = channelCount/2;
344 //chipCountReal = chipCount/2;
345
346 gainOffset = wordsPerChip;
347 } else {
348 // assume normal mode
349 // block contains one CRC word
350 wordsPerChip = blockSize - 1;
351 // one header word
352 dataWordsPerChip = wordsPerChip - 1;
353
354 // channelCountReal = channelCount;
355 // chipCountReal = chipCount;
356 }
357
358 if (msgLvl(MSG::VERBOSE)) {
359 msg(MSG::VERBOSE) << "Unpacking TileDigits, ID=0x" << MSG::hex << frag
360 << ", size=" << MSG::dec << size << endmsg;
361
362 msg(MSG::VERBOSE) << " chips=" << chipCount << endmsg;
363 msg(MSG::VERBOSE) << " channels=" << channelCount << endmsg;
364 msg(MSG::VERBOSE) << " block size=" << blockSize << endmsg;
365 msg(MSG::VERBOSE) << " words/chip=" << wordsPerChip << endmsg;
366 msg(MSG::VERBOSE) << " data/chip=" << dataWordsPerChip << endmsg;
367 msg(MSG::VERBOSE) << " gain offs=" << gainOffset << endmsg;
368 msg(MSG::VERBOSE) << " mode=" << digiMode << endmsg;
369 }
370
371 if (size == 0) {
372 ATH_MSG_VERBOSE( "Size is 0, no digits extracted" );
373 return;
374 }
375
376 TileDigits *td;
377 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
378 HWIdentifier adcID;
379 std::array< std::vector<float>, 3 > digiVec;
380
381 // take BCID from chip header with good parity
382 uint32_t bcid = m_d2Bytes.getBCID(data, chipCount, blockSize);
383
384 if (gainOffset > 0) {
385 // calibration mode
386 pDigits.reserve(96);
387 std::vector<uint32_t>& chipHeaderLow = digitsMetaData[2];
388 std::vector<uint32_t>& chipCRCLow = digitsMetaData[3];
389 std::vector<uint32_t>& chipHeaderHigh = digitsMetaData[4];
390 std::vector<uint32_t>& chipCRCHigh = digitsMetaData[5];
391
392 // loop through all chips
393 for (chip = 0; chip < chipCount; ++chip) {
394 ATH_MSG_VERBOSE( "Unpacking calib data for chip " << chip );
395
396 // Extract low gain digits for fragment
397 digiVec = m_d2Bytes.getDigits(data + 1, dataWordsPerChip);
398
399 for (n = 0; n < 3; ++n) {
400 // calc channel #
401 channel = chip * 3 + n;
402 if (remap) channel = chmap[channel];
403 // create ID
404 adcID = m_tileHWID->adc_id(drawerID, channel, TileHWID::LOWGAIN);
405
406 td = new TileDigits(adcID, digiVec[n]);
407 pDigits.push_back(td);
408
409 }
410 if (remap) std::sort(pDigits.end()-3,pDigits.end(),chan_order);
411
412 // Extract high gain digits for fragment
413 digiVec = m_d2Bytes.getDigits(data + 1 + gainOffset, dataWordsPerChip);
414
415 for (n = 0; n < 3; ++n) {
416 // calc channel #
417 channel = chip * 3 + n;
418 if (remap) channel = chmap[channel];
419 // create ID
420 adcID = m_tileHWID->adc_id(drawerID, channel, TileHWID::HIGHGAIN);
421
422 td = new TileDigits(adcID, digiVec[n]);
423 pDigits.push_back(td);
424
425 }
426 if (remap) std::sort(pDigits.end()-3,pDigits.end(),chan_order);
427
428 // store metadata
429 chipHeaderLow.push_back(*data);
430 chipCRCLow.push_back(*(data + gainOffset - 1));
431 chipHeaderHigh.push_back(*(data + gainOffset));
432 chipCRCHigh.push_back(*(data + blockSize - 1));
433
434 // next block
435 data += blockSize;
436 }
437 } else {
438 // Normal mode
439 pDigits.reserve(pDigits.size() + 48);
440 std::vector<uint32_t>& chipHeader = digitsMetaData[2];
441 std::vector<uint32_t>& chipCRC = digitsMetaData[3];
442
443 // loop through all chips
444 for (chip = 0; chip < chipCount; ++chip) {
445 // Extract digits for fragment
446 digiVec = m_d2Bytes.getDigits(data + 1, dataWordsPerChip);
447
448 ATH_MSG_VERBOSE( "Header $" << MSG::hex << (*data)
449 << " CRC $" << *(data + blockSize - 1) );
450
451 for (n = 0; n < 3; ++n) {
452 // calc channel #
453 channel = chip * 3 + n;
454 if (remap) channel = chmap[channel];
455 // get gain from chip header
456 gain = m_d2Bytes.getGain(data, n);
457 // create ID
458 adcID = m_tileHWID->adc_id(drawerID, channel, gain);
459 td = new TileDigits(adcID, digiVec[n]);
460
461 ATH_MSG_VERBOSE( "Frag: $" << MSG::hex << frag << MSG::dec
462 << " G:" << gain
463 << " C:" << channel
464 << " BCID: " << MSG::hex << m_d2Bytes.getBCID(data, chipCount, blockSize) << MSG::dec
465 << " Data={" << (int) digiVec[n][0]
466 << "," << (int) digiVec[n][1]
467 << "," << (int) digiVec[n][2]
468 << "," << (int) digiVec[n][3]
469 << "," << (int) digiVec[n][4]
470 << "," << (int) digiVec[n][5]
471 << "," << (int) digiVec[n][6] << "}" );
472
473
474 pDigits.push_back(td);
475
476 }
477
478 // store some metadata, first word in chip is header, last is CRC
479 chipHeader.push_back(*data);
480 chipCRC.push_back(*(data + blockSize - 1));
481
482 // go to next block
483 data += blockSize;
484 }
485 if (remap) std::sort(pDigits.end()-channelCount,pDigits.end(),chan_order);
486 }
487
488 int extra = size - (data - p) + 2;
489
490 // check size of fragment - we expect 2 extra words (DMU mask and CRC) or more!
491 if (extra < 2) {
493 ATH_MSG_WARNING( "Too short fragment ! Expected at least " << MSG::dec << (data - p)
494 << " data words, while size from header is " << size
495 << " data words (plus " << sizeOverhead << " words overhead)" );
496 }
497 }
498
499 if (msgLvl(MSG::VERBOSE)) {
500 msg(MSG::VERBOSE) << "Trailer 0x" << MSG::hex
501 << data[0] << " 0x" << data[1];
502 for (int i = 2; i < extra; ++i) {
503 msg(MSG::VERBOSE) << " 0x" << data[i];
504 }
505 msg(MSG::VERBOSE) << MSG::dec << endmsg;
506
507 // check frag trailer
508 if (extra > 0) {
509 if ((data[0] & 0xffff) != (data[0] >> 16)) {
510 msg(MSG::VERBOSE) << MSG::hex << "Trailer numbers do not match: "
511 << data[0] << MSG::dec << endmsg;
512 } else {
513 if ((data[0] & 0xffff) == 0xffff)
514 msg(MSG::VERBOSE) << "Found barrel trailer" << endmsg;
515 else if ((data[0] & 0xffff) == 0xfff)
516 msg(MSG::VERBOSE) << "Found extended barrel trailer" << endmsg;
517 else
518 msg(MSG::VERBOSE) << MSG::hex << "Unexpected trailer number: "
519 << (data[0] & 0xffff) << MSG::dec << endmsg;
520 }
521 }
522
523 // check CRC trailer
524 if (extra > 1) {
525 if ((data[1] & 0xffff) != (data[1] >> 16)) {
526 msg(MSG::VERBOSE) << "Trailer CRC numbers do not match" << endmsg;
527 } else {
528 msg(MSG::VERBOSE) << MSG::hex << "Found CRC 0x" << (data[1] & 0xffff)
529 << MSG::dec << endmsg;
530 }
531 }
532 }
533
534 // store metadata for this collection
535 // size, fragID, BCID, DMU Mask, CRC and other extra words
536 digitsMetaData[0].push_back(size);
537 digitsMetaData[0].push_back(frag);
538 digitsMetaData[0].push_back(bcid);
539 for (int i = 0; i < extra; ++i) {
540 digitsMetaData[1].push_back(data[i]);
541 }
542 if (sizeOverhead == 2 && (version == 0x2 || version == 0x1)) { // keep also first skipped word
543 digitsMetaData[1].push_back(p[2]);
544 }
545
546 if (dataWordsPerChip > 15) { // can not be true !!!
547 savedDigiMode = -1; // check again digiMode in next fragment
548 }
549}
bool chan_order(TileRawData *a, TileRawData *b)
@ HIGHGAIN
Definition TileHWID.h:73
@ LOWGAIN
Definition TileHWID.h:72
Gaudi::Property< bool > m_suppressDummyFragments
std::map< std::string, std::string > remap
list of directories to be explicitly remapped
Definition hcg.cxx:95
setEventNumber setTimeStamp bcid

◆ unpack_frag1()

void TileROD_Decoder::unpack_frag1 ( uint32_t version,
uint32_t sizeOverhead,
DigitsMetaData_t & digitsMetaData,
const uint32_t * p,
pDigiVec & pDigits,
int fragID,
int demoType ) const
private

unpack_frag1 decodes tile subfragment type 0x1.

This subfragment contains the tile raw digits ONLY from the existing channels of a tilecal module.

(not implemented yet).

Definition at line 551 of file TileROD_Decoder.cxx.

556 {
557 // first word is full frag size, first two words are not data
558 int size = *(p) - sizeOverhead;
559 // second word is frag ID (0x100-0x4ff) and frag1 type (old and new version).
560 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
561 bool remap = (drawer_type > 0) || std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), frag);
562 const std::vector<int> & chmap = (frag<0x300) ? m_demoChanLB : m_demoChanEB;
563 int frag1version = (*(p + 1) >> 31) & 0x1;
564 int nbchanformat1 = ((*(p + 1)) >> 24) & 0x3F;
565
566 // store metadata for this collection
567 // size, fragID, BCID
568 digitsMetaData[0].push_back(size);
569 digitsMetaData[0].push_back(frag);
570 digitsMetaData[0].push_back(0);
571
572 if (frag1version == 0) { //Old version
573 p += 2; // 2 words so far
574
575 int nsamp = (*(p) >> 8) & 0x0F; // find number of samples in first data word
576 int words_per_chan = nsamp + 1; // one extra 16bit word with channel number
577 int nchan = 2 * size / words_per_chan;
578
579 if (2 * size != nchan * words_per_chan || nchan <= 0 || nchan > 48) {
581 ATH_MSG_WARNING( "Digi frag type=1 fragId=0x" << MSG::hex << frag << MSG::dec
582 << " Nsamp=" << nsamp
583 << " Nchan=" << nchan
584 << " Wrong Size=" << size );
585 }
586 return;
587 }
588
589 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
590 std::vector<float> digiVec(nsamp);
591 pDigits.reserve(nchan);
592
593 const uint16_t* p16 = reinterpret_cast<const uint16_t *>(p);
594
595 for (int ch = 0; ch < nchan; ++ch) {
596
597 int channel = (*p16) & 0xFF;
598 if (remap) channel = chmap[channel];
599 int nsamp1 = (*(p16) >> 8) & 0x0F;
600 int gain = (*p16) >> 15;
601 ++p16;
602
603 for (int samp = 0; samp < nsamp; ++samp) {
604 digiVec[samp] = *p16++;
605 }
606
607 if (channel < 48 && nsamp1 == nsamp) {
608 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, channel, gain);
609 TileDigits * td = new TileDigits(adcID, digiVec);
610 pDigits.push_back(td);
611 } else {
613 ATH_MSG_WARNING( "Digi frag type=1 fragId=0x" << MSG::hex << frag << MSG::dec
614 << " CHind=" << ch
615 << " channel=" << channel
616 << " nsamp=" << nsamp1 << "/" << nsamp );
617 }
618 }
619
620 if (msgLvl(MSG::VERBOSE)) {
621 msg(MSG::VERBOSE) << MSG::hex << "Frag: $" << frag << MSG::dec
622 << " G:" << gain
623 << " C:" << channel
624 << " Data={";
625 for (int samp = 0; samp < nsamp; ++samp) {
626 msg(MSG::VERBOSE) << " " << (int) digiVec[samp];
627 }
628 msg(MSG::VERBOSE) << "} " << MSG::hex;
629 for (int samp = 0; samp < nsamp / 2 + 1; ++samp) {
630 msg(MSG::VERBOSE) << (int) *p++ << " ";
631 }
632 msg(MSG::VERBOSE) << MSG::dec << endmsg;
633 }
634 }
635 } //End of old version
636
637 else if (frag1version == 1) { //New version
638 p += 2; // 2 words so far
639
640 int nsamp = 7; // New frag1 only for 7 samples
641 int SizeOfFrag1 = size * 2; // Number of 16 bit words
642 int nbchanformat2 = (SizeOfFrag1 - (3 * nbchanformat1)) / 5;
643
644 int nchan = nbchanformat1 + nbchanformat2;
645
646 if ((nchan) > 48 || ((nbchanformat1 * 3) + (nbchanformat2 * 5) > SizeOfFrag1)) {
648 ATH_MSG_WARNING( "Digi frag type=1 fragId=0x" << MSG::hex << frag << MSG::dec
649 << " frag1Version=" << frag1version
650 << " Nsamp=" << nsamp
651 << " NchanFormat1=" << nbchanformat1
652 << " NchanFormat2=" << nbchanformat2
653 << " Wrong Size=" << size);
654 }
655 return;
656 }
657
658 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
659 std::vector<float> digiVec(nsamp);
660 pDigits.reserve(nchan);
661 pDigiVec sDigits(48);
662
663 int ptr16index = 1;
664 int channel = 0;
665 uint16_t word1 = 0;
666 uint16_t word2 = 0;
667 uint16_t word3 = 0;
668 uint16_t word4 = 0;
669 uint16_t word5 = 0;
670
671 for (int chf1 = 0; chf1 < nbchanformat1; ++chf1) {
672 if (ptr16index == 1)
673 channel = ((*p >> 26) & 0x3F);
674 else
675 channel = ((*p >> 10) & 0x3F);
676 if (remap) channel = chmap[channel];
677
678 int gain = 1;
679
680 if (ptr16index == 1) {
681 word1 = (uint16_t) ((*p >> 16) & 0xFFFF);
682 word2 = (uint16_t) (*p & 0xFFFF);
683 word3 = (uint16_t) ((*(p + 1) >> 16) & 0xFFFF);
684 ptr16index = 0;
685 }
686
687 else if (ptr16index == 0) {
688 word1 = (uint16_t) (*p & 0xFFFF);
689 word2 = (uint16_t) ((*(p + 1) >> 16) & 0xFFFF);
690 word3 = (uint16_t) (*(p + 1) & 0xFFFF);
691 ptr16index = 1;
692 }
693
694 uint16_t Smin = (word1 & 0x3FF);
695
696 digiVec[0] = ((word3 >> 4) & 0xF) + Smin;
697 digiVec[1] = ((word3 >> 0) & 0xF) + Smin;
698 digiVec[2] = ((word3 >> 8) & 0xF) + Smin;
699 digiVec[3] = ((word3 >> 12) & 0xF) + Smin;
700 digiVec[4] = ((word2 >> 4) & 0xF) + Smin;
701 digiVec[5] = ((word2 >> 0) & 0xF) + Smin;
702 digiVec[6] = ((word2 >> 8) & 0xF) + Smin;
703
704 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, channel, gain);
705 TileDigits * td = new TileDigits(adcID, digiVec);
706 sDigits.at(channel) = td;
707 p += 1 + ptr16index;
708
709 if (msgLvl(MSG::VERBOSE)) {
710 msg(MSG::VERBOSE) << MSG::hex << "Frag: $" << frag << MSG::dec
711 << " G:" << gain
712 << " C:" << channel
713 << " Data={";
714 for (int samp = 0; samp < 7; ++samp) {
715 msg(MSG::VERBOSE) << " " << (int) digiVec[samp];
716 }
717 msg(MSG::VERBOSE) << "} " << MSG::hex
718 << " WORD1: " << word1
719 << " WORD2: " << word2
720 << " WORD3: " << word3 << MSG::dec << endmsg;
721 }
722 }
723
724 for (int chf2 = 0; chf2 < nbchanformat2; ++chf2) {
725 if (ptr16index == 1)
726 channel = ((*p) & 0x3F);
727 else
728 channel = ((*(p + 1) >> 16) & 0x3F);
729 if (remap) channel = chmap[channel];
730
731 if (ptr16index == 1) {
732 word1 = (uint16_t) ((*p >> 16) & 0xFFFF);
733 word2 = (uint16_t) ((*p) & 0xFFFF);
734 word3 = (uint16_t) ((*(p + 1) >> 16) & 0xFFFF);
735 word4 = (uint16_t) (*(p + 1) & 0xFFFF);
736 word5 = (uint16_t) ((*(p + 2) >> 16) & 0xFFFF);
737 ptr16index = 0;
738 } else if (ptr16index == 0) {
739 word1 = (uint16_t) ((*p) & 0xFFFF);
740 word2 = (uint16_t) ((*(p + 1) >> 16) & 0xFFFF);
741 word3 = (uint16_t) (*(p + 1) & 0xFFFF);
742 word4 = (uint16_t) ((*(p + 2) >> 16) & 0xFFFF);
743 word5 = (uint16_t) (*(p + 2) & 0xFFFF);
744 ptr16index = 1;
745 }
746
747 int gain = ((word2 >> 6) & 0x1);
748
749 digiVec[0] = ((word1 << 9) & 0x200) + ((word2 >> 7) & 0x1FF);
750 digiVec[1] = (word1 >> 1) & 0x3FF;
751 digiVec[2] = (word4 << 5 & 0x3E0) + ((word1 >> 11) & 0x1F);
752 digiVec[3] = (word4 >> 5) & 0x3FF;
753 digiVec[4] = ((word3 << 1) & 0x3FE) + ((word4 >> 15) & 0x1);
754 digiVec[5] = ((word5 << 7) & 0x380) + ((word3 >> 9) & 0x7F);
755 digiVec[6] = (word5 >> 3) & 0x3FF;
756
757 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, channel, gain);
758 TileDigits * td = new TileDigits(adcID, digiVec);
759 sDigits.at(channel) = td;
760 p += (2 + ptr16index);
761
762 if (msgLvl(MSG::VERBOSE)) {
763 msg(MSG::VERBOSE) << MSG::hex << "Frag: $" << frag << MSG::dec
764 << " G:" << gain
765 << " C:" << channel
766 << " Data={";
767 for (int samp = 0; samp < nsamp; ++samp) {
768 msg(MSG::VERBOSE) << " " << (int) digiVec[samp];
769 }
770 msg(MSG::VERBOSE) << "} " << MSG::hex
771 << " WORD1: " << word1
772 << " WORD2: " << word2
773 << " WORD3: " << word3
774 << " WORD4: " << word4
775 << " WORD5: " << word5 << MSG::dec << endmsg;
776 }
777
778 }
779 for (uint i = 0; i < sDigits.size(); i++) {
780 TileDigits * td = sDigits.at(i);
781 if (td) pDigits.push_back(td);
782 }
783 } //End of new version
784
785}
unsigned int uint

◆ unpack_frag10()

void TileROD_Decoder::unpack_frag10 ( uint32_t version,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag10 decodes tile subfragment type 0x10.

This subfragment contains the result of the MTag algorithm and the transverse energy calculation for two tilecal modules.

The MTag algorithm identifies low transverse momentum muons with eta projective pattern that traverse the tile calorimeter and calculates the energy deposited in the corresponding eta projective tower.

The total transverse energy is calculated for each of the two tilecal modules in the subfragment.

Definition at line 1490 of file TileROD_Decoder.cxx.

1492 {
1493 // MTag-MET fragment 0x10 (staging mode)
1494
1495 // second word is frag ID and frag type
1496 int size = *(p);
1497 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
1498
1499 int nDrawer[2];
1500 nDrawer[0] = frag & 0x3F;
1501 nDrawer[1] = (frag & 0xFC0) >> 6;
1502
1503 p += 2; // 2 words so far
1504
1505 uint32_t w;
1506 uint32_t Mu_energy0;
1507 uint32_t Mu_energy1;
1508 uint32_t Mu_energy2;
1509 uint32_t Mu_pattern;
1510 uint32_t Mu_drawer;
1511 uint32_t Mu_quality;
1512
1513 std::vector<float> sumE[2];
1514 std::vector<unsigned int> word[2];
1515 std::vector<float> eta[2];
1516 std::vector<float> energy0[2];
1517 std::vector<float> energy1[2];
1518 std::vector<float> energy2[2];
1519 std::vector<unsigned int> quality[2];
1520
1521
1522 constexpr float eta_LB[9] = {
1523 ((0.00f + 2 * 0.05f) / 3), // D0, BC1, A1
1524 ((0.20f + 2 * 0.15f) / 3), // D1, BC2, A2
1525 ((0.20f + 2 * 0.25f) / 3), // D1, BC3, A3
1526 ((0.40f + 2 * 0.35f) / 3), // D2, BC4, A4
1527 ((0.40f + 2 * 0.45f) / 3), // D2, BC5, A5
1528 ((0.40f + 2 * 0.55f) / 3), // D2, BC6, A6
1529 ((0.60f + 2 * 0.55f) / 3), // D3, BC6, A6
1530 ((0.60f + 2 * 0.65f) / 3), // D3, BC7, A7
1531 ((0.60f + 2 * 0.75f) / 3) // D3, BC8, A8
1532 };
1533
1534 constexpr float eta_EB[17] = {
1535 ((1.00f + 1.05f + 1.15f) / 3), // D5, B11, A12
1536 ((1.00f + 1.15f + 1.15f) / 3), // D5, B12, A12
1537 ((1.00f + 1.15f + 1.25f) / 3), // D5, B12, A13
1538 ((1.00f + 1.25f + 1.15f) / 3), // D5, B13, A12
1539 ((1.00f + 1.25f + 1.25f) / 3), // D5, B13, A13
1540 ((1.00f + 1.25f + 1.35f) / 3), // D5, B13, A14
1541 ((1.20f + 1.05f + 1.15f) / 3), // D6, B11, A12
1542 ((1.20f + 1.15f + 1.15f) / 3), // D6, B12, A12
1543 ((1.20f + 1.15f + 1.25f) / 3), // D6, B12, A13
1544 ((1.20f + 1.25f + 1.15f) / 3), // D6, B13, A12
1545 ((1.20f + 1.25f + 1.25f) / 3), // D6, B13, A13
1546 ((1.20f + 1.25f + 1.35f) / 3), // D6, B13, A14
1547 ((1.20f + 1.35f + 1.25f) / 3), // D6, B14, A13
1548 ((1.20f + 1.35f + 1.35f) / 3), // D6, B14, A14
1549 ((1.20f + 1.35f + 1.45f) / 3), // D6, B14, A15
1550 ((1.20f + 1.45f + 1.35f) / 3), // D6, B15, A14
1551 ((1.20f + 1.45f + 1.45f) / 3) // D6, B15, A15
1552 };
1553
1554 // Transverse energy - 2 words
1555 sumE[0].push_back((float) ((int32_t) (*p++) - 9000));
1556 sumE[1].push_back((float) ((int32_t) (*p++) - 9000));
1557
1558 // Muon tagging
1559
1560 int NMuons = (int) (size - 5) / 2;
1561
1562 for (int mu = 0; mu < NMuons; ++mu) {
1563
1564 w = (*p);
1565
1566 Mu_energy2 = w & 0x1FFFFFF; // 25 bits
1567 Mu_pattern = (w >> 25) & 0x1F; // 5 bits
1568 Mu_drawer = (w >> 30) & 1; // 1 bit
1569 Mu_quality = w >> 31; // 1 bit
1570
1571 word[Mu_drawer].push_back(w);
1572
1573 w = *(p + 1);
1574
1575 Mu_energy0 = w & 0xFFFF; // 16 bits
1576 Mu_energy1 = w >> 16; // 16 bits
1577
1578 word[Mu_drawer].push_back(w);
1579
1580 // Muon eta coordinate
1581 switch (frag >> 12) {
1582 case 1:
1583 eta[Mu_drawer].push_back(eta_LB[Mu_pattern]);
1584 break;
1585 case 2:
1586 eta[Mu_drawer].push_back(-eta_LB[Mu_pattern]);
1587 break;
1588 case 3:
1589 eta[Mu_drawer].push_back(eta_EB[Mu_pattern]);
1590 break;
1591 case 4:
1592 eta[Mu_drawer].push_back(-eta_EB[Mu_pattern]);
1593 break;
1594 default:
1595 ATH_MSG_WARNING("Unknown fragment: " << (frag >> 8));
1596 break;
1597 }
1598
1599 // Energy deposited in TileCal by the muon (MeV)
1600 energy0[Mu_drawer].push_back(Mu_energy0 / 2.);
1601 energy1[Mu_drawer].push_back(Mu_energy1 / 2.);
1602 energy2[Mu_drawer].push_back(Mu_energy2 / 2.);
1603
1604 // Muon quality factor
1605 quality[Mu_drawer].push_back(Mu_quality);
1606
1607 p += 2;
1608 }
1609
1610 for (unsigned int i = 0; i < 2; ++i) {
1611
1612 // frag ID
1613 int fragId = (((frag & 0xF000) >> 4) | nDrawer[i]);
1614
1615 // store sumEt
1616 (*pL2[m_hashFunc(fragId)]).setEt(std::move(sumE[i]));
1617
1618 // store Muon data
1619 (*pL2[m_hashFunc(fragId)]).setMu(std::move(eta[i]), std::move(energy0[i]), std::move(energy1[i]), std::move(energy2[i]),
1620 std::move(quality[i]), std::move(word[i]));
1621 }
1622
1623 return;
1624}
Scalar eta() const
pseudorapidity method

◆ unpack_frag11()

void TileROD_Decoder::unpack_frag11 ( uint32_t version,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag11 decodes tile subfragment type 0x11.

This subfragment contains the result of the MTag algorithm and the transverse energy calculation ONLY for one tilecal module.

The MTag algorithm identifies low transverse momentum muons with eta projective pattern that traverse the tile calorimeter and calculates the energy deposited in the corresponding eta projective tower.

The total transverse energy is calculated for a tilecal module.

Definition at line 1626 of file TileROD_Decoder.cxx.

1628 {
1629 // MTag-MET fragment 0x11 (full mode)
1630
1631 // second word is frag ID and frag type
1632 int size = *(p);
1633 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
1634
1635 p += 2; // 2 words so far
1636
1637 uint32_t w;
1638 uint32_t Mu_energy0;
1639 uint32_t Mu_energy1;
1640 uint32_t Mu_energy2;
1641 uint32_t Mu_pattern;
1642 //uint32_t Mu_drawer;
1643 uint32_t Mu_quality;
1644
1645 std::vector<unsigned int> word;
1646 std::vector<float> eta;
1647 std::vector<float> energy0;
1648 std::vector<float> energy1;
1649 std::vector<float> energy2;
1650 std::vector<unsigned int> quality;
1651
1652 constexpr float eta_LB[9] = {
1653 ((0.00f + 2 * 0.05f) / 3), // D0, BC1, A1
1654 ((0.20f + 2 * 0.15f) / 3), // D1, BC2, A2
1655 ((0.20f + 2 * 0.25f) / 3), // D1, BC3, A3
1656 ((0.40f + 2 * 0.35f) / 3), // D2, BC4, A4
1657 ((0.40f + 2 * 0.45f) / 3), // D2, BC5, A5
1658 ((0.40f + 2 * 0.55f) / 3), // D2, BC6, A6
1659 ((0.60f + 2 * 0.55f) / 3), // D3, BC6, A6
1660 ((0.60f + 2 * 0.65f) / 3), // D3, BC7, A7
1661 ((0.60f + 2 * 0.75f) / 3) // D3, BC8, A8
1662 };
1663
1664 constexpr float eta_EB[17] = {
1665 ((1.00f + 1.05f + 1.15f) / 3), // D5, B11, A12
1666 ((1.00f + 1.15f + 1.15f) / 3), // D5, B12, A12
1667 ((1.00f + 1.15f + 1.25f) / 3), // D5, B12, A13
1668 ((1.00f + 1.25f + 1.15f) / 3), // D5, B13, A12
1669 ((1.00f + 1.25f + 1.25f) / 3), // D5, B13, A13
1670 ((1.00f + 1.25f + 1.35f) / 3), // D5, B13, A14
1671 ((1.20f + 1.05f + 1.15f) / 3), // D6, B11, A12
1672 ((1.20f + 1.15f + 1.15f) / 3), // D6, B12, A12
1673 ((1.20f + 1.15f + 1.25f) / 3), // D6, B12, A13
1674 ((1.20f + 1.25f + 1.15f) / 3), // D6, B13, A12
1675 ((1.20f + 1.25f + 1.25f) / 3), // D6, B13, A13
1676 ((1.20f + 1.25f + 1.35f) / 3), // D6, B13, A14
1677 ((1.20f + 1.35f + 1.25f) / 3), // D6, B14, A13
1678 ((1.20f + 1.35f + 1.35f) / 3), // D6, B14, A14
1679 ((1.20f + 1.35f + 1.45f) / 3), // D6, B14, A15
1680 ((1.20f + 1.45f + 1.35f) / 3), // D6, B15, A14
1681 ((1.20f + 1.45f + 1.45f) / 3) // D6, B15, A15
1682 };
1683
1684 // Transverse energy
1685 std::vector<float> sumE(1, (float) ((int32_t) (*p++) - 9000));
1686 (*pL2[m_hashFunc(frag)]).setEt(std::move(sumE));
1687
1688 // Muon tagging
1689
1690 int NMuons = (int) (size - 4) / 2;
1691
1692 for (int mu = 0; mu < NMuons; ++mu) {
1693
1694 w = (*p);
1695
1696 Mu_energy2 = w & 0x1FFFFFF; // 25 bits
1697 Mu_pattern = (w >> 25) & 0x1F; // 5 bits
1698 //Mu_drawer = (w >> 30) & 1; // 1 bit
1699 Mu_quality = w >> 31; // 1 bit
1700
1701 word.push_back(w);
1702
1703 w = *(p + 1);
1704
1705 Mu_energy0 = w & 0xFFFF; // 16 bits
1706 Mu_energy1 = w >> 16; // 16 bits
1707
1708 word.push_back(w);
1709
1710 // Muon eta coordinate
1711 switch (frag >> 8) {
1712 case 1:
1713 eta.push_back(eta_LB[Mu_pattern]);
1714 break;
1715 case 2:
1716 eta.push_back(-eta_LB[Mu_pattern]);
1717 break;
1718 case 3:
1719 eta.push_back(eta_EB[Mu_pattern]);
1720 break;
1721 case 4:
1722 eta.push_back(-eta_EB[Mu_pattern]);
1723 break;
1724 default:
1725 ATH_MSG_WARNING("Unknown fragment: " << (frag >> 8));
1726 break;
1727 }
1728
1729 // Energy deposited in TileCal by the muon (MeV)
1730 energy0.push_back(Mu_energy0 / 2.);
1731 energy1.push_back(Mu_energy1 / 2.);
1732 energy2.push_back(Mu_energy2 / 2.);
1733
1734 // Muon quality factor
1735 quality.push_back(Mu_quality);
1736
1737 p += 2;
1738 }
1739
1740 (*pL2[m_hashFunc(frag)]).setMu(std::move(eta), std::move(energy0),
1741 std::move(energy1), std::move(energy2), std::move(quality), std::move(word));
1742
1743 return;
1744}

◆ unpack_frag12()

void TileROD_Decoder::unpack_frag12 ( uint32_t version,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag12 decodes tile subfragment type 0x12.

This subfragment contains the result of the MTag algorithm for two tilecal modules.

The MTag algorithm identifies low transverse momentum muons with eta projective pattern that traverse the tile calorimeter and calculates the energy deposited in the corresponding eta projective tower.

Definition at line 1746 of file TileROD_Decoder.cxx.

1748 {
1749 // MTag fragment 0x12 (staging mode)
1750
1751 // second word is frag ID and frag type
1752 int size = *(p);
1753 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
1754
1755 int nDrawer[2];
1756 nDrawer[0] = frag & 0x3F;
1757 nDrawer[1] = (frag & 0xFC0) >> 6;
1758
1759 p += 2; // 2 words so far
1760
1761 uint32_t w;
1762 uint32_t Mu_energy0;
1763 uint32_t Mu_energy1;
1764 uint32_t Mu_energy2;
1765 uint32_t Mu_pattern;
1766 uint32_t Mu_drawer;
1767 uint32_t Mu_quality;
1768
1769 std::vector<unsigned int> word[2];
1770 std::vector<float> eta[2];
1771 std::vector<float> energy0[2];
1772 std::vector<float> energy1[2];
1773 std::vector<float> energy2[2];
1774 std::vector<unsigned int> quality[2];
1775
1776 constexpr float eta_LB[9] = {
1777 ((0.00f + 2 * 0.05f) / 3), // D0, BC1, A1
1778 ((0.20f + 2 * 0.15f) / 3), // D1, BC2, A2
1779 ((0.20f + 2 * 0.25f) / 3), // D1, BC3, A3
1780 ((0.40f + 2 * 0.35f) / 3), // D2, BC4, A4
1781 ((0.40f + 2 * 0.45f) / 3), // D2, BC5, A5
1782 ((0.40f + 2 * 0.55f) / 3), // D2, BC6, A6
1783 ((0.60f + 2 * 0.55f) / 3), // D3, BC6, A6
1784 ((0.60f + 2 * 0.65f) / 3), // D3, BC7, A7
1785 ((0.60f + 2 * 0.75f) / 3) // D3, BC8, A8
1786 };
1787
1788 constexpr float eta_EB[17] = {
1789 ((1.00f + 1.05f + 1.15f) / 3), // D5, B11, A12
1790 ((1.00f + 1.15f + 1.15f) / 3), // D5, B12, A12
1791 ((1.00f + 1.15f + 1.25f) / 3), // D5, B12, A13
1792 ((1.00f + 1.25f + 1.15f) / 3), // D5, B13, A12
1793 ((1.00f + 1.25f + 1.25f) / 3), // D5, B13, A13
1794 ((1.00f + 1.25f + 1.35f) / 3), // D5, B13, A14
1795 ((1.20f + 1.05f + 1.15f) / 3), // D6, B11, A12
1796 ((1.20f + 1.15f + 1.15f) / 3), // D6, B12, A12
1797 ((1.20f + 1.15f + 1.25f) / 3), // D6, B12, A13
1798 ((1.20f + 1.25f + 1.15f) / 3), // D6, B13, A12
1799 ((1.20f + 1.25f + 1.25f) / 3), // D6, B13, A13
1800 ((1.20f + 1.25f + 1.35f) / 3), // D6, B13, A14
1801 ((1.20f + 1.35f + 1.25f) / 3), // D6, B14, A13
1802 ((1.20f + 1.35f + 1.35f) / 3), // D6, B14, A14
1803 ((1.20f + 1.35f + 1.45f) / 3), // D6, B14, A15
1804 ((1.20f + 1.45f + 1.35f) / 3), // D6, B15, A14
1805 ((1.20f + 1.45f + 1.45f) / 3) // D6, B15, A15
1806 };
1807
1808 int NMuons = (int) (size - 3) / 2;
1809
1810 for (int mu = 0; mu < NMuons; ++mu) {
1811
1812 w = (*p);
1813
1814 Mu_energy2 = w & 0x1FFFFFF; // 25 bits
1815 Mu_pattern = (w >> 25) & 0x1F; // 5 bits
1816 Mu_drawer = (w >> 30) & 1; // 1 bit
1817 Mu_quality = w >> 31; // 1 bit
1818
1819 word[Mu_drawer].push_back(w);
1820
1821 w = *(p + 1);
1822
1823 Mu_energy0 = w & 0xFFFF; // 16 bits
1824 Mu_energy1 = w >> 16; // 16 bits
1825
1826 word[Mu_drawer].push_back(w);
1827
1828 // Muon eta coordinate
1829 switch (frag >> 12) {
1830 case 1:
1831 eta[Mu_drawer].push_back(eta_LB[Mu_pattern]);
1832 break;
1833 case 2:
1834 eta[Mu_drawer].push_back(-eta_LB[Mu_pattern]);
1835 break;
1836 case 3:
1837 eta[Mu_drawer].push_back(eta_EB[Mu_pattern]);
1838 break;
1839 case 4:
1840 eta[Mu_drawer].push_back(-eta_EB[Mu_pattern]);
1841 break;
1842 default:
1843 ATH_MSG_WARNING("Unknown fragment: " << (frag >> 8));
1844 break;
1845 }
1846
1847 // Energy deposited in TileCal by the muon (MeV)
1848 energy0[Mu_drawer].push_back(Mu_energy0 / 2.);
1849 energy1[Mu_drawer].push_back(Mu_energy1 / 2.);
1850 energy2[Mu_drawer].push_back(Mu_energy2 / 2.);
1851
1852 // Muon quality factor
1853 quality[Mu_drawer].push_back(Mu_quality);
1854
1855 p += 2;
1856 }
1857
1858 for (unsigned int i = 0; i < 2; ++i) {
1859
1860 // frag ID
1861 int fragId = (((frag & 0xF000) >> 4) | nDrawer[i]);
1862
1863 (*pL2[m_hashFunc(fragId)]).setMu(std::move(eta[i]), std::move(energy0[i]), std::move(energy1[i]), std::move(energy2[i]),
1864 std::move(quality[i]), std::move(word[i]));
1865
1866 }
1867
1868 return;
1869}

◆ unpack_frag13()

void TileROD_Decoder::unpack_frag13 ( uint32_t version,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag13 decodes tile subfragment type 0x13.

This subfragment contains the result of the MTag algorithm ONLY for one tilecal module.

The MTag algorithm identifies low transverse momentum muons with eta projective pattern that traverse the tile calorimeter and calculates the energy deposited in the corresponding eta projective tower.

Definition at line 1871 of file TileROD_Decoder.cxx.

1873 {
1874 // MTag fragment 0x13 (full mode)
1875
1876 // second word is frag ID and frag type
1877 int size = *(p);
1878 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
1879
1880 p += 2; // 2 words so far
1881
1882 uint32_t w;
1883 uint32_t Mu_energy0;
1884 uint32_t Mu_energy1;
1885 uint32_t Mu_energy2;
1886 uint32_t Mu_pattern;
1887 //uint32_t Mu_drawer;
1888 uint32_t Mu_quality;
1889
1890 std::vector<unsigned int> word;
1891 std::vector<float> eta;
1892 std::vector<float> energy0;
1893 std::vector<float> energy1;
1894 std::vector<float> energy2;
1895 std::vector<unsigned int> quality;
1896
1897 constexpr float eta_LB[9] = {
1898 ((0.00f + 2 * 0.05f) / 3), // D0, BC1, A1
1899 ((0.20f + 2 * 0.15f) / 3), // D1, BC2, A2
1900 ((0.20f + 2 * 0.25f) / 3), // D1, BC3, A3
1901 ((0.40f + 2 * 0.35f) / 3), // D2, BC4, A4
1902 ((0.40f + 2 * 0.45f) / 3), // D2, BC5, A5
1903 ((0.40f + 2 * 0.55f) / 3), // D2, BC6, A6
1904 ((0.60f + 2 * 0.55f) / 3), // D3, BC6, A6
1905 ((0.60f + 2 * 0.65f) / 3), // D3, BC7, A7
1906 ((0.60f + 2 * 0.75f) / 3) // D3, BC8, A8
1907 };
1908
1909 constexpr float eta_EB[17] = {
1910 ((1.00f + 1.05f + 1.15f) / 3), // D5, B11, A12
1911 ((1.00f + 1.15f + 1.15f) / 3), // D5, B12, A12
1912 ((1.00f + 1.15f + 1.25f) / 3), // D5, B12, A13
1913 ((1.00f + 1.25f + 1.15f) / 3), // D5, B13, A12
1914 ((1.00f + 1.25f + 1.25f) / 3), // D5, B13, A13
1915 ((1.00f + 1.25f + 1.35f) / 3), // D5, B13, A14
1916 ((1.20f + 1.05f + 1.15f) / 3), // D6, B11, A12
1917 ((1.20f + 1.15f + 1.15f) / 3), // D6, B12, A12
1918 ((1.20f + 1.15f + 1.25f) / 3), // D6, B12, A13
1919 ((1.20f + 1.25f + 1.15f) / 3), // D6, B13, A12
1920 ((1.20f + 1.25f + 1.25f) / 3), // D6, B13, A13
1921 ((1.20f + 1.25f + 1.35f) / 3), // D6, B13, A14
1922 ((1.20f + 1.35f + 1.25f) / 3), // D6, B14, A13
1923 ((1.20f + 1.35f + 1.35f) / 3), // D6, B14, A14
1924 ((1.20f + 1.35f + 1.45f) / 3), // D6, B14, A15
1925 ((1.20f + 1.45f + 1.35f) / 3), // D6, B15, A14
1926 ((1.20f + 1.45f + 1.45f) / 3) // D6, B15, A15
1927 };
1928
1929 int NMuons = (int) (size - 3) / 2;
1930
1931 for (int mu = 0; mu < NMuons; ++mu) {
1932
1933 w = (*p);
1934
1935 Mu_energy2 = w & 0x1FFFFFF; // 25 bits
1936 Mu_pattern = (w >> 25) & 0x1F; // 5 bits
1937 //Mu_drawer = (w >> 30) & 1; // 1 bit
1938 Mu_quality = w >> 31; // 1 bit
1939
1940 word.push_back(w);
1941
1942 w = *(p + 1);
1943
1944 Mu_energy0 = w & 0xFFFF; // 16 bits
1945 Mu_energy1 = w >> 16; // 16 bits
1946
1947 word.push_back(w);
1948
1949 // Muon eta coordinate
1950 switch (frag >> 8) {
1951 case 1:
1952 eta.push_back(eta_LB[Mu_pattern]);
1953 break;
1954 case 2:
1955 eta.push_back(-eta_LB[Mu_pattern]);
1956 break;
1957 case 3:
1958 eta.push_back(eta_EB[Mu_pattern]);
1959 break;
1960 case 4:
1961 eta.push_back(-eta_EB[Mu_pattern]);
1962 break;
1963 default:
1964 ATH_MSG_WARNING("Unknown fragment: " << (frag >> 8));
1965 break;
1966 }
1967
1968 // Energy deposited in TileCal by the muon (MeV)
1969 energy0.push_back(Mu_energy0 / 2.);
1970 energy1.push_back(Mu_energy1 / 2.);
1971 energy2.push_back(Mu_energy2 / 2.);
1972
1973 // Muon quality factor
1974 quality.push_back(Mu_quality);
1975
1976 p += 2;
1977 }
1978
1979 (*pL2[m_hashFunc(frag)]).setMu(std::move(eta), std::move(energy0),
1980 std::move(energy1), std::move(energy2), std::move(quality), std::move(word));
1981
1982 return;
1983}

◆ unpack_frag14()

void TileROD_Decoder::unpack_frag14 ( uint32_t version,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag14 decodes tile subfragment type 0x14.

This subfragment contains the transverse energy calculation for tilecal module.

Definition at line 1985 of file TileROD_Decoder.cxx.

1987 {
1988 // Met fragment 0x14 (staging mode) - obsolete, now sumEt is part of frag4/frag5
1989
1990 // second word is frag ID and frag type
1991 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
1992
1993 int nDrawer[2];
1994 nDrawer[0] = frag & 0x3F;
1995 nDrawer[1] = (frag & 0xFC0) >> 6;
1996
1997 p += 2; // 2 words somethingm far
1998
1999 for (unsigned int i = 0; i < 2; ++i) {
2000
2001 int fragId = (((frag & 0xF000) >> 4) | nDrawer[i]);
2002
2003 float sumE = (float) ((int32_t) (*p) - 9000);
2004 (*pL2[m_hashFunc(fragId)]).setEt(std::vector<float>{sumE});
2005
2006 ++p;
2007 }
2008
2009 return;
2010}

◆ unpack_frag15()

void TileROD_Decoder::unpack_frag15 ( uint32_t version,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag15 decodes tile subfragment type 0x15.

This subfragment contains the transverse energy calculation ONLY for one tilecal module.

Definition at line 2012 of file TileROD_Decoder.cxx.

2014 {
2015 // Met fragment 0x15 (full mode) - obsolete, now sumEt is part of frag4/frag5
2016
2017 // second word is frag ID and frag type
2018 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
2019
2020 p += 2; // 2 words so far
2021
2022 std::vector<float> sumE(1);
2023
2024 sumE[0] = (float) ((int32_t) (*p) - 9000);
2025 (*pL2[m_hashFunc(frag)]).setEt(std::move(sumE));
2026
2027 return;
2028}

◆ unpack_frag16()

void TileROD_Decoder::unpack_frag16 ( uint32_t version,
const uint32_t * p,
TileLaserObject & v ) const
private

unpack_frag16 decodes tile subfragment type 0x16 or 0x20.

This subfragment contains informations coming from the Laser box [calibration run]

Definition at line 2030 of file TileROD_Decoder.cxx.

2031 {
2032
2033 //frag ID
2034
2035 //int frag = *(p+1) & 0xFFFF;
2036 //int type = *(p+1) >>16;
2037
2038 // pointer to current data word
2039 const uint32_t *pData;
2040
2041 //position of first data word, skip the first two words of the header fragment
2042
2043 pData = p + 2;
2044
2045 int counter = 0;
2046
2047 counter = *pData;
2048
2049 ++pData;
2050
2051 int reqAmp = 0;
2052 int filt = 0;
2053 //int rawfilt=0;
2054 //int status=0;
2055 bool errorFlag = false;
2056
2057 if ((*pData & 0xFF000000) == 0x20000000) {
2058
2059 if (version == 1) {
2060
2061 reqAmp = *pData & 0xFFFF;
2062
2063 } else {
2064
2065 reqAmp = *pData & 0xFFFF;
2066
2067 // rawfilt = (*pData >>16) & 0xF;
2068
2069 if (version == 2) {
2070 filt = (((*pData >> 16) & 7) ^ 7) + 2;
2071 } else {
2072 filt = 9 - (((*pData >> 17) & 1) * 4 + ((*pData >> 18) & 1) * 2 + ((*pData >> 19) & 1));
2073 }
2074
2075 if (((*pData >> 16) & 1) == 1) filt = 0; // Filter wheel moving
2076
2077 if (filt > 8) filt -= 8;
2078 }
2079 //status = (*pData >>20) & 0xF;
2080
2081 } else {
2082 errorFlag = true;
2084 ATH_MSG_WARNING( "In decoding word 20" );
2085 }
2086
2087 ++pData;
2088
2089 //int delay=0;
2090 int measAmp = 0;
2091
2092 if ((*pData & 0xFF000000) == 0x21000000) {
2093
2094 measAmp = *pData & 0xFFF;
2095 //delay = (*pData >>12) & 0xFFF;
2096
2097 } else {
2098 errorFlag = true;
2100 ATH_MSG_WARNING( "In decoding word 21" );
2101 }
2102
2103 ++pData;
2104
2105 //int status1=0;
2106 int tdc1 = 0;
2107 int tdc2 = 0;
2108
2109 if ((*pData & 0xFF000000) == 0x22000000) {
2110
2111 if (version == 1) {
2112
2113 tdc1 = (*pData >> 16) & 0xF;
2114 tdc2 = (*pData >> 20) & 0xF;
2115 } else {
2116
2117 tdc1 = *pData & 0xFFFF;
2118
2119 }
2120
2121 } else {
2122 errorFlag = true;
2124 ATH_MSG_WARNING( "In decoding word 22" );
2125
2126 }
2127
2128 ++pData;
2129
2130 //int status2=0;
2131 //int tdc2=0;
2132
2133 if ((*pData & 0xFF000000) == 0x23000000) {
2134
2135 if (version == 1) {
2136
2137 tdc2 = (*pData >> 12) & 0xFFF;
2138 tdc1 = *pData & 0xFFF;
2139
2140 } else {
2141
2142 tdc2 = *pData & 0xFFFF;
2143
2144 //status2 = (*pData >>16) & 0xFF;
2145 }
2146
2147 } else {
2148 errorFlag = true;
2150 ATH_MSG_WARNING( "In decoding word 23" );
2151 }
2152
2153 ++pData;
2154
2155 int chan0 = 0;
2156 int chan1 = 0;
2157
2158 if ((*pData & 0xFF000000) == 0x44000000) {
2159
2160 chan0 = 4095 - (*pData & 0xFFF);
2161 chan1 = 4095 - ((*pData >> 12) & 0xFFF);
2162
2163 } else {
2164 errorFlag = true;
2166 ATH_MSG_WARNING( "In decoding word 24" );
2167 }
2168
2169 ++pData;
2170
2171 int chan2 = 0;
2172 int chan3 = 0;
2173
2174 if ((*pData & 0xFF000000) == 0x45000000) {
2175
2176 chan2 = 4095 - (*pData & 0xFFF);
2177 chan3 = 4095 - ((*pData >> 12) & 0xFFF);
2178
2179 } else {
2180 errorFlag = true;
2182 ATH_MSG_WARNING( "In decoding word 25" );
2183 }
2184
2185 ++pData;
2186
2187 int chan4 = 0;
2188 int chan5 = 0;
2189
2190 if ((*pData & 0xFF000000) == 0x46000000) {
2191
2192 chan4 = 4095 - (*pData & 0xFFF);
2193 chan5 = 4095 - ((*pData >> 12) & 0xFFF);
2194
2195 } else {
2196 errorFlag = true;
2198 ATH_MSG_WARNING( "In decoding word 26" );
2199 }
2200
2201 ++pData;
2202
2203 //int chan6=0;
2204 //int chan7=0;
2205
2206 if ((*pData & 0xFF000000) == 0x47000000) {
2207
2208 //chan6 = 4095 - (*pData & 0xFFF);
2209 //chan7 = 4095 - ((*pData >>12) & 0xFFF);
2210
2211 } else {
2212 errorFlag = true;
2214 ATH_MSG_WARNING( "In decoding word 27" );
2215 }
2216
2217 ++pData;
2218
2219 int meanPed_diode1 = 0;
2220 int rmsPed_diode1 = 0;
2221
2222 double MeanPed_diode1 = 0;
2223 double RmsPed_diode1 = 0;
2224
2225 rmsPed_diode1 = *pData & 0xFFFF;
2226 meanPed_diode1 = (*pData >> 16) & 0xFFFF;
2227
2228 MeanPed_diode1 = static_cast<double>(meanPed_diode1) * 0.1;
2229
2230 RmsPed_diode1 = static_cast<double>(rmsPed_diode1) * 0.01;
2231
2232 ++pData;
2233
2234 int meanPed_diode2 = 0;
2235 int rmsPed_diode2 = 0;
2236
2237 double MeanPed_diode2 = 0;
2238 double RmsPed_diode2 = 0;
2239
2240 rmsPed_diode2 = *pData & 0xFFFF;
2241 meanPed_diode2 = (*pData >> 16) & 0xFFFF;
2242
2243 MeanPed_diode2 = static_cast<double>(meanPed_diode2) * 0.1;
2244
2245 RmsPed_diode2 = static_cast<double>(rmsPed_diode2) * 0.01;
2246
2247 ++pData;
2248
2249 int meanPed_diode3 = 0;
2250 int rmsPed_diode3 = 0;
2251
2252 double MeanPed_diode3 = 0;
2253 double RmsPed_diode3 = 0;
2254
2255 rmsPed_diode3 = *pData & 0xFFFF;
2256 meanPed_diode3 = (*pData >> 16) & 0xFFFF;
2257
2258 MeanPed_diode3 = static_cast<double>(meanPed_diode3) * 0.1;
2259
2260 RmsPed_diode3 = static_cast<double>(rmsPed_diode3) * 0.01;
2261
2262 ++pData;
2263
2264 int meanPed_diode4 = 0;
2265 int rmsPed_diode4 = 0;
2266
2267 double MeanPed_diode4 = 0;
2268 double RmsPed_diode4 = 0;
2269
2270 rmsPed_diode4 = *pData & 0xFFFF;
2271 meanPed_diode4 = (*pData >> 16) & 0xFFFF;
2272
2273 MeanPed_diode4 = static_cast<double>(meanPed_diode4) * 0.1;
2274
2275 RmsPed_diode4 = static_cast<double>(rmsPed_diode4) * 0.01;
2276
2277 ++pData;
2278
2279 int meanPed_pmt1 = 0;
2280 int rmsPed_pmt1 = 0;
2281
2282 double MeanPed_pmt1 = 0;
2283 double RmsPed_pmt1 = 0;
2284
2285 rmsPed_pmt1 = *pData & 0xFFFF;
2286 meanPed_pmt1 = (*pData >> 16) & 0xFFFF;
2287
2288 MeanPed_pmt1 = static_cast<double>(meanPed_pmt1) * 0.1;
2289
2290 RmsPed_pmt1 = static_cast<double>(rmsPed_pmt1) * 0.01;
2291
2292 ++pData;
2293
2294 int meanPed_pmt2 = 0;
2295 int rmsPed_pmt2 = 0;
2296
2297 double MeanPed_pmt2 = 0;
2298 double RmsPed_pmt2 = 0;
2299
2300 rmsPed_pmt2 = *pData & 0xFFFF;
2301 meanPed_pmt2 = (*pData >> 16) & 0xFFFF;
2302
2303 MeanPed_pmt2 = static_cast<double>(meanPed_pmt2) * 0.1;
2304
2305 RmsPed_pmt2 = static_cast<double>(rmsPed_pmt2) * 0.01;
2306
2307 ++pData;
2308
2309 time_t lastPedMeas = *pData;
2310 //struct tm *time = localtime(&lastPedMeas);
2311 //printf("Date is %d/%02d/%02d\n", time->tm_year+1900, time->tm_mon+1, time->tm_mday);
2312 //printf("Time is %02d:%02d\n", time->tm_hour, time->tm_min);
2313
2314 ++pData;
2315
2316 int meanAlpha_diode1 = 0;
2317 int rmsAlpha_diode1 = 0;
2318
2319 double MeanAlpha_diode1 = 0;
2320 double RmsAlpha_diode1 = 0;
2321
2322 rmsAlpha_diode1 = *pData & 0xFFFF;
2323 meanAlpha_diode1 = (*pData >> 16) & 0xFFFF;
2324
2325 MeanAlpha_diode1 = static_cast<double>(meanAlpha_diode1) * 0.1;
2326
2327 RmsAlpha_diode1 = static_cast<double>(rmsAlpha_diode1) * 0.01;
2328
2329 ++pData;
2330
2331 int meanAlpha_diode2 = 0;
2332 int rmsAlpha_diode2 = 0;
2333
2334 double MeanAlpha_diode2 = 0;
2335 double RmsAlpha_diode2 = 0;
2336
2337 rmsAlpha_diode2 = *pData & 0xFFFF;
2338 meanAlpha_diode2 = (*pData >> 16) & 0xFFFF;
2339
2340 MeanAlpha_diode2 = static_cast<float>(meanAlpha_diode2) * 0.1;
2341
2342 RmsAlpha_diode2 = static_cast<float>(rmsAlpha_diode2) * 0.01;
2343
2344 ++pData;
2345
2346 // ATH_MSG_VERBOSE( "Diode 2 value is " << MeanAlpha_diode2 );
2347
2348 int meanAlpha_diode3 = 0;
2349 int rmsAlpha_diode3 = 0;
2350
2351 double MeanAlpha_diode3 = 0;
2352 double RmsAlpha_diode3 = 0;
2353
2354 rmsAlpha_diode3 = *pData & 0xFFFF;
2355 meanAlpha_diode3 = (*pData >> 16) & 0xFFFF;
2356
2357 MeanAlpha_diode3 = static_cast<double>(meanAlpha_diode3) * 0.1;
2358
2359 RmsAlpha_diode3 = static_cast<double>(rmsAlpha_diode3) * 0.01;
2360
2361 ++pData;
2362
2363 int meanAlpha_diode4 = 0;
2364 int rmsAlpha_diode4 = 0;
2365
2366 double MeanAlpha_diode4 = 0;
2367 double RmsAlpha_diode4 = 0;
2368
2369 rmsAlpha_diode4 = *pData & 0xFFFF;
2370 meanAlpha_diode4 = (*pData >> 16) & 0xFFFF;
2371
2372 MeanAlpha_diode4 = static_cast<double>(meanAlpha_diode4) * 0.1;
2373
2374 RmsAlpha_diode4 = static_cast<double>(rmsAlpha_diode4) * 0.01;
2375
2376 ++pData;
2377
2378 time_t lastAlphaMeas = *pData;
2379 //tm *Time = localtime(&lastAlphaMeas);
2380 //printf("Date is %d/%02d/%02d\n", Time->tm_year+1900, Time->tm_mon+1, Time->tm_mday);
2381 //printf("Time is %02d:%02d\n", Time->tm_hour, Time->tm_min);
2382
2383 ++pData;
2384
2385 if (version > 1) {
2386
2387 //int pedAlpha_diode1=0;
2388 //int pedRMSAlpha_diode1=0;
2389
2390 //double PedAlpha_diode1=0;
2391 //double PedRMSAlpha_diode1=0;
2392
2393 //pedRMSAlpha_diode1 = *pData & 0xFFFF ;
2394 //pedAlpha_diode1 = (*pData >> 16) & 0xFFFF;
2395
2396 //PedAlpha_diode1 = static_cast<double>(pedAlpha_diode1)/10;
2397
2398 //PedRMSAlpha_diode1 = static_cast<double>(pedRMSAlpha_diode1)/100;
2399
2400 ++pData;
2401
2402 //int pedAlpha_diode2=0;
2403 //int pedRMSAlpha_diode2=0;
2404
2405 //double PedAlpha_diode2=0;
2406 //double PedRMSAlpha_diode2=0;
2407
2408 //pedRMSAlpha_diode2 = *pData & 0xFFFF ;
2409 //pedAlpha_diode2 = (*pData >> 16) & 0xFFFF;
2410
2411 //PedAlpha_diode2 = static_cast<double>(pedAlpha_diode2)/10;
2412
2413 //PedRMSAlpha_diode2 = static_cast<double>(pedRMSAlpha_diode2)/100;
2414
2415 ++pData;
2416
2417 //int pedAlpha_diode3=0;
2418 //int pedRMSAlpha_diode3=0;
2419
2420 //double PedAlpha_diode3=0;
2421 //double PedRMSAlpha_diode3=0;
2422
2423 //pedRMSAlpha_diode3 = *pData & 0xFFFF ;
2424 //pedAlpha_diode3 = (*pData >> 16) & 0xFFFF;
2425
2426 //PedAlpha_diode3 = static_cast<double>(pedAlpha_diode3)/10;
2427
2428 //PedRMSAlpha_diode3 = static_cast<double>(pedRMSAlpha_diode3)/100;
2429
2430 ++pData;
2431
2432 //int pedAlpha_diode4=0;
2433 //int pedRMSAlpha_diode4=0;
2434
2435 //double PedAlpha_diode4=0;
2436 //double PedRMSAlpha_diode4=0;
2437
2438 //pedRMSAlpha_diode4 = *pData & 0xFFFF ;
2439 //pedAlpha_diode4 = (*pData >> 16) & 0xFFFF;
2440
2441 //PedAlpha_diode4 = static_cast<double>(pedAlpha_diode4)/10;
2442
2443 //PedRMSAlpha_diode4 = static_cast<double>(pedRMSAlpha_diode4)/100;
2444
2445 ++pData;
2446
2447 //time_t lastAlphaPedMeas = *pData;
2448
2449 ++pData;
2450 }
2451
2452 int diodeTemp = 0;
2453 int seconds1 = 0;
2454
2455 double DiodeTemp = 0;
2456
2457 diodeTemp = *pData & 0xFFF;
2458 seconds1 = (*pData >> 12) & 0xFFFFF;
2459
2460 DiodeTemp = static_cast<double>(diodeTemp) * 0.1;
2461
2462 ++pData;
2463
2464 int boxTemp = 0;
2465 int seconds2 = 0;
2466
2467 double BoxTemp = 0;
2468
2469 boxTemp = *pData & 0xFFF;
2470 seconds2 = (*pData >> 12) & 0xFFFFF;
2471
2472 BoxTemp = static_cast<double>(boxTemp) * 0.1;
2473
2474 ++pData;
2475
2476 int hum = 0;
2477 int seconds3 = 0;
2478
2479 double Hum = 0;
2480
2481 hum = *pData & 0xFFF;
2482 seconds3 = (*pData >> 12) & 0xFFFFF;
2483
2484 Hum = static_cast<double>(hum) * 0.1;
2485
2486 ++pData;
2487
2488 int gasFlow = 0;
2489 int seconds4 = 0;
2490
2491 double GasFlow = 0;
2492
2493 gasFlow = *pData & 0xFFF;
2494 seconds4 = (*pData >> 12) & 0xFFFFF;
2495
2496 GasFlow = static_cast<double>(gasFlow) * 0.1;
2497
2498 ++pData;
2499
2500 int PLCstatus = 0;
2501 //int seconds5 =0;
2502
2503 PLCstatus = *pData & 0xFFF;
2504 //seconds5 = (*pData >> 12) & 0xFFFFF;
2505 int alphaPos = PLCstatus & 0x7;
2506 int LVdiodes = (PLCstatus >> 0x3) & 0x1;
2507 int HVpmts = (PLCstatus >> 0x4) & 0x3;
2508 int shutter = (PLCstatus >> 0x6) & 0x3;
2509 int interLock = (PLCstatus >> 0x8) & 0x1;
2510 int alarm = (PLCstatus >> 0x9) & 0x7;
2511
2512 laserObject.setPmt(0, chan4, tdc1, MeanPed_pmt1, RmsPed_pmt1, 0);
2513
2514 laserObject.setPmt(1, chan5, tdc2, MeanPed_pmt2, RmsPed_pmt2, 0);
2515
2516 laserObject.setDiode(0, chan0, MeanPed_diode1, RmsPed_diode1, MeanAlpha_diode1, RmsAlpha_diode1, 0, 0, 0);
2517
2518 laserObject.setDiode(1, chan1, MeanPed_diode2, RmsPed_diode2, MeanAlpha_diode2, RmsAlpha_diode2, 0, 0, 0);
2519
2520 laserObject.setDiode(2, chan2, MeanPed_diode3, RmsPed_diode3, MeanAlpha_diode3, RmsAlpha_diode3, 0, 0, 0);
2521
2522 laserObject.setDiode(3, chan3, MeanPed_diode4, RmsPed_diode4, MeanAlpha_diode4, RmsAlpha_diode4, 0, 0, 0);
2523
2524 laserObject.setControl(DiodeTemp, seconds1, BoxTemp, seconds2, GasFlow, seconds4, Hum, seconds3, lastPedMeas, lastAlphaMeas);
2525
2526 laserObject.setLaser(counter, reqAmp, measAmp, filt, 0, 1);
2527
2528 laserObject.setPLC(alphaPos, LVdiodes, HVpmts, shutter, interLock, alarm);
2529
2530 if (errorFlag) m_ErrorCounter++;
2531} // unpack_frag16

◆ unpack_frag17()

void TileROD_Decoder::unpack_frag17 ( uint32_t version,
uint32_t sizeOverhead,
const uint32_t * p,
TileLaserObject & v ) const
private

unpack_frag17 decodes tile subfragment type 0x17 or 0x20.

This subfragment contains informations coming from the Laser box [calibration run]

Definition at line 2533 of file TileROD_Decoder.cxx.

2537{
2538 // first word is full frag size, first two words are not data
2539 int size = *(p);
2540 // second word is frag ID and frag type
2541 //int frag = *(p + 1) & 0xFFFF;
2542 //position of first data word, skip the first two words of the header fragment
2543 //const uint32_t *pData = p+2;
2544
2545 bool debug = msgLvl(MSG::DEBUG);
2546
2547 if (true) {
2548 int maxn=size+2-sizeOverhead;
2549 for(int n=0; n<maxn; ++n){
2550 ATH_MSG_DEBUG("WORD " << n << " (" << n+11 << ") : (DEC) " << p[n] << " (HEX) 0x" << MSG::hex << p[n] << MSG::dec );
2551 }
2552 }
2553
2554 // p[2] 00 00 00 tt Daq Type
2555 // p[3] nn nn nn nn Laser Count
2556 // p[4] rr rr mm mm rrrr = Requested Intensity mmmm = measured intensity
2557 // p[5] t0 0f dd dd t= timeout (bit 31 and 30) f = filter dddd = Delay Slama
2558 // [[6] 00 00 ll ll Linearity DAC Value
2559
2560 ATH_MSG_DEBUG("SETTING DAQ TYPE IN DECODER = " << MSG::hex << "0x" << int(p[2]) << " " << MSG::dec << int(p[2]));
2561
2562 int countr = p[3];
2563 int idiode = (p[4]>>16);
2564 int intensity = (p[4]&0xFFFF);
2565 int filter = (p[5]>>16) & 0x000F;
2566 bool qdctimeout = !((p[5]>>31) & 0x1);
2567 bool tdctimeout = !((p[5]>>30) & 0x1);
2568
2569 int timing = (p[5] & 0xFFFF);
2570 int daqtyp = p[2];
2571
2572 laserObject.setLaser(countr, idiode, intensity, filter, timing, 2);
2573 laserObject.setControl(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99);
2574 laserObject.setPLC(-99,-99,-99,-99,-99,-99);
2575 laserObject.setDaqType(daqtyp);
2576 laserObject.setTimeouts(qdctimeout, tdctimeout);
2577
2578
2579 if(laserObject.isLASERII()) ATH_MSG_DEBUG("LASERII VERSION IS " << laserObject.getVersion());
2580 else ATH_MSG_DEBUG("LASERI VERSION IS " << laserObject.getVersion());
2581
2582 ATH_MSG_DEBUG("laserObject.setLaser: " << MSG::dec << "COUNTER=" << countr << " | "
2583 << "I_DIODE=" << idiode << " | "
2584 << "FILTERN=" << filter << " | "
2585 << "TIMINGD=" << timing << " | "
2586 << "DAQTYPE=" << daqtyp );
2587
2588 int las[32];
2589 double ped[32];
2590 double std[32];
2591
2592 // ATTENTION: note that HG has even index (0,2,4,...) in las[], ped[], std[] arrays
2593 static const int HG=0;
2594 static const int LG=1;
2595
2596 const uint32_t *word = p+7; // move to 7th word
2597 int adc=0;
2598 // decode 32 ADC half-words (16 low & high channels)
2599 while (adc<31) {
2600 // ll ll hh hh ADC Channel 1 & 0 (Low & High Gain)
2601 las[adc++] = 8500 - ((*word) & 0xFFFF);
2602 las[adc++] = 8500 - ((*word) >> 16);
2603 ++word;
2604 }
2605 // TDC word immediately after ADC words
2606 // aa aa bb bb aaaa = TDC N1 bbbb = TDC N0
2607 int TDC0 = (*word) & 0xFFFF;
2608 int TDC1 = (*word) >> 16;
2609
2610 if (size>130) {
2611
2612 uint32_t sum[32];
2613 uint64_t ssq[32];
2614
2615 // p[128] Nb event
2616 double nevt = double(p[128]);
2617 if(p[128]==0 || (p[128]==3072 && p[32]<21504000) ) {
2618 nevt=1024.; // HAS TO BE REMOVED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2619 ATH_MSG_DEBUG("Nevents= " << p[128] << " => assuming 1024");
2620 }
2621
2622 if (nevt>0) {
2623
2624 word = p+32; // jump to 32th word
2625
2626 // decode sums for 16 channels (6 words per channel)
2627 for(int channel=0;channel<16;++channel) {
2628
2629 // Sum Xi channel 0
2630 // Sum Xi channel 1
2631 // Sum Xi2 LSB channel 0
2632 // Sum Xi2 MSB channel 0
2633 // Sum Xi2 LSB channel 1
2634 // Sum Xi2 MSB channel 1
2635
2636 sum[channel*2+HG] = *(word++);
2637 sum[channel*2+LG] = *(word++);
2638
2639 uint32_t lsb0 = *(word++);
2640 uint32_t msb0 = *(word++);
2641 uint32_t lsb1 = *(word++);
2642 uint32_t msb1 = *(word++);
2643 uint64_t MSB0 = (uint64_t) msb0 << 32;
2644 uint64_t MSB1 = (uint64_t) msb1 << 32;
2645 uint64_t SSQ0 = MSB0 | lsb0;
2646 uint64_t SSQ1 = MSB1 | lsb1;
2647
2648 ssq[channel*2+HG] = SSQ0;
2649 ssq[channel*2+LG] = SSQ1;
2650
2651 // COMPUTE MEAN AND STANDARD DEVIATION
2652 ped[channel*2+HG] = double(sum[channel*2+HG])/nevt;
2653 ped[channel*2+LG] = double(sum[channel*2+LG])/nevt;
2654
2655 std[channel*2+HG] = double(ssq[channel*2+HG])/nevt - ped[channel*2+HG]*ped[channel*2+HG];
2656 std[channel*2+LG] = double(ssq[channel*2+LG])/nevt - ped[channel*2+LG]*ped[channel*2+LG];
2657 if (std[channel*2+HG]>0.0) std[channel*2+HG] = sqrt(std[channel*2+HG]);
2658 if (std[channel*2+LG]>0.0) std[channel*2+LG] = sqrt(std[channel*2+LG]);
2659
2660 // PLEASE NOTE THAT LG EQUALS 1 WHEN TILEID::LOWGAIN EQUALS 0
2661 // HG EQUALS 0 WHEN TILEID::HIGHGAIN EQUALS 1
2662 // THIS CONFUSING INDEXING IS TAKEN CARE OF IN THE FOLLOWING TWO LINES AND WILL *NOT*
2663 // BE PROPAGATED FURTHER DOWN THE CHAIN. THIS MEANS THAT AFTER THIS LG=0 AND HG=1
2664 laserObject.setCalibType(int(p[31]));
2665 laserObject.setCalib(channel,int(p[31]), double(sum[channel*2+LG]), double(ssq[channel*2+LG]), nevt, TileID::LOWGAIN);
2666 laserObject.setCalib(channel,int(p[31]), double(sum[channel*2+HG]), double(ssq[channel*2+HG]), nevt, TileID::HIGHGAIN);
2667
2668 // DEBUGGING OUTPUT
2669 if(debug){
2670 ATH_MSG_DEBUG("PED CHAN=" << channel << " GAIN=LG" << " TYPE=" << laserObject.getType(channel,TileID::LOWGAIN,0) << " MEAN=" << laserObject.getMean(channel,TileID::LOWGAIN,0) << " SIGMA=" << laserObject.getSigma(channel,TileID::LOWGAIN,0) << " N=" << laserObject.getN(channel,TileID::LOWGAIN,0) << " isSet?=" << laserObject.isSet(channel,TileID::LOWGAIN,0) );
2671 ATH_MSG_DEBUG("PED CHAN=" << channel << " GAIN=HG" << " TYPE=" << laserObject.getType(channel,TileID::HIGHGAIN,0) << " MEAN=" << laserObject.getMean(channel,TileID::HIGHGAIN,0) << " SIGMA=" << laserObject.getSigma(channel,TileID::HIGHGAIN,0) << " N=" << laserObject.getN(channel,TileID::HIGHGAIN,0) << " isSet?=" << laserObject.isSet(channel,TileID::HIGHGAIN,0) );
2672
2673 ATH_MSG_DEBUG("PED CHAN=" << channel << " GAIN=LG" << " TYPE=" << laserObject.getType(channel,TileID::LOWGAIN,1) << " MEAN=" << laserObject.getMean(channel,TileID::LOWGAIN,1) << " SIGMA=" << laserObject.getSigma(channel,TileID::LOWGAIN,1) << " N=" << laserObject.getN(channel,TileID::LOWGAIN,1) << " isSet?=" << laserObject.isSet(channel,TileID::LOWGAIN,1) );
2674 ATH_MSG_DEBUG("PED CHAN=" << channel << " GAIN=HG" << " TYPE=" << laserObject.getType(channel,TileID::HIGHGAIN,1) << " MEAN=" << laserObject.getMean(channel,TileID::HIGHGAIN,1) << " SIGMA=" << laserObject.getSigma(channel,TileID::HIGHGAIN,1) << " N=" << laserObject.getN(channel,TileID::HIGHGAIN,1) << " isSet?=" << laserObject.isSet(channel,TileID::HIGHGAIN,1) );
2675
2676 ATH_MSG_DEBUG("LED CHAN=" << channel << " GAIN=LG" << " TYPE=" << laserObject.getType(channel,TileID::LOWGAIN,2) << " MEAN=" << laserObject.getMean(channel,TileID::LOWGAIN,2) << " SIGMA=" << laserObject.getSigma(channel,TileID::LOWGAIN,2) << " N=" << laserObject.getN(channel,TileID::LOWGAIN,2) << " isSet?=" << laserObject.isSet(channel,TileID::LOWGAIN,2) );
2677 ATH_MSG_DEBUG("LED CHAN=" << channel << " GAIN=HG" << " TYPE=" << laserObject.getType(channel,TileID::HIGHGAIN,2) << " MEAN=" << laserObject.getMean(channel,TileID::HIGHGAIN,2) << " SIGMA=" << laserObject.getSigma(channel,TileID::HIGHGAIN,2) << " N=" << laserObject.getN(channel,TileID::HIGHGAIN,2) << " isSet?=" << laserObject.isSet(channel,TileID::HIGHGAIN,2) );
2678
2679 ATH_MSG_DEBUG("ALP CHAN=" << channel << " GAIN=LG" << " TYPE=" << laserObject.getType(channel,TileID::LOWGAIN,3) << " MEAN=" << laserObject.getMean(channel,TileID::LOWGAIN,3) << " SIGMA=" << laserObject.getSigma(channel,TileID::LOWGAIN,3) << " N=" << laserObject.getN(channel,TileID::LOWGAIN,3) << " isSet?=" << laserObject.isSet(channel,TileID::LOWGAIN,3) );
2680 ATH_MSG_DEBUG("ALP CHAN=" << channel << " GAIN=HG" << " TYPE=" << laserObject.getType(channel,TileID::HIGHGAIN,3) << " MEAN=" << laserObject.getMean(channel,TileID::HIGHGAIN,3) << " SIGMA=" << laserObject.getSigma(channel,TileID::HIGHGAIN,3) << " N=" << laserObject.getN(channel,TileID::HIGHGAIN,3) << " isSet?=" << laserObject.isSet(channel,TileID::HIGHGAIN,3) );
2681
2682 ATH_MSG_DEBUG(MSG::hex << msb0 << " + " << lsb0 << " => " << SSQ0 <<
2683 MSG::dec << " >>> D" << channel << "(HG)"
2684 << " SUMX/N="
2685 << sum[channel*2+HG]
2686 << " / " << nevt
2687 << " = "
2688 << ped[channel*2+HG]
2689 << " SUMX2/N="
2690 << ssq[channel*2+HG]
2691 << " / " << nevt
2692 << " => STD="
2693 << std[channel*2+0]);
2694 ATH_MSG_DEBUG(MSG::hex << msb1 << " + " << lsb1 << " => " << SSQ1 <<
2695 MSG::dec << " >>> D" << channel << "(LG)"
2696 << " SUMX/N="
2697 << sum[channel*2+LG]
2698 << " / " << nevt
2699 << " = "
2700 << ped[channel*2+LG]
2701 << " SUMX2/N="
2702 << ssq[channel*2+LG]
2703 << " / " << nevt
2704 << " => STD="
2705 << std[channel*2+LG]);
2706 } // IF
2707
2708 ped[channel*2+0] = 8500. - ped[channel*2+0];
2709 ped[channel*2+1] = 8500. - ped[channel*2+1];
2710 }
2711
2712 } else { // nevt == 0
2713 ATH_MSG_DEBUG("WARNING NEVT=0");
2714 memset(ped,0,sizeof(ped));
2715 memset(std,0,sizeof(std));
2716 }
2717
2718 if (debug) {
2719 for(int channel=0;channel<16;++channel){
2720 ATH_MSG_DEBUG("HG CHANNEL " << channel << ": sig=" << las[HG+channel*2] << " ped=" << ped[HG+channel*2] << "+/-" << std[HG+channel*2]);
2721 ATH_MSG_DEBUG("LG CHANNEL " << channel << ": sig=" << las[LG+channel*2] << " ped=" << ped[LG+channel*2] << "+/-" << std[LG+channel*2]);
2722 }
2723 }
2724
2725 } else { // short fragment
2726 ATH_MSG_DEBUG("SHORT FRAGMENT, size=" << p[0] << " type=0x" << MSG::hex << p[1] << MSG::dec);
2727 memset(ped,0,sizeof(ped));
2728 memset(std,0,sizeof(std));
2729 }
2730
2731 // ATTENTION: note that HG has even index (0,2,4,...) in las[], ped[], std[] arrays
2732
2733 // STORE PMT INFORMATION
2734 //PMT1
2735 laserObject.setPmt(0,las[HG+10*2],TDC0,laserObject.getMean(10,TileID::HIGHGAIN,0),laserObject.getSigma(10,TileID::HIGHGAIN,0),TileID::HIGHGAIN);
2736 laserObject.setPmt(0,las[LG+10*2],TDC0,laserObject.getMean(10,TileID::LOWGAIN,0), laserObject.getSigma(10,TileID::LOWGAIN,0), TileID::LOWGAIN);
2737 //PMT2
2738 laserObject.setPmt(1,las[HG+14*2],TDC1,laserObject.getMean(14,TileID::HIGHGAIN,0),laserObject.getSigma(14,TileID::HIGHGAIN,0),TileID::HIGHGAIN);
2739 laserObject.setPmt(1,las[LG+14*2],TDC1,laserObject.getMean(14,TileID::LOWGAIN,0), laserObject.getSigma(14,TileID::LOWGAIN,0), TileID::LOWGAIN);
2740
2741 // STORE DIODE INFORMATION
2742 for(int diode=0;diode<10;++diode){
2743 laserObject.setDiode(diode,las[HG+diode*2],laserObject.getMean( diode,TileID::HIGHGAIN,0),
2744 laserObject.getSigma(diode,TileID::HIGHGAIN,0),
2745 laserObject.getMean( diode,TileID::HIGHGAIN,3),
2746 laserObject.getSigma(diode,TileID::HIGHGAIN,3),0.,0.,TileID::HIGHGAIN);
2747 laserObject.setDiode(diode,las[LG+diode*2],laserObject.getMean( diode,TileID::LOWGAIN,0),
2748 laserObject.getSigma(diode,TileID::LOWGAIN,0),
2749 laserObject.getMean( diode,TileID::LOWGAIN,3),
2750 laserObject.getSigma(diode,TileID::LOWGAIN,3),0.,0.,TileID::LOWGAIN);
2751 } // FOR
2752 laserObject.setDiode(10,las[HG+22],laserObject.getMean( 11,TileID::HIGHGAIN,0),
2753 laserObject.getSigma(11,TileID::HIGHGAIN,0),
2754 laserObject.getMean( 11,TileID::HIGHGAIN,3),
2755 laserObject.getSigma(11,TileID::HIGHGAIN,3),0.,0.,TileID::HIGHGAIN); // EXTERNAL CIS 0 HG
2756 laserObject.setDiode(10,las[LG+22],laserObject.getMean( 11,TileID::LOWGAIN,0),
2757 laserObject.getSigma(11,TileID::LOWGAIN,0),
2758 laserObject.getMean( 11,TileID::LOWGAIN,3),
2759 laserObject.getSigma(11,TileID::LOWGAIN,3),0.,0.,TileID::LOWGAIN); // EXTERNAL CIS 0 LG
2760 laserObject.setDiode(11,las[HG+24],laserObject.getMean( 12,TileID::HIGHGAIN,0),
2761 laserObject.getSigma(12,TileID::HIGHGAIN,0),
2762 laserObject.getMean( 12,TileID::HIGHGAIN,3),
2763 laserObject.getSigma(12,TileID::HIGHGAIN,3),0.,0.,TileID::HIGHGAIN); // INTERNAL CIS HG
2764 laserObject.setDiode(11,las[LG+24],laserObject.getMean( 12,TileID::LOWGAIN,0),
2765 laserObject.getSigma(12,TileID::LOWGAIN,0),
2766 laserObject.getMean( 12,TileID::LOWGAIN,3),
2767 laserObject.getSigma(12,TileID::LOWGAIN,3),0.,0.,TileID::LOWGAIN); // INTERNAL CIS LG
2768 laserObject.setDiode(12,las[HG+26],laserObject.getMean( 13,TileID::HIGHGAIN,0),
2769 laserObject.getSigma(13,TileID::HIGHGAIN,0),
2770 laserObject.getMean( 13,TileID::HIGHGAIN,3),
2771 laserObject.getSigma(13,TileID::HIGHGAIN,3),0.,0.,TileID::HIGHGAIN); // PHOTODIODE PHOCAL HG
2772 laserObject.setDiode(12,las[LG+26],laserObject.getMean( 13,TileID::LOWGAIN,0),
2773 laserObject.getSigma(13,TileID::LOWGAIN,0),
2774 laserObject.getMean( 13,TileID::LOWGAIN,3),
2775 laserObject.getSigma(13,TileID::LOWGAIN,3),0.,0.,TileID::LOWGAIN); // PHOTODIODE PHOCAL LG
2776 laserObject.setDiode(13,las[HG+30],laserObject.getMean( 15,TileID::HIGHGAIN,0),
2777 laserObject.getSigma(15,TileID::HIGHGAIN,0),
2778 laserObject.getMean( 15,TileID::HIGHGAIN,3),
2779 laserObject.getSigma(15,TileID::HIGHGAIN,3),0.,0.,TileID::HIGHGAIN); // EXTERNAL CIS HG
2780 laserObject.setDiode(13,las[LG+30],laserObject.getMean( 15,TileID::LOWGAIN,0),
2781 laserObject.getSigma(15,TileID::LOWGAIN,0),
2782 laserObject.getMean( 15,TileID::LOWGAIN,3),
2783 laserObject.getSigma(15,TileID::LOWGAIN,3),0.,0.,TileID::LOWGAIN); // EXTERNAL CIS LG
2784
2785} // unpack_frag17
const bool debug

◆ unpack_frag2()

void TileROD_Decoder::unpack_frag2 ( uint32_t version,
uint32_t sizeOverhead,
const uint32_t * p,
pRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag2 decodes tile subfragment type 0x2.

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse and a quality factor of the reconstruction.

The amplitude is not calibrated and is encoded in ADC counts.

The phase is encoded in ns.

The subfragment type 0x2 contains the reconstructed parameters from the 48 read-out channels of a tilecal module.

Definition at line 787 of file TileROD_Decoder.cxx.

791 {
792 // first word is frag size
793 int count = *(p);
794 // second word is frag ID and frag type
795 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
796
797 // ATH_MSG_VERBOSE( "Unpacking TileRawChannels, ID=" << frag << " size=" << count );
798
799 // ATH_MSG_VERBOSE( "first 2 words " << MSG::hex
800 // << " 0x" << *p
801 // << " 0x" << *(p+1)
802 // << MSG::dec );
803
804 p += 2; // 2 words so far
805 int wc = sizeOverhead; // can be 2 or 3 words
806
807 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
808 TileRawChannel* rc;
809
810 for (unsigned int ch = 0; ch < m_maxChannels; ++ch) {
811 unsigned int w = (*p);
812
813 int gain = m_rc2bytes2.gain(w);
814 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch, gain);
815
816 if (w != 0) { // skip invalid channels
817 rc = new TileRawChannel(adcID, m_rc2bytes2.amplitude(w), m_rc2bytes2.time(w),
818 m_rc2bytes2.quality(w));
819 } else {
820 rc = new TileRawChannel(adcID, 0.0, -100.0, 31);
821 }
822
823 pChannel.push_back(rc);
824
825 // ATH_MSG_VERBOSE(" frag 0x" << MSG::hex << frag
826 // << MSG::dec << " ch " << ch
827 // << " " << MSG::hex << w << MSG::dec
828 // << " " << gain
829 // << " " << m_rc2bytes2.amplitude(w)
830 // << " " << m_rc2bytes2.time(w)
831 // << " " << m_rc2bytes2.quality(w) );
832
833 ++wc;
834 ++p;
835 }
836
837 if (wc != count) {
838 // check word count
840 ATH_MSG_WARNING( "unpack_frag2 => Incorrect word count: "
841 << wc << " != " << count );
842 }
843 assert(0);
844 // return;
845 }
846
847 return;
848}

◆ unpack_frag2HLT()

void TileROD_Decoder::unpack_frag2HLT ( uint32_t version,
uint32_t sizeOverhead,
const uint32_t * p,
FRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag2HLT decodes tile subfragment type 0x2 for the high level trigger (HLT).

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse and a quality factor of the reconstruction.

The amplitude is not calibrated and is encoded in ADC counts.

The phase is encoded in ns.

The subfragment type 0x2 contains the reconstructed parameters from the 48 read-out channels of a tilecal module.

Definition at line 3819 of file TileROD_Decoder.cxx.

3824{
3825 // first word is frag size
3826 int count = *(p);
3827
3828 p += 2; // 2 words so far
3829 int wc = sizeOverhead; // can be 2 or 3 words
3830
3831 for (unsigned int ch = 0; ch < m_maxChannels; ++ch) {
3832 unsigned int w = (*p);
3833
3834 if (w != 0) { // skip invalid channels
3835
3836 pChannel.emplace_back(ch
3837 , m_rc2bytes2.gain(w)
3838 , m_rc2bytes2.amplitude(w)
3839 , m_rc2bytes2.time(w)
3840 , m_rc2bytes2.quality(w));
3841
3842 } else {
3843 pChannel.emplace_back(ch, 1U, 0.0F, 0.0F, 0.0F);
3844 }
3845 ++wc;
3846 ++p;
3847 }
3848
3849 if (wc != count) {
3850 // check word count
3851 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3852 ATH_MSG_WARNING("Incorrect word count: " << wc << " != " << count );
3853 }
3854 assert(0);
3855 // return;
3856 }
3857
3858 return;
3859}

◆ unpack_frag3()

void TileROD_Decoder::unpack_frag3 ( uint32_t version,
uint32_t sizeOverhead,
const uint32_t * p,
pRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag3 decodes tile subfragment type 0x3.

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse and a quality factor of the reconstruction.

The amplitude is not calibrated and it is encoded in ADC counts.

The phase is encoded in ns.

The subfragment type 0x3 contains the reconstructed parameters ONLY from the existing channels of a tilecal module.

Definition at line 850 of file TileROD_Decoder.cxx.

854 {
855 // first word is frag size
856 int count = *(p);
857 // second word is frag ID and frag type
858 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
859
860 // ATH_MSG_VERBOSE( "first 4 words " << MSG::hex
861 // << " 0x" << *p
862 // << " 0x" << *(p+1)
863 // << " 0x" << *(p+2)
864 // << " 0x" << *(p+3) << MSG::dec );
865
866 // followed by 2 map words
867 const uint32_t* pMap = p + 2;
868
869 const short* p16 = reinterpret_cast<const short *>(p);
870
871 p16 = p16 + 8; // 8 16bit words so far
872 short wc16 = 4 + sizeOverhead * 2; // can be 8 or 10 (if overhead is 3 words)
873
874 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
875 TileRawChannel* rc;
876
877 for (unsigned int ch = 0; ch < m_maxChannels; ++ch) {
878 if (checkBit(pMap, ch)) {
879 int gain = m_rc2bytes.gain(*p16);
880 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch, gain);
881
882 rc = new TileRawChannel(adcID
883 , m_rc2bytes.amplitude(*p16)
884 , m_rc2bytes.time(*(p16 + 1))
885 , m_rc2bytes.quality(*(p16 + 2)));
886 pChannel.push_back(rc);
887
888 ATH_MSG_VERBOSE( " frag 0x" << MSG::hex << frag << MSG::dec
889 << " ch " << ch << " " << MSG::hex
890 << "0x" << *p16 << *(p16+1) << *(p16+2) << MSG::dec
891 << " " << gain
892 << " " << m_rc2bytes.amplitude(*p16)
893 << " " << m_rc2bytes.time(*(p16+1))
894 << " " << m_rc2bytes.quality(*(p16+2)) );
895
896 wc16 = wc16 + 3;
897 p16 = p16 + 3;
898 } // channel present
899 } // all bits, done with this frag
900
901 if (wc16 % 2 == 1) {
902 ++wc16; // align
903 ++p16;
904 }
905 if (wc16 != 2 * count) {
906 // check word count
908 ATH_MSG_WARNING( "unpack_frag3 => Incorrect word count: "
909 << wc16 << " != 2*" << count );
910 }
911 assert(0);
912 // return;
913 }
914
915 return;
916}
bool checkBit(const uint32_t *p, int chan) const
check the bitmap for a channel

◆ unpack_frag3HLT()

void TileROD_Decoder::unpack_frag3HLT ( uint32_t version,
uint32_t sizeOverhead,
const uint32_t * p,
FRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag3HLT decodes tile subfragment type 0x3 for the high level trigger (HLT).

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse and a quality factor of the reconstruction.

The amplitude is not calibrated and it is encoded in ADC counts.

The phase is encoded in ns.

The subfragment type 0x3 contains the reconstructed parameters ONLY from the existing channels of a tilecal module.

Definition at line 3861 of file TileROD_Decoder.cxx.

3866{
3867 // first word is frag size
3868 int count = *(p);
3869 // second word is frag ID and frag type
3870
3871 // ATH_MSG_VERBOSE( "first 4 words " << MSG::hex
3872 // << " 0x" << *p
3873 // << " 0x" << *(p+1)
3874 // << " 0x" << *(p+2)
3875 // << " 0x" << *(p+3) << MSG::dec );
3876
3877 // followed by 2 map words
3878 const uint32_t* pMap = p + 2;
3879
3880 const short* p16 = reinterpret_cast<const short *>(p);
3881
3882 p16 = p16 + 8; // 8 16bit words so far
3883 short wc16 = 4 + sizeOverhead * 2; // can be 8 or 10 (if overhead is 3 words)
3884
3885 for (unsigned int ch = 0U; ch < 48U; ++ch) {
3886 if (checkBit(pMap, ch)) {
3887
3888 pChannel.emplace_back(ch
3889 , m_rc2bytes.gain(*p16)
3890 , m_rc2bytes.amplitude(*p16)
3891 , m_rc2bytes.time(*(p16 + 1))
3892 , m_rc2bytes.quality(*(p16 + 2)));
3893
3894 // ATH_MSG_VERBOSE(" frag 0x" << MSG::hex << frag << MSG::dec
3895 // << " ch " << ch
3896 // << " " << MSG::hex << "0x" << *p16 << *(p16+1) << *(p16+2) << MSG::dec
3897 // << " " << gain
3898 // << " " << m_rc2bytes.amplitude(*p16)
3899 // << " " << m_rc2bytes.time(*(p16+1))
3900 // << " " << m_rc2bytes.quality(*(p16+2)) );
3901
3902 wc16 = wc16 + 3;
3903 p16 = p16 + 3;
3904 } // channel present
3905 else {
3906 pChannel.emplace_back(ch, 1U, 0.0F, 0.0F, 0.0F);
3907 }
3908 } // all bits, done with this frag
3909
3910 if (wc16 % 2 == 1) {
3911 ++wc16; // align
3912 ++p16;
3913 }
3914 if (wc16 != 2 * count) {
3915 // check word count
3916 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3917 ATH_MSG_WARNING( "unpack_frag3HLT => Incorrect wordcount: "
3918 << wc16 << " != 2*" << count );
3919 }
3920 assert(0);
3921 // return;
3922 }
3923
3924 return;
3925}

◆ unpack_frag4()

void TileROD_Decoder::unpack_frag4 ( uint32_t version,
uint32_t sizeOverhead,
unsigned int unit,
RawChannelMetaData_t & rawchannelMetaData,
const uint32_t * p,
pRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag4 decodes tile subfragment type 0x4.

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse and a quality factor of the reconstruction.

The amplitude is calibrated to the online units that can be:

The phase is encoded in ns.

The subfragment type 0x4 contains the reconstructed parameters from the 48 read-out channels of a tilecal module.

Definition at line 918 of file TileROD_Decoder.cxx.

925{
926 // first word is frag size
927 int count = *(p);
928 // second word is frag ID and frag type
929 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
930 bool remap = (drawer_type > 0) || std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), frag);
931 const std::vector<int> & chmap = (frag<0x300) ? m_demoChanLB : m_demoChanEB;
932
933 // ATH_MSG_VERBOSE( "Unpacking TileRawChannels, ID=" << frag << " size=" << count <<s);
934
935 // ATH_MSG_VERBOSE( "first 2 words " << MSG::hex
936 // << " 0x" << *p
937 // << " 0x" << *(p+1) << MSG::dec );
938
939 p += 2; // 2 words so far
940 int wc = sizeOverhead; // can be 2 or 3 words
941
942 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
943 TileRawChannel* rc;
946
947 for (unsigned int ch = 0; ch < m_maxChannels; ++ch) {
948 unsigned int w = (*p);
949
950 int gain = m_rc2bytes4.gain(w);
951 int ch1 = (remap) ? chmap[ch] : ch;
952 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch1, gain);
953
954 if (allFF && w!=0xFFFFFFFF) allFF = TileFragStatus::ALL_OK;
955 if (w != 0) { // skip invalid channels
956 if (all00) all00 = TileFragStatus::ALL_OK;
957 rc = new TileRawChannel(adcID
958 , m_rc2bytes4.amplitude(w, unit)
959 , m_rc2bytes4.time(w)
960 , m_rc2bytes4.quality(w));
961 } else {
962 rc = new TileRawChannel(adcID, 0.0, -100., 31);
963 }
964
965 pChannel.push_back(rc);
966
967 // ATH_MSG_VERBOSE( MSG::hex << " frag 0x" << frag << MSG::dec
968 // << " ch " << ch
969 // << " 0x" << MSG::hex << w << MSG::dec
970 // << " " << gain
971 // << " " << m_rc2bytes4.amplitude(w)
972 // << " " << m_rc2bytes4.time(w)
973 // << " " << m_rc2bytes4.quality(w) );
974
975 ++wc;
976 ++p;
977 }
978 if (remap) std::sort(pChannel.end()-m_maxChannels,pChannel.end(),chan_order);
979
980 rawchannelMetaData[6].push_back( all00 | allFF );
981
982 if (wc > count) {
983 // check word count
985 ATH_MSG_WARNING( "unpack_frag4 => Incorrect word count: "
986 << wc << " != " << count );
987 }
988 assert(0);
989 // return;
990 // } else if (wc < count) {
991 // ATH_MSG_VERBOSE("unpack_frag4 => extra " << count-wc << " words in frag" );
992 }
993
994 return;
995}
TileRawChannel2Bytes4 m_rc2bytes4

◆ unpack_frag40()

void TileROD_Decoder::unpack_frag40 ( uint32_t collid,
uint32_t version,
const uint32_t * p,
int size,
TileDigitsCollection & coll ) const
private

unpacking methods dedicated to the TMDB ROD format sub-fragments 0x40 0x41 0x42

Definition at line 4699 of file TileROD_Decoder.cxx.

4700 {
4701
4702 int ros = (collid >> 8);
4703 int drawer = collid & 0xff;
4704 HWIdentifier drawerID = m_tileHWID->drawer_id(ros, drawer);
4705 int nsamp = 7; // assume fixed number of samples for the moment
4706 int nmod = (ros > 2) ? 8 : 4; // we have 8 modules per fragment in ext.barrel, 4 modules in barrel
4707 int nchan = 4 * datasize / nmod / nsamp; // factor 4 because in one 32-bit word we have 4 samples
4708
4709 int nsamp1 = nsamp - 1;
4710
4711 std::vector<float> digits(nsamp);
4712
4713 // Each 32 bit word is made of four 8-bit words each a ADC of a sample like
4714 //
4715 // 32nd bit -> | 37/D6R | 38/D6L | 16/D5R | 17/D5L | <- 1st bit
4716 //
4717 // First come 8 words (M0->M7) with sample 0 and so forth i.e. the digits for the first module are placed by words: {0,8,16,24,32,40,48}.
4718 // Note that order of samples is inversed with respect to time line,
4719 // i.e. first sample from data should go to the last sample in TileDigits vector
4720
4721 int wpos = (collid % nmod) * nchan; // location of first sample for given channel in given module
4722 int jump = nchan * nmod; // distance between samples for one channel in number of bytes
4723 const unsigned char * adc = reinterpret_cast<const unsigned char *>(p);
4724
4725 for (int i = 0; i < nchan; ++i) {
4726 for (int j = 0; j < nsamp; ++j) {
4727 digits[nsamp1 - j] = adc[wpos + jump * j];
4728 }
4729 ++wpos;
4730 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, i, TileID::LOWGAIN);
4731 TileDigits *digitmp = new TileDigits(adcID, digits);
4732 coll.push_back(digitmp);
4733 }
4734
4735 if (msgLvl(MSG::DEBUG)) {
4736 msg(MSG::DEBUG) << "TileROD_Decoder::unpack_frag40 frag: 0x" << MSG::hex << collid << MSG::dec
4737 << " version: " << version << endmsg;
4738
4739 int pos = coll.size() - nchan;
4740 const char * strchannel[13] = { " d5L ", " d5R ", " d6L ", " d6R ",
4741 " xxx ", " d0x ", " d1L ", " d1R ", " d2L ", " d2R ", " d3L ", " d3R ", " xxx " };
4742 int nchmax = (ros > 2) ? 4 : 8;
4743 for (int i = 0; i < nchan; ++i) {
4744 const std::vector<float> & sample = coll.at(pos + i)->samples();
4745 std::stringstream ss;
4746 for (const auto & val : sample) {
4747 ss << std::setw(5) << int(val);
4748 }
4749 msg(MSG::DEBUG) << " ros:" << ros
4750 << " drawer:" << drawer
4751 << " ch:" << i << strchannel[std::min(i, nchmax)+nchmax-4] << ss.str() << endmsg;
4752 }
4753 }
4754
4755 return;
4756}
static Double_t ss
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.

◆ unpack_frag41()

void TileROD_Decoder::unpack_frag41 ( uint32_t collid,
uint32_t version,
const uint32_t * p,
int size,
TileRawChannelCollection & coll ) const
private

Definition at line 4758 of file TileROD_Decoder.cxx.

4758 {
4759
4760 int ros=(collid>>8);
4761 int drawer=collid&0xff;
4762 HWIdentifier drawerID = m_tileHWID->drawer_id(ros,drawer);
4763 float calFactorADC2MeV = 1.0;
4764
4765 int nmod = (ros>2)?8:4; // we have 8 modules per fragment in ext.barrel, 4 modules in barrel
4766 int nchan = datasize / nmod;
4767
4768 int wpos = (collid % nmod) * nchan;
4769
4770 if (version == 0) {
4771
4772 // Each 32 bit word is an energy of a channel pmt
4773 //
4774 // 32nd bit -> | 17/D5L | <- 1st bit
4775 // 32nd bit -> | 16/D5R | <- 1st bit
4776 // 32nd bit -> | 37/D6L | <- 1st bit
4777 // 32nd bit -> | 38/D6R | <- 1st bit
4778 //
4779 // Each 4 words respect a module.
4780
4781 const int32_t * pp = reinterpret_cast<const int32_t *>(p);
4782 pp += wpos;
4783 for (int i = 0; i < nchan; ++i) {
4784 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, i, TileID::LOWGAIN);
4785 TileRawChannel *rctmp = new TileRawChannel(adcID, (*pp) * calFactorADC2MeV, 0., 0.);
4786 coll.push_back(rctmp);
4787 ++pp;
4788 }
4789
4790 } else {
4791
4792 // Each 32 bit word is made of two 16-bit words each a energy of a channel pmt
4793 //
4794 // 32nd bit -> | 16/D5R | 17/D5L | <- 1st bit
4795 // 32nd bit -> | 38/D6R | 37/D6L | <- 1st bit
4796 //
4797 // Each 2 words respect a module.
4798
4799 nchan *= 2; // change number of channels calculated before assuming 16 bits for channel
4800 const int16_t * pp = reinterpret_cast<const int16_t *>(p);
4801 pp += wpos;
4802 for (int i = 0; i < nchan; ++i) {
4803 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, i, TileID::LOWGAIN);
4804 TileRawChannel *rctmp = new TileRawChannel(adcID, (*pp) * calFactorADC2MeV, 0., 0.);
4805 coll.push_back(rctmp);
4806 ++pp;
4807 }
4808 }
4809
4810 if (msgLvl(MSG::DEBUG)) {
4811 msg(MSG::DEBUG) << " TileROD_Decoder::unpack_frag41 frag: 0x" << MSG::hex << collid << MSG::dec
4812 << " version: " << version << endmsg;
4813
4814 int nbits = (version == 0) ? 32 : 16;
4815 msg(MSG::DEBUG) << " position of " << nbits << "-bit word inside sub-fragment 0x41: " << wpos << endmsg;
4816 int pos = coll.size() - nchan;
4817 const char * strchannel[13] = { " d5L ", " d5R ", " d6L ", " d6R ",
4818 " xxx ", " d0x ", " d1L ", " d1R ", " d2L ", " d2R ", " d3L ", " d3R ", " xxx " };
4819 int nchmax = (ros > 2) ? 4 : 8;
4820 for (int i = 0; i < nchan; ++i) {
4821 msg(MSG::DEBUG) << " ros:" << ros
4822 << " drawer:" << drawer
4823 << " ch:" << i << strchannel[std::min(i, nchmax)+nchmax-4] << coll.at(pos + i)->amplitude() << endmsg;
4824 }
4825 }
4826
4827 return;
4828}
setScaleOne setStatusOne setSaturated int16_t

◆ unpack_frag42()

void TileROD_Decoder::unpack_frag42 ( uint32_t sourceid,
uint32_t version,
const uint32_t * p,
int size,
TileMuonReceiverContainer & v ) const
private

Definition at line 4830 of file TileROD_Decoder.cxx.

4830 {
4831
4832 // == RUN 2 ==
4833 // results are hold in 3 16-bit words.
4834 //
4835 // 32nd bit -> | results2 || results1 | <- 1st bit
4836 // | 0x0 || results3 |
4837 //
4838 // 32nd bit -> | m-5 | m-4 | m-3 | m-2 || m-2 | m-1 | m-0 | 0x0 | <- 1st bit
4839 // | 0x0 || 0x0 | m-7 | m-6 | m-5 |
4840 //
4841 // each 4 bit word is
4842 // 0 1 2 3 <-- in Obj
4843 // | d56h | d56l | d6h | d6l |
4844 // bit3 bit2 bit1 bit0
4845 //
4846 // bit-3 -> result.at(0)
4847 // bit-2 .
4848 // bit-1 .
4849 // bit-0 -> result.at(3)
4850 //
4851 // == RUN 3 ==
4852 // results are hold in 3 16-bit words.
4853 //
4854 // 32nd bit -> | results2 [16:31] || results1 [0:15] | <- 1st bit
4855 // 32nd bit -> | 0x0 [16:31] || results3 [0:15] | <- 1st bit
4856 //
4857 // 32nd bit -> | bcid1 [12:15] | m-5 | m-4 | m-3 | m-2 || bcid0 [12:15] | m-3 | m-2 | m-1 | m-0 | <- 1st bit
4858 // | 0x0 [16:31] || bcid2 [12:15] | m-7 | m-6 | m-5 | m-4 |
4859 //
4860 // For each module m-X there is a 3-bit word with the results for a threshold
4861 //
4862 // | d5+d6 | d6 | d5 |
4863 // | bit2 | bit1 | bit0 |
4864 //
4865
4866 int nbit=0;
4867 int nmod=0;
4868 uint32_t word=0x0;
4869 uint32_t bcid=0x0;
4870
4871 int drawer = (sourceid & 0xf0000) >> 8; // get ROS number from source ID
4872 if (drawer<0x300) { // barrel
4873 nbit = 4;
4874 nmod = 4;
4875 drawer |= ((sourceid & 0x0000f) << 2);
4876 word = (datasize > 0) ? p[0] : 0; // just use first word, although expect all zeros for the moment
4877 } else { // extended barrel
4878 nbit = 4;
4879 nmod = 8;
4880 drawer |= ((sourceid & 0x0000f) << 3);
4881 if (datasize > 1) {
4882 if (m_runPeriod<=2) {
4883 word = (p[1] << 20) | ((p[0] >> 8) & 0xff000) | ((p[0] >> 4) & 0xfff);
4884 } else {
4885 word = ((p[1] & 0xfff) << 12) | (p[0] & 0xfff);
4886 // keeping all 12 bits of information (just for cross check) |bcid2|bcid1|bcid0|
4887 bcid = ((p[1] >> 4) & 0xf00) | ((p[0] >> 24) & 0xf0) | ((p[0] >> 12) & 0xf);
4888 }
4889 }
4890 }
4891
4892 drawer |= (bcid<<16) ;
4893
4894 std::vector<bool> result(nbit);
4895 for (int j = 0; j < nmod; ++j) { // loop over modules
4896 for (int k = nbit-1; k >= 0; --k) { // loop over bits of one module in inversed order
4897 if (m_runPeriod<=2) {
4898 result[k] = (word & 1);
4899 word >>= 1;
4900 } else {
4901 if (k==0) {
4902 result[k]=0;
4903 } else {
4904 result[k] = (word & 1);
4905 word >>= 1;
4906 }
4907 }
4908 }
4909 TileMuonReceiverObj * obj = new TileMuonReceiverObj(drawer, result);
4910 v.push_back(obj);
4911 ++drawer;
4912 }
4913
4914 if (msgLvl(MSG::DEBUG)) {
4915 if (m_runPeriod<=2) msg(MSG::DEBUG) << "TMDB version for RUN2 simulation (2014)" <<endmsg;
4916 else msg(MSG::DEBUG) << "TMDB version for RUN3 simulation (2020)" <<endmsg;
4917
4918 msg(MSG::DEBUG) << " TileROD_Decoder::unpack_frag42 source ID: 0x" << MSG::hex << sourceid << MSG::dec
4919 << " version: " << version << " bcid | drawer " << MSG::hex << drawer << endmsg;
4920
4921 for (size_t j = v.size() - nmod; j < v.size(); ++j) {
4922 const std::vector<bool> & r = v[j]->GetDecision();
4923 std::stringstream ss;
4924 for (const bool val : r) {
4925 ss << std::setw(2) << val;
4926 }
4927 msg(MSG::DEBUG) << MSG::hex << "0x" << v[j]->GetID() << MSG::dec << ss.str() << endmsg;
4928 }
4929 }
4930
4931 return;
4932}

◆ unpack_frag4HLT()

void TileROD_Decoder::unpack_frag4HLT ( uint32_t version,
uint32_t sizeOverhead,
unsigned int unit,
const uint32_t * p,
FRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag4HLT decodes tile subfragment type 0x4 for the high level trigger (HLT).

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse and a quality factor of the reconstruction.

The amplitude is calibrated to the online units that can be:

The phase is encoded in ns.

The subfragment type 0x4 contains the reconstructed parameters from the 48 read-out channels of a tilecal module.

Definition at line 3927 of file TileROD_Decoder.cxx.

3933{
3934 // first word is frag size
3935 int count = *(p);
3936 // second word is frag ID and frag type
3937 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
3938 bool remap = (drawer_type > 0) || std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), frag);
3939 const std::vector<int> & chmap = (frag<0x300) ? m_demoChanLB : m_demoChanEB;
3940
3941 p += 2; // 2 words so far
3942 int wc = sizeOverhead; // can be 2 or 3 words
3943 for (unsigned int ch = 0U; ch < m_maxChannels; ++ch) {
3944 unsigned int ch1 = (remap) ? chmap[ch] : ch;
3945 unsigned int w = (*p);
3946 if (w != 0) { // skip invalid channels
3947 pChannel.emplace_back(ch1
3948 , m_rc2bytes4.gain(w)
3949 , m_rc2bytes4.amplitude(w, unit)
3950 , m_rc2bytes4.time(w)
3951 , m_rc2bytes4.quality(w));
3952
3953 } else {
3954 pChannel.emplace_back(ch1, 1U, 0.0F, 0.0F, 0.0F);
3955 }
3956 ++wc;
3957 ++p;
3958 }
3959 if (remap) std::sort(pChannel.end()-m_maxChannels,pChannel.end(),chan_order1);
3960
3961 if (wc > count) {
3962 // check word count
3963 if ((m_ErrorCounter++) < m_maxErrorPrint) {
3964 ATH_MSG_WARNING( "unpack_frag4HLT => Incorrect word count: "
3965 << wc << " != " << count );
3966 }
3967 assert(0);
3968 // return;
3969 }
3970
3971 return;
3972}
bool chan_order1(const TileFastRawChannel &a, const TileFastRawChannel &b)

◆ unpack_frag4L2()

bool TileROD_Decoder::unpack_frag4L2 ( uint32_t version,
uint32_t sizeOverhead,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag4L2 decodes tile subfragment type 0x4 and extract transverse energy from this fragment

Definition at line 4037 of file TileROD_Decoder.cxx.

4041 {
4042 // first word is frag size
4043 int size = *(p);
4044 // second word is frag ID and frag type
4045 uint32_t idAndType = *(p + 1);
4046 int frag = (frag_id>0) ? frag_id : idAndType & 0xFFFF;
4047 int unit = (idAndType >> (32 - 2)) & 0x3;
4048
4049#ifdef DO_NOT_USE_MUON_TAG
4050
4051 p += 50; // offset 50: 2 words in header and 48 channels after
4052
4053#else
4054
4055 // this part should be very similar to unpack_frag4HLT - it reads amplitude from DSP
4056 // and then uses vector of 48 amplitudes to calculate Muon tags
4057 // but since nobody is using Tile Muon tags in L2 trigger
4058 // this part is not implemented
4059
4060 p+=50;// offset 50: 2 words in header and 48 channels after
4061
4062#endif
4063
4064 int size_L2 = size - sizeOverhead - 48;
4065 if (size_L2 > 0) {
4066
4067 std::vector<float> sumE;
4068 sumE.reserve(size_L2);
4069 while (size_L2--) {
4070 sumE.push_back(Frag5_unpack_bin2sum(unit, (int)(*(p++))));
4071 }
4072 (*pL2[m_hashFunc(frag)]).setEt(std::move(sumE));
4073
4074 return true;
4075
4076 } else {
4077
4078 return false; // indicate that there is no sumEt info in the fragment
4079 }
4080}

◆ unpack_frag5()

void TileROD_Decoder::unpack_frag5 ( uint32_t version,
uint32_t sizeOverhead,
unsigned int unit,
DigitsMetaData_t & digitsMetaData,
const uint32_t * p,
pDigiVec & pDigits,
pRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag5 decodes tile subfragment type 0x4.

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse and a quality factor of the reconstruction.

The amplitude is calibrated to the online units that can be:

The phase is encoded in ns.

The subfragment type 0x5 contains the reconstructed parameters and residuals from the 48 read-out channels of a tilecal module.

Definition at line 997 of file TileROD_Decoder.cxx.

1004{
1005 // first word is frag size
1006 int count = *(p);
1007 // second word is frag ID and frag type
1008 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
1009 bool remap = (drawer_type > 0) || std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), frag);
1010 const std::vector<int> & chmap = (frag<0x300) ? m_demoChanLB : m_demoChanEB;
1011 int size_L2 = (*(p + 1) >> (32 - 2 - 3)) & 0x7;
1012
1013 // store metadata for this collection
1014 // size, fragID, BCID
1015 digitsMetaData[0].push_back(count);
1016 digitsMetaData[0].push_back(frag);
1017 digitsMetaData[0].push_back(0);
1018
1019 TileRawChannel2Bytes5::TileChanData ChanData[48];
1020 const uint32_t* ptrFrag = reinterpret_cast<const uint32_t*> (p - 1); // begin of fragment
1021 const uint32_t* ptrOFW = getOFW(frag, unit); // get OF Weights
1022 m_rc2bytes5.unpack(ptrOFW, ptrFrag, ChanData);
1023
1024 int wc = sizeOverhead; // can be 2 or 3 words
1025 int bc = (size_L2 * 32 + 48) / 8; // size_L2 + BadBits
1026
1027 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
1028
1029 std::vector<float> digiVec(7);
1030 if (m_useFrag5Raw) pDigits.reserve(pDigits.size() + 48);
1031 if (m_useFrag5Reco) pChannel.reserve(pChannel.size() + 48);
1032
1033 for (int ch = 0; ch < 48; ++ch) {
1034 int size = m_rc2bytes5.get_size_code(ChanData[ch].code);
1035 int gain = ChanData[ch].gain;
1036 int ch1 = (remap) ? chmap[ch] : ch;
1037 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch1, gain);
1038
1039 if (m_useFrag5Raw) {
1040 for (int i = 0; i < 7; ++i) digiVec[i] = ChanData[ch].s[i];
1041 TileDigits* td = new TileDigits(adcID, digiVec);
1042 pDigits.push_back(td);
1043 }
1044
1045 if (m_useFrag5Reco) {
1046 int format = m_rc2bytes5.get_format(ChanData[ch].code);
1047 int quality = m_rc2bytes5.get_quality(ChanData[ch].bad, format);
1048 float ene = ChanData[ch].ene;
1049 float time = ChanData[ch].time;
1050
1051 TileRawChannel* rc = new TileRawChannel(adcID, ene, time, quality);
1052 pChannel.push_back(rc);
1053 }
1054 bc += size;
1055 }
1056 if (remap) {
1057 std::sort(pDigits.end()-m_maxChannels,pDigits.end(),chan_order);
1058 std::sort(pChannel.end()-m_maxChannels,pChannel.end(),chan_order);
1059 }
1060
1061 wc += (bc + 3) / 4;
1062 if (wc > count) {
1063 // check word count
1064 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1065 ATH_MSG_WARNING( " unpack_frag5 => Incorrect word count: "
1066 << wc << " != " << count );
1067 }
1068 assert(0);
1069 // return;
1070 } else if (wc < count) {
1071 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1072 ATH_MSG_WARNING( "unpack_frag5 => extra " << count - wc
1073 << " words in frag" );
1074 ATH_MSG_WARNING( " count = " << count
1075 << " wc = " << wc
1076 << " bc = " << bc
1077 << " words in frag" );
1078 }
1079 }
1080 return;
1081}
const uint32_t * getOFW(int fragId, int unit) const
getOFW returns Optimal Filtering Weights for Frag5 decoder loaded from COOL for correspondent units.

◆ unpack_frag5HLT()

void TileROD_Decoder::unpack_frag5HLT ( uint32_t version,
uint32_t sizeOverhead,
unsigned int unit,
const uint32_t * p,
FRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_frag5HLT decodes tile subfragment type 0x5 for the high level trigger (HLT).

This subfragment contains the reconstructed amplitude and phase from the tilecal digitized pulse

The amplitude is calibrated to the online units that can be:

The phase is encoded in ns.

The subfragment type 0x5 contains the reconstructed parameters and residuals from the 48 read-out channels of a tilecal module.

Definition at line 3974 of file TileROD_Decoder.cxx.

3980{
3981 // first word is frag size
3982 int count = *(p);
3983 // second word is frag ID and frag type
3984 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF;
3985 bool remap = (drawer_type > 0) || std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), frag);
3986 const std::vector<int> & chmap = (frag<0x300) ? m_demoChanLB : m_demoChanEB;
3987 int size_L2 = (*(p + 1) >> (32 - 2 - 3)) & 0x7;
3988
3989 p += 2; // 2 words so far
3990 int wc = sizeOverhead; // can be 2 or 3 words
3991 const uint16_t* ptr_bad = reinterpret_cast<const uint16_t*> (p + 48 + size_L2); // Reco + Size_L2
3992 uint16_t bad_bits[3] = { ptr_bad[1], ptr_bad[0], ptr_bad[3] };
3993
3994 uint32_t code;
3995 int fmt, bad, gain(0), ene_bin(0), time_bin(0), quality;
3996 unsigned int w;
3997 float ene(0.0), time(0.0);
3998
3999 unsigned int ch = 0U;
4000 for (unsigned int i = 0U; i < 3U; ++i) {
4001 uint16_t bad16 = ~bad_bits[i]; // note inversion here
4002 for (unsigned int j = 0U; j < 16U; ++j) {
4003 w = (*p);
4004
4005 code = w >> 24;
4006 fmt = m_rc2bytes5.m_FormatLookup[code];
4007 Frag5_unpack_reco_bin(w, code, gain, ene_bin, time_bin);
4008 Frag5_unpack_bin2reco(unit, gain, ene_bin, ene, time_bin, time);
4009 //m_rc2bytes5.unpack_reco(w, fmt, gain, ene, time);
4010
4011 bad = (bad16 & 0x1);
4012 bad16 >>= 1;
4013 quality = m_rc2bytes5.get_quality(bad, fmt);
4014 unsigned int ch1 = (remap) ? chmap[ch] : ch;
4015 pChannel.emplace_back(ch1, gain, ene, time, quality);
4016
4017 ++ch;
4018 ++wc;
4019 ++p;
4020 }
4021 }
4022 if (remap) std::sort(pChannel.end()-m_maxChannels,pChannel.end(),chan_order1);
4023
4024 if (wc > count) {
4025 // check word count
4026 if ((m_ErrorCounter++) < m_maxErrorPrint) {
4027 ATH_MSG_WARNING( "unpack_frag5HLT => Incorrect word count: "
4028 << wc << " != " << count );
4029 }
4030 assert(0);
4031 // return;
4032 }
4033
4034 return;
4035}
#define Frag5_unpack_reco_bin(w, code, gain, amp, time)
unpack_reco_bin
#define Frag5_unpack_bin2reco(unit, gain, amp_bin, amp, time_bin, time)
unpack_bin2reco
const char *const fmt

◆ unpack_frag5L2()

bool TileROD_Decoder::unpack_frag5L2 ( uint32_t version,
const uint32_t * p,
TileL2Container & v,
int fragID,
int demoType ) const
private

unpack_frag5L2 decodes tile subfragment type 0x5 and extract transverse energy from this fragment

Definition at line 4082 of file TileROD_Decoder.cxx.

4084 {
4085 // second word is frag ID and frag type
4086 uint32_t idAndType = *(p + 1);
4087 int frag = (frag_id>0) ? frag_id : idAndType & 0xFFFF;
4088 int unit = (idAndType >> (32 - 2)) & 0x3;
4089 int size_L2 = (idAndType >> (32 - 2 - 3)) & 0x7;
4090
4091#ifdef DO_NOT_USE_MUON_TAG
4092
4093 p += 50; // offset 50: 2 words in header and 48 channels after
4094
4095#else
4096
4097 // this part is very similar to unpack_frag5HLT - it reads amplitude from DSP
4098 // and then uses vector of 48 amplitudes to calculate Muon tags
4099 // all this is written only for tests and will not be used actually,
4100 // since nobody is using Tile Muon tags in L2 trigger
4101
4102 p+=2;// 2 words so far
4103
4104 int drawer = (frag & 0x3F);
4105 int ros = (frag >> 8);
4106 int drawerIdx = TileCalibUtils::getDrawerIdx(ros,drawer);
4108 bool recalibrate = (onlUnit != TileRawChannelUnit::OnlineMegaElectronVolts);
4109 float E_MeV[48];
4110 int Gain[48];
4111 bool bad[48];
4112
4113 uint16_t* ptr_bad = (uint16_t*)(p + 48 + size_L2);// Reco + Size_L2
4114 uint16_t bad_bits[3] = {ptr_bad[1], ptr_bad[0], ptr_bad[3]};
4115
4116 uint32_t code;
4117 int fmt, gain(0), ene_bin(0), time_bin(0);
4118 unsigned int w;
4119 float ene(0.0), time(0.0);
4120
4121 int ch = 0;
4122 for (int i = 0; i < 3; ++i) {
4123 uint16_t bad16 = ~bad_bits[i]; // note inversion here
4124 for (int j = 0; j < 16; ++j) {
4125 w = (*p);
4126
4127 code = w >> 24;
4128 fmt = m_rc2bytes5.m_FormatLookup[code];
4129 Frag5_unpack_reco_bin(w, code, gain, ene_bin, time_bin);
4130 Frag5_unpack_bin2reco(unit, gain, ene_bin, ene, time_bin, time);
4131 //m_rc2bytes5.unpack_reco(w, fmt, gain, ene, time);
4132
4133 bad[ch] = (bad16 & 0x1); bad16 >>= 1;
4134 Gain[ch] = gain;
4135 if (recalibrate)
4136 E_MeV[ch] = m_tileToolEmscale->channelCalib(drawerIdx, ch, gain, ene, onlUnit, TileRawChannelUnit::MegaElectronVolts);
4137 else
4138 E_MeV[ch] = ene;
4139
4140 ++ch;
4141 ++p;
4142 }
4143 }
4144
4145 std::vector<double> EtaMuons;
4146 std::vector<double> EMuons0;
4147 std::vector<double> EMuons1;
4148 std::vector<double> EMuons2;
4149 std::vector<unsigned int> qf;
4150 std::vector<unsigned int> word;
4151
4152 switch (ros) {
4153 case TileHWID::BARREL_POS: m_L2Builder->MTagLB(ros,drawer,E_MeV,Gain,bad,EtaMuons,EMuons0,EMuons1,EMuons2,qf,word); break;
4154 case TileHWID::BARREL_NEG: m_L2Builder->MTagLB(ros,drawer,E_MeV,Gain,bad,EtaMuons,EMuons0,EMuons1,EMuons2,qf,word); break;
4155 case TileHWID::EXTBAR_POS: m_L2Builder->MTagEB(ros,drawer,E_MeV,Gain,bad,EtaMuons,EMuons0,EMuons1,EMuons2,qf,word); break;
4156 case TileHWID::EXTBAR_NEG: m_L2Builder->MTagEB(ros,drawer,E_MeV,Gain,bad,EtaMuons,EMuons0,EMuons1,EMuons2,qf,word); break;
4157 default: ATH_MSG_WARNING( "unpack_frag5L2: incorrect ros value: " << ros );
4158 }
4159
4160 (*pL2[m_hashFunc(frag)]).setMu(std::move(EtaMuons), std::move(EMuons0),
4161 std::move(EMuons1), std::move(EMuons2), std::move(qf), std::move(word));
4162
4163#endif
4164
4165 if (size_L2 > 0) {
4166
4167 std::vector<float> sumE;
4168 sumE.reserve(size_L2);
4169 while (size_L2--) {
4170 sumE.push_back(Frag5_unpack_bin2sum(unit, (int)(*(p++))));
4171 }
4172 (*pL2[m_hashFunc(frag)]).setEt(std::move(sumE));
4173
4174 return true;
4175
4176 } else {
4177
4178 return false; // indicate that there is no sumEt info in the fragment
4179 }
4180}
@ BARREL_POS
Definition TileHWID.h:68
@ EXTBAR_NEG
Definition TileHWID.h:71
@ BARREL_NEG
Definition TileHWID.h:69
@ EXTBAR_POS
Definition TileHWID.h:70

◆ unpack_frag6()

void TileROD_Decoder::unpack_frag6 ( uint32_t version,
uint32_t sizeOverhead,
DigitsMetaData_t & digitsMetaData,
const uint32_t * p,
pDigiVec & pDigits,
int fragID,
int demoType ) const
private

unpack_frag6 decodes tile subfragment type 0x6.

This subfragment contains the tile raw digits with 16 samples and 2 gains from the 48 read-out channels of a tilecal module.

Definition at line 1113 of file TileROD_Decoder.cxx.

1118{
1119 int size = *(p)- sizeOverhead;
1120 const uint32_t* data = p+2; // pointer to current data word Position of first data word,
1121 // second word is frag ID (0x100-0x4ff) and frag type
1122 int frag = (frag_id>0) ? frag_id : *(p + 1) & 0xFFFF; /* (*(data +3)>>16) & 0xFF;*/
1123 bool remap = (drawer_type > 0) || std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), frag);
1124 const std::vector<int> & chmap = (frag<0x300) ? m_demoChanLB : m_demoChanEB;
1125
1126 HWIdentifier adcID;
1127 HWIdentifier drawerID = m_tileHWID->drawer_id(frag);
1128
1131
1132 for (int i = 0; i < size; ++i) {
1133 uint32_t w = data[i];
1134 if (allFF && w!=0xFFFFFFFF) {
1135 allFF = TileFragStatus::ALL_OK;
1136 if (all00 == TileFragStatus::ALL_OK) break;
1137 }
1138 if (all00 && w != 0) {
1139 all00 = TileFragStatus::ALL_OK;
1140 if (allFF == TileFragStatus::ALL_OK) break;
1141 }
1142 }
1143
1144 uint32_t status = (all00 | allFF);
1145 digitsMetaData[6].push_back( status );
1146
1147 // check that fragment is not dummy
1149 ATH_MSG_WARNING("FRAG6: Suppress dummy fragment!!!");
1150 return; // nothing reasonable found
1151 }
1152
1153 using Tile = TileCalibUtils;
1154 unsigned int moduleID[Tile::MAX_MINIDRAWER] = {0};
1155 unsigned int runType[Tile::MAX_MINIDRAWER] = {0};
1156
1157 unsigned int runNumber[Tile::MAX_MINIDRAWER] = {0};
1158
1159 unsigned int pedestalHi[Tile::MAX_MINIDRAWER] = {0};
1160 unsigned int pedestalLo[Tile::MAX_MINIDRAWER] = {0};
1161
1162 unsigned int chargeInjected[Tile::MAX_MINIDRAWER] = {0};
1163 unsigned int timeInjected[Tile::MAX_MINIDRAWER] = {0};
1164 unsigned int capacitor[Tile::MAX_MINIDRAWER] = {0};
1165
1166 uint32_t bcid[Tile::MAX_MINIDRAWER] = {0};
1167 uint32_t l1id[Tile::MAX_MINIDRAWER] = {0};
1168
1169 uint32_t ecr[Tile::MAX_MINIDRAWER] = {0};
1170 uint32_t bcr[Tile::MAX_MINIDRAWER] = {0};
1171
1172 uint32_t fragmentID[Tile::MAX_MINIDRAWER] = {0};
1173 uint32_t packetVersion[Tile::MAX_MINIDRAWER] = {0};
1174
1175 int version = 0;
1176
1177 int mdFragmentSize = (*data) & 0xFFFF;
1178 int sampleNumber = mdFragmentSize / Tile::MAX_MINIDRAWER_CHAN;
1179
1180 std::vector<std::vector<std::vector<float>>> samples(Tile::MAX_GAIN,
1181 std::vector<std::vector<float>>(Tile::MAX_CHAN,
1182 std::vector<float>(sampleNumber)));
1183
1184 const uint32_t* const end_data = data + size;
1185 while (data < end_data) {
1186 if (*data == 0x12345678 ) {
1187 mdFragmentSize = (*(data - 2)) & 0xFFFF;
1188
1189 if ((++data < end_data)) {
1190
1191 version = (((*data >> 16) & 0xFFFF) == 0) ? 1 : 0;
1192 int mdSizeOverhead = (version == 0) ? 10 : 11;
1193 int delta = mdFragmentSize - (sampleNumber * Tile::MAX_MINIDRAWER_CHAN + mdSizeOverhead);
1194 if (delta != 0) {
1195 ATH_MSG_WARNING( "FRAG6: Unexpected MD fragment size " << mdFragmentSize << " => "
1196 << sampleNumber << " samples will be unpacked and last "
1197 << delta << " words will be ignored ");
1198 }
1199
1200 unsigned int miniDrawer = -1;
1201
1202 // check trailer
1203 const uint32_t* trailer = data + mdFragmentSize - 4;
1204 if (trailer < end_data && *trailer == 0x87654321) {
1205
1206 unsigned int paramsSize = 3;
1207 if (version == 0) {
1208 unsigned int fragSize = *data & 0xFF;
1209 paramsSize = (*data >> 8 ) & 0xFF;
1210
1211 miniDrawer = *(data + 4) & 0xFF;
1212
1213 moduleID[miniDrawer] = (*data >> 16) & 0xFF;
1214 runType[miniDrawer] = (*data >> 24) & 0xFF;
1215 if (fragSize != sampleNumber * Tile::MAX_MINIDRAWER_CHAN) {
1216 ATH_MSG_WARNING("FRAG6: Minidrawer [" << miniDrawer
1217 << "] has unexpected fragment size: " << fragSize
1218 << " correct value for " << sampleNumber
1219 << " samples is " << sampleNumber * Tile::MAX_MINIDRAWER_CHAN);
1220 }
1221
1222 if (paramsSize == 3){
1223 runNumber[miniDrawer] = *(++data);
1224
1225 pedestalLo[miniDrawer] = *(++data) & 0xFFF;
1226 pedestalHi[miniDrawer] = (*data >> 12 ) & 0xFFF;
1227
1228 chargeInjected[miniDrawer] = *(++data) & 0xFFF;
1229 timeInjected[miniDrawer] = (*data >> 12) & 0xFF;
1230 capacitor[miniDrawer] = (*data >> 20) & 0x1;
1231 } else {
1232
1233 ATH_MSG_WARNING("FRAG6: Minidrawer [" << miniDrawer
1234 << "] has unexpected number of parameter words: " << paramsSize
1235 << " => ignore them !!!");
1236 data += paramsSize;
1237 }
1238
1239 bcid[miniDrawer] = (*(++data) >> 16) & 0xFFFF;
1240 l1id[miniDrawer] = *(++data) & 0xFFFFFF;
1241 ecr[miniDrawer] = (*data >> 24) & 0xFF;
1242
1243 } else {
1244
1245 miniDrawer = *(data + 1) & 0xFF;
1246
1247 packetVersion[miniDrawer] = (*data) & 0xFF;
1248 fragmentID[miniDrawer] = (*data >> 8) & 0xFF;
1249
1250 bcid[miniDrawer] = (*(++data) >> 8) & 0xFFF;
1251 moduleID[miniDrawer] = (*data >> 20) & 0xFFF;
1252
1253 l1id[miniDrawer] = *(++data) & 0xFFFFFF;
1254 ecr[miniDrawer] = (*data >> 24) & 0xFF;
1255
1256 bcr[miniDrawer] = *(++data);
1257
1258
1259 if (packetVersion[miniDrawer] == 1) {
1260 pedestalLo[miniDrawer] = *(++data) & 0xFFF;
1261 pedestalHi[miniDrawer] = (*data >> 12 ) & 0xFFF;
1262 runType[miniDrawer] = (*data >> 24) & 0xFF;
1263
1264 runNumber[miniDrawer] = *(++data);
1265 } else {
1266 runNumber[miniDrawer] = *(++data);
1267
1268 pedestalLo[miniDrawer] = *(++data) & 0xFFF;
1269 pedestalHi[miniDrawer] = (*data >> 12 ) & 0xFFF;
1270 runType[miniDrawer] = (*data >> 24) & 0xFF;
1271 }
1272
1273 chargeInjected[miniDrawer] = *(++data) & 0xFFF;
1274 timeInjected[miniDrawer] = (*data >> 12) & 0xFF;
1275 capacitor[miniDrawer] = (*data >> 20) & 0x1;
1276 }
1277
1278 if (msgLvl(MSG::VERBOSE)) {
1279 msg(MSG::VERBOSE) << "FRAG6: Found MD[" << miniDrawer << "] fragment"
1280 << ", Run type: " << runType[miniDrawer]
1281 << ", Module ID: " << moduleID[miniDrawer]
1282 << ", BCID: " << bcid[miniDrawer]
1283 << ", L1ID: " << l1id[miniDrawer]
1284 << ", ECR: " << ecr[miniDrawer];
1285 if (version) {
1286 msg(MSG::VERBOSE) << ", BCR: " << bcr[miniDrawer]
1287 << ", Packet version: " << packetVersion[miniDrawer]
1288 << ", Fragment ID: " << fragmentID[miniDrawer];
1289 }
1290
1291 msg(MSG::VERBOSE) << endmsg;
1292
1293 if (paramsSize == 3) {
1294 msg(MSG::VERBOSE) << "FRAG6: MD[" << miniDrawer << "] Parameters:"
1295 << " Run number: " << runNumber[miniDrawer]
1296 << ", Ppedestal Lo: " << pedestalLo[miniDrawer]
1297 << ", Ppedestal Hi: " << pedestalHi[miniDrawer]
1298 << ", Charge injected: " << chargeInjected[miniDrawer]
1299 << ", Time injected: " << timeInjected[miniDrawer]
1300 << ", Capacitor: " << capacitor[miniDrawer] << endmsg;
1301 }
1302 }
1303
1304 const uint16_t* sample = reinterpret_cast<const uint16_t *> (++data);
1305
1306 for (int gain = 1; gain > -1; --gain) { // HG seems to be first
1307 int start_channel(miniDrawer * Tile::MAX_MINIDRAWER_CHAN);
1308 int end_channel(start_channel + Tile::MAX_MINIDRAWER_CHAN);
1309 for (int channel = start_channel; channel < end_channel; ++channel) {
1310
1311 for (int samplesIdx = 0; samplesIdx<sampleNumber; ++samplesIdx) {
1312 samples[gain][channel][samplesIdx] = (*sample & 0x0FFF);
1313 ++sample;
1314 }
1315
1316 }
1317 }
1318
1319 data = ++trailer;
1320
1321 } else {
1322 ATH_MSG_WARNING("FRAG6: Not found correct MD[" << miniDrawer << "] fragment trailer: => skip it!!!");
1323 }
1324 }
1325 } else {
1326 ++data;
1327 }
1328 }
1329
1330 pDigits.reserve(Tile::MAX_GAIN * Tile::MAX_CHAN);
1331
1332 // always two gains
1333 for (unsigned int gain = 0; gain < Tile::MAX_GAIN; ++gain) {
1334 // always 48 channels
1335 for (unsigned int channel = 0; channel < Tile::MAX_CHAN; ++channel) {
1336 int ch1 = (remap) ? chmap[channel] : channel;
1337
1338 adcID = m_tileHWID->adc_id(drawerID, ch1, gain);
1339 std::vector<float> digiVec(&samples[gain][channel][0], &samples[gain][channel][sampleNumber]);
1340 pDigits.push_back(new TileDigits(adcID, digiVec));
1341
1342 ATH_MSG_VERBOSE("FRAG6: " << (std::string) *(pDigits.back()));
1343 }
1344 if (remap) std::sort(pDigits.end() - Tile::MAX_CHAN, pDigits.end(), chan_order);
1345 }
1346
1347 digitsMetaData[1].insert(digitsMetaData[1].end(), &l1id[0], &l1id[Tile::MAX_MINIDRAWER]);
1348 digitsMetaData[1].insert(digitsMetaData[1].end(), &bcid[0], &bcid[Tile::MAX_MINIDRAWER]);
1349 digitsMetaData[1].insert(digitsMetaData[1].end(), &moduleID[0], &moduleID[Tile::MAX_MINIDRAWER]);
1350 digitsMetaData[1].insert(digitsMetaData[1].end(), &runType[0], &runType[Tile::MAX_MINIDRAWER]);
1351 digitsMetaData[1].insert(digitsMetaData[1].end(), &runNumber[0], &runNumber[Tile::MAX_MINIDRAWER]);
1352 digitsMetaData[1].insert(digitsMetaData[1].end(), &pedestalLo[0], &pedestalLo[Tile::MAX_MINIDRAWER]);
1353 digitsMetaData[1].insert(digitsMetaData[1].end(), &pedestalHi[0], &pedestalHi[Tile::MAX_MINIDRAWER]);
1354 digitsMetaData[1].insert(digitsMetaData[1].end(), &chargeInjected[0], &chargeInjected[Tile::MAX_MINIDRAWER]);
1355 digitsMetaData[1].insert(digitsMetaData[1].end(), &timeInjected[0], &timeInjected[Tile::MAX_MINIDRAWER]);
1356 digitsMetaData[1].insert(digitsMetaData[1].end(), &capacitor[0], &capacitor[Tile::MAX_MINIDRAWER]);
1357 digitsMetaData[1].insert(digitsMetaData[1].end(), &ecr[0], &ecr[Tile::MAX_MINIDRAWER]);
1358 if (version) {
1359 digitsMetaData[1].insert(digitsMetaData[1].end(), &bcr[0], &bcr[Tile::MAX_MINIDRAWER]);
1360 digitsMetaData[1].insert(digitsMetaData[1].end(), &packetVersion[0], &packetVersion[Tile::MAX_MINIDRAWER]);
1361 digitsMetaData[1].insert(digitsMetaData[1].end(), &fragmentID[0], &fragmentID[Tile::MAX_MINIDRAWER]);
1362 }
1363}
constexpr std::initializer_list< int > Tile
Definition HIEventDefs.h:70

◆ unpack_fragA()

void TileROD_Decoder::unpack_fragA ( uint32_t version,
RawChannelMetaData_t & rawchannelMetaData,
const uint32_t * p,
pRwChVec & pChannel,
int fragID,
int demoType ) const
private

unpack_fragA decodes tile subfragment type 0XA.

This subfragment contains data quality checks.

Definition at line 1365 of file TileROD_Decoder.cxx.

1369 {
1370 // second word is frag ID and frag type
1371 int size = *(p);
1372 p += 2; // 2 words so far
1373
1374 unsigned int w;
1375
1376 // Global CRC
1377 w = (*p);
1378 rawchannelMetaData[0].push_back(w & 0xFFFF);
1379 if (w >> 31 & 0x1) //most significant bit is 1. It means that it is a fragment containing the DSP BCID
1380 rawchannelMetaData[0].push_back((w >> 16) & 0x7FFF); //DSP BCID
1381 else
1382 rawchannelMetaData[0].push_back(0xDEAD); //0xDEAD if it is not filled
1383 ++p;
1384
1385 if (drawer_type == 2) {
1386 ATH_MSG_WARNING("Demo->Legacy remapping for Ext.Barrel not yet implemented for DQ fragment");
1387 }
1388
1389 for (int i = 0; i < (size - 4); ++i) {
1390 w = (*p);
1391 rawchannelMetaData[i + 1].push_back(w & 0xFFFF);
1392 rawchannelMetaData[i + 1].push_back(w >> 16);
1393 ++p;
1394 }
1395
1396 return;
1397}

◆ unpack_fragAHLT()

void TileROD_Decoder::unpack_fragAHLT ( uint32_t version,
const uint32_t * p,
uint16_t rob_bcid,
uint16_t & mask,
int fragID,
int demoType ) const
private

unpack_fragAHLT decodes tile subfragment type 0XA.

This subfragment contains data quality checks.

Definition at line 1399 of file TileROD_Decoder.cxx.

1400 {
1401 // first word is full frag size, including header
1402 int size = *(p);
1403 if (size < 9) return;
1404
1405 // second word is frag ID (0x100-0x4ff) and frag type
1406 uint16_t frag = (*(++p)) & 0xfff;
1407
1408 const uint16_t* w = reinterpret_cast<const uint16_t*> (++p); // Jump to first DQ word
1409 /* order of 16bit DQ words in DQ fragment
1410 ---------------------
1411 | Global CRC
1412 | DSP BCID
1413 | BCID checks
1414 | Mem parity err
1415 | Single strobe err
1416 | Double strobe err
1417 | Head format err
1418 | Head parity err
1419 | Sample format err
1420 | Sample parity err
1421 | FE chip mask err
1422 | ROD chip mask err
1423 ---------------------
1424 */
1425 if ((*w++) & 0x1) {
1426 mask = 0xffff;
1427 return;
1428 } // bad CRC
1429 mask = *w++; // BCID in DSP, can be zero (i.e. not set)
1430 if (mask != rob_bcid && mask > 0) {
1431 mask = 0xffff;
1432 return;
1433 } // BCIDs do not match - wrong event
1434
1435 mask = *w++; // bcid checks, one bit per DMU
1436 if (mask & 0x0002) {
1437 mask = 0xffff;
1438 return;
1439 } // second DMU is bad - everything is bad
1440
1441 if (drawer_type == 2) {
1442 ATH_MSG_WARNING("Demo->Legacy remapping for Ext.Barrel not yet implemented for DQ fragment");
1443 }
1444
1445 if (mask & 0x00F0) { // at least one error in second motherboard, where we don't expect errors in ext.barrel
1446 uint16_t BCIDerr = mask;
1447 int n_badMB = 0;
1448 if (frag > 0x2FF) { // do not count non-existing DMUs in EB
1449 if ((frag == 0x30E) || frag == 0x411) {
1450 BCIDerr &= 0x3cff;
1451 } else {
1452 BCIDerr &= 0x3cfe;
1453 }
1454 }
1455 while (BCIDerr) {
1456 if (BCIDerr & 0xF) ++n_badMB;
1457 BCIDerr >>= 4;
1458 }
1459 if (n_badMB == 4) { // BCID errors in all 4 motherboards - assume that all DMUs are bad
1460 mask = 0xffff;
1461 return;
1462 }
1463 }
1464
1465 mask |= *w++; // memory
1466
1467 w += 2; // Ignore 2 guys - strobe
1468 uint16_t fe_mask = *w++; // head format
1469 fe_mask |= *w++; // head parity
1470 fe_mask |= *w++; // sample format
1471 fe_mask |= *w++; // sample parity
1472
1473 if (fe_mask) { // something is wrong in data format - FE mask can not be used
1474 mask |= fe_mask;
1475 w++;
1476 } else { // real FE mask is valid only if there are no format or parity errors
1477 fe_mask = *w++;
1478 if ((frag > 0x2FF)) { // I am in extended barrel
1479 if ((frag == 0x30E) || frag == 0x411) fe_mask <<= 1; // shift by one DMU in EBA15 EBC18
1480 fe_mask = (fe_mask & 0xFF) | ((fe_mask & 0xF00) << 2); // shift upper half by two DMUs
1481 }
1482 mask |= ~fe_mask; // fe chip mask (inverted logic!)
1483 }
1484
1485 mask |= ~(*w); // rod chip mask (inverted logic!)
1486
1487 return;
1488}

◆ updateAmpThreshold()

void TileROD_Decoder::updateAmpThreshold ( int run = -1)
private

Definition at line 60 of file TileROD_Decoder.cxx.

60 {
62 if (run < 0) run = m_fullTileRODs;
63 if (run >= 4444444) { // FIXME: should put correct run number here, once it is known
64 m_ampMinThresh_pC = m_ampMinThresh * (25. / 4095.);
65 m_ampMinThresh_MeV = m_ampMinThresh * (25. / 4095. / 1.05 * 1000.);
66 } else {
67 m_ampMinThresh_pC = m_ampMinThresh * (12.5 / 1023.);
68 m_ampMinThresh_MeV = m_ampMinThresh * (12.5 / 1023. / 1.05 * 1000.);
69 }
70 }
71 ATH_MSG_DEBUG("in TileROD_Decoder::updateAmpThreshold, m_ampMinThresh = " << m_ampMinThresh);
72 ATH_MSG_DEBUG("in TileROD_Decoder::updateAmpThreshold, m_ampMinThresh_MeV = " << m_ampMinThresh_MeV);
73 ATH_MSG_DEBUG("in TileROD_Decoder::updateAmpThreshold, m_ampMinThresh_pC = " << m_ampMinThresh_pC);
74}
Gaudi::Property< float > m_ampMinThresh

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ TileHid2RESrcID

friend class TileHid2RESrcID
friend

Definition at line 229 of file TileROD_Decoder.h.

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

std::vector<uint32_t> m_OFWeights [4 * TileCalibUtils::MAX_DRAWERIDX] TileROD_Decoder::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 569 of file TileROD_Decoder.h.

◆ ATLAS_THREAD_SAFE [2/2]

std::atomic<const uint32_t*> m_OFPtrs [4 * TileCalibUtils::MAX_DRAWERIDX] TileROD_Decoder::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 572 of file TileROD_Decoder.h.

◆ m_allowedTimeMax

Gaudi::Property<float> TileROD_Decoder::m_allowedTimeMax
private
Initial value:
{this, "AllowedTimeMax", 50.0,
"Set amplitude to zero if time is above allowed time maximum"}

Definition at line 516 of file TileROD_Decoder.h.

516 {this, "AllowedTimeMax", 50.0,
517 "Set amplitude to zero if time is above allowed time maximum"};

◆ m_allowedTimeMin

Gaudi::Property<float> TileROD_Decoder::m_allowedTimeMin
private
Initial value:
{this, "AllowedTimeMin", -50.0,
"Set amplitude to zero if time is below allowed time minimum"}

Definition at line 514 of file TileROD_Decoder.h.

514 {this, "AllowedTimeMin", -50.0,
515 "Set amplitude to zero if time is below allowed time minimum"};

◆ m_ampMinThresh

Gaudi::Property<float> TileROD_Decoder::m_ampMinThresh
private
Initial value:
{this, "AmpMinForAmpCorrection", 15.0,
"Correct amplitude if it's above amplitude threshold (in ADC counts)"}

Definition at line 520 of file TileROD_Decoder.h.

520 {this, "AmpMinForAmpCorrection", 15.0,
521 "Correct amplitude if it's above amplitude threshold (in ADC counts)"};

◆ m_ampMinThresh_MeV

float TileROD_Decoder::m_ampMinThresh_MeV
private

correct amplitude if it's above amplitude threshold (in MeV)

Definition at line 564 of file TileROD_Decoder.h.

◆ m_ampMinThresh_pC

float TileROD_Decoder::m_ampMinThresh_pC
private

correct amplitude if it's above amplitude threshold (in pC)

Definition at line 563 of file TileROD_Decoder.h.

◆ m_cablingSvc

ServiceHandle<TileCablingSvc> TileROD_Decoder::m_cablingSvc
private
Initial value:
{ this,
"TileCablingSvc", "TileCablingSvc", "The Tile cabling service"}

Definition at line 559 of file TileROD_Decoder.h.

559 { this,
560 "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};

◆ m_calibrateEnergy

Gaudi::Property<bool> TileROD_Decoder::m_calibrateEnergy {this, "calibrateEnergy", true, "Convert ADC counts to pCb for RawChannels"}
private

Definition at line 534 of file TileROD_Decoder.h.

534{this, "calibrateEnergy", true, "Convert ADC counts to pCb for RawChannels"};

◆ m_checkMaskedDrawers

bool TileROD_Decoder::m_checkMaskedDrawers
private

Definition at line 603 of file TileROD_Decoder.h.

◆ m_d2Bytes

TileDigits2Bytes TileROD_Decoder::m_d2Bytes
private

Definition at line 502 of file TileROD_Decoder.h.

◆ m_demoChanEB

std::vector<int> TileROD_Decoder::m_demoChanEB
private

Definition at line 607 of file TileROD_Decoder.h.

◆ m_demoChanLB

std::vector<int> TileROD_Decoder::m_demoChanLB
private

Definition at line 606 of file TileROD_Decoder.h.

◆ m_demoFragIDs

Gaudi::Property<std::vector<int> > TileROD_Decoder::m_demoFragIDs
private
Initial value:
{this,
"DemoFragIDs", {}, "List of Tile frag IDs with new electronics (demonstrator)"}

Definition at line 530 of file TileROD_Decoder.h.

530 {this,
531 "DemoFragIDs", {}, "List of Tile frag IDs with new electronics (demonstrator)"};

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_ErrorCounter

std::atomic<int> TileROD_Decoder::m_ErrorCounter
mutableprivate

Definition at line 593 of file TileROD_Decoder.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fullTileRODs

Gaudi::Property<unsigned int> TileROD_Decoder::m_fullTileRODs
private
Initial value:
{this, "fullTileMode", 320000,
"Run from which to take the cabling (for the moment, either 320000 - full 2017 mode (default) - or 0 - 2016 mode)"}

Definition at line 527 of file TileROD_Decoder.h.

527 {this, "fullTileMode", 320000,
528 "Run from which to take the cabling (for the moment, either 320000 - full 2017 mode (default) - or 0 - 2016 mode)"};

◆ m_hashFunc

TileFragHash TileROD_Decoder::m_hashFunc
private

Definition at line 584 of file TileROD_Decoder.h.

◆ m_hid2re

TileHid2RESrcID* TileROD_Decoder::m_hid2re
private

Definition at line 595 of file TileROD_Decoder.h.

◆ m_hid2reHLT

TileHid2RESrcID* TileROD_Decoder::m_hid2reHLT
private

Definition at line 596 of file TileROD_Decoder.h.

◆ m_hid2RESrcIDKey

SG::ReadCondHandleKey<TileHid2RESrcID> TileROD_Decoder::m_hid2RESrcIDKey
private
Initial value:
{this,
"TileHid2RESrcID", "TileHid2RESrcID", "TileHid2RESrcID key"}

Definition at line 542 of file TileROD_Decoder.h.

542 {this,
543 "TileHid2RESrcID", "TileHid2RESrcID", "TileHid2RESrcID key"};

◆ m_HidMutex

std::mutex TileROD_Decoder::m_HidMutex
mutableprivate

Definition at line 578 of file TileROD_Decoder.h.

◆ m_ignoreFrag4HLT

Gaudi::Property<bool> TileROD_Decoder::m_ignoreFrag4HLT {this, "ignoreFrag4HLT", false, "Ignore frag4 HLT"}
private

Definition at line 511 of file TileROD_Decoder.h.

511{this, "ignoreFrag4HLT", false, "Ignore frag4 HLT"};

◆ m_L2Builder

ToolHandle<TileL2Builder> TileROD_Decoder::m_L2Builder
private
Initial value:
{this,
"TileL2Builder", "", "Tile L2 builder tool"}

Definition at line 553 of file TileROD_Decoder.h.

553 {this,
554 "TileL2Builder", "", "Tile L2 builder tool"};

◆ m_list_of_masked_drawers

std::vector<int> TileROD_Decoder::m_list_of_masked_drawers
private

Definition at line 598 of file TileROD_Decoder.h.

◆ m_mapMBTS

std::map<unsigned int, unsigned int> TileROD_Decoder::m_mapMBTS
private

Definition at line 588 of file TileROD_Decoder.h.

◆ m_maskBadDigits

Gaudi::Property<bool> TileROD_Decoder::m_maskBadDigits
private
Initial value:
{this, "maskBadDigits", false,
"Put -1 in digits vector for channels with bad BCID or CRC in unpack_frag0"}

Definition at line 536 of file TileROD_Decoder.h.

536 {this, "maskBadDigits", false,
537 "Put -1 in digits vector for channels with bad BCID or CRC in unpack_frag0"};

◆ m_maxChannels

unsigned int TileROD_Decoder::m_maxChannels
private

Definition at line 602 of file TileROD_Decoder.h.

◆ m_maxErrorPrint

Gaudi::Property<int> TileROD_Decoder::m_maxErrorPrint {this, "MaxErrorPrint", 1000, "Maximum error messages to print"}
private

Definition at line 540 of file TileROD_Decoder.h.

540{this, "MaxErrorPrint", 1000, "Maximum error messages to print"};

◆ m_maxWarningPrint

Gaudi::Property<int> TileROD_Decoder::m_maxWarningPrint {this, "MaxWarningPrint", 1000, "Maximum warning messages to print"}
private

Definition at line 539 of file TileROD_Decoder.h.

539{this, "MaxWarningPrint", 1000, "Maximum warning messages to print"};

◆ m_MBTS_channel

int TileROD_Decoder::m_MBTS_channel = 0
private

Definition at line 590 of file TileROD_Decoder.h.

◆ m_of2Default

bool TileROD_Decoder::m_of2Default
private

Definition at line 585 of file TileROD_Decoder.h.

◆ m_OFWeightMutex

std::mutex TileROD_Decoder::m_OFWeightMutex
mutableprivate

Definition at line 575 of file TileROD_Decoder.h.

◆ m_rc2bytes

TileRawChannel2Bytes TileROD_Decoder::m_rc2bytes
private

Definition at line 501 of file TileROD_Decoder.h.

◆ m_rc2bytes2

TileRawChannel2Bytes2 TileROD_Decoder::m_rc2bytes2
private

Definition at line 500 of file TileROD_Decoder.h.

◆ m_rc2bytes4

TileRawChannel2Bytes4 TileROD_Decoder::m_rc2bytes4
private

Definition at line 499 of file TileROD_Decoder.h.

◆ m_rc2bytes5

TileRawChannel2Bytes5 TileROD_Decoder::m_rc2bytes5
private

Definition at line 498 of file TileROD_Decoder.h.

◆ m_runPeriod

int TileROD_Decoder::m_runPeriod
private

Definition at line 604 of file TileROD_Decoder.h.

◆ m_Rw2Cell

std::vector<int> TileROD_Decoder::m_Rw2Cell[4]
private

Definition at line 581 of file TileROD_Decoder.h.

◆ m_Rw2Pmt

std::vector<int> TileROD_Decoder::m_Rw2Pmt[4]
private

Definition at line 582 of file TileROD_Decoder.h.

◆ m_suppressDummyFragments

Gaudi::Property<bool> TileROD_Decoder::m_suppressDummyFragments {this, "suppressDummyFragments", false, "Suppress dummy fragments"}
private

Definition at line 535 of file TileROD_Decoder.h.

535{this, "suppressDummyFragments", false, "Suppress dummy fragments"};

◆ m_tileBadChanTool

ToolHandle<ITileBadChanTool> TileROD_Decoder::m_tileBadChanTool
private
Initial value:
{this,
"TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"}

Definition at line 551 of file TileROD_Decoder.h.

551 {this,
552 "TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"};

◆ m_tileCondToolOfcCool

ToolHandle<TileCondToolOfcCool> TileROD_Decoder::m_tileCondToolOfcCool
private
Initial value:
{this,
"TileCondToolOfcCool", "TileCondToolOfcCool", "Tile OFC tool"}

Definition at line 547 of file TileROD_Decoder.h.

547 {this,
548 "TileCondToolOfcCool", "TileCondToolOfcCool", "Tile OFC tool"};

◆ m_tileHWID

const TileHWID* TileROD_Decoder::m_tileHWID = nullptr
private

Definition at line 504 of file TileROD_Decoder.h.

◆ m_tileToolEmscale

ToolHandle<TileCondToolEmscale> TileROD_Decoder::m_tileToolEmscale
private
Initial value:
{this,
"TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"}

Definition at line 549 of file TileROD_Decoder.h.

549 {this,
550 "TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"};

◆ m_tileToolTiming

ToolHandle<TileCondToolTiming> TileROD_Decoder::m_tileToolTiming
private
Initial value:
{this,
"TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"}

Definition at line 545 of file TileROD_Decoder.h.

545 {this,
546 "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};

◆ m_timeMaxThresh

Gaudi::Property<float> TileROD_Decoder::m_timeMaxThresh
private
Initial value:
{this, "TimeMaxForAmpCorrection", 12.5,
"Correct amplitude is time is below time maximum threshold"}

Definition at line 524 of file TileROD_Decoder.h.

524 {this, "TimeMaxForAmpCorrection", 12.5,
525 "Correct amplitude is time is below time maximum threshold"};

◆ m_timeMinThresh

Gaudi::Property<float> TileROD_Decoder::m_timeMinThresh
private
Initial value:
{this, "TimeMinForAmpCorrection", -12.5,
"Correct amplitude is time is above time minimum threshold"}

Definition at line 522 of file TileROD_Decoder.h.

522 {this, "TimeMinForAmpCorrection", -12.5,
523 "Correct amplitude is time is above time minimum threshold"};

◆ m_useFrag0

Gaudi::Property<bool> TileROD_Decoder::m_useFrag0 {this, "useFrag0", true, "Use frag0"}
private

Definition at line 506 of file TileROD_Decoder.h.

506{this, "useFrag0", true, "Use frag0"};

◆ m_useFrag1

Gaudi::Property<bool> TileROD_Decoder::m_useFrag1 {this, "useFrag1", true, "Use frag1"}
private

Definition at line 507 of file TileROD_Decoder.h.

507{this, "useFrag1", true, "Use frag1"};

◆ m_useFrag4

Gaudi::Property<bool> TileROD_Decoder::m_useFrag4 {this, "useFrag4", true, "User frag4"}
private

Definition at line 508 of file TileROD_Decoder.h.

508{this, "useFrag4", true, "User frag4"};

◆ m_useFrag5Raw

Gaudi::Property<bool> TileROD_Decoder::m_useFrag5Raw {this, "useFrag5Raw", false, "Use frag5 raw"}
private

Definition at line 509 of file TileROD_Decoder.h.

509{this, "useFrag5Raw", false, "Use frag5 raw"};

◆ m_useFrag5Reco

Gaudi::Property<bool> TileROD_Decoder::m_useFrag5Reco {this, "useFrag5Reco", false, "Use frag5 reco"}
private

Definition at line 510 of file TileROD_Decoder.h.

510{this, "useFrag5Reco", false, "Use frag5 reco"};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_verbose

Gaudi::Property<bool> TileROD_Decoder::m_verbose {this, "VerboseOutput", false, "Print extra information"}
private

Definition at line 533 of file TileROD_Decoder.h.

533{this, "VerboseOutput", false, "Print extra information"};

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_WarningCounter

std::atomic<int> TileROD_Decoder::m_WarningCounter
mutableprivate

Definition at line 592 of file TileROD_Decoder.h.


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