1 |
konec |
1.1 |
#include "UserCode/L1RpcTriggerAnalysis/interface/AnaDet.h"
|
2 |
|
|
#include "TObjArray.h"
|
3 |
|
|
#include "TH1D.h"
|
4 |
|
|
#include "TH1F.h"
|
5 |
|
|
#include "TAxis.h"
|
6 |
|
|
#include "TGraphErrors.h"
|
7 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/RPCDetIdUtil.h"
|
8 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
|
9 |
konec |
1.4 |
#include "UserCode/L1RpcTriggerAnalysis/interface/DetCluDigiObj.h"
|
10 |
konec |
1.1 |
#include <sstream>
|
11 |
|
|
#include <bitset>
|
12 |
|
|
#include <algorithm>
|
13 |
|
|
|
14 |
|
|
namespace {
|
15 |
|
|
TH1D *hDet_EfficRoll, *hDet_EfficRollWeighted, *hDet_EfficPull;
|
16 |
|
|
TH1D *hDet_CoincDet, *hDet_CoincHit, *hDet_Muon;
|
17 |
|
|
TH1D *hDet_PartHit[6], *hDet_PartDet[6];
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
void AnaDet::run(
|
22 |
|
|
const MuonObj* muon,
|
23 |
konec |
1.4 |
const std::vector<DetCluDigiObj> & detsHitsCompatibleWithMuon,
|
24 |
konec |
1.1 |
const std::vector<uint32_t> & detsCrossedByMuon,
|
25 |
|
|
const std::vector<uint32_t> & detsCrossedByMuonDeepInside)
|
26 |
|
|
{
|
27 |
|
|
typedef std::vector<uint32_t>::const_iterator IDET;
|
28 |
konec |
1.4 |
typedef std::vector<DetCluDigiObj>::const_iterator IDCD;
|
29 |
konec |
1.1 |
if( muon->pt() < 10.) return;
|
30 |
konec |
1.2 |
// if (fabs(muon->eta()) > 1.14 && fabs(muon->eta()) < 1.24) debug = true;
|
31 |
konec |
1.1 |
|
32 |
|
|
DetEfficiencyManager aManDIS;
|
33 |
konec |
1.4 |
for( IDCD it= detsHitsCompatibleWithMuon.begin(); it < detsHitsCompatibleWithMuon.end(); it++) aManDIS.addDetHit( it->det );
|
34 |
konec |
1.1 |
for( IDET it= detsCrossedByMuonDeepInside.begin(); it < detsCrossedByMuonDeepInside.end(); it++) aManDIS.addDetMuon( *it );
|
35 |
|
|
const std::vector<DetEfficiency> & detEfficDIS = aManDIS.dets();
|
36 |
|
|
|
37 |
|
|
//
|
38 |
|
|
// fill "master" eff. manager and DIS efficiencies
|
39 |
|
|
//
|
40 |
|
|
for (std::vector<DetEfficiency>::const_iterator it = detEfficDIS.begin(); it != detEfficDIS.end(); ++it) {
|
41 |
|
|
if (it->isDummy()) continue;
|
42 |
|
|
if (it->numberOfMuons() > 0) {
|
43 |
|
|
|
44 |
|
|
theDetEfficiencyManager.addDetMuon(it->detId());
|
45 |
|
|
if (it->numberOfHits() > 0) theDetEfficiencyManager.addDetHit(it->detId());
|
46 |
|
|
|
47 |
|
|
RPCDetIdUtil det(it->detId());
|
48 |
|
|
if (it->numberOfHits()) hDet_PartHit[det.layer()-1]->Fill(det.part());
|
49 |
|
|
hDet_PartDet[det.layer()-1]->Fill(det.part());
|
50 |
|
|
}
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
//
|
54 |
|
|
// studies with "not-deep" efficiencies
|
55 |
|
|
//
|
56 |
|
|
DetEfficiencyManager aMan;
|
57 |
|
|
if (debug) std::cout <<"detsCrossedByMuon: "<<detsCrossedByMuon.size()<<" detsHitsCompatibleWithMuon: "<<detsHitsCompatibleWithMuon.size()<<std::endl;
|
58 |
konec |
1.4 |
for( IDCD it= detsHitsCompatibleWithMuon.begin(); it < detsHitsCompatibleWithMuon.end(); it++) aMan.addDetHit( it->det );
|
59 |
konec |
1.1 |
for( IDET it= detsCrossedByMuon.begin(); it < detsCrossedByMuon.end(); it++) aMan.addDetMuon( *it );
|
60 |
|
|
const std::vector<DetEfficiency> & detEffic= aMan.dets();
|
61 |
|
|
//
|
62 |
|
|
// coincidenciy efficiencies
|
63 |
|
|
//
|
64 |
konec |
1.2 |
std::bitset<6> hits, hitsL, hitsH;
|
65 |
|
|
std::bitset<6> dets, detsL, detsH;
|
66 |
|
|
double fetaL = fabs(muon->eta())-0.01;
|
67 |
|
|
double fetaH = fabs(muon->eta())+0.07;
|
68 |
konec |
1.1 |
for (std::vector<DetEfficiency>::const_iterator it = detEffic.begin(); it != detEffic.end(); ++it) {
|
69 |
|
|
if (debug) { std::cout <<it->print() << std::endl; }
|
70 |
|
|
if (it->isDummy()) continue;
|
71 |
|
|
RPCDetIdUtil det(it->detId());
|
72 |
konec |
1.2 |
|
73 |
|
|
unsigned int dl = det.layer(muon->eta());
|
74 |
|
|
if (it->numberOfHits() > 0 && dl > 0) hits.set(dl-1);
|
75 |
|
|
if (it->numberOfMuons() > 0 && dl > 0) dets.set(dl-1);
|
76 |
|
|
|
77 |
|
|
unsigned int dlL = det.layer(fetaL);
|
78 |
|
|
if (it->numberOfHits() > 0 && dlL > 0) hitsL.set(dlL-1);
|
79 |
|
|
if (it->numberOfMuons() > 0 && dlL > 0) detsL.set(dlL-1);
|
80 |
|
|
|
81 |
|
|
unsigned int dlH = det.layer(fetaH);
|
82 |
|
|
if (it->numberOfHits() > 0 && dlH > 0) hitsH.set(dlH-1);
|
83 |
|
|
if (it->numberOfMuons() > 0 && dlH > 0) detsH.set(dlH-1);
|
84 |
konec |
1.1 |
}
|
85 |
|
|
if (debug) std::cout <<" Dets crossed by muons: "<<dets.to_string() << std::endl;
|
86 |
|
|
if (debug) std::cout <<" Hits letf by muons: "<<hits.to_string() << std::endl;
|
87 |
|
|
|
88 |
konec |
1.2 |
bool matched_hits = theLayerCoincManager.matched( fetaL, hitsL)
|
89 |
|
|
|| theLayerCoincManager.matched( muon->eta(), hits )
|
90 |
|
|
|| theLayerCoincManager.matched( fetaH, hitsH);
|
91 |
|
|
bool matched_dets = theLayerCoincManager.matched( fetaL, detsL)
|
92 |
|
|
|| theLayerCoincManager.matched( muon->eta(), dets )
|
93 |
|
|
|| theLayerCoincManager.matched( fetaH, detsH);
|
94 |
|
|
|
95 |
|
|
hDet_Muon->Fill(muon->eta());
|
96 |
|
|
if (matched_hits) hDet_CoincHit->Fill(muon->eta());
|
97 |
|
|
if (matched_dets) hDet_CoincDet->Fill(muon->eta());
|
98 |
|
|
if (debug) std::cout<<"Coinc dets: "<<matched_dets<<"Coinc hits: "<<matched_hits<<std::endl;
|
99 |
konec |
1.1 |
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
TGraph* AnaDet::resume()
|
103 |
|
|
{
|
104 |
|
|
TGraphErrors * hDet_GraphEffic = new TGraphErrors();
|
105 |
|
|
const std::vector<DetEfficiency> & detEffic = theDetEfficiencyManager.dets();
|
106 |
|
|
unsigned int iPointforEfficiency = 0;
|
107 |
|
|
unsigned int nPointforEfficiency = 0;
|
108 |
|
|
for (std::vector<DetEfficiency>::const_iterator it = detEffic.begin(); it != detEffic.end(); ++it) if (!it->isDummy()) nPointforEfficiency++;
|
109 |
|
|
hDet_GraphEffic->Set(nPointforEfficiency);
|
110 |
|
|
for (std::vector<DetEfficiency>::const_iterator it = detEffic.begin(); it != detEffic.end(); ++it) {
|
111 |
|
|
if (it->isDummy()) continue;
|
112 |
|
|
hDet_EfficRoll->Fill(it->efficiency());
|
113 |
|
|
hDet_EfficRollWeighted->Fill(it->efficiency(),it->numberOfMuons());
|
114 |
|
|
if (it->efficiencyError() > 0.) hDet_EfficPull->Fill( (it->efficiency()-0.95)/it->efficiencyError());
|
115 |
|
|
hDet_GraphEffic->SetPoint(iPointforEfficiency, it->detId(), it->efficiency());
|
116 |
|
|
hDet_GraphEffic->SetPointError(iPointforEfficiency, 0., it->efficiencyError());
|
117 |
|
|
++iPointforEfficiency;
|
118 |
|
|
}
|
119 |
|
|
return hDet_GraphEffic;
|
120 |
|
|
}
|
121 |
|
|
|
122 |
konec |
1.3 |
void AnaDet::init(TObjArray& histos)
|
123 |
konec |
1.1 |
{
|
124 |
|
|
hDet_EfficRoll = new TH1D("hDet_EfficRoll","hDet_EfficRoll",220,-0.05,1.05); histos.Add(hDet_EfficRoll);
|
125 |
|
|
hDet_EfficRollWeighted = new TH1D("hDet_EfficRollWeighted","hDet_EfficRollWeighted",220,-0.05,1.05); histos.Add(hDet_EfficRollWeighted);
|
126 |
|
|
hDet_EfficPull = new TH1D("hDet_EfficPull","hDet_EfficPull",100,-5.,5.); histos.Add(hDet_EfficPull);
|
127 |
|
|
|
128 |
|
|
hDet_Muon= new TH1D( "hDet_Muon", "hDet_Muon", 64, -1.6, 1.6); histos.Add( hDet_Muon);
|
129 |
|
|
hDet_CoincHit = new TH1D("hDet_CoincHit","hDet_CoincHit",64, -1.6, 1.6); histos.Add(hDet_CoincHit);
|
130 |
|
|
hDet_CoincDet = new TH1D("hDet_CoincDet","hDet_CoincDet",64, -1.6, 1.6); histos.Add(hDet_CoincDet);
|
131 |
|
|
|
132 |
|
|
for (unsigned int i=1; i<=6; ++i) {
|
133 |
|
|
std::stringstream name;
|
134 |
|
|
name.str(""); name<<"hDet_PartHit"<<i; hDet_PartHit[i-1] = new TH1D( name.str().c_str(), name.str().c_str(), 9, -4.5, 4.5); histos.Add(hDet_PartHit[i-1]);
|
135 |
|
|
name.str(""); name<<"hDet_PartDet"<<i; hDet_PartDet[i-1] = new TH1D( name.str().c_str(), name.str().c_str(), 9, -4.5, 4.5); histos.Add(hDet_PartDet[i-1]);
|
136 |
|
|
std::stringstream ax;
|
137 |
|
|
for (int j=0; j<9; ++j) {
|
138 |
|
|
ax.str(""); if(j<2) ax<<"ring: "<<j-3; else if (j<7) ax<<"wheel: "<<j-4; else ax<<"ring: "<<j-5;
|
139 |
|
|
hDet_PartHit[i-1]->GetXaxis()->SetBinLabel(j+1, ax.str().c_str());
|
140 |
|
|
hDet_PartDet[i-1]->GetXaxis()->SetBinLabel(j+1, ax.str().c_str());
|
141 |
|
|
}
|
142 |
|
|
}
|
143 |
|
|
}
|