#include <DTCombinatorialPatternReco4D.h>
Algo for reconstructing 4d segment in DT using a combinatorial approach
Definition at line 42 of file DTCombinatorialPatternReco4D.h.
DTCombinatorialPatternReco4D::DTCombinatorialPatternReco4D | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 34 of file DTCombinatorialPatternReco4D.cc.
References allDTRecHits, applyT0corr, computeT0corr, debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), the2DAlgo, and theUpdator.
: DTRecSegment4DBaseAlgo(pset), theAlgoName("DTCombinatorialPatternReco4D"){ // debug parameter debug = pset.getUntrackedParameter<bool>("debug"); //do you want the T0 correction? applyT0corr = pset.getParameter<bool>("performT0SegCorrection"); computeT0corr = pset.getUntrackedParameter<bool>("computeT0Seg",true); // the updator theUpdator = new DTSegmentUpdator(pset); // the input type. // If true the instructions in setDTRecSegment2DContainer will be schipped and the // theta segment will be recomputed from the 1D rechits // If false the theta segment will be taken from the Event. Caveat: in this case the // event must contain the 2D segments! allDTRecHits = pset.getParameter<bool>("AllDTRecHits"); // Get the concrete 2D-segments reconstruction algo from the factory // For the 2D reco I use this reconstructor! the2DAlgo = new DTCombinatorialPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig")); }
DTCombinatorialPatternReco4D::~DTCombinatorialPatternReco4D | ( | ) | [virtual] |
Destructor.
Definition at line 59 of file DTCombinatorialPatternReco4D.cc.
References the2DAlgo, and theUpdator.
{ delete the2DAlgo; delete theUpdator; }
virtual std::string DTCombinatorialPatternReco4D::algoName | ( | void | ) | const [inline, virtual] |
Implements DTRecSegment4DBaseAlgo.
Definition at line 55 of file DTCombinatorialPatternReco4D.h.
References theAlgoName.
{ return theAlgoName; }
std::vector<DTSegmentCand*> DTCombinatorialPatternReco4D::buildPhiSuperSegmentsCandidates | ( | std::vector< DTHitPairForFit * > & | pairPhiOwned | ) | [private] |
Referenced by reconstruct().
OwnVector< DTRecSegment4D > DTCombinatorialPatternReco4D::reconstruct | ( | ) | [virtual] |
Operations.
4d segment: I have the pos along the wire => further update!
Implements DTRecSegment4DBaseAlgo.
Definition at line 127 of file DTCombinatorialPatternReco4D.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(), DTCombinatorialPatternReco::reconstruct(), query::result, DTChamber::superLayer(), the2DAlgo, theChamber, theHitsFromTheta, theSegments2DTheta, theUpdator, GeomDet::toGlobal(), GeomDet::toLocal(), DTSegmentUpdator::update(), detailsBasic3DVector::y, and zPos.
{ OwnVector<DTRecSegment4D> result; if (debug){ cout << "Segments in " << theChamber->id() << endl; cout << "Reconstructing of the Phi segments" << endl; } vector<DTHitPairForFit*> pairPhiOwned; vector<DTSegmentCand*> resultPhi = buildPhiSuperSegmentsCandidates(pairPhiOwned); if (debug) cout << "There are " << resultPhi.size() << " Phi cand" << endl; if (allDTRecHits){ // take the theta SL of this chamber const DTSuperLayer* sl = theChamber->superLayer(2); // sl points to 0 if the theta SL was not found if(sl){ // reconstruct the theta segments if(debug) cout<<"Reconstructing of the Theta segments"<<endl; OwnVector<DTSLRecSegment2D> thetaSegs = the2DAlgo->reconstruct(sl, theHitsFromTheta); vector<DTSLRecSegment2D> segments2DTheta(thetaSegs.begin(),thetaSegs.end()); theSegments2DTheta = segments2DTheta; } } bool hasZed = false; // has this chamber the Z-superlayer? if (theSegments2DTheta.size()){ hasZed = theSegments2DTheta.size() > 0; if (debug) cout << "There are " << theSegments2DTheta.size() << " Theta cand" << endl; } else { if (debug) cout << "No Theta SL" << endl; } // Now I want to build the concrete DTRecSegment4D. if(debug) cout<<"Building of the concrete DTRecSegment4D"<<endl; if (resultPhi.size()) { for (vector<DTSegmentCand*>::const_iterator phi=resultPhi.begin(); phi!=resultPhi.end(); ++phi) { std::auto_ptr<DTChamberRecSegment2D> superPhi(**phi); theUpdator->update(superPhi.get()); if(debug) cout << "superPhi: " << *superPhi << endl; if (hasZed) { // Create all the 4D-segment combining the Z view with the Phi one // loop over the Z segments for(vector<DTSLRecSegment2D>::const_iterator zed = theSegments2DTheta.begin(); zed != theSegments2DTheta.end(); ++zed){ if(debug) cout << "Theta: " << *zed << endl; // Important!! DTSuperLayerId ZedSegSLId(zed->geographicalId().rawId()); // Put the theta segment poistion in its 3D place. // note: (superPhi is in the CHAMBER local frame) const DTSuperLayer* zSL = theChamber->superLayer(ZedSegSLId); // FIXME: should rather extrapolate for Y! LocalPoint zPos(zed->localPosition().x(), (zSL->toLocal(theChamber->toGlobal(superPhi->localPosition()))).y(), 0.); const LocalPoint posZInCh = theChamber->toLocal( zSL->toGlobal(zPos)); // FIXME: zed->localDirection() is in 2D. Should add the phi direction in the orthogonal plane as well!! const LocalVector dirZInCh = theChamber->toLocal( zSL->toGlobal(zed->localDirection())); DTRecSegment4D* newSeg = new DTRecSegment4D(*superPhi,*zed,posZInCh,dirZInCh); if (debug) cout << "Created a 4D seg " << *newSeg << endl; theUpdator->update(newSeg); if (debug) cout << " seg updated " << *newSeg << endl; if(!applyT0corr && computeT0corr) theUpdator->calculateT0corr(newSeg); if(applyT0corr) theUpdator->update(newSeg,true); result.push_back(newSeg); } } else { // Only phi DTRecSegment4D* newSeg = new DTRecSegment4D(*superPhi); if (debug) cout << "Created a 4D segment using only the 2D Phi segment " << *newSeg << endl; //update the segment with the t0 and possibly vdrift correction if(!applyT0corr && computeT0corr) theUpdator->calculateT0corr(newSeg); if(applyT0corr) theUpdator->update(newSeg,true); result.push_back(newSeg); } } } else { // DTRecSegment4D from zed projection only (unlikely, not so useful, but...) if (hasZed) { for(vector<DTSLRecSegment2D>::const_iterator zed = theSegments2DTheta.begin(); zed != theSegments2DTheta.end(); ++zed){ if(debug) cout << "Theta: " << *zed << endl; // Important!! DTSuperLayerId ZedSegSLId(zed->geographicalId().rawId()); const LocalPoint posZInCh = theChamber->toLocal( theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localPosition() )) ; const LocalVector dirZInCh = theChamber->toLocal( theChamber->superLayer(ZedSegSLId)->toGlobal(zed->localDirection() )) ; DTRecSegment4D* newSeg = new DTRecSegment4D( *zed,posZInCh,dirZInCh); if (debug) cout << "Created a 4D segment using only the 2D Theta segment " << *newSeg << endl; if(!applyT0corr && computeT0corr) theUpdator->calculateT0corr(newSeg); if(applyT0corr) theUpdator->update(newSeg,true); result.push_back(newSeg); } } } // finally delete the candidates! for (vector<DTSegmentCand*>::iterator phi=resultPhi.begin(); phi!=resultPhi.end(); ++phi) delete *phi; for (vector<DTHitPairForFit*>::iterator phiPair = pairPhiOwned.begin(); phiPair!=pairPhiOwned.end(); ++phiPair) delete *phiPair; return result; }
DTRecSegment4D * DTCombinatorialPatternReco4D::segmentSpecialZed | ( | const DTRecSegment4D * | seg | ) | [private] |
Build a 4d segment with a zed component made by just one hits.
Definition at line 292 of file DTCombinatorialPatternReco4D.cc.
References DTRecSegment2D::chi2(), funct::cos(), DTRecSegment2D::covMatrix(), DTRecHit1D::digiTime(), dir, DTRecSegment2D::localDirection(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), DTRecSegment2D::localPosition(), DTRecSegment2D::localPositionError(), DTRecHit1D::lrSide(), DTRecSegment4D::phiSegment(), pos, query::result, DTRecSegment2D::specificRecHits(), DTSLRecSegment2D::superLayerId(), PV3DBase< T, PVType, FrameType >::theta(), DTRecHit1D::wireId(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().
{ // Get the zed projection //if (!seg->hasZed()) return seg; const DTSLRecSegment2D* zedSeg=seg->zSegment(); std::vector<DTRecHit1D> hits = zedSeg->specificRecHits(); // pick up a hit "in the middle", where the single hit will be put. int nHits=hits.size(); DTRecHit1D middle=hits[static_cast<int>(nHits/2.)]; // Need to extrapolate pos to the middle layer z LocalPoint posInSL = zedSeg->localPosition(); LocalVector dirInSL = zedSeg->localDirection(); LocalPoint posInMiddleLayer = posInSL+dirInSL*(-posInSL.z())/cos(dirInSL.theta()); // create a hit with position and error as the Zed projection one's auto_ptr<DTRecHit1D> hit(new DTRecHit1D( middle.wireId(), middle.lrSide(), middle.digiTime(), posInMiddleLayer, zedSeg->localPositionError())); std::vector<DTRecHit1D> newHits(1,*hit); // create a new zed segment with that single hits, but same dir and pos LocalPoint pos(zedSeg->localPosition()); LocalVector dir(zedSeg->localDirection()); AlgebraicSymMatrix cov(zedSeg->covMatrix()); double chi2(zedSeg->chi2()); //cout << "zed " << *zedSeg << endl; auto_ptr<DTSLRecSegment2D> newZed(new DTSLRecSegment2D(zedSeg->superLayerId(), pos, dir, cov, chi2, newHits)); //cout << "newZed " << *newZed << endl; // create a 4d segment with the special zed DTRecSegment4D* result= new DTRecSegment4D(*seg->phiSegment(), *newZed, seg->localPosition(), seg->localDirection()); // delete the input segment delete seg; // return it return result; }
void DTCombinatorialPatternReco4D::setChamber | ( | const DTChamberId & | chId | ) | [virtual] |
Implements DTRecSegment4DBaseAlgo.
Definition at line 70 of file DTCombinatorialPatternReco4D.cc.
References theChamber, and theDTGeometry.
{ // Set the chamber theChamber = theDTGeometry->chamber(chId); }
void DTCombinatorialPatternReco4D::setDTRecHit1DContainer | ( | edm::Handle< DTRecHitCollection > | all1DHits | ) | [virtual] |
Implements DTRecSegment4DBaseAlgo.
Definition at line 75 of file DTCombinatorialPatternReco4D.cc.
References allDTRecHits, gather_cfg::cout, debug, DTSuperLayerId, DTChamber::id(), DTRangeMapAccessor::layersBySuperLayer(), theChamber, theHitsFromPhi1, theHitsFromPhi2, and theHitsFromTheta.
{ theHitsFromPhi1.clear(); theHitsFromPhi2.clear(); theHitsFromTheta.clear(); DTRecHitCollection::range rangeHitsFromPhi1 = all1DHits->get(DTRangeMapAccessor::layersBySuperLayer( DTSuperLayerId(theChamber->id(),1) ) ); DTRecHitCollection::range rangeHitsFromPhi2 = all1DHits->get(DTRangeMapAccessor::layersBySuperLayer( DTSuperLayerId(theChamber->id(),3) ) ); vector<DTRecHit1DPair> hitsFromPhi1(rangeHitsFromPhi1.first,rangeHitsFromPhi1.second); vector<DTRecHit1DPair> hitsFromPhi2(rangeHitsFromPhi2.first,rangeHitsFromPhi2.second); if(debug) cout<< "Number of DTRecHit1DPair in the SL 1 (Phi 1): " << hitsFromPhi1.size()<<endl << "Number of DTRecHit1DPair in the SL 3 (Phi 2): " << hitsFromPhi2.size()<<endl; theHitsFromPhi1 = hitsFromPhi1; theHitsFromPhi2 = hitsFromPhi2; if(allDTRecHits){ DTRecHitCollection::range rangeHitsFromTheta = all1DHits->get(DTRangeMapAccessor::layersBySuperLayer( DTSuperLayerId(theChamber->id(),2) ) ); vector<DTRecHit1DPair> hitsFromTheta(rangeHitsFromTheta.first,rangeHitsFromTheta.second); if(debug) cout<< "Number of DTRecHit1DPair in the SL 2 (Theta): " << hitsFromTheta.size()<<endl; theHitsFromTheta = hitsFromTheta; } }
void DTCombinatorialPatternReco4D::setDTRecSegment2DContainer | ( | edm::Handle< DTRecSegment2DCollection > | all2DSegments | ) | [virtual] |
Implements DTRecSegment4DBaseAlgo.
Definition at line 106 of file DTCombinatorialPatternReco4D.cc.
References allDTRecHits, gather_cfg::cout, debug, DTSuperLayerId, DTChamber::id(), theChamber, and theSegments2DTheta.
{ theSegments2DTheta.clear(); if(!allDTRecHits){ //Extract the DTRecSegment2DCollection range for the theta SL DTRecSegment2DCollection::range rangeTheta = all2DSegments->get(DTSuperLayerId(theChamber->id(),2)); // Fill the DTRecSegment2D container for the theta SL vector<DTSLRecSegment2D> segments2DTheta(rangeTheta.first,rangeTheta.second); if(debug) cout << "Number of 2D-segments in the second SL (Theta): " << segments2DTheta.size() << endl; theSegments2DTheta = segments2DTheta; } }
void DTCombinatorialPatternReco4D::setES | ( | const edm::EventSetup & | setup | ) | [virtual] |
Implements DTRecSegment4DBaseAlgo.
Definition at line 64 of file DTCombinatorialPatternReco4D.cc.
References edm::EventSetup::get(), DTCombinatorialPatternReco::setES(), DTSegmentUpdator::setES(), the2DAlgo, theDTGeometry, and theUpdator.
{ setup.get<MuonGeometryRecord>().get(theDTGeometry); the2DAlgo->setES(setup); theUpdator->setES(setup); }
virtual bool DTCombinatorialPatternReco4D::wants2DSegments | ( | ) | [inline, virtual] |
Implements DTRecSegment4DBaseAlgo.
Definition at line 61 of file DTCombinatorialPatternReco4D.h.
References allDTRecHits.
{return !allDTRecHits;}
bool DTCombinatorialPatternReco4D::allDTRecHits [private] |
Definition at line 87 of file DTCombinatorialPatternReco4D.h.
Referenced by DTCombinatorialPatternReco4D(), reconstruct(), setDTRecHit1DContainer(), setDTRecSegment2DContainer(), and wants2DSegments().
bool DTCombinatorialPatternReco4D::applyT0corr [private] |
Definition at line 88 of file DTCombinatorialPatternReco4D.h.
Referenced by DTCombinatorialPatternReco4D(), and reconstruct().
bool DTCombinatorialPatternReco4D::computeT0corr [private] |
Definition at line 89 of file DTCombinatorialPatternReco4D.h.
Referenced by DTCombinatorialPatternReco4D(), and reconstruct().
bool DTCombinatorialPatternReco4D::debug [private] |
Definition at line 71 of file DTCombinatorialPatternReco4D.h.
Referenced by DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates(), DTCombinatorialPatternReco4D(), reconstruct(), setDTRecHit1DContainer(), and setDTRecSegment2DContainer().
Definition at line 79 of file DTCombinatorialPatternReco4D.h.
Referenced by DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates(), DTCombinatorialPatternReco4D(), reconstruct(), setES(), and ~DTCombinatorialPatternReco4D().
std::string DTCombinatorialPatternReco4D::theAlgoName [private] |
Definition at line 69 of file DTCombinatorialPatternReco4D.h.
Referenced by algoName().
const DTChamber* DTCombinatorialPatternReco4D::theChamber [private] |
Definition at line 84 of file DTCombinatorialPatternReco4D.h.
Referenced by reconstruct(), setChamber(), setDTRecHit1DContainer(), and setDTRecSegment2DContainer().
Definition at line 75 of file DTCombinatorialPatternReco4D.h.
Referenced by DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates(), setChamber(), and setES().
std::vector<DTRecHit1DPair> DTCombinatorialPatternReco4D::theHitsFromPhi1 [private] |
Definition at line 93 of file DTCombinatorialPatternReco4D.h.
Referenced by DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates(), and setDTRecHit1DContainer().
std::vector<DTRecHit1DPair> DTCombinatorialPatternReco4D::theHitsFromPhi2 [private] |
Definition at line 95 of file DTCombinatorialPatternReco4D.h.
Referenced by DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates(), and setDTRecHit1DContainer().
std::vector<DTRecHit1DPair> DTCombinatorialPatternReco4D::theHitsFromTheta [private] |
Definition at line 94 of file DTCombinatorialPatternReco4D.h.
Referenced by reconstruct(), and setDTRecHit1DContainer().
std::vector<DTSLRecSegment2D> DTCombinatorialPatternReco4D::theSegments2DTheta [private] |
Definition at line 92 of file DTCombinatorialPatternReco4D.h.
Referenced by reconstruct(), and setDTRecSegment2DContainer().
Definition at line 82 of file DTCombinatorialPatternReco4D.h.
Referenced by DTCombinatorialPatternReco4D(), reconstruct(), setES(), and ~DTCombinatorialPatternReco4D().