CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OverlapProblemTSOSPositionFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: OverlapProblemTSOSPositionFilter
4 // Class: OverlapProblemTSOSPositionFilter
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Thu Dec 16 16:32:56 CEST 2010
16 // $Id: OverlapProblemTSOSPositionFilter.cc,v 1.1 2012/03/12 14:46:20 venturia Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include <numeric>
24 #include <vector>
25 
26 // user include files
29 
34 
36 
38 
39 //#include "FWCore/ServiceRegistry/interface/Service.h"
40 //#include "CommonTools/UtilAlgos/interface/TFileService.h"
41 
43 
50 
56 
57 #include "TH1F.h"
58 //
59 // class decleration
60 //
61 
62 
64 public:
67 
68 private:
69  virtual bool filter(edm::Event&, const edm::EventSetup&) override;
70 
71  // ----------member data ---------------------------
72 
73  const bool m_validOnly;
75 
76 };
77 
78 //
79 // constants, enums and typedefs
80 //
81 
82 //
83 // static data member definitions
84 //
85 
86 //
87 // constructors and destructor
88 //
90  m_validOnly(iConfig.getParameter<bool>("onlyValidRecHit")),
91  m_ttacollToken(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("trajTrackAssoCollection")))
92 
93 {
94  //now do what ever initialization is needed
95 
96 
97 
98 }
99 
100 
102 {
103 
104  // do anything here that needs to be done at desctruction time
105  // (e.g. close files, deallocate resources etc.)
106 
107 }
108 
109 
110 //
111 // member functions
112 //
113 
114 // ------------ method called to for each event ------------
115 bool
117 {
118  using namespace edm;
119 
120  // loop on trajectories and plot TSOS local coordinate
121 
122  TrajectoryStateCombiner tsoscomb;
123 
124  // Trajectory Handle
125 
127  iEvent.getByToken(m_ttacollToken,ttac);
128 
129  for(TrajTrackAssociationCollection::const_iterator pair=ttac->begin();pair!=ttac->end();++pair) {
130 
131  const edm::Ref<std::vector<Trajectory> > & traj = pair->key;
132  // const reco::TrackRef & trk = pair->val;
133  const std::vector<TrajectoryMeasurement> & tmcoll = traj->measurements();
134 
135  for(std::vector<TrajectoryMeasurement>::const_iterator meas = tmcoll.begin() ; meas!= tmcoll.end() ; ++meas) {
136 
137  if(!meas->updatedState().isValid()) continue;
138 
139  TrajectoryStateOnSurface tsos = tsoscomb(meas->forwardPredictedState(), meas->backwardPredictedState());
141 
142  if(!hit->isValid() && m_validOnly) continue;
143 
144  if(hit->geographicalId().det() != DetId::Tracker) continue;
145 
146  TECDetId det(hit->geographicalId());
147  if(det.subDetector() != SiStripDetId::TEC) continue;
148 
149  if(det.ring() != 6) continue;
150 
151  if(tsos.localPosition().y() < 6.) continue;
152 
153  return true;
154 
155  }
156 
157  }
158 
159  return false;
160 
161 }
162 
163 //define this as a plug-in
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
T y() const
Definition: PV3DBase.h:63
key_type key() const
Accessor for product key.
Definition: Ref.h:264
int iEvent
Definition: GenABIO.cc:230
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
OverlapProblemTSOSPositionFilter(const edm::ParameterSet &)
virtual bool filter(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< TrajTrackAssociationCollection > m_ttacollToken