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, DTRecHit1D &newHit1D) const override
 
bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, const GlobalPoint &globPos, 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, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error, int step) const
 
virtual bool compute (const DTLayer *layer, const DTWireId &wireId, const float digiTime, const GlobalPoint &globPos, DTRecHit1D &newHit1D, 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
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 ( const edm::ParameterSet config)

Constructor.

Definition at line 26 of file DTLinearDriftFromDBAlgo.cc.

26  :
27  DTRecHitBaseAlgo(config),
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")){}
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTRecHitBaseAlgo(const edm::ParameterSet &config)
Constructor.
const MagneticField * field
DTLinearDriftFromDBAlgo::~DTLinearDriftFromDBAlgo ( )
override

Destructor.

Definition at line 42 of file DTLinearDriftFromDBAlgo.cc.

42 {}

Member Function Documentation

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 77 of file DTLinearDriftFromDBAlgo.cc.

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

Referenced by compute().

81  {
82  // Get the wireId
83  DTLayerId layerId = layer->id();
84  const DTWireId wireId(layerId, digi.wire());
85 
86  // Get Wire position
87  if(!layer->specificTopology().isWireValid(digi.wire())) return false;
88  LocalPoint locWirePos(layer->specificTopology().wirePosition(digi.wire()), 0, 0);
89  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
90 
91  return compute(layer, wireId, digi.time(), globWirePos, leftPoint, rightPoint, error, 1);
92 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
DTLayerId id() const
Return the DetId of this SL.
Definition: DTLayer.cc:46
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
int wire() const
Return wire number.
Definition: DTDigi.cc:67
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
double time() const
Get time in ns.
Definition: DTDigi.cc:63
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:65
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override
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 97 of file DTLinearDriftFromDBAlgo.cc.

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

100  {
101 
102  if (!stepTwoFromDigi) {
103  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
104  return true;
105  }
106 
107  const DTWireId wireId = recHit1D.wireId();
108 
109  // Get Wire position
110  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
111  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
112  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
113 
114  return compute(layer, wireId, recHit1D.digiTime(), globWirePos, newHit1D, 2);
115 
116 }
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:66
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
Definition: DTRecHit1D.h:113
int wire() const
Return the wire number.
Definition: DTWireId.h:56
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:65
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:100
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
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 121 of file DTLinearDriftFromDBAlgo.cc.

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

125  {
126  return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
127 }
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
Definition: DTRecHit1D.h:113
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
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 132 of file DTLinearDriftFromDBAlgo.cc.

References funct::abs(), createfilelist::args, DTVelocityUnits::cm_per_ns, gather_cfg::cout, debug, doVdriftCorr, shallow::drift(), DTRecoConditions::get(), DTMtime::get(), DTLinearDriftAlgo_cfi::hitResolution, DTTopology::isWireValid(), maxTime, mTimeMap, nominalB, DTTTrigBaseSync::offset(), 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().

139  {
140  // Subtract the offset to the digi time accordingly to the DTTTrigBaseSync concrete instance
141  float driftTime = digiTime - theSync->offset(layer, wireId, globPos);
142 
143  // check for out-of-time
144  if (driftTime < minTime || driftTime > maxTime) {
145  if (debug) cout << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits "
146  << driftTime << endl;
147 
148  if(step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
149  // Hits are interpreted as coming from out-of-time pile-up and recHit
150  // is ignored.
151  return false;
152  }
153  }
154 
155  // Small negative times interpreted as hits close to the wire.
156  if (driftTime<0.) driftTime=0;
157 
158  // Read the vDrift and reso for this wire
159  float vDrift = 0;
160  float hitResolution = 0;
161  // vdrift is cm/ns , resolution is cm
162  mTimeMap->get(wireId.superlayerId(),
163  vDrift,
164  hitResolution, // Value from vdrift DB; replaced below if useUncertDB card is set
166 
167  if (useUncertDB) {
168  // Read the uncertainty from the DB for the given channel and step
169  double args[1] = {double(step-1)};
170  hitResolution = uncertMap->get(wireId, args);
171  }
172 
173  //only in step 3
174  if(doVdriftCorr && step == 3 && nominalB !=0){
175  if (abs(wireId.wheel()) == 2 &&
176  wireId.station() == 1 &&
177  wireId.superLayer() != 2) {
178  // Variation of vdrift along Y due to B field,
180  // vdrift is lower a negative Y (lower global |Z|)
181  const float k_param = 1.2e-04;
182  LocalPoint local_pos = layer->toLocal(globPos);
183  vDrift = vDrift*(1. - k_param*local_pos.y());
184  }
185  }
186 
187  // Compute the drift distance
188  float drift = driftTime * vDrift;
189 
190  // Get Wire position
191  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
192  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
193  //Build the two possible points and the error on the position
194  leftPoint = LocalPoint(locWirePos.x()-drift,
195  locWirePos.y(),
196  locWirePos.z());
197  rightPoint = LocalPoint(locWirePos.x()+drift,
198  locWirePos.y(),
199  locWirePos.z());
200  error = LocalError(hitResolution*hitResolution,0.,0.);
201 
202 
203  if(debug) {
204  cout << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId << endl
205  << " Step: " << step << endl
206  << " Digi time: " << digiTime << endl
207  << " Drift time: " << driftTime << endl
208  << " Drift distance: " << drift << endl
209  << " Hit Resolution: " << hitResolution << endl
210  << " Left point: " << leftPoint << endl
211  << " Right point: " << rightPoint << endl
212  << " Error: " << error << endl;
213  }
214 
215  return true;
216 
217 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globalPos)
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:38
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
int superLayer() const
Return the superlayer number.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const DTRecoConditions * uncertMap
DTTTrigBaseSync * theSync
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...
int wire() const
Return the wire number.
Definition: DTWireId.h:56
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
Definition: DTMtime.cc:82
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:65
step
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
bool DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const GlobalPoint globPos,
DTRecHit1D newHit1D,
int  step 
) const
privatevirtual

Definition at line 221 of file DTLinearDriftFromDBAlgo.cc.

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().

226  {
227  LocalPoint leftPoint;
228  LocalPoint rightPoint;
230 
231  if(compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
232  // Set the position and the error of the rechit which is being updated
233  switch(newHit1D.lrSide()) {
234 
235  case DTEnums::Left:
236  {
237  // Keep the original y position of newHit1D: for step==3, it's the
238  // position along the wire. Needed for rotation alignment
239  LocalPoint leftPoint3D(leftPoint.x(), newHit1D.localPosition().y(), leftPoint.z());
240  newHit1D.setPositionAndError(leftPoint3D, error);
241  break;
242  }
243 
244  case DTEnums::Right:
245  {
246  // as above: 3d position
247  LocalPoint rightPoint3D(rightPoint.x(), newHit1D.localPosition().y(), rightPoint.z());
248  newHit1D.setPositionAndError(rightPoint3D, error);
249  break;
250  }
251 
252  default:
253  throw cms::Exception("InvalidDTCellSide") << "[DTLinearDriftFromDBAlgo] Compute at Step "
254  << step << ", Hit side "
255  << newHit1D.lrSide()
256  << " is invalid!" << endl;
257  return false;
258  }
259 
260  return true;
261  }else {
262  return false;
263  }
264 }
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override
step
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:100
T x() const
Definition: PV3DBase.h:62
DTEnums::DTCellSide lrSide() const
The side of the cell.
Definition: DTRecHit1D.h:82
void DTLinearDriftFromDBAlgo::setES ( const edm::EventSetup setup)
overridevirtual

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 46 of file DTLinearDriftFromDBAlgo.cc.

References gather_cfg::cout, debug, field, edm::EventSetup::get(), mTimeMap, nominalB, MagneticField::nominalValue(), DTTTrigBaseSync::setES(), DTRecHitBaseAlgo::theSync, uncertMap, useUncertDB, DTRecoConditions::version(), and DTMtime::version().

46  {
47  if(debug)
48  cout<<"[DTLinearDriftFromDBAlgo] setES called"<<endl;
49  theSync->setES(setup);
50  // Get the map of ttrig from the Setup
51  ESHandle<DTMtime> mTimeHandle;
52  setup.get<DTMtimeRcd>().get(mTimeHandle);
53  mTimeMap = &*mTimeHandle;
54 
55  ESHandle<MagneticField> magfield;
56  setup.get<IdealMagneticFieldRecord>().get(magfield);
57  field = &*magfield;
59 
60  if (useUncertDB) {
62  setup.get<DTRecoConditionsUncertRcd>().get(uncerts);
63  uncertMap = &*uncerts;
64  if (uncertMap->version()>1) edm::LogError("NotImplemented") << "DT Uncertainty DB version unsupported: " << uncertMap->version();
65  }
66 
67  if(debug) {
68  cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version()<<endl;
69  if (useUncertDB) cout << " uncertDB version: " << uncertMap->version()<<endl;
70  }
71 
72 }
int version() const
Version numer specifying the structure of the payload. See .cc file for details.
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:56
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the synchronization module at each event.
const DTRecoConditions * uncertMap
const MagneticField * field
DTTTrigBaseSync * theSync
const T & get() const
Definition: EventSetup.h:55
const std::string & version() const
access version
Definition: DTMtime.cc:233

Member Data Documentation

const bool DTLinearDriftFromDBAlgo::debug
private

Definition at line 112 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

const bool DTLinearDriftFromDBAlgo::doVdriftCorr
private

Definition at line 101 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

const MagneticField* DTLinearDriftFromDBAlgo::field
private

Definition at line 88 of file DTLinearDriftFromDBAlgo.h.

Referenced by setES().

const float DTLinearDriftFromDBAlgo::maxTime
private

Definition at line 98 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

const float DTLinearDriftFromDBAlgo::minTime
private

Definition at line 95 of file DTLinearDriftFromDBAlgo.h.

const DTMtime* DTLinearDriftFromDBAlgo::mTimeMap
private

Definition at line 85 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

int DTLinearDriftFromDBAlgo::nominalB
private

Definition at line 89 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

const bool DTLinearDriftFromDBAlgo::stepTwoFromDigi
private

Definition at line 105 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

const DTRecoConditions* DTLinearDriftFromDBAlgo::uncertMap
private

Definition at line 92 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

bool DTLinearDriftFromDBAlgo::useUncertDB
private

Definition at line 109 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().