CMS 3D CMS Logo

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

#include <DTParametrizedDriftAlgo.h>

Inheritance diagram for DTParametrizedDriftAlgo:
DTRecHitBaseAlgo

Public Member Functions

bool compute (const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override
 
bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, DTRecHit1D &newHit1D) const override
 
bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, const GlobalPoint &globPos, DTRecHit1D &newHit1D) const override
 
 DTParametrizedDriftAlgo (const edm::ParameterSet &config, edm::ConsumesCollector)
 Constructor. More...
 
void setES (const edm::EventSetup &setup) override
 Pass the Event Setup to the algo at each event. More...
 
 ~DTParametrizedDriftAlgo () override
 Destructor. More...
 
- Public Member Functions inherited from DTRecHitBaseAlgo
 DTRecHitBaseAlgo (const edm::ParameterSet &config, edm::ConsumesCollector)
 Constructor. More...
 
virtual edm::OwnVector< DTRecHit1DPairreconstruct (const DTLayer *layer, const DTLayerId &layerId, const DTDigiCollection::Range &digiRange)
 Build all hits in the range associated to the layerId, at the 1st step. More...
 
virtual ~DTRecHitBaseAlgo ()
 Destructor. More...
 

Private Member Functions

virtual bool compute (const DTLayer *layer, const DTWireId &wireId, const float digiTime, const float &angle, const GlobalPoint &globPos, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error, int step) const
 
virtual bool compute (const DTLayer *layer, const DTWireId &wireId, const float digiTime, const float &angle, const GlobalPoint &globPos, DTRecHit1D &newHit1D, int step) const
 

Private Attributes

const bool debug
 
const bool interpolate
 
const MagneticFieldmagField
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
const float maxTime
 
const float minTime
 

Additional Inherited Members

- Protected Attributes inherited from DTRecHitBaseAlgo
std::unique_ptr< DTTTrigBaseSynctheSync
 

Detailed Description

Concrete implementation of DTRecHitBaseAlgo. Compute drift distance using the CIEMAT (by P.Garcia Abia and J. Puerta) parametrization of the cell behavior obtained with GARFIELD

Author
G. Cerminara - INFN Torino

Definition at line 18 of file DTParametrizedDriftAlgo.h.

Constructor & Destructor Documentation

◆ DTParametrizedDriftAlgo()

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

Constructor.

Definition at line 28 of file DTParametrizedDriftAlgo.cc.

30  interpolate(config.getParameter<bool>("interpolate")),
31  minTime(config.getParameter<double>("minTime")), // FIXME: Default was -3 ns
32  maxTime(config.getParameter<double>("maxTime")), // FIXME: Default was 415 ns
33  // Set verbose output
34  debug(config.getUntrackedParameter<bool>("debug", "false")),
35  magField(nullptr),
36  magFieldToken_(cc.esConsumes()) {}
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
Definition: config.py:1
const MagneticField * magField
DTRecHitBaseAlgo(const edm::ParameterSet &config, edm::ConsumesCollector)
Constructor.
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_

◆ ~DTParametrizedDriftAlgo()

DTParametrizedDriftAlgo::~DTParametrizedDriftAlgo ( )
override

Destructor.

Definition at line 38 of file DTParametrizedDriftAlgo.cc.

38 {}

Member Function Documentation

◆ compute() [1/5]

bool DTParametrizedDriftAlgo::compute ( const DTLayer layer,
const DTDigi digi,
LocalPoint leftPoint,
LocalPoint rightPoint,
LocalError error 
) const
overridevirtual

First step in computation of Left/Right hits from a Digi. The results are the local position (in DTLayer frame) of the Left and Right hit, and the error (which is common). The center of the wire is assumed as hit coordinate along y. Returns false on failure.

Implements DTRecHitBaseAlgo.

◆ compute() [2/5]

bool DTParametrizedDriftAlgo::compute ( const DTLayer layer,
const DTRecHit1D recHit1D,
const float &  angle,
DTRecHit1D newHit1D 
) const
overridevirtual

Second step. The impact angle is given as input, and it's used to improve the hit position (and relative error). The angle is defined in radians, with respect to the perpendicular to the layer plane. Given the local direction, angle=atan(dir.x()/-dir.z()) . This can be used when a SL segment is built, so the impact angle is known but the position along wire is not. NOTE: Only position and error of the new hit are modified

Implements DTRecHitBaseAlgo.

◆ compute() [3/5]

bool DTParametrizedDriftAlgo::compute ( const DTLayer layer,
const DTRecHit1D recHit1D,
const float &  angle,
const GlobalPoint globPos,
DTRecHit1D newHit1D 
) const
overridevirtual

Third (and final) step in hits position computation. In addition the the angle, also the global position of the hit is given as input. This allows to get the magnetic field at the hit position (and not only that at the center of the wire). Also the position along the wire is available and can be used to correct the drift time for particle TOF and propagation of signal along the wire. NOTE: Only position and error of the new hit are modified

Implements DTRecHitBaseAlgo.

◆ compute() [4/5]

bool DTParametrizedDriftAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const float &  angle,
const GlobalPoint globPos,
LocalPoint leftPoint,
LocalPoint rightPoint,
LocalError error,
int  step 
) const
privatevirtual

Definition at line 101 of file DTParametrizedDriftAlgo.cc.

References funct::abs(), angle(), DTTime2DriftParametrization::computeDriftDistance_mean(), gather_cfg::cout, debug, shallow::drift(), relativeConstraints::error, alignBH_cfg::fixed, HiCaloJetParameters_cff::interpolate, nano_mu_digi_cff::layer, M_PI, HLT_2023v12_cff::maxTime, mathSSE::sqrt(), DTSuperLayerId::superlayer(), DTTime2DriftParametrization::drift_distance::v_drift, DTChamberId::wheel(), makeMuonMisalignmentScenario::wheel, DTWireId::wire(), PV3DBase< T, PVType, FrameType >::x(), DTTime2DriftParametrization::drift_distance::x_drift, DTTime2DriftParametrization::drift_distance::x_width_m, DTTime2DriftParametrization::drift_distance::x_width_p, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

109  {
110  // Subtract Offset according to DTTTrigBaseSync concrete instance
111  // chosen with the 'tZeroMode' parameter
112  float driftTime = digiTime - theSync->offset(layer, wireId, globPos);
113 
114  // check for out-of-time only at step 1
115  if (step == 1 && (driftTime < minTime || driftTime > maxTime)) {
116  if (debug)
117  cout << "*** Drift time out of window for in-time hits " << driftTime << endl;
118 
119  if (step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
120  // Hits are interpreted as coming from out-of-time pile-up and recHit
121  // is ignored.
122  return false;
123  }
124  }
125 
126  // Small negative times interpreted as hits close to the wire.
127  if (driftTime < 0.)
128  driftTime = 0;
129 
130  //----------------------------------------------------------------------
131  // Magnetic Field in layer frame
132  const LocalVector BLoc = layer->toLocal(magField->inTesla(globPos));
133 
134  float By = BLoc.y();
135  float Bz = BLoc.z();
136 
137  //--------------------------------------------------------------------
138  // Calculate the drift distance and the resolution from the parametrization
139 
141  static const DTTime2DriftParametrization par;
142 
143  bool parStatus = par.computeDriftDistance_mean(driftTime, angle, By, Bz, interpolate, &DX);
144 
145  if (!parStatus) {
146  if (debug)
147  cout << "[DTParametrizedDriftAlgo]*** WARNING: call to parametrization failed" << endl;
148  return false;
149  }
150 
151  float sigma_l = DX.x_width_m;
152  float sigma_r = DX.x_width_p;
153  float drift = DX.x_drift;
154 
155  float reso = 0;
156 
157  bool variableSigma = false;
158  // By defualt the errors are obtained from a fit of the residuals in the various
159  // stations/SL.
160  // The error returned by DTTime2DriftParametrization can not be used easily
161  // to determine the hit error due to the way the parametrization of the error
162  // is done (please contcat the authors for details).
163  // Anyhow changing variableSigma==true, an attempt is done to set a variable error
164  // according to the sigma calculated by DTTime2DriftParametrization.
165  // Additionally, contributions from uncertaionties in TOF and signal propagation
166  // corrections are added.
167  // Uncertainty in the determination of incident angle and hit position
168  // (ie B value) are NOT accounted.
169  // This is not the default since it does not give good results...
170 
171  int wheel = abs(wireId.wheel());
172  if (variableSigma) {
173  float sTDelays = 0;
174  if (step == 1) { // 1. step
175  reso = (sigma_l + sigma_r) / 2.; // FIXME: theta/B are not yet known...
176  if (wireId.superlayer() == 2) { // RZ
177  sTDelays = 2.92;
178  } else { // RPhi
179  if (wheel == 0) {
180  sTDelays = 2.74;
181  } else if (wheel == 1) {
182  sTDelays = 1.83;
183  } else if (wheel == 2) {
184  sTDelays = 1.25;
185  }
186  }
187  } else if (step == 2) { // 2. step
188  reso = (sigma_l + sigma_r) / 2.; // FIXME: B is not yet known...
189  if (wireId.superlayer() == 2) { // RZ
190  sTDelays = 0.096;
191  } else { // RPhi
192  if (wheel == 0) {
193  sTDelays = 0.022;
194  } else if (wheel == 1) {
195  sTDelays = 0.079;
196  } else if (wheel == 2) {
197  sTDelays = 0.124;
198  }
199  }
200  } else if (step == 3) { // 3. step
201  reso = (sigma_l + sigma_r) / 2.;
202  if (wireId.superlayer() == 2) { // RZ
203  sTDelays = 0.096;
204  } else { // RPhi
205  if (wheel == 0) {
206  sTDelays = 0.022;
207  } else if (wheel == 1) {
208  sTDelays = 0.079;
209  } else if (wheel == 2) {
210  sTDelays = 0.124;
211  }
212  }
213  }
214  float sXDelays = sTDelays * DX.v_drift / 10.;
215  reso = sqrt(reso * reso + sXDelays * sXDelays);
216  } else { // Use a fixed sigma, from fit of residuals.
217  if (step == 1) { // 1. step
218  if (wireId.superlayer() == 2) {
219  if (wheel == 0) {
220  reso = 0.0250;
221  } else if (wheel == 1) {
222  reso = 0.0271;
223  } else if (wheel == 2) {
224  reso = 0.0308;
225  }
226  } else {
227  reso = 0.0237;
228  }
229  } else if (step == 2) { // 2. step //FIXME
230  if (wireId.superlayer() == 2) {
231  if (wheel == 0) {
232  reso = 0.0250;
233  } else if (wheel == 1) {
234  reso = 0.0271;
235  } else if (wheel == 2) {
236  reso = 0.0305;
237  }
238  } else {
239  reso = 0.0231;
240  }
241  } else if (step == 3) { // 3. step
242  if (wireId.superlayer() == 2) {
243  if (wheel == 0) {
244  reso = 0.0196;
245  } else if (wheel == 1) {
246  reso = 0.0210;
247  } else if (wheel == 2) {
248  reso = 0.0228;
249  }
250  } else {
251  reso = 0.0207;
252  }
253  }
254  }
255  //--------------------------------------------------------------------
256 
257  error = LocalError(reso * reso, 0., 0.);
258 
259  // Get Wire position
260  if (!layer->specificTopology().isWireValid(wireId.wire()))
261  return false;
262  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
263 
264  //Build the two possible points and the error on the position
265  leftPoint = LocalPoint(locWirePos.x() - drift, locWirePos.y(), locWirePos.z());
266  rightPoint = LocalPoint(locWirePos.x() + drift, locWirePos.y(), locWirePos.z());
267 
268  if (debug) {
269  int prevW = cout.width();
270  cout << setiosflags(ios::showpoint | ios::fixed) << setw(3) << "[DTParametrizedDriftAlgo]: step " << step << endl
271  << " Global Position " << globPos << endl
272  << " Local Position " << layer->toLocal(globPos)
273  << endl
274  // << " y along Wire " << wireCoord << endl
275  << " Digi time " << digiTime
276  << endl
277  // << " dpropDelay " << propDelay << endl
278  // << " deltaTOF " << deltaTOF << endl
279  << " >Drif time " << driftTime << endl
280  << " >Angle " << angle * 180. / M_PI << endl
281  << " <Drift distance " << drift << endl
282  << " <sigma_l " << sigma_l << endl
283  << " <sigma_r " << sigma_r << endl
284  << " reso " << reso << endl
285  << " leftPoint " << leftPoint << endl
286  << " rightPoint " << rightPoint << endl
287  << " error " << error << resetiosflags(ios::showpoint | ios::fixed) << setw(prevW) << endl
288  << endl;
289  }
290 
291  return true;
292 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
int wire() const
Return the wire number.
Definition: DTWireId.h:42
T z() const
Definition: PV3DBase.h:61
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
const MagneticField * magField
T y() const
Definition: PV3DBase.h:60
bool computeDriftDistance_mean(double time, double alpha, double by, double bz, short interpolate, drift_distance *dx) const
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
int superlayer() const
Return the superlayer number (deprecated method name)
std::unique_ptr< DTTTrigBaseSync > theSync
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
step
Definition: StallMonitor.cc:98
Structure used to return output values.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ compute() [5/5]

bool DTParametrizedDriftAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const float &  angle,
const GlobalPoint globPos,
DTRecHit1D newHit1D,
int  step 
) const
privatevirtual

Definition at line 295 of file DTParametrizedDriftAlgo.cc.

References angle(), bookConverter::compute(), relativeConstraints::error, Exception, nano_mu_digi_cff::layer, DTEnums::Left, DTRecHit1D::localPosition(), DTRecHit1D::lrSide(), DTEnums::Right, DTRecHit1D::setPositionAndError(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

301  {
302  LocalPoint leftPoint;
303  LocalPoint rightPoint;
305 
306  if (compute(layer, wireId, digiTime, angle, globPos, leftPoint, rightPoint, error, step)) {
307  // Set the position and the error of the rechit which is being updated
308  switch (newHit1D.lrSide()) {
309  case DTEnums::Left: {
310  // Keep the original y position of newHit1D: for step==3, it's the
311  // position along the wire. Needed for rotation alignment
312  LocalPoint leftPoint3D(leftPoint.x(), newHit1D.localPosition().y(), leftPoint.z());
313  newHit1D.setPositionAndError(leftPoint3D, error);
314  break;
315  }
316 
317  case DTEnums::Right: {
318  // as above: 3d position
319  LocalPoint rightPoint3D(rightPoint.x(), newHit1D.localPosition().y(), rightPoint.z());
320  newHit1D.setPositionAndError(rightPoint3D, error);
321  break;
322  }
323 
324  default:
325  throw cms::Exception("InvalidDTCellSide") << "[DTParametrizedDriftAlgo] Compute at Step " << step
326  << ", Hit side " << newHit1D.lrSide() << " is invalid!" << endl;
327  return false;
328  }
329 
330  return true;
331  } else {
332  return false;
333  }
334 }
T z() const
Definition: PV3DBase.h:61
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
DTEnums::DTCellSide lrSide() const
The side of the cell.
Definition: DTRecHit1D.h:61
step
Definition: StallMonitor.cc:98
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:70
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:47
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ setES()

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

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 40 of file DTParametrizedDriftAlgo.cc.

References singleTopDQM_cfi::setup.

40  {
41  theSync->setES(setup);
42  // Access the magnetic field
43  magField = &setup.getData(magFieldToken_);
44 }
const MagneticField * magField
std::unique_ptr< DTTTrigBaseSync > theSync
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_

Member Data Documentation

◆ debug

const bool DTParametrizedDriftAlgo::debug
private

◆ interpolate

const bool DTParametrizedDriftAlgo::interpolate
private

Definition at line 69 of file DTParametrizedDriftAlgo.h.

◆ magField

const MagneticField* DTParametrizedDriftAlgo::magField
private

Definition at line 101 of file DTParametrizedDriftAlgo.h.

◆ magFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> DTParametrizedDriftAlgo::magFieldToken_
private

Definition at line 102 of file DTParametrizedDriftAlgo.h.

◆ maxTime

const float DTParametrizedDriftAlgo::maxTime
private

Definition at line 75 of file DTParametrizedDriftAlgo.h.

◆ minTime

const float DTParametrizedDriftAlgo::minTime
private

Definition at line 72 of file DTParametrizedDriftAlgo.h.