CMS 3D CMS Logo

DTDigiSyncTOFCorr.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author N. Amapane, R. Bellan - INFN Torino
5  */
6 
10 
14 #include <iostream>
15 
16 using namespace std;
17 
19  theOffset = pSet.getParameter<double>("offset"); // 500ns
20  corrType = pSet.getParameter<int>("TOFCorrection"); // 1
21 }
22 
24 
25 // Delays to be added to digi times during digitization, in ns.
26 double DTDigiSyncTOFCorr::digitizerOffset(const DTWireId *id, const DTLayer *layer) const {
27  double offset = theOffset;
28  const double cSpeed = 29.9792458; // cm/ns
29 
30  if (corrType == 1) {
31  // Subtraction of assumed TOF, per CHAMBER
32  double flightL = layer->chamber()->surface().position().mag();
33  offset -= flightL / cSpeed;
34  } else if (corrType == 2) {
35  // Subtraction of assumed TOF, per WIRE
36 
37  // Position of the wire in the Layer's reference frame
38  float localXPos = layer->specificTopology().wirePosition(id->wire());
39  LocalPoint localPos(localXPos, 0, 0);
40 
41  // Distance of the wire to the CMS's I.P.
42  double flightL = layer->surface().toGlobal(localPos).mag();
43 
44  offset -= flightL / cSpeed;
45 
46  } else if (corrType == 3) {
47  // Subtraction of assumed TOF, per SUPERLAYER
48  double flightL = layer->superLayer()->surface().position().mag();
49  offset -= flightL / cSpeed;
50  } else if (corrType != 0) {
51  cout << "ERROR: SimMuon:DTDigitizer:DTDigiSyncTOFCorr:TOFCorrection = " << corrType << "is not defined " << endl;
52  }
53  return offset;
54 }
55 
56 // Offset to obtain "raw" TDCs for the L1 emulator from digis.
57 double DTDigiSyncTOFCorr::emulatorOffset(const DTWireId *id) const { return theOffset; }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T getParameter(std::string const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
DTDigiSyncTOFCorr(const edm::ParameterSet &)
Constructor.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
T mag() const
Definition: PV3DBase.h:67
double digitizerOffset(const DTWireId *id, const DTLayer *layer=nullptr) const override
Delays to be added to digi times during digitization, in ns.
double emulatorOffset(const DTWireId *id) const override
Offset to obtain "raw" TDCs for the L1 emulator from digis.
int wire() const
Return the wire number.
Definition: DTWireId.h:56
~DTDigiSyncTOFCorr() override
Destructor.
const DTChamber * chamber() const
Definition: DTLayer.cc:58
const DTSuperLayer * superLayer() const
Definition: DTLayer.cc:54
const PositionType & position() const