#include <CosmicTrackingParticleSelector.h>
Public Types | |
typedef TrackingParticleCollection | collection |
typedef container::const_iterator | const_iterator |
typedef std::vector< const TrackingParticle * > | container |
Public Member Functions | |
const_iterator | begin () const |
CosmicTrackingParticleSelector () | |
CosmicTrackingParticleSelector (double ptMin, double minRapidity, double maxRapidity, double tip, double lip, int minHit, bool chargedOnly, std::vector< int > pdgId=std::vector< int >()) | |
CosmicTrackingParticleSelector (const edm::ParameterSet &cfg) | |
const_iterator | end () const |
bool | operator() (const TrackingParticle &tp, const reco::BeamSpot *bs, const edm::Event &iEvent, const edm::EventSetup &iSetup) const |
void | select (const edm::Handle< collection > &c, const edm::Event &event, const edm::EventSetup &setup) |
size_t | size () const |
Private Attributes | |
bool | chargedOnly_ |
double | lip_ |
double | maxRapidity_ |
int | minHit_ |
double | minRapidity_ |
std::vector< int > | pdgId_ |
double | ptMin_ |
container | selected_ |
double | tip_ |
Definition at line 32 of file CosmicTrackingParticleSelector.h.
Definition at line 35 of file CosmicTrackingParticleSelector.h.
typedef container::const_iterator CosmicTrackingParticleSelector::const_iterator |
Definition at line 37 of file CosmicTrackingParticleSelector.h.
typedef std::vector<const TrackingParticle *> CosmicTrackingParticleSelector::container |
Definition at line 36 of file CosmicTrackingParticleSelector.h.
CosmicTrackingParticleSelector::CosmicTrackingParticleSelector | ( | ) | [inline] |
Definition at line 39 of file CosmicTrackingParticleSelector.h.
{}
CosmicTrackingParticleSelector::CosmicTrackingParticleSelector | ( | double | ptMin, |
double | minRapidity, | ||
double | maxRapidity, | ||
double | tip, | ||
double | lip, | ||
int | minHit, | ||
bool | chargedOnly, | ||
std::vector< int > | pdgId = std::vector<int>() |
||
) | [inline] |
Definition at line 41 of file CosmicTrackingParticleSelector.h.
: ptMin_( ptMin ), minRapidity_( minRapidity ), maxRapidity_( maxRapidity ), tip_( tip ), lip_( lip ), minHit_( minHit ), chargedOnly_(chargedOnly), pdgId_( pdgId ) { }
CosmicTrackingParticleSelector::CosmicTrackingParticleSelector | ( | const edm::ParameterSet & | cfg | ) | [inline] |
Definition at line 48 of file CosmicTrackingParticleSelector.h.
: ptMin_(cfg.getParameter<double>("ptMin")), minRapidity_(cfg.getParameter<double>("minRapidity")), maxRapidity_(cfg.getParameter<double>("maxRapidity")), tip_(cfg.getParameter<double>("tip")), lip_(cfg.getParameter<double>("lip")), minHit_(cfg.getParameter<int>("minHit")), chargedOnly_(cfg.getParameter<bool>("chargedOnly")), pdgId_(cfg.getParameter<std::vector<int> >("pdgId")) { }
const_iterator CosmicTrackingParticleSelector::begin | ( | void | ) | const [inline] |
Definition at line 70 of file CosmicTrackingParticleSelector.h.
References selected_.
{ return selected_.begin(); }
const_iterator CosmicTrackingParticleSelector::end | ( | void | ) | const [inline] |
Definition at line 71 of file CosmicTrackingParticleSelector.h.
References selected_.
{ return selected_.end(); }
bool CosmicTrackingParticleSelector::operator() | ( | const TrackingParticle & | tp, |
const reco::BeamSpot * | bs, | ||
const edm::Event & | iEvent, | ||
const edm::EventSetup & | iSetup | ||
) | const [inline] |
Definition at line 74 of file CosmicTrackingParticleSelector.h.
References ParticleBase::charge(), chargedOnly_, gather_cfg::cout, PV3DBase< T, PVType, FrameType >::eta(), newFWLiteAna::found, edm::EventSetup::get(), TrajectoryStateClosestToBeamLine::isValid(), lip_, TrackingParticle::matchedHit(), maxRapidity_, minHit_, minRapidity_, FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::perp2(), FreeTrajectoryState::position(), edm::ESHandle< T >::product(), ptMin_, CosmicsPD_Skims::radius, trackerHits::simHits, mathSSE::sqrt(), GeomDet::surface(), tip_, Surface::toGlobal(), patCandidatesForDimuonsSequences_cff::tracker, DetId::Tracker, TrackingParticle::trackPSimHit(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), and PV3DBase< T, PVType, FrameType >::z().
{ if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0 //bool testId = false; //unsigned int idSize = pdgId_.size(); //if (idSize==0) testId = true; //else for (unsigned int it=0;it!=idSize;++it){ //if (tp.pdgId()==pdgId_[it]) testId = true; //} edm::ESHandle<TrackerGeometry> tracker; iSetup.get<TrackerDigiGeometryRecord>().get(tracker); edm::ESHandle<MagneticField> theMF; iSetup.get<IdealMagneticFieldRecord>().get(theMF); GlobalVector finalGV (0,0,0); GlobalPoint finalGP(0,0,0); GlobalVector momentum(0,0,0);//At the PCA GlobalPoint vertex(0,0,0);//At the PCA double radius(9999); bool found(0); const std::vector<PSimHit> & simHits = tp.trackPSimHit(DetId::Tracker); for(std::vector<PSimHit>::const_iterator it=simHits.begin(); it!=simHits.end(); ++it){ const GeomDet* tmpDet = tracker->idToDet( DetId(it->detUnitId()) ) ; LocalVector lv = it->momentumAtEntry(); Local3DPoint lp = it->localPosition (); GlobalVector gv = tmpDet->surface().toGlobal( lv ); GlobalPoint gp = tmpDet->surface().toGlobal( lp ); if(gp.perp()<radius){ found=true; radius = gp.perp(); finalGV = gv; finalGP = gp; } } if(!found) return 0; else { FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tp.charge()),theMF.product()); TSCBLBuilderNoMaterial tscblBuilder; TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm if(!tsAtClosestApproach.isValid()){ std::cout << "WARNING: tsAtClosestApproach is not valid" << std::endl; return 0; } else { momentum = tsAtClosestApproach.trackStateAtPCA().momentum(); vertex = tsAtClosestApproach.trackStateAtPCA().position(); return ( tp.matchedHit() >= minHit_ && sqrt(momentum.perp2()) >= ptMin_ && momentum.eta() >= minRapidity_ && momentum.eta() <= maxRapidity_ && sqrt(vertex.perp2()) <= tip_ && fabs(vertex.z()) <= lip_ ); } } }
void CosmicTrackingParticleSelector::select | ( | const edm::Handle< collection > & | c, |
const edm::Event & | event, | ||
const edm::EventSetup & | setup | ||
) | [inline] |
Definition at line 59 of file CosmicTrackingParticleSelector.h.
References SiPixelRawToDigiRegional_cfi::beamSpot, event(), edm::Handle< T >::product(), selected_, and HcalObjRepresent::setup().
{ selected_.clear(); edm::Handle<reco::BeamSpot> beamSpot; event.getByLabel(edm::InputTag("offlineBeamSpot"), beamSpot); for( TrackingParticleCollection::const_iterator itp = c->begin(); itp != c->end(); ++ itp ) if ( operator()(*itp,beamSpot.product(),event,setup) ) { selected_.push_back( & * itp ); } }
size_t CosmicTrackingParticleSelector::size | ( | void | ) | const [inline] |
Definition at line 135 of file CosmicTrackingParticleSelector.h.
References selected_.
{ return selected_.size(); }
bool CosmicTrackingParticleSelector::chargedOnly_ [private] |
Definition at line 145 of file CosmicTrackingParticleSelector.h.
Referenced by operator()().
double CosmicTrackingParticleSelector::lip_ [private] |
Definition at line 143 of file CosmicTrackingParticleSelector.h.
Referenced by operator()().
double CosmicTrackingParticleSelector::maxRapidity_ [private] |
Definition at line 141 of file CosmicTrackingParticleSelector.h.
Referenced by operator()().
int CosmicTrackingParticleSelector::minHit_ [private] |
Definition at line 144 of file CosmicTrackingParticleSelector.h.
Referenced by operator()().
double CosmicTrackingParticleSelector::minRapidity_ [private] |
Definition at line 140 of file CosmicTrackingParticleSelector.h.
Referenced by operator()().
std::vector<int> CosmicTrackingParticleSelector::pdgId_ [private] |
Definition at line 146 of file CosmicTrackingParticleSelector.h.
double CosmicTrackingParticleSelector::ptMin_ [private] |
Definition at line 139 of file CosmicTrackingParticleSelector.h.
Referenced by operator()().
double CosmicTrackingParticleSelector::tip_ [private] |
Definition at line 142 of file CosmicTrackingParticleSelector.h.
Referenced by operator()().