CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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...
 
virtual double emulatorOffset (const DTWireId &wireId, double &tTrig, double &t0cell)
 
virtual double offset (const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globPos, double &tTrig, double &wirePropCorr, double &tofCorr)
 
double offset (const DTWireId &wireId)
 
virtual void setES (const edm::EventSetup &setup)
 Pass the Event Setup to the algo at each event. More...
 
virtual ~DTTTrigSyncFromDB ()
 Destructor. More...
 
- Public Member Functions inherited from DTTTrigBaseSync
 DTTTrigBaseSync ()
 Constructor. More...
 
virtual double emulatorOffset (const DTWireId &wireId)
 
double offset (const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globalPos)
 
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 54 of file DTTTrigSyncFromDB.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 27 of file DTTTrigSyncFromDB.cc.

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

Destructor.

Definition at line 47 of file DTTTrigSyncFromDB.cc.

47 {}

Member Function Documentation

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

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 201 of file DTTTrigSyncFromDB.cc.

References gather_cfg::cout, doT0Correction, DTT0::get(), DTTtrig::get(), DTTimeUnits::ns, DTLayerId::superlayerId(), theBXspace, tTrigMap, and tZeroMap.

203  {
204  float t0 = 0;
205  float t0rms = 0;
206  if(doT0Correction)
207  {
208  // Read the t0 from pulses for this wire (ns)
209  tZeroMap->get(wireId,
210  t0,
211  t0rms,
213 
214  }
215 
216  // Read the ttrig for this wire
217  float ttrigMean = 0;
218  float ttrigSigma = 0;
219  float kFactor = 0;
220  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
221  if(tTrigMap->get(wireId.superlayerId(),
222  ttrigMean,
223  ttrigSigma,
224  kFactor,
225  DTTimeUnits::ns) != 0) {
226  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
227 // FIXME: LogError.....
228  }
229 
230  tTrig = ttrigMean + kFactor * ttrigSigma;
231  t0cell = t0;
232 
233  return int(tTrig/theBXspace)*theBXspace + t0cell;
234 }
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
tuple cout
Definition: gather_cfg.py:121
double DTTTrigSyncFromDB::offset ( const DTLayer layer,
const DTWireId wireId,
const GlobalPoint globPos,
double &  tTrig,
double &  wirePropCorr,
double &  tofCorr 
)
virtual

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 73 of file DTTTrigSyncFromDB.cc.

References DTTopology::cellLenght(), gather_cfg::cout, debug, doTOFCorrection, doWirePropCorrection, edm::hlt::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().

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

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 170 of file DTTTrigSyncFromDB.cc.

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

170  {
171  float t0 = 0;
172  float t0rms = 0;
173  if(doT0Correction)
174  {
175  // Read the t0 from pulses for this wire (ns)
176  tZeroMap->get(wireId,
177  t0,
178  t0rms,
180 
181  }
182 
183  // Read the ttrig for this wire
184  float ttrigMean = 0;
185  float ttrigSigma = 0;
186  float kFactor = 0;
187  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
188  if(tTrigMap->get(wireId.superlayerId(),
189  ttrigMean,
190  ttrigSigma,
191  kFactor,
192  DTTimeUnits::ns) != 0) {
193  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
194 // FIXME: LogError.....
195  }
196 
197  return t0 + ttrigMean + kFactor * ttrigSigma;
198 
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
tuple cout
Definition: gather_cfg.py:121
void DTTTrigSyncFromDB::setES ( const edm::EventSetup setup)
virtual

Pass the Event Setup to the algo at each event.

Implements DTTTrigBaseSync.

Definition at line 51 of file DTTTrigSyncFromDB.cc.

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

51  {
52  if(doT0Correction)
53  {
54  // Get the map of t0 from pulses from the Setup
55  ESHandle<DTT0> t0Handle;
56  setup.get<DTT0Rcd>().get(t0Handle);
57  tZeroMap = &*t0Handle;
58  if(debug) {
59  cout << "[DTTTrigSyncFromDB] t0 version: " << tZeroMap->version()<<endl;
60  }
61  }
62 
63  // Get the map of ttrig from the Setup
64  ESHandle<DTTtrig> ttrigHandle;
65  setup.get<DTTtrigRcd>().get(thetTrigLabel,ttrigHandle);
66  tTrigMap = &*ttrigHandle;
67  if(debug) {
68  cout << "[DTTTrigSyncFromDB] ttrig version: " << tTrigMap->version() << endl;
69  }
70 }
const DTTtrig * tTrigMap
const DTT0 * tZeroMap
const std::string & version() const
access version
Definition: DTTtrig.cc:231
std::string thetTrigLabel
const T & get() const
Definition: EventSetup.h:55
Definition: DTT0Rcd.h:9
tuple cout
Definition: gather_cfg.py:121
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 103 of file DTTTrigSyncFromDB.h.

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

bool DTTTrigSyncFromDB::doTOFCorrection
private

Definition at line 105 of file DTTTrigSyncFromDB.h.

Referenced by offset().

bool DTTTrigSyncFromDB::doWirePropCorrection
private

Definition at line 108 of file DTTTrigSyncFromDB.h.

Referenced by offset().

double DTTTrigSyncFromDB::theBXspace
private

Definition at line 111 of file DTTTrigSyncFromDB.h.

Referenced by emulatorOffset().

int DTTTrigSyncFromDB::theTOFCorrType
private

Definition at line 106 of file DTTTrigSyncFromDB.h.

Referenced by offset().

std::string DTTTrigSyncFromDB::thetTrigLabel
private

Definition at line 113 of file DTTTrigSyncFromDB.h.

Referenced by setES().

double DTTTrigSyncFromDB::theVPropWire
private

Definition at line 101 of file DTTTrigSyncFromDB.h.

Referenced by offset().

int DTTTrigSyncFromDB::theWirePropCorrType
private

Definition at line 109 of file DTTTrigSyncFromDB.h.

Referenced by offset().

const DTTtrig* DTTTrigSyncFromDB::tTrigMap
private

Definition at line 97 of file DTTTrigSyncFromDB.h.

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

const DTT0* DTTTrigSyncFromDB::tZeroMap
private

Definition at line 96 of file DTTTrigSyncFromDB.h.

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