CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTMeantimerPatternReco4D Class Reference

#include <DTMeantimerPatternReco4D.h>

Inheritance diagram for DTMeantimerPatternReco4D:
DTRecSegment4DBaseAlgo

Public Member Functions

std::string algoName () const override
 
 DTMeantimerPatternReco4D (const edm::ParameterSet &pset, edm::ConsumesCollector)
 Constructor. More...
 
edm::OwnVector< DTRecSegment4Dreconstruct () override
 Operations. More...
 
void setChamber (const DTChamberId &chId) override
 
void setDTRecHit1DContainer (edm::Handle< DTRecHitCollection > all1DHits) override
 
void setDTRecSegment2DContainer (edm::Handle< DTRecSegment2DCollection > all2DSegments) override
 
void setES (const edm::EventSetup &setup) override
 
bool wants2DSegments () override
 
 ~DTMeantimerPatternReco4D () override
 Destructor. More...
 
- Public Member Functions inherited from DTRecSegment4DBaseAlgo
 DTRecSegment4DBaseAlgo (const edm::ParameterSet &)
 Constructor. More...
 
virtual ~DTRecSegment4DBaseAlgo ()
 Destructor. More...
 

Private Member Functions

std::vector< DTSegmentCand * > buildPhiSuperSegmentsCandidates (std::vector< std::shared_ptr< DTHitPairForFit >> &pairPhiOwned)
 
DTRecSegment4DsegmentSpecialZed (DTRecSegment4D *seg)
 

Private Attributes

bool allDTRecHits
 
bool applyT0corr
 
bool computeT0corr
 
bool debug
 
DTMeantimerPatternRecothe2DAlgo
 
std::string theAlgoName
 
const DTChambertheChamber
 
edm::ESHandle< DTGeometrytheDTGeometry
 
const edm::ESGetToken
< DTGeometry,
MuonGeometryRecord
theDTGeometryToken
 
std::vector< DTRecHit1DPairtheHitsFromPhi1
 
std::vector< DTRecHit1DPairtheHitsFromPhi2
 
std::vector< DTRecHit1DPairtheHitsFromTheta
 
std::vector< DTSLRecSegment2DtheSegments2DTheta
 
DTSegmentUpdatortheUpdator
 

Detailed Description

Algo for reconstructing 4d segment in DT using a Meantimer approach

Author
Stefano Lacaprara - INFN Legnaro stefa.nosp@m.no.l.nosp@m.acapr.nosp@m.ara@.nosp@m.pd.in.nosp@m.fn.i.nosp@m.t
Riccardo Bellan - INFN TO ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 43 of file DTMeantimerPatternReco4D.h.

Constructor & Destructor Documentation

DTMeantimerPatternReco4D::DTMeantimerPatternReco4D ( const edm::ParameterSet pset,
edm::ConsumesCollector  cc 
)

Constructor.

Definition at line 33 of file DTMeantimerPatternReco4D.cc.

References allDTRecHits, applyT0corr, computeT0corr, debug, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), the2DAlgo, and theUpdator.

34  : DTRecSegment4DBaseAlgo(pset), theAlgoName("DTMeantimerPatternReco4D"), theDTGeometryToken(cc.esConsumes()) {
35  // debug parameter
36  debug = pset.getUntrackedParameter<bool>("debug");
37 
38  //do you want the T0 correction?
39  applyT0corr = pset.getParameter<bool>("performT0SegCorrection");
40 
41  computeT0corr = pset.existsAs<bool>("computeT0Seg") ? pset.getParameter<bool>("computeT0Seg") : true;
42 
43  // the updator
44  theUpdator = new DTSegmentUpdator(pset, cc);
45 
46  // the input type.
47  // If true the instructions in setDTRecSegment2DContainer will be schipped and the
48  // theta segment will be recomputed from the 1D rechits
49  // If false the theta segment will be taken from the Event. Caveat: in this case the
50  // event must contain the 2D segments!
51  allDTRecHits = pset.getParameter<bool>("AllDTRecHits");
52 
53  // Get the concrete 2D-segments reconstruction algo from the factory
54  // For the 2D reco I use this reconstructor!
55  the2DAlgo = new DTMeantimerPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"), cc);
56 }
T getUntrackedParameter(std::string const &, T const &) const
DTRecSegment4DBaseAlgo(const edm::ParameterSet &)
Constructor.
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
DTMeantimerPatternReco * the2DAlgo
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > theDTGeometryToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DTMeantimerPatternReco4D::~DTMeantimerPatternReco4D ( )
override

Destructor.

Definition at line 58 of file DTMeantimerPatternReco4D.cc.

References the2DAlgo, and theUpdator.

58  {
59  delete the2DAlgo;
60  delete theUpdator;
61 }
DTMeantimerPatternReco * the2DAlgo

Member Function Documentation

std::string DTMeantimerPatternReco4D::algoName ( ) const
inlineoverridevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 54 of file DTMeantimerPatternReco4D.h.

References theAlgoName.

54 { return theAlgoName; }
vector< DTSegmentCand * > DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates ( std::vector< std::shared_ptr< DTHitPairForFit >> &  pairPhiOwned)
private

Definition at line 257 of file DTMeantimerPatternReco4D.cc.

References DTMeantimerPatternReco::buildSegments(), filterCSVwithJSON::copy, gather_cfg::cout, debug, DTMeantimerPatternReco::initHits(), the2DAlgo, theDTGeometry, theHitsFromPhi1, and theHitsFromPhi2.

Referenced by reconstruct().

258  {
259  DTSuperLayerId slId;
260 
261  if (!theHitsFromPhi1.empty())
262  slId = theHitsFromPhi1.front().wireId().superlayerId();
263  else if (!theHitsFromPhi2.empty())
264  slId = theHitsFromPhi2.front().wireId().superlayerId();
265  else {
266  if (debug)
267  cout << "DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates: "
268  << "No Hits in the two Phi SL" << endl;
269  return vector<DTSegmentCand*>();
270  }
271 
272  const DTSuperLayer* sl = theDTGeometry->superLayer(slId);
273 
274  vector<std::shared_ptr<DTHitPairForFit>> pairPhi1 = the2DAlgo->initHits(sl, theHitsFromPhi1);
275  // same sl!! Since the fit will be in the sl phi 1!
276  vector<std::shared_ptr<DTHitPairForFit>> pairPhi2 = the2DAlgo->initHits(sl, theHitsFromPhi2);
277  // copy the pairPhi2 in the pairPhi1 vector
278  copy(pairPhi2.begin(), pairPhi2.end(), back_inserter(pairPhi1));
279 
280  pairPhiOwned.swap(pairPhi1);
281  // Build the segment candidate
282  return the2DAlgo->buildSegments(sl, pairPhiOwned);
283 }
std::vector< std::shared_ptr< DTHitPairForFit > > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
std::vector< DTRecHit1DPair > theHitsFromPhi2
DTMeantimerPatternReco * the2DAlgo
std::vector< DTRecHit1DPair > theHitsFromPhi1
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
edm::ESHandle< DTGeometry > theDTGeometry
tuple cout
Definition: gather_cfg.py:144
OwnVector< DTRecSegment4D > DTMeantimerPatternReco4D::reconstruct ( )
overridevirtual

Operations.

4d segment: I have the pos along the wire => further update!

Implements DTRecSegment4DBaseAlgo.

Definition at line 120 of file DTMeantimerPatternReco4D.cc.

References allDTRecHits, applyT0corr, edm::OwnVector< T, P >::begin(), buildPhiSuperSegmentsCandidates(), DTSegmentUpdator::calculateT0corr(), computeT0corr, gather_cfg::cout, debug, edm::OwnVector< T, P >::end(), DTChamber::id(), phi, edm::OwnVector< T, P >::push_back(), DTMeantimerPatternReco::reconstruct(), mps_fire::result, DTChamber::superLayer(), the2DAlgo, theChamber, theHitsFromTheta, theSegments2DTheta, theUpdator, GeomDet::toGlobal(), GeomDet::toLocal(), DTSegmentUpdator::update(), and y.

120  {
122 
123  if (debug) {
124  cout << "Segments in " << theChamber->id() << endl;
125  cout << "Reconstructing Phi segments" << endl;
126  }
127 
128  vector<std::shared_ptr<DTHitPairForFit>> pairPhiOwned;
129  vector<DTSegmentCand*> resultPhi = buildPhiSuperSegmentsCandidates(pairPhiOwned);
130 
131  if (debug)
132  cout << "There are " << resultPhi.size() << " Phi cand" << endl;
133 
134  if (allDTRecHits) {
135  // take the theta SL of this chamber
136  const DTSuperLayer* sl = theChamber->superLayer(2);
137  // sl points to 0 if the theta SL was not found
138  if (sl) {
139  // reconstruct the theta segments
140  if (debug)
141  cout << "Reconstructing Theta segments" << endl;
143  vector<DTSLRecSegment2D> segments2DTheta(thetaSegs.begin(), thetaSegs.end());
144  theSegments2DTheta = segments2DTheta;
145  }
146  }
147 
148  bool hasZed = false;
149 
150  // has this chamber the Z-superlayer?
151  if (!theSegments2DTheta.empty()) {
152  hasZed = !theSegments2DTheta.empty();
153  if (debug)
154  cout << "There are " << theSegments2DTheta.size() << " Theta cand" << endl;
155  } else {
156  if (debug)
157  cout << "No Theta candidates." << endl;
158  }
159 
160  // Now I want to build the concrete DTRecSegment4D.
161  if (debug)
162  cout << "Building the concrete DTRecSegment4D" << endl;
163  if (!resultPhi.empty()) {
164  for (vector<DTSegmentCand*>::const_iterator phi = resultPhi.begin(); phi != resultPhi.end(); ++phi) {
165  std::unique_ptr<DTChamberRecSegment2D> superPhi(**phi);
166 
167  theUpdator->update(superPhi.get(), true);
168  if (debug)
169  cout << "superPhi: " << *superPhi << endl;
170 
171  if (hasZed) {
172  // Create all the 4D-segment combining the Z view with the Phi one
173  // loop over the Z segments
174  for (vector<DTSLRecSegment2D>::const_iterator zed = theSegments2DTheta.begin(); zed != theSegments2DTheta.end();
175  ++zed) {
176  // Important!!
177  DTSuperLayerId ZedSegSLId(zed->geographicalId().rawId());
178 
179  // Put the theta segment poistion in its 3D place.
180  // note: (superPhi is in the CHAMBER local frame)
181  const DTSuperLayer* zSL = theChamber->superLayer(ZedSegSLId);
182 
183  // FIXME: should rather extrapolate for Y!
184  LocalPoint zPos(
185  zed->localPosition().x(), (zSL->toLocal(theChamber->toGlobal(superPhi->localPosition()))).y(), 0.);
186 
187  const LocalPoint posZInCh = theChamber->toLocal(zSL->toGlobal(zPos));
188  // FIXME: zed->localDirection() is in 2D. Should add the phi direction in the orthogonal plane as well!!
189  const LocalVector dirZInCh = theChamber->toLocal(zSL->toGlobal(zed->localDirection()));
190 
191  DTRecSegment4D* newSeg = new DTRecSegment4D(*superPhi, *zed, posZInCh, dirZInCh);
192 
194  theUpdator->update(newSeg, false, true);
195  if (debug)
196  cout << "Created a 4D seg " << *newSeg << endl;
197 
198  //update the segment with the t0 and possibly vdrift correction
199  if (!applyT0corr && computeT0corr)
200  theUpdator->calculateT0corr(newSeg);
201  if (applyT0corr)
202  theUpdator->update(newSeg, true, true);
203 
204  result.push_back(newSeg);
205  }
206  } else {
207  // Only phi
208  DTRecSegment4D* newSeg = new DTRecSegment4D(*superPhi);
209 
210  if (debug)
211  cout << "Created a 4D segment using only the 2D Phi segment" << endl;
212 
213  //update the segment with the t0 and possibly vdrift correction
214  if (!applyT0corr && computeT0corr)
215  theUpdator->calculateT0corr(newSeg);
216  if (applyT0corr)
217  theUpdator->update(newSeg, true, true);
218 
219  result.push_back(newSeg);
220  }
221  }
222  } else {
223  // DTRecSegment4D from zed projection only (unlikely, not so useful, but...)
224  if (hasZed) {
225  for (vector<DTSLRecSegment2D>::const_iterator zed = theSegments2DTheta.begin(); zed != theSegments2DTheta.end();
226  ++zed) {
227  // Important!!
228  DTSuperLayerId ZedSegSLId(zed->geographicalId().rawId());
229 
230  const LocalPoint posZInCh =
231  theChamber->toLocal(theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localPosition()));
232  const LocalVector dirZInCh =
233  theChamber->toLocal(theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localDirection()));
234 
235  DTRecSegment4D* newSeg = new DTRecSegment4D(*zed, posZInCh, dirZInCh);
236  // <<
237 
238  if (debug)
239  cout << "Created a 4D segment using only the 2D Theta segment" << endl;
240 
241  if (!applyT0corr && computeT0corr)
242  theUpdator->calculateT0corr(newSeg);
243  if (applyT0corr)
244  theUpdator->update(newSeg, true, true);
245 
246  result.push_back(newSeg);
247  }
248  }
249  }
250  // finally delete the candidates!
251  for (vector<DTSegmentCand*>::iterator phi = resultPhi.begin(); phi != resultPhi.end(); ++phi)
252  delete *phi;
253 
254  return result;
255 }
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:53
edm::OwnVector< DTSLRecSegment2D > reconstruct(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits) override
this function is called in the producer
void calculateT0corr(DTRecSegment2D *seg) const
DTMeantimerPatternReco * the2DAlgo
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
tuple result
Definition: mps_fire.py:311
iterator begin()
Definition: OwnVector.h:280
void push_back(D *&d)
Definition: OwnVector.h:326
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:32
std::vector< DTRecHit1DPair > theHitsFromTheta
std::vector< DTSegmentCand * > buildPhiSuperSegmentsCandidates(std::vector< std::shared_ptr< DTHitPairForFit >> &pairPhiOwned)
std::vector< DTSLRecSegment2D > theSegments2DTheta
iterator end()
Definition: OwnVector.h:285
tuple cout
Definition: gather_cfg.py:144
void update(DTRecSegment4D *seg, const bool calcT0, bool allow3par) const
recompute hits position and refit the segment4D
DTRecSegment4D* DTMeantimerPatternReco4D::segmentSpecialZed ( DTRecSegment4D seg)
private
void DTMeantimerPatternReco4D::setChamber ( const DTChamberId chId)
overridevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 69 of file DTMeantimerPatternReco4D.cc.

References theChamber, and theDTGeometry.

69  {
70  // Set the chamber
71  theChamber = theDTGeometry->chamber(chId);
72 }
edm::ESHandle< DTGeometry > theDTGeometry
void DTMeantimerPatternReco4D::setDTRecHit1DContainer ( edm::Handle< DTRecHitCollection all1DHits)
overridevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 74 of file DTMeantimerPatternReco4D.cc.

References allDTRecHits, gather_cfg::cout, debug, DTSuperLayerId, DTChamber::id(), DTRangeMapAccessor::layersBySuperLayer(), theChamber, theHitsFromPhi1, theHitsFromPhi2, and theHitsFromTheta.

74  {
75  theHitsFromPhi1.clear();
76  theHitsFromPhi2.clear();
77  theHitsFromTheta.clear();
78 
79  DTRecHitCollection::range rangeHitsFromPhi1 =
81  DTRecHitCollection::range rangeHitsFromPhi2 =
83 
84  vector<DTRecHit1DPair> hitsFromPhi1(rangeHitsFromPhi1.first, rangeHitsFromPhi1.second);
85  vector<DTRecHit1DPair> hitsFromPhi2(rangeHitsFromPhi2.first, rangeHitsFromPhi2.second);
86  if (debug)
87  cout << "Number of DTRecHit1DPair in the SL 1 (Phi 1): " << hitsFromPhi1.size() << endl
88  << "Number of DTRecHit1DPair in the SL 3 (Phi 2): " << hitsFromPhi2.size() << endl;
89 
90  theHitsFromPhi1 = hitsFromPhi1;
91  theHitsFromPhi2 = hitsFromPhi2;
92 
93  if (allDTRecHits) {
94  DTRecHitCollection::range rangeHitsFromTheta =
96 
97  vector<DTRecHit1DPair> hitsFromTheta(rangeHitsFromTheta.first, rangeHitsFromTheta.second);
98  if (debug)
99  cout << "Number of DTRecHit1DPair in the SL 2 (Theta): " << hitsFromTheta.size() << endl;
100  theHitsFromTheta = hitsFromTheta;
101  }
102 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
std::vector< DTRecHit1DPair > theHitsFromPhi2
static std::pair< DTLayerId, DTSuperLayerIdComparator > layersBySuperLayer(DTSuperLayerId slId)
Access by SL objects written into a RangeMap by layer.
DTSuperLayerId
std::vector< DTRecHit1DPair > theHitsFromPhi1
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:32
std::vector< DTRecHit1DPair > theHitsFromTheta
tuple cout
Definition: gather_cfg.py:144
void DTMeantimerPatternReco4D::setDTRecSegment2DContainer ( edm::Handle< DTRecSegment2DCollection all2DSegments)
overridevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 104 of file DTMeantimerPatternReco4D.cc.

References allDTRecHits, gather_cfg::cout, debug, DTSuperLayerId, DTChamber::id(), theChamber, and theSegments2DTheta.

104  {
105  theSegments2DTheta.clear();
106 
107  if (!allDTRecHits) {
108  //Extract the DTRecSegment2DCollection range for the theta SL
109  DTRecSegment2DCollection::range rangeTheta = all2DSegments->get(DTSuperLayerId(theChamber->id(), 2));
110 
111  // Fill the DTRecSegment2D container for the theta SL
112  vector<DTSLRecSegment2D> segments2DTheta(rangeTheta.first, rangeTheta.second);
113 
114  if (debug)
115  cout << "Number of 2D-segments in the second SL (Theta): " << segments2DTheta.size() << endl;
116  theSegments2DTheta = segments2DTheta;
117  }
118 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
DTSuperLayerId
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:32
std::vector< DTSLRecSegment2D > theSegments2DTheta
tuple cout
Definition: gather_cfg.py:144
void DTMeantimerPatternReco4D::setES ( const edm::EventSetup setup)
overridevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 63 of file DTMeantimerPatternReco4D.cc.

References edm::EventSetup::getHandle(), DTMeantimerPatternReco::setES(), DTSegmentUpdator::setES(), the2DAlgo, theDTGeometry, theDTGeometryToken, and theUpdator.

63  {
65  the2DAlgo->setES(setup);
66  theUpdator->setES(setup);
67 }
void setES(const edm::EventSetup &setup) override
DTMeantimerPatternReco * the2DAlgo
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > theDTGeometryToken
void setES(const edm::EventSetup &setup)
set the setup
edm::ESHandle< DTGeometry > theDTGeometry
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
bool DTMeantimerPatternReco4D::wants2DSegments ( )
inlineoverridevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 60 of file DTMeantimerPatternReco4D.h.

References allDTRecHits.

Member Data Documentation

bool DTMeantimerPatternReco4D::allDTRecHits
private
bool DTMeantimerPatternReco4D::applyT0corr
private

Definition at line 88 of file DTMeantimerPatternReco4D.h.

Referenced by DTMeantimerPatternReco4D(), and reconstruct().

bool DTMeantimerPatternReco4D::computeT0corr
private

Definition at line 89 of file DTMeantimerPatternReco4D.h.

Referenced by DTMeantimerPatternReco4D(), and reconstruct().

bool DTMeantimerPatternReco4D::debug
private
DTMeantimerPatternReco* DTMeantimerPatternReco4D::the2DAlgo
private
std::string DTMeantimerPatternReco4D::theAlgoName
private

Definition at line 68 of file DTMeantimerPatternReco4D.h.

Referenced by algoName().

const DTChamber* DTMeantimerPatternReco4D::theChamber
private
edm::ESHandle<DTGeometry> DTMeantimerPatternReco4D::theDTGeometry
private

Definition at line 74 of file DTMeantimerPatternReco4D.h.

Referenced by buildPhiSuperSegmentsCandidates(), setChamber(), and setES().

const edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTMeantimerPatternReco4D::theDTGeometryToken
private

Definition at line 75 of file DTMeantimerPatternReco4D.h.

Referenced by setES().

std::vector<DTRecHit1DPair> DTMeantimerPatternReco4D::theHitsFromPhi1
private
std::vector<DTRecHit1DPair> DTMeantimerPatternReco4D::theHitsFromPhi2
private
std::vector<DTRecHit1DPair> DTMeantimerPatternReco4D::theHitsFromTheta
private

Definition at line 94 of file DTMeantimerPatternReco4D.h.

Referenced by reconstruct(), and setDTRecHit1DContainer().

std::vector<DTSLRecSegment2D> DTMeantimerPatternReco4D::theSegments2DTheta
private

Definition at line 92 of file DTMeantimerPatternReco4D.h.

Referenced by reconstruct(), and setDTRecSegment2DContainer().

DTSegmentUpdator* DTMeantimerPatternReco4D::theUpdator
private