EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PndMapPar.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PndMapPar.cxx
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 -----------------------------------------------
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 ---------------------------------------------
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