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.7 by loizides, Thu Mar 12 18:25:35 2009 UTC vs.
Revision 1.9 by loizides, Mon Mar 23 22:15:15 2009 UTC

# Line 17 | Line 17 | AnaFwkMod::AnaFwkMod(const char *name, c
17    BaseMod(name,title),
18    fAllHeadTreeName(Names::gkAllEvtTreeName),
19    fAllHeadBrName(Names::gkAllEvtHeaderBrn),
20 +  fSkipNEvents(0),
21    fSWtotal(0),
22    fSWevent(0),
23    fAllHeaders(0,Names::gkSkimmedHeaders),
# Line 24 | Line 25 | AnaFwkMod::AnaFwkMod(const char *name, c
25    fAllEventHeader(0),
26    fReload(kFALSE),
27    fCurEnt(-2),
28 <  fNEventsSkimmed(0)
28 >  fNEventsSkimmed(0),
29 >  fNEventsSkipped(0)
30   {
31    // Constructor.
32   }
# Line 51 | Line 53 | void AnaFwkMod::BeginRun()
53      fAllHeadTree = dynamic_cast<TTree*>(file->Get(fAllHeadTreeName));
54      if (!fAllHeadTree) {
55        SendError(kWarning, "BeginRun",
56 <                "Can not find tree '%s' in file '%s'",
56 >                "Cannot find tree '%s' in file '%s'",
57                  fAllHeadTreeName.Data(),file->GetName());
58        return;
59      }
# Line 62 | Line 64 | void AnaFwkMod::BeginRun()
64      fAllHeadTree->SetBranchAddress(fAllHeadBrName, &fAllEventHeader);
65    } else {
66      SendError(kWarning, "BeginRun",
67 <              "Can not find branch '%s' in tree '%s'",
67 >              "Cannot find branch '%s' in tree '%s'",
68                fAllHeadBrName.Data(), fAllHeadTreeName.Data());
69      return;
70    }
# Line 77 | Line 79 | void AnaFwkMod::CopyAllEventHeaders()
79  
80    const EventHeader *curev = GetEventHeader();
81    if (!curev) {
82 <    SendError(kWarning, "CopyAllEventHeaders", "Can not obtain current event");
82 >    SendError(kWarning, "CopyAllEventHeaders", "Cannot obtain current event");
83      return;
84    }
85  
# Line 152 | Line 154 | Bool_t AnaFwkMod::Notify()
154   //--------------------------------------------------------------------------------------------------
155   void AnaFwkMod::Process()
156   {
157 <  // Do event counting and print out timing information.
157 >  // Do event skipping and counting and print out timing information.
158  
159 +  // counting processed events
160 +  IncNEventsProcessed();
161    
162    // get skimmed event headers
163    CopyAllEventHeaders();
164    fNEventsSkimmed += fAllHeaders.GetEntries();
165  
166 <  // counting events
167 <  IncNEventsProcessed();
166 >  // check if events should be skipped
167 >  if (fNEventsSkipped<fSkipNEvents) {
168 >    ++fNEventsSkipped;
169 >    MDB(kAnalysis, 3) {
170 >      Info("Process", "Skipping (aborting) %d out of %d first events.",
171 >           fNEventsSkipped, fSkipNEvents);
172 >    }
173 >    AbortEvent();
174 >    return;
175 >  }
176  
177    // check if printout should be done
178    Bool_t doPrint = 0;
179  
180    MDB(kAnalysis, 4) {
181 <    if (GetNEventsProcessed() % 1000  == 0)
181 >    if (GetNEventsProcessed() % 250  == 0)
182        doPrint = 1;
183    } else {
184      MDB(kAnalysis, 3) {
185 <      if (GetNEventsProcessed() % 10000  == 0)
185 >      if (GetNEventsProcessed() % 2500  == 0)
186          doPrint = 1;
187      } else {
188        MDB(kAnalysis, 2) {
189 <        if (GetNEventsProcessed() % 50000  == 0)
189 >        if (GetNEventsProcessed() % 10000  == 0)
190            doPrint = 1;
191        } else {
192          MDB(kAnalysis, 1) {
193 <          if (GetNEventsProcessed() % 250000 == 0)
193 >          if (GetNEventsProcessed() % 50000 == 0)
194              doPrint = 1;
195          }
196        }
# Line 187 | Line 199 | void AnaFwkMod::Process()
199  
200    if (doPrint) {
201      fSWevent->Stop();
202 <    Info("Process", "Events %d -> %.2gs real, %.2gs cpu (%.2g real, %.2g cpu per event)",
202 >    Info("Process",
203 >         "Events %d -> %.2gs real, %.2gs cpu (%.2g real, %.2g cpu per event)",
204           GetNEventsProcessed(), fSWevent->RealTime(), fSWevent->CpuTime(),
205 <         fSWevent->RealTime()/GetNEventsProcessed(), fSWevent->CpuTime()/GetNEventsProcessed());
205 >         fSWevent->RealTime()/GetNEventsProcessed(),
206 >         fSWevent->CpuTime()/GetNEventsProcessed());
207      fSWevent->Start();
208    }  
209   }
# Line 222 | Line 236 | void AnaFwkMod::SlaveTerminate()
236    hDAllEvents->SetEntries(fNEventsSkimmed+GetNEventsProcessed());
237    AddOutput(hDAllEvents);
238  
239 +  TH1D *hDSkippedEvents = new TH1D("hDSkippedEvents","Number of skipped events",1,-0.5,0.5);
240 +  hDSkippedEvents->Fill(0.0,fNEventsSkipped);
241 +  hDSkippedEvents->SetEntries(fNEventsSkipped);
242 +  AddOutput(hDSkippedEvents);
243 +
244    fSWtotal->Stop();
245    fSWevent->Stop();
246  
247    MDB(kAnalysis, 1)
248 <    Info("SlaveTerminate", "Events %d -> %.2gs real, %.2gs cpu (%.2gs real, %.2gs cpu per event)",
248 >    Info("SlaveTerminate",
249 >         "Events %d -> %.2gs real, %.2gs cpu (%.2gs real, %.2gs cpu per event)",
250           GetNEventsProcessed(), fSWtotal->RealTime(), fSWtotal->CpuTime(),
251 <         fSWtotal->RealTime()/GetNEventsProcessed(), fSWtotal->CpuTime()/GetNEventsProcessed());
251 >         fSWtotal->RealTime()/GetNEventsProcessed(),
252 >         fSWtotal->CpuTime()/GetNEventsProcessed());
253  
254    delete fSWtotal;
255    delete fSWevent;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines