CMS 3D CMS Logo

DTTTrigSyncT0Only.cc
Go to the documentation of this file.
1 
18 
19 #include <iostream>
20 
21 namespace edm {
22  class ParameterSet;
23 }
24 
26 public:
29 
31  ~DTTTrigSyncT0Only() override;
32 
33  // Operations
34 
36  void setES(const edm::EventSetup& setup) override;
37 
42  double offset(const DTLayer* layer,
43  const DTWireId& wireId,
44  const GlobalPoint& globPos,
45  double& tTrig,
46  double& wirePropCorr,
47  double& tofCorr) const override;
48 
49  double offset(const DTWireId& wireId) const override;
50 
53  double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override;
54 
55 private:
56  const DTT0* tZeroMap;
58 
59  // Set the verbosity level
60  const bool debug;
61 };
62 
63 using namespace std;
64 using namespace edm;
65 
67  : t0Token_(cc.esConsumes()), debug(config.getUntrackedParameter<bool>("debug")) {}
68 
70 
72  tZeroMap = &setup.getData(t0Token_);
73 
74  if (debug) {
75  edm::LogPrint("[DTTTrigSyncT0Only]") << "T0 version: " << tZeroMap->version() << endl;
76  }
77 }
78 
80  const DTWireId& wireId,
81  const GlobalPoint& globPos,
82  double& tTrig,
83  double& wirePropCorr,
84  double& tofCorr) const {
85  tTrig = offset(wireId);
86  wirePropCorr = 0;
87  tofCorr = 0;
88 
89  if (debug) {
90  edm::LogPrint("[DTTTrigSyncT0Only]") << "Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl
91  << " various contributions are: "
92  << endl
93  //<< " tZero (ns): " << t0 << endl
94  << " Propagation along wire delay (ns): " << wirePropCorr << endl
95  << " TOF correction (ns): " << tofCorr << endl
96  << endl;
97  }
98  //The global offset is the sum of various contributions
99  return tTrig + wirePropCorr - tofCorr;
100 }
101 
102 double DTTTrigSyncT0Only::offset(const DTWireId& wireId) const {
103  float t0 = 0;
104  float t0rms = 0;
105  tZeroMap->get(wireId, t0, t0rms, DTTimeUnits::ns);
106 
107  return t0;
108 }
109 
110 double DTTTrigSyncT0Only::emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const {
111  tTrig = 0.;
112  t0cell = 0.;
113  return 0.;
114 }
115 
118 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
Definition: config.py:1
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: DTT0.h:48
DTTTrigSyncT0Only(const edm::ParameterSet &config, edm::ConsumesCollector)
Constructor.
Log< level::Warning, true > LogPrint
void setES(const edm::EventSetup &setup) override
Pass the Event Setup to the algo at each event.
#define debug
Definition: HDRShower.cc:19
const std::string & version() const
access version
Definition: DTT0.cc:82
double emulatorOffset(const DTWireId &wireId, double &tTrig, double &t0cell) const override
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
Definition: DTT0.cc:48
~DTTTrigSyncT0Only() override
Destructor.
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globPos, double &tTrig, double &wirePropCorr, double &tofCorr) const override
HLT enums.
#define DEFINE_EDM_PLUGIN(factory, type, name)
edm::ESGetToken< DTT0, DTT0Rcd > t0Token_