CMS 3D CMS Logo

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 
35 
37 
39 
40 //#include "FWCore/ServiceRegistry/interface/Service.h"
41 //#include "CommonTools/UtilAlgos/interface/TFileService.h"
42 
44 
51 
57 
59 
60 #include "TH1F.h"
61 //
62 // class decleration
63 //
64 
65 
67 public:
70 
71 private:
72  bool filter(edm::Event&, const edm::EventSetup&) override;
73 
74  // ----------member data ---------------------------
75 
76  const bool m_validOnly;
78 
79 };
80 
81 //
82 // constants, enums and typedefs
83 //
84 
85 //
86 // static data member definitions
87 //
88 
89 //
90 // constructors and destructor
91 //
93  m_validOnly(iConfig.getParameter<bool>("onlyValidRecHit")),
94  m_ttacollToken(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("trajTrackAssoCollection")))
95 
96 {
97  //now do what ever initialization is needed
98 
99 
100 
101 }
102 
103 
105 {
106 
107  // do anything here that needs to be done at desctruction time
108  // (e.g. close files, deallocate resources etc.)
109 
110 }
111 
112 
113 //
114 // member functions
115 //
116 
117 // ------------ method called to for each event ------------
118 bool
120 {
121  using namespace edm;
122 
123  // loop on trajectories and plot TSOS local coordinate
124 
125  TrajectoryStateCombiner tsoscomb;
126 
127  // Trajectory Handle
128 
130  iEvent.getByToken(m_ttacollToken,ttac);
131 
133  iSetup.get<TrackerTopologyRcd>().get(tTopo);
134 
135  for(TrajTrackAssociationCollection::const_iterator pair=ttac->begin();pair!=ttac->end();++pair) {
136 
137  const edm::Ref<std::vector<Trajectory> > & traj = pair->key;
138  // const reco::TrackRef & trk = pair->val;
139  const std::vector<TrajectoryMeasurement> & tmcoll = traj->measurements();
140 
141  for(std::vector<TrajectoryMeasurement>::const_iterator meas = tmcoll.begin() ; meas!= tmcoll.end() ; ++meas) {
142 
143  if(!meas->updatedState().isValid()) continue;
144 
145  TrajectoryStateOnSurface tsos = tsoscomb(meas->forwardPredictedState(), meas->backwardPredictedState());
147 
148  if(!hit->isValid() && m_validOnly) continue;
149 
150  if(hit->geographicalId().det() != DetId::Tracker) continue;
151 
152  if(hit->geographicalId().subdetId() != StripSubdetector::TEC) continue;
153 
154  if(tTopo->tecRing(hit->geographicalId()) != 6) continue;
155 
156  if(tsos.localPosition().y() < 6.) continue;
157 
158  return true;
159 
160  }
161 
162  }
163 
164  return false;
165 
166 }
167 
168 //define this as a plug-in
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
unsigned int tecRing(const DetId &id) const
ring id
T y() const
Definition: PV3DBase.h:63
key_type key() const
Accessor for product key.
Definition: Ref.h:263
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
HLT enums.
T get() const
Definition: EventSetup.h:71
OverlapProblemTSOSPositionFilter(const edm::ParameterSet &)
bool filter(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< TrajTrackAssociationCollection > m_ttacollToken
const_iterator begin() const
first iterator over the map (read only)