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
19}
AthAlgTool()
Default constructor:

◆ ~LArABBADecoder()

LArABBADecoder::~LArABBADecoder ( )
virtual

Destructor.

Definition at line 26 of file LArABBADecoder.cxx.

26{}

Member Function Documentation

◆ convert()

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

Definition at line 37 of file LArABBADecoder.cxx.

38{
39
40 bool ret=false;
41 // Check fragment validity:
42 try {
43 ret=re->check();
44 }
45 catch (eformat::Issue& ex) {
46 ATH_MSG_WARNING( "Exception while checking eformat fragment validity: " << ex.what() );
47 ret=false;
48 }
49 if (!ret) {
50 ATH_MSG_ERROR( "Got invalid RawEvent fragment" );
51 return StatusCode::FAILURE;
52 }
53
54 //Build TOC
55 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> > robIndex;
56 eformat::helper::build_toc(*re, robIndex );
57 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> >::const_iterator robIt = robIndex.find(eformat::LAR);
58 if (robIt!=robIndex.end()) {
59 const std::vector<const uint32_t*>& robs = robIt->second;
60 for (const uint32_t* pRob :robs) {
61 try {
62 ROBFragment robFrag(pRob);
63 fillCollection(&robFrag,coll);
64 }
65 catch (eformat::Issue& ex) {
66 ATH_MSG_WARNING ( " exception thrown by ROBFragment, badly corrupted event. Abort decoding " );
67 coll->clear();
68 break;
69 }
70 }//end loop over robs
71 }//end if got LAr-RODs
72 return StatusCode::SUCCESS;
73}
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 76 of file LArABBADecoder.cxx.

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

33 {
34 return StatusCode::SUCCESS;
35}

◆ initialize()

StatusCode LArABBADecoder::initialize ( )
overridevirtual

Definition at line 29 of file LArABBADecoder.cxx.

29 {
30 return StatusCode::SUCCESS;
31}

◆ 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 21 of file LArABBADecoder.cxx.

22{ 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: