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

#include <CscOverlay.h>

Inheritance diagram for CscOverlay:
Collaboration diagram for CscOverlay:

Public Member Functions

 CscOverlay (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual StatusCode initialize () override final
 
virtual StatusCode execute (const EventContext &ctx) const override final
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual bool isClonable () const override
 Specify if the algorithm is clonable. More...
 
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
 
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
virtual bool filterPassed (const EventContext &ctx) const
 
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 
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 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
 

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

StatusCode overlayContainer (const CscRawDataContainer *bkgContainer, const CscRawDataContainer *signalContainer, CscRawDataContainer *outputContainer) const
 Overlay signal on the background container and record to the output one. More...
 
std::unique_ptr< CscRawDataCollectioncopyCollection (const CscRawDataCollection *collection, bool propertiesOnly=false) const
 Copy CscRawDataCollection, optionally only copy properties. More...
 
void mergeCollections (const CscRawDataCollection *bkgCollection, const CscRawDataCollection *signalCollection, CscRawDataCollection *outputCollection, CLHEP::HepRandomEngine *rndmEngine) const
 In case of overlap merge signal and background collections. More...
 
void spuData (const CscRawDataCollection *coll, const uint16_t spuID, std::vector< const CscRawData * > &data) const
 get the data in one SPU of a chamber More...
 
uint32_t stripData (const std::vector< const CscRawData * > &data, const unsigned int numSamples, std::map< int, std::vector< uint16_t > > &samples, uint32_t &hash, const uint16_t spuID, const int gasLayer, bool isdata) const
 data in one gas lauer More...
 
std::vector< CscRawData * > overlay (const std::map< int, std::vector< uint16_t > > &sigSamples, const std::map< int, std::vector< uint16_t > > &ovlSamples, const uint32_t address, const uint16_t spuID, const uint16_t collId, const uint32_t hash, CLHEP::HepRandomEngine *rndmEngine) const
 do the overlay - summing the ADC samples on one plane if there is overlap between zero bias data and simulation. More...
 
bool needtoflip (const int address) const
 
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

SG::ReadHandleKey< CscRawDataContainerm_bkgInputKey {this,"BkgInputKey","Bkg_CSCRDO",""}
 
SG::ReadHandleKey< CscRawDataContainerm_signalInputKey {this,"SignalInputKey","Sig_CSCRDO",""}
 
SG::WriteHandleKey< CscRawDataContainerm_outputKey {this,"OutputKey","CSCRDO",""}
 
Gaudi::Property< bool > m_isDataOverlay {this, "isDataOverlay", false, ""}
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
ToolHandle< ICscCalibToolm_cscCalibTool {this, "CalibTool", "CscCalibTool", ""}
 
ToolHandle< Muon::ICSC_RDO_Decoderm_cscRdoDecoderTool {this, "CscRdoDecoderTool", "Muon::CscRDO_Decoder", ""}
 
ServiceHandle< IAthRNGSvcm_rndmSvc {this, "RndmSvc", "AthRNGSvc", "Random Number Service"}
 
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
 
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
 

Detailed Description

Definition at line 32 of file CscOverlay.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CscOverlay()

CscOverlay::CscOverlay ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 18 of file CscOverlay.cxx.

18  :
19  AthReentrantAlgorithm(name, pSvcLocator) {
20 }

Member Function Documentation

◆ cardinality()

unsigned int AthReentrantAlgorithm::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Override this to return 0 for reentrant algorithms.

Definition at line 55 of file AthReentrantAlgorithm.cxx.

56 {
57  return 0;
58 }

◆ copyCollection()

std::unique_ptr< CscRawDataCollection > CscOverlay::copyCollection ( const CscRawDataCollection collection,
bool  propertiesOnly = false 
) const
private

Copy CscRawDataCollection, optionally only copy properties.

Definition at line 220 of file CscOverlay.cxx.

222 {
223  auto outputCollection = std::make_unique<CscRawDataCollection>(collection->identify());
224 
225  // Copy property values to the new collection
226  outputCollection->setIdentifyHash(collection->identifyHash());
227  outputCollection->set_eventType(collection->eventType());
228  outputCollection->setRodId(collection->rodId());
229  outputCollection->setSubDetectorId(collection->subDetectorId());
230  outputCollection->set_samplingPhase(collection->samplingPhase());
231  outputCollection->set_triggerType(collection->triggerType());
232  outputCollection->set_firstBitSummary(collection->firstBitSummary());
233  outputCollection->set_scaAddress(collection->scaAddress());
234  for (uint8_t dataType : collection->dataType()) {
235  outputCollection->addDataType(dataType);
236  }
237 
238  // Return if only properties requested
239  if (propertiesOnly) {
240  return outputCollection;
241  }
242 
243  for (const CscRawData *existingDatum : *collection) {
244  // Owned by the collection
245  auto *datumCopy = new CscRawData(*existingDatum);
246  outputCollection->push_back(datumCopy);
247  }
248 
249  return outputCollection;
250 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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; }

◆ execute()

StatusCode CscOverlay::execute ( const EventContext &  ctx) const
finaloverridevirtual

Definition at line 44 of file CscOverlay.cxx.

44  {
45  ATH_MSG_DEBUG("execute() begin");
46 
47 
49  if(!bkgContainer.isValid()) {
50  ATH_MSG_ERROR("Could not get background CscRawDataContainer called " << bkgContainer.name() << " from store " << bkgContainer.store());
51  return StatusCode::FAILURE;
52  }
53  ATH_MSG_DEBUG("Found background CscRawDataContainer called " << bkgContainer.name() << " in store " << bkgContainer.store());
54 
56  if(!signalContainer.isValid()) {
57  ATH_MSG_ERROR("Could not get signal CscRawOverlayContainer called " << signalContainer.name() << " from store " << signalContainer.store());
58  return StatusCode::FAILURE;
59  }
60  ATH_MSG_DEBUG("Found signal CscRawOverlayContainer called " << signalContainer.name() << " in store " << signalContainer.store());
61 
63  ATH_CHECK(outputContainer.record(std::make_unique<CscRawDataContainer>(bkgContainer->size())));
64  if (!outputContainer.isValid()) {
65  ATH_MSG_ERROR("Could not record output CscRawOverlayContainer called " << outputContainer.name() << " to store " << outputContainer.store());
66  return StatusCode::FAILURE;
67  }
68  ATH_MSG_DEBUG("Recorded output CscRawOverlayContainer called " << outputContainer.name() << " in store " << outputContainer.store());
69 
70  // now do the overlay
71  ATH_CHECK(overlayContainer(bkgContainer.cptr(), signalContainer.cptr(), outputContainer.ptr()));
72 
73 
74  ATH_MSG_DEBUG("execute() end");
75  return StatusCode::SUCCESS;
76 }

◆ extraDeps_update_handler()

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

◆ extraOutputDeps()

const DataObjIDColl & AthReentrantAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 79 of file AthReentrantAlgorithm.cxx.

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ initialize()

StatusCode CscOverlay::initialize ( )
finaloverridevirtual

CSC calibratin tool for the Condtiions Data base access

Definition at line 23 of file CscOverlay.cxx.

23  {
24  ATH_MSG_DEBUG("CscOverlay initialized");
25  ATH_CHECK(m_idHelperSvc.retrieve());
26 
28  ATH_CHECK(m_cscCalibTool.retrieve());
29 
30  // get cscRdoDecoderTool
31  ATH_CHECK(m_cscRdoDecoderTool.retrieve());
32 
33  //random number initialization
34  ATH_CHECK(m_rndmSvc.retrieve());
35 
39 
40  return StatusCode::SUCCESS;
41 }

◆ inputHandles()

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

◆ isClonable()

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ mergeCollections()

void CscOverlay::mergeCollections ( const CscRawDataCollection bkgCollection,
const CscRawDataCollection signalCollection,
CscRawDataCollection outputCollection,
CLHEP::HepRandomEngine *  rndmEngine 
) const
private

In case of overlap merge signal and background collections.

loop over the SPU - collecting thr data by layer do the overlay by igas layer in a chamber

for the non-precision strips, all the 4 layers in a chamber are in the same SPU, we need to recover the data by chamber layer

Definition at line 275 of file CscOverlay.cxx.

279 {
280  ATH_MSG_DEBUG("mergeCollection() begin");
281 
282  // number of ADC samples in the both data stream
283  unsigned int nSigSamples = bkgCollection->numSamples();
284  unsigned int nOvlSamples = signalCollection->numSamples();
285 
286  // sampling times in both data streams
287  unsigned int dataSamplingTime = bkgCollection->rate();
288  unsigned int ovlSamplingTime = signalCollection->rate();
289 
290  if ( dataSamplingTime != ovlSamplingTime ) {
291  ATH_MSG_ERROR("Overlay of inconsistent data - sampling times not the same "
292  << dataSamplingTime << " ns " << ovlSamplingTime << " ns");
293  throw std::runtime_error("mergeCollections(): sampling time mismatch");
294  }
295 
296  if ( nSigSamples != nOvlSamples ) {
297  ATH_MSG_ERROR("Overlay of inconsistent data - number of samples not the same "
298  << nSigSamples << " " << nOvlSamples);
299  throw std::runtime_error("mergeCollections(): number of samples mismatch");
300  }
301 
304  uint16_t clusterCounts[] = {0,0,0,0,0,0,0,0,0,0};
305  uint16_t rpuCount[] = {0,0};
306  for ( uint16_t spuID=0; spuID<10; ++spuID) {
307 
308  std::vector<const CscRawData*> sigData; // real data
309  this->spuData(bkgCollection, spuID, sigData);
310 
311  std::vector<const CscRawData*> ovlData; // simulation
312  this->spuData(signalCollection, spuID, ovlData);
313 
316  int layer = 0;
317  if ( spuID == 4 || spuID == 9 ) layer=4;
318  for ( int j=0; j<=layer; ++j ) {
319  std::map< int,std::vector<uint16_t> > sigSamples;
320  std::map< int,std::vector<uint16_t> > ovlSamples;
321  uint32_t sigHash;
322  uint32_t ovlHash;
323  uint32_t sigAddress = this->stripData( sigData, nSigSamples, sigSamples, sigHash, spuID, j , m_isDataOverlay); // need to patch in the case of real data
324  uint32_t ovlAddress = this->stripData( ovlData, nOvlSamples, ovlSamples, ovlHash, spuID, j , false); // simulation
325  if (sigSamples.size()==0 && ovlSamples.size()==0) continue;
326 
327  uint32_t hash = std::min( sigHash, ovlHash );
328  uint32_t address = std::min( sigAddress, ovlAddress );
329  if (sigSamples.size()!=0 && ovlSamples.size()!=0 && needtoflip(address)){
330  ATH_MSG_DEBUG("Looking for overlap of hashes and addresses within widths because needtoflip");
331  msg() << MSG::VERBOSE ;
332  std::set<int> sig; int lastindex=-1;
333  for (std::map< int,std::vector<uint16_t> >::const_iterator si=sigSamples.begin(); si!=sigSamples.end(); ++si) {
334  if (si!=sigSamples.begin() && si->first-lastindex!=1) break;
335  lastindex=si->first;
336  sig.insert(si->first); msg() << si->first << " ";
337  }
338  msg()<<endmsg;
339  bool overlap=false;
340  msg() <<MSG::VERBOSE ;
341  for (std::map< int,std::vector<uint16_t> >::const_iterator so=ovlSamples.begin(); so!=ovlSamples.end(); ++so) {
342  //add 1 to beginning and end of list because adjacent counts as overlap
343  msg() << (so->first)-1 << " ";
344  if (sig.find((so->first)-1)!=sig.end()) {overlap=true; msg() << "!!";}
345  msg() << (so->first) << " ";
346  if (sig.find((so->first))!=sig.end()) {overlap=true; msg() << "!!";}
347  msg() << (so->first)+1 << " ";
348  if (sig.find((so->first)+1)!=sig.end()) {overlap=true; msg() << "!!";}
349  }
350  msg()<<endmsg;
351  if (!overlap){
352  ATH_MSG_DEBUG("Taking max of hashes and addresses because needtoflip and no overlap");
353  hash = std::max( sigHash, ovlHash );
354  address = std::max( sigAddress, ovlAddress );
355  }
356  }
357 
358  //for checks
359  std::set<int> insertedstrips, readstrips;
360  for (std::map< int,std::vector<uint16_t> >::const_iterator s=sigSamples.begin(); s!=sigSamples.end(); ++s){readstrips.insert(s->first);}
361  for (std::map< int,std::vector<uint16_t> >::const_iterator si=ovlSamples.begin(); si!=ovlSamples.end(); ++si){readstrips.insert(si->first);}
362 
363  std::vector<CscRawData*> datums = this->overlay(sigSamples, ovlSamples,address, spuID, outputCollection->identify(), hash, rndmEngine);
364  if ( datums.size()==0 ) { ATH_MSG_WARNING("datums is size 0!"); }
365  for (unsigned int di=0; di<datums.size(); ++di){
366  CscRawData* datum=datums[di];
367  hash = datum->hashId();
368  address = datum->address();
369  int stripstart = ( address & 0x000000FF) + 1 + 0;
370  ATH_MSG_DEBUG("Datum in layer="<<j<<" has hash="<<hash<<" address="<<address<<" stripstart="<<stripstart<<", "<< *datum );
371  if (datum->width()==0) {
372  ATH_MSG_WARNING("Datum has 0 width!");
373  continue;
374  }
375 
376  //perform some checks
377  int stationName = ( ( address & 0x00010000) >> 16 ) + 50;
378  int stationEta = ( ((address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1;
379  int stationPhi = ( ( address & 0x0000E000) >> 13 ) + 1;
380  Identifier me= m_idHelperSvc->cscIdHelper().elementID(stationName,stationEta,stationPhi);
381  ATH_MSG_VERBOSE("stationName,Eta,Phi="<<stationName<<","<<stationEta<<","<<stationPhi<<" - me="<<me);
382  bool good=true;
383  for (unsigned int j=0; j<datum->width(); ++j) {
384  int chamberLayer = ( (address & 0x00000800) >> 11) + 1;
385  int wireLayer = ( (address & 0x00000600) >> 9) + 1;
386  int measuresPhi = ( (address & 0x00000100) >> 8);
387  int strip = ( address & 0x000000FF) + 1 + j;
388  ATH_MSG_VERBOSE("chamberlayer,wirelayer,measuresphi,strip="<<chamberLayer<<","<<wireLayer<<","<<measuresPhi<<","<<strip);
389  // Added to Online -> Offline id in A side number is opposite bug#56002
390  if (measuresPhi) {
391  int stationEta = ( ((address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1;
392  if (stationEta>0) {
393  ATH_MSG_VERBOSE("FLIP strip. Formerly strip="<<strip<<", now strip="<<49-strip);
394  strip = 49-strip;
395  }
396  }
397  insertedstrips.insert(strip);//for checks
398  Identifier mechan= m_idHelperSvc->cscIdHelper().channelID(me,chamberLayer,wireLayer,measuresPhi,strip);
399  ATH_MSG_VERBOSE("mechan="<<mechan);
400  const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(datum, &m_idHelperSvc->cscIdHelper(), j);
401  if(!(m_idHelperSvc->cscIdHelper().valid(channelId))) {
402  ATH_MSG_WARNING("Invalid CSC Identifier in merge! - skipping " << channelId );
403  good=false;
404  }
405  else{ATH_MSG_DEBUG("Valid CSC Identifier in merge " << channelId);}
406  }
407  if (good){ outputCollection->push_back(datum); }
408  else{ continue; }
409 
410  //keep count
411  if (spuID <10) clusterCounts[spuID] += 1;
412  if ( spuID <= 4 ) rpuCount[0] = 5;
413  else if ( spuID > 4 && spuID <= 9 ) rpuCount[1] = 11;
414  }//loop over datum
415 
416  //check
417  if (readstrips!=insertedstrips){
418  ATH_MSG_WARNING("Readstrips != Insertedstrips: ");
419  std::ostringstream readstream;
420  for (std::set<int>::const_iterator i = readstrips.begin(); i!=readstrips.end(); ++i){readstream<<*i<<" ";}
421  ATH_MSG_WARNING(readstream.str());
422  std::ostringstream insertstream;
423  for (std::set<int>::const_iterator i = insertedstrips.begin(); i!=insertedstrips.end(); ++i){insertstream<<*i<<" ";}
424  ATH_MSG_WARNING(insertstream.str());
425  }
426 
427  }
428  }
429  for (unsigned int i=0; i<10; ++i) outputCollection->set_spuCount(i,clusterCounts[i]);
430  for (unsigned int i=0; i<2; ++i) { if (rpuCount[i] != 0) outputCollection->addRPU(rpuCount[i]); }
431  // FIXME --- need to be able to reset the dataType - should add a new method to CscRawDataCollection for this
432  ATH_MSG_DEBUG("mergeCollection<>() end ");
433 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::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< Gaudi::Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ needtoflip()

bool CscOverlay::needtoflip ( const int  address) const
private

Definition at line 263 of file CscOverlay.cxx.

264 {
265  int measuresPhi = ( (address & 0x00000100) >> 8);
266  if (address<2147483640 && measuresPhi) {
267  int stationEta = ( ((address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1;
268  if (stationEta>0) { return true; }
269  }
270  return false;
271 }

◆ outputHandles()

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

◆ overlay()

std::vector< CscRawData * > CscOverlay::overlay ( const std::map< int, std::vector< uint16_t > > &  sigSamples,
const std::map< int, std::vector< uint16_t > > &  ovlSamples,
const uint32_t  address,
const uint16_t  spuID,
const uint16_t  collId,
const uint32_t  hash,
CLHEP::HepRandomEngine *  rndmEngine 
) const
private

do the overlay - summing the ADC samples on one plane if there is overlap between zero bias data and simulation.

If there is no overlap, simply copy the data

Definition at line 532 of file CscOverlay.cxx.

539 {
540  ATH_MSG_DEBUG("overlay<>() begin: hash="<<hash<<" address="<<address);
541  std::vector<CscRawData*> datas;
542  CscRawData * rawData = nullptr;
543  int max = 192;
544  if ( spuID == 4 || spuID == 9 ) max = 48;
545  std::vector<uint16_t> samples;
546  std::map< int,std::vector<uint16_t> >::const_iterator sig;
547  std::map< int,std::vector<uint16_t> >::const_iterator ovl;
548  uint16_t width = 0;
549  int myhash=hash; int myaddress=address;
550 
551  max+=1;//go one past the end, to get the clusters ending right
552  for ( int i=1; i<=max; ++i) {
553  sig = sigSamples.find(i);
554  ovl = ovlSamples.find(i);
555  bool used=false;
556 
557  if ( sig != sigSamples.end() && ovl == ovlSamples.end() ) { // real data only
558  ATH_MSG_VERBOSE("data only for i="<<i);
559  for ( unsigned int j=0; j<(*sig).second.size(); ++j ) {
560  samples.push_back( (*sig).second.at(j) );
561  assert((*sig).second.at(j)<=MAX_AMPL);
562  }
563  width++; used=true;
564  }
565  else if ( sig == sigSamples.end() && ovl != ovlSamples.end() ) { // simulation only
566  ATH_MSG_VERBOSE("simulation only for i="<<i);
567  int myhashw=myhash+width; if (needtoflip(myaddress)) {myhashw=myhash-width;}
568  double noise = m_cscCalibTool->stripNoise( (myhashw), false );//in ADC counts
569  for ( unsigned int j=0; j<(*ovl).second.size(); ++j ) {
570  double theNoise = CLHEP::RandGaussZiggurat::shoot(rndmEngine, 0.0, noise);
571  float adcCount = (*ovl).second.at(j) + theNoise ;//add noise
572  if ( adcCount > MAX_AMPL ) {
573  ATH_MSG_DEBUG("value out of range (adding noise): " << adcCount << " "
574  << " Setting it to max value = " << MAX_AMPL
575  << " IdentifierHash is " << (myhashw));
576  adcCount = MAX_AMPL;
577  }
578  samples.push_back( (uint16_t) rint(adcCount) );
579  }
580  width++; used=true;
581  }
582  else if ( sig != sigSamples.end() && ovl != ovlSamples.end() ) { // real data + MC
583  ATH_MSG_VERBOSE("data and simulation for i="<<i);
584  int myhashw=myhash+width; if (needtoflip(myaddress)) {myhashw=myhash-width;}
585  double pedestal = m_cscCalibTool->stripPedestal( (myhashw), false );//in ADC counts
586  for ( unsigned int j=0; j<(*sig).second.size(); ++j ) {
587  float adcCount = (*sig).second.at(j) + (*ovl).second.at(j) - pedestal ;//subtract pedestal only (data already has noise)
588  if ( adcCount > MAX_AMPL ) {
589  ATH_MSG_DEBUG("value out of range (adding data+MC samples - pedestal): " << adcCount << " "
590  << " Setting it to max value = " << MAX_AMPL
591  << " IdentifierHash is " << (myhashw));
592  adcCount = MAX_AMPL;
593  }
594  samples.push_back( (uint16_t) rint(adcCount) );
595  }
596  width++; used=true;
597  }
598 
599  if ( used==false && datas.size()>0 ){
600  if (needtoflip(myaddress)) {myhash-=1; myaddress-=1;}
601  else {myhash+=1; myaddress+=1;}
602  }
603 
604  //If a break is detected in the strip cluster, start a new CscRawData object...
605  //and adjust the hash and address, etc.
606  if ( (used==false||i==max) && samples.size()>0){
607  if (datas.size()>0 && needtoflip(myaddress)) {myhash-=width; myaddress-=width;}
608  rawData = new CscRawData( samples, myaddress, collId, spuID, width );
609  rawData->setHashID(myhash);
610  rawData->setTime(0);//ACH - TODO: should be made significantly more clever!
611  datas.push_back(rawData);
612  ATH_MSG_DEBUG("overlay<>() add datum: hash="<<myhash<<" address="<<myaddress<<" width="<<width);
613  samples.clear();
614  if (!needtoflip(myaddress)) {myhash+=width; myaddress+=width;}
615  width=0;
616  }
617 
618  }
619  ATH_MSG_DEBUG("overlay<>() end: CscRawDatas size="<<datas.size());
620  return datas;
621 }

◆ overlayContainer()

StatusCode CscOverlay::overlayContainer ( const CscRawDataContainer bkgContainer,
const CscRawDataContainer signalContainer,
CscRawDataContainer outputContainer 
) const
private

Overlay signal on the background container and record to the output one.

Definition at line 79 of file CscOverlay.cxx.

82 {
83  ATH_MSG_DEBUG("overlayContainer() begin");
84 
85  // The MC signal container should typically be smaller than bkgContainer,
86  // because the latter contains all the noise, minimum bias and pile up.
87  // Thus we firstly iterate over signal hashes and store them in a map.
88  std::vector < std::pair<IdentifierHash, bool> > overlapMap;
89  overlapMap.reserve(signalContainer->numberOfCollections());
90  for (const auto &[hashId, ptr] : signalContainer->GetAllHashPtrPair()) {
91  overlapMap.emplace_back(hashId, false);
92  }
93 
94  // Now loop through the background hashes and copy unique ones over
95  for (const auto &[hashId, ptr] : bkgContainer->GetAllHashPtrPair()) {
96  auto search = std::lower_bound( overlapMap.begin(), overlapMap.end(), hashId,
97  [](const std::pair<IdentifierHash, bool> &lhs, IdentifierHash rhs) -> bool { return lhs.first < rhs; } );
98  if (search == overlapMap.end() || search->first != hashId) {
99  // Copy the background collection
100  std::unique_ptr<CscRawDataCollection> bkgCollection = copyCollection(ptr);
101 
102  if (outputContainer->addCollection(bkgCollection.get(), hashId).isFailure()) {
103  ATH_MSG_ERROR("Adding background Collection with hashId " << hashId << " failed");
104  return StatusCode::FAILURE;
105  } else {
106  (void)bkgCollection.release();
107  }
108  } else {
109  // Flip the overlap flag
110  search->second = true;
111  }
112  }
113 
114  // Setup random engine
115  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this);
116  rngWrapper->setSeed( name(), Gaudi::Hive::currentContext() );
117  CLHEP::HepRandomEngine *rndmEngine(*rngWrapper);
118 
119  // Finally loop through the map and process the signal and overlay if
120  // necessary
121  for (const auto &[hashId, overlap] : overlapMap) {
122  // Retrieve the signal collection
123  const CscRawDataCollection *signalCollection = signalContainer->indexFindPtr(hashId);
124 
125  // Output collection
126  std::unique_ptr<CscRawDataCollection> outputCollection{};
127 
128  if (overlap) { // Do overlay
129  // Retrieve the background collection
130  const CscRawDataCollection *bkgCollection = bkgContainer->indexFindPtr(hashId);
131 
132  // Create the output collection with background collection as a base
133  // TODO: should it be signal collection?
134  outputCollection = copyCollection(bkgCollection, true);
135 
136  // Merge the collections
137  mergeCollections(bkgCollection, signalCollection, outputCollection.get(), rndmEngine);
138  } else {
139  // Create the output collection with signal collection as a base
140  outputCollection = copyCollection(signalCollection, true);
141 
142  uint16_t numSamples = signalCollection->numSamples();
143 
144  for (const CscRawData *data : *signalCollection) {
145  if (!data) {
146  ATH_MSG_WARNING("NULL pointer to Digit!");
147  continue;
148  }
149 
150  // Copy the digit and add noise
151  std::vector<uint16_t> samples;
152 
153  uint16_t width = data->width();
154  uint32_t hashOffset = data->hashId();
155 
156  // Loop over width
157  for (uint16_t j = 0; j < width; ++j) {
158  uint32_t stripHash = hashOffset + j;
159  double stripNoise = m_cscCalibTool->stripNoise(stripHash, false);
160  // Get the samples
161  std::vector<uint16_t> stripSamples;
162  bool extractSamplesStatus = data->samples(j, numSamples, stripSamples);
163  if (!extractSamplesStatus) {
164  ATH_MSG_WARNING("Unable to extract samples for strip " << j
165  << " Online Cluster width = " << width
166  << " for number of Samples = " << numSamples
167  << " continuing ...");
168  } else {
169  for (uint16_t sample : stripSamples) {
170  double sampleNoise = CLHEP::RandGaussZiggurat::shoot(rndmEngine, 0.0, stripNoise);
171  // TODO: rounding issue - some strange type conversion is going on
172  // uint16_t adcCount = sample + std::lrint(sampleNoise);
173  float adcCount = sample + sampleNoise;
174  if (adcCount > MAX_AMPL) {
175  ATH_MSG_DEBUG("value out of range (copying over signal): " << adcCount << " "
176  << " Setting it to max value = " << MAX_AMPL
177  << " IdentifierHash is " << stripHash);
178  adcCount = MAX_AMPL;
179  }
180  // TODO: rounding issue
181  // samples.push_back(adcCount);
182  samples.push_back( (uint16_t) rint(adcCount) );
183  }
184  }
185  }
186 
187  // Copy over the digit with the updated samples
188  auto rdo = std::make_unique<CscRawData>(samples, data->address(), data->identify(), data->time(), data->rpuID(), data->width(), data->hashId());
189 
190  // Perform some checks
191  bool good = true;
192  for (uint16_t j = 0; j < width; ++j) {
193  const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(rdo.get(), &m_idHelperSvc->cscIdHelper(), j);
194  if (!m_idHelperSvc->cscIdHelper().valid(channelId)) {
195  ATH_MSG_WARNING("Invalid CSC Identifier! - skipping " << channelId);
196  good = false;
197  break;
198  }
199  }
200  if (good) {
201  outputCollection->push_back(rdo.release());
202  }
203  }
204  }
205 
206  if (outputContainer->addCollection(outputCollection.get(), hashId).isFailure()) {
207  ATH_MSG_ERROR("Adding overlaid Collection with hashId " << hashId << " failed");
208  return StatusCode::FAILURE;
209  } else {
210  (void)outputCollection.release();
211  }
212  }
213 
214  ATH_MSG_DEBUG("overlayContainer>() end");
215  return StatusCode::SUCCESS;
216 }

◆ 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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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  }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

◆ spuData()

void CscOverlay::spuData ( const CscRawDataCollection coll,
const uint16_t  spuID,
std::vector< const CscRawData * > &  data 
) const
private

get the data in one SPU of a chamber

Definition at line 252 of file CscOverlay.cxx.

253 {
254  data.clear(); if ( !coll ) return;
257  for ( ; idata != edata; ++idata ) {
258  if ( (*idata)->rpuID() == spuID ) data.push_back( *idata );
259  }
260  ATH_MSG_DEBUG("spuData(): made data vector of size "<<data.size()<<" for SPU "<<spuID);
261 }

◆ stripData()

uint32_t CscOverlay::stripData ( const std::vector< const CscRawData * > &  data,
const unsigned int  numSamples,
std::map< int, std::vector< uint16_t > > &  samples,
uint32_t &  hash,
const uint16_t  spuID,
const int  gasLayer,
bool  isdata 
) const
private

data in one gas lauer

loop over the data in the SPU

find the strip Identifier given the strip hash ID

create the map only layer by layer for the precision strip, we set gasLayer=0 because the spuID tells you the gas layer for the non-precision strips, we need to explicitly get the gas layer number form the Identifier

Definition at line 435 of file CscOverlay.cxx.

441 {
442  ATH_MSG_DEBUG("stripData<>() begin: gasLayer="<<gasLayer<<" spuID="<<spuID<<" isdata="<<isdata);
443 
444  samples.clear();
445  IdContext context = m_idHelperSvc->cscIdHelper().channel_context();
446 
447  uint32_t maxInt = 2147483640;
448  uint32_t address = maxInt;
449  hash = maxInt;
450 
452  std::vector<const CscRawData*>::const_iterator idata = data.begin();
453  std::vector<const CscRawData*>::const_iterator edata = data.end();
454  for ( ; idata != edata; ++idata ) {
455  const CscRawData * datum = *idata;
456  uint32_t hashOffset = datum->hashId();
457 
459  Identifier stripId;
460  m_idHelperSvc->cscIdHelper().get_id(hashOffset, stripId, &context);
461  unsigned int strip = static_cast<unsigned int> ( m_idHelperSvc->cscIdHelper().strip( stripId ) );
462  int layer = m_idHelperSvc->cscIdHelper().wireLayer( stripId );
463  uint16_t width = datum->width();
464 
468  bool non_precision = (gasLayer==layer) && (spuID==4 || spuID==9);
469  bool precision = (gasLayer==0) && (!(spuID==4 || spuID==9));
470  bool check = precision || non_precision;
471  if ( !check ) {
472  //ATH_MSG_DEBUG("Not precision or non_precision, skipping layer="<<layer<<", gasLayer="<<gasLayer<<", spuID="<<spuID);
473  continue;
474  }
475 
476  //ACH - move down here after layer continue...
477  unsigned int newaddress = datum->address();
478  //if we're going to later flip the data strip for bug#56002
479  if (isdata && needtoflip(newaddress)) {
480  ATH_MSG_VERBOSE("needtoflip in stripdata, newaddress was = "<<newaddress<<", strip was = "<<strip);
481 
482  //old way
483  //newaddress= newaddress- (width-1);//apparently need to shift the address to the highest strip
484 
485  //new way
486  uint32_t oldFirstStrip = uint32_t (newaddress & 0x000000FF);
487  uint32_t newFirstStrip = uint32_t (47-oldFirstStrip) - width +1;//starts at 0
488  newaddress=newaddress - oldFirstStrip + newFirstStrip;
489 
490  uint32_t oldStrip = uint32_t (strip & 0x000000FF);
491  uint32_t newStrip = uint32_t (49-oldStrip);//starts at 1
492  strip=strip - oldStrip + newStrip;
493 
494  ATH_MSG_VERBOSE("needtoflip in stripdata, newaddress now = "<<newaddress<<", strip now = "<<strip);
495  }
496 
497  if ( needtoflip(newaddress) ){
498  if (hash == maxInt) hash=0;
499  if (address == maxInt) address=0;
500  if ( hashOffset > hash ) hash = hashOffset;
501  if ( newaddress > address ) address = newaddress;
502  }
503  else{
504  if ( hashOffset < hash ) hash = hashOffset;
505  if ( newaddress < address ) address = newaddress;
506  }
507 
508  ATH_MSG_DEBUG("stripData(): width="<<width<<" hashOffset="<<hashOffset<<" datumaddress="<<datum->address()<<" layer="<<layer<<" strip="<<strip<<", hash="<<hash<<" address="<<address);
509 
510  for (unsigned int j=0; j<width; ++j) {
511  std::vector<uint16_t> adcs;
512  bool extractSamples = datum->samples(j, numSamples, adcs);
513  if ( !extractSamples ) {
514  ATH_MSG_WARNING("Unable to extract samples for strip " << j
515  << " Online Cluster width = " << width << " for number of Samples = " << numSamples);
516  }
517  else {
518  int newstrip = (strip+j);
519  if (false && isdata && needtoflip(address)){
520  newstrip = strip-j;
521  ATH_MSG_VERBOSE("needtoflip in stripdata, newstrip is "<<newstrip);
522  }
523  samples.insert ( std::make_pair( newstrip, adcs) );
524  }
525  }
526  }
527 
528  ATH_MSG_DEBUG("stripData<>() end: hash=" << hash << " address=" << address);
529  return address;
530 }

◆ sysExecute()

StatusCode AthReentrantAlgorithm::sysExecute ( const EventContext &  ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 67 of file AthReentrantAlgorithm.cxx.

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

◆ sysInitialize()

StatusCode AthReentrantAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in InputMakerBase, and HypoBase.

Definition at line 96 of file AthReentrantAlgorithm.cxx.

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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_bkgInputKey

SG::ReadHandleKey<CscRawDataContainer> CscOverlay::m_bkgInputKey {this,"BkgInputKey","Bkg_CSCRDO",""}
private

Definition at line 87 of file CscOverlay.h.

◆ m_cscCalibTool

ToolHandle<ICscCalibTool> CscOverlay::m_cscCalibTool {this, "CalibTool", "CscCalibTool", ""}
private

Definition at line 93 of file CscOverlay.h.

◆ m_cscRdoDecoderTool

ToolHandle<Muon::ICSC_RDO_Decoder> CscOverlay::m_cscRdoDecoderTool {this, "CscRdoDecoderTool", "Muon::CscRDO_Decoder", ""}
private

Definition at line 94 of file CscOverlay.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 153 of file AthReentrantAlgorithm.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> CscOverlay::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 92 of file CscOverlay.h.

◆ m_isDataOverlay

Gaudi::Property<bool> CscOverlay::m_isDataOverlay {this, "isDataOverlay", false, ""}
private

Definition at line 91 of file CscOverlay.h.

◆ m_outputKey

SG::WriteHandleKey<CscRawDataContainer> CscOverlay::m_outputKey {this,"OutputKey","CSCRDO",""}
private

Definition at line 89 of file CscOverlay.h.

◆ m_rndmSvc

ServiceHandle<IAthRNGSvc> CscOverlay::m_rndmSvc {this, "RndmSvc", "AthRNGSvc", "Random Number Service"}
private

Definition at line 96 of file CscOverlay.h.

◆ m_signalInputKey

SG::ReadHandleKey<CscRawDataContainer> CscOverlay::m_signalInputKey {this,"SignalInputKey","Sig_CSCRDO",""}
private

Definition at line 88 of file CscOverlay.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
used
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Muon::nsw::STGTPSegments::moduleIDBits::stationPhi
constexpr uint8_t stationPhi
station Phi 1 to 8
Definition: NSWSTGTPDecodeBitmaps.h:158
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
CscRawData::address
uint32_t address() const
Definition: CscRawData.h:131
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
SiliconTech::strip
@ strip
max
#define max(a, b)
Definition: cfImp.cxx:41
CscRawDataCollection::identify
uint16_t identify() const
access methods
Definition: CscRawDataCollection.h:107
CscOverlay::m_outputKey
SG::WriteHandleKey< CscRawDataContainer > m_outputKey
Definition: CscOverlay.h:89
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
IdentifiableContainerMT::addCollection
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
Definition: IdentifiableContainerMT.h:300
CscOverlay::mergeCollections
void mergeCollections(const CscRawDataCollection *bkgCollection, const CscRawDataCollection *signalCollection, CscRawDataCollection *outputCollection, CLHEP::HepRandomEngine *rndmEngine) const
In case of overlap merge signal and background collections.
Definition: CscOverlay.cxx:275
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CscOverlay::spuData
void spuData(const CscRawDataCollection *coll, const uint16_t spuID, std::vector< const CscRawData * > &data) const
get the data in one SPU of a chamber
Definition: CscOverlay.cxx:252
AthCommonDataStore::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 > renounce(T &h)
Definition: AthCommonDataStore.h:380
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
downloadSingle.dataType
string dataType
Definition: downloadSingle.py:18
MAX_AMPL
const uint16_t MAX_AMPL
Definition: CscDigitToCscRDOTool.cxx:21
CscRawDataCollection::samplingPhase
bool samplingPhase() const
Definition: CscRawDataCollection.h:117
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CscRawData
CscRawData
Definition: MuonEventAthenaPoolTPCnv.cxx:59
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
CscRawDataCollection::eventType
uint32_t eventType() const
Definition: CscRawDataCollection.h:120
CscOverlay::m_cscRdoDecoderTool
ToolHandle< Muon::ICSC_RDO_Decoder > m_cscRdoDecoderTool
Definition: CscOverlay.h:94
search
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
Definition: hcg.cxx:738
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
CscRawDataCollection::triggerType
bool triggerType() const
Definition: CscRawDataCollection.h:118
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
IdentifiableContainerMT::numberOfCollections
virtual size_t numberOfCollections() const override final
return number of collections
Definition: IdentifiableContainerMT.h:216
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
CscOverlay::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CscOverlay.h:92
CscRawDataCollection::identifyHash
IdentifierHash identifyHash() const
Returns the OFFLINE identifier hash for this collection.
Definition: CscRawDataCollection.h:110
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
CscRawDataCollection::dataType
const std::vector< uint8_t > & dataType() const
Definition: CscRawDataCollection.h:116
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
lumiFormat.i
int i
Definition: lumiFormat.py:85
CscRawData::width
uint16_t width() const
Definition: CscRawData.h:128
CscRawDataCollection::firstBitSummary
uint8_t firstBitSummary() const
Definition: CscRawDataCollection.h:119
CscOverlay::m_signalInputKey
SG::ReadHandleKey< CscRawDataContainer > m_signalInputKey
Definition: CscOverlay.h:88
CscRawDataCollection::rodId
uint16_t rodId() const
Definition: CscRawDataCollection.h:112
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CscRawDataCollection::scaAddress
uint32_t scaAddress() const
Definition: CscRawDataCollection.h:123
python.BuildSignatureFlags.sig
sig
Definition: BuildSignatureFlags.py:218
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CscOverlay::overlayContainer
StatusCode overlayContainer(const CscRawDataContainer *bkgContainer, const CscRawDataContainer *signalContainer, CscRawDataContainer *outputContainer) const
Overlay signal on the background container and record to the output one.
Definition: CscOverlay.cxx:79
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
CscRawData::setHashID
void setHashID(uint32_t hash)
Definition: CscRawData.h:121
CscOverlay::copyCollection
std::unique_ptr< CscRawDataCollection > copyCollection(const CscRawDataCollection *collection, bool propertiesOnly=false) const
Copy CscRawDataCollection, optionally only copy properties.
Definition: CscOverlay.cxx:220
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
CscRawDataCollection
Collection of CSC Raw Hits, arranged according to CSC Detector Elements Author: Ketevi A.
Definition: CscRawDataCollection.h:24
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
min
#define min(a, b)
Definition: cfImp.cxx:40
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
CscRawDataCollection::numSamples
uint16_t numSamples() const
Definition: CscRawDataCollection.cxx:8
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
postInclude.outputCollection
outputCollection
Definition: postInclude.SortInput.py:27
CscRawData::hashId
uint32_t hashId() const
Definition: CscRawData.h:132
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
CscRawData::samples
const std::vector< uint16_t > & samples() const
Definition: CscRawData.h:130
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
CscOverlay::stripData
uint32_t stripData(const std::vector< const CscRawData * > &data, const unsigned int numSamples, std::map< int, std::vector< uint16_t > > &samples, uint32_t &hash, const uint16_t spuID, const int gasLayer, bool isdata) const
data in one gas lauer
Definition: CscOverlay.cxx:435
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
LArNewCalib_Delay_OFC_Cali.check
check
Definition: LArNewCalib_Delay_OFC_Cali.py:258
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
CscOverlay::needtoflip
bool needtoflip(const int address) const
Definition: CscOverlay.cxx:263
IdentifiableContainerMT::indexFindPtr
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
Definition: IdentifiableContainerMT.h:292
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
CscRawData
Class to hold the electronic output for a single CSC readout channel: n sampling ADC data + the addre...
Definition: CscRawData.h:21
ReadBchFromCool.good
good
Definition: ReadBchFromCool.py:433
a
TList * a
Definition: liststreamerinfos.cxx:10
h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CscOverlay::m_cscCalibTool
ToolHandle< ICscCalibTool > m_cscCalibTool
Definition: CscOverlay.h:93
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
IdentifiableContainerMT::GetAllHashPtrPair
const std::vector< EventContainers::hashPair< T > > & GetAllHashPtrPair() const
Definition: IdentifiableContainerMT.h:220
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
CscOverlay::m_bkgInputKey
SG::ReadHandleKey< CscRawDataContainer > m_bkgInputKey
Definition: CscOverlay.h:87
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
CscOverlay::overlay
std::vector< CscRawData * > overlay(const std::map< int, std::vector< uint16_t > > &sigSamples, const std::map< int, std::vector< uint16_t > > &ovlSamples, const uint32_t address, const uint16_t spuID, const uint16_t collId, const uint32_t hash, CLHEP::HepRandomEngine *rndmEngine) const
do the overlay - summing the ADC samples on one plane if there is overlap between zero bias data and ...
Definition: CscOverlay.cxx:532
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
CscOverlay::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Definition: CscOverlay.h:96
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:156
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CscOverlay::m_isDataOverlay
Gaudi::Property< bool > m_isDataOverlay
Definition: CscOverlay.h:91
CscRawData::setTime
void setTime(uint16_t time)
Definition: CscRawData.h:119
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
CscRawDataCollection::subDetectorId
uint16_t subDetectorId() const
Definition: CscRawDataCollection.h:113
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
CscRawDataCollection::rate
uint8_t rate() const
the rate could be 25 or 50 ns
Definition: CscRawDataCollection.cxx:24
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14