CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTTTrigSyncFromDB Class Reference
Inheritance diagram for DTTTrigSyncFromDB:
DTTTrigBaseSync

Public Member Functions

 DTTTrigSyncFromDB (const edm::ParameterSet &config, edm::ConsumesCollector)
 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
 
edm::ESGetToken< DTT0, DTT0Rcdt0Token_
 
double theBXspace
 
int theTOFCorrType
 
double theVPropWire
 
int theWirePropCorrType
 
const DTTtrigtTrigMap
 
const edm::ESGetToken< DTTtrig, DTTtrigRcdttrigToken_
 
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 57 of file DTTTrigSyncFromDB.cc.

Constructor & Destructor Documentation

◆ DTTTrigSyncFromDB()

DTTTrigSyncFromDB::DTTTrigSyncFromDB ( const edm::ParameterSet config,
edm::ConsumesCollector  cc 
)

Constructor.

Definition at line 116 of file DTTTrigSyncFromDB.cc.

References gpuPixelDoublets::cc, doT0Correction, and t0Token_.

117  : ttrigToken_(cc.esConsumes(edm::ESInputTag("", config.getParameter<string>("tTrigLabel")))),
118  debug(config.getUntrackedParameter<bool>("debug")),
119  // The velocity of signal propagation along the wire (cm/ns)
120  theVPropWire(config.getParameter<double>("vPropWire")),
121  // Switch on/off the T0 correction from pulses
122  doT0Correction(config.getParameter<bool>("doT0Correction")),
123  // Switch on/off the TOF correction for particles from IP
124  doTOFCorrection(config.getParameter<bool>("doTOFCorrection")),
125  theTOFCorrType(config.getParameter<int>("tofCorrType")),
126  // Switch on/off the correction for the signal propagation along the wire
127  doWirePropCorrection(config.getParameter<bool>("doWirePropCorrection")),
128  theWirePropCorrType(config.getParameter<int>("wirePropCorrType")),
129  // spacing of BX in ns
130  theBXspace(config.getUntrackedParameter<double>("bxSpace", 25.)) {
131  if (doT0Correction) {
132  t0Token_ = cc.esConsumes(edm::ESInputTag("", config.getParameter<string>("t0Label")));
133  }
134 }
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
Definition: config.py:1
edm::ESGetToken< DTT0, DTT0Rcd > t0Token_
const edm::ESGetToken< DTTtrig, DTTtrigRcd > ttrigToken_

◆ ~DTTTrigSyncFromDB()

DTTTrigSyncFromDB::~DTTTrigSyncFromDB ( )
override

Destructor.

Definition at line 136 of file DTTTrigSyncFromDB.cc.

136 {}

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

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.

268  {
269  float t0 = 0;
270  float t0rms = 0;
271  if (doT0Correction) {
272  // Read the t0 from pulses for this wire (ns)
273  tZeroMap->get(wireId, t0, t0rms, DTTimeUnits::ns);
274  }
275 
276  // Read the ttrig for this wire
277  float ttrigMean = 0;
278  float ttrigSigma = 0;
279  float kFactor = 0;
280  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
281  if (tTrigMap->get(wireId.superlayerId(), ttrigMean, ttrigSigma, kFactor, DTTimeUnits::ns) != 0) {
282  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
283  // FIXME: LogError.....
284  }
285 
286  tTrig = ttrigMean + kFactor * ttrigSigma;
287  t0cell = t0;
288 
289  return int(tTrig / theBXspace) * theBXspace + t0cell;
290 }
const DTTtrig * tTrigMap
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
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
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45

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

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

159  {
160  // Correction for the float to int conversion while writeing the ttrig in ns into an int variable
161  // (half a bin on average)
162  // FIXME: this should disappear as soon as the ttrig object will become a float
163  // static const float f2i_convCorr = (25./64.); // ns //FIXME: check how the conversion is performed
164 
165  tTrig = offset(wireId);
166 
167  // Compute the time spent in signal propagation along wire.
168  // NOTE: the FE is always at y>0
169  wirePropCorr = 0;
170  if (doWirePropCorrection) {
171  switch (theWirePropCorrType) {
172  // The ttrig computed from the timebox accounts on average for the signal propagation time
173  // from the center of the wire to the frontend. Here we just have to correct for
174  // the distance of the hit from the wire center.
175  case 0: {
176  float wireCoord = layer->toLocal(globPos).y();
177  wirePropCorr = -wireCoord / theVPropWire;
178  break;
179  // FIXME: What if hits used for the time box are not distributed uniformly along the wire?
180  }
181  //On simulated data you need to subtract the total propagation time
182  case 1: {
183  float halfL = layer->specificTopology().cellLenght() / 2;
184  float wireCoord = layer->toLocal(globPos).y();
185  float propgL = halfL - wireCoord;
186  wirePropCorr = propgL / theVPropWire;
187  break;
188  }
189  default: {
190  throw cms::Exception("[DTTTrigSyncFromDB]")
191  << " Invalid parameter: wirePropCorrType = " << theWirePropCorrType << std::endl;
192  break;
193  }
194  }
195  }
196 
197  // Compute TOF correction:
198  tofCorr = 0.;
199  // TOF Correction can be switched off with appropriate parameter
200  if (doTOFCorrection) {
201  float flightToHit = globPos.mag();
202  static const float cSpeed = 29.9792458; // cm/ns
203  switch (theTOFCorrType) {
204  case 0: {
205  // The ttrig computed from the real data accounts on average for the TOF correction
206  // Depending on the granularity used for the ttrig computation we just have to correct for the
207  // TOF from the center of the chamber, SL, layer or wire to the hit position.
208  // At the moment only SL granularity is considered
209  // Correction for TOF from the center of the SL to hit position
210  const DTSuperLayer* sl = layer->superLayer();
211  double flightToSL = sl->surface().position().mag();
212  tofCorr = (flightToSL - flightToHit) / cSpeed;
213  break;
214  }
215  case 1: {
216  // On simulated data you need to consider only the TOF from 3D center of the wire to hit position
217  // (because the TOF from the IP to the wire has been already subtracted in the digitization:
218  // SimMuon/DTDigitizer/DTDigiSyncTOFCorr.cc corrType=2)
219  float flightToWire =
220  layer->toGlobal(LocalPoint(layer->specificTopology().wirePosition(wireId.wire()), 0., 0.)).mag();
221  tofCorr = (flightToWire - flightToHit) / cSpeed;
222  break;
223  }
224  default: {
225  throw cms::Exception("[DTTTrigSyncFromDB]")
226  << " Invalid parameter: tofCorrType = " << theTOFCorrType << std::endl;
227  break;
228  }
229  }
230  }
231 
232  if (debug) {
233  cout << "[DTTTrigSyncFromDB] Channel: " << wireId << endl
234  << " Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl
235  << " various contributions are: " << endl
236  << " tTrig + t0 (ns): " << tTrig
237  << endl
238  //<< " tZero (ns): " << t0 << endl
239  << " Propagation along wire delay (ns): " << wirePropCorr << endl
240  << " TOF correction (ns): " << tofCorr << endl
241  << endl;
242  }
243  //The global offset is the sum of various contributions
244  return tTrig + wirePropCorr - tofCorr;
245 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globPos, double &tTrig, double &wirePropCorr, double &tofCorr) const override
int wire() const
Return the wire number.
Definition: DTWireId.h:42
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
T mag() const
Definition: PV3DBase.h:64
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const PositionType & position() const

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

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

247  {
248  float t0 = 0;
249  float t0rms = 0;
250  if (doT0Correction) {
251  // Read the t0 from pulses for this wire (ns)
252  tZeroMap->get(wireId, t0, t0rms, DTTimeUnits::ns);
253  }
254 
255  // Read the ttrig for this wire
256  float ttrigMean = 0;
257  float ttrigSigma = 0;
258  float kFactor = 0;
259  // FIXME: should check the return value of the DTTtrigRcd::get(..) method
260  if (tTrigMap->get(wireId.superlayerId(), ttrigMean, ttrigSigma, kFactor, DTTimeUnits::ns) != 0) {
261  cout << "[DTTTrigSyncFromDB]*Error: ttrig not found for SL: " << wireId.superlayerId() << endl;
262  // FIXME: LogError.....
263  }
264 
265  return t0 + ttrigMean + kFactor * ttrigSigma;
266 }
const DTTtrig * tTrigMap
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
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
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45

◆ setES()

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

Pass the Event Setup to the algo at each event.

Implements DTTTrigBaseSync.

Definition at line 138 of file DTTTrigSyncFromDB.cc.

References gather_cfg::cout, debug, doT0Correction, singleTopDQM_cfi::setup, t0Token_, tTrigMap, ttrigToken_, tZeroMap, DTT0::version(), and DTTtrig::version().

138  {
139  if (doT0Correction) {
140  // Get the map of t0 from pulses from the Setup
141  tZeroMap = &setup.getData(t0Token_);
142  if (debug) {
143  cout << "[DTTTrigSyncFromDB] t0 version: " << tZeroMap->version() << endl;
144  }
145  }
146 
147  // Get the map of ttrig from the Setup
148  tTrigMap = &setup.getData(ttrigToken_);
149  if (debug) {
150  cout << "[DTTTrigSyncFromDB] ttrig version: " << tTrigMap->version() << endl;
151  }
152 }
const DTTtrig * tTrigMap
const std::string & version() const
access version
Definition: DTTtrig.cc:162
edm::ESGetToken< DTT0, DTT0Rcd > t0Token_
const std::string & version() const
access version
Definition: DTT0.cc:82
const edm::ESGetToken< DTTtrig, DTTtrigRcd > ttrigToken_

Member Data Documentation

◆ debug

const bool DTTTrigSyncFromDB::debug
private

◆ doT0Correction

bool DTTTrigSyncFromDB::doT0Correction
private

Definition at line 102 of file DTTTrigSyncFromDB.cc.

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

◆ doTOFCorrection

bool DTTTrigSyncFromDB::doTOFCorrection
private

Definition at line 104 of file DTTTrigSyncFromDB.cc.

Referenced by offset().

◆ doWirePropCorrection

bool DTTTrigSyncFromDB::doWirePropCorrection
private

Definition at line 107 of file DTTTrigSyncFromDB.cc.

Referenced by offset().

◆ t0Token_

edm::ESGetToken<DTT0, DTT0Rcd> DTTTrigSyncFromDB::t0Token_
private

Definition at line 93 of file DTTTrigSyncFromDB.cc.

Referenced by DTTTrigSyncFromDB(), and setES().

◆ theBXspace

double DTTTrigSyncFromDB::theBXspace
private

Definition at line 110 of file DTTTrigSyncFromDB.cc.

Referenced by emulatorOffset().

◆ theTOFCorrType

int DTTTrigSyncFromDB::theTOFCorrType
private

Definition at line 105 of file DTTTrigSyncFromDB.cc.

Referenced by offset().

◆ theVPropWire

double DTTTrigSyncFromDB::theVPropWire
private

Definition at line 100 of file DTTTrigSyncFromDB.cc.

Referenced by offset().

◆ theWirePropCorrType

int DTTTrigSyncFromDB::theWirePropCorrType
private

Definition at line 108 of file DTTTrigSyncFromDB.cc.

Referenced by offset().

◆ tTrigMap

const DTTtrig* DTTTrigSyncFromDB::tTrigMap
private

Definition at line 96 of file DTTTrigSyncFromDB.cc.

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

◆ ttrigToken_

const edm::ESGetToken<DTTtrig, DTTtrigRcd> DTTTrigSyncFromDB::ttrigToken_
private

Definition at line 94 of file DTTTrigSyncFromDB.cc.

Referenced by setES().

◆ tZeroMap

const DTT0* DTTTrigSyncFromDB::tZeroMap
private

Definition at line 95 of file DTTTrigSyncFromDB.cc.

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