#include <CosmicSeedCreator.h>
Public Member Functions | |
CosmicSeedCreator (const edm::ParameterSet &extra) | |
virtual void | init (const TrackingRegion ®ion, const edm::EventSetup &es, const SeedComparitor *filter) |
virtual void | makeSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) |
virtual | ~CosmicSeedCreator () |
Private Attributes | |
edm::ESHandle< MagneticField > | bfield |
const SeedComparitor * | filter = nullptr |
unsigned int | maxseeds_ |
const TrackingRegion * | region = nullptr |
Definition at line 12 of file CosmicSeedCreator.h.
CosmicSeedCreator::CosmicSeedCreator | ( | const edm::ParameterSet & | extra | ) | [inline] |
Definition at line 15 of file CosmicSeedCreator.h.
References edm::ParameterSet::getParameter(), and maxseeds_.
{ maxseeds_ = extra.getParameter<int>("maxseeds"); }
virtual CosmicSeedCreator::~CosmicSeedCreator | ( | ) | [inline, virtual] |
Definition at line 20 of file CosmicSeedCreator.h.
{}
void CosmicSeedCreator::init | ( | const TrackingRegion & | region, |
const edm::EventSetup & | es, | ||
const SeedComparitor * | filter | ||
) | [virtual] |
Implements SeedCreator.
Definition at line 15 of file CosmicSeedCreator.cc.
References bfield, filter, edm::EventSetup::get(), and region.
{ region = &iregion; filter = ifilter; // mag field es.get<IdealMagneticFieldRecord>().get(bfield); }
void CosmicSeedCreator::makeSeed | ( | TrajectorySeedCollection & | seedCollection, |
const SeedingHitSet & | hits | ||
) | [virtual] |
Implements SeedCreator.
Definition at line 25 of file CosmicSeedCreator.cc.
References alongMomentum, bfield, DeDxDiscriminatorTools::charge(), SeedComparitor::compatible(), TrackingRegion::direction(), filter, LogDebug, maxseeds_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), region, and SeedingHitSet::size().
{ //_________________________ // //Get Parameters //________________________ //hit package //+++++++++++ const SeedingHitSet & hits = ordered; if ( hits.size() < 2) return; //hits //++++ TransientTrackingRecHit::ConstRecHitPointer tth1 = hits[0]; TransientTrackingRecHit::ConstRecHitPointer tth2 = hits[1]; TransientTrackingRecHit::ConstRecHitPointer usedHit; //definition of position & momentum //++++++++++++++++++++++++++++++++++ GlobalVector initialMomentum(region->direction());//direction of the trajectory seed given by the direction of the region //fix the momentum scale //initialMomentum = initialMomentum.basicVector.unitVector() * region->origin().direction().mag(); //initialMomentum = region->origin().direction(); //alternative. LogDebug("CosmicSeedCreator") << "initial momentum = " << initialMomentum; //___________________________________________ // //Direction of the trajectory seed //___________________________________________ //radius //++++++ bool reverseAll = false; if ( fabs(tth1->globalPosition().perp()) < fabs(tth2->globalPosition().perp()) ) //comparison of the position of the 2 hits by checking/comparing their radius { usedHit=tth1; reverseAll = true; } else usedHit=tth2; //location in the barrel (up or bottom) //+++++++++++++++++++++++++++++++++++++ //simple check, probably nees to be more precise FIXME bool bottomSeed = (usedHit->globalPosition().y()<0); //apply corrections //+++++++++++++++++ edm::OwnVector<TrackingRecHit> seedHits; if (reverseAll){ LogDebug("CosmicSeedCreator") <<"Reverse all applied"; seedHits.push_back(tth2->hit()->clone()); seedHits.push_back(tth1->hit()->clone()); } else { seedHits.push_back(tth1->hit()->clone()); seedHits.push_back(tth2->hit()->clone()); } //propagation //+++++++++++ PropagationDirection seedDirection = alongMomentum; //by default if (reverseAll) initialMomentum *=-1; if (bottomSeed){ //means that the seed parameters are inverse of what we want. //reverse the momentum again initialMomentum *=-1; //and change the direction of the seed seedDirection = oppositeToMomentum; } for (int charge=-1;charge<=1;charge+=2){ //fixme, what hit do you want to use ? FreeTrajectoryState freeState(GlobalTrajectoryParameters(usedHit->globalPosition(), initialMomentum, charge, &*bfield), CurvilinearTrajectoryError(ROOT::Math::SMatrixIdentity()) ); LogDebug("CosmicSeedCreator")<<"Position freeState: " << usedHit->globalPosition() <<"\nCharge: "<< charge <<"\nInitial momentum :" << initialMomentum ; TrajectoryStateOnSurface tsos(freeState, *usedHit->surface()); PTrajectoryStateOnDet const & PTraj = trajectoryStateTransform::persistentState(tsos, usedHit->hit()->geographicalId().rawId()); TrajectorySeed seed(PTraj,seedHits,seedDirection); if (filter == 0 || filter->compatible(seed)) { seedCollection.push_back(seed); } }//end charge loop //________________ // //Return seed //________________ LogDebug("CosmicSeedCreator") << "Using SeedCreator---------->\n" << "seedCollections size = " << seedCollection.size(); if ( seedCollection.size() > maxseeds_ ) { edm::LogError("TooManySeeds") << "Found too many seeds (" << seedCollection.size() << " > " << maxseeds_ << "), bailing out.\n"; seedCollection.clear(); } }
edm::ESHandle<MagneticField> CosmicSeedCreator::bfield [private] |
Definition at line 36 of file CosmicSeedCreator.h.
Referenced by init(), and makeSeed().
const SeedComparitor* CosmicSeedCreator::filter = nullptr [private] |
Definition at line 35 of file CosmicSeedCreator.h.
Referenced by init(), and makeSeed().
unsigned int CosmicSeedCreator::maxseeds_ [private] |
Definition at line 38 of file CosmicSeedCreator.h.
Referenced by CosmicSeedCreator(), and makeSeed().
const TrackingRegion* CosmicSeedCreator::region = nullptr [private] |
Definition at line 34 of file CosmicSeedCreator.h.
Referenced by init(), and makeSeed().