CMS 3D CMS Logo

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

#include <DTLinearDriftFromDBAlgo.h>

Inheritance diagram for DTLinearDriftFromDBAlgo:
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, const GlobalPoint &globPos, DTRecHit1D &newHit1D) const override
 
bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, DTRecHit1D &newHit1D) const override
 
 DTLinearDriftFromDBAlgo (const edm::ParameterSet &config)
 Constructor. More...
 
void setES (const edm::EventSetup &setup) override
 Pass the Event Setup to the algo at each event. More...
 
 ~DTLinearDriftFromDBAlgo () override
 Destructor. More...
 
- Public Member Functions inherited from DTRecHitBaseAlgo
 DTRecHitBaseAlgo (const edm::ParameterSet &config)
 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 GlobalPoint &globPos, DTRecHit1D &newHit1D, int step) const
 
virtual bool compute (const DTLayer *layer, const DTWireId &wireId, const float digiTime, const GlobalPoint &globPos, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error, int step) const
 

Private Attributes

const bool debug
 
const bool doVdriftCorr
 
const MagneticFieldfield
 
const float maxTime
 
const float minTime
 
const DTMtimemTimeMap
 
int nominalB
 
const bool stepTwoFromDigi
 
const DTRecoConditionsuncertMap
 
bool useUncertDB
 

Additional Inherited Members

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

Detailed Description

Concrete implementation of DTRecHitBaseAlgo. Compute drift distance using constant drift velocity read from database.

Author
S.Bolognesi - INFN Torino

Definition at line 18 of file DTLinearDriftFromDBAlgo.h.

Constructor & Destructor Documentation

◆ DTLinearDriftFromDBAlgo()

DTLinearDriftFromDBAlgo::DTLinearDriftFromDBAlgo ( const edm::ParameterSet config)

Constructor.

Definition at line 26 of file DTLinearDriftFromDBAlgo.cc.

28  mTimeMap(nullptr),
29  field(nullptr),
30  nominalB(-1),
31  minTime(config.getParameter<double>("minTime")),
32  maxTime(config.getParameter<double>("maxTime")),
33  doVdriftCorr(config.getParameter<bool>("doVdriftCorr")),
34  // Option to force going back to digi time at Step 2
35  stepTwoFromDigi(config.getParameter<bool>("stepTwoFromDigi")),
36  useUncertDB(config.getParameter<bool>("useUncertDB")),
37  // Set verbose output
38  debug(config.getUntrackedParameter<bool>("debug")) {}

◆ ~DTLinearDriftFromDBAlgo()

DTLinearDriftFromDBAlgo::~DTLinearDriftFromDBAlgo ( )
override

Destructor.

Definition at line 40 of file DTLinearDriftFromDBAlgo.cc.

40 {}

Member Function Documentation

◆ compute() [1/5]

bool DTLinearDriftFromDBAlgo::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). Returns false on failure. The hit is assumed to be at the wire center.

Implements DTRecHitBaseAlgo.

Definition at line 72 of file DTLinearDriftFromDBAlgo.cc.

73  {
74  // Get the wireId
75  DTLayerId layerId = layer->id();
76  const DTWireId wireId(layerId, digi.wire());
77 
78  // Get Wire position
79  if (!layer->specificTopology().isWireValid(digi.wire()))
80  return false;
81  LocalPoint locWirePos(layer->specificTopology().wirePosition(digi.wire()), 0, 0);
82  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
83 
84  return compute(layer, wireId, digi.time(), globWirePos, leftPoint, rightPoint, error, 1);
85 }

References relativeConstraints::error, DTLayer::id(), DTTopology::isWireValid(), DTLayer::specificTopology(), DTDigi::time(), GeomDet::toGlobal(), DTDigi::wire(), and DTTopology::wirePosition().

Referenced by compute().

◆ compute() [2/5]

bool DTLinearDriftFromDBAlgo::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. Also the hit 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.

Definition at line 109 of file DTLinearDriftFromDBAlgo.cc.

113  {
114  return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
115 }

References compute(), DTRecHit1D::digiTime(), and DTRecHit1D::wireId().

◆ compute() [3/5]

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

Second step in hit position computation. It is the same as first step since the angular information is not used NOTE: Only position and error of the new hit are modified

Implements DTRecHitBaseAlgo.

Definition at line 88 of file DTLinearDriftFromDBAlgo.cc.

91  {
92  if (!stepTwoFromDigi) {
93  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
94  return true;
95  }
96 
97  const DTWireId wireId = recHit1D.wireId();
98 
99  // Get Wire position
100  if (!layer->specificTopology().isWireValid(wireId.wire()))
101  return false;
102  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
103  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
104 
105  return compute(layer, wireId, recHit1D.digiTime(), globWirePos, newHit1D, 2);
106 }

References compute(), DTRecHit1D::digiTime(), DTTopology::isWireValid(), DTRecHit1D::localPosition(), DTRecHit1D::localPositionError(), DTRecHit1D::setPositionAndError(), DTLayer::specificTopology(), stepTwoFromDigi, GeomDet::toGlobal(), DTWireId::wire(), DTRecHit1D::wireId(), and DTTopology::wirePosition().

◆ compute() [4/5]

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

Definition at line 200 of file DTLinearDriftFromDBAlgo.cc.

205  {
206  LocalPoint leftPoint;
207  LocalPoint rightPoint;
209 
210  if (compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
211  // Set the position and the error of the rechit which is being updated
212  switch (newHit1D.lrSide()) {
213  case DTEnums::Left: {
214  // Keep the original y position of newHit1D: for step==3, it's the
215  // position along the wire. Needed for rotation alignment
216  LocalPoint leftPoint3D(leftPoint.x(), newHit1D.localPosition().y(), leftPoint.z());
217  newHit1D.setPositionAndError(leftPoint3D, error);
218  break;
219  }
220 
221  case DTEnums::Right: {
222  // as above: 3d position
223  LocalPoint rightPoint3D(rightPoint.x(), newHit1D.localPosition().y(), rightPoint.z());
224  newHit1D.setPositionAndError(rightPoint3D, error);
225  break;
226  }
227 
228  default:
229  throw cms::Exception("InvalidDTCellSide") << "[DTLinearDriftFromDBAlgo] Compute at Step " << step
230  << ", Hit side " << newHit1D.lrSide() << " is invalid!" << endl;
231  return false;
232  }
233 
234  return true;
235  } else {
236  return false;
237  }
238 }

References compute(), relativeConstraints::error, Exception, 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().

◆ compute() [5/5]

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

cf. http://arxiv.org/PS_cache/arxiv/pdf/0911/0911.4895v2.pdf

Definition at line 118 of file DTLinearDriftFromDBAlgo.cc.

125  {
126  // Subtract the offset to the digi time accordingly to the DTTTrigBaseSync concrete instance
127  float driftTime = digiTime - theSync->offset(layer, wireId, globPos);
128 
129  // check for out-of-time
130  if (driftTime < minTime || driftTime > maxTime) {
131  if (debug)
132  cout << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits " << driftTime << endl;
133 
134  if (step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
135  // Hits are interpreted as coming from out-of-time pile-up and recHit
136  // is ignored.
137  return false;
138  }
139  }
140 
141  // Small negative times interpreted as hits close to the wire.
142  if (driftTime < 0.)
143  driftTime = 0;
144 
145  // Read the vDrift and reso for this wire
146  float vDrift = 0;
147  float hitResolution = 0;
148  // vdrift is cm/ns , resolution is cm
149  mTimeMap->get(wireId.superlayerId(),
150  vDrift,
151  hitResolution, // Value from vdrift DB; replaced below if useUncertDB card is set
153 
154  if (useUncertDB) {
155  // Read the uncertainty from the DB for the given channel and step
156  double args[1] = {double(step - 1)};
157  hitResolution = uncertMap->get(wireId, args);
158  }
159 
160  //only in step 3
161  if (doVdriftCorr && step == 3 && nominalB != 0) {
162  if (abs(wireId.wheel()) == 2 && wireId.station() == 1 && wireId.superLayer() != 2) {
163  // Variation of vdrift along Y due to B field,
165  // vdrift is lower a negative Y (lower global |Z|)
166  const float k_param = 1.2e-04;
167  LocalPoint local_pos = layer->toLocal(globPos);
168  vDrift = vDrift * (1. - k_param * local_pos.y());
169  }
170  }
171 
172  // Compute the drift distance
173  float drift = driftTime * vDrift;
174 
175  // Get Wire position
176  if (!layer->specificTopology().isWireValid(wireId.wire()))
177  return false;
178  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
179  //Build the two possible points and the error on the position
180  leftPoint = LocalPoint(locWirePos.x() - drift, locWirePos.y(), locWirePos.z());
181  rightPoint = LocalPoint(locWirePos.x() + drift, locWirePos.y(), locWirePos.z());
183 
184  if (debug) {
185  cout << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId << endl
186  << " Step: " << step << endl
187  << " Digi time: " << digiTime << endl
188  << " Drift time: " << driftTime << endl
189  << " Drift distance: " << drift << endl
190  << " Hit Resolution: " << hitResolution << endl
191  << " Left point: " << leftPoint << endl
192  << " Right point: " << rightPoint << endl
193  << " Error: " << error << endl;
194  }
195 
196  return true;
197 }

References funct::abs(), writedatasetfile::args, DTVelocityUnits::cm_per_ns, gather_cfg::cout, debug, doVdriftCorr, shallow::drift(), relativeConstraints::error, DTRecoConditions::get(), DTMtime::get(), DTLinearDriftAlgo_cfi::hitResolution, DTTopology::isWireValid(), maxTime, mTimeMap, nominalB, DTLayer::specificTopology(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTLayerId::superlayerId(), DTRecHitBaseAlgo::theSync, GeomDet::toLocal(), uncertMap, useUncertDB, DTChamberId::wheel(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ setES()

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

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 42 of file DTLinearDriftFromDBAlgo.cc.

42  {
43  if (debug)
44  cout << "[DTLinearDriftFromDBAlgo] setES called" << endl;
45  theSync->setES(setup);
46  // Get the map of ttrig from the Setup
47  ESHandle<DTMtime> mTimeHandle;
48  setup.get<DTMtimeRcd>().get(mTimeHandle);
49  mTimeMap = &*mTimeHandle;
50 
53  field = &*magfield;
55 
56  if (useUncertDB) {
58  setup.get<DTRecoConditionsUncertRcd>().get(uncerts);
59  uncertMap = &*uncerts;
60  if (uncertMap->version() > 1)
61  edm::LogError("NotImplemented") << "DT Uncertainty DB version unsupported: " << uncertMap->version();
62  }
63 
64  if (debug) {
65  cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version() << endl;
66  if (useUncertDB)
67  cout << " uncertDB version: " << uncertMap->version() << endl;
68  }
69 }

References gather_cfg::cout, debug, field, get, volumeBasedMagneticField_160812_cfi::magfield, mTimeMap, nominalB, MagneticField::nominalValue(), singleTopDQM_cfi::setup, DTRecHitBaseAlgo::theSync, uncertMap, useUncertDB, DTRecoConditions::version(), and DTMtime::version().

Member Data Documentation

◆ debug

const bool DTLinearDriftFromDBAlgo::debug
private

◆ doVdriftCorr

const bool DTLinearDriftFromDBAlgo::doVdriftCorr
private

Definition at line 96 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

◆ field

const MagneticField* DTLinearDriftFromDBAlgo::field
private

Definition at line 83 of file DTLinearDriftFromDBAlgo.h.

Referenced by setES().

◆ maxTime

const float DTLinearDriftFromDBAlgo::maxTime
private

Definition at line 93 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

◆ minTime

const float DTLinearDriftFromDBAlgo::minTime
private

Definition at line 90 of file DTLinearDriftFromDBAlgo.h.

◆ mTimeMap

const DTMtime* DTLinearDriftFromDBAlgo::mTimeMap
private

Definition at line 80 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

◆ nominalB

int DTLinearDriftFromDBAlgo::nominalB
private

Definition at line 84 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

◆ stepTwoFromDigi

const bool DTLinearDriftFromDBAlgo::stepTwoFromDigi
private

Definition at line 100 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

◆ uncertMap

const DTRecoConditions* DTLinearDriftFromDBAlgo::uncertMap
private

Definition at line 87 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

◆ useUncertDB

bool DTLinearDriftFromDBAlgo::useUncertDB
private

Definition at line 104 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

writedatasetfile.args
args
Definition: writedatasetfile.py:18
DTWireId::wire
int wire() const
Return the wire number.
Definition: DTWireId.h:42
step
step
Definition: StallMonitor.cc:94
DTTopology::isWireValid
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:64
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DTRecHit1D::lrSide
DTEnums::DTCellSide lrSide() const
The side of the cell.
Definition: DTRecHit1D.h:61
DTLinearDriftFromDBAlgo::useUncertDB
bool useUncertDB
Definition: DTLinearDriftFromDBAlgo.h:104
DTLinearDriftFromDBAlgo::maxTime
const float maxTime
Definition: DTLinearDriftFromDBAlgo.h:93
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
DTRecHit1D::localPositionError
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:50
relativeConstraints.error
error
Definition: relativeConstraints.py:53
DTDigi::time
double time() const
Get time in ns.
Definition: DTDigi.cc:37
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTRecoConditions::get
float get(const DTWireId &wireid, double *x=nullptr) const
Get the value correspoding to the given WireId, / using x[] as parameters of the parametrization when...
Definition: DTRecoConditions.cc:42
DTRecHit1D::setPositionAndError
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:70
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
config
Definition: config.py:1
DTTopology::wirePosition
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:59
DTRecHit1D::wireId
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:76
DTEnums::Left
Definition: DTEnums.h:15
shallow::drift
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
DTDigi::wire
int wire() const
Return wire number.
Definition: DTDigi.cc:41
DTRecoConditions::version
int version() const
Version numer specifying the structure of the payload. See .cc file for details.
Definition: DTRecoConditions.h:43
DTLinearDriftFromDBAlgo::doVdriftCorr
const bool doVdriftCorr
Definition: DTLinearDriftFromDBAlgo.h:96
DTRecHitBaseAlgo::theSync
std::unique_ptr< DTTTrigBaseSync > theSync
Definition: DTRecHitBaseAlgo.h:81
DTWireId
Definition: DTWireId.h:12
edm::ESHandle< DTMtime >
MagneticField::nominalValue
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
Point3DBase< float, LocalTag >
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
DTLayerId
Definition: DTLayerId.h:12
DTRecHit1D::localPosition
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:47
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
edm::LogError
Definition: MessageLogger.h:183
DTVelocityUnits::cm_per_ns
Definition: DTVelocityUnits.h:32
LocalError
Definition: LocalError.h:12
DTLinearDriftFromDBAlgo::uncertMap
const DTRecoConditions * uncertMap
Definition: DTLinearDriftFromDBAlgo.h:87
DTLinearDriftFromDBAlgo::minTime
const float minTime
Definition: DTLinearDriftFromDBAlgo.h:90
DTLayer::id
DTLayerId id() const
Return the DetId of this SL.
Definition: DTLayer.cc:39
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
DTMtime::version
const std::string & version() const
access version
Definition: DTMtime.cc:158
DTLinearDriftFromDBAlgo::nominalB
int nominalB
Definition: DTLinearDriftFromDBAlgo.h:84
DTLinearDriftFromDBAlgo::debug
const bool debug
Definition: DTLinearDriftFromDBAlgo.h:107
DTRecHitBaseAlgo::DTRecHitBaseAlgo
DTRecHitBaseAlgo(const edm::ParameterSet &config)
Constructor.
Definition: DTRecHitBaseAlgo.cc:17
DTRecoConditionsUncertRcd
Definition: DTRecoConditionsUncertRcd.h:5
DTLinearDriftFromDBAlgo::mTimeMap
const DTMtime * mTimeMap
Definition: DTLinearDriftFromDBAlgo.h:80
get
#define get
DTLinearDriftAlgo_cfi.hitResolution
hitResolution
Definition: DTLinearDriftAlgo_cfi.py:13
DTRecHit1D::digiTime
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
Definition: DTRecHit1D.h:79
DTLinearDriftFromDBAlgo::field
const MagneticField * field
Definition: DTLinearDriftFromDBAlgo.h:83
DTEnums::Right
Definition: DTEnums.h:15
DTLinearDriftFromDBAlgo::stepTwoFromDigi
const bool stepTwoFromDigi
Definition: DTLinearDriftFromDBAlgo.h:100
DTLinearDriftFromDBAlgo::compute
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override
Definition: DTLinearDriftFromDBAlgo.cc:72
Exception
Definition: hltDiff.cc:246
DTLayerId::superlayerId
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45
DTLayer::specificTopology
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
DTMtime::get
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
Definition: DTMtime.cc:56
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
DTMtimeRcd
Definition: DTMtimeRcd.h:5