FairRoot/PandaRoot
PndMapPar.cxx
Go to the documentation of this file.
1 #include <iostream>
2 #include "PndFieldMap.h"
3 #include "PndMapPar.h"
4 #include "FairParamList.h"
5 
6 
7 using namespace std;
8 
9 // ------ Constructor --------------------------------------------------
10 PndMapPar::PndMapPar(const char* name, const char* title,
11  const char* context)
12  : FairParGenericSet(name, title, context),
13  fType(-1),
14  fXmin(0),
15  fXmax(0),
16  fYmin(0),
17  fYmax(0),
18  fZmin(0),
19  fZmax(0),
20  fMapName(TString("")),
21  fPosX(0),
22  fPosY(0),
23  fPosZ(0),
24  fScale(0)
25 {
26 }
27 // -------------------------------------------------------------------------
28 
30  :fType(-1),
31  fXmin(0),
32  fXmax(0),
33  fYmin(0),
34  fYmax(0),
35  fZmin(0),
36  fZmax(0),
37  fMapName(TString("")),
38  fPosX(0),
39  fPosY(0),
40  fPosZ(0),
41  fScale(0)
42 {
43 
44 }
45 // -------------------------------------------------------------------------
46 
47 // ------ Destructor ---------------------------------------------------
49 // -------------------------------------------------------------------------
50 
51 
52 
53 // ------ Put parameters -----------------------------------------------
54 void PndMapPar::putParams(FairParamList* list) {
55 
56  if ( ! list ) return;
57 
58  list->add("Field Type", fType);
59  list->add("Field map name", fMapName);
60  list->add("Field x position", fPosX);
61  list->add("Field y position", fPosY);
62  list->add("Field z position", fPosZ);
63  list->add("Field scaling factor", fScale);
64 }
65 // -------------------------------------------------------------------------
66 
67 
68 
69 // -------- Get parameters ---------------------------------------------
70 Bool_t PndMapPar::getParams(FairParamList* list) {
71 
72  if ( ! list ) return kFALSE;
73 
74  if ( ! list->fill("Field Type", &fType) ) return kFALSE;
75 
76  Text_t mapName[80];
77  if ( ! list->fill("Field map name", mapName, 80) ) return kFALSE;
78  fMapName = mapName;
79  if ( ! list->fill("Field x position", &fPosX) ) return kFALSE;
80  if ( ! list->fill("Field y position", &fPosY) ) return kFALSE;
81  if ( ! list->fill("Field z position", &fPosZ) ) return kFALSE;
82  if ( ! list->fill("Field scaling factor", &fScale) ) return kFALSE;
83  return kTRUE;
84 
85 }
86 // -------------------------------------------------------------------------
87 
88 
89 
90 // --------- Set parameters from FairField ------------------------------
91 void PndMapPar::SetParameters(FairField* field) {
92 
93  if ( ! field ) {
94  cerr << "-W- PndMapPar::SetParameters: Empty field pointer!" << endl;
95  return;
96  }
97 
98  PndFieldMap* fieldMap = (PndFieldMap*) field;
99 
100  fMapName = field->GetName();
101  fPosX = fieldMap->GetPositionX();
102  fPosY = fieldMap->GetPositionY();
103  fPosZ = fieldMap->GetPositionZ();
104  fScale = fieldMap->GetScale();
105  fType = fieldMap->GetType();
106 }
107 // -------------------------------------------------------------------------
108 
109 
111 
Double_t fPosZ
Definition: PndMapPar.h:88
Double_t fScale
Definition: PndMapPar.h:92
Double_t GetPositionY() const
Definition: PndFieldMap.h:105
Double_t GetScale() const
Definition: PndFieldMap.h:110
TString fMapName
Definition: PndMapPar.h:84
Double_t GetPositionX() const
Definition: PndFieldMap.h:104
Double_t fPosY
Definition: PndMapPar.h:88
TString name
ClassImp(PndAnaContFact)
Int_t fType
Definition: PndMapPar.h:73
virtual void putParams(FairParamList *list)
Definition: PndMapPar.cxx:54
virtual Bool_t getParams(FairParamList *list)
Definition: PndMapPar.cxx:70
Double_t GetPositionZ() const
Definition: PndFieldMap.h:106
void SetParameters(FairField *field)
Definition: PndMapPar.cxx:91
Double_t fPosX
Definition: PndMapPar.h:88