er  dev
ERGadastDigiPar.cxx
1 #include "ERGadastDigiPar.h"
2 
3 #include "FairParamList.h"
4 #include "FairDetParIo.h"
5 #include "FairParIo.h"
6 #include "FairGenericParAsciiFileIo.h"
7 #include "FairGenericParRootFileIo.h"
8 #include "FairParAsciiFileIo.h"
9 #include "FairParRootFileIo.h"
10 #include<iostream>
11 
12 #include "TString.h"
13 #include "TMath.h"
14 
15 #include <iostream>
16 
17 using std::cout;
18 using std::cerr;
19 using std::endl;
20 
21 // ----- Standard constructor ------------------------------------------
23  const char* title,
24  const char* context)
25  : FairParGenericSet(name, title, context),
26  fCsIMECount(-1),
27  fLaBrMECount(-1),
28  fCsILC(new TArrayF(64)),
29  fLaBrLC(new TArrayF(4)),
30  fCsIDispA(new TArrayF(64)),
31  fLaBrDispA(new TArrayF(4)),
32  fCsIDispB(new TArrayF(64)),
33  fLaBrDispB(new TArrayF(4))
34 {
35 }
36 //-------------------------------------------------------------------------
37 
38 
39 
40 // ----- Destructor ----------------------------------------------------
42 {
43  clear();
44 }
45 // -------------------------------------------------------------------------
46 
47 
48 // ----- Public method clear -------------------------------------------
50 {
51  status = kFALSE;
52  resetInputVersions();
53 }
54 // -------------------------------------------------------------------------
55 
56 // ----- Public method print ---------------------------------------
58 {
59  std::cout << "*****************************************" << std::endl;
60  std::cout << " ERGadastDigiPar " << std::endl;
61  std::cout << "*****************************************" << std::endl;
62  std::cout << " ERGadastCsIMECount: " << fCsIMECount << std::endl;
63  std::cout << " ERGadastLaBrMECount: " << fLaBrMECount << std::endl;
64  std::cout << "*****************************************" << std::endl;
65  std::cout << " ERGadastCsILC: " << std::endl;
66  for (Int_t iElement = 0; iElement < 16; iElement++){
67  std::cout << " ";
68  for (Int_t jElement = 0; jElement < 4; jElement++)
69  std::cout <<(*fCsILC)[iElement*4 + jElement] << "\t";
70  std::cout << std::endl;
71  }
72  std::cout << "*****************************************" << std::endl;
73  std::cout << " ERGadastCsIDispA: " << std::endl;
74  for (Int_t iElement = 0; iElement < 16; iElement++){
75  std::cout << " ";
76  for (Int_t jElement = 0; jElement < 4; jElement++)
77  std::cout <<(*fCsIDispA)[iElement*4 + jElement] << "\t";
78  std::cout << std::endl;
79  }
80  std::cout << "*****************************************" << std::endl;
81  std::cout << " ERGadastCsIDispB: " << std::endl;
82  for (Int_t iElement = 0; iElement < 16; iElement++){
83  std::cout << " ";
84  for (Int_t jElement = 0; jElement < 4; jElement++)
85  std::cout <<(*fCsIDispB)[iElement*4 + jElement] << "\t";
86  std::cout << std::endl;
87  }
88  std::cout << "*****************************************" << std::endl;
89  std::cout << " ERGadastLaBrLC: " << std::endl;
90  for (Int_t iElement = 0; iElement < 4; iElement++){
91  std::cout <<(*fLaBrLC)[iElement] << "\t";
92  }
93  std::cout << std::endl;
94  std::cout << "*****************************************" << std::endl;
95  std::cout << " ERGadastLaBrDispA: " << std::endl;
96  for (Int_t iElement = 0; iElement < 4; iElement++){
97  std::cout <<(*fLaBrDispA)[iElement] << "\t";
98  }
99  std::cout << std::endl;
100  std::cout << "*****************************************" << std::endl;
101  std::cout << " ERGadastLaBrDispB: " << std::endl;
102  for (Int_t iElement = 0; iElement < 4; iElement++){
103  std::cout <<(*fLaBrDispB)[iElement] << "\t";
104  }
105  std::cout << std::endl;
106  std::cout << "*****************************************" << std::endl;
107 }
108 //------------------------------------------------------
109 void ERGadastDigiPar::putParams(FairParamList* l)
110 {
111  cout << " I am in ERGadastDigiPar::putParams " << endl;
112 }
113 //------------------------------------------------------
114 Bool_t ERGadastDigiPar::getParams(FairParamList* l)
115 {
116  if (!l) { return kFALSE; }
117 
118  if ( ! l->fill("ERGadastCsIMECount", &fCsIMECount) ) { return kFALSE; }
119  if ( ! l->fill("ERGadastLaBrMECount", &fLaBrMECount) ) { return kFALSE; }
120 
121  fCsILC->Set(fCsIMECount);
122  if ( ! l->fill("ERGadastCsILC", fCsILC) ) { return kFALSE; }
123 
124  fLaBrLC->Set(fLaBrMECount);
125  if ( ! l->fill("ERGadastLaBrLC", fLaBrLC) ) { return kFALSE; }
126 
127  fCsIDispA->Set(fCsIMECount);
128  if ( ! l->fill("ERGadastCsIDispA", fCsIDispA) ) { return kFALSE; }
129 
130  fLaBrDispA->Set(fLaBrMECount);
131  if ( ! l->fill("ERGadastLaBrDispA", fLaBrDispA) ) { return kFALSE; }
132 
133  fCsIDispB->Set(fCsIMECount);
134  if ( ! l->fill("ERGadastCsIDispB", fCsIDispB) ) { return kFALSE; }
135 
136  fLaBrDispB->Set(fLaBrMECount);
137  if ( ! l->fill("ERGadastLaBrDispB", fLaBrDispB) ) { return kFALSE; }
138 
139  return kTRUE;
140 }
141 //------------------------------------------------------
142 Bool_t ERGadastDigiPar::init(FairParIo* input){
143  std::cout << input->getFilename() << std::endl;
144  if ( TString(input->getFilename()).Contains(".digi")){
145  FairGenericParAsciiFileIo* p=new FairGenericParAsciiFileIo(((FairParAsciiFileIo*)input)->getFile());
146  return p->init(this);
147  }
148  if ( TString(input->getFilename()).Contains(".root")){
149  FairGenericParRootFileIo* p=new FairGenericParRootFileIo(((FairParRootFileIo*)input)->getParRootFile());
150  return p->init(this);
151  }
152  return kFALSE;
153 }
154 //------------------------------------------------------
155 
156 ClassImp(ERGadastDigiPar)
virtual Bool_t init(FairParIo *input)
virtual ~ERGadastDigiPar()
virtual void clear()
ERGadastDigiPar(const char *name="ERGadastDigiPar", const char *title="ERGadast Digitization Parameters", const char *context="Default")
virtual void print()