CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

CosmicTrajectoryBuilder Class Reference

#include <CosmicTrajectoryBuilder.h>

List of all members.

Public Member Functions

 CosmicTrajectoryBuilder (const edm::ParameterSet &conf)
Trajectory createStartingTrajectory (const TrajectorySeed &seed) const
void init (const edm::EventSetup &es, bool)
void run (const TrajectorySeedCollection &collseed, const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const edm::EventSetup &es, edm::Event &e, std::vector< Trajectory > &trajoutput)
 Runs the algorithm.
 ~CosmicTrajectoryBuilder ()

Private Types

typedef TrajectoryMeasurement TM
typedef TrajectoryStateOnSurface TSOS

Private Member Functions

void AddHit (Trajectory &traj, const std::vector< const TrackingRecHit * > &Hits)
bool qualityFilter (const Trajectory &traj)
std::vector
< TrajectoryMeasurement
seedMeasurements (const TrajectorySeed &seed) const
std::vector< const
TrackingRecHit * > 
SortHits (const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed)
TSOS startingTSOS (const TrajectorySeed &seed) const
void updateTrajectory (Trajectory &traj, const TM &tm, const TransientTrackingRecHit &hit) const

Private Attributes

double chi2cut
edm::ParameterSet conf_
std::string geometry
TransientTrackingRecHit::RecHitContainer hits
edm::ESHandle< MagneticFieldmagfield
const
TransientTrackingRecHitBuilder
RHBuilder
bool seed_plus
Chi2MeasurementEstimatortheEstimator
const KFTrajectoryFittertheFitter
int theMinHits
PropagatorWithMaterialthePropagator
PropagatorWithMaterialthePropagatorOp
const KFTrajectorySmoothertheSmoother
KFUpdatortheUpdator
edm::ESHandle< TrackerGeometrytracker
std::vector< TrajectorytrajFit

Detailed Description

Definition at line 73 of file CosmicTrajectoryBuilder.h.


Member Typedef Documentation

Definition at line 77 of file CosmicTrajectoryBuilder.h.

Definition at line 76 of file CosmicTrajectoryBuilder.h.


Constructor & Destructor Documentation

CosmicTrajectoryBuilder::CosmicTrajectoryBuilder ( const edm::ParameterSet conf)

Definition at line 21 of file CosmicTrajectoryBuilder.cc.

References chi2cut, conf_, geometry, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and theMinHits.

                                                                            : conf_(conf) { 
  //minimum number of hits per tracks

  theMinHits=conf_.getParameter<int>("MinHits");
  //cut on chi2
  chi2cut=conf_.getParameter<double>("Chi2Cut");
  edm::LogInfo("CosmicTrackFinder")<<"Minimum number of hits "<<theMinHits<<" Cut on Chi2= "<<chi2cut;

  geometry=conf_.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
}
CosmicTrajectoryBuilder::~CosmicTrajectoryBuilder ( )

Definition at line 33 of file CosmicTrajectoryBuilder.cc.

                                                  {
}

Member Function Documentation

void CosmicTrajectoryBuilder::AddHit ( Trajectory traj,
const std::vector< const TrackingRecHit * > &  Hits 
) [private]
Trajectory CosmicTrajectoryBuilder::createStartingTrajectory ( const TrajectorySeed seed) const

Definition at line 130 of file CosmicTrajectoryBuilder.cc.

References TrajectorySeed::direction(), i, query::result, and seedMeasurements().

{
  Trajectory result( seed, seed.direction());
  std::vector<TM> seedMeas = seedMeasurements(seed);
  if ( !seedMeas.empty()) {
    for (std::vector<TM>::const_iterator i=seedMeas.begin(); i!=seedMeas.end(); i++){
      result.push(*i);
    }
  }
 
  return result;
}
void CosmicTrajectoryBuilder::init ( const edm::EventSetup es,
bool  seedplus 
)

Definition at line 37 of file CosmicTrajectoryBuilder.cc.

References alongMomentum, chi2cut, Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, conf_, edm::EventSetup::get(), edm::ParameterSet::getParameter(), KFTrajectoryFitterESProducer_cfi::KFTrajectoryFitter, KFTrajectorySmootherESProducer_cfi::KFTrajectorySmoother, magfield, oppositeToMomentum, edm::ESHandle< T >::product(), RHBuilder, seed_plus, AlCaHLTBitMon_QueryRunRegistry::string, theEstimator, theFitter, thePropagator, thePropagatorOp, theSmoother, theUpdator, and tracker.

bool CosmicTrajectoryBuilder::qualityFilter ( const Trajectory traj) [private]

Definition at line 347 of file CosmicTrajectoryBuilder.cc.

References Trajectory::foundHits(), geometry, hits, Trajectory::recHits(), and theMinHits.

Referenced by CRackTrajectoryBuilder::AddHit().

                                                            {
  int ngoodhits=0;
  if(geometry=="MTCC"){
    std::vector< ConstReferenceCountingPointer< TransientTrackingRecHit> > hits= traj.recHits();
    std::vector< ConstReferenceCountingPointer< TransientTrackingRecHit> >::const_iterator hit;
    for(hit=hits.begin();hit!=hits.end();hit++){
      unsigned int iid=(*hit)->hit()->geographicalId().rawId();
      //CHECK FOR 3 hits r-phi
      if(((iid>>0)&0x3)!=1) ngoodhits++;
    }
  }
  else ngoodhits=traj.foundHits();
  
  if ( ngoodhits >= theMinHits) {
    return true;
  }
  else {
    return false;
  }
}
void CosmicTrajectoryBuilder::run ( const TrajectorySeedCollection collseed,
const SiStripRecHit2DCollection collstereo,
const SiStripRecHit2DCollection collrphi,
const SiStripMatchedRecHit2DCollection collmatched,
const SiPixelRecHitCollection collpixel,
const edm::EventSetup es,
edm::Event e,
std::vector< Trajectory > &  trajoutput 
)

Runs the algorithm.

Referenced by cms::CosmicTrackFinder::produce().

std::vector< TrajectoryMeasurement > CosmicTrajectoryBuilder::seedMeasurements ( const TrajectorySeed seed) const [private]

Definition at line 145 of file CosmicTrajectoryBuilder.cc.

References TransientTrackingRecHitBuilder::build(), TrajectorySeed::recHits(), query::result, RHBuilder, startingTSOS(), and GeomDet::surface().

Referenced by createStartingTrajectory().

{
  std::vector<TrajectoryMeasurement> result;
  TrajectorySeed::range hitRange = seed.recHits();
  for (TrajectorySeed::const_iterator ihit = hitRange.first; 
       ihit != hitRange.second; ihit++) {
    //RC TransientTrackingRecHit* recHit = RHBuilder->build(&(*ihit));
    TransientTrackingRecHit::RecHitPointer recHit = RHBuilder->build(&(*ihit));
    const GeomDet* hitGeomDet = (&(*tracker))->idToDet( ihit->geographicalId());
    TSOS invalidState( new BasicSingleTrajectoryState( hitGeomDet->surface()));

    if (ihit == hitRange.second - 1) {
      TSOS  updatedState=startingTSOS(seed);
      result.push_back(TM( invalidState, updatedState, recHit));

    } 
    else {
      result.push_back(TM( invalidState, recHit));
    }
    
  }

  return result;
}
vector< const TrackingRecHit * > CosmicTrajectoryBuilder::SortHits ( const SiStripRecHit2DCollection collstereo,
const SiStripRecHit2DCollection collrphi,
const SiStripMatchedRecHit2DCollection collmatched,
const SiPixelRecHitCollection collpixel,
const TrajectorySeed seed 
) [private]

Definition at line 175 of file CosmicTrajectoryBuilder.cc.

References TransientTrackingRecHitBuilder::build(), edmNew::DetSetVector< T >::data(), hits, LogDebug, TrajectorySeed::recHits(), RHBuilder, seed_plus, and tracker.

                                                             {


  //The Hits with global y more than the seed are discarded
  //The Hits correspondign to the seed are discarded
  //At the end all the hits are sorted in y
  vector<const TrackingRecHit*> allHits;

  SiStripRecHit2DCollection::DataContainer::const_iterator istrip;
  TrajectorySeed::range hRange= seed.recHits();
  TrajectorySeed::const_iterator ihit;
  float yref=0.;
  for (ihit = hRange.first; 
       ihit != hRange.second; ihit++) {
    yref=RHBuilder->build(&(*ihit))->globalPosition().y();
    hits.push_back((RHBuilder->build(&(*ihit)))); 
    LogDebug("CosmicTrackFinder")<<"SEED HITS"<<RHBuilder->build(&(*ihit))->globalPosition();
  }

  
  if ((&collpixel)!=0){
    SiPixelRecHitCollection::DataContainer::const_iterator ipix;
    for(ipix=collpixel.data().begin();ipix!=collpixel.data().end();ipix++){
      float ych= RHBuilder->build(&(*ipix))->globalPosition().y();
      if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
        allHits.push_back(&(*ipix));
    }
  } 
  
  

  if ((&collrphi)!=0){
    for(istrip=collrphi.data().begin();istrip!=collrphi.data().end();istrip++){
      float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
      if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
        allHits.push_back(&(*istrip));   
    }
  }




  if ((&collstereo)!=0){
    for(istrip=collstereo.data().begin();istrip!=collstereo.data().end();istrip++){
      float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
      if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
        allHits.push_back(&(*istrip));
    }
  }

//   SiStripMatchedRecHit2DCollection::DataContainer::const_iterator istripm;
//   if ((&collmatched)!=0){
//     for(istripm=collmatched.data().begin();istripm!=collmatched.data().end();istripm++){
//       float ych= RHBuilder->build(&(*istripm))->globalPosition().y();
//       if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
//      allHits.push_back(&(*istripm));
//     }
//   }

  if (seed_plus){
    stable_sort(allHits.begin(),allHits.end(),CompareHitY_plus(*tracker));
  }
  else {
    stable_sort(allHits.begin(),allHits.end(),CompareHitY(*tracker));
  }

  return allHits;
}
TrajectoryStateOnSurface CosmicTrajectoryBuilder::startingTSOS ( const TrajectorySeed seed) const [private]

Definition at line 249 of file CosmicTrajectoryBuilder.cc.

References magfield, TrajectorySeed::startingState(), and trajectoryStateTransform::transientState().

Referenced by seedMeasurements().

{
  PTrajectoryStateOnDet pState( seed.startingState());
  const GeomDet* gdet  = (&(*tracker))->idToDet(DetId(pState.detId()));
  TSOS  State= trajectoryStateTransform::transientState( pState, &(gdet->surface()), 
                                           &(*magfield));
  return State;

}
void CosmicTrajectoryBuilder::updateTrajectory ( Trajectory traj,
const TM tm,
const TransientTrackingRecHit hit 
) const [private]

Member Data Documentation

Definition at line 122 of file CosmicTrajectoryBuilder.h.

Referenced by CosmicTrajectoryBuilder(), and init().

std::string CosmicTrajectoryBuilder::geometry [private]

Definition at line 140 of file CosmicTrajectoryBuilder.h.

Referenced by CosmicTrajectoryBuilder(), and qualityFilter().

Definition at line 120 of file CosmicTrajectoryBuilder.h.

Referenced by init(), and startingTSOS().

Definition at line 139 of file CosmicTrajectoryBuilder.h.

Referenced by init(), and SortHits().

Definition at line 127 of file CosmicTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder::AddHit(), and init().

Definition at line 130 of file CosmicTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder::AddHit(), and init().

Definition at line 134 of file CosmicTrajectoryBuilder.h.

Referenced by CosmicTrajectoryBuilder(), and qualityFilter().

Definition at line 124 of file CosmicTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder::AddHit(), and init().

Definition at line 125 of file CosmicTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder::AddHit(), and init().

Definition at line 129 of file CosmicTrajectoryBuilder.h.

Referenced by init().

Definition at line 126 of file CosmicTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder::AddHit(), and init().

Definition at line 121 of file CosmicTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder::AddHit(), init(), and SortHits().

Definition at line 136 of file CosmicTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder::AddHit().