AMSDST
myChain.h
Go to the documentation of this file.
1 // Authors: M.Duranti - INFN di Perugia
2 #ifndef myChain_h
3 #define myChain_h
4 
5 #include "TChain.h"
6 #include "myEvent.h"
7 
8 class myEvent;
9 
13 class myChain: public TChain {
14  private:
15  class Section{
16  public:
17  std::string name;
18  std::string bname;
19  std::string dirname;
20  Int_t ntrees;
21  bool Active;
22  TChain* t3friend;
23  TChain* t3output;
24  Section();
25  ~Section();
26  bool defdir();
27  };
28 
29  std::vector<Section*> sections;
30 
32  std::vector<TFile*> filesoutput;
33 
34  static myChain* ptr;
36 
38  myChain(const char* name="AMSRootNtuplized", const char* title = "");
39  void init();
40  void AddActiveFriends();
41  public:
43  static myChain* gethead();
44 
46  ~myChain();
47 
67  virtual Int_t Add(const char* name, Long64_t nentries = kBigNumber);
68 
70  Int_t AddFromFile(const char* name);
71 
73  myEvent* GetEvent(Long64_t entry = 0, Int_t getall = 0);
74 
77 
81 
82  Int_t GetThisEntry(Int_t getall = 0) { return GetEntry(fReadEntry, getall); };
83 
87 
88  Int_t GetNextEntry(Int_t getall = 0) { return GetEntry(fReadEntry+1, getall); };
89 
91  virtual Long64_t LoadTree(Long64_t entry);
92 
94  virtual Long64_t Draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = kBigNumber, Long64_t firstentry = 0);
95  virtual Long64_t Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = kBigNumber, Long64_t firstentry = 0); // *MENU*
96  virtual void Draw(Option_t* opt) { Draw(opt, "", "", 1000000000, 0); }
97 
100  void CloneTrees(const char * outpath="./",int single=0);
101 
103  void FillOutput();
105  void CloseOutput();
106 
108  void PrintEverything();
109  void PrintEntries();
110  void PrintMyInfo();
111 
112  void AddSection(const char * Name, const char* DirName=0, bool enable=true);
113  void ListSections();
114  myChain::Section * GetSection(const char * Name);
115  bool HasSection(const char *Name);
116  bool HasSectionActivated(const char *Name);
117  void EnableSection(const char *Name);
118  void DisableSection(const char *Name);
119  void SectionSetDirName(const char *SectionName, const char* DirName);
120  virtual void Clear(Option_t* option = "");
121 
122  static char* ExtractFileNameWithoutExtension(TTree* _InputTree);
123  static void CloneSingleTree( TChain* _InputTree, TFile* ff, TChain*& _OutputTree);
124  static void CloneSingleTree( TTree* _InputTree, TFile* ff, TTree*& _OutputTree);
125 
136  static bool checkCastorFile(TString fn);
137 
159  static int checkWildcardList(TString fn, std::vector<TString>& list, TString treeName="AMSRootNtuplized");
160 
161  private:
164 
165  bool kGetAll;
166 
167  ClassDef(myChain,0);//should be not written on disk!
168 };
169 
170 #endif