1 |
loizides |
1.6 |
// $Id: Analysis.h,v 1.5 2008/06/11 14:52:43 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#ifndef DATAUTIL_ANALYSIS_H
|
4 |
|
|
#define DATAUTIL_ANALYSIS_H
|
5 |
|
|
|
6 |
loizides |
1.2 |
#include <TObject.h>
|
7 |
|
|
#include <TString.h>
|
8 |
|
|
|
9 |
|
|
class TList;
|
10 |
|
|
class TChain;
|
11 |
|
|
class TDSet;
|
12 |
|
|
class TString;
|
13 |
|
|
class TAModule;
|
14 |
|
|
class TAMSelector;
|
15 |
|
|
class TAMVirtualLoader;
|
16 |
|
|
class TObjArray;
|
17 |
|
|
class TProof;
|
18 |
|
|
|
19 |
|
|
//--------------------------------------------------------------------------------------------------
|
20 |
loizides |
1.1 |
//
|
21 |
|
|
// Analysis
|
22 |
|
|
//
|
23 |
|
|
// This is the top-level analysis class used to hide the (little)
|
24 |
|
|
// differences between TAM standalone and TAM with PROOF.
|
25 |
|
|
// In addition it provides an almost transparent interface
|
26 |
|
|
// in the case you want to do mixing of different events.
|
27 |
|
|
//
|
28 |
loizides |
1.3 |
// The class can operate in following modes:
|
29 |
|
|
// a) Add single files to be analyzed using Analysis::AddFile
|
30 |
loizides |
1.5 |
// b) Use a text file to point to files to be analyzed using Analysis::AddFiles
|
31 |
loizides |
1.3 |
// c) Add files using a catalogue (to be done)
|
32 |
loizides |
1.1 |
//
|
33 |
loizides |
1.3 |
// See $CMSSW_BASE/src/MitAna/macros/examples/runSimpleExample.C
|
34 |
|
|
// for an example of how to use this class.
|
35 |
loizides |
1.1 |
//
|
36 |
loizides |
1.3 |
// Authors: C.Loizides
|
37 |
loizides |
1.1 |
//
|
38 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
39 |
loizides |
1.1 |
|
40 |
|
|
namespace mithep
|
41 |
|
|
{
|
42 |
|
|
class Analysis : public TObject
|
43 |
|
|
{
|
44 |
|
|
public:
|
45 |
loizides |
1.4 |
Analysis(Bool_t useproof=kFALSE);
|
46 |
loizides |
1.1 |
~Analysis();
|
47 |
|
|
|
48 |
|
|
void AddLoader(TAMVirtualLoader *l);
|
49 |
|
|
Bool_t AddFile(const char *pname);
|
50 |
loizides |
1.5 |
Bool_t AddFiles(const char *pname, Int_t nmax=-1);
|
51 |
loizides |
1.1 |
void AddPackage(const char* name);
|
52 |
|
|
void AddPackages(TList *list);
|
53 |
|
|
const char *GetAnaOutputName() const { return fAnaOutput;}
|
54 |
|
|
const TList *GetOutput() const { return fOutput; }
|
55 |
|
|
Bool_t GetUseProof() const { return fUseProof; }
|
56 |
|
|
Bool_t Init();
|
57 |
|
|
Bool_t IsInit() const { return fState==kInit; }
|
58 |
|
|
Bool_t IsRun() const { return fState==kRun; }
|
59 |
|
|
Bool_t IsTerminated() const { return fState==kTerminate; }
|
60 |
|
|
void Run();
|
61 |
loizides |
1.4 |
Bool_t Run(Bool_t browse);
|
62 |
loizides |
1.6 |
void SetProcessNevents(Long64_t n) { fDoNEvents = n; }
|
63 |
loizides |
1.1 |
void SetCompressionLevel(Int_t level) { fCompLevel = level; }
|
64 |
|
|
void SetConfigName(const char* name) { fConfig = name; }
|
65 |
|
|
void SetKeepHierachy(Bool_t b) { fHierachy = b; }
|
66 |
|
|
void SetMasterName(const char* name) { fMaster = name; }
|
67 |
loizides |
1.5 |
void SetOutputName(const char *name) { fAnaOutput = name; }
|
68 |
loizides |
1.1 |
void SetSuperModule(TAModule *mod) { fSuperMod = mod; }
|
69 |
|
|
void SetTreeName(const char *name) { fTreeName = name; }
|
70 |
|
|
void SetUseProof(Bool_t up) { fUseProof = up; }
|
71 |
|
|
void Terminate();
|
72 |
|
|
|
73 |
|
|
protected:
|
74 |
|
|
enum EState { kPristine, //after constructor
|
75 |
|
|
kInit, //after init
|
76 |
|
|
kRun, //after run
|
77 |
|
|
kTerminate //after terminate
|
78 |
|
|
};
|
79 |
|
|
|
80 |
loizides |
1.3 |
Bool_t fUseProof; //=true if PROOF is to be used (def=0)
|
81 |
|
|
Bool_t fHierachy; //=true if module hierachy to be stored (def=1)
|
82 |
loizides |
1.1 |
EState fState; //status of analysis
|
83 |
|
|
Int_t fNFriends; //number of friend trees
|
84 |
|
|
TList *fList; //list of lists of path names
|
85 |
|
|
TList *fOutput; //output as obtained from TAM (not owned)
|
86 |
|
|
TList *fPackages; //list of package names for PROOF upload
|
87 |
|
|
TList *fLoaders; //list of loaders
|
88 |
|
|
TAModule *fSuperMod; //top level TAM module (not owned)
|
89 |
|
|
TAMSelector *fSelector; //selector for non-PROOF usage
|
90 |
|
|
TChain *fChain; //trees or friend trees for non-PROOF usage
|
91 |
|
|
TDSet *fSet; //set of trees or friend trees for PROOF usage
|
92 |
|
|
TList *fDeleteList; //list of objects to be deleted on Terminate()
|
93 |
|
|
TString fTreeName; //name of trees or friend trees
|
94 |
|
|
TString fAnaOutput; //path name of output file
|
95 |
|
|
TString fMaster; //hostname of PROOF master
|
96 |
|
|
TString fConfig; //config file name for PROOF
|
97 |
loizides |
1.3 |
Int_t fCompLevel; //compression level for output file (def=2)
|
98 |
loizides |
1.1 |
TProof *fProof; //pointer to the PROOF session
|
99 |
loizides |
1.6 |
Long64_t fDoNEvents; //number of events to process (def=TChain::kBigNumber)
|
100 |
loizides |
1.1 |
|
101 |
|
|
void AddFile(const char *pname, Int_t eventlist);
|
102 |
|
|
void AddFile(const TObject *oname, Int_t eventlist);
|
103 |
|
|
void AddList(TList *list, Int_t eventlist);
|
104 |
|
|
Bool_t IsValidName(const char */*name*/) { return kTRUE; }
|
105 |
|
|
Bool_t InitProof();
|
106 |
|
|
Bool_t UploadPackages(TList *packages);
|
107 |
|
|
|
108 |
|
|
ClassDef(Analysis,0) // Top-level analysis class
|
109 |
|
|
};
|
110 |
loizides |
1.5 |
}
|
111 |
|
|
#endif
|