EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairParIo.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairParIo.cxx
1 //*-- AUTHOR : Ilse Koenig
2 //*-- Created : 20/10/2004
3 
5 // FairParIo
6 //
7 // Base class for different parameter input/output sources:
8 // Rootfiles, Asciifiles, Oracle
9 // It contains a list of detector I/Os.
11 
12 #include "FairParIo.h"
13 
14 #include "FairDetParIo.h"
15 
17 
19  :TObject(),
20  detParIoList(new TList()),
21  autoWritable(kTRUE),
22  filename("")
23 {
24  //default constructor creates an empty list of detector I/Os
25  // detParIoList=new TList();
26  // autoWritable=kTRUE;
27 }
28 
30 {
31  // default destructor
32  if(detParIoList) {
33  detParIoList->Delete();
34  delete detParIoList;
35  detParIoList=0;
36  }
37 }
38 
40 {
41  // stores pointer of the input/output class for a detector
42  // used for I/O from ROOT file or Ascii file
43  Text_t* detName=(char*)detParIo->GetName();
44  if (!detParIoList->FindObject(detName)) { detParIoList->Add(detParIo); }
45 }
46 
48 {
49  // sets in all detector I/Os the number of the input
50  TIter next(detParIoList);
51  FairDetParIo* io;
52  while ((io=(FairDetParIo*)next())) {
53  io->setInputNumber(num);
54  }
55 }
56 
57 FairDetParIo* FairParIo::getDetParIo(const Text_t* detName)
58 {
59  // returns pointer to input/output class for a detector
60  return ((FairDetParIo*)detParIoList->FindObject(detName));
61 }
62 
63 void FairParIo::removeDetParIo(Text_t* detName)
64 {
65  // removes input/output class for a detector
66  TObject* p=detParIoList->FindObject(detName);
67  if (p) {
68  delete p;
69  p=0;
70  }
71 }