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

#include <LArABBADecoder.h>

Inheritance diagram for LArABBADecoder:
Collaboration diagram for LArABBADecoder:

Public Member Functions

 LArABBADecoder (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~LArABBADecoder ()
 Destructor.
virtual StatusCode initialize () override
virtual StatusCode finalize () override
StatusCode convert (const RawEvent *re, LArDigitContainer *coll) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

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

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *pROB, LArDigitContainer *coll) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 27 of file LArABBADecoder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArABBADecoder()

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

Definition at line 13 of file LArABBADecoder.cxx.

15 : AthAlgTool(type,name,parent)
16{
17 declareInterface< LArABBADecoder >( this );
18}
AthAlgTool()
Default constructor:

◆ ~LArABBADecoder()

LArABBADecoder::~LArABBADecoder ( )
virtual

Destructor.

Definition at line 25 of file LArABBADecoder.cxx.

25{}

Member Function Documentation

◆ convert()

StatusCode LArABBADecoder::convert ( const RawEvent * re,
LArDigitContainer * coll ) const

Definition at line 36 of file LArABBADecoder.cxx.

37{
38 bool ret=false;
39 // Check fragment validity:
40 try {
41 ret=re->check();
42 }
43 catch (eformat::Issue& ex) {
44 ATH_MSG_WARNING( "Exception while checking eformat fragment validity: " << ex.what() );
45 ret=false;
46 }
47 if (!ret) {
48 ATH_MSG_ERROR( "Got invalid RawEvent fragment" );
49 return StatusCode::FAILURE;
50 }
51
52 //Build TOC
53 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> > robIndex;
54 eformat::helper::build_toc(*re, robIndex );
55 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> >::const_iterator robIt = robIndex.find(eformat::LAR);
56 if (robIt!=robIndex.end()) {
57 const std::vector<const uint32_t*>& robs = robIt->second;
58 for (const uint32_t* pRob :robs) {
59 try {
60 ROBFragment robFrag(pRob);
61 fillCollection(&robFrag,coll);
62 }
63 catch (eformat::Issue& ex) {
64 ATH_MSG_WARNING ( " exception thrown by ROBFragment, badly corrupted event. Abort decoding " );
65 coll->clear();
66 break;
67 }
68 }//end loop over robs
69 }//end if got LAr-RODs
70 return StatusCode::SUCCESS;
71}
const boost::regex re(r_e)
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
void clear()
Erase all the elements in the collection.
void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *pROB, LArDigitContainer *coll) const
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27

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

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

void LArABBADecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * pROB,
LArDigitContainer * coll ) const
private

Definition at line 74 of file LArABBADecoder.cxx.

75{
77 LArDigit * scDigit=0 ;
78
79 //FIXME: Check validity
80 uint32_t nData = robFrag->rod_ndata();
81 const uint32_t* p=robFrag->rod_data();
82 if (nData < 3) {
83 ATH_MSG_WARNING ( "Error reading bytestream event: "
84 << "Empty ROD block (less than 3 words) for source ID " << robFrag->rod_source_id() );
85 return;
86 }
87 else
88 robFrag->rod_source_id();
89
90 unsigned int n = robFrag->payload_size_word();
91
92 std::vector<std::string> string;
93 int x=0x0;
94 int nsamples = p[0];
95 for(unsigned int s=1;s<n-13;s+=6) {
96 std::string ss;
97 for (unsigned int k=0;k<6;++k){
98 x = p[s+k];
99 std::ostringstream oss;
100 oss << std::hex << x;
101 if (oss.str().size() == 7){
102 ss.append("0");
103 }
104 ss += oss.str();
105 }
106 string.push_back(std::move(ss));
107 }
108
109 constexpr int nFibers = 20;
110 constexpr int nchannels = 8;
111 constexpr int Nabbachannels = nFibers * nchannels;
112
113 constexpr int fiberSeq[16] = {0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1};
114 constexpr int adcSeq[16] = {1,0,1,0,3,2,3,2,5,4,5,4,7,6,7,6};
115
116 std::vector< std::vector< std::vector<int> > > abbasamples;
117 abbasamples.resize(nFibers);
118
119 std::vector<std::vector<short>> abba_channel_samples;
120 abba_channel_samples.resize(Nabbachannels);
121
122 for (int fib=0;fib < nFibers; ++fib){
123 abbasamples[fib].resize(nchannels);
124 for (int ch = 0; ch < nchannels; ++ch){
125 abbasamples[fib][ch].resize(nsamples);
126 int Nchannel = fib*8 + ch;
127 abba_channel_samples[Nchannel].resize(nsamples);
128 }
129 }
130
131 for (int fib=0;fib < nFibers; fib+=2){
132 for (int sam=0; sam < nsamples; sam++){
133 int zx = sam + (fib/2)*nsamples;
134 const std::string &wx = string[zx];
135 int k = 0;
136 for (int m = 0; m < 16; ++m){ //16 size of fiberSeq array
137 int fiber_number = fiberSeq[m];
138 int adc_number = adcSeq[m];
139 int idx = k*3;
140 std::stringstream ss;
141 char mysample[3];
142 for (int j = idx; j < idx+3; ++j){
143 int i = j%3;
144 mysample[i] = wx[j];
145 }
146 ss << mysample;
147 short mysample_int;
148 ss >> std::hex >> mysample_int;
149 int fb = fiber_number+fib;
150 int ch = adc_number;
151 int abbachannel = fb*8+ch;
152 k++;
153 abbasamples[fb][ch][sam] = mysample_int;
154 abba_channel_samples[abbachannel][sam] = mysample_int;
155 }
156 }
157 }
158
159 std::map<int, HWIdentifier> abba_mapping;
160
161
162 int iphi = 0;
163 switch (robFrag->rod_source_id())
164 {
165 case 0x410511:
166 iphi=19;
167 break;
169 case 0x410512:
170 iphi=18;
171 break;
172 case 0x410521:
173 iphi=20;
174 break;
175 case 0x410522:
176 iphi=21;
177 break;
178
179 default:
180 ATH_MSG_ERROR("ROD_source_id not found");
181 }
182
183
184 ABBAMapping::fill(&abba_mapping, iphi, msg());
185
186
187 for (std::size_t index_abba_channel_samples = 0; index_abba_channel_samples < abba_channel_samples.size(); ++index_abba_channel_samples) {
188 auto abba_mapping_search = abba_mapping.find(index_abba_channel_samples);
189 if (abba_mapping_search == abba_mapping.end()) {
190 ATH_MSG_WARNING("No mapping for index_abba_channel_samples: "<<std::dec<<index_abba_channel_samples);
191 continue;
192 }
193
194 HWIdentifier channelID = (*abba_mapping_search).second;
195 std::vector<short> adcValues = abba_channel_samples[index_abba_channel_samples];
196 scDigit=new LArDigit(channelID,dummyGain,std::move(adcValues));
197
198 coll->push_back(scDigit);
199 }
200
201 abbasamples.clear();
202}
static Double_t ss
#define x
static void fill(std::map< int, HWIdentifier > *toFill, int iphi, MsgStream &log)
MsgStream & msg() const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
@ LARHIGHGAIN
Definition CaloGain.h:18
End of vector before end of string
Definition Arrayrep.cxx:228
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
setEventNumber uint32_t

◆ finalize()

StatusCode LArABBADecoder::finalize ( )
overridevirtual

Definition at line 32 of file LArABBADecoder.cxx.

32 {
33 return StatusCode::SUCCESS;
34}

◆ initialize()

StatusCode LArABBADecoder::initialize ( )
overridevirtual

Definition at line 28 of file LArABBADecoder.cxx.

28 {
29 return StatusCode::SUCCESS;
30}

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

Definition at line 20 of file LArABBADecoder.cxx.

21{ return IID_ILArABBADecoder; }
static const InterfaceID IID_ILArABBADecoder("LArABBADecoder", 1, 0)

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

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

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

◆ 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

Member Data Documentation

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

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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