CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CosmicTrackingParticleSelector Class Reference

#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, const std::vector< int > &pdgId=std::vector< int >())
 
 CosmicTrackingParticleSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
const_iterator end () const
 
void initEvent (edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssocToSet) const
 
bool operator() (const TrackingParticleRef tpr, 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

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
bool chargedOnly_
 
double lip_
 
double maxRapidity_
 
int minHit_
 
double minRapidity_
 
std::vector< int > pdgId_
 
double ptMin_
 
container selected_
 
edm::Handle
< SimHitTPAssociationProducer::SimHitTPAssociationList
simHitsTPAssoc
 
double tip_
 

Detailed Description

Definition at line 36 of file CosmicTrackingParticleSelector.h.

Member Typedef Documentation

Definition at line 39 of file CosmicTrackingParticleSelector.h.

typedef container::const_iterator CosmicTrackingParticleSelector::const_iterator

Definition at line 41 of file CosmicTrackingParticleSelector.h.

Definition at line 40 of file CosmicTrackingParticleSelector.h.

Constructor & Destructor Documentation

CosmicTrackingParticleSelector::CosmicTrackingParticleSelector ( )
inline

Definition at line 43 of file CosmicTrackingParticleSelector.h.

43 {}
CosmicTrackingParticleSelector::CosmicTrackingParticleSelector ( double  ptMin,
double  minRapidity,
double  maxRapidity,
double  tip,
double  lip,
int  minHit,
bool  chargedOnly,
const std::vector< int > &  pdgId = std::vector<int>() 
)
inline
CosmicTrackingParticleSelector::CosmicTrackingParticleSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 52 of file CosmicTrackingParticleSelector.h.

52  :
53  ptMin_(cfg.getParameter<double>("ptMin")),
54  minRapidity_(cfg.getParameter<double>("minRapidity")),
55  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
56  tip_(cfg.getParameter<double>("tip")),
57  lip_(cfg.getParameter<double>("lip")),
58  minHit_(cfg.getParameter<int>("minHit")),
59  chargedOnly_(cfg.getParameter<bool>("chargedOnly")),
60  pdgId_(cfg.getParameter<std::vector<int> >("pdgId")),
61  beamSpotToken_(iC.consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"))) { }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_

Member Function Documentation

const_iterator CosmicTrackingParticleSelector::begin ( void  ) const
inline

Definition at line 75 of file CosmicTrackingParticleSelector.h.

References selected_.

75 { return selected_.begin(); }
const_iterator CosmicTrackingParticleSelector::end ( void  ) const
inline
void CosmicTrackingParticleSelector::initEvent ( edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList simHitsTPAssocToSet) const
inline

Definition at line 78 of file CosmicTrackingParticleSelector.h.

References simHitsTPAssoc.

Referenced by MultiTrackValidator::analyze().

78  {
79  simHitsTPAssoc = simHitsTPAssocToSet;
80  }
edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssoc
bool CosmicTrackingParticleSelector::operator() ( const TrackingParticleRef  tpr,
const reco::BeamSpot bs,
const edm::Event iEvent,
const edm::EventSetup iSetup 
) const
inline

Definition at line 83 of file CosmicTrackingParticleSelector.h.

References chargedOnly_, gather_cfg::cout, PV3DBase< T, PVType, FrameType >::eta(), newFWLiteAna::found, edm::EventSetup::get(), TrajectoryStateClosestToBeamLine::isValid(), edm::HandleBase::isValid(), lip_, maxRapidity_, minHit_, minRapidity_, FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::perp2(), FreeTrajectoryState::position(), edm::ESHandle< class >::product(), ptMin_, CosmicsPD_Skims::radius, simHitsTPAssoc, SimHitTPAssociationProducer::simHitTPAssociationListGreater(), mathSSE::sqrt(), GeomDet::surface(), tip_, Surface::toGlobal(), patCandidatesForDimuonsSequences_cff::tracker, TrajectoryStateClosestToBeamLine::trackStateAtPCA(), and PV3DBase< T, PVType, FrameType >::z().

83  {
84  if (chargedOnly_ && tpr->charge()==0) return false;//select only if charge!=0
85  //bool testId = false;
86  //unsigned int idSize = pdgId_.size();
87  //if (idSize==0) testId = true;
88  //else for (unsigned int it=0;it!=idSize;++it){
89  //if (tpr->pdgId()==pdgId_[it]) testId = true;
90  //}
91 
93  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
94 
96  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
97 
98  GlobalVector finalGV (0,0,0);
99  GlobalPoint finalGP(0,0,0);
100  GlobalVector momentum(0,0,0);//At the PCA
101  GlobalPoint vertex(0,0,0);//At the PCA
102  double radius(9999);
103  bool found(0);
104 
105 
106  if (simHitsTPAssoc.isValid()==0) {
107  edm::LogError("TrackAssociation") << "Invalid handle!";
108  return false;
109  }
110  std::pair<TrackingParticleRef, TrackPSimHitRef> clusterTPpairWithDummyTP(tpr,TrackPSimHitRef());//SimHit is dummy: for simHitTPAssociationListGreater
111  // sorting only the cluster is needed
112  auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
114  for(auto ip = range.first; ip != range.second; ++ip) {
115  TrackPSimHitRef it = ip->second;
116  const GeomDet* tmpDet = tracker->idToDet( DetId(it->detUnitId()) ) ;
117  LocalVector lv = it->momentumAtEntry();
118  Local3DPoint lp = it->localPosition ();
119  GlobalVector gv = tmpDet->surface().toGlobal( lv );
120  GlobalPoint gp = tmpDet->surface().toGlobal( lp );
121  if(gp.perp()<radius){
122  found=true;
123  radius = gp.perp();
124  finalGV = gv;
125  finalGP = gp;
126  }
127  }
128  if(!found) return 0;
129  else
130  {
131  FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tpr->charge()),theMF.product());
132  TSCBLBuilderNoMaterial tscblBuilder;
133  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
134  if(!tsAtClosestApproach.isValid()){
135  std::cout << "WARNING: tsAtClosestApproach is not valid" << std::endl;
136  return 0;
137  }
138  else
139  {
140  momentum = tsAtClosestApproach.trackStateAtPCA().momentum();
141  vertex = tsAtClosestApproach.trackStateAtPCA().position();
142  return (
143  tpr->numberOfTrackerLayers() >= minHit_ &&
144  sqrt(momentum.perp2()) >= ptMin_ &&
145  momentum.eta() >= minRapidity_ && momentum.eta() <= maxRapidity_ &&
146  sqrt(vertex.perp2()) <= tip_ &&
147  fabs(vertex.z()) <= lip_
148  );
149  }
150  }
151  }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
T perp() const
Definition: PV3DBase.h:72
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:48
bool isValid() const
Definition: HandleBase.h:76
edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssoc
GlobalVector momentum() const
Definition: DetId.h:18
GlobalPoint position() const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
tuple cout
Definition: gather_cfg.py:121
void CosmicTrackingParticleSelector::select ( const edm::Handle< collection > &  c,
const edm::Event event,
const edm::EventSetup setup 
)
inline

Definition at line 64 of file CosmicTrackingParticleSelector.h.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotToken_, event(), edm::Handle< T >::product(), selected_, and HcalObjRepresent::setup().

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

64  {
65  selected_.clear();
67  event.getByToken(beamSpotToken_, beamSpot);
68  for( TrackingParticleCollection::const_iterator itp = c->begin();
69  itp != c->end(); ++ itp )
70  if ( operator()(TrackingParticleRef(c,itp-c->begin()),beamSpot.product(),event,setup) ) {
71  selected_.push_back( & * itp );
72  }
73  }
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
T const * product() const
Definition: Handle.h:81
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::Ref< TrackingParticleCollection > TrackingParticleRef
size_t CosmicTrackingParticleSelector::size ( void  ) const
inline

Definition at line 153 of file CosmicTrackingParticleSelector.h.

References selected_.

153 { return selected_.size(); }

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> CosmicTrackingParticleSelector::beamSpotToken_
private

Definition at line 166 of file CosmicTrackingParticleSelector.h.

Referenced by select().

bool CosmicTrackingParticleSelector::chargedOnly_
private

Definition at line 163 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::lip_
private

Definition at line 161 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::maxRapidity_
private

Definition at line 159 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

int CosmicTrackingParticleSelector::minHit_
private

Definition at line 162 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::minRapidity_
private

Definition at line 158 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

std::vector<int> CosmicTrackingParticleSelector::pdgId_
private

Definition at line 164 of file CosmicTrackingParticleSelector.h.

double CosmicTrackingParticleSelector::ptMin_
private

Definition at line 157 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

container CosmicTrackingParticleSelector::selected_
private

Definition at line 165 of file CosmicTrackingParticleSelector.h.

Referenced by begin(), end(), select(), and size().

edm::Handle<SimHitTPAssociationProducer::SimHitTPAssociationList> CosmicTrackingParticleSelector::simHitsTPAssoc
mutableprivate

Definition at line 168 of file CosmicTrackingParticleSelector.h.

Referenced by initEvent(), and operator()().

double CosmicTrackingParticleSelector::tip_
private

Definition at line 160 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().