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
 
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_
 

Detailed Description

Definition at line 32 of file CosmicTrackingParticleSelector.h.

Member Typedef Documentation

Definition at line 35 of file CosmicTrackingParticleSelector.h.

typedef container::const_iterator CosmicTrackingParticleSelector::const_iterator

Definition at line 37 of file CosmicTrackingParticleSelector.h.

Definition at line 36 of file CosmicTrackingParticleSelector.h.

Constructor & Destructor Documentation

CosmicTrackingParticleSelector::CosmicTrackingParticleSelector ( )
inline

Definition at line 39 of file CosmicTrackingParticleSelector.h.

39 {}
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 48 of file CosmicTrackingParticleSelector.h.

48  :
49  ptMin_(cfg.getParameter<double>("ptMin")),
50  minRapidity_(cfg.getParameter<double>("minRapidity")),
51  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
52  tip_(cfg.getParameter<double>("tip")),
53  lip_(cfg.getParameter<double>("lip")),
54  minHit_(cfg.getParameter<int>("minHit")),
55  chargedOnly_(cfg.getParameter<bool>("chargedOnly")),
56  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 70 of file CosmicTrackingParticleSelector.h.

References selected_.

70 { return selected_.begin(); }
const_iterator CosmicTrackingParticleSelector::end ( void  ) const
inline
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< class >::product(), ptMin_, CosmicsPD_Skims::radius, trackerHits::simHits, mathSSE::sqrt(), GeomDet::surface(), tip_, Surface::toGlobal(), DetId::Tracker, patCandidatesForDimuonsSequences_cff::tracker, TrackingParticle::trackPSimHit(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), and PV3DBase< T, PVType, FrameType >::z().

74  {
75  if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
76  //bool testId = false;
77  //unsigned int idSize = pdgId_.size();
78  //if (idSize==0) testId = true;
79  //else for (unsigned int it=0;it!=idSize;++it){
80  //if (tp.pdgId()==pdgId_[it]) testId = true;
81  //}
82 
84  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
85 
87  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
88 
89  GlobalVector finalGV (0,0,0);
90  GlobalPoint finalGP(0,0,0);
91  GlobalVector momentum(0,0,0);//At the PCA
92  GlobalPoint vertex(0,0,0);//At the PCA
93  double radius(9999);
94  bool found(0);
95 
96  const std::vector<PSimHit> & simHits = tp.trackPSimHit(DetId::Tracker);
97  for(std::vector<PSimHit>::const_iterator it=simHits.begin(); it!=simHits.end(); ++it){
98  const GeomDet* tmpDet = tracker->idToDet( DetId(it->detUnitId()) ) ;
99  LocalVector lv = it->momentumAtEntry();
100  Local3DPoint lp = it->localPosition ();
101  GlobalVector gv = tmpDet->surface().toGlobal( lv );
102  GlobalPoint gp = tmpDet->surface().toGlobal( lp );
103  if(gp.perp()<radius){
104  found=true;
105  radius = gp.perp();
106  finalGV = gv;
107  finalGP = gp;
108  }
109  }
110  if(!found) return 0;
111  else
112  {
113  FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tp.charge()),theMF.product());
114  TSCBLBuilderNoMaterial tscblBuilder;
115  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
116  if(!tsAtClosestApproach.isValid()){
117  std::cout << "WARNING: tsAtClosestApproach is not valid" << std::endl;
118  return 0;
119  }
120  else
121  {
122  momentum = tsAtClosestApproach.trackStateAtPCA().momentum();
123  vertex = tsAtClosestApproach.trackStateAtPCA().position();
124  return (
125  tp.matchedHit() >= minHit_ &&
126  sqrt(momentum.perp2()) >= ptMin_ &&
127  momentum.eta() >= minRapidity_ && momentum.eta() <= maxRapidity_ &&
128  sqrt(vertex.perp2()) <= tip_ &&
129  fabs(vertex.z()) <= lip_
130  );
131  }
132  }
133  }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T perp() const
Definition: PV3DBase.h:71
int charge() const
electric charge
Definition: ParticleBase.h:54
const std::vector< PSimHit > & trackPSimHit() const
int matchedHit() const
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:46
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
tuple simHits
Definition: trackerHits.py:16
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
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 59 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().

59  {
60  selected_.clear();
62  event.getByLabel(edm::InputTag("offlineBeamSpot"), beamSpot);
63  for( TrackingParticleCollection::const_iterator itp = c->begin();
64  itp != c->end(); ++ itp )
65  if ( operator()(*itp,beamSpot.product(),event,setup) ) {
66  selected_.push_back( & * itp );
67  }
68  }
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="")
size_t CosmicTrackingParticleSelector::size ( void  ) const
inline

Definition at line 135 of file CosmicTrackingParticleSelector.h.

References selected_.

135 { return selected_.size(); }

Member Data Documentation

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()().

container CosmicTrackingParticleSelector::selected_
private

Definition at line 147 of file CosmicTrackingParticleSelector.h.

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

double CosmicTrackingParticleSelector::tip_
private

Definition at line 142 of file CosmicTrackingParticleSelector.h.

Referenced by operator()().