ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/AnaTimingL1.cc
Revision: 1.13
Committed: Mon Apr 29 10:15:06 2013 UTC (12 years ago) by konec
Content type: text/plain
Branch: MAIN
CVS Tags: Artur_11_07_2013_B, Artur_11_07_2013_A, Artur_11_07_2013, Artur_28_06_2013, HEAD
Changes since 1.12: +2 -2 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 konec 1.1 #include "UserCode/L1RpcTriggerAnalysis/interface/AnaTimingL1.h"
2     #include "TObjArray.h"
3     #include "TH1D.h"
4     #include "TH2D.h"
5 konec 1.2 #include "TProfile.h"
6 konec 1.1 #include "TGraphErrors.h"
7    
8     #include "UserCode/L1RpcTriggerAnalysis/interface/EventObj.h"
9 konec 1.6 #include "UserCode/L1RpcTriggerAnalysis/interface/EventObjBXExtra.h"
10 konec 1.1 #include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
11     #include "UserCode/L1RpcTriggerAnalysis/interface/L1Obj.h"
12     #include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjColl.h"
13     #include "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h"
14     #include <vector>
15     #include <cmath>
16 konec 1.4 #include <sstream>
17 konec 1.1
18     template <class T> T sqr( T t) {return t*t;}
19     namespace {
20 konec 1.7 TH1D *hTimingL1_Rpc, *hTimingL1_RpcEmu, *hTimingL1_Dt, *hTimingL1_Csc, *hTimingL1_Gmt, *hTimingL1_GmtEmu;
21 konec 1.5 TH2D *hTimingL1_RpcVsDtOpen, *hTimingL1_RpcVsCscOpen, *hTimingL1_RpcVsDtTight, *hTimingL1_RpcVsCscTight;
22 konec 1.9 TH2D *hTimingL1_RpcVsDt_MuOK, *hTimingL1_RpcVsDt_MuBad, *hTimingL1_RpcVsDt_NoMu,
23     *hTimingL1_RpcVsCsc_MuOK , *hTimingL1_RpcVsCsc_MuBad, *hTimingL1_RpcVsCsc_NoMu,
24     *hTimingL1_RpcVsDt_noRPCBX0, *hTimingL1_RpcVsCsc_noRPCBX0;
25 konec 1.11 TH1D *hTimingL1_Rpc2Dt0;
26 konec 1.12 TH2D *hTimingL1_HitsRpc0Dt0, *hTimingL1_HitsRpc2Dt0;
27 konec 1.7 // TProfile *hTimingL1_Prof;
28     // TH1D *hTimingL1_RMS;
29 konec 1.4 TH1D *hTimingL1_DR_Dt, *hTimingL1_DR_Rpc, *hTimingL1_DR_Csc, *hTimingL1_DR_Gmt;
30 konec 1.7 TH1D *hTimingL1_preFire_GmtEmu, *hTimingL1_preFire_GmtEmu_D;
31     TH1D *hTimingL1_postFire_GmtEmu, *hTimingL1_postFire_GmtEmu_D;
32 konec 1.4
33 konec 1.6 // std::map<std::string, TH1D* > hmap;
34    
35 konec 1.4 std::vector<double> drs = {9999, 0.5, 0.3, 0.2, 0.1, 0.06};
36     std::vector<std::string> tags = {"Rpc","Dt","Csc","Gmt","RpcEmu","GmtEmu"};
37     const unsigned int nptBins = 7;
38 konec 1.7 // double ptBins[nptBins+1]={0.1, 5., 7., 12., 16., 20., 25.,161.};
39     double ptBins[nptBins+1]={0.1, 4., 6., 10., 16., 25., 50.,161.};
40 konec 1.6 const unsigned int nptCuts = 3;
41     double ptCuts[nptCuts+1]={0., 6., 16.};
42    
43     TH1D* hL1ptBxForDR[6][nptBins][nptCuts]={ { {0} } };
44     TH1D* hL1ptBxForDR_noBXm2[6][nptBins][nptCuts]={ { {0} } };
45     TH1D* hL1ptBxForDR_noBXp2[6][nptBins][nptCuts]={ { {0} } };
46     TH1D* hL1DRForPt[6][6] = {{0}};
47 konec 1.7
48     static float epsilon = 1.e-6;
49 konec 1.1 }
50    
51     void AnaTimingL1::init(TObjArray& histos)
52     {
53 konec 1.7
54     //
55     // timging for events with GMTQ5-7, ptGMT > threshold;
56     //
57 konec 1.1 hTimingL1_Rpc = new TH1D("hTimingL1_Rpc","hTimingL1_Rpc", 5,-2.5,2.5); hTimingL1_Rpc->Sumw2(); histos.Add(hTimingL1_Rpc);
58 konec 1.7 hTimingL1_RpcEmu = new TH1D("hTimingL1_RpcEmu","hTimingL1_RpcEmu", 5,-2.5,2.5); hTimingL1_RpcEmu->Sumw2(); histos.Add(hTimingL1_RpcEmu);
59 konec 1.1 hTimingL1_Dt = new TH1D("hTimingL1_Dt","hTimingL1_Dt", 5,-2.5,2.5); hTimingL1_Dt->Sumw2(); histos.Add(hTimingL1_Dt);
60     hTimingL1_Csc = new TH1D("hTimingL1_Csc","hTimingL1_Csc", 5,-2.5,2.5); hTimingL1_Csc->Sumw2(); histos.Add(hTimingL1_Csc);
61 konec 1.7 hTimingL1_GmtEmu = new TH1D("hTimingL1_GmtEmu","hTimingL1_GmtEmu", 5,-2.5,2.5); hTimingL1_GmtEmu->Sumw2(); histos.Add(hTimingL1_GmtEmu);
62 konec 1.2 hTimingL1_Gmt = new TH1D("hTimingL1_Gmt","hTimingL1_Gmt", 5,-2.5,2.5); hTimingL1_Gmt->Sumw2(); histos.Add(hTimingL1_Gmt);
63 konec 1.4
64 konec 1.5 hTimingL1_RpcVsDtOpen = new TH2D("hTimingL1_RpcVsDtOpen", "hTimingL1_RpcVsDtOpen", 5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsDtOpen);
65     hTimingL1_RpcVsCscOpen = new TH2D("hTimingL1_RpcVsCscOpen","hTimingL1_RpcVsCscOpen",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsCscOpen);
66     hTimingL1_RpcVsDtTight = new TH2D("hTimingL1_RpcVsDtTight", "hTimingL1_RpcVsDtTight", 5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsDtTight);
67     hTimingL1_RpcVsCscTight = new TH2D("hTimingL1_RpcVsCscTight","hTimingL1_RpcVsCscTight",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsCscTight);
68 konec 1.4
69 konec 1.9 hTimingL1_RpcVsDt_MuOK = new TH2D("hTimingL1_RpcVsDt_MuOK","hTimingL1_RpcVsDt_MuOK",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsDt_MuOK);
70     hTimingL1_RpcVsDt_MuBad = new TH2D("hTimingL1_RpcVsDt_MuBad","hTimingL1_RpcVsDt_MuBad",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsDt_MuBad);
71 konec 1.8 hTimingL1_RpcVsDt_NoMu = new TH2D("hTimingL1_RpcVsDt_NoMu","hTimingL1_RpcVsDt_NoMu",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsDt_NoMu);
72 konec 1.9 hTimingL1_RpcVsCsc_MuOK = new TH2D("hTimingL1_RpcVsCsc_MuOK","hTimingL1_RpcVsCsc_MuOK",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsCsc_MuOK);
73     hTimingL1_RpcVsCsc_MuBad = new TH2D("hTimingL1_RpcVsCsc_MuBad","hTimingL1_RpcVsCsc_MuBad",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsCsc_MuBad);
74 konec 1.8 hTimingL1_RpcVsCsc_NoMu = new TH2D("hTimingL1_RpcVsCsc_NoMu","hTimingL1_RpcVsCsc_NoMu",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsCsc_NoMu);
75 konec 1.9 hTimingL1_RpcVsDt_noRPCBX0 = new TH2D("hTimingL1_RpcVsDt_noRPCBX0","hTimingL1_RpcVsDt_noRPCBX0",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsDt_noRPCBX0);
76     hTimingL1_RpcVsCsc_noRPCBX0 = new TH2D("hTimingL1_RpcVsCsc_noRPCBX0","hTimingL1_RpcVsCsc_noRPCBX0",5,-2.5,2.5, 5,-2.5,2.5); histos.Add(hTimingL1_RpcVsCsc_noRPCBX0);
77 konec 1.11 hTimingL1_Rpc2Dt0 = new TH1D("hTimingL1_Rpc2Dt0","hTimingL1_Rpc2Dt0",7, 0.5,7.5); histos.Add( hTimingL1_Rpc2Dt0);
78 konec 1.12 hTimingL1_Rpc2Dt0->GetXaxis()->SetBinLabel(1,"GLB+prop");
79 konec 1.11 hTimingL1_Rpc2Dt0->GetXaxis()->SetBinLabel(2,"GLB");
80     hTimingL1_Rpc2Dt0->GetXaxis()->SetBinLabel(3,"TK");
81 konec 1.12 hTimingL1_Rpc2Dt0->GetXaxis()->SetBinLabel(4,"STA+dir");
82     hTimingL1_Rpc2Dt0->GetXaxis()->SetBinLabel(5,"STA");
83     hTimingL1_Rpc2Dt0->GetXaxis()->SetBinLabel(6,"Other");
84     hTimingL1_Rpc2Dt0->GetXaxis()->SetBinLabel(7,"NoMu");
85    
86     hTimingL1_HitsRpc0Dt0 = new TH2D("hTimingL1_HitsRpc0Dt0","hTimingL1_HitsRpc0Dt0",7,0.,7.,10,0.,30.); histos.Add( hTimingL1_HitsRpc0Dt0);
87     hTimingL1_HitsRpc2Dt0 = new TH2D("hTimingL1_HitsRpc2Dt0","hTimingL1_HitsRpc2Dt0",7,0.,7.,10,0.,30.); histos.Add( hTimingL1_HitsRpc2Dt0);
88 konec 1.11
89    
90 konec 1.8
91 konec 1.4 hTimingL1_DR_Dt = new TH1D("hTimingL1_DR_Dt", "hTimingL1_DR_Dt", 80,0.,0.8);histos.Add(hTimingL1_DR_Dt);
92     hTimingL1_DR_Rpc = new TH1D("hTimingL1_DR_Rpc","hTimingL1_DR_Rpc",80,0.,0.8);histos.Add(hTimingL1_DR_Rpc);
93     hTimingL1_DR_Csc = new TH1D("hTimingL1_DR_Csc","hTimingL1_DR_Csc",80,0.,0.8);histos.Add(hTimingL1_DR_Csc);
94     hTimingL1_DR_Gmt = new TH1D("hTimingL1_DR_Gmt","hTimingL1_DR_Gmt",80,0.,0.8);histos.Add(hTimingL1_DR_Gmt);
95    
96 konec 1.7 // const unsigned int nBins = 5;
97     // double myPtBins[nBins+1]={5., 7., 12.,16., 20., 25.};
98     // hTimingL1_Prof = new TProfile("hTimingL1_Prof","hTimingL1_Prof",nBins, myPtBins,"s"); histos.Add(hTimingL1_Prof);
99     // hTimingL1_RMS = new TH1D("hTimingL1_RMS","hTimingL1_RMS",nBins, myPtBins); histos.Add(hTimingL1_RMS);
100 konec 1.4
101     //
102     // 1D timing histos
103     //
104     for (std::vector<std::string>::const_iterator is = tags.begin(); is != tags.end(); is++) {
105 konec 1.6 unsigned int itag = is-tags.begin();
106 konec 1.4
107     //
108     // different DR
109     //
110     for (std::vector<double>::const_iterator id = drs.begin(); id != drs.end(); id++) {
111 konec 1.6 unsigned int idr = id-drs.begin();
112 konec 1.4 std::stringstream str;
113     str << "hTimingL1_"<<*is<<"_DR"<<*id;
114 konec 1.6 TH1D *h = new TH1D(str.str().c_str(), str.str().c_str(), 5,-2.5,2.5); h->Sumw2(); histos.Add(h);
115     hL1DRForPt[itag][idr] = h;
116 konec 1.4 }
117    
118     //
119     // different L1Candpt
120     //
121 konec 1.6 for (unsigned int iptL1 = 0; iptL1 < nptBins; iptL1++) {
122     for (unsigned int iptMu = 0; iptMu < nptCuts; iptMu++) {
123     std::stringstream str;
124     str << "hTimingL1_"<<*is<<"_L1PT"<<ptBins[iptL1]<<"_MuPT"<<ptCuts[iptMu];
125     TH1D *h = new TH1D(str.str().c_str(), str.str().c_str(), 5,-2.5,2.5); h->Sumw2(); histos.Add(h);
126     hL1ptBxForDR[itag][iptL1][iptMu]=h;
127     //noBXm2
128     {
129     std::string name = str.str()+"_noBXm2";
130     TH1D *h = new TH1D(name.c_str(), name.c_str(), 5,-2.5,2.5); h->Sumw2(); histos.Add(h);
131     hL1ptBxForDR_noBXm2[itag][iptL1][iptMu]=h;
132     }
133     {
134     std::string name = str.str()+"_noBXp2";
135     TH1D *h = new TH1D(name.c_str(), name.c_str(), 5,-2.5,2.5); h->Sumw2(); histos.Add(h);
136     hL1ptBxForDR_noBXp2[itag][iptL1][iptMu]=h;
137     }
138     }
139 konec 1.4 }
140     }
141     histos.Add( new TH1D("hPrefire","hPrefire",nptBins, ptBins) );
142 konec 1.7
143     // pre+post firing for L1paper
144     hTimingL1_preFire_GmtEmu = new TH1D("hTimingL1_preFire_GmtEmu","hTimingL1_preFire_GmtEmu", nptBins, ptBins); histos.Add(hTimingL1_preFire_GmtEmu);
145     hTimingL1_preFire_GmtEmu_D = new TH1D("hTimingL1_preFire_GmtEmu_D","hTimingL1_preFire_GmtEmu_D", nptBins, ptBins); histos.Add(hTimingL1_preFire_GmtEmu_D);
146     hTimingL1_postFire_GmtEmu = new TH1D("hTimingL1_postFire_GmtEmu", "hTimingL1_postFire_GmtEmu", nptBins, ptBins); histos.Add(hTimingL1_postFire_GmtEmu);
147     hTimingL1_postFire_GmtEmu_D = new TH1D("hTimingL1_postFire_GmtEmu_D","hTimingL1_postFire_GmtEmu_D", nptBins, ptBins); histos.Add(hTimingL1_postFire_GmtEmu_D);
148 konec 1.4
149 konec 1.1 }
150    
151     void AnaTimingL1::resume(TObjArray& histos)
152     {
153 konec 1.7 /*
154 konec 1.2 for (int ibin=1; ibin<=hTimingL1_Prof->GetNbinsX(); ibin++) {
155     double v=hTimingL1_Prof->GetBinError(ibin);
156     hTimingL1_RMS->SetBinContent(ibin, v);
157     hTimingL1_RMS->SetBinError(ibin, 0.);
158     }
159 konec 1.7 */
160 konec 1.2
161 konec 1.1 }
162    
163 konec 1.6 void AnaTimingL1::run(const EventObj* ev_noBx, const MuonObj* muon, const L1ObjColl *l1Coll)
164 konec 1.1 {
165 konec 1.11 // std::cout<<*l1Coll<<std::endl;
166 konec 1.6 const EventObjBXExtra *ev = dynamic_cast<const EventObjBXExtra*>(ev_noBx);
167     if (!ev) return;
168 konec 1.11 // if (ev->hasValidBX_Minus2)return;
169 konec 1.12 // if (ev->hasValidBX_Plus2)return;
170 konec 1.1
171 konec 1.4
172 konec 1.7 bool dbg = false;
173     static double l1ptCutForDR = theConfig.getParameter<double>("l1ptCutForDR");
174     static double l1DRCutForpT = theConfig.getParameter<double>("l1DRCutForpT");
175    
176 konec 1.5 //
177 konec 1.8 // additional check for DT prefireing
178     //
179     {
180 konec 1.12 L1ObjColl collGMT = l1Coll->selectByType(L1Obj::GMT).selectByQuality(4,7).
181     selectByPtMin(l1ptCutForDR).selectByBx(0,0);
182 konec 1.8 L1ObjColl collDT = l1Coll->selectByType(L1Obj::DT);
183     L1ObjColl collCSC = l1Coll->selectByType(L1Obj::CSC);
184 konec 1.11 L1ObjColl collRPC = l1Coll->l1RpcCollEmu();
185 konec 1.8
186     if (collGMT) {
187 konec 1.12 bool matchingProp = collGMT.isMatching_DRBx(0.3, 0, l1ptCutForDR);
188     bool matchingDir = (muon->pt() > 0.) ?
189     collGMT.isMatching_DRBx_At(0.5, 0, 0., muon->eta(), muon->phi()): false;
190 konec 1.8 double eta = collGMT.getL1Objs()[0].eta;
191     double phi = collGMT.getL1Objs()[0].phi;
192 konec 1.9 bool noRPCBX0 = !collRPC.isMatching_DRBx_At(0.3, 0, 0., eta,phi);
193 konec 1.12 if (noRPCBX0 && collDT.isMatching_DRBx_At(0.2, 0, 0., eta,phi)) {
194     hTimingL1_RpcVsDt_noRPCBX0->Fill(0.,0.);
195 konec 1.13 if (!muon->isGlobal() && !muon->isTracker() && muon->isOuter() && matchingDir)
196 konec 1.12 hTimingL1_HitsRpc0Dt0->Fill(muon->nRPCHits, muon->nDTHits);
197     }
198 konec 1.8 for (int ibxRPC=-2; ibxRPC <=2; ibxRPC++) {
199 konec 1.12 if (collRPC.isMatching_DRBx_At(0.2, ibxRPC, 0., eta,phi) ) {
200 konec 1.8 for (int ibxDTCSC=-2; ibxDTCSC <=2; ibxDTCSC++) {
201 konec 1.12 if (collDT.isMatching_DRBx_At(0.2, ibxDTCSC, 0., eta,phi) ) {
202     if (muon->nAllMuons==0) hTimingL1_RpcVsDt_NoMu->Fill(ibxRPC, ibxDTCSC);
203     else if (muon->isGlobal() && matchingProp) hTimingL1_RpcVsDt_MuOK->Fill(ibxRPC, ibxDTCSC);
204     else hTimingL1_RpcVsDt_MuBad->Fill(ibxRPC, ibxDTCSC);
205 konec 1.9 if (noRPCBX0) hTimingL1_RpcVsDt_noRPCBX0->Fill(ibxRPC, ibxDTCSC);
206 konec 1.11 if (noRPCBX0 && ibxDTCSC==0 && ibxRPC==2) {
207 konec 1.12 if (muon->isGlobal() && matchingProp) hTimingL1_Rpc2Dt0->Fill(1.);
208     else if (muon->isGlobal()) hTimingL1_Rpc2Dt0->Fill(2.);
209     else if (muon->isTracker()) hTimingL1_Rpc2Dt0->Fill(3.);
210     else if (muon->isOuter() && matchingDir) {
211     hTimingL1_Rpc2Dt0->Fill(4.);
212     hTimingL1_HitsRpc2Dt0->Fill(muon->nRPCHits, muon->nDTHits);
213 konec 1.13 std::cout << *ev << std::endl << *muon << std::endl << *l1Coll << std::endl;
214 konec 1.12 }
215     else if (muon->isOuter()) hTimingL1_Rpc2Dt0->Fill(5.);
216     else if (muon->nAllMuons>0) hTimingL1_Rpc2Dt0->Fill(6.);
217     else if (muon->nAllMuons==0) hTimingL1_Rpc2Dt0->Fill(7.);
218 konec 1.10
219 konec 1.8 }
220     }
221 konec 1.9 if (collCSC.isMatching_DRBx_At(0.3, ibxDTCSC, 0., eta,phi) ) {
222     if (ibxDTCSC==0 && noRPCBX0) hTimingL1_RpcVsCsc_noRPCBX0->Fill(0.,0.);
223 konec 1.12 if (muon->nAllMuons==0) hTimingL1_RpcVsCsc_NoMu->Fill(ibxRPC, ibxDTCSC);
224     else if (muon->isGlobal() && matchingProp) hTimingL1_RpcVsCsc_MuOK->Fill(ibxRPC, ibxDTCSC);
225     else hTimingL1_RpcVsCsc_MuBad->Fill(ibxRPC, ibxDTCSC);
226 konec 1.9 if (noRPCBX0) hTimingL1_RpcVsCsc_noRPCBX0->Fill(ibxRPC, ibxDTCSC);
227 konec 1.8 }
228     }
229     }
230     }
231     }
232     }
233    
234     //
235 konec 1.5 // main 1D histos, BX vs DR and BX vs PT
236     //
237 konec 1.7 L1ObjColl collGMT = l1Coll->selectByType(L1Obj::GMT).selectByQuality(4,7).selectByDeltaR(l1DRCutForpT).selectByPtMin(l1ptCutForDR);
238    
239 konec 1.8
240     if (!muon->isGlobal()) return;
241 konec 1.6 for (unsigned int itag=0; itag < tags.size(); itag++) {
242 konec 1.4 L1ObjColl coll;
243 konec 1.6 if ( tags[itag] == "Rpc" ) coll = l1Coll->l1RpcColl();
244     if ( tags[itag] == "RpcEmu" ) coll = l1Coll->l1RpcCollEmu();
245     if ( tags[itag] == "Dt" ) coll = l1Coll->selectByType(L1Obj::DT);
246     if ( tags[itag] == "Csc" ) coll = l1Coll->selectByType(L1Obj::CSC);
247 konec 1.7 if ( tags[itag] == "Gmt" ) coll = l1Coll->selectByType(L1Obj::GMT).selectByQuality(4,7);
248     if ( tags[itag] == "GmtEmu" ) coll = l1Coll->selectByType(L1Obj::GMT_emu).selectByQuality(4,7);
249 konec 1.6 if (!coll) continue;
250 konec 1.4
251 konec 1.7 //
252     // main timing histo for paper, for events with GMT ptGMT> threshold (16), dr < drCut (0.3) timing profile off candidates
253     //
254     if (collGMT) {
255     for (int ibx=-2; ibx <=2; ibx++) {
256     if (coll.isMatching_DRBx(l1DRCutForpT, ibx, l1ptCutForDR)) {
257     if ( tags[itag] == "Gmt" ) hTimingL1_Gmt->Fill(ibx);
258     // if (ibx == -2 && tags[itag] == "Gmt" ) dbg = true;
259     }
260     // if (coll.isMatching_DRBx_At(l1DRCutForpT, ibx, l1ptCutForDR,muon->eta(),muon->phi())) {
261     if (coll.isMatching_DRBx(l1DRCutForpT, ibx, l1ptCutForDR)) {
262     // if (ibx==-2 && (tags[itag] == "Csc" || tags[itag] == "RpcEmu") ) dbg = true;
263     if ( tags[itag] == "Rpc") hTimingL1_Rpc->Fill(ibx);
264     if ( tags[itag] == "RpcEmu" ) hTimingL1_RpcEmu->Fill(ibx);
265     if ( tags[itag] == "Dt" ) hTimingL1_Dt->Fill(ibx);
266     if ( tags[itag] == "Csc" ) hTimingL1_Csc->Fill(ibx);
267     // if ( tags[itag] == "Gmt" ) hTimingL1_Gmt->Fill(ibx);
268     if ( tags[itag] == "GmtEmu" ) hTimingL1_GmtEmu->Fill(ibx);
269     }
270     }
271     }
272    
273 konec 1.4
274     // timing for different DR
275 konec 1.6 L1ObjColl collPt = coll.selectByPtMin(l1ptCutForDR);
276     if (collPt) {
277     for (std::vector<double>::const_iterator idr = drs.begin(); idr != drs.end(); idr++) {
278     for (int ibx=-2; ibx <=2; ibx++) {
279     if (collPt.isMatching_DRBx(*idr,ibx)) hL1DRForPt[itag][idr-drs.begin()]->Fill(ibx);
280     }
281 konec 1.4 }
282     }
283    
284 konec 1.6 L1ObjColl collDR = coll.selectByDeltaR( l1DRCutForpT);
285     if (collDR) {
286 konec 1.7 //
287     // timing in given bx(pre-,post-fire) vs L1pt_bin (ptmu > L1pt_bin) for GmtEmu ( L1performance paper)
288     //
289     if (tags[itag] == "GmtEmu" ) {
290     for (unsigned int iptL1=0; iptL1 < nptBins; iptL1++) {
291     if (collDR.isMatching_PtminPtmaxBx(ptBins[iptL1], ptBins[iptL1+1],0, true)) {
292     hTimingL1_preFire_GmtEmu_D->Fill(ptBins[iptL1]+epsilon);
293     if (muon->pt() > ptBins[iptL1]) hTimingL1_postFire_GmtEmu_D->Fill(ptBins[iptL1]+epsilon);
294     }
295     if (collDR.isMatching_PtminPtmaxBx(ptBins[iptL1], ptBins[iptL1+1], -1, true)) {
296     hTimingL1_preFire_GmtEmu->Fill(ptBins[iptL1]+epsilon);
297     }
298     if (collDR.isMatching_PtminPtmaxBx(ptBins[iptL1], ptBins[iptL1+1], 1, true)) {
299     if (muon->pt() > ptBins[iptL1]) hTimingL1_postFire_GmtEmu->Fill(ptBins[iptL1]+epsilon);
300     }
301     }
302     }
303     //
304 konec 1.4 // timing for different L1pt
305 konec 1.7 //
306 konec 1.6 for (unsigned int iptL1=0; iptL1 < nptBins; iptL1++) {
307     for (int ibx=-2; ibx <=2; ibx++) {
308 konec 1.7 if (!collDR.isMatching_PtminPtmaxBx(ptBins[iptL1], ptBins[iptL1+1],ibx, false)) continue;
309 konec 1.6 for (unsigned int iptMu=0; iptMu < nptCuts; iptMu++) {
310 konec 1.7 if (muon->pt() < ptBins[iptL1]) continue;
311 konec 1.6 hL1ptBxForDR[itag][iptL1][iptMu]->Fill(ibx);
312     if (!ev->hasValidBX_Minus2) hL1ptBxForDR_noBXm2[itag][iptL1][iptMu]->Fill(ibx);
313     if (!ev->hasValidBX_Plus2) hL1ptBxForDR_noBXp2[itag][iptL1][iptMu]->Fill(ibx);
314 konec 1.7 // if (ptBins[iptL1] >= 16. && ibx == -2 ) dbg = true;
315     // if (ptBins[iptL1] >= 16. && ibx == -2 ) dbg = true;
316     // if (ptBins[iptL1] >= 16. && ibx == 2 ) dbg = true;
317     // if (ibx == 1 && tags[itag] == "GmtEmu" && ptBins[iptL1] >= 16. ) dbg = true;
318 konec 1.6 }
319     }
320     }
321     }
322    
323     //
324     // DR histos
325     //
326 konec 1.7 const std::vector<double> deltaR = coll.selectByBx( 0, 0).getL1ObjDeltaR();
327     double minDeltaR = 100.;
328     for (unsigned int i=0; i< deltaR.size(); ++i) if (deltaR[i] < minDeltaR) minDeltaR = deltaR[i];
329     if (minDeltaR < 1.) {
330     if (tags[itag]=="Rpc") hTimingL1_DR_Rpc->Fill(minDeltaR);
331     if (tags[itag]=="Dt" ) hTimingL1_DR_Dt->Fill(minDeltaR);
332     if (tags[itag]=="Csc") hTimingL1_DR_Csc->Fill(minDeltaR);
333     if (tags[itag]=="Gmt") hTimingL1_DR_Gmt->Fill(minDeltaR);
334     }
335 konec 1.4 }
336    
337 konec 1.7 if (dbg) {
338     std::cout << "EVENT: " << " id: "<<ev->id
339     << " bx: "<<ev->bx
340     << " val: "<<ev->hasValidBX
341     << " valm2: "<< ev->hasValidBX_Minus2
342     << " valp2: "<< ev->hasValidBX_Plus2 << std::endl;
343     std::cout <<" Muon: pt="<<muon->pt()<<" eta: "<<muon->eta()<<" phi: "<<muon->phi() << std::endl;
344     std::cout <<*l1Coll << std::endl;
345    
346     }
347 konec 1.5
348     //
349     // tight correlation histograms;
350     //
351 konec 1.6 static double muptCutForCorrTight = theConfig.getParameter<double>("muptCutForCorrTight");
352     static double l1DRCutForCorrTight = theConfig.getParameter<double>("l1DRCutForCorrTight");
353     static double l1ptCutForCorrTight = theConfig.getParameter<double>("l1ptCutForCorrTight");
354     if (muon->pt() >= muptCutForCorrTight) {
355     L1ObjColl collTight = l1Coll->selectByPtMin(l1ptCutForCorrTight).selectByDeltaR(l1DRCutForCorrTight);
356     if (collTight) {
357     std::vector<L1Obj> l1Cscs = collTight.selectByType(L1Obj::CSC).getL1Objs();
358     std::vector<L1Obj> l1Dts = collTight.selectByType(L1Obj::DT ).getL1Objs();
359     std::vector<L1Obj> l1RpcEmus = collTight.l1RpcCollEmu().getL1Objs();
360     for (unsigned int ir=0; ir < l1RpcEmus.size(); ir++) {
361     for (unsigned int io=0; io < l1Dts.size(); io++) hTimingL1_RpcVsDtTight->Fill( l1RpcEmus[ir].bx, l1Dts[io].bx);
362     for (unsigned int io=0; io < l1Cscs.size(); io++) hTimingL1_RpcVsCscTight->Fill( l1RpcEmus[ir].bx, l1Cscs[io].bx);
363     }
364 konec 1.1 }
365     }
366    
367 konec 1.5 //
368     // open/loose correlation histograms
369     //
370     {
371     std::vector<L1Obj> l1Cscs = l1Coll->selectByType(L1Obj::CSC).getL1Objs();
372     std::vector<L1Obj> l1Dts = l1Coll->selectByType(L1Obj::DT).getL1Objs();
373     std::vector<L1Obj> l1RpcEmus = l1Coll->l1RpcCollEmu().getL1Objs();
374     for (unsigned int ir=0; ir < l1RpcEmus.size(); ir++) {
375     for (unsigned int io=0; io < l1Dts.size(); io++) hTimingL1_RpcVsDtOpen->Fill( l1RpcEmus[ir].bx, l1Dts[io].bx);
376     for (unsigned int io=0; io < l1Cscs.size(); io++) hTimingL1_RpcVsCscOpen->Fill( l1RpcEmus[ir].bx, l1Cscs[io].bx);
377     }
378 konec 1.2 }
379 konec 1.1
380     }