BmnRoot
Loading...
Searching...
No Matches
BmnSP41FieldMapCreator.h
Go to the documentation of this file.
1#ifndef BMNSP41FIELDMAPCREATOR_H
2#define BMNSP41FIELDMAPCREATOR_H 1
3
4#include "BmnFieldMap.h"
5
6#include <TFile.h>
7#include <TClonesArray.h>
8#include <TF1.h>
9#include <TH1.h>
10#include <TGraph.h>
11#include <TGraph2D.h>
12#include <TString.h>
13#include <TMath.h>
14
15#include <vector>
16#include <utility>
17
18using namespace TMath;
19
20class fitParMonitor : public TObject
21{
22 public:
24 fitParMonitor(TString out);
25 virtual ~fitParMonitor();
26
27 TH1F*** C;
28 TH1F*** M;
29 TH1F*** S;
30
31 private:
32 TFile* f;
33
34 ClassDef(fitParMonitor, 1)
35};
36
37
38class extrapolationConditions : public TObject
39{
40 public:
42 {
43 direction = "Z";
44 min = -DBL_MAX;
45 max = DBL_MAX;
46 }
47
49
50 TString direction;
51 Double_t min;
52 Double_t max;
53 std::pair <Double_t, Double_t> tailRangeLeft;
54 std::pair <Double_t, Double_t> tailRangeRight;
55
56 ClassDef(extrapolationConditions, 1)
57};
58
59
60class smoothedValues : public TObject
61{
62 public:
64 {
65 X = 0.;
66 Y = 0.;
67 Z = 0.;
68 fieldValue = 0.;
69 }
70
71 virtual ~smoothedValues() {}
72
73 Double_t X;
74 Double_t Y;
75 Double_t Z;
76 Double_t fieldValue;
77
78 ClassDef(smoothedValues, 1)
79};
80
81
82class BmnSP41FieldMapCreator : public TNamed
83{
84 public:
86 BmnSP41FieldMapCreator(TString, TString);
88
90 void SmoothMap(TClonesArray*);
91
92 void SetOutParamFileName(TString name) {
93 fParamFileName = name;
94 }
95
96 void SetDebug(Bool_t flag) {
97 fDebug = flag;
98 }
99
100 void SetNodeNumber(Int_t nNodes) {
101 dimGrid = nNodes;
102 }
103
104 // Extrapolation new ranges ...
105
106 void SetNewRanges(Double_t min, Double_t max) {
107 fConditions->min = min;
108 fConditions->max = max;
109 }
110
111 void SetExtrapolationAxis(TString axis) {
112 fConditions->direction = axis;
113 }
114
115 // Main method to be called ...
117
118 private:
119 Bool_t fDebug;
120
121 TString nameOutput;
122
123 Int_t dimGrid; // dimGrid x dimGrid corresponds to number of nodes to build a grid along X(Y)-axis
124 Int_t dimNhist; // dimNhist corresponds to number of profiles drawn
125
126 Double_t factor; // Transition from T to kG
127
128 BmnFieldMap* fMap;
129 extrapolationConditions* fConditions;
130 fitParMonitor* fMonitor;
131
132 Double_t WinXmin;
133 Double_t WinXmax;
134 Double_t WinYmin;
135 Double_t WinYmax;
136 Double_t WinZmin;
137 Double_t WinZmax;
138 Double_t winXstep;
139 Double_t winYstep;
140 Double_t winZstep;
141
142 TGraph2D*** constant;
143 TGraph2D*** mean;
144 TGraph2D*** sigma;
145
146 TString fParamFileName;
147
148 void DrawProfileExtrapZ(Int_t, TGraph***, TF1***, TString, TString, Double_t, Double_t, Double_t, Double_t);
149 void DrawProfileExtrapX(Int_t, TGraph***, TF1***, TString, TString, Double_t, Double_t, Double_t, Double_t);
150 Double_t FieldExtrapolate(Double_t, Double_t, Double_t, TGraph2D*, TGraph2D*, TGraph2D*);
151 void Print(BmnFieldMap*);
152
153 void DoExtrapolationAlongZ(Int_t, Int_t);
154 void DoExtrapolationAlongX(Int_t, Int_t);
155
156 std::vector <Double_t> checkedFieldValue(Double_t bx, Double_t by, Double_t bz) {
157 // To be not more than 5kG at scale = 1
158 const Double_t min = 0.001;
159 const Double_t max = 7.;
160
161 std::vector <Double_t> out;
162
163 out.push_back((TMath::Abs(bx) > min && TMath::Abs(bx) < max) ? bx : 0.);
164 out.push_back((TMath::Abs(by) > min && TMath::Abs(by) < max) ? by : 0.);
165 out.push_back((TMath::Abs(bz) > min && TMath::Abs(bz) < max) ? bz : 0.);
166
167 return out;
168 }
169
170 ClassDef(BmnSP41FieldMapCreator, 1)
171};
172
173#endif
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition P4_F32vec4.h:30
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition P4_F32vec4.h:31
void SetOutParamFileName(TString name)
void SetExtrapolationAxis(TString axis)
BmnSP41FieldMapCreator(TString, TString)
void SmoothMap(TClonesArray *)
void SetNewRanges(Double_t min, Double_t max)
virtual ~BmnSP41FieldMapCreator()
std::pair< Double_t, Double_t > tailRangeRight
std::pair< Double_t, Double_t > tailRangeLeft
virtual ~fitParMonitor()
fitParMonitor(TString out)