193 cout <<
"//------------------------------ CbmRichAlignment: Calculate Angles "
194 "& Draw Distrib ------------------------------//"
198 Double_t trackX = 0., trackY = 0.;
201 Int_t nofRingsInEvent =
fRichRings->GetEntriesFast();
202 Float_t DistCenters, Theta_Ch, Theta_0, Angles_0;
203 Float_t Pi = 3.14159265;
204 Float_t TwoPi = 2. * 3.14159265;
208 if (nofRingsInEvent >= 1) {
209 cout <<
"Number of Rings in event: " << nofRingsInEvent << endl;
211 for (Int_t iR = 0; iR < nofRingsInEvent; iR++) {
219 fHM->
H1(
"fHCenterDistance")->Fill(DistCenters);
225 for (Int_t iH = 0; iH < NofHits; iH++) {
227 Int_t HitIndex = ring->
GetHit(iH);
229 Float_t xHit = hit->
GetX();
230 Float_t yHit = hit->
GetY();
235 if (xRing - xHit == 0 || yRing - yHit == 0)
continue;
236 fPhi[iH] = TMath::ATan2(yHit - yRing, xHit - xRing);
240 Theta_Ch =
sqrt(TMath::Power(trackX - hit->
GetX(), 2) + TMath::Power(trackY - hit->
GetY(), 2));
244 fHM->
H1(
"fHThetaDiff")->Fill(Theta_Ch - Theta_0);
247 fHM->
H2(
"fHCherenkovHitsDistribTheta0")->Fill(Angles_0, Theta_0);
248 fHM->
H2(
"fHCherenkovHitsDistribThetaCh")->Fill(
fPhi[iH], Theta_Ch);
249 fHM->
H2(
"fHCherenkovHitsDistribReduced")->Fill(
fPhi[iH], (Theta_Ch - Theta_0));
313 c3->SetFillColor(42);
315 gPad->SetTopMargin(0.1);
316 gPad->SetFillColor(33);
319 TH2D* CloneArr = (TH2D*)
fHM->
H2(
"fHCherenkovHitsDistribReduced")->Clone();
320 CloneArr->GetXaxis()->SetLabelSize(0.03);
321 CloneArr->GetXaxis()->SetTitleSize(0.03);
322 CloneArr->GetXaxis()->CenterTitle();
323 CloneArr->GetXaxis()->SetNdivisions(612, kTRUE);
324 CloneArr->GetYaxis()->SetLabelSize(0.03);
325 CloneArr->GetYaxis()->SetTitleSize(0.03);
326 CloneArr->GetYaxis()->SetNdivisions(612, kTRUE);
327 CloneArr->GetYaxis()->CenterTitle();
329 CloneArr->GetZaxis()->SetLabelSize(0.03);
330 CloneArr->GetZaxis()->SetTitleSize(0.03);
331 CloneArr->GetYaxis()->SetTitleOffset(1.0);
332 CloneArr->Draw(
"colz");
339 TH2D* CloneArr_2 = (TH2D*)
fHM->
H2(
"fHCherenkovHitsDistribReduced")->Clone();
340 for (Int_t y_bin = 1; y_bin <= 500; y_bin++) {
341 for (Int_t x_bin = 1; x_bin <= 200; x_bin++) {
347 if (CloneArr_2->GetBinContent(x_bin, y_bin) < thresh) {
348 CloneArr_2->SetBinContent(x_bin, y_bin, 0);
353 CloneArr_2->GetXaxis()->SetLabelSize(0.03);
354 CloneArr_2->GetXaxis()->SetTitleSize(0.03);
355 CloneArr_2->GetXaxis()->CenterTitle();
356 CloneArr_2->GetXaxis()->SetNdivisions(612, kTRUE);
357 CloneArr_2->GetYaxis()->SetLabelSize(0.03);
358 CloneArr_2->GetYaxis()->SetTitleSize(0.03);
359 CloneArr_2->GetYaxis()->SetNdivisions(612, kTRUE);
360 CloneArr_2->GetYaxis()->CenterTitle();
362 CloneArr_2->GetZaxis()->SetLabelSize(0.03);
363 CloneArr_2->GetZaxis()->SetTitleSize(0.03);
364 CloneArr_2->GetYaxis()->SetTitleOffset(1.0);
365 CloneArr_2->Draw(
"colz");
369 CloneArr_2->FitSlicesY(0, 0, -1, 1);
371 TH1D* histo_0 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_0");
374 TH1D* histo_1 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_1");
378 TH1D* histo_2 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_2");
381 TH1D* histo_chi2 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_chi2");
385 TF1* f1 =
new TF1(
"f1",
"[2]+[0]*cos(x)+[1]*sin(x)", -3.5, 3.5);
386 f1->SetParameters(0, 0, 0);
387 f1->SetParNames(
"Delta_phi",
"Delta_lambda",
"Offset");
388 histo_1->Fit(
"f1",
"",
"");
389 TF1* fit = histo_1->GetFunction(
"f1");
390 Double_t p1 = fit->GetParameter(
"Delta_phi");
391 Double_t p2 = fit->GetParameter(
"Delta_lambda");
392 Double_t p3 = fit->GetParameter(
"Offset");
393 Double_t chi2 = fit->GetChisquare();
404 f1->SetParameters(fit->GetParameter(0), fit->GetParameter(1));
411 Double_t Focal_length = 150., q = 0., A = 0., Alpha = 0., mis_x = 0., mis_y = 0.;
414 q = TMath::ATan(fit->GetParameter(0) / fit->GetParameter(1));
415 cout << endl <<
"fit_1 = " << fit->GetParameter(0) <<
" and fit_2 = " << fit->GetParameter(1) << endl;
417 A = fit->GetParameter(1) / TMath::Cos(q);
420 TMath::ATan(A / 1.5) * 0.5
425 mis_x = TMath::ATan(fit->GetParameter(0) / Focal_length) * 0.5 * TMath::Power(10, 3);
426 mis_y = TMath::ATan(fit->GetParameter(1) / Focal_length) * 0.5 * TMath::Power(10, 3);
429 TLegend* LEG =
new TLegend(0.27, 0.7, 0.85, 0.87);
430 LEG->SetBorderSize(1);
431 LEG->SetFillColor(0);
433 LEG->SetTextSize(0.03);
434 sprintf(leg,
"Fitted sinusoid");
435 LEG->AddEntry(f1, leg,
"l");
436 sprintf(leg,
"Rotation angle around X = %f", mis_y);
437 LEG->AddEntry(
"", leg,
"l");
438 sprintf(leg,
"Rotation angle around Y = %f", mis_x);
439 LEG->AddEntry(
"", leg,
"l");
440 sprintf(leg,
"Offset = %f", fit->GetParameter(2));
441 LEG->AddEntry(
"", leg,
"l");
448 CloneArr_2->Draw(
"colz");
450 TLegend* LEG1 =
new TLegend(0.35, 0.7, 0.72, 0.85);
451 LEG1->SetBorderSize(1);
452 LEG1->SetFillColor(0);
453 LEG1->SetMargin(0.2);
454 LEG1->SetTextSize(0.03);
455 sprintf(leg,
"Fitted sinusoid");
456 LEG1->AddEntry(f1, leg,
"l");
457 sprintf(leg,
"Misalign in X = %f", mis_x);
458 LEG1->AddEntry(
"", leg,
"l");
459 sprintf(leg,
"Misalign in Y = %f", mis_y);
460 LEG1->AddEntry(
"", leg,
"l");
461 sprintf(leg,
"Offset = %f", fit->GetParameter(2));
462 LEG1->AddEntry(
"", leg,
"l");
503 outputFit.at(0) = mis_y;
504 outputFit.at(1) = mis_x;
505 outputFit.at(2) = fit->GetParameter(1);
506 outputFit.at(3) = fit->GetParameter(0);
void Create2(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...