3 |
|
#include "MitAna/TreeMod/interface/AnaFwkMod.h" |
4 |
|
#include "MitAna/DataUtil/interface/Debug.h" |
5 |
|
#include "MitAna/DataTree/interface/Names.h" |
6 |
+ |
#include "MitAna/DataTree/interface/PileupInfo.h" |
7 |
|
#include <TFile.h> |
8 |
|
#include <TH1D.h> |
9 |
+ |
#include <TH3D.h> |
10 |
|
#include <TStopwatch.h> |
11 |
|
#include <TTree.h> |
12 |
|
|
29 |
|
fReload(kFALSE), |
30 |
|
fCurEnt(-2), |
31 |
|
fNEventsSkimmed(0), |
32 |
< |
fNEventsSkipped(0) |
32 |
> |
fNEventsSkipped(0), |
33 |
> |
fPileupInfoName("PileupInfo"), |
34 |
> |
fDoPUInfo(kFALSE), |
35 |
> |
hNPU(0), |
36 |
> |
hNPU50ns(0), |
37 |
> |
hNPUTrue(0), |
38 |
> |
fMCEventInfo(0), |
39 |
> |
fMCEventInfoName(Names::gkMCEvtInfoBrn), |
40 |
> |
hDTotalMCWeight(0) |
41 |
|
{ |
42 |
|
// Constructor. |
43 |
|
} |
102 |
|
return; |
103 |
|
} |
104 |
|
fAllHeadTree->GetEntry(fCurEnt++); |
105 |
< |
while(fCurEnt<=nemax && fAllEventHeader->Skimmed()) { |
105 |
> |
while (fCurEnt <= nemax && fAllEventHeader->Skimmed()) { |
106 |
|
EventHeader *eh = fAllHeaders.AddNew(); |
107 |
< |
eh->SetRunNum(fAllEventHeader->RunNum()); |
108 |
< |
eh->SetEvtNum(fAllEventHeader->EvtNum()); |
109 |
< |
eh->SetLumiSec(fAllEventHeader->LumiSec()); |
107 |
> |
eh->SetRunNum (fAllEventHeader->RunNum()); |
108 |
> |
eh->SetEvtNum (fAllEventHeader->EvtNum()); |
109 |
> |
eh->SetLumiSec (fAllEventHeader->LumiSec()); |
110 |
|
eh->SetRunEntry(fAllEventHeader->RunEntry()); |
111 |
< |
eh->SetSkimmed(fAllEventHeader->Skimmed()); |
111 |
> |
eh->SetSkimmed (fAllEventHeader->Skimmed()); |
112 |
|
fAllHeadTree->GetEntry(fCurEnt++); |
113 |
|
} |
114 |
< |
if ((fAllEventHeader->RunNum()!=curev->RunNum()) || |
115 |
< |
(fAllEventHeader->EvtNum()!=curev->EvtNum()) || |
116 |
< |
(fAllEventHeader->LumiSec()!=curev->LumiSec()) || |
117 |
< |
(fAllEventHeader->RunEntry()!=curev->RunEntry())) { |
114 |
> |
if ((fAllEventHeader->RunNum() != curev->RunNum()) || |
115 |
> |
(fAllEventHeader->EvtNum() != curev->EvtNum()) || |
116 |
> |
(fAllEventHeader->LumiSec() != curev->LumiSec()) || |
117 |
> |
(fAllEventHeader->RunEntry() != curev->RunEntry())) { |
118 |
|
SendError(kWarning, "CopyAllEventHeaders", |
119 |
|
"Event header information for entry %d inconsistent: " |
120 |
|
"%d==%d, %d==%d, %d==%d, %d==%d", |
130 |
|
if (fCurEnt<nemax) { |
131 |
|
Int_t testEnt = fCurEnt; |
132 |
|
fAllHeadTree->GetEntry(testEnt++); |
133 |
< |
while(testEnt<=nemax && fAllEventHeader->Skimmed()) |
133 |
> |
while (testEnt<=nemax && fAllEventHeader->Skimmed()) |
134 |
|
fAllHeadTree->GetEntry(testEnt++); |
135 |
|
if (testEnt==nemax+1) { // need to add remaining skimmed events |
136 |
|
fAllHeadTree->GetEntry(fCurEnt++); |
137 |
|
while(fCurEnt<=nemax) { |
138 |
|
EventHeader *eh = fAllHeaders.AddNew(); |
139 |
< |
eh->SetRunNum(fAllEventHeader->RunNum()); |
140 |
< |
eh->SetEvtNum(fAllEventHeader->EvtNum()); |
141 |
< |
eh->SetLumiSec(fAllEventHeader->LumiSec()); |
139 |
> |
eh->SetRunNum (fAllEventHeader->RunNum()); |
140 |
> |
eh->SetEvtNum (fAllEventHeader->EvtNum()); |
141 |
> |
eh->SetLumiSec (fAllEventHeader->LumiSec()); |
142 |
|
eh->SetRunEntry(fAllEventHeader->RunEntry()); |
143 |
< |
eh->SetSkimmed(fAllEventHeader->Skimmed()); |
143 |
> |
eh->SetSkimmed (fAllEventHeader->Skimmed()); |
144 |
|
fAllHeadTree->GetEntry(fCurEnt++); |
145 |
|
} |
146 |
|
if (fCurEnt != nemax+1) { |
178 |
|
if (fNEventsSkipped<fSkipNEvents) { |
179 |
|
++fNEventsSkipped; |
180 |
|
MDB(kAnalysis, 3) { |
181 |
< |
Info("Process", "Skipping (aborting) %d out of %d first events.", |
181 |
> |
Info("Process", "Skipping (aborting) %d out of %lld first events.", |
182 |
|
fNEventsSkipped, fSkipNEvents); |
183 |
|
} |
184 |
|
AbortEvent(); |
186 |
|
} |
187 |
|
|
188 |
|
// check if printout should be done |
189 |
< |
Bool_t doPrint = 0; |
189 |
> |
Bool_t doPrint = 0; |
190 |
> |
UInt_t nProcessed = fPrintScale; |
191 |
|
|
192 |
|
MDB(kAnalysis, 4) { |
193 |
|
if (GetNEventsProcessed() % (fPrintScale) == 0) |
196 |
|
MDB(kAnalysis, 3) { |
197 |
|
if (GetNEventsProcessed() % (fPrintScale*10) == 0) |
198 |
|
doPrint = 1; |
199 |
+ |
nProcessed = fPrintScale*10; |
200 |
|
} else { |
201 |
|
MDB(kAnalysis, 2) { |
202 |
|
if (GetNEventsProcessed() % (fPrintScale*100) == 0) |
203 |
|
doPrint = 1; |
204 |
+ |
nProcessed = fPrintScale*100; |
205 |
|
} else { |
206 |
|
MDB(kAnalysis, 1) { |
207 |
|
if (GetNEventsProcessed() % (fPrintScale*1000) == 0) |
208 |
|
doPrint = 1; |
209 |
+ |
nProcessed = fPrintScale*1000; |
210 |
|
} |
211 |
|
} |
212 |
|
} |
213 |
|
} |
214 |
|
|
215 |
+ |
if (GetEventHeader()->IsMC()) { |
216 |
+ |
LoadBranch(fPileupInfoName); |
217 |
+ |
Double_t npu[4] = {0.,0.,0.,0.}; |
218 |
+ |
for (UInt_t i=0; i<fPileupInfo->GetEntries(); ++i) { |
219 |
+ |
const PileupInfo *puinfo = fPileupInfo->At(i); |
220 |
+ |
if (puinfo->GetBunchCrossing()==0) npu[0]= puinfo->GetPU_NumInteractions(); |
221 |
+ |
else if (puinfo->GetBunchCrossing()==-1) npu[1] = puinfo->GetPU_NumInteractions(); |
222 |
+ |
else if (puinfo->GetBunchCrossing()==1) npu[2] = puinfo->GetPU_NumInteractions(); |
223 |
+ |
if (puinfo->GetBunchCrossing()==0) npu[3]= puinfo->GetPU_NumMean(); |
224 |
+ |
} |
225 |
+ |
hNPU->Fill(npu[0]); |
226 |
+ |
hNPU50ns->Fill(npu[0],npu[1],npu[2]); |
227 |
+ |
hNPUTrue->Fill(npu[3]); |
228 |
+ |
|
229 |
+ |
LoadBranch(fMCEventInfoName); |
230 |
+ |
hDTotalMCWeight->Fill(0., fMCEventInfo->Weight()); |
231 |
+ |
|
232 |
+ |
} |
233 |
+ |
|
234 |
+ |
|
235 |
|
if (doPrint) { |
236 |
|
fSWevent->Stop(); |
237 |
|
Info("Process", |
238 |
|
"Events %d -> %.2gs real, %.2gs cpu (%.2g real, %.2g cpu per event)", |
239 |
|
GetNEventsProcessed(), fSWevent->RealTime(), fSWevent->CpuTime(), |
240 |
< |
fSWevent->RealTime()/GetNEventsProcessed(), |
241 |
< |
fSWevent->CpuTime()/GetNEventsProcessed()); |
240 |
> |
fSWevent->RealTime()/nProcessed, |
241 |
> |
fSWevent->CpuTime()/nProcessed); |
242 |
|
fSWevent->Start(); |
243 |
< |
} |
243 |
> |
} |
244 |
> |
|
245 |
> |
|
246 |
|
} |
247 |
|
|
248 |
|
//-------------------------------------------------------------------------------------------------- |
258 |
|
"Could not publish all event headers with name %s.", fAllHeaders.GetName()); |
259 |
|
return; |
260 |
|
} |
261 |
+ |
|
262 |
+ |
ReqBranch(fPileupInfoName, fPileupInfo); |
263 |
+ |
ReqBranch(fMCEventInfoName, fMCEventInfo); |
264 |
+ |
|
265 |
+ |
hNPU = new TH1D("hNPU", "hNPU", 201, -0.5, 200.5); |
266 |
+ |
AddOutput(hNPU); |
267 |
+ |
|
268 |
+ |
hNPU50ns = new TH3D("hNPU50ns", "hNPU50ns", 201, -0.5, 200.5, 201, -0.5, 200.5, 201, -0.5, 200.5); |
269 |
+ |
AddOutput(hNPU50ns); |
270 |
+ |
|
271 |
+ |
hNPUTrue = new TH1D("hNPUTrue", "hNPUTrue", 2000, 0.0, 200.0); |
272 |
+ |
AddOutput(hNPUTrue); |
273 |
+ |
|
274 |
+ |
hDTotalMCWeight = new TH1D("hDTotalMCWeight","hDTotalMCWeight",1,-0.5,0.5); |
275 |
+ |
AddOutput(hDTotalMCWeight); |
276 |
+ |
|
277 |
|
} |
278 |
|
|
279 |
|
//-------------------------------------------------------------------------------------------------- |