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.15 by bendavid, Fri Mar 11 04:03:54 2011 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 27 | 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 202 | Line 208 | void AnaFwkMod::Process()
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",
# Line 210 | Line 231 | void AnaFwkMod::Process()
231           fSWevent->RealTime()/nProcessed,
232           fSWevent->CpuTime()/nProcessed);
233      fSWevent->Start();
234 <  }  
234 >  }
235 >  
236 >    
237   }
238  
239   //--------------------------------------------------------------------------------------------------
# Line 226 | 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