ATLAS Offline Software
StripDigitizationTool.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef STRIPDIGITIZATION_STRIPDIGITIZATIONTOOL_H
8 #define STRIPDIGITIZATION_STRIPDIGITIZATIONTOOL_H
9 
13 //Base class header
15 
16 // Athena headers
29 #include "StoreGate/WriteHandle.h"
31 
32 // Gaudi headers
33 #include "GaudiKernel/ServiceHandle.h"
34 #include "GaudiKernel/ToolHandle.h"
35 
36 // STL headers
37 #include <limits>
38 #include <memory>
39 #include <string>
40 
41 
42 // Forward declarations
44 class SCT_ID;
46 
47 typedef std::unordered_map<int, std::unique_ptr<SiChargedDiodeCollection>> SiChargedDiodeCollectionMap;
48 typedef std::pair<const int, std::unique_ptr<SiChargedDiodeCollection>> SiChargedDiodeCollectionIterator;
49 
50 namespace CLHEP
51 {
52  class HepRandomEngine;
53 }
54 
55 namespace ITk
56 {
57 
58 class StripDigitizationTool : public extends<PileUpToolBase, IPileUpTool>
59 {
60 public:
61  static const InterfaceID& interfaceID();
62  StripDigitizationTool(const std::string& type,
63  const std::string& name,
64  const IInterface* parent);
69  virtual StatusCode prepareEvent(const EventContext& ctx, unsigned int) override final;
70  virtual StatusCode processBunchXing(int bunchXing,
71  SubEventIterator bSubEvents,
72  SubEventIterator eSubEvents) override final;
73  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
74 
75  virtual StatusCode initialize() override final;
76  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
77 
78 protected:
79 
80  bool digitizeElement(const EventContext& ctx, SiChargedDiodeCollectionMap& chargedDiodes, TimedHitCollection<SiHit>*& thpcsi, CLHEP::HepRandomEngine * rndmEngine);
81  void applyProcessorTools(SiChargedDiodeCollection* chargedDiodes, CLHEP::HepRandomEngine * rndmEngine) const;
82  void addSDO(SiChargedDiodeCollection* collection, SG::WriteHandle<InDetSimDataCollection>* simDataCollMap) const;
83 
84  void storeTool(ISiChargedDiodesProcessorTool* p_processor) {m_diodeCollectionTools.push_back(p_processor);}
85 
86 private:
87 
104 
115  std::unique_ptr<SCT_RDO_Collection> createRDO(SiChargedDiodeCollection* collection) const;
116 
117  StatusCode getNextEvent(const EventContext& ctx);
118  void digitizeAllHits(const EventContext& ctx, SG::WriteHandle<SCT_RDO_Container>* rdoContainer, SG::WriteHandle<InDetSimDataCollection>* simDataCollMap, std::vector<bool>* processedElements, TimedHitCollection<SiHit>* thpcsi, CLHEP::HepRandomEngine * rndmEngine);
119  void digitizeNonHits(const EventContext& ctx, SG::WriteHandle<SCT_RDO_Container>* rdoContainer, SG::WriteHandle<InDetSimDataCollection>* simDataCollMap, const std::vector<bool>* processedElements, CLHEP::HepRandomEngine * rndmEngine) const;
120 
124  void SetupRdoOutputType(Gaudi::Details::PropertyBase&);
125 
126  FloatProperty m_tfix{this, "FixedTime", -999., "Fixed time for Cosmics run selection"};
127  BooleanProperty m_enableHits{this, "EnableHits", true, "Enable hits"};
128  BooleanProperty m_onlyHitElements{this, "OnlyHitElements", false, "Process only elements with hits"};
129  BooleanProperty m_cosmicsRun{this, "CosmicsRun", false, "Cosmics run selection"};
130  BooleanProperty m_barrelonly{this, "BarrelOnly", false, "Only Barrel layers"};
131  BooleanProperty m_randomDisabledCells{this, "RandomDisabledCells", false, "Use Random disabled cells, default no"};
132  BooleanProperty m_createNoiseSDO{this, "CreateNoiseSDO", false, "Create SDOs for strips with only noise hits (huge increase in SDO collection size"};
133  IntegerProperty m_HardScatterSplittingMode{this, "HardScatterSplittingMode", 0, "Control pileup & signal splitting. Process all SiHit or just those from signal or background events"};
134  BooleanProperty m_WriteSCT1_RawData{this, "WriteSCT1_RawData", false, "Write out SCT1_RawData rather than SCT3_RawData"};
135 
136  BooleanProperty m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."};
137  SG::ReadHandleKey<SiHitCollection> m_hitsContainerKey{this, "InputObjectName", "StripHits", "Input HITS collection name"};
138  std::string m_inputObjectName{""};
139 
140  SG::WriteHandleKey<SCT_RDO_Container> m_rdoContainerKey{this, "OutputObjectName", "SCT_RDOs", "Output Object name"};
142  SG::WriteHandleKey<InDetSimDataCollection> m_simDataCollMapKey{this, "OutputSDOName", "StripSDO_Map", "Output SDO container name"};
144  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_stripDetEleCollKey{this, "StripDetEleCollKey", "ITkStripDetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};
145 
146  ToolHandle<IFrontEnd> m_sct_FrontEnd{this, "FrontEnd", "StripFrontEnd", "Handle the Front End Electronic tool"};
147  ToolHandle<ISurfaceChargesGenerator> m_sct_SurfaceChargesGenerator{this, "SurfaceChargesGenerator", "StripSurfaceChargesGenerator", "Choice of using a more detailed charge drift model"};
148  ToolHandle<IRandomDisabledCellGenerator> m_sct_RandomDisabledCellGenerator{this, "RandomDisabledCellGenerator", "StripRandomDisabledCellGenerator", ""};
149  ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""};
150  ServiceHandle <PileUpMergeSvc> m_mergeSvc{this, "MergeSvc", "PileUpMergeSvc", "Merge service used in Pixel & SCT digitization"};
151 
152  const SCT_ID* m_detID{nullptr};
153  std::unique_ptr<TimedHitCollection<SiHit>> m_thpcsi{nullptr};
154  std::vector<ISiChargedDiodesProcessorTool*> m_diodeCollectionTools;
155  std::vector<bool> m_processedElements;
156  std::vector<std::unique_ptr<SiHitCollection>> m_hitCollPtrs;
158 };
159 
160 static const InterfaceID IID_IStripDigitizationTool("StripDigitizationTool", 1, 0);
161 inline const InterfaceID& StripDigitizationTool::interfaceID() {
162  return IID_IStripDigitizationTool;
163 }
164 
165 } // namespace ITk
166 
167 #endif // not STRIPDIGITIZATION_STRIPDIGITIZATIONTOOL_H
ITk::StripDigitizationTool::initialize
virtual StatusCode initialize() override final
Definition: StripDigitizationTool.cxx:56
ITk::StripDigitizationTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
Definition: StripDigitizationTool.cxx:273
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
ITk::StripDigitizationTool::m_sct_RandomDisabledCellGenerator
ToolHandle< IRandomDisabledCellGenerator > m_sct_RandomDisabledCellGenerator
Definition: StripDigitizationTool.h:148
ITk::StripDigitizationTool::createAndStoreRDO
StatusCode createAndStoreRDO(SiChargedDiodeCollection *chDiodeCollection, SG::WriteHandle< SCT_RDO_Container > *rdoContainer) const
RDO and SDO methods.
Definition: StripDigitizationTool.cxx:641
ITk::StripDigitizationTool::m_detID
const SCT_ID * m_detID
Handle to the ID helper.
Definition: StripDigitizationTool.h:152
ITk::StripDigitizationTool::initFrontEndTool
StatusCode initFrontEndTool()
Initialize the StripFrontEnd AlgTool.
Definition: StripDigitizationTool.cxx:181
ITk::StripDigitizationTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
Definition: StripDigitizationTool.cxx:554
ITk::StripDigitizationTool::m_WriteSCT1_RawData
BooleanProperty m_WriteSCT1_RawData
Definition: StripDigitizationTool.h:134
ITk::StripDigitizationTool::initDisabledCells
StatusCode initDisabledCells()
Initialize the StripRandomDisabledCellGenerator AlgTool.
Definition: StripDigitizationTool.cxx:209
ITk::StripDigitizationTool::m_thpcsi
std::unique_ptr< TimedHitCollection< SiHit > > m_thpcsi
Definition: StripDigitizationTool.h:153
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
ITk::StripDigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: StripDigitizationTool.h:150
ITk::StripDigitizationTool::digitizeNonHits
void digitizeNonHits(const EventContext &ctx, SG::WriteHandle< SCT_RDO_Container > *rdoContainer, SG::WriteHandle< InDetSimDataCollection > *simDataCollMap, const std::vector< bool > *processedElements, CLHEP::HepRandomEngine *rndmEngine) const
digitize SCT without hits
Definition: StripDigitizationTool.cxx:355
ITk::StripDigitizationTool::m_simDataCollMapKey
SG::WriteHandleKey< InDetSimDataCollection > m_simDataCollMapKey
Definition: StripDigitizationTool.h:142
ITk::StripDigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
Definition: StripDigitizationTool.h:149
ITk::StripDigitizationTool
Definition: StripDigitizationTool.h:59
InDetSimDataCollection
Definition: InDetSimDataCollection.h:25
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
ITk::StripDigitizationTool::m_HardScatterSplittingSkipper
bool m_HardScatterSplittingSkipper
Definition: StripDigitizationTool.h:157
ITk::StripDigitizationTool::StripDigitizationTool
StripDigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: StripDigitizationTool.cxx:44
ISurfaceChargesGenerator.h
ITk::StripDigitizationTool::m_processedElements
std::vector< bool > m_processedElements
vector of processed elements - set by digitizeHits() *‍/
Definition: StripDigitizationTool.h:155
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
ITk::StripDigitizationTool::m_sct_SurfaceChargesGenerator
ToolHandle< ISurfaceChargesGenerator > m_sct_SurfaceChargesGenerator
Definition: StripDigitizationTool.h:147
ISiChargedDiodesProcessorTool
Definition: ISiChargedDiodesProcessorTool.h:26
ITk::StripDigitizationTool::m_simDataCollMap
SG::WriteHandle< InDetSimDataCollection > m_simDataCollMap
SDO Map handle.
Definition: StripDigitizationTool.h:143
ITk::StripDigitizationTool::m_rdoContainer
SG::WriteHandle< SCT_RDO_Container > m_rdoContainer
RDO container handle.
Definition: StripDigitizationTool.h:141
SiHit
Definition: SiHit.h:19
ITk::StripDigitizationTool::addSDO
void addSDO(SiChargedDiodeCollection *collection, SG::WriteHandle< InDetSimDataCollection > *simDataCollMap) const
Definition: StripDigitizationTool.cxx:871
ITk::StripDigitizationTool::digitizeAllHits
void digitizeAllHits(const EventContext &ctx, SG::WriteHandle< SCT_RDO_Container > *rdoContainer, SG::WriteHandle< InDetSimDataCollection > *simDataCollMap, std::vector< bool > *processedElements, TimedHitCollection< SiHit > *thpcsi, CLHEP::HepRandomEngine *rndmEngine)
digitize all hits
Definition: StripDigitizationTool.cxx:297
WriteHandle.h
Handle class for recording to StoreGate.
SCT_RDO_Container.h
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
SiChargedDiodeCollection
Definition: SiChargedDiodeCollection.h:109
ITk::StripDigitizationTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Definition: StripDigitizationTool.cxx:219
ITk::StripDigitizationTool::interfaceID
static const InterfaceID & interfaceID()
Definition: StripDigitizationTool.h:161
ITk::StripDigitizationTool::applyProcessorTools
void applyProcessorTools(SiChargedDiodeCollection *chargedDiodes, CLHEP::HepRandomEngine *rndmEngine) const
Definition: StripDigitizationTool.cxx:542
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ITk::StripDigitizationTool::m_hitsContainerKey
SG::ReadHandleKey< SiHitCollection > m_hitsContainerKey
Definition: StripDigitizationTool.h:137
ITk::StripDigitizationTool::SetupRdoOutputType
void SetupRdoOutputType(Gaudi::Details::PropertyBase &)
Called when m_WriteSCT1_RawData is altered.
Definition: StripDigitizationTool.cxx:604
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
ITk::StripDigitizationTool::m_onlyUseContainerName
BooleanProperty m_onlyUseContainerName
Definition: StripDigitizationTool.h:136
ITk::StripDigitizationTool::m_onlyHitElements
BooleanProperty m_onlyHitElements
Definition: StripDigitizationTool.h:128
IRandomDisabledCellGenerator.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TimedHitCollection.h
ITk::StripDigitizationTool::~StripDigitizationTool
virtual ~StripDigitizationTool()
ITk::StripDigitizationTool::digitizeElement
bool digitizeElement(const EventContext &ctx, SiChargedDiodeCollectionMap &chargedDiodes, TimedHitCollection< SiHit > *&thpcsi, CLHEP::HepRandomEngine *rndmEngine)
Definition: StripDigitizationTool.cxx:403
SiChargedDiodeCollectionMap
std::unordered_map< int, std::unique_ptr< SiChargedDiodeCollection > > SiChargedDiodeCollectionMap
Definition: StripDigitizationTool.h:45
ITk::StripDigitizationTool::m_sct_FrontEnd
ToolHandle< IFrontEnd > m_sct_FrontEnd
Definition: StripDigitizationTool.h:146
ReadCondHandleKey.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
ITk
Definition: ITkPixelOfflineCalibCondAlg.cxx:14
ITk::StripDigitizationTool::m_HardScatterSplittingMode
IntegerProperty m_HardScatterSplittingMode
Definition: StripDigitizationTool.h:133
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ITk::StripDigitizationTool::m_rdoContainerKey
SG::WriteHandleKey< SCT_RDO_Container > m_rdoContainerKey
Definition: StripDigitizationTool.h:140
ITk::StripDigitizationTool::m_cosmicsRun
BooleanProperty m_cosmicsRun
Definition: StripDigitizationTool.h:129
SiDetectorElementCollection.h
ITk::StripDigitizationTool::m_barrelonly
BooleanProperty m_barrelonly
Definition: StripDigitizationTool.h:130
ITk::StripDigitizationTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int) override final
Called before processing physics events.
Definition: StripDigitizationTool.cxx:251
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection >
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ITk::StripDigitizationTool::getNextEvent
StatusCode getNextEvent(const EventContext &ctx)
Definition: StripDigitizationTool.cxx:814
ITk::StripDigitizationTool::m_hitCollPtrs
std::vector< std::unique_ptr< SiHitCollection > > m_hitCollPtrs
Definition: StripDigitizationTool.h:156
SCT_ID
Definition: SCT_ID.h:68
IFrontEnd.h
ITk::StripDigitizationTool::m_inputObjectName
std::string m_inputObjectName
Definition: StripDigitizationTool.h:138
ITk::StripDigitizationTool::initSurfaceChargesGeneratorTool
StatusCode initSurfaceChargesGeneratorTool()
Initialize the StripSurfaceChargesGenerator AlgTool.
Definition: StripDigitizationTool.cxx:165
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
InDetSimDataCollection.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ITk::StripDigitizationTool::m_diodeCollectionTools
std::vector< ISiChargedDiodesProcessorTool * > m_diodeCollectionTools
Definition: StripDigitizationTool.h:154
ITk::StripDigitizationTool::storeTool
void storeTool(ISiChargedDiodesProcessorTool *p_processor)
Definition: StripDigitizationTool.h:84
SiChargedDiodeCollectionIterator
std::pair< const int, std::unique_ptr< SiChargedDiodeCollection > > SiChargedDiodeCollectionIterator
Definition: StripDigitizationTool.h:48
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
ITk::StripDigitizationTool::m_tfix
FloatProperty m_tfix
Definition: StripDigitizationTool.h:126
ITk::StripDigitizationTool::initServices
StatusCode initServices()
initialize the required services
Definition: StripDigitizationTool.cxx:193
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
ITk::StripDigitizationTool::m_randomDisabledCells
BooleanProperty m_randomDisabledCells
Definition: StripDigitizationTool.h:131
ITk::StripDigitizationTool::createRDO
std::unique_ptr< SCT_RDO_Collection > createRDO(SiChargedDiodeCollection *collection) const
Create RDOs from the SiChargedDiodeCollection for the current wafer.
Definition: StripDigitizationTool.cxx:665
ITk::StripDigitizationTool::m_createNoiseSDO
BooleanProperty m_createNoiseSDO
Definition: StripDigitizationTool.h:132
TimedHitCollection
Definition: TimedHitCollection.h:15
ITk::StripDigitizationTool::m_enableHits
BooleanProperty m_enableHits
Definition: StripDigitizationTool.h:127
ITk::StripDigitizationTool::m_stripDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_stripDetEleCollKey
Definition: StripDigitizationTool.h:144
IAthRNGSvc.h
ServiceHandle< IAthRNGSvc >
SiHitCollection.h