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
 
std::string thet0Label
 
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::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")),
40  thet0Label(config.getParameter<string>("t0Label")) {}

◆ ~DTTTrigSyncFromDB()

DTTTrigSyncFromDB::~DTTTrigSyncFromDB ( )
override

Destructor.

Definition at line 42 of file DTTTrigSyncFromDB.cc.

42 {}

Member Function Documentation

◆ emulatorOffset()

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

178  {
179  float t0 = 0;
180  float t0rms = 0;
181  if (doT0Correction) {
182  // Read the t0 from pulses for this wire (ns)
183  tZeroMap->get(wireId, t0, t0rms, DTTimeUnits::ns);
184  }
185 
186  // Read the ttrig for this wire
187  float ttrigMean = 0;
188  float ttrigSigma = 0;
189  float kFactor = 0;
190  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
191  if (tTrigMap->get(wireId.superlayerId(), ttrigMean, ttrigSigma, kFactor, DTTimeUnits::ns) != 0) {
192  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
193  // FIXME: LogError.....
194  }
195 
196  tTrig = ttrigMean + kFactor * ttrigSigma;
197  t0cell = t0;
198 
199  return int(tTrig / theBXspace) * theBXspace + t0cell;
200 }

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

◆ offset() [1/2]

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

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

References gather_cfg::cout, debug, doTOFCorrection, doWirePropCorrection, Exception, phase1PixelTopology::layer, PV3DBase< T, PVType, FrameType >::mag(), mag(), GloballyPositioned< T >::position(), GeomDet::surface(), theTOFCorrType, theVPropWire, theWirePropCorrType, dttriganalyzer_cfi::tTrig, and DTWireId::wire().

◆ offset() [2/2]

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

157  {
158  float t0 = 0;
159  float t0rms = 0;
160  if (doT0Correction) {
161  // Read the t0 from pulses for this wire (ns)
162  tZeroMap->get(wireId, t0, t0rms, DTTimeUnits::ns);
163  }
164 
165  // Read the ttrig for this wire
166  float ttrigMean = 0;
167  float ttrigSigma = 0;
168  float kFactor = 0;
169  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
170  if (tTrigMap->get(wireId.superlayerId(), ttrigMean, ttrigSigma, kFactor, DTTimeUnits::ns) != 0) {
171  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
172  // FIXME: LogError.....
173  }
174 
175  return t0 + ttrigMean + kFactor * ttrigSigma;
176 }

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

◆ setES()

void DTTTrigSyncFromDB::setES ( const edm::EventSetup setup)
overridevirtual

Pass the Event Setup to the algo at each event.

Implements DTTTrigBaseSync.

Definition at line 44 of file DTTTrigSyncFromDB.cc.

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

References gather_cfg::cout, debug, doT0Correction, get, singleTopDQM_cfi::setup, thet0Label, thetTrigLabel, tTrigMap, tZeroMap, DTT0::version(), and DTTtrig::version().

Member Data Documentation

◆ debug

const bool DTTTrigSyncFromDB::debug
private

◆ doT0Correction

bool DTTTrigSyncFromDB::doT0Correction
private

Definition at line 95 of file DTTTrigSyncFromDB.h.

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

◆ doTOFCorrection

bool DTTTrigSyncFromDB::doTOFCorrection
private

Definition at line 97 of file DTTTrigSyncFromDB.h.

Referenced by offset().

◆ doWirePropCorrection

bool DTTTrigSyncFromDB::doWirePropCorrection
private

Definition at line 100 of file DTTTrigSyncFromDB.h.

Referenced by offset().

◆ theBXspace

double DTTTrigSyncFromDB::theBXspace
private

Definition at line 103 of file DTTTrigSyncFromDB.h.

Referenced by emulatorOffset().

◆ thet0Label

std::string DTTTrigSyncFromDB::thet0Label
private

Definition at line 106 of file DTTTrigSyncFromDB.h.

Referenced by setES().

◆ theTOFCorrType

int DTTTrigSyncFromDB::theTOFCorrType
private

Definition at line 98 of file DTTTrigSyncFromDB.h.

Referenced by offset().

◆ thetTrigLabel

std::string DTTTrigSyncFromDB::thetTrigLabel
private

Definition at line 105 of file DTTTrigSyncFromDB.h.

Referenced by setES().

◆ theVPropWire

double DTTTrigSyncFromDB::theVPropWire
private

Definition at line 93 of file DTTTrigSyncFromDB.h.

Referenced by offset().

◆ theWirePropCorrType

int DTTTrigSyncFromDB::theWirePropCorrType
private

Definition at line 101 of file DTTTrigSyncFromDB.h.

Referenced by offset().

◆ tTrigMap

const DTTtrig* DTTTrigSyncFromDB::tTrigMap
private

Definition at line 89 of file DTTTrigSyncFromDB.h.

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

◆ tZeroMap

const DTT0* DTTTrigSyncFromDB::tZeroMap
private

Definition at line 88 of file DTTTrigSyncFromDB.h.

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

DTTTrigSyncFromDB::doTOFCorrection
bool doTOFCorrection
Definition: DTTTrigSyncFromDB.h:97
DTWireId::wire
int wire() const
Return the wire number.
Definition: DTWireId.h:42
DTTTrigSyncFromDB::doWirePropCorrection
bool doWirePropCorrection
Definition: DTTTrigSyncFromDB.h:100
DTTtrig::version
const std::string & version() const
access version
Definition: DTTtrig.cc:162
DTTTrigSyncFromDB::tTrigMap
const DTTtrig * tTrigMap
Definition: DTTTrigSyncFromDB.h:89
DTTTrigSyncFromDB::debug
const bool debug
Definition: DTTTrigSyncFromDB.h:91
DTTtrigRcd
Definition: DTTtrigRcd.h:5
dttriganalyzer_cfi.tTrig
tTrig
Definition: dttriganalyzer_cfi.py:11
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTTTrigSyncFromDB::theWirePropCorrType
int theWirePropCorrType
Definition: DTTTrigSyncFromDB.h:101
DTTTrigSyncFromDB::tZeroMap
const DTT0 * tZeroMap
Definition: DTTTrigSyncFromDB.h:88
DTT0::version
const std::string & version() const
access version
Definition: DTT0.cc:82
DTSuperLayer
Definition: DTSuperLayer.h:24
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
DTT0Rcd
Definition: DTT0Rcd.h:9
DTTTrigSyncFromDB::theVPropWire
double theVPropWire
Definition: DTTTrigSyncFromDB.h:93
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTTTrigSyncFromDB::theTOFCorrType
int theTOFCorrType
Definition: DTTTrigSyncFromDB.h:98
config
Definition: config.py:1
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
DTT0::get
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
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:149
DTTimeUnits::ns
Definition: DTTimeUnits.h:32
edm::ESHandle
Definition: DTSurvey.h:22
DTTtrig::get
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:59
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
DTTTrigSyncFromDB::thet0Label
std::string thet0Label
Definition: DTTTrigSyncFromDB.h:106
createfilelist.int
int
Definition: createfilelist.py:10
get
#define get
DTTTrigSyncFromDB::doT0Correction
bool doT0Correction
Definition: DTTTrigSyncFromDB.h:95
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
DTTTrigSyncFromDB::theBXspace
double theBXspace
Definition: DTTTrigSyncFromDB.h:103
dttriganalyzer_cfi.kFactor
kFactor
Definition: dttriganalyzer_cfi.py:7
DTTTrigSyncFromDB::thetTrigLabel
std::string thetTrigLabel
Definition: DTTTrigSyncFromDB.h:105
Exception
Definition: hltDiff.cc:245
DTLayerId::superlayerId
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45
DTTTrigSyncFromDB::offset
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globPos, double &tTrig, double &wirePropCorr, double &tofCorr) const override
Definition: DTTTrigSyncFromDB.cc:64