CMS 3D CMS Logo

MuonSeedsAnalyzer.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2008/03/25
5  18:37:05 $
6  * \author G. Mila - INFN Torino
7  */
8 
10 
19 
21 
24 
30 
31 #include <string>
32 
33 using namespace std;
34 using namespace edm;
35 
37  parameters = pSet;
38 
39  theService = new MuonServiceProxy(parameters.getParameter<ParameterSet>("ServiceParameters"), consumesCollector());
40 
41  theSeedsCollectionLabel_ = consumes<TrajectorySeedCollection>(parameters.getParameter<InputTag>("SeedCollection"));
42 
43  seedHitBin = parameters.getParameter<int>("RecHitBin");
44  seedHitMin = parameters.getParameter<double>("RecHitMin");
45  seedHitMax = parameters.getParameter<double>("RecHitMax");
46  PhiBin = parameters.getParameter<int>("PhiBin");
47  PhiMin = parameters.getParameter<double>("PhiMin");
48  PhiMax = parameters.getParameter<double>("PhiMax");
49  EtaBin = parameters.getParameter<int>("EtaBin");
50  EtaMin = parameters.getParameter<double>("EtaMin");
51  EtaMax = parameters.getParameter<double>("EtaMax");
52  ThetaBin = parameters.getParameter<int>("ThetaBin");
53  ThetaMin = parameters.getParameter<double>("ThetaMin");
54  ThetaMax = parameters.getParameter<double>("ThetaMax");
55  seedPtBin = parameters.getParameter<int>("seedPtBin");
56  seedPtMin = parameters.getParameter<double>("seedPtMin");
57  seedPtMax = parameters.getParameter<double>("seedPtMax");
58  seedPxyzBin = parameters.getParameter<int>("seedPxyzBin");
59  seedPxyzMin = parameters.getParameter<double>("seedPxyzMin");
60  seedPxyzMax = parameters.getParameter<double>("seedPxyzMax");
61  pErrBin = parameters.getParameter<int>("pErrBin");
62  pErrMin = parameters.getParameter<double>("pErrMin");
63  pErrMax = parameters.getParameter<double>("pErrMax");
64  pxyzErrBin = parameters.getParameter<int>("pxyzErrBin");
65  pxyzErrMin = parameters.getParameter<double>("pxyzErrMin");
66  pxyzErrMax = parameters.getParameter<double>("pxyzErrMax");
67  phiErrBin = parameters.getParameter<int>("phiErrBin");
68  phiErrMin = parameters.getParameter<double>("phiErrMin");
69  phiErrMax = parameters.getParameter<double>("phiErrMax");
70  etaErrBin = parameters.getParameter<int>("etaErrBin");
71  etaErrMin = parameters.getParameter<double>("etaErrMin");
72  etaErrMax = parameters.getParameter<double>("etaErrMax");
73 }
74 MuonSeedsAnalyzer::~MuonSeedsAnalyzer() { delete theService; }
76  ibooker.cd();
77  ibooker.setCurrentFolder("Muons/MuonSeedsAnalyzer");
78 
79  string histname = "NumberOfRecHitsPerSeed_";
80  NumberOfRecHitsPerSeed = ibooker.book1D(histname, "Number of seed recHits", seedHitBin, seedHitMin, seedHitMax);
81 
82  histname = "seedPhi_";
83  seedPhi = ibooker.book1D(histname, "Seed #phi", PhiBin, PhiMin, PhiMax);
84  seedPhi->setAxisTitle("rad");
85 
86  histname = "seedEta_";
87  seedEta = ibooker.book1D(histname, "Seed #eta", EtaBin, EtaMin, EtaMax);
88 
89  histname = "seedTheta_";
90  seedTheta = ibooker.book1D(histname, "Seed #theta", ThetaBin, ThetaMin, ThetaMax);
91  seedTheta->setAxisTitle("rad");
92 
93  histname = "seedPt_";
94  seedPt = ibooker.book1D(histname, "Seed p_{t}", seedPtBin, seedPtMin, seedPtMax);
95  seedPt->setAxisTitle("GeV");
96 
97  histname = "seedPx_";
98  seedPx = ibooker.book1D(histname, "Seed p_{x}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
99  seedPx->setAxisTitle("GeV");
100  histname = "seedPy_";
101  seedPy = ibooker.book1D(histname, "Seed p_{y}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
102  seedPy->setAxisTitle("GeV");
103  histname = "seedPz_";
104  seedPz = ibooker.book1D(histname, "Seed p_{z}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
105  seedPz->setAxisTitle("GeV");
106 
107  histname = "seedPtErrOverPt_";
108  seedPtErr = ibooker.book1D(histname, "Seed p_{t}Err/p_{t}", pErrBin, pErrMin, pErrMax);
109  histname = "seedPtErrOverPtVsPhi_";
110  seedPtErrVsPhi =
111  ibooker.book2D(histname, "Seed p_{t}Err/p_{t} vs #phi", PhiBin, PhiMin, PhiMax, pErrBin, pErrMin, pErrMax);
112  seedPtErrVsPhi->setAxisTitle("rad", 2);
113  histname = "seedPtErrOverPtVsEta_";
114  seedPtErrVsEta =
115  ibooker.book2D(histname, "Seed p_{t}Err/p_{t} vs #eta", EtaBin, EtaMin, EtaMax, pErrBin, pErrMin, pErrMax);
116  histname = "seedPtErrOverPtVsPt_";
117  seedPtErrVsPt = ibooker.book2D(
118  histname, "Seed p_{t}Err/p_{t} vs p_{t}", seedPtBin / 5, seedPtMin, seedPtMax, pErrBin, pErrMin, pErrMax);
119  seedPtErrVsPt->setAxisTitle("GeV", 2);
120  histname = "seedPErrOverP_";
121  seedPErr = ibooker.book1D(histname, "Seed pErr/p", pErrBin, pErrMin, pErrMax);
122  histname = "seedPErrOverPVsPhi_";
123  seedPErrVsPhi = ibooker.book2D(histname, "Seed pErr/p vs #phi", PhiBin, PhiMin, PhiMax, pErrBin, pErrMin, pErrMax);
124  seedPErrVsPhi->setAxisTitle("rad", 2);
125  histname = "seedPErrOverPVsEta_";
126  seedPErrVsEta = ibooker.book2D(histname, "Seed pErr/p vs #eta", EtaBin, EtaMin, EtaMax, pErrBin, pErrMin, pErrMax);
127  histname = "seedPErrOverPVsPt_";
128  seedPErrVsPt =
129  ibooker.book2D(histname, "Seed pErr/p vs p_{t}", seedPtBin / 5, seedPtMin, seedPtMax, pErrBin, pErrMin, pErrMax);
130  seedPErrVsPt->setAxisTitle("GeV", 2);
131 
132  histname = "seedPxErrOverPx_";
133  seedPxErr = ibooker.book1D(histname, "Seed p_{x}Err/p_{x}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
134  histname = "seedPyErrOverPy_";
135  seedPyErr = ibooker.book1D(histname, "Seed p_{y}Err/p_{y}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
136  histname = "seedPzErrOverPz_";
137  seedPzErr = ibooker.book1D(histname, "Seed p_{z}Err/p_{z}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
138 
139  histname = "seedPhiErr_";
140  seedPhiErr = ibooker.book1D(histname, "Seed #phi error", phiErrBin, phiErrMin, phiErrMax);
141 
142  histname = "seedEtaErr_";
143  seedEtaErr = ibooker.book1D(histname, "Seed #eta error", etaErrBin, etaErrMin, etaErrMax);
144 }
145 
147  theService->update(iSetup);
148 
149  // Take the seeds container
151  iEvent.getByToken(theSeedsCollectionLabel_, seeds);
152 
153  // if not valid, skip
154  if (!seeds.isValid())
155  return;
156 
157  for (TrajectorySeedCollection::const_iterator seed = seeds->begin(); seed != seeds->end(); ++seed) {
158  // const TrajectorySeed sd = *seed;
159 
160  // Get the Trajectory State on Det (persistent version of a TSOS) from the seed
161  PTrajectoryStateOnDet pTSOD = seed->startingState();
162 
163  // Transform it in a TrajectoryStateOnSurface
164  DetId seedDetId(pTSOD.detId());
165  const GeomDet* gdet = theService->trackingGeometry()->idToDet(seedDetId);
166  TrajectoryStateOnSurface seedTSOS =
167  trajectoryStateTransform::transientState(pTSOD, &(gdet->surface()), &*(theService)->magneticField());
169  double partialPterror =
170  errors(3, 3) * pow(seedTSOS.globalMomentum().x(), 2) + errors(4, 4) * pow(seedTSOS.globalMomentum().y(), 2);
171 
172  LogTrace(metname) << "[MuonSeedAnalyzer] Filling the histos";
173 
174  // nhits
175  LogTrace(metname) << "Number od recHits per seed: " << seed->nHits();
176  NumberOfRecHitsPerSeed->Fill(seed->nHits());
177 
178  // pt
179  LogTrace(metname) << "seed momentum: " << seedTSOS.globalMomentum().perp();
180  seedPt->Fill(seedTSOS.globalMomentum().perp());
181 
182  // px
183  LogTrace(metname) << "seed px: " << seedTSOS.globalMomentum().x();
184  seedPx->Fill(seedTSOS.globalMomentum().x());
185 
186  // py
187  LogTrace(metname) << "seed py: " << seedTSOS.globalMomentum().y();
188  seedPy->Fill(seedTSOS.globalMomentum().y());
189 
190  // pz
191  LogTrace(metname) << "seed pz: " << seedTSOS.globalMomentum().z();
192  seedPz->Fill(seedTSOS.globalMomentum().z());
193 
194  // phi
195  LogTrace(metname) << "seed phi: " << seedTSOS.globalMomentum().phi();
196  seedPhi->Fill(seedTSOS.globalMomentum().phi());
197 
198  // theta
199  LogTrace(metname) << "seed theta: " << seedTSOS.globalMomentum().theta();
200  seedTheta->Fill(seedTSOS.globalMomentum().theta());
201 
202  // eta
203  LogTrace(metname) << "seed eta: " << seedTSOS.globalMomentum().eta();
204  seedEta->Fill(seedTSOS.globalMomentum().eta());
205 
206  // pt err
207  LogTrace(metname) << "seed pt error: " << sqrt(partialPterror) / seedTSOS.globalMomentum().perp();
208  seedPtErr->Fill(sqrt(partialPterror) / seedTSOS.globalMomentum().perp());
209 
210  // ptErr/pt Vs phi
211  seedPtErrVsPhi->Fill(seedTSOS.globalMomentum().phi(), sqrt(partialPterror) / seedTSOS.globalMomentum().perp());
212  // ptErr/pt Vs eta
213  seedPtErrVsEta->Fill(seedTSOS.globalMomentum().eta(), sqrt(partialPterror) / seedTSOS.globalMomentum().perp());
214  // ptErr/pt Vs pt
215  seedPtErrVsPt->Fill(seedTSOS.globalMomentum().perp(), sqrt(partialPterror) / seedTSOS.globalMomentum().perp());
216 
217  // px err
218  LogTrace(metname) << "seed px error: " << sqrt(errors(3, 3)) / seedTSOS.globalMomentum().x();
219  seedPxErr->Fill(sqrt(errors(3, 3)) / seedTSOS.globalMomentum().x());
220 
221  // py err
222  LogTrace(metname) << "seed py error: " << sqrt(errors(4, 4)) / seedTSOS.globalMomentum().y();
223  seedPyErr->Fill(sqrt(errors(4, 4)) / seedTSOS.globalMomentum().y());
224 
225  // pz err
226  LogTrace(metname) << "seed pz error: " << sqrt(errors(5, 5)) / seedTSOS.globalMomentum().z();
227  seedPzErr->Fill(sqrt(errors(5, 5)) / seedTSOS.globalMomentum().z());
228 
229  // p err
230  LogTrace(metname) << "seed p error: "
231  << sqrt(partialPterror + errors(5, 5) * pow(seedTSOS.globalMomentum().z(), 2)) /
232  seedTSOS.globalMomentum().mag();
233  seedPErr->Fill(sqrt(partialPterror + errors(5, 5) * pow(seedTSOS.globalMomentum().z(), 2)) /
234  seedTSOS.globalMomentum().mag());
235 
236  // pErr/p Vs phi
237  seedPErrVsPhi->Fill(
238  seedTSOS.globalMomentum().phi(),
239  sqrt(partialPterror + errors(5, 5) * pow(seedTSOS.globalMomentum().z(), 2)) / seedTSOS.globalMomentum().mag());
240  // pErr/p Vs eta
241  seedPErrVsEta->Fill(
242  seedTSOS.globalMomentum().eta(),
243  sqrt(partialPterror + errors(5, 5) * pow(seedTSOS.globalMomentum().z(), 2)) / seedTSOS.globalMomentum().mag());
244  // pErr/p Vs pt
245  seedPErrVsPt->Fill(
246  seedTSOS.globalMomentum().perp(),
247  sqrt(partialPterror + errors(5, 5) * pow(seedTSOS.globalMomentum().z(), 2)) / seedTSOS.globalMomentum().mag());
248 
249  // phi err
250  LogTrace(metname) << "seed phi error: " << sqrt(seedTSOS.curvilinearError().matrix()(2, 2));
251  seedPhiErr->Fill(sqrt(seedTSOS.curvilinearError().matrix()(2, 2)));
252 
253  // eta err
254  LogTrace(metname) << "seed eta error: "
255  << sqrt(seedTSOS.curvilinearError().matrix()(1, 1)) * abs(sin(seedTSOS.globalMomentum().theta()));
256  seedEtaErr->Fill(sqrt(seedTSOS.curvilinearError().matrix()(1, 1)) * abs(sin(seedTSOS.globalMomentum().theta())));
257  }
258 }
muonSeedsAnalyzer_cfi.seedPtMax
seedPtMax
Definition: muonSeedsAnalyzer_cfi.py:34
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
Handle.h
muonSeedsAnalyzer_cfi.seedPtMin
seedPtMin
Definition: muonSeedsAnalyzer_cfi.py:16
MessageLogger.h
MuonPatternRecoDumper.h
GeomDet
Definition: GeomDet.h:27
muonSeedsAnalyzer_cfi.seedPxyzMin
seedPxyzMin
Definition: muonSeedsAnalyzer_cfi.py:10
TrajectoryStateOnSurface::cartesianError
const CartesianTrajectoryError cartesianError() const
Definition: TrajectoryStateOnSurface.h:71
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
MonitorTrackInnerTrackMuons_cff.phiErrMax
phiErrMax
Definition: MonitorTrackInnerTrackMuons_cff.py:46
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
MuonSeedsAnalyzer::MuonSeedsAnalyzer
MuonSeedsAnalyzer(const edm::ParameterSet &)
Constructor.
Definition: MuonSeedsAnalyzer.cc:36
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
MuonSeedsAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: MuonSeedsAnalyzer.cc:75
muonSeedsAnalyzer_cfi.pxyzErrBin
pxyzErrBin
Definition: muonSeedsAnalyzer_cfi.py:28
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MuonSeedsAnalyzer.h
MonitorTrackInnerTrackMuons_cff.EtaBin
EtaBin
Definition: MonitorTrackInnerTrackMuons_cff.py:64
TransientTrack.h
edm::Handle
Definition: AssociativeIterator.h:50
MuonServiceProxy_cff.MuonServiceProxy
MuonServiceProxy
Definition: MuonServiceProxy_cff.py:14
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
fileCollector.seed
seed
Definition: fileCollector.py:127
MonitorTrackSTAMuons_cfi.ThetaMin
ThetaMin
Definition: MonitorTrackSTAMuons_cfi.py:221
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MonitorTrackSTAMuons_cfi.PhiMax
PhiMax
Definition: MonitorTrackSTAMuons_cfi.py:230
PTrajectoryStateOnDet::detId
unsigned int detId() const
Definition: PTrajectoryStateOnDet.h:65
Track.h
errors
Definition: errors.py:1
MonitorTrackInnerTrackMuons_cff.etaErrMax
etaErrMax
Definition: MonitorTrackInnerTrackMuons_cff.py:47
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
AlgebraicSymMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Definition: AlgebraicROOTObjects.h:24
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
MonitorTrackSTAMuons_cfi.etaErrMin
etaErrMin
Definition: MonitorTrackSTAMuons_cfi.py:261
MonitorTrackSTAMuons_cfi.pErrMax
pErrMax
Definition: MonitorTrackSTAMuons_cfi.py:235
TrajectorySeed.h
edm::ParameterSet
Definition: ParameterSet.h:47
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
muonSeedsAnalyzer_cfi.seedPxyzMax
seedPxyzMax
Definition: muonSeedsAnalyzer_cfi.py:25
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
MonitorTrackSTAMuons_cfi.phiErrMin
phiErrMin
Definition: MonitorTrackSTAMuons_cfi.py:266
iEvent
int iEvent
Definition: GenABIO.cc:224
trajectoryStateTransform::transientState
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Definition: TrajectoryStateTransform.cc:35
MonitorTrackSTAMuons_cfi.PhiMin
PhiMin
Definition: MonitorTrackSTAMuons_cfi.py:231
edm::EventSetup
Definition: EventSetup.h:58
MonitorTrackSTAMuons_cfi.phiErrBin
phiErrBin
Definition: MonitorTrackSTAMuons_cfi.py:264
TrajectorySeedCollection.h
CartesianTrajectoryError::matrix
const AlgebraicSymMatrix66 & matrix() const
Definition: CartesianTrajectoryError.h:28
muonSeedsAnalyzer_cfi.seedPxyzBin
seedPxyzBin
Definition: muonSeedsAnalyzer_cfi.py:17
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
GeomDet.h
muonSeedsAnalyzer_cfi.seedPtBin
seedPtBin
Definition: muonSeedsAnalyzer_cfi.py:35
std
Definition: JetResolutionObject.h:76
DetachedQuadStep_cff.seeds
seeds
Definition: DetachedQuadStep_cff.py:195
MonitorTrackInnerTrackMuons_cff.EtaMin
EtaMin
Definition: MonitorTrackInnerTrackMuons_cff.py:64
MonitorTrackInnerTrackMuons_cff.EtaMax
EtaMax
Definition: MonitorTrackInnerTrackMuons_cff.py:64
MonitorTrackSTAMuons_cfi.pErrMin
pErrMin
Definition: MonitorTrackSTAMuons_cfi.py:236
MonitorTrackSTAMuons_cfi.ThetaMax
ThetaMax
Definition: MonitorTrackSTAMuons_cfi.py:220
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
MuonSeedsAnalyzer::~MuonSeedsAnalyzer
~MuonSeedsAnalyzer() override
Destructor.
Definition: MuonSeedsAnalyzer.cc:74
TrajectoryStateOnSurface::curvilinearError
const CurvilinearTrajectoryError & curvilinearError() const
Definition: TrajectoryStateOnSurface.h:72
MuonServiceProxy.h
DetLayer.h
TrajectoryStateTransform.h
MonitorTrackSTAMuons_cfi.PhiBin
PhiBin
Definition: MonitorTrackSTAMuons_cfi.py:229
dqm::implementation::IBooker
Definition: DQMStore.h:43
muonSeedsAnalyzer_cfi.pxyzErrMin
pxyzErrMin
Definition: muonSeedsAnalyzer_cfi.py:11
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
ConsumesCollector.h
MonitorTrackSTAMuons_cfi.etaErrBin
etaErrBin
Definition: MonitorTrackSTAMuons_cfi.py:259
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
ParameterSet.h
edm::Event
Definition: Event.h:73
MuonSeedsAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: MuonSeedsAnalyzer.cc:146
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:791
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
edm::InputTag
Definition: InputTag.h:15
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
CurvilinearTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: CurvilinearTrajectoryError.h:61
MonitorTrackSTAMuons_cfi.pErrBin
pErrBin
Definition: MonitorTrackSTAMuons_cfi.py:234
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MeasurementDet.h
muonSeedsAnalyzer_cfi.pxyzErrMax
pxyzErrMax
Definition: muonSeedsAnalyzer_cfi.py:13
MonitorTrackSTAMuons_cfi.ThetaBin
ThetaBin
Definition: MonitorTrackSTAMuons_cfi.py:219
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40
debug_messages_cfi.errors
errors
Definition: debug_messages_cfi.py:54