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 | Static 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 DTMtimemTimeMap
 

Static Private Attributes

static bool debug
 
static float maxTime
 
static float minTime
 

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.

Date:
2006/09/13 09:40:10
Revision:
1.1
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 23 of file DTLinearDriftFromDBAlgo.cc.

References gather_cfg::cout, debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxTime, and minTime.

23  :
24  DTRecHitBaseAlgo(config) {
25 
26  minTime = config.getParameter<double>("minTime");
27 
28  maxTime = config.getParameter<double>("maxTime");
29 
30  // Set verbose output
31  debug = config.getUntrackedParameter<bool>("debug");
32  if(debug)
33  cout<<"[DTLinearDriftFromDBAlgo] Constructor called"<<endl;
34  }
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:41
DTLinearDriftFromDBAlgo::~DTLinearDriftFromDBAlgo ( )
virtual

Destructor.

Definition at line 38 of file DTLinearDriftFromDBAlgo.cc.

38 {}

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

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

Referenced by compute().

62  {
63  // Get the wireId
64  DTLayerId layerId = layer->id();
65  const DTWireId wireId(layerId, digi.wire());
66 
67  // Get Wire position
68  if(!layer->specificTopology().isWireValid(digi.wire())) return false;
69  LocalPoint locWirePos(layer->specificTopology().wirePosition(digi.wire()), 0, 0);
70  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
71 
72  return compute(layer, wireId, digi.time(), globWirePos, leftPoint, rightPoint, error, 1);
73 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:73
DTLayerId id() const
Return the DetId of this SL.
Definition: DTLayer.cc:48
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
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:69
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
double time() const
Get time in ns.
Definition: DTDigi.cc:65
const bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:67
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 78 of file DTLinearDriftFromDBAlgo.cc.

References DTRecHit1D::localPosition(), DTRecHit1D::localPositionError(), and DTRecHit1D::setPositionAndError().

81  {
82  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
83  return true;
84 }
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:68
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:62
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:102
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 89 of file DTLinearDriftFromDBAlgo.cc.

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

93  {
94  return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
95 }
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:115
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109
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

Definition at line 100 of file DTLinearDriftFromDBAlgo.cc.

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

107  {
108  // Subtract the offset to the digi time accordingly to the DTTTrigBaseSync concrete instance
109  float driftTime = digiTime - theSync->offset(layer, wireId, globPos);
110 
111  // check for out-of-time
112  if (driftTime < minTime || driftTime > maxTime) {
113  if (debug) cout << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits "
114  << driftTime << endl;
115 
116  if(step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
117  // Hits are interpreted as coming from out-of-time pile-up and recHit
118  // is ignored.
119  return false;
120  }
121  }
122 
123  // Small negative times interpreted as hits close to the wire.
124  if (driftTime<0.) driftTime=0;
125 
126  // Read the vDrift and reso for this wire
127  float vDrift = 0;
128  float hitResolution = 0;//FIXME: should use this!
129  // vdrift is cm/ns , resolution is cm
130  mTimeMap->get(wireId.superlayerId(),
131  vDrift,
132  hitResolution,
134 
135 
136  // Compute the drift distance
137  float drift = driftTime * vDrift;
138 
139  // Get Wire position
140  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
141  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
142  //Build the two possible points and the error on the position
143  leftPoint = LocalPoint(locWirePos.x()-drift,
144  locWirePos.y(),
145  locWirePos.z());
146  rightPoint = LocalPoint(locWirePos.x()+drift,
147  locWirePos.y(),
148  locWirePos.z());
149  error = LocalError(hitResolution*hitResolution,0.,0.);
150 
151 
152  if(debug) {
153  cout << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId << endl
154  << " Step: " << step << endl
155  << " Digi time: " << digiTime << endl
156  << " Drift time: " << driftTime << endl
157  << " Drift distance: " << drift << endl
158  << " Hit Resolution: " << hitResolution << endl
159  << " Left point: " << leftPoint << endl
160  << " Right point: " << rightPoint << endl
161  << " Error: " << error << endl;
162  }
163 
164  return true;
165 
166 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:73
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:57
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
DTTTrigBaseSync * theSync
int wire() const
Return the wire number.
Definition: DTWireId.h:58
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
Definition: DTMtime.cc:86
const bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:67
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:41
bool DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const GlobalPoint globPos,
DTRecHit1D newHit1D,
int  step 
) const
privatevirtual

Definition at line 170 of file DTLinearDriftFromDBAlgo.cc.

References compute(), 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().

175  {
176  LocalPoint leftPoint;
177  LocalPoint rightPoint;
179 
180  if(compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
181  // Set the position and the error of the rechit which is being updated
182  switch(newHit1D.lrSide()) {
183 
184  case DTEnums::Left:
185  {
186  // Keep the original y position of newHit1D: for step==3, it's the
187  // position along the wire. Needed for rotation alignment
188  LocalPoint leftPoint3D(leftPoint.x(), newHit1D.localPosition().y(), leftPoint.z());
189  newHit1D.setPositionAndError(leftPoint3D, error);
190  break;
191  }
192 
193  case DTEnums::Right:
194  {
195  // as above: 3d position
196  LocalPoint rightPoint3D(rightPoint.x(), newHit1D.localPosition().y(), rightPoint.z());
197  newHit1D.setPositionAndError(rightPoint3D, error);
198  break;
199  }
200 
201  default:
202  throw cms::Exception("InvalidDTCellSide") << "[DTLinearDriftFromDBAlgo] Compute at Step "
203  << step << ", Hit side "
204  << newHit1D.lrSide()
205  << " is invalid!" << endl;
206  return false;
207  }
208 
209  return true;
210  }else {
211  return false;
212  }
213 }
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
T y() const
Definition: PV3DBase.h:57
T z() const
Definition: PV3DBase.h:58
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:62
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:102
T x() const
Definition: PV3DBase.h:56
DTEnums::DTCellSide lrSide() const
The side of the cell.
Definition: DTRecHit1D.h:84
void DTLinearDriftFromDBAlgo::setES ( const edm::EventSetup setup)
virtual

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 42 of file DTLinearDriftFromDBAlgo.cc.

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

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 
51  if(debug)
52  cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version()<<endl;
53 }
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:41

Member Data Documentation

bool DTLinearDriftFromDBAlgo::debug
staticprivate

Definition at line 94 of file DTLinearDriftFromDBAlgo.h.

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

float DTLinearDriftFromDBAlgo::maxTime
staticprivate

Definition at line 91 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and DTLinearDriftFromDBAlgo().

float DTLinearDriftFromDBAlgo::minTime
staticprivate

Definition at line 88 of file DTLinearDriftFromDBAlgo.h.

Referenced by DTLinearDriftFromDBAlgo().

const DTMtime* DTLinearDriftFromDBAlgo::mTimeMap
private

Definition at line 85 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().