CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual bool compute (const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
 
virtual bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, DTRecHit1D &newHit1D) const
 
virtual bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, const GlobalPoint &globPos, DTRecHit1D &newHit1D) const
 
 DTLinearDriftFromDBAlgo (const edm::ParameterSet &config)
 Constructor. More...
 
virtual void setES (const edm::EventSetup &setup)
 Pass the Event Setup to the algo at each event. More...
 
virtual ~DTLinearDriftFromDBAlgo ()
 Destructor. More...
 
- Public Member Functions inherited from DTRecHitBaseAlgo
 DTRecHitBaseAlgo (const edm::ParameterSet &config)
 Constructor. More...
 
virtual edm::OwnVector
< DTRecHit1DPair
reconstruct (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 float maxTime
 
const float minTime
 
const DTMtimemTimeMap
 
const bool stepTwoFromDigi
 

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 16 of file DTLinearDriftFromDBAlgo.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 21 of file DTLinearDriftFromDBAlgo.cc.

References gather_cfg::cout, and debug.

21  :
22  DTRecHitBaseAlgo(config),
23  minTime(config.getParameter<double>("minTime")),
24  maxTime(config.getParameter<double>("maxTime")),
25  doVdriftCorr(config.getParameter<bool>("doVdriftCorr")),
26  // Option to force going back to digi time at Step 2
27  stepTwoFromDigi(config.getParameter<bool>("stepTwoFromDigi")),
28  // Set verbose output
29  debug(config.getUntrackedParameter<bool>("debug"))
30 {
31  if(debug)
32  cout<<"[DTLinearDriftFromDBAlgo] Constructor called"<<endl;
33  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTRecHitBaseAlgo(const edm::ParameterSet &config)
Constructor.
tuple cout
Definition: gather_cfg.py:121
DTLinearDriftFromDBAlgo::~DTLinearDriftFromDBAlgo ( )
virtual

Destructor.

Definition at line 37 of file DTLinearDriftFromDBAlgo.cc.

37 {}

Member Function Documentation

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

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

61  {
62  // Get the wireId
63  DTLayerId layerId = layer->id();
64  const DTWireId wireId(layerId, digi.wire());
65 
66  // Get Wire position
67  if(!layer->specificTopology().isWireValid(digi.wire())) return false;
68  LocalPoint locWirePos(layer->specificTopology().wirePosition(digi.wire()), 0, 0);
69  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
70 
71  return compute(layer, wireId, digi.time(), globWirePos, leftPoint, rightPoint, error, 1);
72 }
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:47
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
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 DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTRecHit1D recHit1D,
const float &  angle,
DTRecHit1D newHit1D 
) const
virtual

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

80  {
81 
82  if (!stepTwoFromDigi) {
83  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
84  return true;
85  }
86 
87  const DTWireId wireId = recHit1D.wireId();
88 
89  // Get Wire position
90  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
91  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
92  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
93 
94  return compute(layer, wireId, recHit1D.digiTime(), globWirePos, newHit1D, 2);
95 
96 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
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
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:66
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
int wire() const
Return the wire number.
Definition: DTWireId.h:56
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:65
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
virtual

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

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

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

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

119  {
120  // Subtract the offset to the digi time accordingly to the DTTTrigBaseSync concrete instance
121  float driftTime = digiTime - theSync->offset(layer, wireId, globPos);
122 
123  // check for out-of-time
124  if (driftTime < minTime || driftTime > maxTime) {
125  if (debug) cout << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits "
126  << driftTime << endl;
127 
128  if(step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
129  // Hits are interpreted as coming from out-of-time pile-up and recHit
130  // is ignored.
131  return false;
132  }
133  }
134 
135  // Small negative times interpreted as hits close to the wire.
136  if (driftTime<0.) driftTime=0;
137 
138  // Read the vDrift and reso for this wire
139  float vDrift = 0;
140  float hitResolution = 0;//FIXME: should use this!
141  // vdrift is cm/ns , resolution is cm
142  mTimeMap->get(wireId.superlayerId(),
143  vDrift,
144  hitResolution,
146 
147  //only in step 3
148  if(doVdriftCorr && step == 3){
149  if (abs(wireId.wheel()) == 2 &&
150  wireId.station() == 1 &&
151  wireId.superLayer() != 2) {
152  // Variation of vdrift along Y due to B field,
154  // vdrift is lower a negative Y (lower global |Z|)
155  const float k_param = 1.2e-04;
156  LocalPoint local_pos = layer->toLocal(globPos);
157  vDrift = vDrift*(1. - k_param*local_pos.y());
158  }
159  }
160 
161  // Compute the drift distance
162  float drift = driftTime * vDrift;
163 
164  // Get Wire position
165  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
166  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
167  //Build the two possible points and the error on the position
168  leftPoint = LocalPoint(locWirePos.x()-drift,
169  locWirePos.y(),
170  locWirePos.z());
171  rightPoint = LocalPoint(locWirePos.x()+drift,
172  locWirePos.y(),
173  locWirePos.z());
174  error = LocalError(hitResolution*hitResolution,0.,0.);
175 
176 
177  if(debug) {
178  cout << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId << endl
179  << " Step: " << step << endl
180  << " Digi time: " << digiTime << endl
181  << " Drift time: " << driftTime << endl
182  << " Drift distance: " << drift << endl
183  << " Hit Resolution: " << hitResolution << endl
184  << " Left point: " << leftPoint << endl
185  << " Right point: " << rightPoint << endl
186  << " Error: " << error << endl;
187  }
188 
189  return true;
190 
191 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globalPos)
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:39
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
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
DTTTrigBaseSync * theSync
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:86
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:65
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
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 195 of file DTLinearDriftFromDBAlgo.cc.

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

200  {
201  LocalPoint leftPoint;
202  LocalPoint rightPoint;
204 
205  if(compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
206  // Set the position and the error of the rechit which is being updated
207  switch(newHit1D.lrSide()) {
208 
209  case DTEnums::Left:
210  {
211  // Keep the original y position of newHit1D: for step==3, it's the
212  // position along the wire. Needed for rotation alignment
213  LocalPoint leftPoint3D(leftPoint.x(), newHit1D.localPosition().y(), leftPoint.z());
214  newHit1D.setPositionAndError(leftPoint3D, error);
215  break;
216  }
217 
218  case DTEnums::Right:
219  {
220  // as above: 3d position
221  LocalPoint rightPoint3D(rightPoint.x(), newHit1D.localPosition().y(), rightPoint.z());
222  newHit1D.setPositionAndError(rightPoint3D, error);
223  break;
224  }
225 
226  default:
227  throw cms::Exception("InvalidDTCellSide") << "[DTLinearDriftFromDBAlgo] Compute at Step "
228  << step << ", Hit side "
229  << newHit1D.lrSide()
230  << " is invalid!" << endl;
231  return false;
232  }
233 
234  return true;
235  }else {
236  return false;
237  }
238 }
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
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)
virtual

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 41 of file DTLinearDriftFromDBAlgo.cc.

References gather_cfg::cout, debug, edm::EventSetup::get(), mTimeMap, DTTTrigBaseSync::setES(), DTRecHitBaseAlgo::theSync, and DTMtime::version().

41  {
42  if(debug)
43  cout<<"[DTLinearDriftFromDBAlgo] setES called"<<endl;
44  theSync->setES(setup);
45  // Get the map of ttrig from the Setup
46  ESHandle<DTMtime> mTimeHandle;
47  setup.get<DTMtimeRcd>().get(mTimeHandle);
48  mTimeMap = &*mTimeHandle;
49 
50  if(debug)
51  cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version()<<endl;
52 }
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the synchronization module at each event.
DTTTrigBaseSync * theSync
const T & get() const
Definition: EventSetup.h:55
const std::string & version() const
access version
Definition: DTMtime.cc:247
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

const bool DTLinearDriftFromDBAlgo::debug
private

Definition at line 99 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), DTLinearDriftFromDBAlgo(), and setES().

const bool DTLinearDriftFromDBAlgo::doVdriftCorr
private

Definition at line 92 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

const float DTLinearDriftFromDBAlgo::maxTime
private

Definition at line 89 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().

const float DTLinearDriftFromDBAlgo::minTime
private

Definition at line 86 of file DTLinearDriftFromDBAlgo.h.

const DTMtime* DTLinearDriftFromDBAlgo::mTimeMap
private

Definition at line 83 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().

const bool DTLinearDriftFromDBAlgo::stepTwoFromDigi
private

Definition at line 96 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute().