ATLAS Offline Software
Loading...
Searching...
No Matches
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
12
13//Base class header
15
16// Athena headers
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
44class SCT_ID;
46
47typedef std::unordered_map<int, std::unique_ptr<SiChargedDiodeCollection>> SiChargedDiodeCollectionMap;
48typedef std::pair<const int, std::unique_ptr<SiChargedDiodeCollection>> SiChargedDiodeCollectionIterator;
49
50namespace CLHEP
51{
52 class HepRandomEngine;
53}
54
55namespace ITk
56{
57
58class StripDigitizationTool : public extends<PileUpToolBase, IPileUpTool>
59{
60public:
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
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
86private:
87
91 StatusCode initServices();
95 StatusCode initFrontEndTool();
99 StatusCode initDisabledCells();
104
110 StatusCode createAndStoreRDO(SiChargedDiodeCollection* chDiodeCollection, SG::WriteHandle<SCT_RDO_Container>* rdoContainer) const;
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
160static const InterfaceID IID_IStripDigitizationTool("StripDigitizationTool", 1, 0);
161inline const InterfaceID& StripDigitizationTool::interfaceID() {
163}
164
165} // namespace ITk
166
167#endif // not STRIPDIGITIZATION_STRIPDIGITIZATIONTOOL_H
#define protected
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition IPileUpTool.h:22
the preferred mechanism to access information from the different event stores in a pileup job.
helper base class IPileUpTool::toProcess().
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Handle class for recording to StoreGate.
std::unordered_map< int, std::unique_ptr< SiChargedDiodeCollection > > SiChargedDiodeCollectionMap
std::pair< const int, std::unique_ptr< SiChargedDiodeCollection > > SiChargedDiodeCollectionIterator
SG::WriteHandleKey< SCT_RDO_Container > m_rdoContainerKey
static const InterfaceID & interfaceID()
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int) override final
Called before processing physics events.
SG::WriteHandle< InDetSimDataCollection > m_simDataCollMap
SDO Map handle.
bool digitizeElement(const EventContext &ctx, SiChargedDiodeCollectionMap &chargedDiodes, TimedHitCollection< SiHit > *&thpcsi, CLHEP::HepRandomEngine *rndmEngine)
ToolHandle< ISurfaceChargesGenerator > m_sct_SurfaceChargesGenerator
ToolHandle< IFrontEnd > m_sct_FrontEnd
std::unique_ptr< TimedHitCollection< SiHit > > m_thpcsi
StripDigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode initFrontEndTool()
Initialize the StripFrontEnd AlgTool.
const SCT_ID * m_detID
Handle to the ID helper.
void SetupRdoOutputType(Gaudi::Details::PropertyBase &)
Called when m_WriteSCT1_RawData is altered.
StatusCode getNextEvent(const EventContext &ctx)
std::vector< std::unique_ptr< SiHitCollection > > m_hitCollPtrs
StatusCode initServices()
initialize the required services
void applyProcessorTools(SiChargedDiodeCollection *chargedDiodes, CLHEP::HepRandomEngine *rndmEngine) const
ToolHandle< IRandomDisabledCellGenerator > m_sct_RandomDisabledCellGenerator
StatusCode createAndStoreRDO(SiChargedDiodeCollection *chDiodeCollection, SG::WriteHandle< SCT_RDO_Container > *rdoContainer) const
RDO and SDO methods.
void storeTool(ISiChargedDiodesProcessorTool *p_processor)
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
std::unique_ptr< SCT_RDO_Collection > createRDO(SiChargedDiodeCollection *collection) const
Create RDOs from the SiChargedDiodeCollection for the current wafer.
ServiceHandle< PileUpMergeSvc > m_mergeSvc
SG::WriteHandle< SCT_RDO_Container > m_rdoContainer
RDO container handle.
virtual StatusCode mergeEvent(const EventContext &ctx) override final
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
StatusCode initSurfaceChargesGeneratorTool()
Initialize the StripSurfaceChargesGenerator AlgTool.
std::vector< bool > m_processedElements
vector of processed elements - set by digitizeHits() *‍/
virtual StatusCode initialize() override final
std::vector< ISiChargedDiodesProcessorTool * > m_diodeCollectionTools
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_stripDetEleCollKey
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
SG::ReadHandleKey< SiHitCollection > m_hitsContainerKey
SG::WriteHandleKey< InDetSimDataCollection > m_simDataCollMapKey
void addSDO(SiChargedDiodeCollection *collection, SG::WriteHandle< InDetSimDataCollection > *simDataCollMap) const
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
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
StatusCode initDisabledCells()
Initialize the StripRandomDisabledCellGenerator AlgTool.
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition SiHit.h:19
static const InterfaceID IID_IStripDigitizationTool("StripDigitizationTool", 1, 0)
Forward declaration.