26 FairRootManager* ioman = FairRootManager::Instance();
28 LOG(error) <<
" <!> BmnAligner::Init() : FairRootManager not found";
31 fpStsHitsArray = (TClonesArray*)ioman->GetObject(
"StsHit");
32 if (!fpStsHitsArray) {
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";
49 if (!fLorentzCorrectionApply)
60 FairField* mField = FairRunAna::Instance()->GetField();
61 fieldFlag = (TMath::Abs(mField->GetBy(0, 0, 135)) > 0.5) ? kTRUE : kFALSE;
62 TString gPathConfig = gSystem->Getenv(
"VMCWORKDIR");
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) {
125 ReadCorrections(irun, igem, lorCorX, lorCorY, nx, ny);
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) {
136 TString hName =
"hLorCorX_";
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) {
164 int ireg = TMath::Abs(ireg1);
169 Double_t x = (ix2 + 0.5) * dx;
172 Double_t y = (iy2 + 0.5) * dy;
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]);
196 for (Int_t
i = 0, n = fpStsHitsArray->GetEntriesFast();
i < n;
i++) {
202 if (!fLorentzCorrectionApply)
218 Double_t xh = hit->GetX(), yh = TMath::Abs(hit->GetY()), xh1 = xh, yh1 = yh;
219 TH2D* h2 = hLorCorX[iupd][ista];
228 if (xh1 >= h2->GetXaxis()->GetXmax())
229 xh1 = h2->GetXaxis()->GetXmax() - 0.1;
230 else if (xh1 < h2->GetXaxis()->GetXmin())
231 xh1 = h2->GetXaxis()->GetXmin() + 0.1;
232 if (yh1 >= h2->GetYaxis()->GetXmax())
233 yh1 = h2->GetYaxis()->GetXmax() - 0.1;
234 else if (yh1 < h2->GetYaxis()->GetXmin())
235 yh1 = h2->GetYaxis()->GetXmin() + 0.1;
238 Double_t dx = h2->Interpolate(xh1, yh1);
240 hit->SetX(xh - dx * 0.65);
241 h2 = hLorCorY[iupd][ista];
242 Double_t dy = h2->Interpolate(xh1, yh1);
246 Double_t ynew = yh - dy * 0.65;
251 int iupd = isec / hLorCorX[0][ista]->GetNbinsX();
252 int ireg = isec % hLorCorX[0][ista]->GetNbinsX();
253 TH2D* h2 = hLorCorX[iupd][ista];
254 Double_t dx = h2->GetBinContent(ireg + 1, 1);
255 hit->SetX(hit->GetX() - dx * 0.65);
256 h2 = hLorCorY[iupd][ista];
257 Double_t dy = h2->GetBinContent(ireg + 1, 1);
258 hit->SetY(hit->GetY() - dy * 0.65);