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 | Static 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

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

Static Private Attributes

static bool debug = false
 

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

Date:
2009/10/21 17:05:47
Revision:
1.4
Author
G. Cerminara - INFN Torino

Definition at line 56 of file DTTTrigSyncFromDB.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 29 of file DTTTrigSyncFromDB.cc.

References debug, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

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

Destructor.

Definition at line 49 of file DTTTrigSyncFromDB.cc.

49 {}

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

References gather_cfg::cout, DTTimeUnits::ns, and DTLayerId::superlayerId().

210  {
211  float t0 = 0;
212  float t0rms = 0;
213  if(doT0Correction)
214  {
215  // Read the t0 from pulses for this wire (ns)
216  tZeroMap->get(wireId,
217  t0,
218  t0rms,
220 
221  }
222 
223  // Read the ttrig for this wire
224  float ttrigMean = 0;
225  float ttrigSigma = 0;
226  float kFactor = 0;
227  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
228  if(tTrigMap->get(wireId.superlayerId(),
229  ttrigMean,
230  ttrigSigma,
231  kFactor,
232  DTTimeUnits::ns) != 0) {
233  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
234 // FIXME: LogError.....
235  }
236 
237  tTrig = ttrigMean + kFactor * ttrigSigma;
238  t0cell = t0;
239 
240  return int(tTrig/theBXspace)*theBXspace + t0cell;
241 }
const DTTtrig * tTrigMap
const DTT0 * tZeroMap
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
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:94
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:87
tuple cout
Definition: gather_cfg.py:41
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 75 of file DTTTrigSyncFromDB.cc.

References DTTopology::cellLenght(), gather_cfg::cout, debug, edm::hlt::Exception, PV3DBase< T, PVType, FrameType >::mag(), mag(), evf::evtn::offset(), GloballyPositioned< T >::position(), DTLayer::specificTopology(), DTLayer::superLayer(), GeomDet::surface(), GeomDet::toGlobal(), GeomDet::toLocal(), DTWireId::wire(), DTTopology::wirePosition(), and PV3DBase< T, PVType, FrameType >::y().

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

References gather_cfg::cout, DTTimeUnits::ns, and DTLayerId::superlayerId().

172  {
173  float t0 = 0;
174  float t0rms = 0;
175  if(doT0Correction)
176  {
177  // Read the t0 from pulses for this wire (ns)
178  tZeroMap->get(wireId,
179  t0,
180  t0rms,
182 
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(),
191  ttrigMean,
192  ttrigSigma,
193  kFactor,
194  DTTimeUnits::ns) != 0) {
195  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
196 // FIXME: LogError.....
197  }
198 
199  return t0 + ttrigMean + kFactor * ttrigSigma;
200 
201 }
const DTTtrig * tTrigMap
const DTT0 * tZeroMap
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
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:94
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:87
tuple cout
Definition: gather_cfg.py:41
void DTTTrigSyncFromDB::setES ( const edm::EventSetup setup)
virtual

Pass the Event Setup to the algo at each event.

Implements DTTTrigBaseSync.

Definition at line 53 of file DTTTrigSyncFromDB.cc.

References gather_cfg::cout, debug, and edm::EventSetup::get().

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

Member Data Documentation

bool DTTTrigSyncFromDB::debug = false
staticprivate

Definition at line 101 of file DTTTrigSyncFromDB.h.

bool DTTTrigSyncFromDB::doT0Correction
private

Definition at line 105 of file DTTTrigSyncFromDB.h.

bool DTTTrigSyncFromDB::doTOFCorrection
private

Definition at line 107 of file DTTTrigSyncFromDB.h.

bool DTTTrigSyncFromDB::doWirePropCorrection
private

Definition at line 110 of file DTTTrigSyncFromDB.h.

double DTTTrigSyncFromDB::theBXspace
private

Definition at line 113 of file DTTTrigSyncFromDB.h.

int DTTTrigSyncFromDB::theTOFCorrType
private

Definition at line 108 of file DTTTrigSyncFromDB.h.

std::string DTTTrigSyncFromDB::thetTrigLabel
private

Definition at line 115 of file DTTTrigSyncFromDB.h.

double DTTTrigSyncFromDB::theVPropWire
private

Definition at line 103 of file DTTTrigSyncFromDB.h.

int DTTTrigSyncFromDB::theWirePropCorrType
private

Definition at line 111 of file DTTTrigSyncFromDB.h.

const DTTtrig* DTTTrigSyncFromDB::tTrigMap
private

Definition at line 99 of file DTTTrigSyncFromDB.h.

const DTT0* DTTTrigSyncFromDB::tZeroMap
private

Definition at line 98 of file DTTTrigSyncFromDB.h.