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

Comparing UserCode/MitAna/TreeMod/src/Analysis.cc (file contents):
Revision 1.7 by paus, Wed Jun 18 13:23:13 2008 UTC vs.
Revision 1.17 by loizides, Wed Nov 5 17:23:47 2008 UTC

# Line 1 | Line 1
1   // $Id$
2  
3 + #include "MitAna/TreeMod/interface/Analysis.h"
4   #include <Riostream.h>
5   #include <TFile.h>
6   #include <TList.h>
# Line 14 | Line 15
15   #include "MitAna/DataTree/interface/Names.h"
16   #include "MitAna/TAM/interface/TAMVirtualLoader.h"
17   #include "MitAna/TAM/interface/TAModule.h"
18 < #include "MitAna/TAM/interface/TAMSelector.h"
19 < #include "MitAna/TreeMod/interface/Analysis.h"
18 > #include "MitAna/TreeMod/interface/Selector.h"
19 > #include "MitAna/TreeMod/interface/TreeLoader.h"
20 > #include "MitAna/TreeMod/interface/HLTFwkMod.h"
21 > #include "MitAna/Catalog/interface/Dataset.h"
22  
23   ClassImp(mithep::Analysis)
24  
25   using namespace mithep;
26  
27 < //__________________________________________________________________________________________________
27 > //--------------------------------------------------------------------------------------------------
28   Analysis::Analysis(Bool_t useproof) :
29    fUseProof(useproof),
30 <  fHierachy(kTRUE),
30 >  fUseHLT(kTRUE),
31 >  fHierarchy(kTRUE),
32 >  fDoProxy(kTRUE),
33    fState(kPristine),
34    fNFriends(0),
35    fList(new TList),
# Line 36 | Line 41 | Analysis::Analysis(Bool_t useproof) :
41    fChain(0),
42    fSet(0),
43    fDeleteList(new TList),
44 <  fTreeName(Names::gkMitTreeName),
44 >  fTreeName(Names::gkEvtTreeName),
45    fCompLevel(2),
46    fProof(0),
47    fDoNEvents(TChain::kBigNumber)
# Line 51 | Line 56 | Analysis::Analysis(Bool_t useproof) :
56    // nothing to be done since we do not use par files (yet?)
57   }
58  
59 < //__________________________________________________________________________________________________
59 > //--------------------------------------------------------------------------------------------------
60   Analysis::~Analysis()
61   {
62    // Destructor.
# Line 70 | Line 75 | Analysis::~Analysis()
75    delete fProof;
76   }
77  
78 < //__________________________________________________________________________________________________
78 > //--------------------------------------------------------------------------------------------------
79   Bool_t Analysis::AddFile(const char *pname)
80   {
81    // Add file with given name to the list of files to be processed. Using the token "|", you can
# Line 103 | Line 108 | Bool_t Analysis::AddFile(const char *pna
108    return kTRUE;
109   }
110  
111 < //__________________________________________________________________________________________________
111 > //--------------------------------------------------------------------------------------------------
112   void Analysis::AddFile(const char *pname, Int_t eventlist)
113   {
114    // Add file name to the event list specified by eventlist. The lists are used to hold filenames of
# Line 141 | Line 146 | void Analysis::AddFile(const char *pname
146      Info("AddFile", "Added %s to list of files.", pname);
147   }
148  
149 < //__________________________________________________________________________________________________
149 > //--------------------------------------------------------------------------------------------------
150   void Analysis::AddFile(const TObject *oname, Int_t eventlist)
151   {
152    // Add file name to the event list specified by eventlist. The lists are used to hold filenames of
# Line 191 | Line 196 | Bool_t Analysis::AddFiles(const char *pn
196    return kTRUE;
197   }
198  
199 < //__________________________________________________________________________________________________
199 > //--------------------------------------------------------------------------------------------------
200 > Bool_t Analysis::AddDataset(const Dataset *dataset)
201 > {
202 >  // Add a full dataset to the analysis.
203 >
204 >  Bool_t status = true;
205 >
206 >  for (UInt_t i=0; i<dataset->NFiles(); i++)
207 >    status = (status && AddFile(dataset->FileUrl(i)));
208 >
209 >  return status;
210 > }
211 >
212 > //--------------------------------------------------------------------------------------------------
213   void Analysis::AddList(TList *list, Int_t eventlist)
214   {
215    // Add file name to the event list specified by eventlist. The lists are used to hold filenames of
# Line 205 | Line 223 | void Analysis::AddList(TList *list, Int_
223      AddFile(obj->GetName(), eventlist);
224   }
225  
226 < //__________________________________________________________________________________________________
226 > //--------------------------------------------------------------------------------------------------
227   void Analysis::AddLoader(TAMVirtualLoader *l)      
228   {
229    // Add loader to the list of loaders.
# Line 213 | Line 231 | void Analysis::AddLoader(TAMVirtualLoade
231    fLoaders->Add(l);
232   }
233  
234 < //__________________________________________________________________________________________________
234 > //--------------------------------------------------------------------------------------------------
235   void Analysis::AddPackage(const char* name)
236   {
237    // Add package to the list of uploaded packages.
# Line 222 | Line 240 | void Analysis::AddPackage(const char* na
240    fPackages->Add(new TObjString(name));
241   }
242  
243 < //__________________________________________________________________________________________________
243 > //--------------------------------------------------------------------------------------------------
244   void Analysis::AddPackages(TList *list)
245   {
246    // Add list of packages to the list of uploaded packages.
# Line 235 | Line 253 | void Analysis::AddPackages(TList *list)
253    }
254   }
255  
256 < //__________________________________________________________________________________________________
256 > //--------------------------------------------------------------------------------------------------
257   Bool_t Analysis::Init()
258   {
259    // Setup the TDSet and TChain to be used for the analysis with or without PROOF. If more than one
# Line 307 | Line 325 | Bool_t Analysis::Init()
325  
326    }
327  
328 <  // if we had our default TAM plugin we would create it here
329 <  //  TreeLoader *bl = new TreeLoader;
330 <  //  fLoaders->Add(bl);
331 <  //  fDeleteList->Add(bl);
328 >  // create our customized loader plugin for TAM
329 >  TreeLoader *bl = new TreeLoader;
330 >  fLoaders->Add(bl);
331 >  fDeleteList->Add(bl);
332 >
333 >  // create our HLT framework module
334 >  HLTFwkMod *hltmod = 0;
335 >  if (fUseHLT) {
336 >    hltmod = new HLTFwkMod;
337 >    fDeleteList->Add(hltmod);
338 >  }
339  
340    if (fUseProof) {
341  
342 +    if (hltmod)
343 +      fProof->AddInput(hltmod);
344 +
345      fProof->AddInput(fSuperMod);
346      fLoaders->SetName("TAM_LOADERS");
347      fProof->AddInput(fLoaders);      
# Line 321 | Line 349 | Bool_t Analysis::Init()
349    } else {
350  
351      // when not running Proof, we must make a selector
352 <    fSelector = new TAMSelector;
352 >    fSelector = new Selector;
353 >    fSelector->SetDoProxy(fDoProxy);
354 >    if (hltmod)
355 >      fSelector->AddInput(hltmod);
356      fSelector->AddInput(fSuperMod);
357      MDB(kAnalysis, 2)
358        fSelector->SetVerbosity(1);
# Line 336 | Line 367 | Bool_t Analysis::Init()
367    return kTRUE;
368   }
369  
370 < //__________________________________________________________________________________________________
370 > //--------------------------------------------------------------------------------------------------
371   Bool_t Analysis::InitProof()
372   {
373    // Initialize PROOF connection.
# Line 377 | Line 408 | Bool_t Analysis::InitProof()
408    return ret;
409   }
410  
411 < //__________________________________________________________________________________________________
411 > //--------------------------------------------------------------------------------------------------
412   void Analysis::Run()
413   {
414    // Run the analysis on the created file set.
# Line 392 | Line 423 | void Analysis::Run()
423      MDB(kAnalysis, 1)
424        Info("Run", "Start processing with PROOF...");
425  
426 <    fSet->Process("TAMSelector","",fDoNEvents);
426 >    fSet->Process("Selector","",fDoNEvents);
427  
428    } else {
429  
# Line 408 | Line 439 | void Analysis::Run()
439    fState = kRun;
440   }
441  
442 < //__________________________________________________________________________________________________
442 > //--------------------------------------------------------------------------------------------------
443   Bool_t Analysis::Run(Bool_t browse)
444   {
445    // Execute analysis and open TBrowser if requested.
# Line 426 | Line 457 | Bool_t Analysis::Run(Bool_t browse)
457    return kFALSE;
458   }
459  
460 < //__________________________________________________________________________________________________
460 > //--------------------------------------------------------------------------------------------------
461   void Analysis::Terminate()
462   {
463    // Terminate current analysis run.
# Line 465 | Line 496 | void Analysis::Terminate()
496          MDB(kAnalysis, 1)
497            Info("Terminate", "Saving output to %s!", fAnaOutput.Data());
498  
499 <        if (fHierachy)
499 >        if (fHierarchy)
500            fOutput->Write(fOutput->GetName(),TObject::kSingleKey);      
501          else
502            fOutput->Write();
503                
504        }
505      }
506 +    // set state to terminate
507 +    fState = kTerminate;
508    }
509  
510    delete fChain;
511    delete fSet;
512    fDeleteList->Delete();
480
481  fState = kTerminate;
513   }
514  
515 < //__________________________________________________________________________________________________
515 > //--------------------------------------------------------------------------------------------------
516   Bool_t Analysis::UploadPackages(TList *packages)
517   {
518    // Upload list of par files to the server.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines