ATLAS Offline Software
CscDigitizationTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H
6 #define MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H
7 
8 #include <memory>
9 
11 
12 #include "GaudiKernel/ServiceHandle.h"
13 #include "GaudiKernel/ToolHandle.h"
15 #include "CLHEP/Random/RandomEngine.h"
18 #include "MuonSimEvent/CSCSimHit.h"
26 
27 #include "CSC_Digitizer.h"
28 
29 // Author: Ketevi A. Assamagan
30 // BNL, October 27, 2003
31 
32 // Digitization algorithm for the CSC:
33 // get the hit container from Storegate
34 // loop over the hits
35 // digitize each hit
36 // loop over the digit and build the digit container
37 // store the digits in StoreGate
38 
40 
41  typedef std::vector<CscSimData::Deposit> deposits;
42  typedef std::map<IdentifierHash,std::pair<double,double> > csc_map;
43  typedef std::map<IdentifierHash,std::vector<float> > csc_newmap;
44 
45 
46 public:
47 
48  CscDigitizationTool(const std::string& type, const std::string& name, const IInterface* pIID);
49 
50  ~CscDigitizationTool() = default;
51 
52  virtual StatusCode initialize() override final;
53 
54  // PileUpTool methods...
56  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
57 
60  int bunchXing,
61  SubEventIterator bSubEvents,
62  SubEventIterator eSubEvents
63  ) override final;
64 
67  // virtual bool toProcess(int bunchXing) const;
68  virtual StatusCode prepareEvent(const EventContext& ctx, unsigned int /*nInputEvents*/) override final;
69 
72  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
73 
74 private:
75  using Collections_t = std::vector<std::unique_ptr<CscDigitCollection> >;
76  StatusCode FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, //csc_newmap& data_SampleMapOddPhase,
77  std::map<IdentifierHash,deposits>& myDeposits,bool phaseToSet,
78  Collections_t& collections,
79  CscSimDataCollection* cscSimData);
81  Collections_t& collections,
82  CscSimDataCollection* cscSimData);
83 
84  StatusCode CoreDigitization(Collections_t& collections,CscSimDataCollection* cscSimData, CLHEP::HepRandomEngine* rndmEngine, const EventContext& ctx);
85 
86  // Get next event and extract collection of hit collections:
87  StatusCode getNextEvent(const EventContext& ctx);
88 
89  ToolHandle<ICscCalibTool> m_pcalib{this, "cscCalibTool", "CscCalibTool", "CSC calibration tool"};
90 
91  BooleanProperty m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."};
92  SG::ReadHandleKey<CSCSimHitCollection> m_hitsContainerKey{this, "InputObjectName", "CSC_Hits", "name of the input objects"}; // name of the input objects
93  std::string m_inputObjectName{""};
94  SG::WriteHandleKey<CscSimDataCollection> m_cscSimDataCollectionWriteHandleKey{this,"CSCSimDataCollectionOutputName","CSC_SDO","WriteHandleKey for Output CscSimDataCollection"};
95  SG::WriteHandleKey<CscDigitContainer> m_cscDigitContainerKey{this,"OutputObjectName","CSC_DIGITS","CSC digit container object"};
96 
97  std::unique_ptr<CSC_Digitizer> m_cscDigitizer{nullptr};
98 
99  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
100 
101  Gaudi::Property<double> m_pedestal{this, "pedestal",0.0, ""};
102  Gaudi::Property<bool> m_maskBadChannel{this, "maskBadChannels", true, ""};
103  Gaudi::Property<double> m_amplification{this, "amplification", 0.58e5, ""};
104 
105  //pile-up
107  std::list<CSCSimHitCollection*> m_cscHitCollList; // only for pileup events..
108  //pileup truth veto
109  Gaudi::Property<bool> m_includePileUpTruth{this, "IncludePileUpTruth", true, "Include pile-up truth info"};
110 
111  Gaudi::Property<double> m_timeWindowLowerOffset{this, "WindowLowerOffset", -25., ""};
112  Gaudi::Property<double> m_timeWindowUpperOffset{this, "WindowUpperOffset", +25., ""};
113  Gaudi::Property<bool> m_isPileUp{this, "isPileUp", false, ""};
114  Gaudi::Property<bool> m_newDigitEDM{this, "NewDigitEDM", true, ""};
115  Gaudi::Property<double> m_driftVelocity{this, "DriftVelocity", 60, ""}; // 60 / (1e-6 * 1e9); // 6 cm/microsecond -> mm/ns // 0.06
116  Gaudi::Property<double> m_electronEnergy{this, "ElectronEnergy", 66, ""}; // eV
117  Gaudi::Property<bool> m_NInterFixed{this, "NInterFixed", false, ""};
118 
119  ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", ""}; // Pile up service
120 
121  ServiceHandle <IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; // Random number service
122 };
123 
124 #endif // MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H
CscDigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Definition: CscDigitizationTool.h:121
CscDigitizationTool::m_electronEnergy
Gaudi::Property< double > m_electronEnergy
Definition: CscDigitizationTool.h:116
CscDigitizationTool::csc_newmap
std::map< IdentifierHash, std::vector< float > > csc_newmap
Definition: CscDigitizationTool.h:43
CscDigitizationTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
called for each active bunch-crossing to process current subEvents. bunchXing is in ns
Definition: CscDigitizationTool.cxx:502
CscDigitizationTool::m_amplification
Gaudi::Property< double > m_amplification
Definition: CscDigitizationTool.h:103
CscDigitizationTool::m_newDigitEDM
Gaudi::Property< bool > m_newDigitEDM
Definition: CscDigitizationTool.h:114
CscDigitizationTool::m_isPileUp
Gaudi::Property< bool > m_isPileUp
Definition: CscDigitizationTool.h:113
CSCSimHitCollection.h
CscSimDataCollection.h
CscDigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: CscDigitizationTool.h:119
CscDigitizationTool::CoreDigitization
StatusCode CoreDigitization(Collections_t &collections, CscSimDataCollection *cscSimData, CLHEP::HepRandomEngine *rndmEngine, const EventContext &ctx)
Definition: CscDigitizationTool.cxx:139
CscDigitizationTool::csc_map
std::map< IdentifierHash, std::pair< double, double > > csc_map
Definition: CscDigitizationTool.h:42
CscDigitizationTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop. Not (necessarily) able to access subEvents
Definition: CscDigitizationTool.cxx:545
ICscCalibTool.h
CscDigitizationTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CscDigitizationTool.h:99
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
CscDigitizationTool
Definition: CscDigitizationTool.h:39
CscDigitizationTool::initialize
virtual StatusCode initialize() override final
Definition: CscDigitizationTool.cxx:21
CscDigitizationTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int) override final
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition: CscDigitizationTool.cxx:90
CscDigitizationTool::m_cscDigitContainerKey
SG::WriteHandleKey< CscDigitContainer > m_cscDigitContainerKey
Definition: CscDigitizationTool.h:95
CscDigitizationTool::m_cscDigitizer
std::unique_ptr< CSC_Digitizer > m_cscDigitizer
Definition: CscDigitizationTool.h:97
CSC_Digitizer.h
CscDigitizationTool::m_maskBadChannel
Gaudi::Property< bool > m_maskBadChannel
Definition: CscDigitizationTool.h:102
CscDigitizationTool::FillCollectionWithNewDigitEDM
StatusCode FillCollectionWithNewDigitEDM(csc_newmap &data_SampleMap, std::map< IdentifierHash, deposits > &myDeposits, bool phaseToSet, Collections_t &collections, CscSimDataCollection *cscSimData)
Definition: CscDigitizationTool.cxx:242
SG::WriteHandleKey< CscSimDataCollection >
CscDigitizationTool::m_thpcCSC
TimedHitCollection< CSCSimHit > * m_thpcCSC
Definition: CscDigitizationTool.h:106
CscDigitizationTool::m_inputObjectName
std::string m_inputObjectName
Definition: CscDigitizationTool.h:93
CscDigitizationTool::m_cscHitCollList
std::list< CSCSimHitCollection * > m_cscHitCollList
Definition: CscDigitizationTool.h:107
CscDigitizationTool::getNextEvent
StatusCode getNextEvent(const EventContext &ctx)
Definition: CscDigitizationTool.cxx:445
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
TimedHitCollection.h
CscDigitizationTool::CscDigitizationTool
CscDigitizationTool(const std::string &type, const std::string &name, const IInterface *pIID)
Definition: CscDigitizationTool.cxx:17
ICscCalibTool
Definition: ICscCalibTool.h:24
CscSimDataCollection
Definition: CscSimDataCollection.h:29
CscDigitizationTool::m_includePileUpTruth
Gaudi::Property< bool > m_includePileUpTruth
Definition: CscDigitizationTool.h:109
PileUpToolBase
Definition: PileUpToolBase.h:18
CscDigitizationTool::m_NInterFixed
Gaudi::Property< bool > m_NInterFixed
Definition: CscDigitizationTool.h:117
CscDigitCollection
Definition: CscDigitCollection.h:17
CscDigitizationTool::m_hitsContainerKey
SG::ReadHandleKey< CSCSimHitCollection > m_hitsContainerKey
Definition: CscDigitizationTool.h:92
CSCSimHit.h
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CscDigitizationTool::m_pedestal
Gaudi::Property< double > m_pedestal
Definition: CscDigitizationTool.h:101
MuonDetectorManager.h
CscDigitizationTool::m_driftVelocity
Gaudi::Property< double > m_driftVelocity
Definition: CscDigitizationTool.h:115
CscDigitContainer.h
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CscDigitizationTool::Collections_t
std::vector< std::unique_ptr< CscDigitCollection > > Collections_t
Definition: CscDigitizationTool.h:75
CscDigitizationTool::FillCollectionWithOldDigitEDM
StatusCode FillCollectionWithOldDigitEDM(csc_map &data_map, std::map< IdentifierHash, deposits > &myDeposits, Collections_t &collections, CscSimDataCollection *cscSimData)
Definition: CscDigitizationTool.cxx:350
CscDigitizationTool::~CscDigitizationTool
~CscDigitizationTool()=default
CscDigitizationTool::m_pcalib
ToolHandle< ICscCalibTool > m_pcalib
Definition: CscDigitizationTool.h:89
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
CscDigitizationTool::deposits
std::vector< CscSimData::Deposit > deposits
Definition: CscDigitizationTool.h:41
CscDigitizationTool::m_cscSimDataCollectionWriteHandleKey
SG::WriteHandleKey< CscSimDataCollection > m_cscSimDataCollectionWriteHandleKey
Definition: CscDigitizationTool.h:94
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
CscDigitizationTool::m_timeWindowUpperOffset
Gaudi::Property< double > m_timeWindowUpperOffset
Definition: CscDigitizationTool.h:112
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
CscDigitizationTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
alternative interface which uses the PileUpMergeSvc to obtain all the required SubEvents.
Definition: CscDigitizationTool.cxx:101
TimedHitCollection< CSCSimHit >
IMuonIdHelperSvc.h
CscDigitizationTool::m_timeWindowLowerOffset
Gaudi::Property< double > m_timeWindowLowerOffset
Definition: CscDigitizationTool.h:111
IAthRNGSvc.h
ServiceHandle< Muon::IMuonIdHelperSvc >
CscDigitizationTool::m_onlyUseContainerName
BooleanProperty m_onlyUseContainerName
Definition: CscDigitizationTool.h:91