TPCCondData
FieldSetting.cc
Go to the documentation of this file.
1 /* FieldSetting.cc
2  * $Id$
3  */
4 
5 #include "FieldSetting.h"
6 
7 //LCIO
8 #include "lcio.h"
9 #include "EVENT/LCGenericObject.h"
10 #include "IMPL/LCGenericObjectImpl.h"
11 
12 namespace tpcconddata{
13 
15  return std::string("$Rev: 3988 $");
16 }
17 
19  return std::string("TPCFieldSetting");
20 }
21 
23  createObj=true;
24  myObj = new IMPL::LCGenericObjectImpl();
25 
26  setNGEMs(NGEMs);
27 
28  setGEMStatus( 0 );
31  for (int iGem = 0; iGem<NGEMs; iGem++){
32  setGEMVoltage( iGem, 0 );
33  }
34  for (int iGem = 0; iGem<(NGEMs-1); iGem++){
35  setTransferField( iGem, 0 );
36  }
37  setInductionField( 0 );
38  setCathodeVoltage( 0 );
40  setAnodeVoltage( 0 );
41  setMagneticField( 0 );
42 }
43 
44 FieldSetting::FieldSetting(EVENT::LCObject* Obj){
45  createObj=false;
46  myObj = dynamic_cast<IMPL::LCGenericObjectImpl*>( Obj );
47 
48  if (myObj ==0){
49  //could be an FieldSetting
50  FieldSetting* dummyObj = dynamic_cast<FieldSetting*>( Obj );
51  if (dummyObj != 0){
52  myObj=dummyObj->obj();
53  }
54  }
55 }
56 
58  if (createObj) delete myObj;
59 }
60 
62  return myObj->getIntVal( 0 );
63 }
64 
66  return myObj->getIntVal( 1 );
67 }
68 
70  return myObj->getIntVal( 2 );
71 }
72 
74  return myObj->getIntVal( 3 );
75 }
76 
77 float FieldSetting::getGEMVoltage( int GEMID ) const {
78  if ( GEMID<getNGEMs() )
79  return myObj->getFloatVal( 3+GEMID );
80  return 0;
81 }
82 
83 float FieldSetting::getTransferField( int GEMID ) const {
84  if ( GEMID<getNGEMs()-1 )
85  return myObj->getFloatVal( 3+getNGEMs()+GEMID );
86  return 0;
87 }
88 
90  return myObj->getFloatVal( 3+getNGEMs()*2 );
91 }
92 
94  return myObj->getFloatVal( 0 );
95 }
96 
98  return myObj->getFloatVal( 3+getNGEMs()*2 + 1 );
99 }
100 
102  return myObj->getFloatVal( 1 );
103 }
104 
105 float FieldSetting::getDriftField( float maxDriftLegth ) const {
106  return (getCathodeVoltage()-getAnodeVoltage() )/maxDriftLegth;
107 }
108 
110  return myObj->getFloatVal( 2 );
111 }
112 
113 void FieldSetting::setNGEMs( int Value){
114  myObj->setIntVal( 0, Value );
115 }
116 
118  myObj->setIntVal( 1, Value );
119 }
120 
122  myObj->setIntVal( 2, Value );
123 }
124 
125 void FieldSetting::setGEMStatus( int Value ){
126  myObj->setIntVal( 3, Value );
127 }
128 
129 void FieldSetting::setGEMVoltage( int GEMID, float Value ){
130  if ( GEMID<getNGEMs() )
131  myObj->setFloatVal( 3+GEMID, Value );
132 }
133 
134 void FieldSetting::setTransferField( int GEMID, float Value ){
135  if ( GEMID<getNGEMs()-1 )
136  myObj->setFloatVal( 3+getNGEMs()+GEMID, Value );
137 }
138 
140  myObj->setFloatVal( 3+getNGEMs()*2, Value );
141 }
142 
144  myObj->setFloatVal( 0, Value );
145 }
146 
148  myObj->setFloatVal( 3+getNGEMs()*2 + 1, Value );
149 }
150 
151 void FieldSetting::setAnodeVoltage( float Value ){
152  myObj->setFloatVal( 1, Value );
153 }
154 
155 void FieldSetting::setMagneticField( float Value ){
156  myObj->setFloatVal( 2, Value );
157 }
158 
159 IMPL::LCGenericObjectImpl* FieldSetting::obj() {
160  return myObj;
161 }
162 
164  return myObj->id();
165 }
166 
167 
168 // void FieldSetting::print ( std::ostream& os = std::cout ) const {
169 
170 // os<<"cathode: "<<getCathodeVoltage()
171 // <<" V \t-----------------------"<<std::endl;
172 // os<<"magnetic field "<<getMagneticField()<<" T"<<std::endl;
173 // os<<"anode: "<<getAnodeVoltage()
174 // <<" V \t-----------------------"<<std::endl;
175 // for (int iGem = 0; iGem<getNGEMs()-1; iGem++){
176 // os<<"GEM: "<<getGEMVoltage(iGem)
177 // <<" V \t-----------------------"<<std::endl;
178 // os<<"transferfield: \t"<<getTransferField(iGem)<<" V/mm"<<std::endl;
179 // }
180 // os<<"GEM: "<<getGEMVoltage(getNGEMs()-1)
181 // <<" V \t-----------------------"<<std::endl;
182 // os<<"inductionfield "<<getInductionField()<<" V/mm"<<std::endl;
183 // os<<"pad plane: 0"
184 // <<" V \t-----------------------"<<std::endl;
185 
186 // }
187 
188 // std::ostream &operator<<(std::ostream &os, const FieldSetting &fs) {
189 // fs.print(os);
190 // return os;
191 // }
192 
193 int FieldSetting::getNInt() const { return 4;}//myObj->getNInt(); }
194 int FieldSetting::getNFloat() const { return myObj->getNFloat(); }
195 int FieldSetting::getNDouble() const { return 0; }
196 
197 int FieldSetting::getIntVal(int index) const {
198  return myObj->getIntVal( index ) ;
199 }
200 float FieldSetting::getFloatVal(int index) const {
201  return myObj->getFloatVal( index ) ;
202 }
203 double FieldSetting::getDoubleVal(int index) const {
204  return 0.0;//myObj->getDoubleVal( index ) ;
205 }
206 
207 }
float getGuardRingVoltage() const
return voltage (in V) of the guard ring on the gem modules
Definition: FieldSetting.cc:97
float getGEMVoltage(int GEMID) const
return the voltage of the given number GEM 0 is the nearest the drift region
Definition: FieldSetting.cc:77
IMPL::LCGenericObjectImpl * obj()
void setMagneticField(float Value)
return the magnetic field (in T)
float getTransferField(int GEMID) const
return the field (in V/mm) between the GEM N and N+1
Definition: FieldSetting.cc:83
float getFloatVal(int index) const
IMPL::LCGenericObjectImpl * myObj
Definition: FieldSetting.h:163
float getMagneticField() const
return the magnetic field (in T)
int getMagneticFieldStatus() const
return the status of the Magnet 0: off 1: running normally 2: ramping up 3: ramping down ...
Definition: FieldSetting.cc:69
void setAnodeVoltage(float Value)
set voltage (in V) of the anode of the field cage (e.g.
void setGEMVoltage(int GEMID, float Value)
set the voltage of the given number GEM 0 is the nearest the drift region
static std::string getDefaultColName()
Definition: FieldSetting.cc:18
float getDriftField(float maxDriftLegth) const
return the driftfield (in V/mm) if the length of the driftregion (in mm) is given ...
int getIntVal(int index) const
void setTransferField(int GEMID, float Value)
set the field (in V/mm) between the GEM N and N+1
int getNGEMs() const
return the Number of GEMs
Definition: FieldSetting.cc:61
int getGEMStatus() const
return the status of the GEM System 0: off 1: running normally 2: ramping up 3: ramping down 4: tripp...
Definition: FieldSetting.cc:73
void setCathodeVoltage(float Value)
set voltage (in V) of the cathode of the field cage
static std::string getRevision()
Definition: FieldSetting.cc:14
void setInductionField(float Value)
set the field (in V/mm) between the last GEM and the Pad-Readout-Plane
void setDriftFieldStatus(int Value)
set the status of a drift field (see getDriftFieldStatus)
float getAnodeVoltage() const
return voltage (in V) of the anode of the field cage (e.g.
void setNGEMs(int Value)
set the Number of GEMs is protected, numberof GEMs is to imported for consistence can only be set by ...
class to store the field setting of a TPC with GEM-based amplification system
Definition: FieldSetting.h:19
float getInductionField() const
return the field (in V/mm) between the last GEM and the Pad-Readout-Plane
Definition: FieldSetting.cc:89
void setGEMStatus(int Value)
set the status of a GEM (see getGEMStatus)
float getCathodeVoltage() const
return voltage (in V) of the cathode of the field cage
Definition: FieldSetting.cc:93
void setMagneticFieldStatus(int Value)
set the status of a magnet (see getMagneticFieldStatus)
int getDriftFieldStatus() const
return the status of the DriftField System 0: off 1: running normally 2: ramping up 3: ramping down ...
Definition: FieldSetting.cc:65
double getDoubleVal(int index) const
void setGuardRingVoltage(float Value)
set voltage (in V) of the guard ring on gem module