CMS 3D CMS Logo

TripletGenerator Class Reference

#include <RecoPixelVertexing/PixelLowPtUtilities/interface/TripletGenerator.h>

Inheritance diagram for TripletGenerator:

HitTripletGeneratorFromPairAndLayers HitTripletGenerator OrderedHitsGenerator

List of all members.

Public Member Functions

virtual void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es)
virtual void init (const HitPairGenerator &pairs, const std::vector< ctfseeding::SeedingLayer > &layers, LayerCacheType *layerCache)
const HitPairGeneratorpairGenerator () const
const std::vector
< ctfseeding::SeedingLayer > & 
thirdLayers () const
 TripletGenerator (const edm::ParameterSet &cfg)
virtual ~TripletGenerator ()

Private Types

typedef
CombinedHitTripletGenerator::LayerCacheType 
LayerCacheType

Private Member Functions

GlobalPoint getGlobalPosition (const TrackingRecHit *recHit)
void getTracker (const edm::EventSetup &es)

Private Attributes

bool checkClusterShape
bool checkMultipleScattering
double maxAngleRatio
double nSigMultipleScattering
edm::ParameterSet ps
double rzTolerance
LayerCacheTypetheLayerCache
std::vector
< ctfseeding::SeedingLayer
theLayers
HitPairGeneratorthePairGenerator
const TrackerGeometrytheTracker


Detailed Description

Definition at line 22 of file TripletGenerator.h.


Member Typedef Documentation

typedef CombinedHitTripletGenerator::LayerCacheType TripletGenerator::LayerCacheType [private]

Reimplemented from HitTripletGeneratorFromPairAndLayers.

Definition at line 25 of file TripletGenerator.h.


Constructor & Destructor Documentation

TripletGenerator::TripletGenerator ( const edm::ParameterSet cfg  )  [inline]

Definition at line 28 of file TripletGenerator.h.

References theTracker.

00029     : ps(cfg), thePairGenerator(0), theLayerCache(0) { theTracker = 0; }

virtual TripletGenerator::~TripletGenerator (  )  [inline, virtual]

Definition at line 31 of file TripletGenerator.h.

References thePairGenerator.

00031 { delete thePairGenerator; }


Member Function Documentation

GlobalPoint TripletGenerator::getGlobalPosition ( const TrackingRecHit recHit  )  [private]

Definition at line 55 of file TripletGenerator.cc.

References detId, TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), TrackingRecHit::localPosition(), theTracker, and GeomDet::toGlobal().

Referenced by hitTriplets().

00056 {
00057   DetId detId = recHit->geographicalId();
00058 
00059   return
00060     theTracker->idToDet(detId)->toGlobal(recHit->localPosition());
00061 }

void TripletGenerator::getTracker ( const edm::EventSetup es  )  [private]

Definition at line 41 of file TripletGenerator.cc.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and theTracker.

Referenced by hitTriplets().

00042 {
00043   if(theTracker == 0)
00044   {
00045     // Get tracker geometry
00046     edm::ESHandle<TrackerGeometry> tracker;
00047     es.get<TrackerDigiGeometryRecord>().get(tracker);
00048 
00049     theTracker = tracker.product();
00050   }
00051 }

void TripletGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets trs,
const edm::Event ev,
const edm::EventSetup es 
) [virtual]

Implements HitTripletGenerator.

Definition at line 64 of file TripletGenerator.cc.

References TestMuL1L2Filter_cff::cerr, checkClusterShape, checkMultipleScattering, TripletFilter::checkTrack(), DBG, ctfseeding::SeedingLayer::detLayer(), lat::endl(), getGlobalPosition(), LayerHitMapLoop::getHit(), HitInfo::getInfo(), getTracker(), HitPairGenerator::hitPairs(), i, TrackerGeometry::idToDet(), DetLayer::location(), LayerHitMap::loop(), maxAngleRatio, nSigMultipleScattering, mergeAndRegister_online::pairs, phi, rzTolerance, OrderedHitPairs::size(), size, DetLayer::subDetector(), theLayerCache, theLayers, thePairGenerator, theTracker, and toLocal().

00069 {
00070   // Generate pairs
00071   OrderedHitPairs pairs; pairs.reserve(30000);
00072   thePairGenerator->hitPairs(region,pairs,ev,es);
00073 
00074   if (pairs.size() == 0) return;
00075 
00076   int size = theLayers.size(); 
00077 
00078   // Filter 
00079   TripletFilter theFilter(es);
00080 
00081   // Set aliases
00082   const LayerHitMap **thirdHitMap = new const LayerHitMap* [size];
00083   for(int il=0; il<size; il++)
00084     thirdHitMap[il] = &(*theLayerCache)(&theLayers[il], region, ev, es);
00085 
00086   // Get tracker
00087   getTracker(es);
00088 
00089   // Look at all generated pairs
00090   for(OrderedHitPairs::const_iterator ip = pairs.begin();
00091                                       ip!= pairs.end(); ip++)
00092   {
00093     // Fill rechits and points
00094     vector<const TrackingRecHit*> recHits(3);
00095     vector<GlobalPoint> points(3);
00096 
00097     recHits[0] = (*ip).inner();
00098     recHits[1] = (*ip).outer();
00099 
00100 if(DBG)
00101 cerr << " RecHits " + HitInfo::getInfo(*recHits[0]) +
00102                       HitInfo::getInfo(*recHits[1]) << endl;
00103 
00104     for(int i=0; i<2; i++)
00105       points[i] = getGlobalPosition(recHits[i]);
00106 
00107     // Initialize helix prediction
00108     ThirdHitPrediction
00109       thePrediction(region.originRBound(), region.ptMin(),
00110                     points[0],points[1], es,
00111                     nSigMultipleScattering,maxAngleRatio);
00112 
00113     // Look at all layers
00114     for(int il=0; il<size; il++)
00115     {
00116       const SeedingLayer & layerwithhits = theLayers[il];
00117       const DetLayer * layer = layerwithhits.detLayer();
00118 
00119 if(DBG)
00120 cerr << "  check layer " << layer->subDetector() << " " << layer->location() << endl;
00121 
00122       // Get ranges for the third hit
00123       float phi[2],rz[2];
00124       thePrediction.getRanges(layer, phi,rz);
00125 
00126       PixelRecoRange<float> phiRange(phi[0]              , phi[1]             );
00127       PixelRecoRange<float>  rzRange( rz[0] - rzTolerance, rz[1] + rzTolerance);
00128 
00129       // Get third hit candidates from cache
00130       LayerHitMapLoop thirdHits = thirdHitMap[il]->loop(phiRange, rzRange);
00131       const SeedingHit * th;
00132       while( (th = thirdHits.getHit()) )
00133       {
00134         // Fill rechit and point
00135         recHits[2] = *th;
00136         points[2]  = getGlobalPosition(recHits[2]);
00137 
00138 if(DBG)
00139   cerr << "  third hit " + HitInfo::getInfo(*recHits[2]) << endl;
00140 
00141         // Check if third hit is compatible with multiple scattering
00142         vector<GlobalVector> globalDirs;
00143         if(thePrediction.isCompatibleWithMultipleScattering
00144              (points[2], recHits, globalDirs, es) == false)
00145         {
00146 if(DBG)
00147           cerr << "  not compatible: multiple scattering" << endl;
00148           if(checkMultipleScattering) continue;
00149         }
00150 
00151         // Convert to localDirs
00152         vector<LocalVector> localDirs;
00153         vector<GlobalVector>::const_iterator globalDir = globalDirs.begin();
00154         for(vector<const TrackingRecHit *>::const_iterator
00155                                             recHit  = recHits.begin();
00156                                             recHit != recHits.end(); recHit++)
00157         {
00158           localDirs.push_back(theTracker->idToDet(
00159                              (*recHit)->geographicalId())->toLocal(*globalDir));
00160           globalDir++;
00161         }
00162 
00163         // Check if the cluster shapes are compatible with thrusts
00164         if(checkClusterShape)
00165         {
00166           if(theFilter.checkTrack(recHits,localDirs) == false)
00167           {
00168 if(DBG)
00169             cerr << "  not compatible: cluster shape" << endl;
00170             continue;
00171           }
00172         }
00173 
00174         // All checks passed, put triplet back
00175         result.push_back(OrderedHitTriplet((*ip).inner(),(*ip).outer(),*th));
00176       }
00177     }
00178   } 
00179   delete [] thirdHitMap;
00180 
00181   return;
00182 }

void TripletGenerator::init ( const HitPairGenerator pairs,
const std::vector< ctfseeding::SeedingLayer > &  layers,
LayerCacheType layerCache 
) [virtual]

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 24 of file TripletGenerator.cc.

References checkClusterShape, checkMultipleScattering, HitPairGenerator::clone(), edm::ParameterSet::getParameter(), maxAngleRatio, nSigMultipleScattering, ps, rzTolerance, theLayerCache, theLayers, and thePairGenerator.

00027 {
00028   thePairGenerator = pairs.clone();
00029   theLayers = layers;
00030   theLayerCache = layerCache;
00031 
00032   checkMultipleScattering = ps.getParameter<bool>("checkMultipleScattering");
00033   nSigMultipleScattering  = ps.getParameter<double>("nSigMultipleScattering");
00034   checkClusterShape       = ps.getParameter<bool>("checkClusterShape"); 
00035   rzTolerance             = ps.getParameter<double>("rzTolerance");
00036   maxAngleRatio           = ps.getParameter<double>("maxAngleRatio");
00037 }

const HitPairGenerator& TripletGenerator::pairGenerator (  )  const [inline]

Definition at line 38 of file TripletGenerator.h.

References thePairGenerator.

00038 { return *thePairGenerator; }

const std::vector<ctfseeding::SeedingLayer>& TripletGenerator::thirdLayers (  )  const [inline]

Definition at line 39 of file TripletGenerator.h.

References theLayers.

00039 { return theLayers; }


Member Data Documentation

bool TripletGenerator::checkClusterShape [private]

Definition at line 54 of file TripletGenerator.h.

Referenced by hitTriplets(), and init().

bool TripletGenerator::checkMultipleScattering [private]

Definition at line 52 of file TripletGenerator.h.

Referenced by hitTriplets(), and init().

double TripletGenerator::maxAngleRatio [private]

Definition at line 56 of file TripletGenerator.h.

Referenced by hitTriplets(), and init().

double TripletGenerator::nSigMultipleScattering [private]

Definition at line 53 of file TripletGenerator.h.

Referenced by hitTriplets(), and init().

edm::ParameterSet TripletGenerator::ps [private]

Definition at line 47 of file TripletGenerator.h.

Referenced by init().

double TripletGenerator::rzTolerance [private]

Definition at line 55 of file TripletGenerator.h.

Referenced by hitTriplets(), and init().

LayerCacheType* TripletGenerator::theLayerCache [private]

Definition at line 50 of file TripletGenerator.h.

Referenced by hitTriplets(), and init().

std::vector<ctfseeding::SeedingLayer> TripletGenerator::theLayers [private]

Definition at line 49 of file TripletGenerator.h.

Referenced by hitTriplets(), init(), and thirdLayers().

HitPairGenerator* TripletGenerator::thePairGenerator [private]

Definition at line 48 of file TripletGenerator.h.

Referenced by hitTriplets(), init(), pairGenerator(), and ~TripletGenerator().

const TrackerGeometry* TripletGenerator::theTracker [private]

Definition at line 45 of file TripletGenerator.h.

Referenced by getGlobalPosition(), getTracker(), hitTriplets(), and TripletGenerator().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:37 2009 for CMSSW by  doxygen 1.5.4