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
DTMeantimerPatternReco4D Class Reference

#include <DTMeantimerPatternReco4D.h>

Inheritance diagram for DTMeantimerPatternReco4D:
DTRecSegment4DBaseAlgo

Public Member Functions

virtual std::string algoName () const
 
 DTMeantimerPatternReco4D (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual edm::OwnVector
< DTRecSegment4D
reconstruct ()
 Operations. More...
 
virtual void setChamber (const DTChamberId &chId)
 
virtual void setDTRecHit1DContainer (edm::Handle< DTRecHitCollection > all1DHits)
 
virtual void setDTRecSegment2DContainer (edm::Handle< DTRecSegment2DCollection > all2DSegments)
 
virtual void setES (const edm::EventSetup &setup)
 
virtual bool wants2DSegments ()
 
virtual ~DTMeantimerPatternReco4D ()
 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
 
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 40 of file DTMeantimerPatternReco4D.h.

Constructor & Destructor Documentation

DTMeantimerPatternReco4D::DTMeantimerPatternReco4D ( const edm::ParameterSet pset)

Constructor.

Definition at line 32 of file DTMeantimerPatternReco4D.cc.

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

32  :
33  DTRecSegment4DBaseAlgo(pset), theAlgoName("DTMeantimerPatternReco4D"){
34 
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") ?
42  pset.getParameter<bool>("computeT0Seg") : true;
43 
44  // the updator
45  theUpdator = new DTSegmentUpdator(pset);
46 
47  // the input type.
48  // If true the instructions in setDTRecSegment2DContainer will be schipped and the
49  // theta segment will be recomputed from the 1D rechits
50  // If false the theta segment will be taken from the Event. Caveat: in this case the
51  // event must contain the 2D segments!
52  allDTRecHits = pset.getParameter<bool>("AllDTRecHits");
53 
54  // Get the concrete 2D-segments reconstruction algo from the factory
55  // For the 2D reco I use this reconstructor!
56  the2DAlgo = new DTMeantimerPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
57 }
T getParameter(std::string const &) const
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:184
DTMeantimerPatternReco * the2DAlgo
DTMeantimerPatternReco4D::~DTMeantimerPatternReco4D ( )
virtual

Destructor.

Definition at line 60 of file DTMeantimerPatternReco4D.cc.

References the2DAlgo, and theUpdator.

60  {
61  delete the2DAlgo;
62  delete theUpdator;
63 }
DTMeantimerPatternReco * the2DAlgo

Member Function Documentation

virtual std::string DTMeantimerPatternReco4D::algoName ( void  ) const
inlinevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 53 of file DTMeantimerPatternReco4D.h.

References theAlgoName.

53 { 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().

257  {
258 
259  DTSuperLayerId slId;
260 
261  if(theHitsFromPhi1.size())
262  slId = theHitsFromPhi1.front().wireId().superlayerId();
263  else
264  if(theHitsFromPhi2.size())
265  slId = theHitsFromPhi2.front().wireId().superlayerId();
266  else{
267  if(debug) 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:121
OwnVector< DTRecSegment4D > DTMeantimerPatternReco4D::reconstruct ( )
virtual

Operations.

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 128 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(), query::result, DTChamber::superLayer(), the2DAlgo, theChamber, theHitsFromTheta, theSegments2DTheta, theUpdator, GeomDet::toGlobal(), GeomDet::toLocal(), DTSegmentUpdator::update(), detailsBasic3DVector::y, and zPos.

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 71 of file DTMeantimerPatternReco4D.cc.

References theChamber, and theDTGeometry.

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 76 of file DTMeantimerPatternReco4D.cc.

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

76  {
77  theHitsFromPhi1.clear();
78  theHitsFromPhi2.clear();
79  theHitsFromTheta.clear();
80 
81  DTRecHitCollection::range rangeHitsFromPhi1 =
83  DTRecHitCollection::range rangeHitsFromPhi2 =
85 
86  vector<DTRecHit1DPair> hitsFromPhi1(rangeHitsFromPhi1.first,rangeHitsFromPhi1.second);
87  vector<DTRecHit1DPair> hitsFromPhi2(rangeHitsFromPhi2.first,rangeHitsFromPhi2.second);
88  if(debug)
89  cout<< "Number of DTRecHit1DPair in the SL 1 (Phi 1): " << hitsFromPhi1.size()<<endl
90  << "Number of DTRecHit1DPair in the SL 3 (Phi 2): " << hitsFromPhi2.size()<<endl;
91 
92  theHitsFromPhi1 = hitsFromPhi1;
93  theHitsFromPhi2 = hitsFromPhi2;
94 
95  if(allDTRecHits){
96  DTRecHitCollection::range rangeHitsFromTheta =
98 
99  vector<DTRecHit1DPair> hitsFromTheta(rangeHitsFromTheta.first,rangeHitsFromTheta.second);
100  if(debug)
101  cout<< "Number of DTRecHit1DPair in the SL 2 (Theta): " << hitsFromTheta.size()<<endl;
102  theHitsFromTheta = hitsFromTheta;
103  }
104 
105 }
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:33
std::vector< DTRecHit1DPair > theHitsFromTheta
tuple cout
Definition: gather_cfg.py:121
void DTMeantimerPatternReco4D::setDTRecSegment2DContainer ( edm::Handle< DTRecSegment2DCollection all2DSegments)
virtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 107 of file DTMeantimerPatternReco4D.cc.

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

107  {
108  theSegments2DTheta.clear();
109 
110  if(!allDTRecHits){
111 
112  //Extract the DTRecSegment2DCollection range for the theta SL
113  DTRecSegment2DCollection::range rangeTheta =
114  all2DSegments->get(DTSuperLayerId(theChamber->id(),2));
115 
116  // Fill the DTRecSegment2D container for the theta SL
117  vector<DTSLRecSegment2D> segments2DTheta(rangeTheta.first,rangeTheta.second);
118 
119  if(debug)
120  cout << "Number of 2D-segments in the second SL (Theta): " << segments2DTheta.size() << endl;
121  theSegments2DTheta = segments2DTheta;
122  }
123 
124 }
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:33
std::vector< DTSLRecSegment2D > theSegments2DTheta
tuple cout
Definition: gather_cfg.py:121
void DTMeantimerPatternReco4D::setES ( const edm::EventSetup setup)
virtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 65 of file DTMeantimerPatternReco4D.cc.

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

65  {
66  setup.get<MuonGeometryRecord>().get(theDTGeometry);
67  the2DAlgo->setES(setup);
68  theUpdator->setES(setup);
69 }
DTMeantimerPatternReco * the2DAlgo
virtual void setES(const edm::EventSetup &setup)
void setES(const edm::EventSetup &setup)
set the setup
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< DTGeometry > theDTGeometry
virtual bool DTMeantimerPatternReco4D::wants2DSegments ( )
inlinevirtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 59 of file DTMeantimerPatternReco4D.h.

References allDTRecHits.

Member Data Documentation

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

Definition at line 86 of file DTMeantimerPatternReco4D.h.

Referenced by DTMeantimerPatternReco4D(), and reconstruct().

bool DTMeantimerPatternReco4D::computeT0corr
private

Definition at line 87 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 67 of file DTMeantimerPatternReco4D.h.

Referenced by algoName().

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

Definition at line 73 of file DTMeantimerPatternReco4D.h.

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

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

Definition at line 92 of file DTMeantimerPatternReco4D.h.

Referenced by reconstruct(), and setDTRecHit1DContainer().

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

Definition at line 90 of file DTMeantimerPatternReco4D.h.

Referenced by reconstruct(), and setDTRecSegment2DContainer().

DTSegmentUpdator* DTMeantimerPatternReco4D::theUpdator
private