19#include "FairRunAna.h"
20#include "FairRuntimeDb.h"
27#include <boost/assign/list_of.hpp>
32using boost::assign::list_of;
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]"};
128 TGraph2D* graph =
new TGraph2D();
132 string title = name +
";X [cm];Y [cm];" + zTitle[
v];
133 graph->SetNameTitle(name.c_str(), title.c_str());
134 fHM->Add(name, graph);
140 TGraph* graph =
new TGraph();
142 string title = name +
";Z [cm];B [kGauss]";
143 graph->SetNameTitle(name.c_str(), title.c_str());
144 fHM->Add(name, graph);
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());
152 fHM->Add(name, graph);
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());
160 fHM->Add(name, graph);
164 for (
Int_t p = 0; p < 2; p++) {
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());
172 fHM->Add(name, graph);
179 string names[] = {
"Bx",
"By",
"Bz",
"Mod"};
193 Double_t
pos[3] = {X, Y, Z};
197 B[3] =
sqrt(
B[0] *
B[0] +
B[1] *
B[1] +
B[2] *
B[2]);
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]);
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]);
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];
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(CbmCutId id)
Convert CbmCutId to a string representation.
friend fvec sqrt(const fvec &a)
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.
std::vector< Int_t > GetPixelAddresses()
static CbmRichGeoHandler & GetInstance()
CbmRichPixelData * GetPixelDataByAddress(Int_t 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)