ATLAS Offline Software
SCT_DigitizationTool.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 SCT_DIGITZATION_SCT_DIGITZATIONTOOL_H
8 #define SCT_DIGITZATION_SCT_DIGITZATIONTOOL_H
9 
15 //Base class header
17 
18 // Athena headers
31 #include "StoreGate/WriteHandle.h"
33 
34 // Gaudi headers
35 #include "GaudiKernel/ServiceHandle.h"
36 #include "GaudiKernel/ToolHandle.h"
37 
38 // STL headers
39 #include <limits>
40 #include <memory>
41 #include <string>
42 
43 // Forward declarations
45 class SCT_ID;
47 
48 namespace CLHEP
49 {
50  class HepRandomEngine;
51 }
52 
53 class SCT_DigitizationTool : public extends<PileUpToolBase, IPileUpTool>
54 {
55 public:
56  static const InterfaceID& interfaceID();
57  SCT_DigitizationTool(const std::string& type,
58  const std::string& name,
59  const IInterface* parent);
64  virtual StatusCode prepareEvent(const EventContext& ctx, unsigned int) override final;
65  virtual StatusCode processBunchXing(int bunchXing,
66  SubEventIterator bSubEvents,
67  SubEventIterator eSubEvents) override final;
68  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
69 
70  virtual StatusCode initialize() override final;
71  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
72 
73 protected:
74 
75  bool digitizeElement(const EventContext& ctx, SiChargedDiodeCollection* chargedDiodes, TimedHitCollection<SiHit>*& thpcsi, CLHEP::HepRandomEngine * rndmEngine);
76  void applyProcessorTools(SiChargedDiodeCollection* chargedDiodes, CLHEP::HepRandomEngine * rndmEngine) const;
77  void addSDO(SiChargedDiodeCollection* collection, SG::WriteHandle<InDetSimDataCollection>* simDataCollMap) const;
78 
79  void storeTool(ISiChargedDiodesProcessorTool* p_processor) {m_diodeCollectionTools.push_back(p_processor);}
80 
81 private:
82 
99 
110  std::unique_ptr<SCT_RDO_Collection> createRDO(SiChargedDiodeCollection* collection) const;
111 
112  StatusCode getNextEvent(const EventContext& ctx);
113  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);
114  void digitizeNonHits(const EventContext& ctx, SG::WriteHandle<SCT_RDO_Container>* rdoContainer, SG::WriteHandle<InDetSimDataCollection>* simDataCollMap, const std::vector<bool>* processedElements, CLHEP::HepRandomEngine * rndmEngine) const;
115 
119  void SetupRdoOutputType(Gaudi::Details::PropertyBase&);
120 
121  FloatProperty m_tfix{this, "FixedTime", -999., "Fixed time for Cosmics run selection"};
122  BooleanProperty m_enableHits{this, "EnableHits", true, "Enable hits"};
123  BooleanProperty m_onlyHitElements{this, "OnlyHitElements", false, "Process only elements with hits"};
124  BooleanProperty m_cosmicsRun{this, "CosmicsRun", false, "Cosmics run selection"};
125  BooleanProperty m_barrelonly{this, "BarrelOnly", false, "Only Barrel layers"};
126  BooleanProperty m_randomDisabledCells{this, "RandomDisabledCells", false, "Use Random disabled cells, default no"};
127  BooleanProperty m_createNoiseSDO{this, "CreateNoiseSDO", false, "Create SDOs for strips with only noise hits (huge increase in SDO collection size"};
128  IntegerProperty m_HardScatterSplittingMode{this, "HardScatterSplittingMode", 0, "Control pileup & signal splitting. Process all SiHit or just those from signal or background events"};
129  BooleanProperty m_WriteSCT1_RawData{this, "WriteSCT1_RawData", false, "Write out SCT1_RawData rather than SCT3_RawData"};
130 
131  BooleanProperty m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."};
132  SG::ReadHandleKey<SiHitCollection> m_hitsContainerKey{this, "InputObjectName", "SCT_Hits", "Input HITS collection name"};
133  std::string m_inputObjectName{""};
134 
135  SG::WriteHandleKey<SCT_RDO_Container> m_rdoContainerKey{this, "OutputObjectName", "SCT_RDOs", "Output Object name"};
137  SG::WriteHandleKey<InDetSimDataCollection> m_simDataCollMapKey{this, "OutputSDOName", "SCT_SDO_Map", "Output SDO container name"};
139  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};
140 
141  ToolHandle<IFrontEnd> m_sct_FrontEnd{this, "FrontEnd", "SCT_FrontEnd", "Handle the Front End Electronic tool"};
142  ToolHandle<ISurfaceChargesGenerator> m_sct_SurfaceChargesGenerator{this, "SurfaceChargesGenerator", "SCT_SurfaceChargesGenerator", "Choice of using a more detailed charge drift model"};
143  ToolHandle<IRandomDisabledCellGenerator> m_sct_RandomDisabledCellGenerator{this, "RandomDisabledCellGenerator", "SCT_RandomDisabledCellGenerator", ""};
144  ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""};
145  ServiceHandle <PileUpMergeSvc> m_mergeSvc{this, "MergeSvc", "PileUpMergeSvc", "Merge service used in Pixel & SCT digitization"};
146 
147  const SCT_ID* m_detID{nullptr};
148  std::unique_ptr<TimedHitCollection<SiHit>> m_thpcsi{nullptr};
149  std::vector<ISiChargedDiodesProcessorTool*> m_diodeCollectionTools;
150  std::vector<bool> m_processedElements;
151  std::vector<std::unique_ptr<SiHitCollection>> m_hitCollPtrs;
153 };
154 
155 static const InterfaceID IID_ISCT_DigitizationTool("SCT_DigitizationTool", 1, 0);
156 inline const InterfaceID& SCT_DigitizationTool::interfaceID() {
157  return IID_ISCT_DigitizationTool;
158 }
159 
160 #endif // SCT_DIGITZATION_SCT_DIGITZATIONTOOL_H
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
SCT_DigitizationTool::m_thpcsi
std::unique_ptr< TimedHitCollection< SiHit > > m_thpcsi
Definition: SCT_DigitizationTool.h:148
SCT_DigitizationTool::m_sct_RandomDisabledCellGenerator
ToolHandle< IRandomDisabledCellGenerator > m_sct_RandomDisabledCellGenerator
Definition: SCT_DigitizationTool.h:143
SCT_DigitizationTool::createAndStoreRDO
StatusCode createAndStoreRDO(SiChargedDiodeCollection *chDiodeCollection, SG::WriteHandle< SCT_RDO_Container > *rdoContainer) const
RDO and SDO methods.
Definition: SCT_DigitizationTool.cxx:527
SCT_DigitizationTool::m_processedElements
std::vector< bool > m_processedElements
vector of processed elements - set by digitizeHits() *‍/
Definition: SCT_DigitizationTool.h:150
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SCT_DigitizationTool
Definition: SCT_DigitizationTool.h:54
SCT_DigitizationTool::SCT_DigitizationTool
SCT_DigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SCT_DigitizationTool.cxx:39
SCT_DigitizationTool::m_hitCollPtrs
std::vector< std::unique_ptr< SiHitCollection > > m_hitCollPtrs
Definition: SCT_DigitizationTool.h:151
SCT_DigitizationTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int) override final
Called before processing physics events.
Definition: SCT_DigitizationTool.cxx:215
SCT_DigitizationTool::getNextEvent
StatusCode getNextEvent(const EventContext &ctx)
Definition: SCT_DigitizationTool.cxx:700
SCT_DigitizationTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
Definition: SCT_DigitizationTool.cxx:237
SCT_DigitizationTool::m_HardScatterSplittingMode
IntegerProperty m_HardScatterSplittingMode
Definition: SCT_DigitizationTool.h:128
SCT_DigitizationTool::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: SCT_DigitizationTool.cxx:261
SCT_DigitizationTool::m_barrelonly
BooleanProperty m_barrelonly
Definition: SCT_DigitizationTool.h:125
InDetSimDataCollection
Definition: InDetSimDataCollection.h:25
SCT_DigitizationTool::m_rdoContainerKey
SG::WriteHandleKey< SCT_RDO_Container > m_rdoContainerKey
Definition: SCT_DigitizationTool.h:135
SCT_DigitizationTool::m_onlyUseContainerName
BooleanProperty m_onlyUseContainerName
Definition: SCT_DigitizationTool.h:131
SCT_DigitizationTool::m_onlyHitElements
BooleanProperty m_onlyHitElements
Definition: SCT_DigitizationTool.h:123
SCT_DigitizationTool::m_createNoiseSDO
BooleanProperty m_createNoiseSDO
Definition: SCT_DigitizationTool.h:127
SCT_DigitizationTool::applyProcessorTools
void applyProcessorTools(SiChargedDiodeCollection *chargedDiodes, CLHEP::HepRandomEngine *rndmEngine) const
Definition: SCT_DigitizationTool.cxx:428
SCT_DigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
Definition: SCT_DigitizationTool.h:144
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
SCT_DigitizationTool::initServices
StatusCode initServices()
initialize the required services
Definition: SCT_DigitizationTool.cxx:157
SCT_DigitizationTool::addSDO
void addSDO(SiChargedDiodeCollection *collection, SG::WriteHandle< InDetSimDataCollection > *simDataCollMap) const
Definition: SCT_DigitizationTool.cxx:757
ISurfaceChargesGenerator.h
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
ISiChargedDiodesProcessorTool
Definition: ISiChargedDiodesProcessorTool.h:26
SCT_DigitizationTool::initSurfaceChargesGeneratorTool
StatusCode initSurfaceChargesGeneratorTool()
Initialize the SCT_SurfaceChargesGenerator AlgTool.
Definition: SCT_DigitizationTool.cxx:129
SiHit
Definition: SiHit.h:19
SCT_DigitizationTool::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: SCT_DigitizationTool.h:139
SCT_DigitizationTool::createRDO
std::unique_ptr< SCT_RDO_Collection > createRDO(SiChargedDiodeCollection *collection) const
Create RDOs from the SiChargedDiodeCollection for the current wafer.
Definition: SCT_DigitizationTool.cxx:551
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
SCT_DigitizationTool::m_hitsContainerKey
SG::ReadHandleKey< SiHitCollection > m_hitsContainerKey
Definition: SCT_DigitizationTool.h:132
SiChargedDiodeCollection
Definition: SiChargedDiodeCollection.h:109
SCT_DigitizationTool::m_simDataCollMapKey
SG::WriteHandleKey< InDetSimDataCollection > m_simDataCollMapKey
Definition: SCT_DigitizationTool.h:137
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SCT_DigitizationTool::m_enableHits
BooleanProperty m_enableHits
Definition: SCT_DigitizationTool.h:122
SCT_DigitizationTool::SetupRdoOutputType
void SetupRdoOutputType(Gaudi::Details::PropertyBase &)
Called when m_WriteSCT1_RawData is altered.
Definition: SCT_DigitizationTool.cxx:490
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
SCT_DigitizationTool::m_randomDisabledCells
BooleanProperty m_randomDisabledCells
Definition: SCT_DigitizationTool.h:126
SCT_DigitizationTool::m_diodeCollectionTools
std::vector< ISiChargedDiodesProcessorTool * > m_diodeCollectionTools
Definition: SCT_DigitizationTool.h:149
SCT_DigitizationTool::m_HardScatterSplittingSkipper
bool m_HardScatterSplittingSkipper
Definition: SCT_DigitizationTool.h:152
IRandomDisabledCellGenerator.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TimedHitCollection.h
SCT_DigitizationTool::m_sct_FrontEnd
ToolHandle< IFrontEnd > m_sct_FrontEnd
Definition: SCT_DigitizationTool.h:141
ReadCondHandleKey.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
SCT_DigitizationTool::storeTool
void storeTool(ISiChargedDiodesProcessorTool *p_processor)
Definition: SCT_DigitizationTool.h:79
SCT_DigitizationTool::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: SCT_DigitizationTool.cxx:311
SCT_DigitizationTool::initFrontEndTool
StatusCode initFrontEndTool()
Initialize the SCT_FrontEnd AlgTool.
Definition: SCT_DigitizationTool.cxx:145
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_DigitizationTool::m_WriteSCT1_RawData
BooleanProperty m_WriteSCT1_RawData
Definition: SCT_DigitizationTool.h:129
SiDetectorElementCollection.h
SCT_DigitizationTool::m_simDataCollMap
SG::WriteHandle< InDetSimDataCollection > m_simDataCollMap
SDO Map handle.
Definition: SCT_DigitizationTool.h:138
SCT_DigitizationTool::m_rdoContainer
SG::WriteHandle< SCT_RDO_Container > m_rdoContainer
RDO container handle.
Definition: SCT_DigitizationTool.h:136
SCT_DigitizationTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Definition: SCT_DigitizationTool.cxx:183
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection >
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SCT_DigitizationTool::initDisabledCells
StatusCode initDisabledCells()
Initialize the SCT_RandomDisabledCellGenerator AlgTool.
Definition: SCT_DigitizationTool.cxx:173
SCT_DigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: SCT_DigitizationTool.h:145
SCT_ID
Definition: SCT_ID.h:68
SCT_DigitizationTool::m_sct_SurfaceChargesGenerator
ToolHandle< ISurfaceChargesGenerator > m_sct_SurfaceChargesGenerator
Definition: SCT_DigitizationTool.h:142
IFrontEnd.h
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
SCT_DigitizationTool::digitizeElement
bool digitizeElement(const EventContext &ctx, SiChargedDiodeCollection *chargedDiodes, TimedHitCollection< SiHit > *&thpcsi, CLHEP::HepRandomEngine *rndmEngine)
Definition: SCT_DigitizationTool.cxx:359
InDetSimDataCollection.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_DigitizationTool::m_detID
const SCT_ID * m_detID
Handle to the ID helper.
Definition: SCT_DigitizationTool.h:147
SCT_DigitizationTool::interfaceID
static const InterfaceID & interfaceID()
Definition: SCT_DigitizationTool.h:156
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
SCT_DigitizationTool::m_inputObjectName
std::string m_inputObjectName
Definition: SCT_DigitizationTool.h:133
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
SCT_DigitizationTool::initialize
virtual StatusCode initialize() override final
Definition: SCT_DigitizationTool.cxx:51
TimedHitCollection
Definition: TimedHitCollection.h:15
SCT_DigitizationTool::~SCT_DigitizationTool
virtual ~SCT_DigitizationTool()
SCT_DigitizationTool::m_cosmicsRun
BooleanProperty m_cosmicsRun
Definition: SCT_DigitizationTool.h:124
SCT_DigitizationTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
Definition: SCT_DigitizationTool.cxx:440
SCT_DigitizationTool::m_tfix
FloatProperty m_tfix
Definition: SCT_DigitizationTool.h:121
IAthRNGSvc.h
ServiceHandle< IAthRNGSvc >
SiHitCollection.h