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 ()
 
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

Date:
2012/10/25 12:45:37
Revision:
1.4
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 41 of file DTMeantimerPatternReco4D.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 34 of file DTMeantimerPatternReco4D.cc.

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

34  :
35  DTRecSegment4DBaseAlgo(pset), theAlgoName("DTMeantimerPatternReco4D"){
36 
37  // debug parameter
38  debug = pset.getUntrackedParameter<bool>("debug");
39 
40  //do you want the T0 correction?
41  applyT0corr = pset.getParameter<bool>("performT0SegCorrection");
42 
43  computeT0corr = pset.existsAs<bool>("computeT0Seg") ?
44  pset.getParameter<bool>("computeT0Seg") : true;
45 
46  // the updator
47  theUpdator = new DTSegmentUpdator(pset);
48 
49  // the input type.
50  // If true the instructions in setDTRecSegment2DContainer will be schipped and the
51  // theta segment will be recomputed from the 1D rechits
52  // If false the theta segment will be taken from the Event. Caveat: in this case the
53  // event must contain the 2D segments!
54  allDTRecHits = pset.getParameter<bool>("AllDTRecHits");
55 
56  // Get the concrete 2D-segments reconstruction algo from the factory
57  // For the 2D reco I use this reconstructor!
58  the2DAlgo = new DTMeantimerPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
59 
60  }
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:187
DTMeantimerPatternReco * the2DAlgo
DTMeantimerPatternReco4D::~DTMeantimerPatternReco4D ( )
virtual

Destructor.

Definition at line 63 of file DTMeantimerPatternReco4D.cc.

References the2DAlgo, and theUpdator.

63  {
64  delete the2DAlgo;
65  delete theUpdator;
66 }
DTMeantimerPatternReco * the2DAlgo

Member Function Documentation

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 54 of file DTMeantimerPatternReco4D.h.

References theAlgoName.

54 { return theAlgoName; }
vector< DTSegmentCand * > DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates ( )
private

Definition at line 258 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 
260  DTSuperLayerId slId;
261 
262  if(theHitsFromPhi1.size())
263  slId = theHitsFromPhi1.front().wireId().superlayerId();
264  else
265  if(theHitsFromPhi2.size())
266  slId = theHitsFromPhi2.front().wireId().superlayerId();
267  else{
268  if(debug) cout<<"DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates: "
269  <<"No Hits in the two Phi SL"<<endl;
270  return vector<DTSegmentCand*>();
271  }
272 
273  const DTSuperLayer *sl = theDTGeometry->superLayer(slId);
274 
275  vector<DTHitPairForFit*> pairPhi1 = the2DAlgo->initHits(sl,theHitsFromPhi1);
276  // same sl!! Since the fit will be in the sl phi 1!
277  vector<DTHitPairForFit*> pairPhi2 = the2DAlgo->initHits(sl,theHitsFromPhi2);
278  // copy the pairPhi2 in the pairPhi1 vector
279  copy(pairPhi2.begin(),pairPhi2.end(),back_inserter(pairPhi1));
280 
281  // Build the segment candidate
282  return the2DAlgo->buildSegments(sl,pairPhi1);
283 }
std::vector< DTRecHit1DPair > theHitsFromPhi2
DTMeantimerPatternReco * the2DAlgo
std::vector< DTRecHit1DPair > theHitsFromPhi1
std::vector< DTHitPairForFit * > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< 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 131 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(), DTRecSegment2D::localPosition(), 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.

131  {
132 
134 
135  if (debug){
136  cout << "Segments in " << theChamber->id() << endl;
137  cout << "Reconstructing Phi segments"<<endl;
138  }
139  vector<DTSegmentCand*> resultPhi = buildPhiSuperSegmentsCandidates();
140 
141  if (debug) cout << "There are " << resultPhi.size() << " Phi cand" << endl;
142 
143  if (allDTRecHits){
144  // take the theta SL of this chamber
145  const DTSuperLayer* sl = theChamber->superLayer(2);
146  // sl points to 0 if the theta SL was not found
147  if(sl){
148  // reconstruct the theta segments
149  if(debug) cout << "Reconstructing Theta segments"<<endl;
151  vector<DTSLRecSegment2D> segments2DTheta(thetaSegs.begin(),thetaSegs.end());
152  theSegments2DTheta = segments2DTheta;
153  }
154  }
155 
156  bool hasZed=false;
157 
158  // has this chamber the Z-superlayer?
159  if (theSegments2DTheta.size()){
160  hasZed = theSegments2DTheta.size()>0;
161  if (debug) cout << "There are " << theSegments2DTheta.size() << " Theta cand" << endl;
162  } else {
163  if (debug) cout << "No Theta SL" << endl;
164  }
165 
166  // Now I want to build the concrete DTRecSegment4D.
167  if(debug) cout<<"Building the concrete DTRecSegment4D"<<endl;
168  if (resultPhi.size()) {
169  for (vector<DTSegmentCand*>::const_iterator phi=resultPhi.begin();
170  phi!=resultPhi.end(); ++phi) {
171 
172  DTChamberRecSegment2D* superPhi = (**phi);
173 
174  theUpdator->update(superPhi);
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  //<<
201 
203  theUpdator->update(newSeg);
204  if (debug) cout << "Created a 4D seg " << *newSeg << endl;
205 
206  //update the segment with the t0 and possibly vdrift correction
208  if(applyT0corr) theUpdator->update(newSeg,true);
209 
210  result.push_back(newSeg);
211  }
212  } else {
213  // Only phi
214  DTRecSegment4D* newSeg = new DTRecSegment4D(*superPhi);
215 
216  if (debug) cout << "Created a 4D segment using only the 2D Phi segment" << endl;
217 
218  //update the segment with the t0 and possibly vdrift correction
220  if(applyT0corr) theUpdator->update(newSeg,true);
221 
222  result.push_back(newSeg);
223  }
224  }
225  } else {
226  // DTRecSegment4D from zed projection only (unlikely, not so useful, but...)
227  if (hasZed) {
228  for(vector<DTSLRecSegment2D>::const_iterator zed = theSegments2DTheta.begin();
229  zed != theSegments2DTheta.end(); ++zed){
230 
231  // Important!!
232  DTSuperLayerId ZedSegSLId(zed->geographicalId().rawId());
233 
234  const LocalPoint posZInCh = theChamber->toLocal( theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localPosition() )) ;
235  const LocalVector dirZInCh = theChamber->toLocal( theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localDirection() )) ;
236 
237  DTRecSegment4D* newSeg = new DTRecSegment4D( *zed,posZInCh,dirZInCh);
238  // <<
239 
240  if (debug) cout << "Created a 4D segment using only the 2D Theta segment" << endl;
241 
243  if(applyT0corr) theUpdator->update(newSeg,true);
244 
245  result.push_back(newSeg);
246  }
247  }
248  }
249  // finally delete the candidates!
250  for (vector<DTSegmentCand*>::iterator phi=resultPhi.begin();
251  phi!=resultPhi.end(); ++phi) delete *phi;
252 
253  return result;
254 }
std::vector< DTSegmentCand * > buildPhiSuperSegmentsCandidates()
void update(DTRecSegment4D *seg, const bool calcT0=false) const
recompute hits position and refit the segment4D
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:227
void push_back(D *&d)
Definition: OwnVector.h:273
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:35
tuple result
Definition: query.py:137
std::vector< DTRecHit1DPair > theHitsFromTheta
std::vector< DTSLRecSegment2D > theSegments2DTheta
virtual LocalPoint localPosition() const
local position in SL frame
iterator end()
Definition: OwnVector.h:232
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
const DTSuperLayer * superLayer(DTSuperLayerId id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:67
Definition: DDAxes.h:10
DTRecSegment4D* DTMeantimerPatternReco4D::segmentSpecialZed ( DTRecSegment4D seg)
private
void DTMeantimerPatternReco4D::setChamber ( const DTChamberId chId)
virtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 74 of file DTMeantimerPatternReco4D.cc.

References theChamber, and theDTGeometry.

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 79 of file DTMeantimerPatternReco4D.cc.

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

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 110 of file DTMeantimerPatternReco4D.cc.

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

110  {
111  theSegments2DTheta.clear();
112 
113  if(!allDTRecHits){
114 
115  //Extract the DTRecSegment2DCollection range for the theta SL
116  DTRecSegment2DCollection::range rangeTheta =
117  all2DSegments->get(DTSuperLayerId(theChamber->id(),2));
118 
119  // Fill the DTRecSegment2D container for the theta SL
120  vector<DTSLRecSegment2D> segments2DTheta(rangeTheta.first,rangeTheta.second);
121 
122  if(debug)
123  cout << "Number of 2D-segments in the second SL (Theta): " << segments2DTheta.size() << endl;
124  theSegments2DTheta = segments2DTheta;
125  }
126 
127 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:52
DTSuperLayerId
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:35
std::vector< DTSLRecSegment2D > theSegments2DTheta
tuple cout
Definition: gather_cfg.py:121
void DTMeantimerPatternReco4D::setES ( const edm::EventSetup setup)
virtual

Implements DTRecSegment4DBaseAlgo.

Definition at line 68 of file DTMeantimerPatternReco4D.cc.

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

68  {
69  setup.get<MuonGeometryRecord>().get(theDTGeometry);
70  the2DAlgo->setES(setup);
71  theUpdator->setES(setup);
72 }
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 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 69 of file DTMeantimerPatternReco4D.h.

Referenced by algoName().

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

Definition at line 75 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 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