FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairFileHeader.cxx
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 // ----- FairFileHeader source file -----
10 // ----- Created 20/04/11 M.Al-Turany -----
11 // -------------------------------------------------------------------------
12 
13 #include "FairFileHeader.h"
14 
15 #include "FairFileInfo.h" // for FairFileInfo
16 
17 #include <TIterator.h> // for TIterator
18 #include <TList.h> // for TList
19 #include <TObjString.h> // for TObjString
20 #include <TObject.h> // for TObject
21 class TFile;
22 
24  : TNamed()
25  , fRunId(0)
26  , fTaskList(new TList())
27  , fFileList(new TList())
28 {}
29 
30 void FairFileHeader::AddTaskClassName(TString taskname) { fTaskList->AddLast(new TObjString(taskname)); }
31 
32 void FairFileHeader::AddInputFile(TFile* f, UInt_t id, UInt_t ChId)
33 {
34  fFileList->AddLast(new FairFileInfo(f, id, ChId));
35 }
36 
37 FairFileInfo* FairFileHeader::GetFileInfo(UInt_t id, UInt_t ChId)
38 {
39  TIterator* Iter = fFileList->MakeIterator();
40  Iter->Reset();
41  TObject* obj = 0;
42  FairFileInfo* info = 0;
43  while ((obj = Iter->Next())) {
44  info = dynamic_cast<FairFileInfo*>(obj);
45  if (info && info->GetIdentifier() == id && info->GetOrderInChain() == ChId) {
46  return info;
47  }
48  }
49  delete Iter;
50  return 0;
51 }
52 
54 
void AddTaskClassName(TString taskname)
ClassImp(FairEventBuilder)
UInt_t GetIdentifier()
Definition: FairFileInfo.h:29
void AddInputFile(TFile *f, UInt_t id, UInt_t ChId)
FairFileInfo * GetFileInfo(UInt_t id, UInt_t ChId)
virtual ~FairFileHeader()
UInt_t GetOrderInChain()
Definition: FairFileInfo.h:30