CMS 3D CMS Logo

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

#include <DTNoDriftAlgo.h>

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

Private Attributes

const bool debug
 
const float fixedDrift
 
const float hitResolution
 
const float maxTime
 
const float minTime
 

Additional Inherited Members

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

Detailed Description

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

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 15 of file DTNoDriftAlgo.h.

Constructor & Destructor Documentation

◆ DTNoDriftAlgo()

DTNoDriftAlgo::DTNoDriftAlgo ( const edm::ParameterSet config,
edm::ConsumesCollector  cc 
)

Constructor.

Definition at line 19 of file DTNoDriftAlgo.cc.

20  : DTRecHitBaseAlgo(config, cc),
21  fixedDrift(config.getParameter<double>("fixedDrift")),
22  hitResolution(config.getParameter<double>("hitResolution")), // Set to size of (half)cell
23  minTime(config.getParameter<double>("minTime")),
24  maxTime(config.getParameter<double>("maxTime")),
25  debug(config.getUntrackedParameter<bool>("debug")) // Set verbose output
26 {}
const float hitResolution
Definition: DTNoDriftAlgo.h:87
const float minTime
Definition: DTNoDriftAlgo.h:90
const float fixedDrift
Definition: DTNoDriftAlgo.h:84
Definition: config.py:1
DTRecHitBaseAlgo(const edm::ParameterSet &config, edm::ConsumesCollector)
Constructor.
const float maxTime
Definition: DTNoDriftAlgo.h:93
const bool debug
Definition: DTNoDriftAlgo.h:96

◆ ~DTNoDriftAlgo()

DTNoDriftAlgo::~DTNoDriftAlgo ( )
override

Destructor.

Definition at line 28 of file DTNoDriftAlgo.cc.

28 {}

Member Function Documentation

◆ compute() [1/5]

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

References relativeConstraints::error, phase1PixelTopology::layer, DTDigi::time(), and DTDigi::wire().

Referenced by compute(), and reconstruct().

80  {
81  // Get the wireId
82  DTLayerId layerId = layer->id();
83  const DTWireId wireId(layerId, digi.wire());
84 
85  // Get Wire position
86  if (!layer->specificTopology().isWireValid(digi.wire()))
87  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 }
int wire() const
Return wire number.
Definition: DTDigi.cc:41
constexpr std::array< uint8_t, layerIndexSize > layer
double time() const
Get time in ns.
Definition: DTDigi.cc:37
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override

◆ compute() [2/5]

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

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

98  {
99  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
100  return true;
101 }
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:50
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:70
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:47

◆ compute() [3/5]

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

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

108  {
109  return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
110 }
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
Definition: DTRecHit1D.h:79
constexpr std::array< uint8_t, layerIndexSize > layer
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:76
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override

◆ compute() [4/5]

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 113 of file DTNoDriftAlgo.cc.

References gather_cfg::cout, debug, shallow::drift(), relativeConstraints::error, fixedDrift, hitResolution, phase1PixelTopology::layer, maxTime, DTWireId::wire(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

120  {
121  //}
122 
123  // Small negative times interpreted as hits close to the wire.
124  //if (driftTime<0.) driftTime=0;
125 
126  // check for out-of-time
127  if (digiTime < minTime || digiTime > maxTime) {
128  if (debug)
129  cout << "[DTNoDriftAlgo]*** Drift time out of window for in-time hits " << digiTime << endl;
130 
131  if (step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
132  // Hits are interpreted as coming from out-of-time pile-up and recHit
133  // is ignored.
134  return false;
135  }
136  }
137 
138  // Compute the drift distance
139  float drift = fixedDrift;
140 
141  // Get Wire position
142  if (!layer->specificTopology().isWireValid(wireId.wire()))
143  return false;
144  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
145  //Build the two possible points and the error on the position
146  leftPoint = LocalPoint(locWirePos.x() - drift, locWirePos.y(), locWirePos.z());
147  rightPoint = LocalPoint(locWirePos.x() + drift, locWirePos.y(), locWirePos.z());
149 
150  if (debug) {
151  cout << "[DTNoDriftAlgo] Compute drift distance, for digi at wire: " << wireId << endl
152  << " Step: " << step << endl
153  << " Digi time: " << digiTime
154  << endl
155  // << " Drift time: " << driftTime << endl
156  << " Fixed Drift distance: " << drift << endl
157  << " Hit Resolution: " << hitResolution << endl
158  << " Left point: " << leftPoint << endl
159  << " Right point: " << rightPoint << endl
160  << " Error: " << error << endl;
161  }
162 
163  return true;
164 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
const float hitResolution
Definition: DTNoDriftAlgo.h:87
int wire() const
Return the wire number.
Definition: DTWireId.h:42
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
const float fixedDrift
Definition: DTNoDriftAlgo.h:84
constexpr std::array< uint8_t, layerIndexSize > layer
T y() const
Definition: PV3DBase.h:60
const float maxTime
Definition: DTNoDriftAlgo.h:93
step
Definition: StallMonitor.cc:98
const bool debug
Definition: DTNoDriftAlgo.h:96

◆ compute() [5/5]

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

Definition at line 167 of file DTNoDriftAlgo.cc.

References compute(), relativeConstraints::error, Exception, phase1PixelTopology::layer, DTEnums::Left, DTRecHit1D::lrSide(), DTEnums::Right, and DTRecHit1D::setPositionAndError().

172  {
173  LocalPoint leftPoint;
174  LocalPoint rightPoint;
176 
177  if (compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
178  // Set the position and the error of the rechit which is being updated
179  switch (newHit1D.lrSide()) {
180  case DTEnums::Left:
181  newHit1D.setPositionAndError(leftPoint, error);
182  break;
183 
184  case DTEnums::Right:
185  newHit1D.setPositionAndError(rightPoint, error);
186  break;
187 
188  default:
189  throw cms::Exception("InvalidDTCellSide") << "[DTNoDriftAlgo] Compute at Step " << step << ", Hit side "
190  << newHit1D.lrSide() << " is invalid!" << endl;
191  return false;
192  }
193 
194  return true;
195  } else {
196  return false;
197  }
198 }
constexpr std::array< uint8_t, layerIndexSize > layer
DTEnums::DTCellSide lrSide() const
The side of the cell.
Definition: DTRecHit1D.h:61
step
Definition: StallMonitor.cc:98
void setPositionAndError(LocalPoint pos, LocalError err)
Set the local position and its error.
Definition: DTRecHit1D.h:70
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override

◆ reconstruct()

OwnVector< DTRecHit1DPair > DTNoDriftAlgo::reconstruct ( const DTLayer layer,
const DTLayerId layerId,
const DTDigiCollection::Range digiRange 
)
overridevirtual

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 35 of file DTNoDriftAlgo.cc.

References compute(), phase1PixelTopology::layer, DTEnums::Left, mps_fire::result, DTEnums::Right, and DTRecHit1DPair::setPositionAndError().

37  {
39 
40  // Loop over all digis in the given range
41  for (DTDigiCollection::const_iterator digi = digiRange.first; digi != digiRange.second; digi++) {
42  // Get the wireId
43  DTWireId wireId(layerId, (*digi).wire());
44 
45  bool isDouble = false;
46  for (OwnVector<DTRecHit1DPair>::const_iterator doubleWireCheck = result.begin(); doubleWireCheck != result.end();
47  doubleWireCheck++) {
48  if (wireId == (*doubleWireCheck).wireId()) {
49  isDouble = true;
50  // std::cout << " Reject this hit with time " << (*digi).time() << std::endl;
51  break;
52  }
53  }
54 
55  if (isDouble)
56  continue;
57 
58  LocalError tmpErr;
59  LocalPoint lpoint, rpoint;
60  // Call the compute method
61  bool OK = compute(layer, *digi, lpoint, rpoint, tmpErr);
62 
63  if (!OK)
64  continue;
65 
66  // Build a new pair of 1D rechit
67  DTRecHit1DPair* recHitPair = new DTRecHit1DPair(wireId, *digi);
68 
69  // Set the position and the error of the 1D rechits
70  recHitPair->setPositionAndError(DTEnums::Left, lpoint, tmpErr);
71  recHitPair->setPositionAndError(DTEnums::Right, rpoint, tmpErr);
72 
73  result.push_back(recHitPair);
74  }
75  return result;
76 }
constexpr std::array< uint8_t, layerIndexSize > layer
void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint &point, const LocalError &err)
std::pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:126
std::vector< DigiType >::const_iterator const_iterator
bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const override

◆ setES()

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

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 30 of file DTNoDriftAlgo.cc.

30  {
31  // theSync->setES(setup);
32 }

Member Data Documentation

◆ debug

const bool DTNoDriftAlgo::debug
private

◆ fixedDrift

const float DTNoDriftAlgo::fixedDrift
private

Definition at line 84 of file DTNoDriftAlgo.h.

Referenced by compute().

◆ hitResolution

const float DTNoDriftAlgo::hitResolution
private

Definition at line 87 of file DTNoDriftAlgo.h.

Referenced by compute().

◆ maxTime

const float DTNoDriftAlgo::maxTime
private

Definition at line 93 of file DTNoDriftAlgo.h.

Referenced by compute().

◆ minTime

const float DTNoDriftAlgo::minTime
private

Definition at line 90 of file DTNoDriftAlgo.h.