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

Destructor.

Definition at line 56 of file DTMeantimerPatternReco4D.cc.

References the2DAlgo, and theUpdator.

56  {
57  delete the2DAlgo;
58  delete theUpdator;
59 }
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 237 of file DTMeantimerPatternReco4D.cc.

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

Referenced by reconstruct().

237  {
238 
239  DTSuperLayerId slId;
240 
241  if(theHitsFromPhi1.size())
242  slId = theHitsFromPhi1.front().wireId().superlayerId();
243  else
244  if(theHitsFromPhi2.size())
245  slId = theHitsFromPhi2.front().wireId().superlayerId();
246  else{
247  if(debug) cout<<"DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates: "
248  <<"No Hits in the two Phi SL"<<endl;
249  return vector<DTSegmentCand*>();
250  }
251 
252  const DTSuperLayer *sl = theDTGeometry->superLayer(slId);
253 
254  vector<DTHitPairForFit*> pairPhi1 = the2DAlgo->initHits(sl,theHitsFromPhi1);
255  // same sl!! Since the fit will be in the sl phi 1!
256  vector<DTHitPairForFit*> pairPhi2 = the2DAlgo->initHits(sl,theHitsFromPhi2);
257  // copy the pairPhi2 in the pairPhi1 vector
258  copy(pairPhi2.begin(),pairPhi2.end(),back_inserter(pairPhi1));
259 
260  // Build the segment candidate
261  return the2DAlgo->buildSegments(sl,pairPhi1);
262 }
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 124 of file DTMeantimerPatternReco4D.cc.

References allDTRecHits, edm::OwnVector< T, P >::begin(), buildPhiSuperSegmentsCandidates(), 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.

124  {
125 
127 
128  if (debug){
129  cout << "Segments in " << theChamber->id() << endl;
130  cout << "Reconstructing Phi segments"<<endl;
131  }
132  vector<DTSegmentCand*> resultPhi = buildPhiSuperSegmentsCandidates();
133 
134  if (debug) cout << "There are " << resultPhi.size() << " Phi cand" << endl;
135 
136  if (allDTRecHits){
137  // take the theta SL of this chamber
138  const DTSuperLayer* sl = theChamber->superLayer(2);
139  // sl points to 0 if the theta SL was not found
140  if(sl){
141  // reconstruct the theta segments
142  if(debug) cout << "Reconstructing Theta segments"<<endl;
144  vector<DTSLRecSegment2D> segments2DTheta(thetaSegs.begin(),thetaSegs.end());
145  theSegments2DTheta = segments2DTheta;
146  }
147  }
148 
149  bool hasZed=false;
150 
151  // has this chamber the Z-superlayer?
152  if (theSegments2DTheta.size()){
153  hasZed = theSegments2DTheta.size()>0;
154  if (debug) cout << "There are " << theSegments2DTheta.size() << " Theta cand" << endl;
155  } else {
156  if (debug) cout << "No Theta SL" << endl;
157  }
158 
159  // Now I want to build the concrete DTRecSegment4D.
160  if(debug) cout<<"Building the concrete DTRecSegment4D"<<endl;
161  if (resultPhi.size()) {
162  for (vector<DTSegmentCand*>::const_iterator phi=resultPhi.begin();
163  phi!=resultPhi.end(); ++phi) {
164 
165  DTChamberRecSegment2D* superPhi = (**phi);
166 
167  theUpdator->update(superPhi);
168 
169  if (hasZed) {
170 
171  // Create all the 4D-segment combining the Z view with the Phi one
172  // loop over the Z segments
173  for(vector<DTSLRecSegment2D>::const_iterator zed = theSegments2DTheta.begin();
174  zed != theSegments2DTheta.end(); ++zed){
175 
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(zed->localPosition().x(),
185  (zSL->toLocal(theChamber->toGlobal(superPhi->localPosition()))).y(),
186  0.);
187 
188  const LocalPoint posZInCh = theChamber->toLocal( zSL->toGlobal(zPos));
189  // FIXME: zed->localDirection() is in 2D. Should add the phi direction in the orthogonal plane as well!!
190  const LocalVector dirZInCh = theChamber->toLocal( zSL->toGlobal(zed->localDirection()));
191 
192  DTRecSegment4D* newSeg = new DTRecSegment4D(*superPhi,*zed,posZInCh,dirZInCh);
193  //<<
194 
196  theUpdator->update(newSeg);
197  if (debug) cout << "Created a 4D seg " << *newSeg << endl;
198  result.push_back(newSeg);
199  }
200  } else {
201  // Only phi
202  DTRecSegment4D* newSeg = new DTRecSegment4D(*superPhi);
203 
204  if (debug) cout << "Created a 4D segment using only the 2D Phi segment" << endl;
205  result.push_back(newSeg);
206  }
207  }
208  } else {
209  // DTRecSegment4D from zed projection only (unlikely, not so useful, but...)
210  if (hasZed) {
211  for(vector<DTSLRecSegment2D>::const_iterator zed = theSegments2DTheta.begin();
212  zed != theSegments2DTheta.end(); ++zed){
213 
214  // Important!!
215  DTSuperLayerId ZedSegSLId(zed->geographicalId().rawId());
216 
217  const LocalPoint posZInCh = theChamber->toLocal( theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localPosition() )) ;
218  const LocalVector dirZInCh = theChamber->toLocal( theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localDirection() )) ;
219 
220  DTRecSegment4D* newSeg = new DTRecSegment4D( *zed,posZInCh,dirZInCh);
221  // <<
222 
223  if (debug) cout << "Created a 4D segment using only the 2D Theta segment" << endl;
224  result.push_back(newSeg);
225  }
226  }
227  }
228  // finally delete the candidates!
229  for (vector<DTSegmentCand*>::iterator phi=resultPhi.begin();
230  phi!=resultPhi.end(); ++phi) delete *phi;
231 
232  return result;
233 }
std::vector< DTSegmentCand * > buildPhiSuperSegmentsCandidates()
void update(DTRecSegment4D *seg, const bool calcT0=false) const
recompute hits position and refit the segment4D
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 67 of file DTMeantimerPatternReco4D.cc.

References theChamber, and theDTGeometry.

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 72 of file DTMeantimerPatternReco4D.cc.

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

72  {
73  theHitsFromPhi1.clear();
74  theHitsFromPhi2.clear();
75  theHitsFromTheta.clear();
76 
77  DTRecHitCollection::range rangeHitsFromPhi1 =
79  DTRecHitCollection::range rangeHitsFromPhi2 =
81 
82  vector<DTRecHit1DPair> hitsFromPhi1(rangeHitsFromPhi1.first,rangeHitsFromPhi1.second);
83  vector<DTRecHit1DPair> hitsFromPhi2(rangeHitsFromPhi2.first,rangeHitsFromPhi2.second);
84  if(debug)
85  cout<< "Number of DTRecHit1DPair in the SL 1 (Phi 1): " << hitsFromPhi1.size()<<endl
86  << "Number of DTRecHit1DPair in the SL 3 (Phi 2): " << hitsFromPhi2.size()<<endl;
87 
88  theHitsFromPhi1 = hitsFromPhi1;
89  theHitsFromPhi2 = hitsFromPhi2;
90 
91  if(allDTRecHits){
92  DTRecHitCollection::range rangeHitsFromTheta =
94 
95  vector<DTRecHit1DPair> hitsFromTheta(rangeHitsFromTheta.first,rangeHitsFromTheta.second);
96  if(debug)
97  cout<< "Number of DTRecHit1DPair in the SL 2 (Theta): " << hitsFromTheta.size()<<endl;
98  theHitsFromTheta = hitsFromTheta;
99  }
100 
101 }
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 103 of file DTMeantimerPatternReco4D.cc.

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

103  {
104  theSegments2DTheta.clear();
105 
106  if(!allDTRecHits){
107 
108  //Extract the DTRecSegment2DCollection range for the theta SL
109  DTRecSegment2DCollection::range rangeTheta =
110  all2DSegments->get(DTSuperLayerId(theChamber->id(),2));
111 
112  // Fill the DTRecSegment2D container for the theta SL
113  vector<DTSLRecSegment2D> segments2DTheta(rangeTheta.first,rangeTheta.second);
114 
115  if(debug)
116  cout << "Number of 2D-segments in the second SL (Theta): " << segments2DTheta.size() << endl;
117  theSegments2DTheta = segments2DTheta;
118  }
119 
120 }
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 61 of file DTMeantimerPatternReco4D.cc.

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

61  {
62  setup.get<MuonGeometryRecord>().get(theDTGeometry);
63  the2DAlgo->setES(setup);
64  theUpdator->setES(setup);
65 }
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::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 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