CMS 3D CMS Logo

OverlapProblemTSOSAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: OverlapProblemTSOSAnalyzer
4 // Class: OverlapProblemTSOSAnalyzer
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Thu Dec 16 16:32:56 CEST 2010
16 // $Id: OverlapProblemTSOSAnalyzer.cc,v 1.2 2013/04/10 21:08:01 venturia Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 #include <numeric>
23 #include <vector>
24 
25 // user include files
28 
33 
35 
37 
40 
42 
49 
56 
57 #include "TH1F.h"
58 
60 //
61 // class decleration
62 //
63 
65 public:
67  ~OverlapProblemTSOSAnalyzer() override;
68 
69 private:
70  void beginRun(const edm::Run&, const edm::EventSetup&) override;
71  void endRun(const edm::Run&, const edm::EventSetup&) override;
72  void analyze(const edm::Event&, const edm::EventSetup&) override;
73 
74  // ----------member data ---------------------------
75 
76  TH1F* m_ptrk;
77  TH1F* m_etatrk;
78 
81  const bool m_debug;
82 
84 };
85 
86 //
87 // constants, enums and typedefs
88 //
89 
90 //
91 // static data member definitions
92 //
93 
94 //
95 // constructors and destructor
96 //
98  : m_validOnly(iConfig.getParameter<bool>("onlyValidRecHit")),
99  m_ttacollToken(
100  consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("trajTrackAssoCollection"))),
101  m_debug(iConfig.getUntrackedParameter<bool>("debugMode", false)),
102  m_tsoshm(iConfig.getParameter<edm::ParameterSet>("tsosHMConf")) {
103  //now do what ever initialization is needed
104 
106 
107  m_ptrk = tfserv->make<TH1F>("trkmomentum", "Refitted Track momentum", 100, 0., 200.);
108  m_etatrk = tfserv->make<TH1F>("trketa", "Refitted Track pseudorapidity", 100, -4., 4.);
109 }
110 
112  // do anything here that needs to be done at desctruction time
113  // (e.g. close files, deallocate resources etc.)
114 }
115 
116 //
117 // member functions
118 //
119 
120 // ------------ method called to for each event ------------
122  using namespace edm;
123 
124  // loop on trajectories and plot TSOS local coordinate
125 
126  TrajectoryStateCombiner tsoscomb;
127 
128  // Trajectory Handle
129 
130  DetIdSelector selector("0x1fbff004-0x14ac1004");
131 
133  iEvent.getByToken(m_ttacollToken, ttac);
134 
135  for (TrajTrackAssociationCollection::const_iterator pair = ttac->begin(); pair != ttac->end(); ++pair) {
136  const edm::Ref<std::vector<Trajectory> >& traj = pair->key;
137  const reco::TrackRef& trk = pair->val;
138  const std::vector<TrajectoryMeasurement>& tmcoll = traj->measurements();
139 
140  m_ptrk->Fill(trk->p());
141  m_etatrk->Fill(trk->eta());
142 
143  for (std::vector<TrajectoryMeasurement>::const_iterator meas = tmcoll.begin(); meas != tmcoll.end(); ++meas) {
144  if (!meas->updatedState().isValid())
145  continue;
146 
147  TrajectoryStateOnSurface tsos = tsoscomb(meas->forwardPredictedState(), meas->backwardPredictedState());
149 
150  m_tsoshm.fill(tsos, hit);
151 
152  if (!hit->isValid() && m_validOnly)
153  continue;
154 
155  if (m_debug) {
156  if (selector.isSelected(hit->geographicalId())) {
157  const SiPixelRecHit* pixelrh = dynamic_cast<const SiPixelRecHit*>(hit->hit());
158  if (pixelrh) {
159  edm::LogInfo("ClusterFound") << "Cluster reference" << pixelrh->cluster().key();
160  } else {
161  edm::LogInfo("NoCluster") << "No cluster found!";
162  }
163  }
164  }
165  }
166  }
167 }
168 
170 
172 
173 //define this as a plug-in
TrajectoryStateCombiner.h
TrajectoryStateOnSurface.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
OverlapProblemTSOSAnalyzer::m_debug
const bool m_debug
Definition: OverlapProblemTSOSAnalyzer.cc:81
ESHandle.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
TrajectoryMeasurement.h
TransientTrackingRecHit.h
DetIdSelector.h
EDAnalyzer.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
SiPixelRecHit::cluster
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
TSOSHistogramMaker
Definition: TSOSHistogramMaker.h:16
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
edm::Ref
Definition: AssociativeIterator.h:58
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MakerMacros.h
OverlapProblemTSOSAnalyzer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: OverlapProblemTSOSAnalyzer.cc:169
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
OverlapProblemTSOSAnalyzer::m_validOnly
bool m_validOnly
Definition: OverlapProblemTSOSAnalyzer.cc:79
Service.h
Run.h
OverlapProblemTSOSAnalyzer
Definition: OverlapProblemTSOSAnalyzer.cc:64
SiPixelRecHit.h
OverlapProblemTSOSAnalyzer::~OverlapProblemTSOSAnalyzer
~OverlapProblemTSOSAnalyzer() override
Definition: OverlapProblemTSOSAnalyzer.cc:111
TrajTrackAssociation.h
TFileService.h
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator
friend struct const_iterator
Definition: AssociationMap.h:274
TrajectoryStateCombiner
Definition: TrajectoryStateCombiner.h:13
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ParameterSet
Definition: Functions.h:16
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >
TSOSHistogramMaker::fill
void fill(const TrajectoryStateOnSurface &tsos, TransientTrackingRecHit::ConstRecHitPointer hit) const
Definition: TSOSHistogramMaker.cc:110
TSOSHistogramMaker.h
TrackingRecHit::ConstRecHitPointer
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
Definition: TrackingRecHit.h:25
edm::Service< TFileService >
OverlapProblemTSOSAnalyzer::m_etatrk
TH1F * m_etatrk
Definition: OverlapProblemTSOSAnalyzer.cc:77
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
OverlapProblemTSOSAnalyzer::OverlapProblemTSOSAnalyzer
OverlapProblemTSOSAnalyzer(const edm::ParameterSet &)
Definition: OverlapProblemTSOSAnalyzer.cc:97
InputTag.h
OverlapProblemTSOSAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: OverlapProblemTSOSAnalyzer.cc:121
Trajectory.h
Ref.h
OverlapProblemTSOSAnalyzer::m_tsoshm
TSOSHistogramMaker m_tsoshm
Definition: OverlapProblemTSOSAnalyzer.cc:83
DetId.h
Frameworkfwd.h
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
OverlapProblemTSOSAnalyzer::m_ttacollToken
edm::EDGetTokenT< TrajTrackAssociationCollection > m_ttacollToken
Definition: OverlapProblemTSOSAnalyzer.cc:80
OverlapProblemTSOSAnalyzer::endRun
void endRun(const edm::Run &, const edm::EventSetup &) override
Definition: OverlapProblemTSOSAnalyzer.cc:171
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
ParameterSet.h
OverlapProblemTSOSAnalyzer::m_ptrk
TH1F * m_ptrk
Definition: OverlapProblemTSOSAnalyzer.cc:76
DetIdSelector::isSelected
bool isSelected(const DetId &detid) const
Definition: DetIdSelector.cc:51
edm::Event
Definition: Event.h:73
DetIdSelector
Definition: DetIdSelector.h:12
hit
Definition: SiStripHitEffFromCalibTree.cc:88