19#include "FairRunAna.h"
20#include "FairRuntimeDb.h"
27#include <boost/assign/list_of.hpp>
32using boost::assign::list_of;
44 , fMinZFieldIntegral(171.)
45 , fMaxZFieldIntegral(330.)
76 vector<Double_t> tmp = list_of(0.)(10.)(20.)(30.);
84 fField = FairRunAna::Instance()->GetField();
96 TDirectory* oldir = gDirectory;
97 TFile* outFile = FairRootManager::Instance()->GetOutFile();
98 if (outFile != NULL) {
102 gDirectory->cd(oldir->GetPath());
106 vector<vector<Double_t>>
pos = {{0., 0., 170.}, {0., 80., 170.}, {50., 0., 170.}, {0., 0., 250.}};
107 for (UInt_t i = 0; i <
pos.size(); i++) {
109 Double_t magB =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
110 cout <<
"B at (" <<
pos[i][0] <<
", " <<
pos[i][1] <<
", " <<
pos[i][2] <<
") = " << magB <<
" kGauss" << endl;
113 cout <<
"CbmLitFieldQa::Init() end" << endl;
124 string names[] = {
"Bx",
"By",
"Bz",
"Mod"};
125 string zTitle[] = {
"B_{x} [kGauss]",
"B_{y} [kGauss]",
"B_{z} [kGauss]",
"|B| [kGauss]"};
126 for (Int_t
v = 0;
v < 4;
v++) {
128 TGraph2D* graph =
new TGraph2D();
132 string title = name +
";X [cm];Y [cm];" + zTitle[
v];
133 graph->SetNameTitle(name.c_str(), title.c_str());
138 for (Int_t
v = 0;
v < 4;
v++) {
140 TGraph* graph =
new TGraph();
142 string title = name +
";Z [cm];B [kGauss]";
143 graph->SetNameTitle(name.c_str(), title.c_str());
146 for (UInt_t i = 0; i <
fAlongZXY.size(); i++) {
147 TGraph* graph =
new TGraph();
150 string title = name +
";Z [cm];B [kGauss]";
151 graph->SetNameTitle(name.c_str(), title.c_str());
154 for (UInt_t i = 0; i <
fAlongZXY.size(); i++) {
155 TGraph* graph =
new TGraph();
158 string title = name +
";Z [cm];B_{Int_t} [kGauss*m]";
159 graph->SetNameTitle(name.c_str(), title.c_str());
164 for (Int_t p = 0; p < 2; p++) {
165 for (Int_t
v = 0;
v < 4;
v++) {
166 TGraph2D* graph =
new TGraph2D();
169 string name =
"hmf_" + names[
v] +
"_Rich_Pmt_" + ((p == 0) ?
"up" :
"down");
170 string title = name +
";X [cm];Y [cm];" + zTitle[
v];
171 graph->SetNameTitle(name.c_str(), title.c_str());
179 string names[] = {
"Bx",
"By",
"Bz",
"Mod"};
181 for (Int_t iSlice = 0; iSlice <
fNofSlices; iSlice++) {
187 for (Int_t iX = 0; iX <
fNofBinsX; iX++) {
189 for (Int_t iY = 0; iY <
fNofBinsY; iY++) {
193 Double_t
pos[3] = {X, Y, Z};
197 B[3] =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
198 for (Int_t
v = 0;
v < 4;
v++) {
200 fHM->
G2(name)->SetPoint(cnt, X, Y, B[
v]);
210 for (Int_t istep = 0; istep < nofSteps; istep++) {
212 Double_t tanXangle = tan(
fAlongZAngles[i] * 3.14159265 / 180);
213 Double_t tanYangle = tan(
fAlongZAngles[i] * 3.14159265 / 180);
214 Double_t X = Z * tanXangle;
215 Double_t Y = Z * tanYangle;
218 Double_t
pos[3] = {X, Y, Z};
222 B[3] =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
223 for (Int_t
v = 0;
v < 4;
v++) {
225 fHM->
G1(name)->SetPoint(istep, Z, B[
v]);
230 for (UInt_t i = 0; i <
fAlongZXY.size(); i++) {
232 Double_t integralB[4] = {0., 0., 0., 0.};
233 for (Int_t istep = 0; istep < nofSteps; istep++) {
239 Double_t
pos[3] = {X, Y, Z};
243 B[3] =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
245 for (Int_t
v = 0;
v < 4;
v++) {
248 fHM->
G1(name)->SetPoint(istep, Z, B[
v]);
251 integralB[
v] += 0.01 *
fZStep * fabs(B[
v]);
254 fHM->
G1(name)->SetPoint(istep, Z, integralB[
v]);
255 fHM->
G1(name)->SetMaximum(1.1 * integralB[
v]);
264 string names[] = {
"Bx",
"By",
"Bz",
"Mod"};
266 if (pixels.size() == 0)
return;
268 Double_t maxModB = 0.;
270 for (UInt_t i = 0; i < pixels.size(); i++) {
273 inPos.SetXYZ(pixelData->
fX, pixelData->
fY, pixelData->
fZ);
275 if (inPos.Y() < 0) ud =
"down";
281 Double_t
pos[3] = {inPos.X(), inPos.Y(), inPos.Z()};
286 B[3] =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
287 if (maxModB < B[3]) maxModB = B[3];
288 for (Int_t
v = 0;
v < 4;
v++) {
289 string name =
"hmf_" + names[
v] +
"_Rich_Pmt_" + ud;
291 fHM->
G2(name)->SetPoint(
fHM->
G2(name)->GetN(), outPos.X(), outPos.Y(), B[
v]);
295 cout <<
"Maximum Bmod onto RICH PMT:" << maxModB <<
" kGauss" << endl;
std::string ToString(ECbmModuleId modId)
friend fvec sqrt(const fvec &a)
TGraph2D * G2(const std::string &name) const
Return pointer to TGraph2D.
TGraph * G1(const std::string &name) const
Return pointer to TGraph.
void WriteToFile()
Write all objects to current opened file.
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
vector< Double_t > fZSlicePosition
virtual void Finish()
Inherited from FairTask.
vector< Double_t > fAlongZAngles
vector< Double_t > fXSlicePosition
vector< std::pair< Double_t, Double_t > > fAlongZXY
vector< Double_t > fYSlicePosition
void CreateHistos()
Create histograms.
Double_t fMinZFieldIntegral
virtual void Exec(Option_t *opt)
Inherited from FairTask.
void FillBHistos()
Fill graphs and histos for field map for each field component (Bx, By, Bz, |B|).
Double_t fMaxZFieldIntegral
virtual InitStatus Init()
Inherited from FairTask.
void FillRichPmtPlaneBHistos()
Fill B-field histograms for RICH PMT plane.
virtual ~CbmLitFieldQa()
Destructor.
CbmLitFieldQa()
Constructor.
static CbmRichDigiMapManager & GetInstance()
Return Instance of CbmRichGeoManager.
std::vector< Int_t > GetPixelAddresses()
Return addresses of all pixels.
CbmRichPixelData * GetPixelDataByAddress(Int_t address)
Return CbmRichDataPixel by digi address.
void RotatePoint(TVector3 *inPos, TVector3 *outPos, Bool_t noTilting=false)
static CbmRichGeoManager & GetInstance()
Base class for simulation reports.
void Create(CbmHistManager *histManager, const std::string &outputDir)
Main function which creates report data.
std::string ToString(const T &value)