ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AFP_ByteStream2RawCnv Class Reference

#include <AFP_ByteStream2RawCnv.h>

Inheritance diagram for AFP_ByteStream2RawCnv:
Collaboration diagram for AFP_ByteStream2RawCnv:

Public Member Functions

 AFP_ByteStream2RawCnv (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~AFP_ByteStream2RawCnv ()
 Does nothing. More...
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
StatusCode fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, AFP_RawContainer *rawContainer) const
 Fills rawContainer with collections from ROBFragment. More...
 
bool isLinkToF (const unsigned int link) const
 returns true if provided link corresponds to time-of-flight information More...
 
bool isLinkSi (const unsigned int link) const
 returns true if provided link corresponds to silicon detector information More...
 
AFP_SiRawCollectiongetCollectionSi (AFP_RawContainer *container) const
 Adds new silicon collection to AFP_RawContainer. More...
 
AFP_ToFRawCollectiongetCollectionToF (AFP_RawContainer *container) const
 Adds new time-of-flight collection to AFP_RawContainer. More...
 
void setDataHeader (uint32_t the_word, AFP_RawDataCommonHead *dataHead) const
 Sets data header information for given argument based on m_wordReadout. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) 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 More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ServiceHandle< IROBDataProviderSvcm_robDataProvider
 
ToolHandle< AFP_WordReadOutm_wordReadout {this, "AFP_WordReadOut", "AFP_WordReadOut", "Tool that reads word"}
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Static Private Attributes

static const uint32_t s_siNoHitMarker = 15
 

Detailed Description

Definition at line 27 of file AFP_ByteStream2RawCnv.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

◆ AFP_ByteStream2RawCnv()

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

Definition at line 23 of file AFP_ByteStream2RawCnv.cxx.

27  m_robDataProvider("ROBDataProviderSvc", name)
28 {
29  declareInterface<AFP_ByteStream2RawCnv>(this);
30 }

◆ ~AFP_ByteStream2RawCnv()

AFP_ByteStream2RawCnv::~AFP_ByteStream2RawCnv ( )
virtual

Does nothing.

Definition at line 32 of file AFP_ByteStream2RawCnv.cxx.

32 {}

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

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

StatusCode AFP_ByteStream2RawCnv::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag,
AFP_RawContainer rawContainer 
) const

Fills rawContainer with collections from ROBFragment.

Definition at line 69 of file AFP_ByteStream2RawCnv.cxx.

69  {
70  ATH_MSG_DEBUG("AFP_ByteStream2RawCnv::fillColelction rob_source_id: in decimal="<<std::dec<<robFrag->rob_source_id()<<", in hex=0x"<<std::hex<<robFrag->rob_source_id()<<std::dec);
71 
72  try {
73  robFrag->check();
74  } catch (...) {
75  ATH_MSG_WARNING("An exception occurred");
76  return StatusCode::SUCCESS;
77  }
78 
79  const uint32_t nStat = robFrag->nstatus();
80  if (nStat) {
81  const uint32_t *it;
82  robFrag->status(it);
83  if (*it) {
84  ATH_MSG_WARNING(" Error in ROB status word: 0x");
85  return StatusCode::SUCCESS;
86  }
87  }
88 
89  if (!rawContainer) {
90  ATH_MSG_WARNING("NULL pointer passed in rawContainer argument.");
91  return StatusCode::SUCCESS;
92  }
93 
94  // --- end of check input parameters ---
95 
97  robFrag->rod_data(vint);
98 
99  if (robFrag->rod_nstatus() <= 0) {
100  ATH_MSG_WARNING("Buffer size <= 0!");
101  return StatusCode::SUCCESS;
102  }
103 
104  const eformat::FullEventFragment<const uint32_t*> *event = m_robDataProvider->getEvent(Gaudi::Hive::currentContext());
105 
106  // this information will be present only in offline reconstruction
107  // not be at HLT; however the remaining AFP information will be
108  // present both online and offline
109  if (event) {
110  // set information about event in the RawContainer
111  rawContainer->setTimeStamp(event->bc_time_seconds());
112  rawContainer->setTimeStampNS(event->bc_time_nanoseconds());
113  rawContainer->setBCId(event->bc_id());
114  rawContainer->setLumiBlock(event->lumi_block());
115  rawContainer->setLvl1Id(event->lvl1_id());
116  }
117 
118 
119  // fill container with collections
120  AFP_SiRawCollection *collectionSi = nullptr;
121  AFP_ToFRawCollection *collectionToF = nullptr;
122 
123  std::vector<std::vector<uint16_t>> picoTDC1_channels, picoTDC2_channels;
124  std::vector<bool> picoTDC_hasTrigger;
125  std::vector<int> ToF_links;
126 
127  const uint32_t size = robFrag->rod_ndata();
128  for (unsigned i = 0; i < size; i++) {
129  uint32_t the_word=vint[i];
130  uint32_t the_link=m_wordReadout->link(the_word);
131 
132  if (m_wordReadout->isHeader(the_word)) {
133  AFP_RawCollectionHead* collectionHead = nullptr;
134  if ( isLinkToF (the_link) ) {
135  // prepare collection for time-of-flight
136  collectionToF = getCollectionToF(//m_wordReadout->link(), robFrag->rob_source_id(),
137  rawContainer);
138  collectionHead = collectionToF;
139 
140  std::vector<uint16_t> helper;
141  picoTDC1_channels.push_back(helper);
142  picoTDC2_channels.push_back(helper);
143  picoTDC_hasTrigger.push_back(false);
144  ToF_links.push_back(the_link);
145  }
146  else if ( isLinkSi (the_link) ) {
147  // prepare collection for silicon detector
148  collectionSi = getCollectionSi(//m_wordReadout->link(), robFrag->rob_source_id(),
149  rawContainer);
150  collectionHead = collectionSi;
151  }
152  else {
153  ATH_MSG_ERROR("Unidentified value of link="<<the_link<<" for header record.");
154  return StatusCode::FAILURE;
155  }
156 
157  if (!collectionHead) {
158  ATH_MSG_WARNING("nullptr returned by getCollection(link = "
159  << the_link << ", robID = " << robFrag->rob_source_id() <<")");
160  return StatusCode::SUCCESS;
161  }
162 
163  // set head collection informaiton
164  collectionHead->setLvl1Id(m_wordReadout->getBits(the_word, 14, 10));
165  collectionHead->setLink(the_link);
166  collectionHead->setFrontendFlag(m_wordReadout->getBits(the_word, 15, 15));
167  collectionHead->setBcId(m_wordReadout->getBits(the_word, 9, 0));
168  collectionHead->setRobId(robFrag->rob_source_id());
169  }
170  else if (m_wordReadout->isData(the_word)) {
171  // fill time-of-flight collection
172  if ( isLinkToF (the_link) ) {
173 
174  // check if collection is available
175  if ( !collectionToF ) {
176  ATH_MSG_WARNING("No ToF collection available to fill data.");
177  return StatusCode::SUCCESS;
178  }
179 
180  uint32_t bit23=m_wordReadout->getBits(the_word, 23, 23);
181  if(!bit23)
182  {
183  // HPTDC 2017
184  uint32_t bits22_21=m_wordReadout->getBits(the_word, 22, 21);
185  if(bits22_21==2)
186  {
187  // ToF measurement
188  AFP_ToFRawData& ToFData = collectionToF->newDataRecord();
189  ToFData.setHeader( m_wordReadout->getBits(the_word, 23, 21) );
190  ToFData.setEdge( m_wordReadout->getBits(the_word, 20, 20) );
191  ToFData.setChannel( m_wordReadout->getBits(the_word, 19, 16) );
192  ToFData.setPulseLength( m_wordReadout->getBits(the_word, 15, 10) );
193  ToFData.setTime( m_wordReadout->getBits(the_word, 9, 0) );
194 
195  setDataHeader (the_word, &ToFData);
196  }
197  else
198  {
199  ATH_MSG_DEBUG("This is not a ToF measurement, bit23 = "<<bit23<<", bits22_21 "<<bits22_21<<", ignoring word = "<<the_word);
200  }
201  }
202  else
203  {
204  // picoTDC
205 
206  uint32_t bits19_22=m_wordReadout->getBits(the_word, 22, 19);
207 
208  if(bits19_22==0 || bits19_22==1)
209  {
210  // picoTDC #1 (==0) or picoTDC #2 (==1)
211  uint16_t channel=m_wordReadout->getBits(the_word, 18, 13);
212 
213  // find entry with the same channel number
214  auto ToFData_itr=std::find_if( collectionToF->begin(), collectionToF->end(),
215  [&](const AFP_ToFRawData& entry){return entry.channel()==channel;});
216 
217  if(ToFData_itr==collectionToF->end())
218  {
219  // create a new entry if such channel number doesn't exist
220  auto& ToFData = collectionToF->newDataRecord();
221 
222  ToFData.setHeader( bit23 );
223  ToFData.setEdge( 0 );
224  ToFData.setChannel( m_wordReadout->getBits(the_word, 18, 13) );
225  ToFData.setPulseLength( 0 );
226  ToFData.setTime( 0 );
227  setDataHeader (the_word, &ToFData);
228 
229  ToFData_itr = std::prev(collectionToF->end());
230  }
231 
232  if(!bits19_22)
233  {
234  // picoTDC #1
235  if(ToFData_itr->time() !=0 )
236  {
237  ATH_MSG_WARNING("trying to set time to "<<m_wordReadout->getBits(the_word, 12, 0)<<", but it is already set to = "<<ToFData_itr->time()<<", will not overwrite");
238  }
239  else
240  {
241  ToFData_itr->setTime( m_wordReadout->getBits(the_word, 12, 0) );
242  picoTDC1_channels.back().push_back(channel);
243  }
244  }
245  else
246  {
247  // picoTDC #2
248  if(ToFData_itr->pulseLength() !=0 )
249  {
250  ATH_MSG_WARNING("trying to set pulseLength to "<<m_wordReadout->getBits(the_word, 12, 0)<<", but it is already set to = "<<ToFData_itr->pulseLength()<<", will not overwrite");
251  }
252  else
253  {
254  ToFData_itr->setPulseLength( m_wordReadout->getBits(the_word, 12, 0) );
255  picoTDC2_channels.back().push_back(channel);
256  }
257  }
258  }
259  else if(bits19_22==4)
260  {
261  // check if there's already some other trigger word
262  auto ToFData_itr=std::find_if( collectionToF->begin(), collectionToF->end(),
263  [&](const AFP_ToFRawData& e){return e.isTrigger();});
264  if(ToFData_itr!=collectionToF->end())
265  {
266  // there shouldn't be any other trigger word
267  ATH_MSG_WARNING("already found a trigger word with delayedTrigger = "<<ToFData_itr->delayedTrigger()<<" and triggerPattern = "<<ToFData_itr->triggerPattern()<<", will ignore new word with delayedTrigger = "<<m_wordReadout->getBits(the_word, 18,16)<<" and triggerPattern = "<<m_wordReadout->getBits(the_word, 15, 0));
268  }
269  else
270  {
271  // if there isn't any other trigger word, create a new entry
272  auto& ToFData = collectionToF->newDataRecord();
273 
274  ToFData.setHeader( bit23 );
275  ToFData.setEdge( 0 );
276  ToFData.setTrigger(); // mark this entry as a trigger entry; must be done before setting delayedTrigger or triggerPattern
277  ToFData.setDelayedTrigger( m_wordReadout->getBits(the_word, 18,16) );
278  ToFData.setTriggerPattern( m_wordReadout->getBits(the_word, 15, 0) );
279  picoTDC_hasTrigger.back()=true;
280  }
281  }
282  else
283  {
284  ATH_MSG_WARNING("unknown pattern in bits 19-22 = "<<bits19_22<<", ignoring word = "<<the_word);
285  }
286  }
287  }
288  else if ( isLinkSi (the_link) ) {
289  // fill silicon detector collection
290 
291  // check if collection is available
292  if ( !collectionSi ) {
293  ATH_MSG_WARNING("No silicon detector collection available to fill data.");
294  return StatusCode::SUCCESS;
295  }
296 
297  // check first silicon hit information
298  if (m_wordReadout->getBits(the_word, 7, 4) != s_siNoHitMarker) {
299  AFP_SiRawData& siData = collectionSi->newDataRecord();
300  siData.setColumn (m_wordReadout->getBits(the_word, 23, 17));
301  siData.setRow (m_wordReadout->getBits(the_word, 16, 8));
302  siData.setTimeOverThreshold (m_wordReadout->getBits(the_word, 7, 4));
303 
304  setDataHeader (the_word, &siData);
305  }
306 
307  // check second silicon hit information
308  if (m_wordReadout->getBits(the_word, 3, 0) != s_siNoHitMarker) {
309  AFP_SiRawData& siData = collectionSi->newDataRecord();
310  siData.setColumn (m_wordReadout->getBits(the_word, 23, 17));
311  siData.setRow (m_wordReadout->getBits(the_word, 16, 8) + 1);
312  siData.setTimeOverThreshold (m_wordReadout->getBits(the_word, 3, 0));
313 
314  setDataHeader (the_word, &siData);
315  }
316  }
317  else {
318  ATH_MSG_ERROR("Not recognised value of link="<<the_link<<" for data record.");
319  return StatusCode::FAILURE;
320  }
321 
322  } // end is data
323  } // end of loop
324 
325  // in case of picoTDC, check we always have both words
326  for(unsigned int i=0;i<picoTDC1_channels.size();++i)
327  {
328  if(!picoTDC1_channels.at(i).empty() || !picoTDC2_channels.at(i).empty())
329  {
330  for(auto ch1 : picoTDC1_channels.at(i))
331  {
332  if(std::find(picoTDC2_channels.at(i).begin(),picoTDC2_channels.at(i).end(),ch1) == picoTDC2_channels.at(i).end())
333  {
334  ATH_MSG_WARNING("Cannot find channel "<<ch1<<" from picoTDC #1 in picoTDC #2 in ToF collections with link nr. "<<ToF_links.at(i)<<", pulseLength is very probably not set");
335  }
336  }
337  for(auto ch2 : picoTDC2_channels.at(i))
338  {
339  if(std::find(picoTDC1_channels.at(i).begin(),picoTDC1_channels.at(i).end(),ch2) == picoTDC1_channels.at(i).end())
340  {
341  ATH_MSG_WARNING("Cannot find channel "<<ch2<<" from picoTDC #2 in picoTDC #1 in ToF collections with link nr. "<<ToF_links.at(i)<<", time is very probably not set");
342  }
343  }
344 
345  if(!picoTDC_hasTrigger.at(i))
346  {
347  ATH_MSG_WARNING("Cannot find trigger word in ToF collections with link nr. "<<ToF_links.at(i));
348  }
349  }
350  }
351 
352  return StatusCode::SUCCESS;
353 }

◆ finalize()

StatusCode AFP_ByteStream2RawCnv::finalize ( )
virtual

Definition at line 63 of file AFP_ByteStream2RawCnv.cxx.

63  {
64  ATH_MSG_DEBUG("AFP_ByteStream2RawCnv: finalizing ");
65 
66  return StatusCode::SUCCESS;
67 }

◆ getCollectionSi()

AFP_SiRawCollection * AFP_ByteStream2RawCnv::getCollectionSi ( AFP_RawContainer container) const

Adds new silicon collection to AFP_RawContainer.

It is checked if a silicon collection with given link and robId is already in the container. If it is a warning message is issued and nullptr is returned. If it is not, then it is created and pointer to the new collection is returned.

Definition at line 356 of file AFP_ByteStream2RawCnv.cxx.

357  {
358 
359  if (!container) {
360  ATH_MSG_WARNING("NULL pointer passed in argument: container. NULL pointer returned.");
361  return nullptr;
362  }
363 
364  // Code below is commented, because it was impossible to
365  // reconstruct several bunch crossings in one event with it. In
366  // standard data taking only one bunch crossing is saved and this
367  // protection should not be necessary. However in case of big
368  // readout problems the code may be needed, that is why it stays
369  // commented here.
370 
371  // for (const AFP_SiRawCollection& collection : container->collectionsSi())
372  // if (collection.link() == link && collection.robId() == robId)
373  // ATH_MSG_WARNING("Silicon collection link="<<link<<" robId="<<robId<<" already in container, although it should not be there. Anyway creating new collection. (Reading several BCX?)");
374 
375  AFP_SiRawCollection& newCollection = container->newCollectionSi();
376  return &newCollection;
377 }

◆ getCollectionToF()

AFP_ToFRawCollection * AFP_ByteStream2RawCnv::getCollectionToF ( AFP_RawContainer container) const

Adds new time-of-flight collection to AFP_RawContainer.

It is checked if a time-of-flight collection with given link and robId is already in the container. If it is a warning message is issued and nullptr is returned. If it is not, then it is created and pointer to the new collection is returned.

Definition at line 380 of file AFP_ByteStream2RawCnv.cxx.

381  {
382 
383  if (!container) {
384  ATH_MSG_WARNING("NULL pointer passed in argument: container. NULL pointer returned.");
385  return nullptr;
386  }
387 
388  // Code below is commented, because it was impossible to
389  // reconstruct several bunch crossings in one event with it. In
390  // standard data taking only one bunch crossing is saved and this
391  // protection should not be necessary. However in case of big
392  // readout problems the code may be needed, that is why it stays
393  // commented here.
394 
395  // for (const AFP_ToFRawCollection& collection : container->collectionsToF())
396  // if (collection.link() == link && collection.robId() == robId)
397  // ATH_MSG_WARNING("ToF collection link="<<link<<" robId="<<robId<<" already in container, although it should not be there. Anyway creating new collection (Reading several BCX?)");
398 
399  AFP_ToFRawCollection& newCollection = container->newCollectionToF();
400  return &newCollection;
401 }

◆ initialize()

StatusCode AFP_ByteStream2RawCnv::initialize ( )
virtual

Definition at line 34 of file AFP_ByteStream2RawCnv.cxx.

34  {
35  ATH_MSG_INFO("Initializing " << name() << "...");
36 
38  ATH_MSG_DEBUG("AFP_ByteStream2RawCnv::initialize");
39  if (sc.isFailure()) {
40  ATH_MSG_WARNING("Failed to initialize");
41  return StatusCode::SUCCESS;
42  }
43 
44  if (m_robDataProvider.retrieve().isFailure()) {
45  ATH_MSG_WARNING("Failed to retrieve service " << m_robDataProvider
46  << "...");
47  return StatusCode::SUCCESS;
48  } else {
49  ATH_MSG_DEBUG("Retrieved service " << m_robDataProvider << "...");
50  }
51 
52  if (m_wordReadout.retrieve().isFailure()) {
53  ATH_MSG_WARNING("Failed to retrieve service " << m_wordReadout
54  << "...");
55  return StatusCode::SUCCESS;
56  } else {
57  ATH_MSG_DEBUG("Retrieved service " << m_wordReadout << "...");
58  }
59 
60  return StatusCode::SUCCESS;
61 }

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

Definition at line 18 of file AFP_ByteStream2RawCnv.cxx.

18  {
19  static const InterfaceID IID_IAFP_ByteStream2RawCnv("AFP_ByteStream2RawCnv", 1, 0);
20  return IID_IAFP_ByteStream2RawCnv;
21 }

◆ isLinkSi()

bool AFP_ByteStream2RawCnv::isLinkSi ( const unsigned int  link) const
inline

returns true if provided link corresponds to silicon detector information

Definition at line 47 of file AFP_ByteStream2RawCnv.h.

47 {return ( (link <= 3) || ( (link >= 8) && (link <= 11) ) );}

◆ isLinkToF()

bool AFP_ByteStream2RawCnv::isLinkToF ( const unsigned int  link) const
inline

returns true if provided link corresponds to time-of-flight information

Definition at line 44 of file AFP_ByteStream2RawCnv.h.

44 {return ( (link == 12) || (link == 13));}

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ setDataHeader()

void AFP_ByteStream2RawCnv::setDataHeader ( uint32_t  the_word,
AFP_RawDataCommonHead dataHead 
) const

Sets data header information for given argument based on m_wordReadout.

Definition at line 403 of file AFP_ByteStream2RawCnv.cxx.

404 {
405  dataHead->setLink (m_wordReadout->link(the_word));
406  dataHead->setHitDiscConfig (m_wordReadout->getBits(the_word, 29, 28));
407 }

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

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

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_robDataProvider

ServiceHandle<IROBDataProviderSvc> AFP_ByteStream2RawCnv::m_robDataProvider
private

Definition at line 71 of file AFP_ByteStream2RawCnv.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.

◆ m_wordReadout

ToolHandle<AFP_WordReadOut> AFP_ByteStream2RawCnv::m_wordReadout {this, "AFP_WordReadOut", "AFP_WordReadOut", "Tool that reads word"}
private

Definition at line 73 of file AFP_ByteStream2RawCnv.h.

◆ s_siNoHitMarker

const uint32_t AFP_ByteStream2RawCnv::s_siNoHitMarker = 15
staticprivate

Definition at line 75 of file AFP_ByteStream2RawCnv.h.


The documentation for this class was generated from the following files:
AFP_RawDataCommonHead::setLink
void setLink(const uint16_t outlink)
Definition: AFP_RawDataCommonHead.h:24
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
AFP_RawContainer::newCollectionSi
AFP_SiRawCollection & newCollectionSi()
Definition: AFP_RawContainer.h:31
AFP_RawCollection::end
std::list< RAWDATA_T >::iterator end()
Definition: AFP_RawCollection.h:21
AFP_ByteStream2RawCnv::isLinkSi
bool isLinkSi(const unsigned int link) const
returns true if provided link corresponds to silicon detector information
Definition: AFP_ByteStream2RawCnv.h:47
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AFP_RawDataCommonHead::setHitDiscConfig
void setHitDiscConfig(const uint16_t hitDiscConfig)
Definition: AFP_RawDataCommonHead.h:21
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
initialize
void initialize()
Definition: run_EoverP.cxx:894
AFP_RawCollectionHead
Class represnting header record in bytestream.
Definition: AFP_RawCollectionHead.h:15
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AFP_ToFRawData_v2
Class representing data record for time-of-flight detectors.
Definition: AFP_ToFRawData_v2.h:22
AFP_RawCollection::newDataRecord
RAWDATA_T & newDataRecord()
Creates a new empty data record in the collection and returns reference to it.
Definition: AFP_RawCollection.h:24
AFP_RawCollectionHead::setRobId
void setRobId(const uint32_t robId)
Definition: AFP_RawCollectionHead.h:35
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AFP_RawCollection::begin
std::list< RAWDATA_T >::iterator begin()
Returns iterators to the beginning and end of the list.
Definition: AFP_RawCollection.h:20
AFP_RawContainer::setTimeStampNS
void setTimeStampNS(const uint32_t timeStampNS)
Definition: AFP_RawContainer.h:22
AFP_ByteStream2RawCnv::m_wordReadout
ToolHandle< AFP_WordReadOut > m_wordReadout
Definition: AFP_ByteStream2RawCnv.h:73
AFP_RawCollectionHead::setBcId
void setBcId(const uint16_t bcId)
Definition: AFP_RawCollectionHead.h:31
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
AFP_ByteStream2RawCnv::getCollectionToF
AFP_ToFRawCollection * getCollectionToF(AFP_RawContainer *container) const
Adds new time-of-flight collection to AFP_RawContainer.
Definition: AFP_ByteStream2RawCnv.cxx:380
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
AFP_ByteStream2RawCnv::isLinkToF
bool isLinkToF(const unsigned int link) const
returns true if provided link corresponds to time-of-flight information
Definition: AFP_ByteStream2RawCnv.h:44
AFP_ToFRawData_v2::setEdge
void setEdge(const uint16_t edge)
Definition: AFP_ToFRawData_v2.h:35
AFP_ByteStream2RawCnv::s_siNoHitMarker
static const uint32_t s_siNoHitMarker
Definition: AFP_ByteStream2RawCnv.h:75
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
AFP_RawCollection
Class representing collection of silicon detector data.
Definition: AFP_RawCollection.h:14
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:85
AFP_ByteStream2RawCnv::getCollectionSi
AFP_SiRawCollection * getCollectionSi(AFP_RawContainer *container) const
Adds new silicon collection to AFP_RawContainer.
Definition: AFP_ByteStream2RawCnv.cxx:356
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AFP_RawContainer::setBCId
void setBCId(const uint32_t bcId)
Definition: AFP_RawContainer.h:19
AFP_ToFRawData_v2::setTime
void setTime(const uint32_t time)
Definition: AFP_ToFRawData_v2.cxx:36
AFP_SiRawData::setColumn
void setColumn(const uint16_t column)
Definition: AFP_SiRawData.h:21
AFP_RawContainer::setLumiBlock
void setLumiBlock(const uint32_t lumiBlock)
Definition: AFP_RawContainer.h:25
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
AFP_ToFRawData_v2::setPulseLength
void setPulseLength(const uint32_t pulseLength)
Definition: AFP_ToFRawData_v2.cxx:58
AFP_ToFRawData_v2::setTriggerPattern
void setTriggerPattern(const uint32_t triggerPattern)
Definition: AFP_ToFRawData_v2.cxx:102
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
AFP_SiRawData
Class representing data record for silicon detectors.
Definition: AFP_SiRawData.h:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AFP_SiRawData::setRow
void setRow(const uint32_t row)
Definition: AFP_SiRawData.h:25
AFP_RawContainer::newCollectionToF
AFP_ToFRawCollection & newCollectionToF()
Definition: AFP_RawContainer.h:34
AFP_SiRawData::setTimeOverThreshold
void setTimeOverThreshold(const uint16_t timeOverThreshold)
Definition: AFP_SiRawData.h:29
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AFP_RawCollectionHead::setLvl1Id
void setLvl1Id(const uint16_t lvl1Id)
Definition: AFP_RawCollectionHead.h:19
AFP_ByteStream2RawCnv::setDataHeader
void setDataHeader(uint32_t the_word, AFP_RawDataCommonHead *dataHead) const
Sets data header information for given argument based on m_wordReadout.
Definition: AFP_ByteStream2RawCnv.cxx:403
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFP_RawContainer::setTimeStamp
void setTimeStamp(const uint32_t timeStamp)
Definition: AFP_RawContainer.h:16
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AFP_RawContainer::setLvl1Id
void setLvl1Id(const uint32_t lvl1ID)
Definition: AFP_RawContainer.h:28
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
AFP_ToFRawData_v2::setHeader
void setHeader(const uint16_t header)
Definition: AFP_ToFRawData_v2.h:31
AFP_ToFRawData_v2::setDelayedTrigger
void setDelayedTrigger(const uint32_t delayedTrigger)
Definition: AFP_ToFRawData_v2.cxx:80
AFP_ByteStream2RawCnv::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: AFP_ByteStream2RawCnv.h:71
AFP_RawCollectionHead::setFrontendFlag
void setFrontendFlag(const uint32_t flag)
Definition: AFP_RawCollectionHead.h:27
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
AFP_RawCollectionHead::setLink
void setLink(const uint16_t link)
Definition: AFP_RawCollectionHead.h:23
AFP_ToFRawData_v2::setTrigger
void setTrigger()
Definition: AFP_ToFRawData_v2.h:40
fitman.k
k
Definition: fitman.py:528
AFP_ToFRawData_v2::setChannel
void setChannel(const uint16_t channel)
Definition: AFP_ToFRawData_v2.h:39