CMS 3D CMS Logo

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::SimHitTPAssociationListsimHitsTPAssoc
 
double tip_
 

Detailed Description

Definition at line 39 of file CosmicTrackingParticleSelector.h.

Member Typedef Documentation

Definition at line 41 of file CosmicTrackingParticleSelector.h.

typedef container::const_iterator CosmicTrackingParticleSelector::const_iterator

Definition at line 43 of file CosmicTrackingParticleSelector.h.

Definition at line 42 of file CosmicTrackingParticleSelector.h.

Constructor & Destructor Documentation

CosmicTrackingParticleSelector::CosmicTrackingParticleSelector ( )
inline

Definition at line 45 of file CosmicTrackingParticleSelector.h.

45 {}
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

Definition at line 47 of file CosmicTrackingParticleSelector.h.

55  : ptMin_(ptMin),
58  tip_(tip),
59  lip_(lip),
60  minHit_(minHit),
62  pdgId_(pdgId) {}
CosmicTrackingParticleSelector::CosmicTrackingParticleSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 64 of file CosmicTrackingParticleSelector.h.

65  : ptMin_(cfg.getParameter<double>("ptMin")),
66  minRapidity_(cfg.getParameter<double>("minRapidity")),
67  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
68  tip_(cfg.getParameter<double>("tip")),
69  lip_(cfg.getParameter<double>("lip")),
70  minHit_(cfg.getParameter<int>("minHit")),
71  chargedOnly_(cfg.getParameter<bool>("chargedOnly")),
72  pdgId_(cfg.getParameter<std::vector<int> >("pdgId")),
73  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 85 of file CosmicTrackingParticleSelector.h.

References selected_.

const_iterator CosmicTrackingParticleSelector::end ( void  ) const
inline
void CosmicTrackingParticleSelector::initEvent ( edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList simHitsTPAssocToSet) const
inline

Definition at line 88 of file CosmicTrackingParticleSelector.h.

References simHitsTPAssoc.

Referenced by MultiTrackValidator::dqmAnalyze().

88  {
89  simHitsTPAssoc = simHitsTPAssocToSet;
90  }
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 93 of file CosmicTrackingParticleSelector.h.

References chargedOnly_, PV3DBase< T, PVType, FrameType >::eta(), newFWLiteAna::found, edm::EventSetup::get(), runTauDisplay::gp, GlobalTrackingGeometry::idToDet(), cuy::ii, 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< T >::product(), ptMin_, CosmicsPD_Skims::radius, FastTimerService_cff::range, simHitsTPAssoc, SimHitTPAssociationProducer::simHitTPAssociationListGreater(), mathSSE::sqrt(), GeomDet::surface(), tip_, Surface::toGlobal(), PbPb_ZMuSkimMuonDPG_cff::tracker, TrajectoryStateClosestToBeamLine::trackStateAtPCA(), bphysicsOniaDQM_cfi::vertex, and PV3DBase< T, PVType, FrameType >::z().

96  {
97  if (chargedOnly_ && tpr->charge() == 0)
98  return false; //select only if charge!=0
99  //bool testId = false;
100  //unsigned int idSize = pdgId_.size();
101  //if (idSize==0) testId = true;
102  //else for (unsigned int it=0;it!=idSize;++it){
103  //if (tpr->pdgId()==pdgId_[it]) testId = true;
104  //}
105 
107  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
109  iSetup.get<GlobalTrackingGeometryRecord>().get(theGeometry);
110 
112  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
113 
114  GlobalVector finalGV(0, 0, 0);
115  GlobalPoint finalGP(0, 0, 0);
116  GlobalVector momentum(0, 0, 0); //At the PCA
117  GlobalPoint vertex(0, 0, 0); //At the PCA
118  double radius(9999);
119  bool found(false);
120 
121  int ii = 0;
122  DetId::Detector det;
123  int subdet;
124 
125  edm::LogVerbatim("CosmicTrackingParticleSelector")
126  << "TOT Number of PSimHits = " << tpr->numberOfHits()
127  << ", Number of Tracker PSimHits = " << tpr->numberOfTrackerHits() << "\n";
128 
129  if (simHitsTPAssoc.isValid() == 0) {
130  edm::LogError("CosmicTrackingParticleSelector") << "Invalid handle!";
131  return false;
132  }
133  std::pair<TrackingParticleRef, TrackPSimHitRef> clusterTPpairWithDummyTP(
134  tpr, TrackPSimHitRef()); //SimHit is dummy: for simHitTPAssociationListGreater
135  // sorting only the cluster is needed
136  auto range = std::equal_range(simHitsTPAssoc->begin(),
137  simHitsTPAssoc->end(),
138  clusterTPpairWithDummyTP,
140  for (auto ip = range.first; ip != range.second; ++ip) {
141  TrackPSimHitRef it = ip->second;
142  ++ii;
143  const GeomDet* tmpDet = theGeometry->idToDet(DetId(it->detUnitId()));
144  if (!tmpDet) {
145  edm::LogVerbatim("CosmicTrackingParticleSelector")
146  << "***WARNING: PSimHit " << ii << ", no GeomDet for: " << it->detUnitId() << ". Skipping it.";
147  continue;
148  } else {
149  det = DetId(it->detUnitId()).det();
150  subdet = DetId(it->detUnitId()).subdetId();
151  }
152 
153  LocalVector lv = it->momentumAtEntry();
154  Local3DPoint lp = it->localPosition();
155  GlobalVector gv = tmpDet->surface().toGlobal(lv);
156  GlobalPoint gp = tmpDet->surface().toGlobal(lp);
157  edm::LogVerbatim("CosmicTrackingParticleSelector")
158  << "PSimHit " << ii << ", Detector = " << det << ", subdet = " << subdet << "\t Radius = " << gp.perp()
159  << ", z = " << gp.z() << "\t pt = " << gv.perp() << ", pz = " << gv.z();
160  edm::LogVerbatim("CosmicTrackingParticleSelector")
161  << "\t trackId = " << it->trackId() << ", particleType = " << it->particleType()
162  << ", processType = " << it->processType();
163 
164  // discard hits related to low energy debris from the primary particle
165  if (it->processType() != 0)
166  continue;
167 
168  if (gp.perp() < radius) {
169  found = true;
170  radius = gp.perp();
171  finalGV = gv;
172  finalGP = gp;
173  }
174  }
175  edm::LogVerbatim("CosmicTrackingParticleSelector")
176  << "\n"
177  << "FINAL State at InnerMost Hit: Radius = " << finalGP.perp() << ", z = " << finalGP.z()
178  << ", pt = " << finalGV.perp() << ", pz = " << finalGV.z();
179 
180  if (!found)
181  return false;
182  else {
183  FreeTrajectoryState ftsAtProduction(finalGP, finalGV, TrackCharge(tpr->charge()), theMF.product());
184  TSCBLBuilderNoMaterial tscblBuilder;
185  //as in TrackProducerAlgorithm
186  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction, *bs);
187  if (!tsAtClosestApproach.isValid()) {
188  edm::LogVerbatim("CosmicTrackingParticleSelector")
189  << "*** WARNING in CosmicTrackingParticleSelector: tsAtClosestApproach is not valid."
190  << "\n";
191  return false;
192  } else {
193  momentum = tsAtClosestApproach.trackStateAtPCA().momentum();
194  vertex = tsAtClosestApproach.trackStateAtPCA().position();
195 
196  edm::LogVerbatim("CosmicTrackingParticleSelector")
197  << "FINAL State extrapolated at PCA: Radius = " << vertex.perp() << ", z = " << vertex.z()
198  << ", pt = " << momentum.perp() << ", pz = " << momentum.z() << "\n";
199 
200  return (tpr->numberOfTrackerLayers() >= minHit_ && sqrt(momentum.perp2()) >= ptMin_ &&
201  momentum.eta() >= minRapidity_ && momentum.eta() <= maxRapidity_ && sqrt(vertex.perp2()) <= tip_ &&
202  fabs(vertex.z()) <= lip_);
203  }
204  }
205  }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
T perp() const
Definition: PV3DBase.h:69
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
bool isValid() const
Definition: HandleBase.h:70
edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssoc
GlobalVector momentum() const
ii
Definition: cuy.py:590
Definition: DetId.h:17
GlobalPoint position() const
Detector
Definition: DetId.h:24
T get() const
Definition: EventSetup.h:73
const GeomDet * idToDet(DetId) const override
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
T const * product() const
Definition: ESHandle.h:86
void CosmicTrackingParticleSelector::select ( const edm::Handle< collection > &  c,
const edm::Event event,
const edm::EventSetup setup 
)
inline

Definition at line 75 of file CosmicTrackingParticleSelector.h.

References pwdgSkimBPark_cfi::beamSpot, beamSpotToken_, event(), edm::Handle< T >::product(), selected_, and singleTopDQM_cfi::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().

75  {
76  selected_.clear();
78  event.getByToken(beamSpotToken_, beamSpot);
79  for (TrackingParticleCollection::const_iterator itp = c->begin(); itp != c->end(); ++itp)
80  if (operator()(TrackingParticleRef(c, itp - c->begin()), beamSpot.product(), event, setup)) {
81  selected_.push_back(&*itp);
82  }
83  }
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:69
edm::Ref< TrackingParticleCollection > TrackingParticleRef
size_t CosmicTrackingParticleSelector::size ( void  ) const
inline

Member Data Documentation

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

Definition at line 219 of file CosmicTrackingParticleSelector.h.

Referenced by select().

bool CosmicTrackingParticleSelector::chargedOnly_
private

Definition at line 216 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::lip_
private

Definition at line 214 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::maxRapidity_
private

Definition at line 212 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

int CosmicTrackingParticleSelector::minHit_
private

Definition at line 215 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::minRapidity_
private

Definition at line 211 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

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

Definition at line 217 of file CosmicTrackingParticleSelector.h.

double CosmicTrackingParticleSelector::ptMin_
private

Definition at line 210 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

container CosmicTrackingParticleSelector::selected_
private

Definition at line 218 of file CosmicTrackingParticleSelector.h.

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

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

Definition at line 221 of file CosmicTrackingParticleSelector.h.

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

double CosmicTrackingParticleSelector::tip_
private

Definition at line 213 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().