EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PndMultiFieldPar.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PndMultiFieldPar.cxx
1 #include "PndMultiFieldPar.h"
2 #include "PndMultiFieldPar.h"
3 #include "PndConstField.h"
4 #include "PndConstPar.h"
5 #include "PndDipoleMap.h"
6 #include "PndSolenoidMap.h"
7 #include "PndDipolePar.h"
8 #include "PndSolenoidPar.h"
9 #include "PndTransPar.h"
10 #include "PndTransMap.h"
11 #include "FairParamList.h"
12 #include "PndMapPar.h"
13 #include "FairRuntimeDb.h"
14 #include "FairRun.h"
15 
16 // ------ Constructor --------------------------------------------------
17 PndMultiFieldPar::PndMultiFieldPar(const char* name, const char* title, const char* context)
18  : PndMapPar(name, title, context), fParArray()
19 {
20 
21  fParArray=new TObjArray();
22 }
23 
25  : PndMapPar(), fParArray()
26 {
27 }
28 
30 
32 {
33  if ( ! list ) return;
34  list->addObject("List of Field par", fParArray);
35  list->add("Field Type", fType);
36 }
37 
38 
39 
41 {
42  if (!l->fillObject("list of fields Par",fParArray))return kFALSE;
43  if ( ! l->fill("Field Type", &fType) ) return kFALSE;
44 
45  return kTRUE;
46 }
47 void PndMultiFieldPar:: SetParameters(FairField* field)
48 {
49  fType=5;
51  FairRun *fRun= FairRun::Instance();
52  PndMultiField *fmField = (PndMultiField *)field;
53  TObjArray *fArray=fmField->GetFieldList();
54  TIterator *Iter=fArray->MakeIterator();
55  Iter->Reset();
56  FairField* fField = NULL;
57  Int_t Type=-1;
58  while( (fField = (FairField*)Iter->Next() ) ) {
59  Type=fField->GetType();
60  if(Type==0){
61  PndConstField *fc= (PndConstField *)fField;
62  PndConstPar *cp = (PndConstPar*) rtdb->getContainer("PndConstPar");
63  cp->SetParameters(fc);
64  cp->setInputVersion(fRun->GetRunId(),1);
65  fParArray->AddLast(cp);
66  }
67  if(Type==1){
68 
69  }
70  if(Type==2){
71  PndSolenoidMap *fs= (PndSolenoidMap *)fField;
73  PndSolenoidPar* cs = (PndSolenoidPar*) rtdb->getContainer("PndSolenoidPar");
74  cs->SetParameters(fs);
75  cs->setInputVersion(fRun->GetRunId(),1);
76  fParArray->AddLast(cs);
77  }else{
78  TString contN1="PndSolenoid";
79  TString contN3="Par";
80  char NO[1];
81  sprintf(NO,"%d",fs->GetRegionNo());
82  TString contN2=contN1+NO;
83  TString contName=contN2+contN3;
84  // cout << "------"<< "PndMultiFieldPar:: SetParameters(FairField* field) " << contName << endl;
85  PndMapPar* cs = (PndMapPar*) rtdb->getContainer(contName.Data());
86  cs->SetParameters(fs);
87  cs->setInputVersion(fRun->GetRunId(),1);
88  fParArray->AddLast(cs);
89  }
90  }
91  if(Type==3){
92  PndDipoleMap *fd= (PndDipoleMap *)fField;
94  PndDipolePar* cs = (PndDipolePar*) rtdb->getContainer("PndDipolePar");
95  cs->SetParameters(fd);
96  cs->setInputVersion(fRun->GetRunId(),1);
97  fParArray->AddLast(cs);
98  }else{
99  TString contN1="PndDipole";
100  TString contN3="Par";
101  char NO[1];
102  sprintf(NO,"%d",fd->GetRegionNo());
103  TString contN2=contN1+NO;
104  TString contName=contN2+contN3;
105  PndMapPar* cs = (PndMapPar*) rtdb->getContainer(contName.Data());
106  cs->SetParameters(fd);
107  cs->setInputVersion(fRun->GetRunId(),1);
108  fParArray->AddLast(cs);
109  }
110  }
111  if(Type==4){
112  PndTransMap *ft= (PndTransMap *)fField;
113  PndTransPar* ct = (PndTransPar*) rtdb->getContainer("PndTransPar");
114  ct->SetParameters(ft);
115  ct->setInputVersion(fRun->GetRunId(),1);
116  fParArray->AddLast(ct);
117  }
118  }
119  delete Iter;
120 }
121 
122 
124