ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
FirstPage Class Reference
Inheritance diagram for FirstPage:
Collaboration diagram for FirstPage:

Public Member Functions

 FirstPage (char *, TFile *)
 

Public Attributes

float runnumber = 0
 
float t0offset = 0
 
int iter = 0
 

Detailed Description

Definition at line 3528 of file TRTCalib_makeplots.cxx.

Constructor & Destructor Documentation

◆ FirstPage()

FirstPage::FirstPage ( char *  ,
TFile *  file 
)

Definition at line 3538 of file TRTCalib_makeplots.cxx.

3539 {
3540 
3541  this->cd();
3542 
3543  TNtuple *Tracktuple = (TNtuple *)file->Get("tracktuple");
3544  // we assign here index 0,1,2,3 to detectors -1, -2, 1, 2
3545  TH1F *resAr0 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_-1/residual");
3546  TH1F *tresAr0 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_-1/timeresidual");
3547  TH1F *resAr1 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_-2/residual");
3548  TH1F *tresAr1 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_-2/timeresidual");
3549  TH1F *resXe1 = (TH1F *)file->Get("TRT_all/Detector_-2/residual");
3550  TH1F *tresXe1 = (TH1F *)file->Get("TRT_all/Detector_-2/timeresidual");
3551  TH1F *resAr2 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_1/residual");
3552  TH1F *tresAr2 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_1/timeresidual");
3553  TH1F *resAr3 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_2/residual");
3554  TH1F *tresAr3 = (TH1F *)file->Get("TRT_Ar_all/Detector_Ar_2/timeresidual");
3555  TH1F *resXe3 = (TH1F *)file->Get("TRT_all/Detector_2/residual");
3556  TH1F *tresXe3 = (TH1F *)file->Get("TRT_all/Detector_2/timeresidual");
3557 
3558  TDatime *dt = new TDatime();
3559 
3560  TPaveText *pt = new TPaveText(.1, .2, .9, .9);
3561 
3562  if (!Tracktuple)
3563  throw(string("tracktuple not found!"));
3564 
3565  cout << " tracktuple found " << endl;
3566  pt->AddText(" ");
3567 
3568  // if (string(filename).find("_histograms.root")!=string::npos) iter = atoi(string(filename).substr(string(filename).find("_histograms.root")-2,2).data());
3569  iter = 0;
3570 
3571  runnumber = 0;
3572  cout << " writing to header. iteration number " << iter << endl;
3573  pt->AddText(Form("Iteration number: %i", iter));
3574  cout << " writing to header. month " << dt->GetMonth() << endl;
3575  pt->AddText(Form("Time: %02i/%02i/%i %02i:%02i", dt->GetDay(), dt->GetMonth(), dt->GetYear(), dt->GetHour(), dt->GetMinute()));
3576  Tracktuple->SetBranchAddress("run", &runnumber);
3577  Tracktuple->GetEntry(0);
3578  cout << " writing to header. run number " << (int)runnumber << endl;
3579  pt->AddText(Form("Run number: %i", (int)runnumber));
3580  /*
3581  for(int i=1; i<Tracktuple->GetEntries();i++){
3582  float oldrun= runnumber;
3583  Tracktuple->GetEntry(i);
3584  if(oldrun!=runnumber ) pt->AddText(Form("Run number: %i",(int)runnumber));
3585  }
3586  */
3587  cout << " writing to header. number of tracks " << Tracktuple->GetEntries() << endl;
3588  pt->AddText(Form("Total no. tracks: %lli", Tracktuple->GetEntries()));
3589 
3590  // Get residuals and time residuals per subdetector
3591  // we assign here index 0,1,2,3 to detectors -1, -2, 1, 2
3592  // the detectors +-1 have only Argon in Run3
3593 
3594  float bhitst[4]={0};
3595  float rest[4]{};
3596  float trest[4]{};
3597  float treswt[4]{};
3598 
3599  cout << " debug 1 " << endl;
3600  bhitst[0] = resAr0->GetEntries();
3601  bhitst[2] = resAr2->GetEntries();
3602  float nhAr1 = resAr1->GetEntries();
3603  float nhXe1 = resXe1->GetEntries();
3604  cout << " debug 2 " << endl;
3605  bhitst[1] = nhAr1 + nhXe1;
3606  float nhAr3 = 0;
3607  float nhXe3 = 0;
3608  if (resAr3)
3609  nhAr3 = resAr3->GetEntries();
3610  if (resXe3)
3611  nhXe3 = resXe3->GetEntries();
3612  bhitst[3] = nhAr3 + nhXe3;
3613  cout << " debug 3 " << endl;
3614  rest[0] = resAr0->GetFunction("gaus")->GetParameter(2);
3615  rest[2] = resAr2->GetFunction("gaus")->GetParameter(2);
3616  rest[1] = (resAr1->GetFunction("gaus")->GetParameter(2) * nhAr1 + resXe1->GetFunction("gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3617  if (resAr3 and resXe3)
3618  rest[3] = (resAr3->GetFunction("gaus")->GetParameter(2) * nhAr3 + resXe3->GetFunction("gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3619  cout << " debug 4 " << endl;
3620  trest[0] = tresAr0->GetFunction("gaus")->GetParameter(1);
3621  trest[2] = tresAr2->GetFunction("gaus")->GetParameter(1);
3622  trest[1] = (tresAr1->GetFunction("gaus")->GetParameter(1) * nhAr1 + tresXe1->GetFunction("gaus")->GetParameter(1) * nhXe1) / bhitst[1];
3623  if (tresAr3)
3624  trest[3] = (tresAr3->GetFunction("gaus")->GetParameter(1) * nhAr3 + tresXe3->GetFunction("gaus")->GetParameter(1) * nhXe3) / bhitst[3];
3625  cout << " debug 5 " << endl;
3626  treswt[0] = tresAr0->GetFunction("gaus")->GetParameter(2);
3627  treswt[2] = tresAr2->GetFunction("gaus")->GetParameter(2);
3628  treswt[1] = (tresAr1->GetFunction("gaus")->GetParameter(2) * nhAr1 + tresXe1->GetFunction("gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3629  if (tresAr3)
3630  treswt[3] = (tresAr3->GetFunction("gaus")->GetParameter(2) * nhAr3 + tresXe3->GetFunction("gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3631  cout << " debug 6 " << endl;
3632 
3633  // Get the precion hits vs tube hits:
3634 
3635  TDirectory *errors = nullptr;
3636  TDirectory *errorsAr = nullptr;
3637  bool iserrors = false;
3638  bool iserrorsAr = false;
3639  if (file->FindKey("ErrorsAr"))
3640  {
3641  errorsAr = (TDirectory *)file->FindKey("ErrorsAr")->ReadObj();
3642  if (errorsAr != nullptr)
3643  iserrorsAr = true;
3644  }
3645  if (file->FindKey("Errors"))
3646  {
3647  errors = (TDirectory *)file->FindKey("Errors")->ReadObj();
3648  if (errors != nullptr)
3649  iserrors = true;
3650  }
3651 
3652  // double ratiotrt = 0;
3653  double ratioba = 0;
3654  double ratiobc = 0;
3655  double ratioea = 0;
3656  double ratioec = 0;
3657  // TH2F *residual_trt = nullptr;
3658  // TH2F *residual_ba = nullptr;
3659  // TH2F *residual_bc = nullptr;
3660  TH2F *residual_ea = nullptr;
3661  TH2F *residual_ec = nullptr;
3662 
3663  // TH2F *residual_trtP = nullptr;
3664  // TH2F *residual_baP = nullptr;
3665  // TH2F *residual_bcP = nullptr;
3666  TH2F *residual_eaP = nullptr;
3667  TH2F *residual_ecP = nullptr;
3668 
3669  // TH2F *residualAr_trt = nullptr;
3670  TH2F *residualAr_ba = nullptr;
3671  TH2F *residualAr_bc = nullptr;
3672  TH2F *residualAr_ea = nullptr;
3673  TH2F *residualAr_ec = nullptr;
3674 
3675  // TH2F *residualAr_trtP = nullptr;
3676  TH2F *residualAr_baP = nullptr;
3677  TH2F *residualAr_bcP = nullptr;
3678  TH2F *residualAr_eaP = nullptr;
3679  TH2F *residualAr_ecP = nullptr;
3680 
3681  if (iserrors && errors->FindKey("tresidual_trt") && errors->FindKey("tresidual_trtP"))
3682  {
3683  // residual_trt = (TH2F *)errors->FindKey("tresidual_trt")->ReadObj();
3684  if (errors->FindKey("tresidual_ea"))
3685  residual_ea = (TH2F *)errors->FindKey("tresidual_ea")->ReadObj();
3686  if (errors->FindKey("tresidual_ec"))
3687  residual_ec = (TH2F *)errors->FindKey("tresidual_ec")->ReadObj();
3688 
3689  // residual_trtP = (TH2F *)errors->FindKey("tresidual_trtP")->ReadObj();
3690  if (errors->FindKey("tresidual_eaP"))
3691  residual_eaP = (TH2F *)errors->FindKey("tresidual_eaP")->ReadObj();
3692  if (errors->FindKey("tresidual_ecP"))
3693  residual_ecP = (TH2F *)errors->FindKey("tresidual_ecP")->ReadObj();
3694  }
3695  else
3696  {
3697  cout << " No time residual histograms in endcaps: tresidual_trt and tresidual_trtP " << endl;
3698  }
3699  if (iserrorsAr && errorsAr->FindKey("tresidualAr_trt") && errorsAr->FindKey("tresidualAr_trtP"))
3700  {
3701  // residualAr_trt = (TH2F *)errorsAr->FindKey("tresidualAr_trt")->ReadObj();
3702  if (errorsAr->FindKey("tresidualAr_ba"))
3703  residualAr_ba = (TH2F *)errorsAr->FindKey("tresidualAr_ba")->ReadObj();
3704  if (errorsAr->FindKey("tresidualAr_bc"))
3705  residualAr_bc = (TH2F *)errorsAr->FindKey("tresidualAr_bc")->ReadObj();
3706  if (errorsAr->FindKey("tresidualAr_ea"))
3707  residualAr_ea = (TH2F *)errorsAr->FindKey("tresidualAr_ea")->ReadObj();
3708  if (errorsAr->FindKey("tresidualAr_ec"))
3709  residualAr_ec = (TH2F *)errorsAr->FindKey("tresidualAr_ec")->ReadObj();
3710 
3711  // residualAr_trtP = (TH2F *)errorsAr->FindKey("tresidualAr_trtP")->ReadObj();
3712  if (errorsAr->FindKey("tresidualAr_baP"))
3713  residualAr_baP = (TH2F *)errorsAr->FindKey("tresidualAr_baP")->ReadObj();
3714  if (errorsAr->FindKey("tresidualAr_bcP"))
3715  residualAr_bcP = (TH2F *)errorsAr->FindKey("tresidualAr_bcP")->ReadObj();
3716  if (errorsAr->FindKey("tresidualAr_eaP"))
3717  residualAr_eaP = (TH2F *)errorsAr->FindKey("tresidualAr_eaP")->ReadObj();
3718  if (errorsAr->FindKey("tresidualAr_ecP"))
3719  residualAr_ecP = (TH2F *)errorsAr->FindKey("tresidualAr_ecP")->ReadObj();
3720  }
3721  else
3722  {
3723  cout << " No time residual histograms for Argon layers : tresidualAr_trt and tresidualAr_trtP " << endl;
3724  }
3725 
3726  // if (residual_trt && residual_trtP && residual_trt->GetEntries() > 0)
3727  // {
3728  // ratiotrt = (residual_trtP->GetEntries() + residualAr_trtP->GetEntries()) / (residual_trt->GetEntries() + residualAr_trt->GetEntries());
3729  // }
3730  if (residualAr_ba && residualAr_baP && residualAr_ba->GetEntries() > 0)
3731  {
3732  ratioba = residualAr_baP->GetEntries() / residualAr_ba->GetEntries();
3733  }
3734  if (residualAr_bc && residualAr_bcP && residualAr_ea && residualAr_bc->GetEntries() > 0)
3735  {
3736  ratiobc = residualAr_bcP->GetEntries() / residualAr_bc->GetEntries();
3737  }
3738  if (residual_ea && residual_eaP && residualAr_ea && residualAr_eaP && residual_ea->GetEntries() > 0)
3739  {
3740  ratioea = (residual_eaP->GetEntries() + residualAr_eaP->GetEntries()) / (residual_ea->GetEntries() + residualAr_ea->GetEntries());
3741  }
3742  if (residual_ec && residualAr_ecP &&residualAr_ec && residual_ec->GetEntries() > 0)
3743  {
3744  ratioec = (residual_ecP->GetEntries() + residualAr_ecP->GetEntries()) / (residual_ec->GetEntries() + residualAr_ec->GetEntries());
3745  }
3746 
3747  pt->AddText("Barrels:");
3748  pt->AddText(Form(" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (int)bhitst[0], rest[0], trest[0]));
3749  pt->AddText(Form(" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[0], ratioba));
3750  pt->AddText(Form(" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (int)bhitst[2], rest[2], trest[2]));
3751  pt->AddText(Form(" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[2], ratiobc));
3752  pt->AddText(" Endcaps:");
3753  pt->AddText(Form(" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns", (int)bhitst[1], rest[1], trest[1]));
3754  pt->AddText(Form(" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[1], ratioea));
3755  pt->AddText(Form(" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns", (int)bhitst[3], rest[3], trest[3]));
3756  pt->AddText(Form(" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[3], ratioec));
3757 
3758  pt->SetLabel(Form("TRT calibration iteration summary"));
3759 
3760  pt->Draw();
3761 }

Member Data Documentation

◆ iter

int FirstPage::iter = 0

Definition at line 3533 of file TRTCalib_makeplots.cxx.

◆ runnumber

float FirstPage::runnumber = 0

Definition at line 3532 of file TRTCalib_makeplots.cxx.

◆ t0offset

float FirstPage::t0offset = 0

Definition at line 3532 of file TRTCalib_makeplots.cxx.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
FirstPage::iter
int iter
Definition: TRTCalib_makeplots.cxx:3533
FirstPage::runnumber
float runnumber
Definition: TRTCalib_makeplots.cxx:3532
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
file
TFile * file
Definition: tile_monitor.h:29
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
calibdata.cd
cd
Definition: calibdata.py:51
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24