FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMixedSource.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 //
9 // FairMixedSource.h
10 // FAIRROOT
11 //
12 // Created by Mohammad Al-Turany on 08/02/14.
13 //
14 //
15 
16 #ifndef __FAIRROOT__FairMixedSource__
17 #define __FAIRROOT__FairMixedSource__
18 
19 #include "FairSource.h"
20 
21 #include <TArrayI.h>
22 #include <TChain.h>
23 #include <TF1.h>
24 #include <TFile.h>
25 #include <list>
26 #include <map>
27 
28 class FairEventHeader;
29 class FairFileHeader;
30 class FairMCEventHeader;
31 class TString;
32 class FairRuntimeDb;
33 class TFolder;
34 class TObject;
35 
36 class FairRootManager;
37 
39 {
40  public:
41  FairMixedSource(TFile* f, const char* Title = "InputRootFile", UInt_t identifier = 0);
42  FairMixedSource(const TString* RootFileName, const char* Title = "InputRootFile", UInt_t identifier = 0);
43  FairMixedSource(const TString RootFileName,
44  const Int_t signalId,
45  const char* Title = "InputRootFile",
46  UInt_t identifier = 0);
47  // FairMixedSource(const FairMixedSource& file);
48  virtual ~FairMixedSource();
49 
50  Bool_t Init();
51  Int_t ReadEvent(UInt_t i = 0);
52  void Close();
53  void Reset();
54 
55  virtual Source_Type GetSourceType() { return kFILE; }
56 
57  virtual void SetParUnpackers() {}
58 
59  virtual Bool_t InitUnpackers() { return kTRUE; }
60 
61  virtual Bool_t ReInitUnpackers() { return kTRUE; }
62 
64  virtual Int_t CheckMaxEventNo(Int_t EvtEnd = 0);
66  void ReadBranchEvent(const char* BrName);
68  void ReadBranchEvent(const char* BrName, Int_t Entry);
69 
71 
72  const TFile* GetRootFile() { return fRootFile; }
75  virtual Bool_t ActivateObject(TObject** obj, const char* BrName);
76 
77  virtual Bool_t ActivateObjectAny(void**, const std::type_info&, const char*);
78 
79  void ReadBKEvent(UInt_t i = 0);
80 
85  void SetSignalFile(TString name, UInt_t identifier);
87  void SetBackgroundFile(TString name);
92  void AddSignalFile(TString name, UInt_t identifier);
93  void AddBackgroundFile(TString name);
94 
95  TChain* GetBGChain() { return fBackgroundChain; }
96  TChain* GetSignalChainNo(UInt_t i);
97 
98  Bool_t OpenBackgroundChain();
99  Bool_t OpenSignalChain();
100 
105  void BGWindowWidthNo(UInt_t background, UInt_t Signalid);
110  void BGWindowWidthTime(Double_t background, UInt_t Signalid);
111 
113  void SetEventTimeInterval(Double_t min, Double_t max);
115  void SetEventMeanTime(Double_t mean);
118  void SetBeamTime(Double_t beamTime, Double_t gapTime);
119  void SetEventTime();
120  Double_t GetDeltaEventTime();
121  void SetFileHeader(FairFileHeader* f) { fFileHeader = f; }
122  Double_t GetEventTime();
123 
125  Bool_t CompareBranchList(TFile* fileHandle, TString inputLevel);
127  TObjArray* GetListOfFolders() { return fListFolder; }
128  TFolder* GetBranchDescriptionFolder() { return fCbmroot; }
129  UInt_t GetEntries() { return fNoOfEntries; }
130 
135  void SetEvtHeaderNew(Bool_t Status) { fEvtHeaderIsNew = Status; }
136  Bool_t IsEvtHeaderNew() { return fEvtHeaderIsNew; }
137 
139  void UseRunIdFromBG();
143  void UseRunIdfromSG(UInt_t identifier = 1);
144 
145  private:
147  FairRootManager* fRootManager;
148 
150  TString fInputTitle;
152  TFile* fRootFile;
154  std::list<TString> fFriendFileList;
155  std::list<TString> fInputChainList;
156  std::map<TString, TChain*> fFriendTypeList;
157  std::map<TString, std::list<TString>*> fCheckInputBranches;
158  std::list<TString> fInputLevel;
159  std::map<TString, std::multimap<TString, TArrayI>> fRunIdInfoAll;
160 
161  TObjArray* fListFolder;
162 
163  FairRuntimeDb* fRtdb;
165  TFolder* fCbmout;
167  TFolder* fCbmroot;
168  /***/
169  UInt_t fSourceIdentifier;
171  UInt_t fNoOfEntries;
173  Bool_t IsInitialized;
174 
176  FairMCEventHeader* fMCHeader;
177 
179  FairEventHeader* fEvtHeader;
180 
182  FairEventHeader* fOutHeader;
183 
185  FairFileHeader* fFileHeader;
186 
188  Bool_t fEventTimeInMCHeader;
189 
193  Bool_t fEvtHeaderIsNew;
194 
196  UInt_t fCurrentEntryNo;
197 
198  UInt_t fTimeforEntryNo;
199  /* /\**No of entries in BG Chain*\/ */
200  UInt_t fNoOfBGEntries;
201  /* /\**Hold the current entry for each input chain*\/ */
202  std::map<UInt_t, UInt_t> fCurrentEntry;
203 
205  Double_t fEventTimeMin;
206 
207  Double_t fEventTimeMax;
208 
209  Double_t fEventTime;
210 
211  Double_t fBeamTime;
212 
213  Double_t fGapTime;
214 
215  Double_t fEventMeanTime;
216 
217  TF1* fTimeProb;
218 
220  std::map<UInt_t, Double_t> fSignalBGN;
221  /* /\**True for background window in entry units*\/ */
222  Bool_t fSBRatiobyN;
223  /* /\**True for background window in time units (ns) *\/ */
224  Bool_t fSBRatiobyT;
225 
227  UInt_t fActualSignalIdentifier;
228 
229  UInt_t fNoOfSignals;
230 
231  std::list<TString>* fSignalChainList;
232 
233  TChain* fBackgroundChain;
234  std::map<UInt_t, TChain*> fSignalTypeList;
235 
237  Bool_t fRunIdFromBG;
238 
239  Bool_t fRunIdFromSG;
240 
243  UInt_t fRunIdFromSG_identifier;
244 
246  Bool_t SpecifyRunId();
247 
249  FairMixedSource& operator=(const FairMixedSource&);
250 
251  public:
253 };
254 
255 #endif /* defined(__FAIRROOT__FairMixedSource__) */
void FillEventHeader(FairEventHeader *feh)
list of container factories
Definition: FairRuntimeDb.h:24
Bool_t OpenBackgroundChain()
FairMixedSource(TFile *f, const char *Title="InputRootFile", UInt_t identifier=0)
TFolder * GetBranchDescriptionFolder()
void ReadBKEvent(UInt_t i=0)
virtual Bool_t ActivateObjectAny(void **, const std::type_info &, const char *)
void SetEvtHeaderNew(Bool_t Status)
void UseRunIdfromSG(UInt_t identifier=1)
void AddBackgroundFile(TString name)
virtual Source_Type GetSourceType()
virtual Int_t CheckMaxEventNo(Int_t EvtEnd=0)
virtual Bool_t InitUnpackers()
virtual void SetParUnpackers()
const TFile * GetRootFile()
void SetFileHeader(FairFileHeader *f)
virtual Bool_t ReInitUnpackers()
Bool_t IsEvtHeaderNew()
Double_t GetEventTime()
void SetEventTimeInterval(Double_t min, Double_t max)
virtual ~FairMixedSource()
TChain * GetSignalChainNo(UInt_t i)
Source_Type
Definition: FairSource.h:26
virtual Bool_t ActivateObject(TObject **obj, const char *BrName)
void ReadBranchEvent(const char *BrName)
ClassDef(FairMixedSource, 0)
void AddSignalFile(TString name, UInt_t identifier)
void SetBackgroundFile(TString name)
TObjArray * GetListOfFolders()
void BGWindowWidthNo(UInt_t background, UInt_t Signalid)
void SetSignalFile(TString name, UInt_t identifier)
TChain * GetBGChain()
void BGWindowWidthTime(Double_t background, UInt_t Signalid)
void SetBeamTime(Double_t beamTime, Double_t gapTime)
void SetEventMeanTime(Double_t mean)
Double_t GetDeltaEventTime()
Int_t ReadEvent(UInt_t i=0)
Bool_t CompareBranchList(TFile *fileHandle, TString inputLevel)