File indexing completed on 2024-04-06 12:30:59
0001 #ifndef SiStripDigitizer_h
0002 #define SiStripDigitizer_h
0003
0004 #include <map>
0005 #include <memory>
0006 #include <string>
0007 #include <vector>
0008 #include <bitset>
0009 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
0010 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0011 #include "CalibTracker/Records/interface/SiStripDependentRecords.h"
0012 #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
0013 #include "CondFormats/SiStripObjects/interface/SiStripApvSimulationParameters.h"
0014 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0015 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
0016 #include "CondFormats/SiStripObjects/interface/SiStripThreshold.h"
0017 #include "FWCore/Framework/interface/ProducesCollector.h"
0018 #include "FWCore/Utilities/interface/ESGetToken.h"
0019 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0020 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0021 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0022 #include "SimDataFormats/PileupSummaryInfo/interface/PileupMixingContent.h"
0023 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h"
0024
0025 class TrackerTopology;
0026
0027 namespace CLHEP {
0028 class HepRandomEngine;
0029 }
0030
0031 namespace edm {
0032 class ConsumesCollector;
0033 class Event;
0034 class EventSetup;
0035 class ParameterSet;
0036 template <typename T>
0037 class Handle;
0038 class StreamID;
0039 }
0040
0041 class MagneticField;
0042 class PileUpEventPrincipal;
0043 class PSimHit;
0044 class SiStripDigitizerAlgorithm;
0045 class StripGeomDetUnit;
0046 class TrackerGeometry;
0047 class SiStripBadStrip;
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 class SiStripDigitizer : public DigiAccumulatorMixMod {
0058 public:
0059 explicit SiStripDigitizer(const edm::ParameterSet& conf, edm::ProducesCollector, edm::ConsumesCollector& iC);
0060
0061 ~SiStripDigitizer() override;
0062
0063 void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override;
0064 void accumulate(edm::Event const& e, edm::EventSetup const& c) override;
0065 void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, edm::StreamID const&) override;
0066 void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override;
0067
0068 void StorePileupInformation(std::vector<int>& numInteractionList,
0069 std::vector<int>& bunchCrossingList,
0070 std::vector<float>& TrueInteractionList,
0071 std::vector<edm::EventID>& eventInfoList,
0072 int bunchSpacing) override {
0073 PileupInfo_ = std::make_unique<PileupMixingContent>(
0074 numInteractionList, bunchCrossingList, TrueInteractionList, eventInfoList, bunchSpacing);
0075 }
0076
0077 PileupMixingContent* getEventPileupInfo() override { return PileupInfo_.get(); }
0078
0079 private:
0080 void accumulateStripHits(edm::Handle<std::vector<PSimHit>>,
0081 const TrackerTopology* tTopo,
0082 size_t globalSimHitIndex,
0083 const unsigned int tofBin);
0084
0085 typedef std::vector<std::string> vstring;
0086 typedef std::map<unsigned int, std::vector<std::pair<const PSimHit*, int>>, std::less<unsigned int>> simhit_map;
0087 typedef simhit_map::iterator simhit_map_iterator;
0088
0089 const std::string hitsProducer;
0090 const vstring trackerContainers;
0091 const std::string ZSDigi;
0092 const std::string SCDigi;
0093 const std::string VRDigi;
0094 const std::string PRDigi;
0095 const bool useConfFromDB;
0096 const bool zeroSuppression;
0097 const bool makeDigiSimLinks_;
0098 const bool includeAPVSimulation_;
0099 const double fracOfEventsToSimAPV_;
0100 const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0101 const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> pDDToken_;
0102 const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> pSetupToken_;
0103 const edm::ESGetToken<SiStripGain, SiStripGainSimRcd> gainToken_;
0104 const edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> noiseToken_;
0105 const edm::ESGetToken<SiStripThreshold, SiStripThresholdRcd> thresholdToken_;
0106 const edm::ESGetToken<SiStripPedestals, SiStripPedestalsRcd> pedestalToken_;
0107 const edm::ESGetToken<SiStripBadStrip, SiStripBadChannelRcd> deadChannelToken_;
0108 edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> detCablingToken_;
0109 edm::ESGetToken<SiStripApvSimulationParameters, SiStripApvSimulationParametersRcd> apvSimulationParametersToken_;
0110
0111 unsigned long long ddCacheID_ = 0;
0112 unsigned long long deadChannelCacheID_ = 0;
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 std::map<std::string, size_t> crossingSimHitIndexOffset_;
0124
0125 std::unique_ptr<SiStripDigitizerAlgorithm> theDigiAlgo;
0126 std::map<uint32_t, std::vector<int>> theDetIdList;
0127 const TrackerGeometry* pDD = nullptr;
0128 const MagneticField* pSetup = nullptr;
0129 std::map<unsigned int, StripGeomDetUnit const*> detectorUnits;
0130 CLHEP::HepRandomEngine* randomEngine_ = nullptr;
0131 std::vector<std::pair<int, std::bitset<6>>> theAffectedAPVvector;
0132
0133 std::unique_ptr<PileupMixingContent> PileupInfo_;
0134 };
0135
0136 #endif