1 |
//--------------------------------------------------------------------------------------------------
|
2 |
// $Id: Analysis.h,v 1.27 2009/07/13 20:05:31 loizides Exp $
|
3 |
//
|
4 |
// Analysis
|
5 |
//
|
6 |
// This is the top-level analysis class used to hide the (little) differences between TAM standalone
|
7 |
// and TAM with PROOF. In addition it provides an almost transparent interface in the case you want
|
8 |
// to do mixing of different events.
|
9 |
//
|
10 |
// The class can operate in following modes:
|
11 |
// a) Add single files to be analyzed using Analysis::AddFile
|
12 |
// b) Use a text file to point to files to be analyzed using Analysis::AddFiles
|
13 |
// c) Add files using a catalog using Analysis::AddDataset
|
14 |
// d) Use of environment variables (only will be attempted if none of a-c is provided)
|
15 |
// MIT_CATALOG (eg. export MIT_CATALOG=/home/mitprod/catalog)
|
16 |
// MIT_BOOK (eg. export MIT_BOOK=mit/filler/006)
|
17 |
// MIT_DATASET (eg. export MIT_DATASET=s8-ttbar-id9)
|
18 |
// MIT_FILESETS (eg. export MIT_FILESETS=0000;0001;0002)
|
19 |
// or
|
20 |
// MIT_FILES (eg. export MIT_FILES=file1;file2;file3)
|
21 |
//
|
22 |
// See $CMSSW_BASE/src/MitAna/macros/examples/runSimpleExample.C
|
23 |
// for an example of how to use this class.
|
24 |
//
|
25 |
// Authors: C.Loizides
|
26 |
//--------------------------------------------------------------------------------------------------
|
27 |
|
28 |
#ifndef MITANA_DATAUTIL_ANALYSIS_H
|
29 |
#define MITANA_DATAUTIL_ANALYSIS_H
|
30 |
|
31 |
#include <TObject.h>
|
32 |
#include <TString.h>
|
33 |
|
34 |
class TList;
|
35 |
class TChain;
|
36 |
class TDSet;
|
37 |
class TString;
|
38 |
class TAModule;
|
39 |
class TAMSelector;
|
40 |
class TAMVirtualLoader;
|
41 |
class TObjArray;
|
42 |
class TProof;
|
43 |
|
44 |
namespace mithep
|
45 |
{
|
46 |
class Dataset;
|
47 |
class Analysis : public TObject
|
48 |
{
|
49 |
public:
|
50 |
Analysis(Bool_t useproof=kFALSE);
|
51 |
~Analysis();
|
52 |
|
53 |
Bool_t AddDataset(const Dataset *dataset);
|
54 |
Bool_t AddFile(const char *pname);
|
55 |
Bool_t AddFiles(const char *pname, Int_t nmax=-1);
|
56 |
void AddLoader(TAMVirtualLoader *l);
|
57 |
void AddPackage(const char *name);
|
58 |
void AddPackages(TList *list);
|
59 |
void AddSuperModule(TAModule *mod);
|
60 |
const char *GetAllEvtTreeName() const { return fAllEvtTreeName; }
|
61 |
const char *GetAllEvtHdrBrn() const { return fAllEvtHdrBrn; }
|
62 |
const char *GetAnaOutputName() const { return fAnaOutput; }
|
63 |
const char *GetEvtHdrName() const { return fEvtHdrName; }
|
64 |
const char *GetHLTObjsName() const { return fHLTObjsName; }
|
65 |
const char *GetHLTTreeName() const { return fHLTTreeName; }
|
66 |
const char *GetLATreeName() const { return fLATreeName; }
|
67 |
const char *GetLAHdrName() const { return fLAHdrName; }
|
68 |
const char *GetRunTreeName() const { return fRunTreeName; }
|
69 |
const char *GetRunInfoName() const { return fRunInfoName; }
|
70 |
const TList *GetOutput() const { return fOutput; }
|
71 |
Bool_t GetUseProof() const { return fUseProof; }
|
72 |
Bool_t Init();
|
73 |
Bool_t IsInit() const { return fState==kInit; }
|
74 |
Bool_t IsRun() const { return fState==kRun; }
|
75 |
Bool_t IsTerminated() const { return fState==kTerminate; }
|
76 |
void Run();
|
77 |
Bool_t Run(Bool_t browse);
|
78 |
void SetAllEvtHdrBrn(const char *n) { fAllEvtHdrBrn = n; }
|
79 |
void SetAllEvtTreeName(const char *n) { fAllEvtTreeName = n; }
|
80 |
void SetCacheSize(Int_t cache) { fCacheSize = cache; }
|
81 |
void SetCompressionLevel(Int_t level) { fCompLevel = level; }
|
82 |
void SetConfigName(const char* name) { fConfig = name; }
|
83 |
void SetDoObjTabClean(Bool_t b) { fDoObjTabClean = b; }
|
84 |
void SetDoParallel(Bool_t b) { fParallel = b; }
|
85 |
void SetDoProxy(Bool_t b) { fDoProxy = b; }
|
86 |
void SetEvtHdrName(const char *n) { fEvtHdrName = n; }
|
87 |
void SetHLTObjsName(const char *n) { fHLTObjsName = n; }
|
88 |
void SetHLTTreeName(const char *n) { fHLTTreeName = n; }
|
89 |
void SetKeepHierarchy(Bool_t b) { fHierarchy = b; }
|
90 |
void SetLAHdrName(const char *n) { fLAHdrName = n; }
|
91 |
void SetLATreeName(const char *n) { fLATreeName = n; }
|
92 |
void SetMasterName(const char* name) { fMaster = name; }
|
93 |
void SetOutputName(const char *name) { fAnaOutput = name; }
|
94 |
void SetPrintScale(UInt_t n) { fPrintScale = n; }
|
95 |
void SetProcessNEvents(Long64_t n) { fDoNEvents = n; }
|
96 |
void SetRunInfoName(const char *n) { fRunInfoName = n; }
|
97 |
void SetRunTreeName(const char *n) { fRunTreeName = n; }
|
98 |
void SetSkipFirstNEvents(Long64_t n) { fSkipNEvents = n; }
|
99 |
void SetSuperModule(TAModule *mod);
|
100 |
void SetTreeName(const char *name) { fTreeName = name; }
|
101 |
void SetUseHLT(Bool_t hlt) { fUseHLT = hlt; }
|
102 |
void SetUseProof(Bool_t up) { fUseProof = up; }
|
103 |
void Terminate();
|
104 |
|
105 |
protected:
|
106 |
void AddFile(const char *pname, Int_t eventlist);
|
107 |
void AddFile(const TObject *oname, Int_t eventlist);
|
108 |
void AddList(TList *list, Int_t eventlist);
|
109 |
void FileInputFromEnv();
|
110 |
Bool_t IsValidName(const char */*name*/) { return kTRUE; }
|
111 |
Bool_t InitProof();
|
112 |
Bool_t UploadPackages(TList *packages);
|
113 |
|
114 |
enum EState {
|
115 |
kPristine, //after constructor
|
116 |
kInit, //after init
|
117 |
kRun, //after run
|
118 |
kTerminate //after terminate
|
119 |
};
|
120 |
|
121 |
Bool_t fUseProof; //=true if PROOF is to be used (def=0)
|
122 |
Bool_t fUseHLT; //=true if HLT module is to be used (def=1)
|
123 |
Bool_t fHierarchy; //=true if module hierachy to be stored (def=1)
|
124 |
Bool_t fDoProxy; //=true if TRef branch autoload is used (def=0)
|
125 |
Bool_t fDoObjTabClean; //=true if object table cleaning is used (def=1)
|
126 |
Bool_t fParallel; //=true if parellel tree unzipping is used (def=0)
|
127 |
EState fState; //status of analysis
|
128 |
Int_t fNFriends; //number of friend trees
|
129 |
TList *fList; //list of lists of path names
|
130 |
TList *fOutput; //output as obtained from TAM (not owned)
|
131 |
TList *fPackages; //list of package names for PROOF upload
|
132 |
TList *fLoaders; //list of loaders
|
133 |
TList *fSuperMods; //top level TAM module(s) (not owned)
|
134 |
TAMSelector *fSelector; //selector for non-PROOF usage
|
135 |
TChain *fChain; //trees or friend trees for non-PROOF usage
|
136 |
TDSet *fSet; //set of trees or friend trees for PROOF usage
|
137 |
TList *fDeleteList; //list of objects to be deleted on Terminate()
|
138 |
TString fAnaOutput; //path name of output file
|
139 |
TString fMaster; //hostname of PROOF master
|
140 |
TString fConfig; //config file name for PROOF
|
141 |
Int_t fCompLevel; //compression level for output file (def=7)
|
142 |
TProof *fProof; //pointer to the PROOF session
|
143 |
Long64_t fDoNEvents; //events to process (def=TChain::kBigNumber)
|
144 |
Long64_t fSkipNEvents; //number of events to skip from beginning (def=0)
|
145 |
UInt_t fPrintScale; //scale for evt number/timings printouts (def=100)
|
146 |
Int_t fCacheSize; //size of read cache for events tree
|
147 |
TString fTreeName; //name of trees or friend trees
|
148 |
TString fEvtHdrName; //name of event header branch
|
149 |
TString fRunTreeName; //name of run info tree
|
150 |
TString fRunInfoName; //name of run info branch
|
151 |
TString fAllEvtHdrBrn; //name of all-event header branch
|
152 |
TString fLATreeName; //name of look-ahead tree
|
153 |
TString fLAHdrName; //name of look-ahead event header branch
|
154 |
TString fHLTTreeName; //name of HLT tree
|
155 |
TString fAllEvtTreeName; //name of all-event tree
|
156 |
TString fHLTObjsName; //trigger objects branch name
|
157 |
|
158 |
ClassDef(Analysis, 0) // Top-level analysis class
|
159 |
};
|
160 |
}
|
161 |
#endif
|