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 | Static Private Attributes
DTNoDriftAlgo Class Reference

#include <DTNoDriftAlgo.h>

Inheritance diagram for DTNoDriftAlgo:
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
 
 DTNoDriftAlgo (const edm::ParameterSet &config)
 Constructor. More...
 
virtual edm::OwnVector
< DTRecHit1DPair
reconstruct (const DTLayer *layer, const DTLayerId &layerId, const DTDigiCollection::Range &digiRange)
 
virtual void setES (const edm::EventSetup &setup)
 Pass the Event Setup to the algo at each event. More...
 
virtual ~DTNoDriftAlgo ()
 Destructor. More...
 
- Public Member Functions inherited from DTRecHitBaseAlgo
 DTRecHitBaseAlgo (const edm::ParameterSet &config)
 Constructor. 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
 

Static Private Attributes

static bool debug
 
static float fixedDrift
 
static float hitResolution
 
static float maxTime
 
static float minTime
 

Additional Inherited Members

- Protected Attributes inherited from DTRecHitBaseAlgo
DTTTrigBaseSynctheSync
 

Detailed Description

Concrete implementation of DTRecHitBaseAlgo. Create pair of RecHits at fixed distance from the wire.

Date:
2007/04/19 11:08:17
Revision:
1.1
Author
Martijn Mulders - CERN (marti.nosp@m.jn.m.nosp@m.ulder.nosp@m.s@ce.nosp@m.rn.ch) based on DTLinearDriftAlgo

Definition at line 19 of file DTNoDriftAlgo.h.

Constructor & Destructor Documentation

DTNoDriftAlgo::DTNoDriftAlgo ( const edm::ParameterSet config)

Constructor.

Definition at line 20 of file DTNoDriftAlgo.cc.

References debug, fixedDrift, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitResolution, maxTime, and minTime.

20  :
21  DTRecHitBaseAlgo(config) {
22 
23  minTime = config.getParameter<double>("minTime");
24 
25  maxTime = config.getParameter<double>("maxTime");
26 
27  fixedDrift = config.getParameter<double>("fixedDrift");
28 
29  hitResolution = config.getParameter<double>("hitResolution"); // Set to size of (half)cell
30  // Set verbose output
31  debug = config.getUntrackedParameter<bool>("debug");
32 
33  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static bool debug
static float maxTime
DTRecHitBaseAlgo(const edm::ParameterSet &config)
Constructor.
static float hitResolution
Definition: DTNoDriftAlgo.h:98
static float fixedDrift
Definition: DTNoDriftAlgo.h:95
static float minTime
DTNoDriftAlgo::~DTNoDriftAlgo ( )
virtual

Destructor.

Definition at line 37 of file DTNoDriftAlgo.cc.

37 {}

Member Function Documentation

bool DTNoDriftAlgo::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 98 of file DTNoDriftAlgo.cc.

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

Referenced by compute(), and reconstruct().

102  {
103  // Get the wireId
104  DTLayerId layerId = layer->id();
105  const DTWireId wireId(layerId, digi.wire());
106 
107  // Get Wire position
108  if(!layer->specificTopology().isWireValid(digi.wire())) return false;
109  LocalPoint locWirePos(layer->specificTopology().wirePosition(digi.wire()), 0, 0);
110  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
111 
112  return compute(layer, wireId, digi.time(), globWirePos, leftPoint, rightPoint, error, 1);
113 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
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:47
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
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:67
bool DTNoDriftAlgo::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 118 of file DTNoDriftAlgo.cc.

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

121  {
122  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
123  return true;
124 }
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 DTNoDriftAlgo::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 129 of file DTNoDriftAlgo.cc.

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

133  {
134  return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
135 }
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 DTNoDriftAlgo::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 140 of file DTNoDriftAlgo.cc.

References gather_cfg::cout, debug, shallow::drift(), fixedDrift, hitResolution, DTTopology::isWireValid(), maxTime, DTLayer::specificTopology(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

147  {
148  //}
149 
150  // Small negative times interpreted as hits close to the wire.
151  //if (driftTime<0.) driftTime=0;
152 
153 
154  // check for out-of-time
155  if (digiTime < minTime || digiTime > maxTime) {
156  if (debug) cout << "[DTNoDriftAlgo]*** Drift time out of window for in-time hits "
157  << digiTime << endl;
158 
159  if(step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
160  // Hits are interpreted as coming from out-of-time pile-up and recHit
161  // is ignored.
162  return false;
163  }
164  }
165 
166 
167  // Compute the drift distance
168  float drift = fixedDrift;
169 
170  // Get Wire position
171  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
172  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
173  //Build the two possible points and the error on the position
174  leftPoint = LocalPoint(locWirePos.x()-drift,
175  locWirePos.y(),
176  locWirePos.z());
177  rightPoint = LocalPoint(locWirePos.x()+drift,
178  locWirePos.y(),
179  locWirePos.z());
180  error = LocalError(hitResolution*hitResolution,0.,0.);
181 
182 
183  if(debug) {
184  cout << "[DTNoDriftAlgo] Compute drift distance, for digi at wire: " << wireId << endl
185  << " Step: " << step << endl
186  << " Digi time: " << digiTime << endl
187  // << " Drift time: " << driftTime << endl
188  << " Fixed Drift distance: " << drift << endl
189  << " Hit Resolution: " << hitResolution << endl
190  << " Left point: " << leftPoint << endl
191  << " Right point: " << rightPoint << endl
192  << " Error: " << error << endl;
193  }
194 
195 
196 
197  return true;
198 
199 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
static bool debug
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:39
T y() const
Definition: PV3DBase.h:63
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
static float maxTime
int wire() const
Return the wire number.
Definition: DTWireId.h:58
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:67
static float hitResolution
Definition: DTNoDriftAlgo.h:98
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
static float fixedDrift
Definition: DTNoDriftAlgo.h:95
bool DTNoDriftAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const GlobalPoint globPos,
DTRecHit1D newHit1D,
int  step 
) const
privatevirtual

Definition at line 203 of file DTNoDriftAlgo.cc.

References compute(), error, edm::hlt::Exception, DTEnums::Left, DTRecHit1D::lrSide(), DTEnums::Right, and DTRecHit1D::setPositionAndError().

208  {
209  LocalPoint leftPoint;
210  LocalPoint rightPoint;
212 
213  if(compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
214  // Set the position and the error of the rechit which is being updated
215  switch(newHit1D.lrSide()) {
216 
217  case DTEnums::Left:
218  newHit1D.setPositionAndError(leftPoint, error);
219  break;
220 
221  case DTEnums::Right:
222  newHit1D.setPositionAndError(rightPoint, error);
223  break;
224 
225  default:
226  throw cms::Exception("InvalidDTCellSide") << "[DTNoDriftAlgo] Compute at Step "
227  << step << ", Hit side "
228  << newHit1D.lrSide()
229  << " is invalid!" << endl;
230  return false;
231  }
232 
233  return true;
234  }else {
235  return false;
236  }
237 }
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:102
DTEnums::DTCellSide lrSide() const
The side of the cell.
Definition: DTRecHit1D.h:84
OwnVector< DTRecHit1DPair > DTNoDriftAlgo::reconstruct ( const DTLayer layer,
const DTLayerId layerId,
const DTDigiCollection::Range digiRange 
)
virtual

MM: Override virtual function from DTRecHitBaseAlgo–> for the NoDrift algorithm only a maximum of one hit per wire is allowed! Build all hits in the range associated to the layerId, at the 1st step.

Reimplemented from DTRecHitBaseAlgo.

Definition at line 49 of file DTNoDriftAlgo.cc.

References edm::OwnVector< T, P >::begin(), compute(), edm::OwnVector< T, P >::end(), DTEnums::Left, edm::OwnVector< T, P >::push_back(), query::result, DTEnums::Right, and DTRecHit1DPair::setPositionAndError().

51  {
53 
54  // Loop over all digis in the given range
55  for (DTDigiCollection::const_iterator digi = digiRange.first;
56  digi != digiRange.second;
57  digi++) {
58  // Get the wireId
59  DTWireId wireId(layerId, (*digi).wire());
60 
61  bool isDouble = false;
62  for (OwnVector<DTRecHit1DPair>::const_iterator doubleWireCheck = result.begin();
63  doubleWireCheck != result.end();
64  doubleWireCheck++) {
65  if( wireId == (*doubleWireCheck).wireId()) {
66  isDouble = true;
67  // std::cout << " Reject this hit with time " << (*digi).time() << std::endl;
68  break;
69  }
70  }
71 
72  if (isDouble) continue;
73 
74  LocalError tmpErr;
75  LocalPoint lpoint, rpoint;
76  // Call the compute method
77  bool OK = compute(layer, *digi, lpoint, rpoint, tmpErr);
78 
79  if (!OK) continue;
80 
81  // Build a new pair of 1D rechit
82  DTRecHit1DPair* recHitPair = new DTRecHit1DPair(wireId, *digi);
83 
84  // Set the position and the error of the 1D rechits
85  recHitPair->setPositionAndError(DTEnums::Left, lpoint, tmpErr);
86  recHitPair->setPositionAndError(DTEnums::Right, rpoint, tmpErr);
87 
88  result.push_back(recHitPair);
89  }
90  return result;
91 }
pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:70
iterator begin()
Definition: OwnVector.h:227
void push_back(D *&d)
Definition: OwnVector.h:273
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint &point, const LocalError &err)
tuple result
Definition: query.py:137
iterator end()
Definition: OwnVector.h:232
std::vector< DigiType >::const_iterator const_iterator
void DTNoDriftAlgo::setES ( const edm::EventSetup setup)
virtual

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 41 of file DTNoDriftAlgo.cc.

41  {
42  // theSync->setES(setup);
43 }

Member Data Documentation

bool DTNoDriftAlgo::debug
staticprivate

Definition at line 107 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::fixedDrift
staticprivate

Definition at line 95 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::hitResolution
staticprivate

Definition at line 98 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::maxTime
staticprivate

Definition at line 104 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::minTime
staticprivate

Definition at line 101 of file DTNoDriftAlgo.h.

Referenced by DTNoDriftAlgo().