26 FairRootManager* ioman = FairRootManager::Instance();
28 LOG(error) <<
" <!> BmnAligner::Init() : FairRootManager not found";
33 LOG(error) <<
" <!> BmnAligner::Init() : Failed to get StsHit array";
38 LOG(error) <<
" <!> BmnAlignerApply::Init() : Failed to load alignment solution from file "
42 }
catch (std::exception& e) {
43 LOG(error) <<
" <!> BmnAlignerApply::Init() : " << e.what();
46 LOG(error) <<
" <!> BmnAlignerApply::Init() : Unknown exception";
60 FairField* mField = FairRunAna::Instance()->GetField();
69 TString fGemConfigFile(
"GemRun8.xml"), fSilConfigFile(
"SiliconRun8.xml");
88 irun = ((
DstEventHeader*)FairRootManager::Instance()->GetObject(
"DstEventHeader."))->GetRunId();
100 else if (
hLorCorX[0][0] ==
nullptr) {
121 map<int, vector<Double_t>> lorCorX[2], lorCorY[2];
124 for (
int igem = 0; igem < 2; ++igem) {
126 Double_t dx = 160.0 / nx, dy = 45.0 / ny;
129 for (
int iupd = 0; iupd < 2; ++iupd) {
130 int istb = (igem == 0) ? 0 : nsta;
131 int iste = (igem == 0) ? nsta : nsta + nsta1;
132 if (iste > (
int)lorCorX[0].size())
135 for (
int ist = istb; ist < iste; ++ist) {
143 hLorCorX[iupd][ist] =
new TH2D(hName,
"", nx, -80, 80, ny, 0, 45);
145 nxfsd = lorCorX[0][ist + 1].size();
146 hLorCorX[iupd][ist] =
new TH2D(hName,
"", nxfsd, 0, nxfsd, ny, 0, ny);
154 hLorCorY[iupd][ist] =
new TH2D(hName,
"", nx, -80, 80, ny, 0, 45);
156 hLorCorY[iupd][ist] =
new TH2D(hName,
"", nxfsd, 0, nxfsd, ny, 0, ny);
160 for (
int j = 0; j < 24; ++j) {
173 hLorCorX[iupd][ist]->Fill(x, y, lorCorX[iupd][ist + 1][j]);
174 if (lorCorY[iupd].find(ist + 1) != lorCorY[iupd].end())
175 hLorCorY[iupd][ist]->Fill(x, y, lorCorY[iupd][ist + 1][j]);
178 for (
int j = 0; j < nxfsd; ++j) {
179 hLorCorX[iupd][ist]->Fill(j + 0.5, 0.5, lorCorX[iupd][ist + 1][j]);
180 hLorCorY[iupd][ist]->Fill(j + 0.5, 0.5, lorCorY[iupd][ist + 1][j]);
230 else if (xh1 < h2->GetXaxis()->GetXmin())
234 else if (yh1 < h2->GetYaxis()->GetXmin())
240 hit->SetX(xh - dx * 0.65);
251 int iupd = isec /
hLorCorX[0][ista]->GetNbinsX();
252 int ireg = isec %
hLorCorX[0][ista]->GetNbinsX();
255 hit->SetX(hit->GetX() - dx * 0.65);
258 hit->SetY(hit->GetY() - dy * 0.65);
294 std::map<
int, std::vector<Double_t>>* lorCorX,
295 std::map<
int, std::vector<Double_t>>* lorCorY,
305 fileName =
gSystem->ExpandPathName(
"$VMCWORKDIR");
307 fileName +=
"/parameters/reco/";
309 fileName +=
"LorentzGemCorr.txt";
311 fileName +=
"LorentzFsdCorr.txt";
312 fin.open(fileName.
Data());
313 if (!fin.is_open()) {
314 cout <<
" !!! Lorentz correction file " << fileName <<
" not found !!!" << endl;
318 map<int, std::size_t> runsMap;
323 size_t pos = fin.tellg();
334 runsMap[run.
Atoi()] = pos;
346 auto iter = runsMap.upper_bound(irun);
347 if (iter != runsMap.begin())
355 fin.seekg(iter->second);
368 int ista = stat.
Atoi();
379 cout <<
" !!! Wrong input line !!! " << chline <<
" " << nx <<
" " << ny << endl;
388 if (nreg != nx * ny) {
389 cout <<
" !!! Wrong input line !!! " << chline <<
" " << nreg <<
" " << nx * ny << endl;
392 auto lorCor = vector<Double_t>(nreg);
394 for (
int itok = 0; itok < nreg; ++itok) {
400 lorCorX[iupd][ista] = lorCor;
402 lorCorY[iupd][ista] = lorCor;
void ReadCorrections(int irun, int igem, std::map< int, std::vector< Double_t > > *locCorX, std::map< int, std::vector< Double_t > > *locCorY, int &nx, int &ny)