CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTMeantimerPatternReco4D Class Reference

#include <DTMeantimerPatternReco4D.h>

Inheritance diagram for DTMeantimerPatternReco4D:
DTRecSegment4DBaseAlgo

List of all members.

Public Member Functions

virtual std::string algoName () const
 DTMeantimerPatternReco4D (const edm::ParameterSet &pset)
 Constructor.
virtual edm::OwnVector
< DTRecSegment4D
reconstruct ()
 Operations.
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.

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 <stefano.lacaprara@pd.infn.it>
Riccardo Bellan - INFN TO <riccardo.bellan@cern.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.

                                                                          :
  DTRecSegment4DBaseAlgo(pset), theAlgoName("DTMeantimerPatternReco4D"){

    // debug parameter
    debug = pset.getUntrackedParameter<bool>("debug");

    // 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 DTMeantimerPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
  }
DTMeantimerPatternReco4D::~DTMeantimerPatternReco4D ( ) [virtual]

Destructor.

Definition at line 56 of file DTMeantimerPatternReco4D.cc.

References the2DAlgo, and theUpdator.

                                                   {
  delete the2DAlgo;
  delete theUpdator;
}

Member Function Documentation

virtual std::string DTMeantimerPatternReco4D::algoName ( void  ) const [inline, virtual]

Implements DTRecSegment4DBaseAlgo.

Definition at line 54 of file DTMeantimerPatternReco4D.h.

References theAlgoName.

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

Definition at line 263 of file DTCombinatorialPatternReco4D.cc.

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

Referenced by reconstruct().

                                                                                                                          {

  DTSuperLayerId slId;

  if(theHitsFromPhi1.size())
    slId = theHitsFromPhi1.front().wireId().superlayerId();
  else
    if(theHitsFromPhi2.size())
      slId = theHitsFromPhi2.front().wireId().superlayerId();
    else{
      if(debug) cout<<"DTCombinatorialPatternReco4D::buildPhiSuperSegmentsCandidates: "
        <<"No Hits in the two Phi SL"<<endl;
      return vector<DTSegmentCand*>();
    }

  const DTSuperLayer *sl = theDTGeometry->superLayer(slId);

  vector<DTHitPairForFit*> pairPhi1 = the2DAlgo->initHits(sl,theHitsFromPhi1);
  // same sl!! Since the fit will be in the sl phi 1!
  vector<DTHitPairForFit*> pairPhi2 = the2DAlgo->initHits(sl,theHitsFromPhi2);
  // copy the pairPhi2 in the pairPhi1 vector 
  copy(pairPhi2.begin(),pairPhi2.end(),back_inserter(pairPhi1));

  pairPhiOwned.swap(pairPhi1);
  // Build the segment candidate
  return the2DAlgo->buildSegments(sl,pairPhiOwned);
}
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(), phi, edm::OwnVector< T, P >::push_back(), DTMeantimerPatternReco::reconstruct(), query::result, DTChamber::superLayer(), the2DAlgo, theChamber, theHitsFromTheta, theSegments2DTheta, theUpdator, GeomDet::toGlobal(), GeomDet::toLocal(), and DTSegmentUpdator::update().

                                     {

  OwnVector<DTRecSegment4D> result;

  if (debug){ 
    cout << "Segments in " << theChamber->id() << endl;
    cout << "Reconstructing Phi segments"<<endl;
  }
  vector<DTSegmentCand*> resultPhi = buildPhiSuperSegmentsCandidates();

  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 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 the concrete DTRecSegment4D"<<endl;
  if (resultPhi.size()) {
    for (vector<DTSegmentCand*>::const_iterator phi=resultPhi.begin();
         phi!=resultPhi.end(); ++phi) {

      DTChamberRecSegment2D* superPhi = (**phi);

      theUpdator->update(superPhi);

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

          // 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(*superPhi,*zed,posZInCh,dirZInCh);
          //<<

          theUpdator->update(newSeg);
          if (debug) cout << "Created a 4D seg " << *newSeg << endl;
          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" << endl;
        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){

        // 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" << endl;
        result.push_back(newSeg);
      }
    }
  }
  // finally delete the candidates!
  for (vector<DTSegmentCand*>::iterator phi=resultPhi.begin();
       phi!=resultPhi.end(); ++phi) delete *phi;

  return result;
}
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.

                                                                {
  // Set the chamber
  theChamber = theDTGeometry->chamber(chId); 
}
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.

                                                                                         {
  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 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.

                                                                                                       {
  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 DTMeantimerPatternReco4D::setES ( const edm::EventSetup setup) [virtual]
virtual bool DTMeantimerPatternReco4D::wants2DSegments ( ) [inline, virtual]

Implements DTRecSegment4DBaseAlgo.

Definition at line 60 of file DTMeantimerPatternReco4D.h.

References allDTRecHits.

{return !allDTRecHits;}

Member Data Documentation

Definition at line 69 of file DTMeantimerPatternReco4D.h.

Referenced by algoName().

Definition at line 75 of file DTMeantimerPatternReco4D.h.

Referenced by setChamber(), and setES().

Definition at line 91 of file DTMeantimerPatternReco4D.h.

Referenced by setDTRecHit1DContainer().

Definition at line 93 of file DTMeantimerPatternReco4D.h.

Referenced by setDTRecHit1DContainer().

Definition at line 92 of file DTMeantimerPatternReco4D.h.

Referenced by reconstruct(), and setDTRecHit1DContainer().

Definition at line 90 of file DTMeantimerPatternReco4D.h.

Referenced by reconstruct(), and setDTRecSegment2DContainer().