CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTRefitAndCombineReco4D Class Reference

#include <DTRefitAndCombineReco4D.h>

Inheritance diagram for DTRefitAndCombineReco4D:
DTRecSegment4DBaseAlgo

List of all members.

Public Member Functions

virtual std::string algoName () const
 DTRefitAndCombineReco4D (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 ~DTRefitAndCombineReco4D ()
 Destructor.

Private Member Functions

std::vector
< DTChamberRecSegment2D
refitSuperSegments ()

Private Attributes

bool debug
std::string theAlgoName
const DTChambertheChamber
edm::ESHandle< DTGeometrytheDTGeometry
double theMaxChi2forPhi
std::vector< DTSLRecSegment2DtheSegments2DPhi1
std::vector< DTSLRecSegment2DtheSegments2DPhi2
std::vector< DTSLRecSegment2DtheSegments2DTheta
DTSegmentUpdatortheUpdator

Detailed Description

Algo for reconstructing 4d segment in DT refitting the 2D phi SL hits and combining the results with the theta view.

Date:
2006/04/28 15:21:52
Revision:
1.5
Author:
Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>

Algo for reconstructing 4d segment in DT refitting the 2D phi SL hits and combining the results with the theta view.

Date:
2006/05/04 09:17:36
Revision:
1.5
Author:
Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>

Definition at line 41 of file DTRefitAndCombineReco4D.h.


Constructor & Destructor Documentation

DTRefitAndCombineReco4D::DTRefitAndCombineReco4D ( const edm::ParameterSet pset)

Constructor.

Definition at line 31 of file DTRefitAndCombineReco4D.cc.

References debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), theMaxChi2forPhi, and theUpdator.

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

  // debug parameter
  debug = pset.getUntrackedParameter<bool>("debug");
  
  // the updator
  theUpdator = new DTSegmentUpdator(pset);

  // the max allowd chi^2 for the fit of th combination of two phi segments
  theMaxChi2forPhi = pset.getParameter<double>("MaxChi2forPhi");
}
virtual DTRefitAndCombineReco4D::~DTRefitAndCombineReco4D ( ) [inline, virtual]

Destructor.

Definition at line 49 of file DTRefitAndCombineReco4D.h.

{};

Member Function Documentation

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 55 of file DTRefitAndCombineReco4D.h.

References theAlgoName.

{ return theAlgoName; }
OwnVector< DTRecSegment4D > DTRefitAndCombineReco4D::reconstruct ( ) [virtual]

Operations.

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

Implements DTRecSegment4DBaseAlgo.

Definition at line 89 of file DTRefitAndCombineReco4D.cc.

References gather_cfg::cout, debug, DTChamber::id(), phi, edm::OwnVector< T, P >::push_back(), refitSuperSegments(), query::result, DTChamber::superLayer(), theChamber, theSegments2DTheta, theUpdator, GeomDet::toGlobal(), GeomDet::toLocal(), and DTSegmentUpdator::update().

                                    {
  OwnVector<DTRecSegment4D> result;
  
  if (debug) cout << "Segments in " << theChamber->id() << endl;

  vector<DTChamberRecSegment2D> resultPhi = refitSuperSegments();

  if (debug) cout << "There are " << resultPhi.size() << " Phi cand" << endl;
  
  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 (resultPhi.size()) {
    for (vector<DTChamberRecSegment2D>::const_iterator phi=resultPhi.begin();
         phi!=resultPhi.end(); ++phi) {
      
      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(*phi,*zed,posZInCh,dirZInCh);
          //<<

          theUpdator->update(newSeg);
          if (debug) cout << "Created a 4D seg " << endl;
          result.push_back(newSeg);
        }
      } else {
        // Only phi
        DTRecSegment4D* newSeg = new DTRecSegment4D(*phi);
        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);
      }
    }
  }
  
  return result;
}
vector< DTChamberRecSegment2D > DTRefitAndCombineReco4D::refitSuperSegments ( ) [private]

Definition at line 165 of file DTRefitAndCombineReco4D.cc.

References DTRecSegment2D::chi2(), filterCSVwithJSON::copy, DTSegmentUpdator::fit(), query::result, theMaxChi2forPhi, theSegments2DPhi1, theSegments2DPhi2, and theUpdator.

Referenced by reconstruct().

                                                                         {
  vector<DTChamberRecSegment2D> result;
  
  //double-loop over all the DTSLRecSegment2D in order to make all the possible pairs
  for(vector<DTSLRecSegment2D>::const_iterator segment2DPhi1 = theSegments2DPhi1.begin();
      segment2DPhi1 != theSegments2DPhi1.end(); ++segment2DPhi1){
    for(vector<DTSLRecSegment2D>::const_iterator segment2DPhi2 = theSegments2DPhi2.begin();
        segment2DPhi2 != theSegments2DPhi2.end(); ++segment2DPhi2){

      // check the id
      if(segment2DPhi1->chamberId() !=  segment2DPhi2->chamberId())
        throw cms::Exception("refitSuperSegments")
          <<"he phi segments have different chamber id"<<std::endl;
      
      // create a super phi starting from 2 phi
      vector<DTRecHit1D> recHitsSeg2DPhi1 =  segment2DPhi1->specificRecHits();
      vector<DTRecHit1D> recHitsSeg2DPhi2 =  segment2DPhi2->specificRecHits();
      // copy the recHitsSeg2DPhi2 in the recHitsSeg2DPhi1 container
      copy(recHitsSeg2DPhi2.begin(),recHitsSeg2DPhi2.end(),back_inserter(recHitsSeg2DPhi1));
      
      const DTChamberId chId = segment2DPhi1->chamberId();

      // create the super phi
      DTChamberRecSegment2D superPhi(chId,recHitsSeg2DPhi1); 
      
      // refit it!
      theUpdator->fit(&superPhi);
      
      // cut on the chi^2
      if (superPhi.chi2() > theMaxChi2forPhi)
        result.push_back(superPhi);
    }
  }
  // TODO clean the container!!!
  // there are some possible repetition!
  // maybe using the cleaner, previous a conversion from DTChamberRecSegment2D to DTSegmentCandidate
  return result;
}
void DTRefitAndCombineReco4D::setChamber ( const DTChamberId chId) [virtual]

Implements DTRecSegment4DBaseAlgo.

Definition at line 50 of file DTRefitAndCombineReco4D.cc.

References theChamber, and theDTGeometry.

                                                               {
  // Set the chamber
  theChamber = theDTGeometry->chamber(chId); 
}
virtual void DTRefitAndCombineReco4D::setDTRecHit1DContainer ( edm::Handle< DTRecHitCollection all1DHits) [inline, virtual]

Implements DTRecSegment4DBaseAlgo.

Definition at line 59 of file DTRefitAndCombineReco4D.h.

{};
void DTRefitAndCombineReco4D::setDTRecSegment2DContainer ( edm::Handle< DTRecSegment2DCollection all2DSegments) [virtual]

Implements DTRecSegment4DBaseAlgo.

Definition at line 56 of file DTRefitAndCombineReco4D.cc.

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

                                                                                            {
  theSegments2DPhi1.clear();
  theSegments2DTheta.clear();
  theSegments2DPhi2.clear();

  // Get the chamber
  //    const DTChamber *chamber = theDTGeometry->chamber(chId);
  
  const DTChamberId chId =  theChamber->id();
  
  //Extract the DTRecSegment2DCollection ranges for the three different SL
  DTRecSegment2DCollection::range rangePhi1   = allHits->get(DTSuperLayerId(chId,1));
  DTRecSegment2DCollection::range rangeTheta = allHits->get(DTSuperLayerId(chId,2));
  DTRecSegment2DCollection::range rangePhi2   = allHits->get(DTSuperLayerId(chId,3));
    
  // Fill the DTSLRecSegment2D containers for the three different SL
  vector<DTSLRecSegment2D> segments2DPhi1(rangePhi1.first,rangePhi1.second);
  vector<DTSLRecSegment2D> segments2DTheta(rangeTheta.first,rangeTheta.second);
  vector<DTSLRecSegment2D> segments2DPhi2(rangePhi2.first,rangePhi2.second);

  if(debug)
    cout << "Number of 2D-segments in the first  SL (Phi)" << segments2DPhi1.size() << endl
         << "Number of 2D-segments in the second SL (Theta)" << segments2DTheta.size() << endl
         << "Number of 2D-segments in the third  SL (Phi)" << segments2DPhi2.size() << endl;
    
  theSegments2DPhi1 = segments2DPhi1;
  theSegments2DTheta = segments2DTheta;
  theSegments2DPhi2 = segments2DPhi2;
}
void DTRefitAndCombineReco4D::setES ( const edm::EventSetup setup) [virtual]

Implements DTRecSegment4DBaseAlgo.

Definition at line 44 of file DTRefitAndCombineReco4D.cc.

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

                                                          {
  setup.get<MuonGeometryRecord>().get(theDTGeometry);
  theUpdator->setES(setup);
  //  the2DAlgo->setES(setup);
}
virtual bool DTRefitAndCombineReco4D::wants2DSegments ( ) [inline, virtual]

Implements DTRecSegment4DBaseAlgo.

Definition at line 62 of file DTRefitAndCombineReco4D.h.

{return true;}

Member Data Documentation

std::string DTRefitAndCombineReco4D::theAlgoName [private]

Definition at line 69 of file DTRefitAndCombineReco4D.h.

Referenced by algoName().

Definition at line 85 of file DTRefitAndCombineReco4D.h.

Referenced by reconstruct(), setChamber(), and setDTRecSegment2DContainer().

Definition at line 77 of file DTRefitAndCombineReco4D.h.

Referenced by setChamber(), and setES().

Definition at line 71 of file DTRefitAndCombineReco4D.h.

Referenced by DTRefitAndCombineReco4D(), and refitSuperSegments().

Definition at line 86 of file DTRefitAndCombineReco4D.h.

Referenced by refitSuperSegments(), and setDTRecSegment2DContainer().

Definition at line 88 of file DTRefitAndCombineReco4D.h.

Referenced by refitSuperSegments(), and setDTRecSegment2DContainer().

Definition at line 87 of file DTRefitAndCombineReco4D.h.

Referenced by reconstruct(), and setDTRecSegment2DContainer().