File indexing completed on 2023-03-17 11:25:21
0001 #ifndef SimMuon_DTDigitizer_h
0002 #define SimMuon_DTDigitizer_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "FWCore/Framework/interface/stream/EDProducer.h"
0013
0014 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0015 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0016 #include "FWCore/Framework/interface/ConsumesCollector.h"
0017 #include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLinkCollection.h"
0018 #include "FWCore/Utilities/interface/ESGetToken.h"
0019 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0020 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0021
0022 #include "DataFormats/GeometryVector/interface/LocalVector.h"
0023
0024 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0025 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0026 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0027 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0028
0029 #include "MagneticField/Engine/interface/MagneticField.h"
0030 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0031
0032 #include <memory>
0033 #include <vector>
0034
0035 namespace CLHEP {
0036 class HepRandomEngine;
0037 }
0038
0039 class DTLayer;
0040 class PSimHit;
0041 class DTWireType;
0042 class DTBaseDigiSync;
0043 class DTTopology;
0044 class DTDigiSyncBase;
0045
0046 namespace edm {
0047 class ParameterSet;
0048 class Event;
0049 class EventSetup;
0050 }
0051
0052 class DTDigitizer : public edm::stream::EDProducer<> {
0053 public:
0054 explicit DTDigitizer(const edm::ParameterSet &);
0055
0056 void produce(edm::Event &, const edm::EventSetup &) override;
0057
0058 private:
0059 typedef std::pair<const PSimHit *, float> hitAndT;
0060 typedef std::vector<hitAndT> TDContainer;
0061
0062 typedef std::map<DTWireId, std::vector<const PSimHit *>> DTWireIdMap;
0063 typedef DTWireIdMap::iterator DTWireIdMapIter;
0064 typedef DTWireIdMap::const_iterator DTWireIdMapConstIter;
0065
0066
0067 struct hitLessT {
0068 bool operator()(const hitAndT &h1, const hitAndT &h2) {
0069 if (h1.second < h2.second)
0070 return true;
0071 return false;
0072 }
0073 };
0074
0075
0076
0077 std::pair<float, bool> computeTime(const DTLayer *layer,
0078 const DTWireId &wireId,
0079 const PSimHit *hit,
0080 const LocalVector &BLoc,
0081 CLHEP::HepRandomEngine *);
0082
0083
0084
0085
0086 std::pair<float, bool> driftTimeFromParametrization(
0087 float x, float alpha, float By, float Bz, CLHEP::HepRandomEngine *) const;
0088
0089
0090
0091 std::pair<float, bool> driftTimeFromTimeMap() const;
0092
0093
0094
0095 float externalDelays(const DTLayer *layer, const DTWireId &wireId, const PSimHit *hit) const;
0096
0097
0098
0099 void storeDigis(DTWireId &wireId, TDContainer &hits, DTDigiCollection &output, DTDigiSimLinkCollection &outputLinks);
0100
0101
0102 void dumpHit(const PSimHit *hit, float xEntry, float xExit, const DTTopology &topo);
0103
0104
0105 float asymGausSmear(double mean, double sigmaLeft, double sigmaRight, CLHEP::HepRandomEngine *) const;
0106
0107
0108 friend class DTDigitizerAnalysis;
0109
0110
0111 double vPropWire;
0112 float deadTime;
0113 float smearing;
0114 bool debug;
0115 bool interpolate;
0116 bool onlyMuHits;
0117 int base;
0118
0119 std::string syncName;
0120 std::unique_ptr<DTDigiSyncBase> theSync;
0121
0122 std::string geometryType;
0123
0124
0125 bool IdealModel;
0126 float theConstVDrift;
0127
0128
0129 bool MultipleLinks;
0130 float LinksTimeWindow;
0131
0132
0133 std::string mix_;
0134 std::string collection_for_XF;
0135
0136 edm::EDGetTokenT<CrossingFrame<PSimHit>> cf_token;
0137 edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeom_token;
0138 edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magnField_token;
0139 };
0140 #endif