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, V, H > &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, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &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 41 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 28 of file CscOverlay.cxx.

28  :
29  AthReentrantAlgorithm(name, pSvcLocator) {
30 }

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality
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 75 of file AthCommonReentrantAlgorithm.cxx.

64 {
65  return 0;
66 }

◆ copyCollection()

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

Copy CscRawDataCollection, optionally only copy properties.

Definition at line 226 of file CscOverlay.cxx.

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

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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 54 of file CscOverlay.cxx.

54  {
55  ATH_MSG_DEBUG("execute() begin");
56 
57 
59  if(!bkgContainer.isValid()) {
60  ATH_MSG_ERROR("Could not get background CscRawDataContainer called " << bkgContainer.name() << " from store " << bkgContainer.store());
61  return StatusCode::FAILURE;
62  }
63  ATH_MSG_DEBUG("Found background CscRawDataContainer called " << bkgContainer.name() << " in store " << bkgContainer.store());
64 
66  if(!signalContainer.isValid()) {
67  ATH_MSG_ERROR("Could not get signal CscRawOverlayContainer called " << signalContainer.name() << " from store " << signalContainer.store());
68  return StatusCode::FAILURE;
69  }
70  ATH_MSG_DEBUG("Found signal CscRawOverlayContainer called " << signalContainer.name() << " in store " << signalContainer.store());
71 
73  ATH_CHECK(outputContainer.record(std::make_unique<CscRawDataContainer>(bkgContainer->size())));
74  if (!outputContainer.isValid()) {
75  ATH_MSG_ERROR("Could not record output CscRawOverlayContainer called " << outputContainer.name() << " to store " << outputContainer.store());
76  return StatusCode::FAILURE;
77  }
78  ATH_MSG_DEBUG("Recorded output CscRawOverlayContainer called " << outputContainer.name() << " in store " << outputContainer.store());
79 
80  // now do the overlay
81  ATH_CHECK(overlayContainer(bkgContainer.cptr(), signalContainer.cptr(), outputContainer.ptr()));
82 
83 
84  ATH_MSG_DEBUG("execute() end");
85  return StatusCode::SUCCESS;
86 }

◆ 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 & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90 {
91  // If we didn't find any symlinks to add, just return the collection
92  // from the base class. Otherwise, return the extended collection.
93  if (!m_extendedExtraObjects.empty()) {
95  }
96  return BaseAlg::extraOutputDeps();
97 }

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96  {
97  return execState( ctx ).filterPassed();
98  }

◆ initialize()

StatusCode CscOverlay::initialize ( )
finaloverridevirtual

CSC calibratin tool for the Condtiions Data base access

Definition at line 33 of file CscOverlay.cxx.

33  {
34  ATH_MSG_DEBUG("CscOverlay initialized");
35  ATH_CHECK(m_idHelperSvc.retrieve());
36 
38  ATH_CHECK(m_cscCalibTool.retrieve());
39 
40  // get cscRdoDecoderTool
41  ATH_CHECK(m_cscRdoDecoderTool.retrieve());
42 
43  //random number initialization
44  ATH_CHECK(m_rndmSvc.retrieve());
45 
49 
50  return StatusCode::SUCCESS;
51 }

◆ 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 AthCommonReentrantAlgorithm< Gaudi::Algorithm >::isClonable
overridevirtualinherited

Specify if the algorithm is clonable.

Reentrant algorithms are clonable.

Definition at line 68 of file AthCommonReentrantAlgorithm.cxx.

52 {
53  // Reentrant algorithms are clonable.
54  return true;
55 }

◆ 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 281 of file CscOverlay.cxx.

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

◆ 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 269 of file CscOverlay.cxx.

270 {
271  int measuresPhi = ( (address & 0x00000100) >> 8);
272  if (address<2147483640 && measuresPhi) {
273  int stationEta = ( ((address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1;
274  if (stationEta>0) { return true; }
275  }
276  return false;
277 }

◆ 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 538 of file CscOverlay.cxx.

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

◆ 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 89 of file CscOverlay.cxx.

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

◆ 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 AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100  {
101  execState( ctx ).setFilterPassed( state );
102  }

◆ 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 258 of file CscOverlay.cxx.

259 {
260  data.clear(); if ( !coll ) return;
263  for ( ; idata != edata; ++idata ) {
264  if ( (*idata)->rpuID() == spuID ) data.push_back( *idata );
265  }
266  ATH_MSG_DEBUG("spuData(): made data vector of size "<<data.size()<<" for SPU "<<spuID);
267 }

◆ 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 441 of file CscOverlay.cxx.

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

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::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 85 of file AthCommonReentrantAlgorithm.cxx.

77 {
78  return BaseAlg::sysExecute (ctx);
79 }

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::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 61 of file AthCommonReentrantAlgorithm.cxx.

107  {
109 
110  if (sc.isFailure()) {
111  return sc;
112  }
113 
114  ServiceHandle<ICondSvc> cs("CondSvc",name());
115  for (auto h : outputHandles()) {
116  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117  // do this inside the loop so we don't create the CondSvc until needed
118  if ( cs.retrieve().isFailure() ) {
119  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120  return StatusCode::SUCCESS;
121  }
122  if (cs->regHandle(this,*h).isFailure()) {
123  sc = StatusCode::FAILURE;
124  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125  << " with CondSvc");
126  }
127  }
128  }
129  return sc;
130 }

◆ 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 96 of file CscOverlay.h.

◆ m_cscCalibTool

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

Definition at line 102 of file CscOverlay.h.

◆ m_cscRdoDecoderTool

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

Definition at line 103 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 AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

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

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_idHelperSvc

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

Definition at line 101 of file CscOverlay.h.

◆ m_isDataOverlay

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

Definition at line 100 of file CscOverlay.h.

◆ m_outputKey

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

Definition at line 98 of file CscOverlay.h.

◆ m_rndmSvc

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

Definition at line 105 of file CscOverlay.h.

◆ m_signalInputKey

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

Definition at line 97 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:161
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
CscRawData::address
uint32_t address() const
Definition: CscRawData.h:131
SiliconTech::strip
@ strip
CscRawDataCollection::identify
uint16_t identify() const
access methods
Definition: CscRawDataCollection.h:107
CscOverlay::m_outputKey
SG::WriteHandleKey< CscRawDataContainer > m_outputKey
Definition: CscOverlay.h:98
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
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:298
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:281
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
gridSubmitIDTPM.check
check
Definition: gridSubmitIDTPM.py:45
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
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:258
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:103
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
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
AthCommonReentrantAlgorithm::extraOutputDeps
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
Definition: AthCommonReentrantAlgorithm.cxx:89
CscRawDataCollection::triggerType
bool triggerType() const
Definition: CscRawDataCollection.h:118
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
IdentifiableContainerMT::numberOfCollections
virtual size_t numberOfCollections() const override final
return number of collections
Definition: IdentifiableContainerMT.h:214
AthCommonDataStore
Definition: AthCommonDataStore.h:52
CscOverlay::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CscOverlay.h:101
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:93
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:97
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
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CscRawDataCollection::scaAddress
uint32_t scaAddress() const
Definition: CscRawDataCollection.h:123
AthCommonReentrantAlgorithm::sysExecute
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
Definition: AthCommonReentrantAlgorithm.cxx:76
python.BuildSignatureFlags.sig
sig
Definition: BuildSignatureFlags.py:237
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:89
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:226
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:121
CscRawDataCollection
Collection of CSC Raw Hits, arranged according to CSC Detector Elements Author: Ketevi A.
Definition: CscRawDataCollection.h:24
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:240
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
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:441
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
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:269
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:290
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
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:108
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CscOverlay::m_cscCalibTool
ToolHandle< ICscCalibTool > m_cscCalibTool
Definition: CscOverlay.h:102
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
IdentifiableContainerMT::GetAllHashPtrPair
const std::vector< EventContainers::hashPair< T > > & GetAllHashPtrPair() const
Definition: IdentifiableContainerMT.h:218
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthCommonReentrantAlgorithm.cxx:107
CscOverlay::m_bkgInputKey
SG::ReadHandleKey< CscRawDataContainer > m_bkgInputKey
Definition: CscOverlay.h:96
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
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:538
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
CscOverlay::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Definition: CscOverlay.h:105
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:159
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:100
CscRawData::setTime
void setTime(uint16_t time)
Definition: CscRawData.h:119
AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthCommonReentrantAlgorithm.h:114
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
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