CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTTTrigSyncFromDB Class Reference

#include <DTTTrigSyncFromDB.h>

Inheritance diagram for DTTTrigSyncFromDB:
DTTTrigBaseSync

Public Member Functions

 DTTTrigSyncFromDB (const edm::ParameterSet &config)
 Constructor. More...
 
double emulatorOffset (const DTWireId &wireId, double &tTrig, double &t0cell) const override
 
double offset (const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globPos, double &tTrig, double &wirePropCorr, double &tofCorr) const override
 
double offset (const DTWireId &wireId) const override
 
void setES (const edm::EventSetup &setup) override
 Pass the Event Setup to the algo at each event. More...
 
 ~DTTTrigSyncFromDB () override
 Destructor. More...
 
- Public Member Functions inherited from DTTTrigBaseSync
 DTTTrigBaseSync ()
 Constructor. More...
 
virtual double emulatorOffset (const DTWireId &wireId) const
 
double offset (const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globalPos) const
 
virtual ~DTTTrigBaseSync ()
 Destructor. More...
 

Private Attributes

const bool debug
 
bool doT0Correction
 
bool doTOFCorrection
 
bool doWirePropCorrection
 
double theBXspace
 
int theTOFCorrType
 
std::string thetTrigLabel
 
double theVPropWire
 
int theWirePropCorrType
 
const DTTtrigtTrigMap
 
const DTT0tZeroMap
 

Detailed Description

Concrete implementation of a DTTTrigBaseSync. This class define the offset for RecHit building of data and simulation. The offset is computes as:
offset = t0 + tTrig + wirePropCorr - tofCorr
where:

The emulatorOffset is computed as:
offset = int(ttrig/BXspace)*BXspace + t0
where:

NOTE: this should approximate what is seen online by the BTI

Author
G. Cerminara - INFN Torino

Definition at line 52 of file DTTTrigSyncFromDB.h.

Constructor & Destructor Documentation

DTTTrigSyncFromDB::DTTTrigSyncFromDB ( const edm::ParameterSet config)

Constructor.

Definition at line 25 of file DTTTrigSyncFromDB.cc.

26  : debug(config.getUntrackedParameter<bool>("debug")),
27  // The velocity of signal propagation along the wire (cm/ns)
28  theVPropWire(config.getParameter<double>("vPropWire")),
29  // Switch on/off the T0 correction from pulses
30  doT0Correction(config.getParameter<bool>("doT0Correction")),
31  // Switch on/off the TOF correction for particles from IP
32  doTOFCorrection(config.getParameter<bool>("doTOFCorrection")),
33  theTOFCorrType(config.getParameter<int>("tofCorrType")),
34  // Switch on/off the correction for the signal propagation along the wire
35  doWirePropCorrection(config.getParameter<bool>("doWirePropCorrection")),
36  theWirePropCorrType(config.getParameter<int>("wirePropCorrType")),
37  // spacing of BX in ns
38  theBXspace(config.getUntrackedParameter<double>("bxSpace", 25.)),
39  thetTrigLabel(config.getParameter<string>("tTrigLabel")) {}
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string thetTrigLabel
DTTTrigSyncFromDB::~DTTTrigSyncFromDB ( )
override

Destructor.

Definition at line 41 of file DTTTrigSyncFromDB.cc.

41 {}

Member Function Documentation

double DTTTrigSyncFromDB::emulatorOffset ( const DTWireId wireId,
double &  tTrig,
double &  t0cell 
) const
overridevirtual

Time (ns) to be subtracted to the digi time for emulation purposes It does not take into account TOF and signal propagation along the wire It also returns the different contributions separately:

  • tTrig is the offset (t_trig)
  • t0cell is the t0 from pulses

Implements DTTTrigBaseSync.

Definition at line 177 of file DTTTrigSyncFromDB.cc.

References gather_cfg::cout, doT0Correction, DTT0::get(), DTTtrig::get(), createfilelist::int, DTAnalyzerDetailed_cfi::kFactor, DTTimeUnits::ns, DTLayerId::superlayerId(), genVertex_cff::t0, theBXspace, tTrigMap, and tZeroMap.

177  {
178  float t0 = 0;
179  float t0rms = 0;
180  if (doT0Correction) {
181  // Read the t0 from pulses for this wire (ns)
182  tZeroMap->get(wireId, t0, t0rms, DTTimeUnits::ns);
183  }
184 
185  // Read the ttrig for this wire
186  float ttrigMean = 0;
187  float ttrigSigma = 0;
188  float kFactor = 0;
189  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
190  if (tTrigMap->get(wireId.superlayerId(), ttrigMean, ttrigSigma, kFactor, DTTimeUnits::ns) != 0) {
191  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
192  // FIXME: LogError.....
193  }
194 
195  tTrig = ttrigMean + kFactor * ttrigSigma;
196  t0cell = t0;
197 
198  return int(tTrig / theBXspace) * theBXspace + t0cell;
199 }
const DTTtrig * tTrigMap
const DTT0 * tZeroMap
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
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:67
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
Definition: DTTtrig.cc:85
double DTTTrigSyncFromDB::offset ( const DTLayer layer,
const DTWireId wireId,
const GlobalPoint globPos,
double &  tTrig,
double &  wirePropCorr,
double &  tofCorr 
) const
overridevirtual

Time (ns) to be subtracted to the digi time, Parameters are the layer and the wireId to which the digi is referred and the estimation of the 3D hit position (globPos)

Implements DTTTrigBaseSync.

Definition at line 63 of file DTTTrigSyncFromDB.cc.

References DTTopology::cellLenght(), gather_cfg::cout, debug, doTOFCorrection, doWirePropCorrection, Exception, PV3DBase< T, PVType, FrameType >::mag(), mag(), GloballyPositioned< T >::position(), DTLayer::specificTopology(), DTLayer::superLayer(), GeomDet::surface(), theTOFCorrType, theVPropWire, theWirePropCorrType, GeomDet::toGlobal(), GeomDet::toLocal(), DTWireId::wire(), DTTopology::wirePosition(), and PV3DBase< T, PVType, FrameType >::y().

68  {
69  // Correction for the float to int conversion while writeing the ttrig in ns into an int variable
70  // (half a bin on average)
71  // FIXME: this should disappear as soon as the ttrig object will become a float
72  // static const float f2i_convCorr = (25./64.); // ns //FIXME: check how the conversion is performed
73 
74  tTrig = offset(wireId);
75 
76  // Compute the time spent in signal propagation along wire.
77  // NOTE: the FE is always at y>0
78  wirePropCorr = 0;
80  switch (theWirePropCorrType) {
81  // The ttrig computed from the timebox accounts on average for the signal propagation time
82  // from the center of the wire to the frontend. Here we just have to correct for
83  // the distance of the hit from the wire center.
84  case 0: {
85  float wireCoord = layer->toLocal(globPos).y();
86  wirePropCorr = -wireCoord / theVPropWire;
87  break;
88  // FIXME: What if hits used for the time box are not distributed uniformly along the wire?
89  }
90  //On simulated data you need to subtract the total propagation time
91  case 1: {
92  float halfL = layer->specificTopology().cellLenght() / 2;
93  float wireCoord = layer->toLocal(globPos).y();
94  float propgL = halfL - wireCoord;
95  wirePropCorr = propgL / theVPropWire;
96  break;
97  }
98  default: {
99  throw cms::Exception("[DTTTrigSyncFromDB]")
100  << " Invalid parameter: wirePropCorrType = " << theWirePropCorrType << std::endl;
101  break;
102  }
103  }
104  }
105 
106  // Compute TOF correction:
107  tofCorr = 0.;
108  // TOF Correction can be switched off with appropriate parameter
109  if (doTOFCorrection) {
110  float flightToHit = globPos.mag();
111  static const float cSpeed = 29.9792458; // cm/ns
112  switch (theTOFCorrType) {
113  case 0: {
114  // The ttrig computed from the real data accounts on average for the TOF correction
115  // Depending on the granularity used for the ttrig computation we just have to correct for the
116  // TOF from the center of the chamber, SL, layer or wire to the hit position.
117  // At the moment only SL granularity is considered
118  // Correction for TOF from the center of the SL to hit position
119  const DTSuperLayer* sl = layer->superLayer();
120  double flightToSL = sl->surface().position().mag();
121  tofCorr = (flightToSL - flightToHit) / cSpeed;
122  break;
123  }
124  case 1: {
125  // On simulated data you need to consider only the TOF from 3D center of the wire to hit position
126  // (because the TOF from the IP to the wire has been already subtracted in the digitization:
127  // SimMuon/DTDigitizer/DTDigiSyncTOFCorr.cc corrType=2)
128  float flightToWire =
129  layer->toGlobal(LocalPoint(layer->specificTopology().wirePosition(wireId.wire()), 0., 0.)).mag();
130  tofCorr = (flightToWire - flightToHit) / cSpeed;
131  break;
132  }
133  default: {
134  throw cms::Exception("[DTTTrigSyncFromDB]")
135  << " Invalid parameter: tofCorrType = " << theTOFCorrType << std::endl;
136  break;
137  }
138  }
139  }
140 
141  if (debug) {
142  cout << "[DTTTrigSyncFromDB] Channel: " << wireId << endl
143  << " Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl
144  << " various contributions are: " << endl
145  << " tTrig + t0 (ns): " << tTrig
146  << endl
147  //<< " tZero (ns): " << t0 << endl
148  << " Propagation along wire delay (ns): " << wirePropCorr << endl
149  << " TOF correction (ns): " << tofCorr << endl
150  << endl;
151  }
152  //The global offset is the sum of various contributions
153  return tTrig + wirePropCorr - tofCorr;
154 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globPos, double &tTrig, double &wirePropCorr, double &tofCorr) const override
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
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
int wire() const
Return the wire number.
Definition: DTWireId.h:56
const DTSuperLayer * superLayer() const
Definition: DTLayer.cc:54
float cellLenght() const
Definition: DTTopology.h:73
const PositionType & position() const
double DTTTrigSyncFromDB::offset ( const DTWireId wireId) const
overridevirtual

Time (ns) to be subtracted to the digi time. It does not take into account TOF and signal propagation along the wire

Implements DTTTrigBaseSync.

Definition at line 156 of file DTTTrigSyncFromDB.cc.

References gather_cfg::cout, doT0Correction, DTT0::get(), DTTtrig::get(), DTAnalyzerDetailed_cfi::kFactor, DTTimeUnits::ns, DTLayerId::superlayerId(), genVertex_cff::t0, tTrigMap, and tZeroMap.

156  {
157  float t0 = 0;
158  float t0rms = 0;
159  if (doT0Correction) {
160  // Read the t0 from pulses for this wire (ns)
161  tZeroMap->get(wireId, t0, t0rms, DTTimeUnits::ns);
162  }
163 
164  // Read the ttrig for this wire
165  float ttrigMean = 0;
166  float ttrigSigma = 0;
167  float kFactor = 0;
168  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
169  if (tTrigMap->get(wireId.superlayerId(), ttrigMean, ttrigSigma, kFactor, DTTimeUnits::ns) != 0) {
170  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
171  // FIXME: LogError.....
172  }
173 
174  return t0 + ttrigMean + kFactor * ttrigSigma;
175 }
const DTTtrig * tTrigMap
const DTT0 * tZeroMap
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
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:67
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
Definition: DTTtrig.cc:85
void DTTTrigSyncFromDB::setES ( const edm::EventSetup setup)
overridevirtual

Pass the Event Setup to the algo at each event.

Implements DTTTrigBaseSync.

Definition at line 43 of file DTTTrigSyncFromDB.cc.

References gather_cfg::cout, debug, doT0Correction, edm::EventSetup::get(), thetTrigLabel, tTrigMap, tZeroMap, DTT0::version(), and DTTtrig::version().

43  {
44  if (doT0Correction) {
45  // Get the map of t0 from pulses from the Setup
46  ESHandle<DTT0> t0Handle;
47  setup.get<DTT0Rcd>().get(t0Handle);
48  tZeroMap = &*t0Handle;
49  if (debug) {
50  cout << "[DTTTrigSyncFromDB] t0 version: " << tZeroMap->version() << endl;
51  }
52  }
53 
54  // Get the map of ttrig from the Setup
55  ESHandle<DTTtrig> ttrigHandle;
56  setup.get<DTTtrigRcd>().get(thetTrigLabel, ttrigHandle);
57  tTrigMap = &*ttrigHandle;
58  if (debug) {
59  cout << "[DTTTrigSyncFromDB] ttrig version: " << tTrigMap->version() << endl;
60  }
61 }
const DTTtrig * tTrigMap
const DTT0 * tZeroMap
const std::string & version() const
access version
Definition: DTTtrig.cc:231
std::string thetTrigLabel
Definition: DTT0Rcd.h:9
T get() const
Definition: EventSetup.h:71
const std::string & version() const
access version
Definition: DTT0.cc:118

Member Data Documentation

const bool DTTTrigSyncFromDB::debug
private
bool DTTTrigSyncFromDB::doT0Correction
private

Definition at line 95 of file DTTTrigSyncFromDB.h.

Referenced by emulatorOffset(), offset(), and setES().

bool DTTTrigSyncFromDB::doTOFCorrection
private

Definition at line 97 of file DTTTrigSyncFromDB.h.

Referenced by offset().

bool DTTTrigSyncFromDB::doWirePropCorrection
private

Definition at line 100 of file DTTTrigSyncFromDB.h.

Referenced by offset().

double DTTTrigSyncFromDB::theBXspace
private

Definition at line 103 of file DTTTrigSyncFromDB.h.

Referenced by emulatorOffset().

int DTTTrigSyncFromDB::theTOFCorrType
private

Definition at line 98 of file DTTTrigSyncFromDB.h.

Referenced by offset().

std::string DTTTrigSyncFromDB::thetTrigLabel
private

Definition at line 105 of file DTTTrigSyncFromDB.h.

Referenced by setES().

double DTTTrigSyncFromDB::theVPropWire
private

Definition at line 93 of file DTTTrigSyncFromDB.h.

Referenced by offset().

int DTTTrigSyncFromDB::theWirePropCorrType
private

Definition at line 101 of file DTTTrigSyncFromDB.h.

Referenced by offset().

const DTTtrig* DTTTrigSyncFromDB::tTrigMap
private

Definition at line 89 of file DTTTrigSyncFromDB.h.

Referenced by emulatorOffset(), offset(), and setES().

const DTT0* DTTTrigSyncFromDB::tZeroMap
private

Definition at line 88 of file DTTTrigSyncFromDB.h.

Referenced by emulatorOffset(), offset(), and setES().