ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/AnaFwkMod.cc
(Generate patch)

Comparing UserCode/MitAna/TreeMod/src/AnaFwkMod.cc (file contents):
Revision 1.10 by loizides, Sat Mar 28 14:39:56 2009 UTC vs.
Revision 1.16 by bendavid, Fri Jul 22 18:21:02 2011 UTC

# Line 3 | Line 3
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  
# Line 18 | Line 20 | AnaFwkMod::AnaFwkMod(const char *name, c
20    fAllHeadTreeName(Names::gkAllEvtTreeName),
21    fAllHeadBrName(Names::gkAllEvtHeaderBrn),
22    fSkipNEvents(0),
23 +  fPrintScale(1),
24    fSWtotal(0),
25    fSWevent(0),
26    fAllHeaders(0,Names::gkSkimmedHeaders),
# Line 26 | Line 29 | AnaFwkMod::AnaFwkMod(const char *name, c
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   {
38    // Constructor.
39   }
# Line 167 | Line 174 | void AnaFwkMod::Process()
174    if (fNEventsSkipped<fSkipNEvents) {
175      ++fNEventsSkipped;
176      MDB(kAnalysis, 3) {
177 <      Info("Process", "Skipping (aborting) %d out of %d first events.",
177 >      Info("Process", "Skipping (aborting) %d out of %lld first events.",
178             fNEventsSkipped, fSkipNEvents);
179      }
180      AbortEvent();
# Line 175 | Line 182 | void AnaFwkMod::Process()
182    }
183  
184    // check if printout should be done
185 <  Bool_t doPrint = 0;
185 >  Bool_t doPrint    = 0;
186 >  UInt_t nProcessed = fPrintScale;
187  
188    MDB(kAnalysis, 4) {
189 <    if (GetNEventsProcessed() % 250  == 0)
189 >    if (GetNEventsProcessed() % (fPrintScale)  == 0)
190        doPrint = 1;
191    } else {
192      MDB(kAnalysis, 3) {
193 <      if (GetNEventsProcessed() % 2500  == 0)
193 >      if (GetNEventsProcessed() % (fPrintScale*10)  == 0)
194          doPrint = 1;
195 +      nProcessed = fPrintScale*10;
196      } else {
197        MDB(kAnalysis, 2) {
198 <        if (GetNEventsProcessed() % 10000  == 0)
198 >        if (GetNEventsProcessed() % (fPrintScale*100)  == 0)
199            doPrint = 1;
200 +        nProcessed = fPrintScale*100;
201        } else {
202          MDB(kAnalysis, 1) {
203 <          if (GetNEventsProcessed() % 50000 == 0)
203 >          if (GetNEventsProcessed() % (fPrintScale*1000) == 0)
204              doPrint = 1;
205 +          nProcessed = fPrintScale*1000;
206          }
207        }
208      }
209    }
210  
211 +  if (GetEventHeader()->IsMC()) {
212 +    LoadBranch(fPileupInfoName);  
213 +    Int_t npu[3] = {0,0,0};
214 +    for (UInt_t i=0; i<fPileupInfo->GetEntries(); ++i) {
215 +      const PileupInfo *puinfo = fPileupInfo->At(i);
216 +      if (puinfo->GetBunchCrossing()==0) npu[0]= puinfo->GetPU_NumInteractions();
217 +      else if (puinfo->GetBunchCrossing()==-1) npu[1] = puinfo->GetPU_NumInteractions();
218 +      else if (puinfo->GetBunchCrossing()==1) npu[2] = puinfo->GetPU_NumInteractions();
219 +    }
220 +    
221 +    hNPU->Fill(npu[0]);
222 +    hNPU50ns->Fill(npu[0],npu[1],npu[2]);
223 +  }
224 +
225 +
226    if (doPrint) {
227      fSWevent->Stop();
228      Info("Process",
229           "Events %d -> %.2gs real, %.2gs cpu (%.2g real, %.2g cpu per event)",
230           GetNEventsProcessed(), fSWevent->RealTime(), fSWevent->CpuTime(),
231 <         fSWevent->RealTime()/GetNEventsProcessed(),
232 <         fSWevent->CpuTime()/GetNEventsProcessed());
231 >         fSWevent->RealTime()/nProcessed,
232 >         fSWevent->CpuTime()/nProcessed);
233      fSWevent->Start();
234 <  }  
234 >  }
235 >  
236 >    
237   }
238  
239   //--------------------------------------------------------------------------------------------------
# Line 221 | Line 249 | void AnaFwkMod::SlaveBegin()
249                "Could not publish all event headers with name %s.", fAllHeaders.GetName());
250      return;
251    }
252 +  
253 +  ReqBranch(fPileupInfoName, fPileupInfo);
254 +  
255 +  hNPU = new TH1D("hNPU", "hNPU", 51, -0.5, 50.5);
256 +  AddOutput(hNPU);  
257 +  
258 +  hNPU50ns = new TH3D("hNPU50ns", "hNPU50ns", 51, -0.5, 50.5, 51, -0.5, 50.5, 51, -0.5, 50.5);
259 +  AddOutput(hNPU50ns);  
260 +  
261   }
262  
263   //--------------------------------------------------------------------------------------------------

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines