1 |
konec |
1.1 |
// -*- C++ -*-
|
2 |
|
|
//
|
3 |
|
|
// Package: PatternEff
|
4 |
|
|
// Class: PatternEff
|
5 |
|
|
//
|
6 |
|
|
/**\class PatternEff PatternEff.cc PatternEff/PatternEff/src/PatternEff.cc
|
7 |
|
|
|
8 |
|
|
Description: [one line class summary]
|
9 |
|
|
|
10 |
|
|
Implementation:
|
11 |
|
|
[Notes on implementation]
|
12 |
|
|
*/
|
13 |
|
|
//
|
14 |
|
|
// Original Author: Dominik Bartkiewicz,40 2-A20,+41227671616,
|
15 |
|
|
// Created: Thu May 13 21:11:17 CEST 2010
|
16 |
|
|
// $Id$
|
17 |
|
|
//
|
18 |
|
|
//
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
// system include files
|
22 |
|
|
#include <memory>
|
23 |
|
|
|
24 |
|
|
// user include files
|
25 |
|
|
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
26 |
|
|
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
27 |
|
|
|
28 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
29 |
|
|
#include "FWCore/Framework/interface/MakerMacros.h"
|
30 |
|
|
|
31 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
32 |
|
|
|
33 |
|
|
#include "DQMServices/Core/interface/DQMStore.h"
|
34 |
|
|
|
35 |
|
|
#include <Geometry/RPCGeometry/interface/RPCRoll.h>
|
36 |
|
|
#include <Geometry/RPCGeometry/interface/RPCGeometry.h>
|
37 |
|
|
#include "Geometry/Records/interface/MuonGeometryRecord.h"
|
38 |
|
|
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
|
39 |
|
|
#include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
|
40 |
|
|
#include "DataFormats/RPCDigi/interface/RPCDigi.h"
|
41 |
|
|
#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
|
42 |
|
|
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
|
43 |
|
|
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
|
44 |
|
|
#include "DataFormats/GeometrySurface/interface/LocalError.h"
|
45 |
|
|
#include "DataFormats/GeometryVector/interface/LocalPoint.h"
|
46 |
|
|
#include "DataFormats/Common/interface/Handle.h"
|
47 |
|
|
#include "DataFormats/Candidate/interface/Candidate.h"
|
48 |
|
|
#include "DataFormats/MuonReco/interface/Muon.h"
|
49 |
|
|
#include "DataFormats/MuonReco/interface/MuonFwd.h"
|
50 |
|
|
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
|
51 |
|
|
#include <DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h>
|
52 |
|
|
#include "DataFormats/Math/interface/deltaR.h"
|
53 |
|
|
#include "FWCore/ServiceRegistry/interface/Service.h"
|
54 |
|
|
#include "FWCore/MessageLogger/interface/MessageLogger.h"
|
55 |
|
|
#include "DQMServices/Core/interface/MonitorElement.h"
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
#include "MuonAnalysis/MuonAssociators/interface/PropagateToMuon.h"
|
59 |
|
|
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
|
60 |
|
|
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
|
61 |
|
|
#include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
|
62 |
|
|
#include "TrackingTools/GeomPropagators/interface/Propagator.h"
|
63 |
|
|
|
64 |
|
|
#include "TTree.h"
|
65 |
|
|
#include "FWCore/ServiceRegistry/interface/Service.h"
|
66 |
|
|
#include "CommonTools/UtilAlgos/interface/TFileService.h"
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
|
70 |
|
|
//
|
71 |
|
|
// class declaration
|
72 |
|
|
//
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
class PatternEff : public edm::EDAnalyzer {
|
77 |
|
|
public:
|
78 |
|
|
|
79 |
|
|
explicit PatternEff(const edm::ParameterSet&);
|
80 |
|
|
~PatternEff();
|
81 |
|
|
|
82 |
|
|
DQMStore * dqm;
|
83 |
|
|
edm::Service<TFileService> fs;
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
MonitorElement * DeltaEtaEmu, * DeltaEtaDat, * DeltaPhiEmu, * DeltaPhiDat, * PtCodeEmu, * PtCodeDat,* DeltaEtaCSC, * DeltaEtaDT , * DeltaPhiCSC, * DeltaPhiDT, * EtaCSCAll, * PhiCSCAll, * DeltaRDat, * DeltaREmu, * DeltaRCSC, * DeltaRDT;
|
87 |
|
|
|
88 |
|
|
double m_deltaRThreshold;
|
89 |
|
|
TTree * tree;
|
90 |
|
|
struct MEPACEff;
|
91 |
|
|
private:
|
92 |
|
|
virtual void beginJob() ;
|
93 |
|
|
virtual void analyze(const edm::Event&, const edm::EventSetup&);
|
94 |
|
|
virtual void endJob() ;
|
95 |
|
|
std::vector<MEPACEff> _mePACEffVec;
|
96 |
|
|
int lumi;
|
97 |
|
|
int run;
|
98 |
|
|
int RPC_Emu;
|
99 |
|
|
int RPC_Dat;
|
100 |
|
|
int GM;
|
101 |
|
|
int CSC;
|
102 |
|
|
int DT;
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
// ----------member data ---------------------------
|
108 |
|
|
};
|
109 |
|
|
|
110 |
|
|
//
|
111 |
|
|
// constants, enums and typedefs
|
112 |
|
|
//
|
113 |
|
|
|
114 |
|
|
//
|
115 |
|
|
// static data member definitions
|
116 |
|
|
//
|
117 |
|
|
std::string changedot(double x)
|
118 |
|
|
{
|
119 |
|
|
std::stringstream ss;
|
120 |
|
|
ss<<x;
|
121 |
|
|
std::string s=ss.str();
|
122 |
|
|
if (s.find('.')!=std::string::npos)
|
123 |
|
|
{s.replace(s.find('.'),1,1,'d');}
|
124 |
|
|
return s;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
struct PatternEff::MEPACEff {
|
128 |
|
|
public:
|
129 |
|
|
MEPACEff(edm::ParameterSet ps, DQMStore * dqm): _ptL(ps.getParameter<double>("ptL")),
|
130 |
|
|
_ptH(ps.getParameter<double>("ptH"))
|
131 |
|
|
|
132 |
|
|
{
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
{
|
137 |
|
|
std::stringstream name;
|
138 |
|
|
std::stringstream title;
|
139 |
|
|
|
140 |
|
|
name<<"Eta_Emu_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
141 |
|
|
title<<"RPCTrigger: #eta Emu Pt["<<_ptL<<","<<_ptH<<"]";
|
142 |
|
|
_EtaEmu = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
143 |
|
|
|
144 |
|
|
}
|
145 |
|
|
{
|
146 |
|
|
std::stringstream name;
|
147 |
|
|
std::stringstream title;
|
148 |
|
|
|
149 |
|
|
name<<"Eta_Dat_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
150 |
|
|
title<<"RPCTrigger: #eta Dat Pt["<<_ptL<<","<<_ptH<<"]";
|
151 |
|
|
_EtaDat = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
152 |
|
|
}
|
153 |
|
|
{
|
154 |
|
|
std::stringstream name;
|
155 |
|
|
std::stringstream title;
|
156 |
|
|
|
157 |
|
|
name<<"Eta_Ref_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
158 |
|
|
title<<"GM: #eta Ref Pt["<<_ptL<<","<<_ptH<<"]";
|
159 |
|
|
_EtaRef = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
160 |
|
|
}
|
161 |
|
|
{
|
162 |
|
|
std::stringstream name;
|
163 |
|
|
std::stringstream title;
|
164 |
|
|
|
165 |
|
|
name<<"Eta_CSC_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
166 |
|
|
title<<"CSCTrigger: #eta CSC Pt["<<_ptL<<","<<_ptH<<"]";
|
167 |
|
|
_EtaCSC = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
{
|
171 |
|
|
std::stringstream name;
|
172 |
|
|
std::stringstream title;
|
173 |
|
|
|
174 |
|
|
name<<"Eta_DT_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
175 |
|
|
title<<"DTTrigger: #eta DT Pt["<<_ptL<<","<<_ptH<<"]";
|
176 |
|
|
_EtaDT = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
{
|
181 |
|
|
std::stringstream name;
|
182 |
|
|
std::stringstream title;
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
name<<"Eta_Dat_DTorCSC_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
186 |
|
|
title<<"#eta Dat and DT or CSC Pt["<<_ptL<<","<<_ptH<<"]";
|
187 |
|
|
_EtaDatAndDTorCSC = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
{
|
191 |
|
|
std::stringstream name;
|
192 |
|
|
std::stringstream title;
|
193 |
|
|
|
194 |
|
|
name<<"Eta_Emu_DTorCSC_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
195 |
|
|
title<<" #eta Emu and DT or CSC Pt["<<_ptL<<","<<_ptH<<"]";
|
196 |
|
|
_EtaEmuAndDTorCSC = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
197 |
|
|
}
|
198 |
|
|
|
199 |
|
|
{
|
200 |
|
|
std::stringstream name;
|
201 |
|
|
std::stringstream title;
|
202 |
|
|
|
203 |
|
|
name<<"Eta_DTorCSC_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
204 |
|
|
title<<" #eta DT or CSC Pt["<<_ptL<<","<<_ptH<<"]";
|
205 |
|
|
_EtaDTorCSC = dqm->book1D(name.str(),title.str(),100,-2.5,2.5);
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
{
|
210 |
|
|
std::stringstream name;
|
211 |
|
|
std::stringstream title;
|
212 |
|
|
|
213 |
|
|
name<<"Phi_Emu_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
214 |
|
|
title<<"RPCTrigger: #eta Emu Pt["<<_ptL<<","<<_ptH<<"]";
|
215 |
|
|
_PhiEmu = dqm->book2D(name.str(),title.str(),100,-2.5,2.5,100,-M_PI,M_PI);
|
216 |
|
|
|
217 |
|
|
}
|
218 |
|
|
{
|
219 |
|
|
std::stringstream name;
|
220 |
|
|
std::stringstream title;
|
221 |
|
|
|
222 |
|
|
name<<"Phi_Dat_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
223 |
|
|
title<<"RPCTrigger: #eta Dat Pt["<<_ptL<<","<<_ptH<<"]";
|
224 |
|
|
_PhiDat = dqm->book2D(name.str(),title.str(),100,-2.5,2.5,100,-M_PI,M_PI);
|
225 |
|
|
}
|
226 |
|
|
{
|
227 |
|
|
std::stringstream name;
|
228 |
|
|
std::stringstream title;
|
229 |
|
|
|
230 |
|
|
name<<"Phi_Ref_Pt_"<<changedot(_ptL)<<"_"<<changedot(_ptH);
|
231 |
|
|
title<<"GM: #eta Ref Pt["<<_ptL<<","<<_ptH<<"]";
|
232 |
|
|
_PhiRef = dqm->book2D(name.str(),title.str(),100,-2.5,2.5,100,-M_PI,M_PI);
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
};
|
237 |
|
|
|
238 |
|
|
void fill( const reco::Muon *gl,bool Dat, bool Emu, bool DT ,bool CSC )
|
239 |
|
|
{
|
240 |
|
|
|
241 |
|
|
if((gl->pt()>=_ptL)&&(gl->pt()<=_ptH)){
|
242 |
|
|
_EtaRef->Fill(gl->eta());
|
243 |
|
|
_PhiRef->Fill(gl->eta(),gl->phi());
|
244 |
|
|
if(Dat) {
|
245 |
|
|
_EtaDat->Fill(gl->eta());
|
246 |
|
|
_PhiDat->Fill(gl->eta(),gl->phi());
|
247 |
|
|
}
|
248 |
|
|
if(Emu) {
|
249 |
|
|
_EtaEmu->Fill(gl->eta());
|
250 |
|
|
_PhiEmu->Fill(gl->eta(),gl->phi());
|
251 |
|
|
}
|
252 |
|
|
if(CSC) _EtaCSC->Fill(gl->eta());
|
253 |
|
|
if(DT) _EtaDT->Fill(gl->eta());
|
254 |
|
|
if(Dat && (DT || CSC)) _EtaDatAndDTorCSC->Fill(gl->eta());
|
255 |
|
|
if(Emu && (DT || CSC)) _EtaEmuAndDTorCSC->Fill(gl->eta());
|
256 |
|
|
if(DT || CSC) _EtaDTorCSC->Fill(gl->eta());
|
257 |
|
|
|
258 |
|
|
}
|
259 |
|
|
}
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
private:
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
float _ptL, _ptH;
|
268 |
|
|
|
269 |
|
|
MonitorElement * _EtaEmu, * _EtaDat, * _EtaRef, * _EtaCSC, * _EtaDT, * _EtaDatAndDTorCSC, * _EtaEmuAndDTorCSC, * _EtaDTorCSC,* _PhiEmu, * _PhiDat, * _PhiRef ;
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
};
|
274 |
|
|
//
|
275 |
|
|
// constructors and destructor
|
276 |
|
|
//
|
277 |
|
|
PatternEff::PatternEff(const edm::ParameterSet& iConfig):
|
278 |
|
|
m_deltaRThreshold(iConfig.getParameter<double>("deltaRThreshold"))
|
279 |
|
|
|
280 |
|
|
{
|
281 |
|
|
//now do what ever initialization is needed
|
282 |
|
|
|
283 |
|
|
dqm = edm::Service<DQMStore>().operator->();
|
284 |
|
|
if ( !dqm ) {
|
285 |
|
|
throw cms::Exception("RPCTriggerValidation") << "Cannot get DQMStore \n";
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
// EtaEmu = dqm->book1D("Eta_Emu","RPCTrigger: Efficiency vs #eta Emu",100,-2.5,2.5);
|
289 |
|
|
// EtaDat = dqm->book1D("Eta_Dat","RPCTrigger: Efficiency vs #eta - Dat",100,-2.5,2.5);
|
290 |
|
|
// EtaRef = dqm->book1D("Eta_Ref","RPCTrigger: Efficiency vs #eta - Ref",100,-2.5,2.5);
|
291 |
|
|
EtaCSCAll = dqm->book1D("Eta_CSC_All","CSCTrigger: Distr #eta ",100,-3.5,3.5);
|
292 |
|
|
PhiCSCAll = dqm->book1D("Phi_CSC_All","CSCTrigger: Distr #phi ",100,-M_PI,M_PI);
|
293 |
|
|
// EtaDT = dqm->book1D("Eta_DT","DTTrigger: Efficiency vs #eta ",100,-2.5,2.5);
|
294 |
|
|
// EtaDatAndDTorCSC = dqm->book1D("Eta_Dat_DTorCSC","Dat and DT or CSC #eta ",100,-2.5,2.5);
|
295 |
|
|
// EtaEmuAndDTorCSC = dqm->book1D("Eta_Emu_DTorCSC","Emu and DT or CSC #eta ",100,-2.5,2.5);
|
296 |
|
|
// EtaDTorCSC = dqm->book1D("Eta_DTorCSC","DT or CSC #eta ",100,-2.5,2.5);
|
297 |
|
|
DeltaEtaEmu = dqm->book1D("Delta_Eta_Emu","RPCTrigger: Delta #eta - Emu",100,-2.5,2.5);
|
298 |
|
|
DeltaEtaDat = dqm->book1D("Delta_Eta_Dat","RPCTrigger: Delta #eta - Dat",100,-2.5,2.5);
|
299 |
|
|
DeltaPhiEmu = dqm->book1D("Delta_Phi_Emu","RPCTrigger: Delta #eta - Emu",100,-2.5,2.5);
|
300 |
|
|
DeltaPhiDat = dqm->book1D("Delta_Phi_Dat","RPCTrigger: Delta #eta - Dat",100,-2.5,2.5);
|
301 |
|
|
PtCodeDat = dqm->book1D("PtCode_Dat","RPCTrigger: PtCode - Dat",32, -0.5, 31.5);
|
302 |
|
|
PtCodeEmu = dqm->book1D("PtCode_Emu","RPCTrigger: PtCode - Emu",32, -0.5, 31.5);
|
303 |
|
|
DeltaEtaCSC = dqm->book1D("Delta_Eta_CSC","CSCTrigger: Delta #eta",100,-2.5,2.5);
|
304 |
|
|
DeltaEtaDT = dqm->book1D("Delta_Eta_DT","DTTrigger: Delta #eta ",100,-2.5,2.5);
|
305 |
|
|
DeltaPhiCSC = dqm->book1D("Delta_Phi_CSC","CSCTrigger: Delta #eta ",100,-2.5,2.5);
|
306 |
|
|
DeltaPhiDT = dqm->book1D("Delta_Phi_DT","DTTrigger: Delta #eta ",100,-2.5,2.5);
|
307 |
|
|
|
308 |
|
|
DeltaREmu = dqm->book1D("Delta_R_Emu","RPCTrigger: Delta R - Emu",100,-2.5,2.5);
|
309 |
|
|
DeltaRDat = dqm->book1D("Delta_R_Dat","RPCTrigger: Delta R - Dat",100,-2.5,2.5);
|
310 |
|
|
DeltaRCSC = dqm->book1D("Delta_R_CSC","CSCTrigger: Delta R",100,-2.5,2.5);
|
311 |
|
|
DeltaRDT = dqm->book1D("Delta_R_DT","DTTrigger: Delta R",100,-2.5,2.5);
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
tree=fs->make<TTree>("L1_Eff", "L1_Eff");
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
tree->Branch("lumi", &lumi,"lumi/I");
|
318 |
|
|
tree->Branch("run",&run,"run/I");
|
319 |
|
|
tree->Branch("RPC_Emu", &RPC_Emu,"RPC_Emu/I");
|
320 |
|
|
tree->Branch("RPC_Dat",&RPC_Dat,"RPC_Dat/I");
|
321 |
|
|
tree->Branch("GM", &GM,"GM/I" );
|
322 |
|
|
tree->Branch("CSC", &CSC, "CSC/I");
|
323 |
|
|
tree->Branch("DT", &DT,"DT/I");
|
324 |
|
|
|
325 |
|
|
std::vector<edm::ParameterSet> PtRanges = iConfig.getParameter< std::vector<edm::ParameterSet> > ("PtRanges");std::vector<edm::ParameterSet>::iterator it =PtRanges.begin();
|
326 |
|
|
std::vector<edm::ParameterSet>::iterator itE =PtRanges.end();
|
327 |
|
|
|
328 |
|
|
it = PtRanges.begin();
|
329 |
|
|
itE =PtRanges.end();
|
330 |
|
|
|
331 |
|
|
for (;it!=itE;++it){
|
332 |
|
|
|
333 |
|
|
_mePACEffVec.push_back( MEPACEff(*it,dqm) );
|
334 |
|
|
|
335 |
|
|
}
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
}
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
PatternEff::~PatternEff()
|
344 |
|
|
{
|
345 |
|
|
|
346 |
|
|
// do anything here that needs to be done at desctruction time
|
347 |
|
|
// (e.g. close files, deallocate resources etc.)
|
348 |
|
|
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
//
|
353 |
|
|
// member functions
|
354 |
|
|
//
|
355 |
|
|
|
356 |
|
|
// ------------ method called to for each event ------------
|
357 |
|
|
void
|
358 |
|
|
PatternEff::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
359 |
|
|
{
|
360 |
|
|
using namespace edm;
|
361 |
|
|
using namespace reco;
|
362 |
|
|
using namespace std;
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
std::vector<L1MuRegionalCand> L1Dat;
|
370 |
|
|
std::vector<L1MuRegionalCand> L1Emu;
|
371 |
|
|
std::vector<L1MuRegionalCand> L1DT;
|
372 |
|
|
std::vector<L1MuRegionalCand> L1CSC;
|
373 |
|
|
edm::InputTag DatTag("gtDigis","","RECO");
|
374 |
|
|
edm::InputTag EmuTag("simGmtDigis","","L1Wide");
|
375 |
|
|
edm::Handle<L1MuGMTReadoutCollection> pCollection;
|
376 |
|
|
|
377 |
|
|
iEvent.getByLabel(EmuTag,pCollection);
|
378 |
|
|
L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
|
379 |
|
|
vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
|
380 |
|
|
vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
for( RRItr = gmt_records.begin() ;
|
384 |
|
|
RRItr != gmt_records.end() ;
|
385 |
|
|
RRItr++ )
|
386 |
|
|
{
|
387 |
|
|
|
388 |
|
|
vector<vector<L1MuRegionalCand> > brlAndFwdCands;
|
389 |
|
|
brlAndFwdCands.push_back(RRItr->getBrlRPCCands());
|
390 |
|
|
brlAndFwdCands.push_back(RRItr->getFwdRPCCands());
|
391 |
|
|
|
392 |
|
|
vector<vector<L1MuRegionalCand> >::iterator RPCTFCands = brlAndFwdCands.begin();
|
393 |
|
|
for(; RPCTFCands!= brlAndFwdCands.end(); ++RPCTFCands)
|
394 |
|
|
{
|
395 |
|
|
|
396 |
|
|
for( vector<L1MuRegionalCand>::const_iterator
|
397 |
|
|
ECItr = RPCTFCands->begin() ;
|
398 |
|
|
ECItr != RPCTFCands->end() ;
|
399 |
|
|
++ECItr )
|
400 |
|
|
{
|
401 |
|
|
if(!ECItr->empty()) L1Emu.push_back(*ECItr);
|
402 |
|
|
}
|
403 |
|
|
}
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
iEvent.getByLabel(DatTag,pCollection);
|
411 |
|
|
|
412 |
|
|
gmtrc = pCollection.product();
|
413 |
|
|
gmt_records = gmtrc->getRecords();
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
for( RRItr = gmt_records.begin() ;
|
417 |
|
|
RRItr != gmt_records.end() ;
|
418 |
|
|
RRItr++ )
|
419 |
|
|
{
|
420 |
|
|
|
421 |
|
|
vector<vector<L1MuRegionalCand> > brlAndFwdCands;
|
422 |
|
|
brlAndFwdCands.push_back(RRItr->getBrlRPCCands());
|
423 |
|
|
brlAndFwdCands.push_back(RRItr->getFwdRPCCands());
|
424 |
|
|
|
425 |
|
|
vector<vector<L1MuRegionalCand> >::iterator RPCTFCands = brlAndFwdCands.begin();
|
426 |
|
|
for(; RPCTFCands!= brlAndFwdCands.end(); ++RPCTFCands)
|
427 |
|
|
{
|
428 |
|
|
|
429 |
|
|
for( vector<L1MuRegionalCand>::const_iterator
|
430 |
|
|
ECItr = RPCTFCands->begin() ;
|
431 |
|
|
ECItr != RPCTFCands->end() ;
|
432 |
|
|
++ECItr )
|
433 |
|
|
{
|
434 |
|
|
if(!ECItr->empty()) L1Dat.push_back(*ECItr);
|
435 |
|
|
}
|
436 |
|
|
}
|
437 |
|
|
|
438 |
|
|
|
439 |
|
|
L1DT=RRItr->getDTBXCands();
|
440 |
|
|
|
441 |
|
|
L1CSC=RRItr->getCSCCands();
|
442 |
|
|
}
|
443 |
|
|
|
444 |
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
//Handle<CandidateView> mcHandle; // can hold reco::Muon or genParticle
|
448 |
|
|
//iEvent.getByLabel("muons", mcHandle);
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
edm::ParameterSet pset;
|
452 |
|
|
std::string str("none");
|
453 |
|
|
pset.addParameter("useTrack", str);
|
454 |
|
|
pset.addParameter("useState", "atVertex");
|
455 |
|
|
|
456 |
|
|
pset.addParameter("useSimpleGeometry", true);
|
457 |
|
|
|
458 |
|
|
|
459 |
|
|
edm::Handle<reco::BeamSpot> pBeamSpot;
|
460 |
|
|
iEvent.getByLabel("offlineBeamSpot", pBeamSpot);
|
461 |
|
|
const reco::BeamSpot *bspot = pBeamSpot.product();
|
462 |
|
|
const math::XYZPoint bspotPosition = bspot->position();
|
463 |
|
|
|
464 |
|
|
lumi=iEvent.getLuminosityBlock().luminosityBlockAuxiliary().id().luminosityBlock();
|
465 |
|
|
run=iEvent.run();
|
466 |
|
|
RPC_Emu=L1Emu.size();
|
467 |
|
|
RPC_Dat=L1Dat.size();
|
468 |
|
|
GM=0;
|
469 |
|
|
CSC=0;
|
470 |
|
|
DT=0;
|
471 |
|
|
|
472 |
|
|
|
473 |
|
|
std::vector<L1MuRegionalCand>::iterator itL1;
|
474 |
|
|
std::vector<L1MuRegionalCand>::iterator itL1E;
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
itL1 = L1DT.begin();
|
478 |
|
|
itL1E = L1DT.end();
|
479 |
|
|
for (;itL1!=itL1E;++itL1){
|
480 |
|
|
if ( !(itL1->empty()) ){
|
481 |
|
|
DT++;
|
482 |
|
|
}
|
483 |
|
|
}
|
484 |
|
|
|
485 |
|
|
itL1 = L1CSC.begin();
|
486 |
|
|
itL1E = L1CSC.end();
|
487 |
|
|
for (;itL1!=itL1E;++itL1){
|
488 |
|
|
if ( !(itL1->empty()) ){
|
489 |
|
|
CSC++;
|
490 |
|
|
}
|
491 |
|
|
}
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
Handle<MuonCollection> mcHandle;
|
495 |
|
|
iEvent.getByLabel( "muons", mcHandle );
|
496 |
|
|
|
497 |
|
|
for( reco::MuonCollection::const_iterator ref = mcHandle->begin(); ref != mcHandle->end(); ref++ ){
|
498 |
|
|
// reco::MuonRef ref = mcHandle->refAt(i);
|
499 |
|
|
bool Dat= false;
|
500 |
|
|
bool Emu= false;
|
501 |
|
|
bool DT= false;
|
502 |
|
|
bool CSC= false;
|
503 |
|
|
|
504 |
|
|
|
505 |
|
|
if((ref->pdgId() == 13 || ref->pdgId() == -13) && ref->isGlobalMuon() && ref->isTrackerMuon() && (ref->track ()->dxy(bspotPosition) )< 0.5 ) {
|
506 |
|
|
|
507 |
|
|
GM++;
|
508 |
|
|
double _phi ,_eta;
|
509 |
|
|
|
510 |
|
|
PropagateToMuon propagatorToMuon(pset);
|
511 |
|
|
|
512 |
|
|
propagatorToMuon.init(iSetup);
|
513 |
|
|
|
514 |
|
|
TrajectoryStateOnSurface trackAtRPC=propagatorToMuon.extrapolate(*ref);
|
515 |
|
|
|
516 |
|
|
if (trackAtRPC.isValid()) {
|
517 |
|
|
_phi = trackAtRPC.globalPosition().phi();
|
518 |
|
|
_eta = trackAtRPC.globalPosition().eta();
|
519 |
|
|
}else{
|
520 |
|
|
_phi=ref->phi();
|
521 |
|
|
_eta=ref->eta();
|
522 |
|
|
}
|
523 |
|
|
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
itL1 = L1Dat.begin();
|
527 |
|
|
itL1E = L1Dat.end();
|
528 |
|
|
for (;itL1!=itL1E;++itL1){
|
529 |
|
|
|
530 |
|
|
double dr = reco::deltaR(itL1->etaValue(),itL1->phiValue(),_eta,_phi);
|
531 |
|
|
if (dr < m_deltaRThreshold) Dat=true;
|
532 |
|
|
DeltaEtaDat->Fill(_eta-itL1->etaValue());
|
533 |
|
|
DeltaRDat->Fill(dr);
|
534 |
|
|
DeltaPhiDat->Fill(_phi-itL1->phiValue());
|
535 |
|
|
PtCodeDat->Fill(itL1->pt_packed());
|
536 |
|
|
}
|
537 |
|
|
|
538 |
|
|
itL1 = L1Emu.begin();
|
539 |
|
|
itL1E = L1Emu.end();
|
540 |
|
|
for (;itL1!=itL1E;++itL1){
|
541 |
|
|
|
542 |
|
|
double dr = reco::deltaR(itL1->etaValue(),itL1->phiValue(),_eta,_phi);
|
543 |
|
|
if (dr < m_deltaRThreshold) Emu=true;
|
544 |
|
|
DeltaEtaEmu->Fill(_eta-itL1->etaValue());
|
545 |
|
|
DeltaPhiEmu->Fill(_phi-itL1->phiValue());
|
546 |
|
|
PtCodeEmu->Fill(itL1->pt_packed());
|
547 |
|
|
DeltaREmu->Fill(dr);
|
548 |
|
|
}
|
549 |
|
|
|
550 |
|
|
itL1 = L1DT.begin();
|
551 |
|
|
itL1E = L1DT.end();
|
552 |
|
|
for (;itL1!=itL1E;++itL1){
|
553 |
|
|
if ( !(itL1->empty()) ){
|
554 |
|
|
double dr = reco::deltaR(itL1->etaValue(),itL1->phiValue(),_eta,_phi);
|
555 |
|
|
if (dr < m_deltaRThreshold) DT=true;
|
556 |
|
|
DeltaEtaDT->Fill(_eta-itL1->etaValue());
|
557 |
|
|
DeltaPhiDT->Fill(_phi-itL1->phiValue());
|
558 |
|
|
DeltaRDT->Fill(dr);
|
559 |
|
|
}
|
560 |
|
|
}
|
561 |
|
|
|
562 |
|
|
itL1 = L1CSC.begin();
|
563 |
|
|
itL1E = L1CSC.end();
|
564 |
|
|
for (;itL1!=itL1E;++itL1){
|
565 |
|
|
if ( !(itL1->empty()) ){
|
566 |
|
|
double dr = reco::deltaR(itL1->etaValue(),itL1->phiValue(),_eta,_phi);
|
567 |
|
|
if (dr < m_deltaRThreshold) CSC=true;
|
568 |
|
|
DeltaEtaCSC->Fill(_eta-itL1->etaValue());
|
569 |
|
|
DeltaPhiCSC->Fill(_phi-itL1->phiValue());
|
570 |
|
|
EtaCSCAll->Fill(itL1->etaValue());
|
571 |
|
|
PhiCSCAll->Fill(itL1->phiValue());
|
572 |
|
|
DeltaRCSC->Fill(dr);
|
573 |
|
|
}
|
574 |
|
|
}
|
575 |
|
|
|
576 |
|
|
|
577 |
|
|
std::vector<MEPACEff>::iterator itEff = _mePACEffVec.begin();
|
578 |
|
|
std::vector<MEPACEff>::iterator itEffE = _mePACEffVec.end();
|
579 |
|
|
for (;itEff!=itEffE; ++itEff){
|
580 |
|
|
itEff->fill(&(*ref),Dat,Emu,DT,CSC);
|
581 |
|
|
}
|
582 |
|
|
if(Dat && !Emu) std::cout<<"error Dat not Emu run:"<<run<<"lui "<<lumi<<"event "<<std::endl;
|
583 |
|
|
|
584 |
|
|
}
|
585 |
|
|
}
|
586 |
|
|
|
587 |
|
|
if(RPC_Emu+RPC_Dat+GM+CSC+DT>0) tree->Fill();
|
588 |
|
|
if(RPC_Emu<RPC_Dat) {
|
589 |
|
|
|
590 |
|
|
// Retrieve RecHits from the event
|
591 |
|
|
edm::Handle<RPCRecHitCollection> recHitHandle;
|
592 |
|
|
iEvent.getByLabel("rpcRecHits", recHitHandle);
|
593 |
|
|
|
594 |
|
|
edm::ESHandle<RPCGeometry> theRPCGeometry;
|
595 |
|
|
iSetup.get<MuonGeometryRecord>().get(theRPCGeometry);
|
596 |
|
|
if (!theRPCGeometry.isValid()) {
|
597 |
|
|
edm::LogWarning("MuonSimHitsValidAnalyzer::fillRPC")
|
598 |
|
|
<< "Unable to find MuonGeometryRecord for the RPCGeometry in event!";
|
599 |
|
|
return;
|
600 |
|
|
}
|
601 |
|
|
|
602 |
|
|
|
603 |
|
|
const RPCGeometry & rpcGeom(*theRPCGeometry);
|
604 |
|
|
|
605 |
|
|
typedef RPCRecHitCollection::const_iterator RecHitIter;
|
606 |
|
|
|
607 |
|
|
|
608 |
|
|
|
609 |
|
|
for ( RecHitIter recHitIter = recHitHandle->begin();
|
610 |
|
|
recHitIter != recHitHandle->end(); ++recHitIter )
|
611 |
|
|
{
|
612 |
|
|
const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
|
613 |
|
|
const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom.roll(detId()));
|
614 |
|
|
if ( !roll ) continue;
|
615 |
|
|
|
616 |
|
|
const int region = roll->id().region();
|
617 |
|
|
const int ring = roll->id().ring();
|
618 |
|
|
//const int sector = roll->id().sector();
|
619 |
|
|
const int station = abs(roll->id().station());
|
620 |
|
|
//const int layer = roll->id().layer();
|
621 |
|
|
//const int subSector = roll->id().subsector();
|
622 |
|
|
std::cout<<"!!!! region : "<<region<<" ring : "<<ring<<" station : "<<station<<std::endl;
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
}
|
627 |
|
|
}
|
628 |
|
|
}
|
629 |
|
|
|
630 |
|
|
|
631 |
|
|
// ------------ method called once each job just before starting event loop ------------
|
632 |
|
|
void
|
633 |
|
|
PatternEff::beginJob()
|
634 |
|
|
{
|
635 |
|
|
}
|
636 |
|
|
|
637 |
|
|
// ------------ method called once each job just after ending the event loop ------------
|
638 |
|
|
void
|
639 |
|
|
PatternEff::endJob() {
|
640 |
|
|
if ( dqm ) dqm -> save("PACEff.root");
|
641 |
|
|
}
|
642 |
|
|
|
643 |
|
|
|
644 |
|
|
//define this as a plug-in
|
645 |
|
|
DEFINE_FWK_MODULE(PatternEff);
|