FairRoot/PandaRoot
PndFieldMapData.cxx
Go to the documentation of this file.
1 #include "TArrayF.h"
2 #include "PndFieldMap.h"
3 #include "PndFieldMapData.h"
4 
5 
6 
7 // ------------- Default constructor ----------------------------------
9  :fType(1),
10  fXmin(0),
11  fXmax(0),
12  fYmin(0),
13  fYmax(0),
14  fZmin(0),
15  fZmax(0),
16  fUnit(0),
17  fNx(0),
18  fNy(0),
19  fNz(0),
20  fBx(0),
21  fBy(0),
22  fBz(0)
23 {
24 
25 }
26 // ------------------------------------------------------------------------
27 
28 
29 
30 // ------------- Standard constructor ---------------------------------
32  :TNamed(mapName, "PND Field Map Data"),
33  fType(1),
34  fXmin(0),
35  fXmax(0),
36  fYmin(0),
37  fYmax(0),
38  fZmin(0),
39  fZmax(0),
40  fUnit(0),
41  fNx(0),
42  fNy(0),
43  fNz(0),
44  fBx(0),
45  fBy(0),
46  fBz(0)
47 {
48 }
49 // ------------------------------------------------------------------------
50 
51 
52 
53 // ----- Constructor from PndFieldMap ------------------------------
55  const PndFieldMap& map)
56  :TNamed(name, "PND Field Map Data"),
57  fType( map.GetType()),
58  fXmin( map.GetXmin()),
59  fXmax( map.GetXmax()),
60  fYmin( map.GetYmin()),
61  fYmax( map.GetYmax()),
62  fZmin( map.GetZmin()),
63  fZmax( map.GetZmax()),
64  fUnit( map.GetUnit()),
65  fNx( map.GetNx()),
66  fNy( map.GetNy()),
67  fNz( map.GetNz()),
68  fBx( new TArrayF(*(map.GetBx()))),
69  fBy( new TArrayF(*(map.GetBy()))),
70  fBz( new TArrayF(*(map.GetBz())))
71 
72 {
73 
74  // Take out scaling factor and convert from kG to T
75  Double_t factor = map.GetScale() * 10.;
76  Int_t index = 0;
77  for (Int_t ix=0; ix<fNx; ix++) {
78  for (Int_t iy=0; iy<fNy; iy++) {
79  for (Int_t iz=0; iz<fNz; iz++) {
80  index = ix*fNy*fNz + iy*fNz + iz;
81  if ( fBx ) (*fBx)[index] = (*fBx)[index] / factor;
82  if ( fBy ) (*fBy)[index] = (*fBy)[index] / factor;
83  if ( fBz ) (*fBz)[index] = (*fBz)[index] / factor;
84  } // z loop
85  } // y loop
86  } // x loop
87 
88 }
89 // ------------------------------------------------------------------------
90 
91 // ----- Copy Constructor from PndFieldMap ----------------------------
93  :TNamed(L),
94  fType( L.GetType()),
95  fXmin( L.GetXmin()),
96  fXmax( L.GetXmax()),
97  fYmin( L.GetYmin()),
98  fYmax( L.GetYmax()),
99  fZmin( L.GetZmin()),
100  fZmax( L.GetZmax()),
101  fUnit( L.fUnit),
102  fNx( L.GetNx()),
103  fNy( L.GetNy()),
104  fNz( L.GetNz()),
105  fBx( new TArrayF(*(L.GetBx()))),
106  fBy( new TArrayF(*(L.GetBy()))),
107  fBz( new TArrayF(*(L.GetBz())))
108 
109 {
110 }
111 // ------------------------------------------------------------------------
112 
113 // ------------ Destructor --------------------------------------------
115  if ( fBx ) delete fBx;
116  if ( fBy ) delete fBy;
117  if ( fBz ) delete fBz;
118 }
119 // ------------------------------------------------------------------------
120 
121 
PndTransMap * map
Definition: sim_emc_apd.C:99
Double_t GetScale() const
Definition: PndFieldMap.h:110
Double_t
virtual ~PndFieldMapData()
TString name
ClassImp(PndAnaContFact)