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, std::vector< int > pdgId=std::vector< int >())
 
 CosmicTrackingParticleSelector (const edm::ParameterSet &cfg)
 
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

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 35 of file CosmicTrackingParticleSelector.h.

Member Typedef Documentation

Definition at line 38 of file CosmicTrackingParticleSelector.h.

typedef container::const_iterator CosmicTrackingParticleSelector::const_iterator

Definition at line 40 of file CosmicTrackingParticleSelector.h.

Definition at line 39 of file CosmicTrackingParticleSelector.h.

Constructor & Destructor Documentation

CosmicTrackingParticleSelector::CosmicTrackingParticleSelector ( )
inline

Definition at line 42 of file CosmicTrackingParticleSelector.h.

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

Definition at line 51 of file CosmicTrackingParticleSelector.h.

51  :
52  ptMin_(cfg.getParameter<double>("ptMin")),
53  minRapidity_(cfg.getParameter<double>("minRapidity")),
54  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
55  tip_(cfg.getParameter<double>("tip")),
56  lip_(cfg.getParameter<double>("lip")),
57  minHit_(cfg.getParameter<int>("minHit")),
58  chargedOnly_(cfg.getParameter<bool>("chargedOnly")),
59  pdgId_(cfg.getParameter<std::vector<int> >("pdgId")) { }
T getParameter(std::string const &) const

Member Function Documentation

const_iterator CosmicTrackingParticleSelector::begin ( void  ) const
inline

Definition at line 73 of file CosmicTrackingParticleSelector.h.

References selected_.

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

Definition at line 76 of file CosmicTrackingParticleSelector.h.

References simHitsTPAssoc.

Referenced by MultiTrackValidator::analyze().

76  {
77  simHitsTPAssoc = simHitsTPAssocToSet;
78  }
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 81 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().

81  {
82  if (chargedOnly_ && tpr->charge()==0) return false;//select only if charge!=0
83  //bool testId = false;
84  //unsigned int idSize = pdgId_.size();
85  //if (idSize==0) testId = true;
86  //else for (unsigned int it=0;it!=idSize;++it){
87  //if (tpr->pdgId()==pdgId_[it]) testId = true;
88  //}
89 
91  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
92 
94  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
95 
96  GlobalVector finalGV (0,0,0);
97  GlobalPoint finalGP(0,0,0);
98  GlobalVector momentum(0,0,0);//At the PCA
99  GlobalPoint vertex(0,0,0);//At the PCA
100  double radius(9999);
101  bool found(0);
102 
103 
104  if (simHitsTPAssoc.isValid()==0) {
105  edm::LogError("TrackAssociation") << "Invalid handle!";
106  return false;
107  }
108  std::pair<TrackingParticleRef, TrackPSimHitRef> clusterTPpairWithDummyTP(tpr,TrackPSimHitRef());//SimHit is dummy: for simHitTPAssociationListGreater
109  // sorting only the cluster is needed
110  auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
112  for(auto ip = range.first; ip != range.second; ++ip) {
113  TrackPSimHitRef it = ip->second;
114  const GeomDet* tmpDet = tracker->idToDet( DetId(it->detUnitId()) ) ;
115  LocalVector lv = it->momentumAtEntry();
116  Local3DPoint lp = it->localPosition ();
117  GlobalVector gv = tmpDet->surface().toGlobal( lv );
118  GlobalPoint gp = tmpDet->surface().toGlobal( lp );
119  if(gp.perp()<radius){
120  found=true;
121  radius = gp.perp();
122  finalGV = gv;
123  finalGP = gp;
124  }
125  }
126  if(!found) return 0;
127  else
128  {
129  FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tpr->charge()),theMF.product());
130  TSCBLBuilderNoMaterial tscblBuilder;
131  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
132  if(!tsAtClosestApproach.isValid()){
133  std::cout << "WARNING: tsAtClosestApproach is not valid" << std::endl;
134  return 0;
135  }
136  else
137  {
138  momentum = tsAtClosestApproach.trackStateAtPCA().momentum();
139  vertex = tsAtClosestApproach.trackStateAtPCA().position();
140  return (
141  tpr->numberOfTrackerLayers() >= minHit_ &&
142  sqrt(momentum.perp2()) >= ptMin_ &&
143  momentum.eta() >= minRapidity_ && momentum.eta() <= maxRapidity_ &&
144  sqrt(vertex.perp2()) <= tip_ &&
145  fabs(vertex.z()) <= lip_
146  );
147  }
148  }
149  }
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:35
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:20
GlobalPoint position() const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
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 62 of file CosmicTrackingParticleSelector.h.

References SiPixelRawToDigiRegional_cfi::beamSpot, 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().

62  {
63  selected_.clear();
65  event.getByLabel(edm::InputTag("offlineBeamSpot"), beamSpot);
66  for( TrackingParticleCollection::const_iterator itp = c->begin();
67  itp != c->end(); ++ itp )
68  if ( operator()(TrackingParticleRef(c,itp-c->begin()),beamSpot.product(),event,setup) ) {
69  selected_.push_back( & * itp );
70  }
71  }
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:74
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 151 of file CosmicTrackingParticleSelector.h.

References selected_.

151 { return selected_.size(); }

Member Data Documentation

bool CosmicTrackingParticleSelector::chargedOnly_
private

Definition at line 161 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::lip_
private

Definition at line 159 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::maxRapidity_
private

Definition at line 157 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

int CosmicTrackingParticleSelector::minHit_
private

Definition at line 160 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

double CosmicTrackingParticleSelector::minRapidity_
private

Definition at line 156 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

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

Definition at line 162 of file CosmicTrackingParticleSelector.h.

double CosmicTrackingParticleSelector::ptMin_
private

Definition at line 155 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().

container CosmicTrackingParticleSelector::selected_
private

Definition at line 163 of file CosmicTrackingParticleSelector.h.

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

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

Definition at line 165 of file CosmicTrackingParticleSelector.h.

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

double CosmicTrackingParticleSelector::tip_
private

Definition at line 158 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().