5 |
|
#include "TH1D.h" |
6 |
|
#include "TGraphErrors.h" |
7 |
|
#include "TF1.h" |
8 |
+ |
#include "TTree.h" |
9 |
+ |
#include "TFile.h" |
10 |
+ |
|
11 |
+ |
#include "UserCode/L1RpcTriggerAnalysis/interface/EventData.h" |
12 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h" |
13 |
+ |
#include "UserCode/L1RpcTriggerAnalysis/interface/HitSpecObj.h" |
14 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/L1Obj.h" |
15 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjColl.h" |
16 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h" |
18 |
|
#include <vector> |
19 |
|
#include <sstream> |
20 |
|
|
21 |
< |
const double AnaEff::ptCuts[ AnaEff::nPtCuts] = { 0., 5., 10., 16., 30., 100.}; |
21 |
> |
const double AnaEff::ptCuts[ AnaEff::nPtCuts] ={0., 0.1, |
22 |
> |
1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5., 6., 7., 8., |
23 |
> |
10., 12., 14., 16., 18., 20., 25., 30., 35., 40., 45., |
24 |
> |
50., 60., 70., 80., 90., 100.}; |
25 |
> |
|
26 |
> |
|
27 |
|
std::string reg[5]={"_Bar","_Int","_End","_Qeq0","_Qgt0"}; |
28 |
|
|
29 |
|
|
30 |
< |
AnaEff::AnaEff(TObjArray& histos) |
31 |
< |
: debug(false) |
30 |
> |
AnaEff::~AnaEff(){ |
31 |
> |
|
32 |
> |
file->Write(); |
33 |
> |
delete file; |
34 |
> |
|
35 |
> |
} |
36 |
> |
|
37 |
> |
void AnaEff::init(TObjArray& histos) |
38 |
|
{ |
39 |
+ |
|
40 |
+ |
|
41 |
+ |
file = new TFile("EfficiencyTree.root","RECREATE"); |
42 |
+ |
tree = new TTree("efficiencyTree","efficiencyTree"); |
43 |
+ |
myEvent = new EventData(); |
44 |
+ |
tree->Branch("Events", myEvent); |
45 |
+ |
|
46 |
|
hEfficMuPt_D = new TH1D("hEfficMuPt_D","hEfficMuPt_D", L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hEfficMuPt_D); |
47 |
|
hEfficRpcNoCut_N = new TH1D("hEfficRpcNoCut_N","hEfficRpcNoCut_N", L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hEfficRpcNoCut_N); |
48 |
|
hEfficRpcPtCut_N = new TH1D("hEfficRpcPtCut_N","hEfficRpcPtCut_N", L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hEfficRpcPtCut_N); |
49 |
|
|
50 |
|
std::string base("hEff"); |
51 |
< |
std::string opt[2]={"_RpcPtCut","_OthPtCut"}; |
51 |
> |
std::string opt[4]={"_RpcPtCut","_OthPtCut","_GmtPtCut","_OtfPtCut"}; |
52 |
|
for (unsigned int ir=0; ir<5; ++ir) { |
53 |
|
std::string name=base+"_PtDenom"+reg[ir]; |
54 |
|
TH1D *h= new TH1D(name.c_str(),name.c_str(), L1PtScale::nPtBins, L1PtScale::ptBins); |
55 |
|
histos.Add(h); hm[name]=h; |
56 |
< |
for (unsigned int iopt=0; iopt<2; ++iopt) { |
56 |
> |
for (unsigned int iopt=0; iopt<4; ++iopt) { |
57 |
|
if (iopt >0 && ir >2) continue; |
58 |
|
for (unsigned int icut=0; icut<AnaEff::nPtCuts; ++icut) { |
59 |
|
std::stringstream str; |
82 |
|
return result; |
83 |
|
} |
84 |
|
|
85 |
< |
void AnaEff::run( const MuonObj *muon, const L1ObjColl *l1RpcColl, const L1ObjColl *l1OtherColl) |
85 |
> |
void AnaEff::run( const TrackObj *muon, const L1ObjColl *l1Coll, const HitSpecObj * hitSpec) |
86 |
|
{ |
87 |
|
double etaMu = fabs(muon->eta()); |
88 |
< |
double ptMu = muon->pt(); |
89 |
< |
if (!muon->isGlobal()) return; |
88 |
> |
double ptMu = muon->pt(); |
89 |
> |
|
90 |
> |
//////////Fill plotting tree |
91 |
> |
myEvent->clear(); |
92 |
> |
myEvent->weight = 1.0; |
93 |
> |
myEvent->pt = muon->pt(); |
94 |
> |
myEvent->eta = muon->eta(); |
95 |
> |
myEvent->phi = muon->phi(); |
96 |
> |
myEvent->phiHit = hitSpec->position().phi(); |
97 |
> |
myEvent->etaHit = hitSpec->position().eta(); |
98 |
> |
myEvent->charge = muon->charge(); |
99 |
> |
///////////////////////////// |
100 |
> |
|
101 |
> |
// if (!muon->isGlobal()) return; |
102 |
|
|
103 |
|
// if (ptMu < 6.) return; |
104 |
|
// if (ptMu > 7.) return; |
105 |
|
|
106 |
< |
//std::vector<L1Obj> l1Rpcs = l1RpcColl->getL1ObjsSelected(true, false, 0., 161., 0,0, -1.6, 1.6, -1.,7., -1,7 ); |
107 |
< |
std::vector<L1Obj> l1Rpcs = l1RpcColl->getL1ObjsSelected(); |
108 |
< |
//std::vector<L1Obj> l1Oths = l1OtherColl->getL1ObjsSelected(); |
109 |
< |
std::vector<L1Obj> l1Oths = l1OtherColl->getL1ObjsSelected(); |
106 |
> |
static double matchingdR = theConfig.getParameter<double>("maxDR"); |
107 |
> |
std::vector<L1Obj> l1Rpcs = l1Coll->l1RpcColl().selectByBx().selectByDeltaR( matchingdR); |
108 |
> |
std::vector<L1Obj> l1Oths = l1Coll->l1OthColl().selectByBx().selectByDeltaR( matchingdR).selectByEta(); |
109 |
> |
std::vector<L1Obj> l1Gmts = l1Coll->selectByType(L1Obj::GMT).selectByBx().selectByQuality(4,7).selectByDeltaR( matchingdR).selectByEta(); |
110 |
> |
std::vector<L1Obj> l1Otfs = l1Coll->selectByType(L1Obj::OTF); |
111 |
> |
|
112 |
> |
myEvent->l1ObjectsOtf = l1Otfs; |
113 |
> |
myEvent->l1ObjectsGmt = l1Gmts; |
114 |
> |
tree->Fill(); |
115 |
|
|
116 |
|
|
117 |
|
hEfficMuPt_D->Fill(ptMu); |
140 |
|
std::stringstream strPt; strPt << "hEff_OthPtCut"<< ptCuts[icut]<<reg[iregion]; |
141 |
|
hm[strPt.str()]->Fill(ptMu); |
142 |
|
} |
143 |
+ |
if (maxPt(l1Gmts)+epsilon > threshold) { |
144 |
+ |
std::stringstream strPt; strPt << "hEff_GmtPtCut"<< ptCuts[icut]<<reg[iregion]; |
145 |
+ |
hm[strPt.str()]->Fill(ptMu); |
146 |
+ |
} |
147 |
+ |
if (maxPt(l1Otfs)+epsilon > threshold) { |
148 |
+ |
std::stringstream strPt; strPt << "hEff_OtfPtCut"<< ptCuts[icut]<<reg[iregion]; |
149 |
+ |
hm[strPt.str()]->Fill(ptMu); |
150 |
+ |
} |
151 |
|
} |
152 |
|
|
153 |
|
|
158 |
|
for (unsigned int ir=3; ir <=4; ++ir) { |
159 |
|
hm["hEff_PtDenom"+reg[ir]]->Fill(ptMu); |
160 |
|
std::vector<L1Obj> l1RpcsQ; |
161 |
< |
if (ir==3) l1RpcsQ = l1RpcColl->getL1ObjsSelected(true, false,0.,161., 0,0, -1.6,1.6, 0.,7., 0,0); |
162 |
< |
if (ir==4) l1RpcsQ = l1RpcColl->getL1ObjsSelected(true, false,0.,161., 0,0, -1.6,1.6, 0.,7., 1,7); |
161 |
> |
L1ObjColl l1RpcCollQ = l1Coll->l1RpcColl().selectByDeltaR( matchingdR).selectByBx(); |
162 |
> |
if (ir==3) l1RpcsQ = l1RpcCollQ.selectByQuality(0,0).getL1Objs(); |
163 |
> |
if (ir==4) l1RpcsQ = l1RpcCollQ.selectByQuality(1,7).getL1Objs(); |
164 |
|
double epsilon=1.e-5; |
165 |
|
for (unsigned int icut=0; icut < AnaEff::nPtCuts; icut++) { |
166 |
|
double threshold = AnaEff::ptCuts[icut]; |