diff --git a/core/base/CbmHistManager.cxx b/core/base/CbmHistManager.cxx index 3e0e575b75c41b415d63d5b5773bcdf084f32d5c..19dc3be1cc63057f927edcc103cd712561dd8a3c 100644 --- a/core/base/CbmHistManager.cxx +++ b/core/base/CbmHistManager.cxx @@ -94,6 +94,31 @@ vector<TProfile*> CbmHistManager::P1Vector(const string& pattern) const { return vector<TProfile2D*> CbmHistManager::P2Vector(const string& pattern) const { return ObjectVector<TProfile2D*>(pattern); } + +template<class T> +vector<T> CbmHistManager::ObjectVector(const vector<string>& names) const +{ + vector<T> objects; + for (const string& name : names) { + objects.push_back(dynamic_cast<T>(fMap.find(name)->second)); + } + return objects; +} +vector<TH1*> CbmHistManager::H1Vector(const vector<string>& names) const { return ObjectVector<TH1*>(names); } + +vector<TH2*> CbmHistManager::H2Vector(const vector<string>& names) const { return ObjectVector<TH2*>(names); } + +vector<TGraph*> CbmHistManager::G1Vector(const vector<string>& names) const { return ObjectVector<TGraph*>(names); } + +vector<TGraph2D*> CbmHistManager::G2Vector(const vector<string>& names) const { return ObjectVector<TGraph2D*>(names); } + +vector<TProfile*> CbmHistManager::P1Vector(const vector<string>& names) const { return ObjectVector<TProfile*>(names); } + +vector<TProfile2D*> CbmHistManager::P2Vector(const vector<string>& names) const +{ + return ObjectVector<TProfile2D*>(names); +} + void CbmHistManager::WriteToFile() { map<string, TNamed*>::iterator it; diff --git a/core/base/CbmHistManager.h b/core/base/CbmHistManager.h index 390a5a86b7ed56067981d29591f109e0e14f37a5..65e39fd098b1de946d74d84979f527eb54cd1fe7 100644 --- a/core/base/CbmHistManager.h +++ b/core/base/CbmHistManager.h @@ -177,7 +177,7 @@ public: /** * \brief Return pointer to TH1 histogram. - * \param[in] name Name of histogram. + * \param[in] name Name of TH1 histogram. * \return pointer to TH1 histogram. */ TH1* H1(const std::string& name) const @@ -189,16 +189,31 @@ public: return dynamic_cast<TH1*>(fMap.find(name)->second); } + /** + * \brief Return clone of TH1 histogram. + * \param[in] name Name of TH1 histogram. + * \return pointer of TH1 clone histogram. + */ + TH1* H1Clone(const std::string& name) const { return static_cast<TH1*>(H1(name)->Clone()); } + + /** + * \brief Return vector of pointers to TH1 histogram. + * \param[in] names Vector of TH1 histogram names. + * \return Vector of pointers to TH1 histogram. + */ + std::vector<TH1*> H1Vector(const std::vector<std::string>& names) const; + + /** * \brief Return vector of pointers to TH1 histogram. - * \param[in] pattern Regex for histogram name. + * \param[in] pattern Regex for TH1 histogram name. * \return Vector of pointers to TH1 histogram. */ std::vector<TH1*> H1Vector(const std::string& pattern) const; /** * \brief Return pointer to TH2 histogram. - * \param[in] name Name of histogram. + * \param[in] name Name of TH2 histogram. * \return pointer to TH2 histogram. */ TH2* H2(const std::string& name) const @@ -210,16 +225,30 @@ public: return dynamic_cast<TH2*>(fMap.find(name)->second); } + /** + * \brief Return clone of TH2 histogram. + * \param[in] name Name of TH2 histogram. + * \return pointer of TH2 clone histogram. + */ + TH2* H2Clone(const std::string& name) const { return static_cast<TH2*>(H2(name)->Clone()); } + /** * \brief Return vector of pointers to TH2 histogram. - * \param[in] pattern Regex for histogram name. + * \param[in] names Vector of TH2 histogram names. + * \return Vector of pointers to TH2 histogram. + */ + std::vector<TH2*> H2Vector(const std::vector<std::string>& names) const; + + /** + * \brief Return vector of pointers to TH2 histogram. + * \param[in] pattern Regex for TH2 histogram name. * \return Vector of pointers to TH2 histogram. */ std::vector<TH2*> H2Vector(const std::string& pattern) const; /** * \brief Return pointer to TH3 histogram. - * \param[in] name Name of histogram. + * \param[in] name Name of TH3 histogram. * \return pointer to TH3 histogram. */ TH3* H3(const std::string& name) const @@ -231,9 +260,16 @@ public: return dynamic_cast<TH3*>(fMap.find(name)->second); } + /** + * \brief Return clone of TH3 histogram. + * \param[in] name Name of TH3 histogram. + * \return pointer of TH3 clone histogram. + */ + TH3* H3Clone(const std::string& name) const { return static_cast<TH3*>(H3(name)->Clone()); } + /** * \brief Return pointer to TGraph. - * \param[in] name Name of graph. + * \param[in] name Name of TGraph. * \return pointer to TGraph. */ TGraph* G1(const std::string& name) const @@ -247,15 +283,22 @@ public: /** * \brief Return vector of pointers to TGraph. - * \param[in] pattern Regex for object name. + * \param[in] names Vector of TGraph names. + * \return Vector of pointers to TGraph. + */ + std::vector<TGraph*> G1Vector(const std::vector<std::string>& names) const; + + /** + * \brief Return vector of pointers to TGraph. + * \param[in] pattern Regex for TGraph name. * \return Vector of pointers to TGraph. */ std::vector<TGraph*> G1Vector(const std::string& pattern) const; /** * \brief Return pointer to TGraph2D. - * \param[in] name Name of graph. - * \return pointer to TGraph. + * \param[in] name Name of TGraph2D. + * \return pointer to TGraph2D. */ TGraph2D* G2(const std::string& name) const { @@ -268,14 +311,21 @@ public: /** * \brief Return vector of pointers to TGraph2D. - * \param[in] pattern Regex for object name. + * \param[in] names Vector of TGraph2D names. + * \return Vector of pointers to TGraph2D. + */ + std::vector<TGraph2D*> G2Vector(const std::vector<std::string>& names) const; + + /** + * \brief Return vector of pointers to TGraph2D. + * \param[in] pattern Regex for TGraph2D name. * \return Vector of pointers to TGraph2D. */ std::vector<TGraph2D*> G2Vector(const std::string& pattern) const; /** * \brief Return pointer to TProfile. - * \param[in] name Name of profile. + * \param[in] name Name of TProfile. * \return pointer to TProfile. */ TProfile* P1(const std::string& name) const @@ -289,15 +339,22 @@ public: /** * \brief Return vector of pointers to TProfile. - * \param[in] pattern Regex for profile name. + * \param[in] names Vector of TProfile names. + * \return Vector of pointers to TProfile. + */ + std::vector<TProfile*> P1Vector(const std::vector<std::string>& names) const; + + /** + * \brief Return vector of pointers to TProfile. + * \param[in] pattern Regex for TProfile name. * \return Vector of pointers to TProfile. */ std::vector<TProfile*> P1Vector(const std::string& pattern) const; /** - * \brief Return pointer to TH2 histogram. - * \param[in] name Name of histogram. - * \return pointer to TH1 histogram. + * \brief Return pointer to TProfile2D. + * \param[in] name Name of TProfile2D. + * \return pointer to TProfile2D. */ TProfile2D* P2(const std::string& name) const { @@ -310,20 +367,27 @@ public: /** * \brief Return vector of pointers to TProfile2D. - * \param[in] pattern Regex for profile name. + * \param[in] names Vector of TProfile2D names. + * \return Vector of pointers to TProfile2D. + */ + std::vector<TProfile2D*> P2Vector(const std::vector<std::string>& names) const; + + /** + * \brief Return vector of pointers to TProfile2D. + * \param[in] pattern Regex for TProfile2D name. * \return Vector of pointers to TProfile2D. */ std::vector<TProfile2D*> P2Vector(const std::string& pattern) const; /** - * \brief Check existence of histogram in manager. - * \param[in] name Name of histogram. - * \return True if histogram exists in manager. + * \brief Check existence of object in manager. + * \param[in] name Name of object. + * \return True if object exists in manager. */ Bool_t Exists(const std::string& name) const { return (fMap.count(name) == 0) ? false : true; } /** - * \brief Write all histograms to current opened file. + * \brief Write all objects to current opened file. */ void WriteToFile(); @@ -449,6 +513,9 @@ private: template<class T> std::vector<T> ObjectVector(const std::string& pattern) const; + template<class T> + std::vector<T> ObjectVector(const std::vector<std::string>& names) const; + std::map<std::string, TNamed*> fMap; // Map of histogram (graph) name to its pointer std::vector<TCanvas*> fCanvases; // Pointers to all created canvases diff --git a/macro/rich/CbmRichHitsProd.C b/macro/rich/CbmRichHitsProd.C deleted file mode 100644 index fb79a9c7842aa77839e133b0ff400a86bb336010..0000000000000000000000000000000000000000 --- a/macro/rich/CbmRichHitsProd.C +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (C) 2006-2009 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Denis Bertini [committer], Claudia Höhne */ - -/* $Id: CbmRichHitsProd.C,v 1.8 2006/09/15 12:50:52 turany Exp $ */ - - -{ - - - // this macro read an input Tree structure - // from simulation and generate an output - // tree containing collections of RichHits - - // ======================================================================== - // Adjust this part according to your requirements - - - // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) - Int_t iVerbose = 1; - - // Number of events to process - Int_t nEvents = 10; - - // Input file (MC events) - TString inFile = "../run/test.mc.root"; - - // Parameter file - TString parFile = "../run/params.root"; - - // Output file - TString outFile = "test.richhits.root"; - - // In general, the following parts need not be touched - // ======================================================================== - - TStopwatch timer; - timer.Start(); - - // ---- Load libraries ------------------------------------------------- - gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); - basiclibs(); - gSystem->Load("libGeoBase"); - gSystem->Load("libParBase"); - gSystem->Load("libBase"); - gSystem->Load("libCbmBase"); - gSystem->Load("libCbmData"); - gSystem->Load("libField"); - gSystem->Load("libGen"); - gSystem->Load("libPassive"); - gSystem->Load("libMvd"); - gSystem->Load("libSts"); - gSystem->Load("libRich"); - gSystem->Load("libTrd"); - gSystem->Load("libTof"); - gSystem->Load("libEcal"); - gSystem->Load("libGlobal"); - gSystem->Load("libKF"); - gSystem->Load("libL1"); - // ------------------------------------------------------------------------ - - FairRunAna* fRun = new FairRunAna(); - fRun->SetInputFile(inFile); - fRun->SetOutputFile(outFile); - - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - FairParRootFileIo* io1 = new FairParRootFileIo(); - io1->open(parFile.Data()); - rtdb->setFirstInput(io1); - - // ------- Parameters for photodetector ------------------------- - Double_t pmt_rad = 0.4; // PMT radius (cm) - Double_t pmt_dist = 0.; // distance between PMTs (cm) - Int_t det_type = 4; // detector type (choose: 1=Protvino, 2=Hamamatsu, 3=CsI) - Int_t noise = 220; // number of noise points to be added - // (note: excluding geom. eff. (~0.9)) - - // define RichHitProducer to run - CbmRichHitProducer* hp = new CbmRichHitProducer(pmt_rad, pmt_dist, det_type, noise, iVerbose); - fRun->AddTask(hp); - - - // ----- Intialise and run -------------------------------------------- - fRun->Init(); - fRun->Run(0, nEvents); - - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime); -} diff --git a/macro/rich/CbmRichTestHits.C b/macro/rich/CbmRichTestHits.C deleted file mode 100644 index c89023718c38a5c386715ae262a1b495d3d759b9..0000000000000000000000000000000000000000 --- a/macro/rich/CbmRichTestHits.C +++ /dev/null @@ -1,253 +0,0 @@ -/* Copyright (C) 2006-2009 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Denis Bertini [committer] */ - -/*************************************************************** -* $Id: CbmRichTestHits.C,v 1.3 2006/06/22 07:18:07 hoehne Exp $ -* -* This macro gives typical plots for RICH HitProducer -* in order to make a fast check whether the Rich HitProducer -* ran correctly -* -* C. Hoehne (c.hoehne@gsi.de) -* -* -**************************************************************/ - - -{ - - // ======================================================================== - // Adjust this part according to your requirements - - // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) - Int_t iVerbose = 1; - - // Number of events to process - Int_t nEvents = 10; - - // Input file (MC events) - TString inFile = "../run/data/test.mc.root"; - - // Input file (Hits or reconstructed data) - TString hitFile = "../run/data/test.eds.root"; - - // Parameter file - TString parFile = "../run/data/params.root"; - - // Output file - TString outFile = "TestRichHits.root"; - - // Output file with most important histograms and numbers for printout - TString psFile = "TestRichHits.ps"; - - // In general, the following parts need not be touched - // ======================================================================== - - // timer - TStopwatch timer; - timer.Start(); - - // ---- Load libraries ------------------------------------------------- - gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); - basiclibs(); - gSystem->Load("libGeoBase"); - gSystem->Load("libParBase"); - gSystem->Load("libBase"); - gSystem->Load("libCbmBase"); - gSystem->Load("libCbmData"); - gSystem->Load("libField"); - gSystem->Load("libGen"); - gSystem->Load("libPassive"); - gSystem->Load("libMvd"); - gSystem->Load("libSts"); - gSystem->Load("libRich"); - gSystem->Load("libTrd"); - gSystem->Load("libTof"); - gSystem->Load("libEcal"); - gSystem->Load("libGlobal"); - gSystem->Load("libKF"); - gSystem->Load("libL1"); - // ------------------------------------------------------------------------ - - - FairRunAna* fRun = new FairRunAna(); - fRun->SetInputFile(inFile); - //fRun->AddFile(inFile2); - fRun->AddFriend(hitFile); - fRun->SetOutputFile(outFile); - - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - FairParRootFileIo* io1 = new FairParRootFileIo(); - io1->open(parFile.Data()); - rtdb->setFirstInput(io1); - - // ---- define TestHits task to run --------- - CbmRichTestHits* tsim = new CbmRichTestHits("RichTestHits", "RichTestHits", iVerbose); - fRun->AddTask(tsim); - - // ----- Intialise and run -------------------------------------------- - fRun->Init(); - fRun->Run(0, nEvents); - - delete tsim; - - //------------ draw Histos, save plot ------------------------------------------------ - - gROOT->SetStyle("Plain"); - gStyle->SetOptStat(0000); - gStyle->SetPalette(1, 0); - - gStyle->SetPadBorderMode(0); - // gStyle->SetOptTitle(0); - gStyle->SetOptStat(0); - gStyle->SetOptFit(0); - //gStyle->SetStatW(0.3); - //gStyle->SetStatH(0.01); - gStyle->SetTitleW(0.); - gStyle->SetStatColor(10); - gStyle->SetStatBorderSize(1); - gStyle->SetStatX(0.9); - gStyle->SetStatY(0.90); - gStyle->SetTitleOffset(0.5, "x"); - gStyle->SetTitleOffset(0.5, "y"); - gStyle->SetTitleOffset(0.5, "z"); - gSystem->Load("libPostscript.so"); - - // TLatex *t1 = new TLatex(220,7.2,"#frac{dN}{d#lambda}=#frac{2#pi#alpha}{#lambda ^{2}} (1-#frac{1}{#beta^{2}n^{2}}) L"); - // t1->Draw(); - - - TCanvas* c1 = new TCanvas("c1", "Canvas", 768, 1024); - ps = new TPostScript(psFile, -111); - // ps->Range(768,1024); - - c1->SetBottomMargin(0.11); - c1->SetTopMargin(0.11); - c1->SetTicks(0, 0); - c1->SetFillColor(10); - c1->SetGrid(0, 0); - - TPaveLabel* title = new TPaveLabel(0.1, 0.92, 0.9, 0.98, "Test RICH HitProducer for file " + hitFile); - title->SetFillColor(10); - title->SetLineStyle(1); - title->Draw(); - - TPad* pad1 = new TPad("pad1", "This is pad1", 0.02, 0.6, 0.48, 0.9); - TPad* pad2 = new TPad("pad2", "This is pad2", 0.52, 0.6, 0.98, 0.9); - TPad* pad3 = new TPad("pad3", "This is pad3", 0.02, 0.3, 0.48, 0.6); - TPad* pad4 = new TPad("pad4", "This is pad4", 0.52, 0.3, 0.98, 0.6); - TPad* pad5 = new TPad("pad5", "This is pad5", 0.02, 0.0, 0.48, 0.3); - TPad* pad6 = new TPad("pad6", "This is pad6", 0.52, 0.0, 0.98, 0.3); - - pad1->Draw(); - pad2->Draw(); - pad3->Draw(); - pad4->Draw(); - pad5->Draw(); - pad6->Draw(); - - pad1->cd(); - gPad->SetFillColor(10); - fh_Det1ev->GetXaxis()->SetTitle("x [cm]"); - fh_Det1ev->GetYaxis()->SetTitle("y [cm]"); - fh_Det1ev->Draw(); - - pad2->cd(); - gPad->SetFillColor(10); - pad2->SetLogz(); - fh_Detall->GetXaxis()->SetTitle("x [cm]"); - fh_Detall->GetYaxis()->SetTitle("y [cm]"); - fh_Detall->Draw("colz"); - - pad3->cd(); - gPad->SetFillColor(10); - pad3->SetLogz(); - fh_Detall_zoom->GetXaxis()->SetTitle("x [cm]"); - fh_Detall_zoom->GetYaxis()->SetTitle("y [cm]"); - fh_Detall_zoom->Draw("colz"); - - pad4->cd(); - gPad->SetFillColor(0); - Double_t ymax = fh_Nhits->GetMaximum(); - fh_Nhits->GetXaxis()->SetTitle("Nhits"); - fh_Nhits->Fit("gaus", "Q", "R", 0, 60); // Protvino - //fh_Nhits->Fit("gaus","Q","R",10,30); // CsI - //fh_Nhits->Fit("gaus","Q","R",6,20); // Hamamatsu - fh_Nhits->Draw("same"); - fh_Nhits->GetFunction("gaus"); - Double_t par[3]; - gaus->GetParameters(par); - - char t1[300]; - Double_t y = ymax * 0.95; - sprintf(t1, "\t Mean number of hits/rings %3.2f\n", par[1]); - TLatex* t2 = new TLatex(2, y, t1); - t2->Draw(); - sprintf(t1, "\t Sigma %3.2f\n", par[2]); - TLatex* t2 = new TLatex(2, y * 0.9, t1); - t2->Draw(); - - - pad5->cd(); - gPad->SetFillColor(10); - pad5->SetLogz(); - fh_n_vs_p->GetXaxis()->SetTitle("p [GeV/c]"); - fh_n_vs_p->GetYaxis()->SetTitle("Nhits"); - fh_n_vs_p->Draw("colz"); - - pad6->cd(); - gPad->SetFillColor(10); - - Double_t Nall = fh_Nall->GetMean(); - Double_t Nel = fh_Nel->GetMean(); - Double_t Nelprim = fh_Nelprim->GetMean(); - Double_t Npi = fh_Npi->GetMean(); - Double_t Nk = fh_Nk->GetMean(); - Double_t Nhad = fh_Nhad->GetMean(); - Double_t Nnoise = fh_Nnoise->GetMean(); - - TPaveText* info = new TPaveText(0.1, 0.1, 0.9, 0.9); - info->SetFillColor(10); - info->SetBorderSize(0); - info->SetTextAlign(1); - info->Draw(); - - char t1[300]; - sprintf(t1, "\t Mean number of rings/event for "); - info->AddText(0.05, 0.9, t1); - sprintf(t1, "\t all %3.2f\n", Nall); - info->AddText(0.05, 0.7, t1); - sprintf(t1, "\t electrons %3.2f\n", Nel); - info->AddText(0.05, 0.6, t1); - sprintf(t1, "\t electrons (STS>6) %3.2f\n", Nelprim); - info->AddText(0.05, 0.5, t1); - sprintf(t1, "\t pions %3.2f\n", Npi); - info->AddText(0.05, 0.4, t1); - sprintf(t1, "\t Kaons %3.2f\n", Nk); - info->AddText(0.05, 0.3, t1); - sprintf(t1, "\t Mean number of crossing hadrons %3.2f\n", Nhad); - info->AddText(0.05, 0.1, t1); - sprintf(t1, "\t Mean number of noise hits %3.2f\n", Nnoise); - info->AddText(0.05, 0., t1); - info->Draw(); - - ps->Close(); - - - // ------------------------------------------------------------------------ - - // ----- Finish ------------------------------------------------------- - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - cout << endl << endl; - cout << "Macro finished succesfully." << endl; - cout << "Output file is " << outFile << endl; - cout << "Parameter file is " << parFile << endl; - cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; - cout << endl; - // ------------------------------------------------------------------------ - - -} // macro ends here diff --git a/macro/rich/CbmRichTestSim.C b/macro/rich/CbmRichTestSim.C deleted file mode 100644 index 2171427ab35f65b6a40fa8c91eecc4ebf787dde8..0000000000000000000000000000000000000000 --- a/macro/rich/CbmRichTestSim.C +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright (C) 2006-2009 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Denis Bertini [committer] */ - -/*************************************************************** -* $Id: CbmRichTestSim.C,v 1.5 2006/09/15 12:50:53 turany Exp $ -* -* This macro gives typical plots for RICH simulation -* in order to make a fast check whether the Rich detector -* is properly simulated -* -* C. Hoehne (c.hoehne@gsi.de) -* -* -**************************************************************/ - - -{ - - // ======================================================================== - // Adjust this part according to your requirements - - // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) - Int_t iVerbose = 1; - - // Number of events to process - Int_t nEvents = 1; - - // Input file (MC events) - TString inFile = "../run/data/test.mc.root"; - - - // Parameter file - TString parFile = "../run/data/params.root"; - - // Output file - TString outFile = "test.mc.RichTestSim.root"; - - // Output file with most important histograms and numbers for printout - TString psFile = "test.mc.RichTestSim.ps"; - - // In general, the following parts need not be touched - // ======================================================================== - - // timer - TStopwatch timer; - timer.Start(); - - // ---- Load libraries ------------------------------------------------- - gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); - basiclibs(); - gSystem->Load("libGeoBase"); - gSystem->Load("libParBase"); - gSystem->Load("libBase"); - gSystem->Load("libCbmBase"); - gSystem->Load("libCbmData"); - gSystem->Load("libField"); - gSystem->Load("libGen"); - gSystem->Load("libPassive"); - gSystem->Load("libMvd"); - gSystem->Load("libSts"); - gSystem->Load("libRich"); - gSystem->Load("libTrd"); - gSystem->Load("libTof"); - gSystem->Load("libEcal"); - gSystem->Load("libGlobal"); - gSystem->Load("libKF"); - gSystem->Load("libL1"); - // ------------------------------------------------------------------------ - - FairRunAna* fRun = new FairRunAna(); - fRun->SetInputFile(inFile); - //fRun->AddFile(inFile2); - fRun->SetOutputFile(outFile); - - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - FairParRootFileIo* io1 = new FairParRootFileIo(); - io1->open(parFile.Data()); - rtdb->setFirstInput(io1); - - // ---- define TestSim task to run --------- - CbmRichTestSim* tsim = new CbmRichTestSim("RichTestSim", "RichTestSim", iVerbose); - fRun->AddTask(tsim); - - // ----- Intialise and run -------------------------------------------- - fRun->Init(); - fRun->Run(0, nEvents); - - delete tsim; - - //------------ draw Histos, save plot ------------------------------------------------ - - gROOT->SetStyle("Plain"); - gStyle->SetOptStat(0000); - gStyle->SetPalette(1, 0); - - gStyle->SetPadBorderMode(0); - // gStyle->SetOptTitle(0); - gStyle->SetOptStat(0); - gStyle->SetOptFit(0); - //gStyle->SetStatW(0.3); - //gStyle->SetStatH(0.01); - gStyle->SetTitleW(0.); - gStyle->SetStatColor(10); - gStyle->SetStatBorderSize(1); - gStyle->SetStatX(0.9); - gStyle->SetStatY(0.90); - gStyle->SetTitleOffset(0.5, "x"); - gStyle->SetTitleOffset(0.5, "y"); - gStyle->SetTitleOffset(0.5, "z"); - gSystem->Load("libPostscript.so"); - - // TLatex *t1 = new TLatex(220,7.2,"#frac{dN}{d#lambda}=#frac{2#pi#alpha}{#lambda ^{2}} (1-#frac{1}{#beta^{2}n^{2}}) L"); - // t1->Draw(); - - - TCanvas* c1 = new TCanvas("c1", "Canvas", 768, 1024); - ps = new TPostScript(psFile, -111); - // ps->Range(768,1024); - - c1->SetBottomMargin(0.11); - c1->SetTopMargin(0.11); - c1->SetTicks(0, 0); - c1->SetFillColor(10); - c1->SetGrid(0, 0); - - TPaveLabel* title = new TPaveLabel(0.1, 0.92, 0.9, 0.98, "Test RICH for file " + inFile); - title->SetFillColor(10); - title->SetLineStyle(1); - title->Draw(); - - TPad* pad1 = new TPad("pad1", "This is pad1", 0.02, 0.6, 0.48, 0.9); - TPad* pad2 = new TPad("pad2", "This is pad2", 0.52, 0.6, 0.98, 0.9); - TPad* pad3 = new TPad("pad3", "This is pad3", 0.02, 0.3, 0.48, 0.6); - TPad* pad4 = new TPad("pad4", "This is pad4", 0.52, 0.3, 0.98, 0.6); - TPad* pad5 = new TPad("pad5", "This is pad5", 0.02, 0.0, 0.48, 0.3); - TPad* pad6 = new TPad("pad6", "This is pad6", 0.52, 0.0, 0.98, 0.3); - - pad1->Draw(); - pad2->Draw(); - pad3->Draw(); - pad4->Draw(); - pad5->Draw(); - pad6->Draw(); - - pad1->cd(); - gPad->SetFillColor(10); - fh_Det1ev->GetXaxis()->SetTitle("x [cm]"); - fh_Det1ev->GetYaxis()->SetTitle("y [cm]"); - fh_Det1ev->Draw(); - - pad2->cd(); - gPad->SetFillColor(10); - pad2->SetLogz(); - fh_Detall->GetXaxis()->SetTitle("x [cm]"); - fh_Detall->GetYaxis()->SetTitle("y [cm]"); - fh_Detall->Draw("colz"); - - pad3->cd(); - gPad->SetFillColor(10); - pad3->SetLogz(); - fh_v_el->GetXaxis()->SetTitle("z [cm]"); - fh_v_el->GetYaxis()->SetTitle("y [cm]"); - fh_v_el->Draw("colz"); - - pad4->cd(); - gPad->SetFillColor(10); - pad4->SetLogy(); - fh_v_el->ProjectionX()->GetXaxis()->SetTitle("z [cm]"); - fh_v_el->ProjectionX()->Draw(); - - pad5->cd(); - gPad->SetFillColor(10); - pad5->SetLogz(); - fh_n_vs_p->GetXaxis()->SetTitle("p [GeV/c]"); - fh_n_vs_p->GetYaxis()->SetTitle("Npoints"); - fh_n_vs_p->Draw("colz"); - - pad6->cd(); - gPad->SetFillColor(10); - - Double_t Nall = fh_Nall->GetMean(); - Double_t Nel = fh_Nel->GetMean(); - Double_t Nelprim = fh_Nelprim->GetMean(); - Double_t Npi = fh_Npi->GetMean(); - Double_t Nk = fh_Nk->GetMean(); - Double_t Nhad = fh_Nhad->GetMean(); - - TPaveText* info = new TPaveText(0.1, 0.1, 0.9, 0.9); - info->SetFillColor(10); - info->SetBorderSize(0); - info->SetTextAlign(1); - info->Draw(); - - char t1[300]; - sprintf(t1, "\t Mean number of rings/event for "); - info->AddText(0.05, 0.9, t1); - sprintf(t1, "\t all %3.2f\n", Nall); - info->AddText(0.05, 0.7, t1); - sprintf(t1, "\t electrons %3.2f\n", Nel); - info->AddText(0.05, 0.6, t1); - sprintf(t1, "\t electrons (STS>6) %3.2f\n", Nelprim); - info->AddText(0.05, 0.5, t1); - sprintf(t1, "\t pions %3.2f\n", Npi); - info->AddText(0.05, 0.4, t1); - sprintf(t1, "\t Kaons %3.2f\n", Nk); - info->AddText(0.05, 0.3, t1); - sprintf(t1, "\t Mean number of crossing hadrons %3.2f\n", Nhad); - info->AddText(0.05, 0.1, t1); - info->Draw(); - - ps->Close(); - - - // ------------------------------------------------------------------------ - - // ----- Finish ------------------------------------------------------- - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - cout << endl << endl; - cout << "Macro finished succesfully." << endl; - cout << "Output file is " << outFile << endl; - cout << "Parameter file is " << parFile << endl; - cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; - cout << endl; - // ------------------------------------------------------------------------ - - -} // macro ends here diff --git a/macro/rich/RICH_readme.txt b/macro/rich/RICH_readme.txt deleted file mode 100644 index 6f8239d91008aceeb305305d0719cca8bb54025c..0000000000000000000000000000000000000000 --- a/macro/rich/RICH_readme.txt +++ /dev/null @@ -1,42 +0,0 @@ - - Claudia Höhne - GSI, 28 Oct 2005 - - -==================================================== -How to create new RICH geometry files for studies on -the RICH layout optimization: -==================================================== - ---> See presentation at the Simulation Workgroup meeting, October 28, 2005 - - "Geometry of the RICH detector in cbmroot2" - http://www.gsi.de/documents/DOC-2005-Nov-4-2.pdf - -The macro and an example RICH geometry file (input and output) can be found -in the "geometry" folder of cbmroot2. The input file (*.dat) contains basic -geometry parameters of the RICH detector from which the macro calculates the -*.geo file to be used in CBM detector simulations. - -macro: cbmroot2/geometry/create_RICH_geo_file.C -inputfile: cbmroot2/geometry/rich-L2900-N2-angleM0-angleD0.dat -outputfile: cbmroot2/geometry/rich-L2900-N2-angleM0-angleD0.geo - -Use in root like: -root> .L create_RICH_geo_file.C -root> create_RICH_geo_file("rich-L2900-N2-angleM0-angleD0") - -attention: -A change in the RICH detector position and length requires a change in the pipe.geo -file because in order to avoid overlaps the pipe is implemented in the RICH geo-file -and cut out in the pipe geo-file. A warning and the required lines for the pipe.geo -file is given out by the macro. - -In case of problems please feel free to ask. - --- -Dr. Claudia Höhne -Gesellschaft fuer Schwerionenforschung (GSI) -mail c.hoehne@gsi.de - - diff --git a/macro/rich/cbmlibs.C b/macro/rich/cbmlibs.C deleted file mode 100644 index 71ce17d62ed074d1e03a55775f85729001f4598f..0000000000000000000000000000000000000000 --- a/macro/rich/cbmlibs.C +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2009-2013 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer] */ - -void cbmlibs() -{ - - gSystem->Load("libboost_regex"); - gSystem->Load("libboost_regex"); - - gSystem->Load("libGeoBase"); - gSystem->Load("libParBase"); - gSystem->Load("libBase"); - gSystem->Load("libCbmBase"); - gSystem->Load("libCbmData"); - gSystem->Load("libField"); - gSystem->Load("libGen"); - gSystem->Load("libPassive"); - gSystem->Load("libEcal"); - gSystem->Load("libSts"); - gSystem->Load("libKF"); - gSystem->Load("libMvd"); - gSystem->Load("libLittrack"); - gSystem->Load("libRich"); - gSystem->Load("libTrd"); - gSystem->Load("libTof"); - gSystem->Load("libGlobal"); - gSystem->Load("libL1"); - //gSystem->Load("libLittrack"); - gSystem->Load("libMuch"); - - gSystem->Load("libMinuit2"); // Nedded for rich ellipse fitter -} diff --git a/macro/rich/create_RICH_geo_file.C b/macro/rich/create_RICH_geo_file.C deleted file mode 100644 index 2d3407713856dae8b3719ac00588ac514edc7f51..0000000000000000000000000000000000000000 --- a/macro/rich/create_RICH_geo_file.C +++ /dev/null @@ -1,701 +0,0 @@ -/* Copyright (C) 2006-2008 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Denis Bertini [committer], Claudia Höhne */ - -void create_RICH_geo_file(char* geometry = "rich-2900-N2-0") -{ - char infile[256]; // geometry data file - input - char outfile[256]; // geometry data file for CBMROOT - output - char logfile[256]; // log file - - char dummy[200][10]; // dummy text - - Float_t zBarrel; // z-position RICH detector (start) - Float_t lBarrel; // length RICH barrel - Float_t dWindow; // thickness entrance and exit window, material: kapton - Float_t dVessel; // thickness gas vessel, material: aluminum - Float_t lRadiator; // length of radiator - char gas[20]; // radiator gas (see media.geo file) - - Float_t radius; // radius of mirror - Float_t dMirror; // thickness of mirror - char mirror[20]; // material of mirror (see media.geo file) - Float_t yBeam; // hole for beam in y (x=1.5*y) - Float_t angle; - - Float_t zPMT, yPMT; // z and y position photodetector plane - Float_t dx, dy; // x-y size of PMT plane - Float_t anglePMTx; // angle photodetector plane (tilt around x-axis) - Float_t anglePMTy; // angle photodetector plane (tilt around y-axis) - Float_t dGlass; // thickness glass window of PMT tubes (PMTglass) - Float_t dCathode; // thickness photocathode (CsI) - Float_t lTube; // length PMT tube (air for eff. thickness) - Float_t dSupport; // effective thickness support structure (aluminum) - - Float_t xM, yM, xB1, xB2, yB; // x,y sizes for mirror and barrel - Float_t xE1, xE2, zI1, xI1, zI2, xI2; - Float_t r1, r2; - Float_t rE1, rE2, rI1, rI2, rC, rM; - Float_t theta1, theta2, phi1, phi2; // angles for mirror - Float_t theta3, phi3, phi4; - Float_t yMC, zMC; // center of mirror SPHE - - printf("\n"); - printf("geometry: %s\n", geometry); - printf("\n"); - - sprintf(infile, "%s.dat", geometry); - sprintf(outfile, "%s.geo", geometry); - sprintf(logfile, "%s.log", geometry); - printf("\n"); - - // read in input file (if existing) - printf("input file: %s\n", infile); - if (!fopen(infile, "r")) { - printf("... does not exist. \n"); - printf("... exit. \n\n"); - } - else { - - printf("output file: %s\n", outfile); - printf("logfile: %s\n", logfile); - printf("\n"); - printf("read in datafile:\n"); - printf("--------------------------------------------------------------\n"); - - FILE* fin = fopen(infile, "r"); - fscanf(fin, "%s %s", dummy[1], dummy[2]); - printf("%s %s\n", dummy[1], dummy[2]); - fscanf(fin, "%s %s %s %s %s %s", dummy[1], dummy[2], dummy[3], dummy[4], dummy[5], dummy[6]); - printf("%s %s %s %s %s %s\n", dummy[1], dummy[2], dummy[3], dummy[4], dummy[5], dummy[6]); - fscanf(fin, "%f %f %f %f %f %s", &zBarrel, &lBarrel, &dWindow, &dVessel, &lRadiator, gas); - printf("%6.2f %6.2f %6.2f %6.2f %6.2f %s\n", zBarrel, lBarrel, dWindow, dVessel, lRadiator, gas); - fscanf(fin, "%s %s", dummy[1], dummy[2]); - printf("%s %s\n", dummy[1], dummy[2]); - fscanf(fin, "%s %s %s %s %s", dummy[1], dummy[2], dummy[3], dummy[4], dummy[5]); - printf("%s %s %s %s %s\n", dummy[1], dummy[2], dummy[3], dummy[4], dummy[5]); - fscanf(fin, "%f %f %s %f %f", &radius, &dMirror, mirror, &yBeam, &angle); - printf("%6.2f %6.2f %s %6.2f %6.2f\n", radius, dMirror, mirror, yBeam, angle); - fscanf(fin, "%s %s %s", dummy[1], dummy[2], dummy[3]); - printf("%s %s %s\n", dummy[1], dummy[2], dummy[3]); - fscanf(fin, "%s %s %s %s %s %s %s %s %s %s", dummy[1], dummy[2], dummy[3], dummy[4], dummy[5], dummy[6], dummy[7], - dummy[8], dummy[9], dummy[10]); - printf("%s %s %s %s %s %s %s %s %s %s\n", dummy[1], dummy[2], dummy[3], dummy[4], dummy[5], dummy[6], dummy[7], - dummy[8], dummy[9], dummy[10]); - fscanf(fin, "%f %f %f %f %f %f %f %f %f %f", &zPMT, &yPMT, &dx, &dy, &anglePMTx, &anglePMTy, &dGlass, &dCathode, - &lTube, &dSupport); - printf("%6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n", zPMT, yPMT, dx, dy, anglePMTx, anglePMTy, - dGlass, dCathode, lTube, dSupport); - printf("--------------------------------------------------------------\n"); - printf("\n"); - fclose(fin); - - - //calculate parameters - - // size of RICH mirror (acceptance: 25 degree) - yM = (zBarrel + lRadiator + zPMT) * TMath::Tan(25. / 180. * TMath::Pi()); - xM = 1.5 * yM; - - // size of RICH barrel (front part in x smaller by 800mm) - yB = (zBarrel + lBarrel) * TMath::Tan(25. / 180. * TMath::Pi()) + 300.; - if (yB < (yPMT + dy)) yB = (yPMT + dy) + 100; - xB2 = 1.5 * yB; - xB1 = xB2 - 800.; - - // end entrance window in x - xE1 = (xB2 - xB1) / lBarrel * dWindow + xB1; - xE2 = (xB2 - xB1) / lBarrel * (lBarrel - dWindow) + xB1; - - // imaginary plane for registration of points needed for track extrapolation to PMTplane (distance to mirror: 900mm for angle=0) - // take care: necessary distance to mirror depends on angle! - // thickness 10mm - // start - zI1 = zPMT + lRadiator - 900.; - xI1 = (xB2 - xB1) / lBarrel * (zI1 - dWindow) + (xB1 - dVessel); - // end - zI2 = zPMT + lRadiator - 900. + 10.; - xI2 = (xB2 - xB1) / lBarrel * (zI2 - dWindow) + (xB1 - dVessel); - - // beam cone: - // at z=1600mm (end of STS beam-pipe) outer radius =32.5mm - // at end of RICH detector outer radius = 200.5mm - r1 = 32.5; - r2 = 200.5; - rC = 0.5; // thickness of carbon wall - rE1 = (r2 - r1) / lBarrel * dWindow + r1; - rE2 = (r2 - r1) / lBarrel * (lBarrel - dWindow) + r1; - rI1 = (r2 - r1) / lBarrel * zI1 + r1; - rI2 = (r2 - r1) / lBarrel * zI2 + r1; - // beam cone at mirror: - rM = (r2 - r1) / lBarrel * (lRadiator + zPMT) + r1; - if ((rM + 30.) > yBeam) yBeam = rM + 30.; // add 3cm for mirror support - if ((TMath::Tan(2.5 / 180. * TMath::Pi()) * (zBarrel + zPMT + lRadiator)) > yBeam) - yBeam = TMath::Tan(2.5 / 180. * TMath::Pi()) * (zBarrel + zPMT + lRadiator); // agreement: inner hole 2.5 degrees - - - printf("check pipe.geo! --> modify? \n"); - printf(" ... third last line of pipe1: %6.2f %6.2f %6.2f ?\n", zBarrel, r1 - rC, r1); - printf(" ... third last line of pipevac1: %6.2f 0. %6.2f ?\n", zBarrel, r1 - rC); - printf(" ... 4th line of pipe2: %6.2f 0. %6.2f ?\n", zBarrel + lBarrel, r2); - printf(" ... 4th line of pipevac2: %6.2f 0. %6.2f ?\n", zBarrel + lBarrel, r2 - rC); - printf("\n"); - - // mirror parameters (angles in degree for SPHE) - theta1 = (TMath::Pi() / 2. - TMath::ATan(yM / 2. / radius)) * 180. / TMath::Pi(); - theta2 = (TMath::Pi() / 2. + TMath::ATan(yM / 2. / radius)) * 180. / TMath::Pi(); - phi1 = (TMath::Pi() / 2. - TMath::ATan(xM / radius)) * 180. / TMath::Pi(); - phi2 = (TMath::Pi() / 2. + TMath::ATan(xM / radius)) * 180. / TMath::Pi(); - - theta3 = theta1 - TMath::ATan(yBeam / radius) * 180. / TMath::Pi(); - phi3 = (TMath::Pi() / 2. - TMath::ATan((1.5 * yBeam) / radius)) * 180. / TMath::Pi(); - phi4 = (TMath::Pi() / 2. + TMath::ATan((1.5 * yBeam) / radius)) * 180. / TMath::Pi(); - - - // ... (center of SPHE) - yMC = yM / 2. * TMath::Cos(angle / 180. * TMath::Pi()) + yBeam + TMath::Tan(angle / 180. * TMath::Pi()) * radius; - zMC = (lRadiator + zPMT) - radius; - - //output to geo file - FILE* fout = fopen(outfile, "w"); - - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "// RICH barrel\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1\n"); - fprintf(fout, "cave\n"); - fprintf(fout, "TRAP\n"); - fprintf(fout, "aluminium\n"); - fprintf(fout, "%6.2f -%6.2f 0. \n ", xB1, yB); - fprintf(fout, "%6.2f %6.2f 0. \n ", xB1, yB); - fprintf(fout, "-%6.2f %6.2f 0. \n ", xB1, yB); - fprintf(fout, "-%6.2f -%6.2f 0. \n ", xB1, yB); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xB2, yB, lBarrel); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xB2, yB, lBarrel); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xB2, yB, lBarrel); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xB2, yB, lBarrel); - fprintf(fout, "0. 0. %6.2f\n", zBarrel); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1entrance\n"); - fprintf(fout, "rich1\n"); - fprintf(fout, "TRAP\n"); - fprintf(fout, "kapton\n"); - fprintf(fout, "%6.2f -%6.2f 0. \n ", xB1 - dVessel, yB - dVessel); - fprintf(fout, "%6.2f %6.2f 0. \n ", xB1 - dVessel, yB - dVessel); - fprintf(fout, "-%6.2f %6.2f 0. \n ", xB1 - dVessel, yB - dVessel); - fprintf(fout, "-%6.2f -%6.2f 0. \n ", xB1 - dVessel, yB - dVessel); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xE1 - dVessel, yB - dVessel, dWindow); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xE1 - dVessel, yB - dVessel, dWindow); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xE1 - dVessel, yB - dVessel, dWindow); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xE1 - dVessel, yB - dVessel, dWindow); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1exit\n"); - fprintf(fout, "rich1\n"); - fprintf(fout, "TRAP\n"); - fprintf(fout, "kapton\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xE2 - dVessel, yB - dVessel, (lBarrel - dWindow)); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xE2 - dVessel, yB - dVessel, (lBarrel - dWindow)); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xE2 - dVessel, yB - dVessel, (lBarrel - dWindow)); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xE2 - dVessel, yB - dVessel, (lBarrel - dWindow)); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xB2 - dVessel, yB - dVessel, lBarrel); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xB2 - dVessel, yB - dVessel, lBarrel); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xB2 - dVessel, yB - dVessel, lBarrel); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xB2 - dVessel, yB - dVessel, lBarrel); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "rich1\n"); - fprintf(fout, "TRAP\n"); - fprintf(fout, "%s\n", gas); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", (xE1 - dVessel), (yB - dVessel), dWindow); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", (xE1 - dVessel), (yB - dVessel), dWindow); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", (xE1 - dVessel), (yB - dVessel), dWindow); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", (xE1 - dVessel), (yB - dVessel), dWindow); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1gas2\n"); - fprintf(fout, "rich1\n"); - fprintf(fout, "TRAP\n"); - fprintf(fout, "%s+\n", gas); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xI1, (yB - dVessel), zI1); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "rich1\n"); - fprintf(fout, "TRAP\n"); - fprintf(fout, "%s\n", gas); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xI2, (yB - dVessel), zI2); - fprintf(fout, "%6.2f -%6.2f %6.2f \n ", xE2 - dVessel, (yB - dVessel), (lBarrel - dWindow)); - fprintf(fout, "%6.2f %6.2f %6.2f \n ", xE2 - dVessel, (yB - dVessel), (lBarrel - dWindow)); - fprintf(fout, "-%6.2f %6.2f %6.2f \n ", xE2 - dVessel, (yB - dVessel), (lBarrel - dWindow)); - fprintf(fout, "-%6.2f -%6.2f %6.2f \n ", xE2 - dVessel, (yB - dVessel), (lBarrel - dWindow)); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "// beam cone\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1_cone1\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "carbon\n"); - fprintf(fout, "0. 0. %6.2f\n", dWindow); - fprintf(fout, "0. %6.2f\n", rE1); - fprintf(fout, "0. 0. %6.2f\n", zI1); - fprintf(fout, "0. %6.2f\n", rI1); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1_cone1_vac\n"); - fprintf(fout, "rich1_cone1\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "vacuum\n"); - fprintf(fout, "0. 0. %6.2f\n", dWindow); - fprintf(fout, "0. %6.2f\n", rE1 - rC); - fprintf(fout, "0. 0. %6.2f\n", zI1); - fprintf(fout, "0. %6.2f\n", rI1 - rC); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, " \n"); - fprintf(fout, "rich1_cone2\n"); - fprintf(fout, "rich1gas2\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "carbon\n"); - fprintf(fout, "0. 0. %6.2f\n", zI1); - fprintf(fout, "0. %6.2f\n", rI1); - fprintf(fout, "0. 0. %6.2f\n", zI2); - fprintf(fout, "0. %6.2f\n", rI2); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1_cone2_vac\n"); - fprintf(fout, "rich1_cone2\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "vacuum\n"); - fprintf(fout, "0. 0. %6.2f\n", zI1); - fprintf(fout, "0. %6.2f\n", rI1 - rC); - fprintf(fout, "0. 0. %6.2f\n", zI2); - fprintf(fout, "0. %6.2f\n", rI2 - rC); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, " \n"); - fprintf(fout, "rich1_cone3\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "carbon\n"); - fprintf(fout, "0. 0. %6.2f\n", zI2); - fprintf(fout, "0. %6.2f\n", rI2); - fprintf(fout, "0. 0. %6.2f\n", lBarrel - dWindow); - fprintf(fout, "0. %6.2f\n", rE2); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1_cone3_vac\n"); - fprintf(fout, "rich1_cone3\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "vacuum\n"); - fprintf(fout, "0. 0. %6.2f\n", zI2); - fprintf(fout, "0. %6.2f\n", rI2 - rC); - fprintf(fout, "0. 0. %6.2f\n", lBarrel - dWindow); - fprintf(fout, "0. %6.2f\n", rE2 - rC); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, " \n"); - fprintf(fout, "rich1_cone1_cap\n"); - fprintf(fout, "rich1entrance\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "carbon\n"); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, "0. %6.2f\n", r1); - fprintf(fout, "0. 0. %6.2f\n", dWindow); - fprintf(fout, "0. %6.2f\n", rE1); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1_cone1_cap_vac\n"); - fprintf(fout, "rich1_cone1_cap\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "vacuum\n"); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, "0. %6.2f\n", r1 - rC); - fprintf(fout, "0. 0. %6.2f\n", dWindow); - fprintf(fout, "0. %6.2f\n", rE1 - rC); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, " \n"); - fprintf(fout, "rich1_cone2_cap\n"); - fprintf(fout, "rich1exit\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "carbon\n"); - fprintf(fout, "0. 0. %6.2f\n", lBarrel - dWindow); - fprintf(fout, "0. %6.2f\n", rE2); - fprintf(fout, "0. 0. %6.2f\n", lBarrel); - fprintf(fout, "0. %6.2f\n", r2); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1_cone2_cap_vac\n"); - fprintf(fout, "rich1_cone2_cap\n"); - fprintf(fout, "CONE\n"); - fprintf(fout, "vacuum\n"); - fprintf(fout, "0. 0. %6.2f\n", lBarrel - dWindow); - fprintf(fout, "0. %6.2f\n", rE2 - rC); - fprintf(fout, "0. 0. %6.2f\n", lBarrel); - fprintf(fout, "0. %6.2f\n", r2 - rC); - fprintf(fout, "0. 0. 0.\n"); - fprintf(fout, " 1. 0. 0. 0. 1. 0. 0. 0. 1.\n"); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "// mirror\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1mgl#1\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "SPHE\n"); - fprintf(fout, "%s\n", mirror); - fprintf(fout, " %6.2f %6.2f\n", radius, radius + dMirror); - fprintf(fout, " %6.2f %6.2f\n", theta1, theta2); - fprintf(fout, " %6.2f %6.2f\n", phi1, phi2); - fprintf(fout, "0. %6.2f %6.2f\n", yMC, zMC); - fprintf(fout, " 1. 0. 0. 0. %6.4f %6.4f 0. %6.4f %6.4f\n", TMath::Cos((90. + angle) / 180. * TMath::Pi()), - -TMath::Sin((90. + angle) / 180. * TMath::Pi()), TMath::Sin((90. + angle) / 180. * TMath::Pi()), - TMath::Cos((90. + angle) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1mglLU#1\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "SPHE\n"); - fprintf(fout, "%s\n", mirror); - fprintf(fout, " %6.2f %6.2f\n", radius, radius + dMirror); - fprintf(fout, " %6.2f %6.2f\n", theta3, theta1); - fprintf(fout, " %6.2f %6.2f\n", phi4, phi2); - fprintf(fout, "0. %6.2f %6.2f\n", yMC, zMC); - fprintf(fout, " 1. 0. 0. 0. %6.4f %6.4f 0. %6.4f %6.4f\n", TMath::Cos((90. + angle) / 180. * TMath::Pi()), - -TMath::Sin((90. + angle) / 180. * TMath::Pi()), TMath::Sin((90. + angle) / 180. * TMath::Pi()), - TMath::Cos((90. + angle) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1mglRU#1\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "SPHE\n"); - fprintf(fout, "%s\n", mirror); - fprintf(fout, " %6.2f %6.2f\n", radius, radius + dMirror); - fprintf(fout, " %6.2f %6.2f\n", theta3, theta1); - fprintf(fout, " %6.2f %6.2f\n", phi1, phi3); - fprintf(fout, "0. %6.2f %6.2f\n", yMC, zMC); - fprintf(fout, " 1. 0. 0. 0. %6.4f %6.4f 0. %6.4f %6.4f\n", TMath::Cos((90. + angle) / 180. * TMath::Pi()), - -TMath::Sin((90. + angle) / 180. * TMath::Pi()), TMath::Sin((90. + angle) / 180. * TMath::Pi()), - TMath::Cos((90. + angle) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1mgl#2\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "0. -%6.2f %6.2f\n", yMC, zMC); - fprintf(fout, " -1. 0. 0. 0. %6.4f %6.4f 0. %6.4f %6.4f\n", TMath::Cos((90. - angle) / 180. * TMath::Pi()), - TMath::Sin((90. - angle) / 180. * TMath::Pi()), TMath::Sin((90. - angle) / 180. * TMath::Pi()), - -TMath::Cos((90. - angle) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1mglLU#2\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "0. -%6.2f %6.2f\n", yMC, zMC); - fprintf(fout, " -1. 0. 0. 0. %6.4f %6.4f 0. %6.4f %6.4f\n", TMath::Cos((90. - angle) / 180. * TMath::Pi()), - TMath::Sin((90. - angle) / 180. * TMath::Pi()), TMath::Sin((90. - angle) / 180. * TMath::Pi()), - -TMath::Cos((90. - angle) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "rich1mglRU#2\n"); - fprintf(fout, "rich1gas3\n"); - fprintf(fout, "0. -%6.2f %6.2f\n", yMC, zMC); - fprintf(fout, " -1. 0. 0. 0. %6.4f %6.4f 0. %6.4f %6.4f\n", TMath::Cos((90. - angle) / 180. * TMath::Pi()), - TMath::Sin((90. - angle) / 180. * TMath::Pi()), TMath::Sin((90. - angle) / 180. * TMath::Pi()), - -TMath::Cos((90. - angle) / 180. * TMath::Pi())); - fprintf(fout, " \n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - fprintf(fout, "// photodetector\n"); - fprintf(fout, "//-----------------------------------------------------------\n"); - if (dGlass > 0) { - fprintf(fout, "rich1dgl#1\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "BOX\n"); - fprintf(fout, "PMTglass\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., dy, -dGlass); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., dy, -dGlass); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., dy, -dGlass); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., dy, -dGlass); - fprintf(fout, " %6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, " %6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - fprintf(fout, "rich1d#1\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "BOX\n"); - fprintf(fout, "CsI\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., dy, -dCathode); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., dy, -dCathode); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., dy, -dCathode); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., dy, -dCathode); - fprintf(fout, "%6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, "%6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - if (lTube > 0) { - fprintf(fout, "rich1dtube#1\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "BOX\n"); - fprintf(fout, "air\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., dy, -lTube); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., dy, -lTube); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., dy, -lTube); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., dy, -lTube); - fprintf(fout, "%6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, "%6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - if (dSupport > 0) { - fprintf(fout, "rich1dsupport#1\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "BOX\n"); - fprintf(fout, "aluminium\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., dy, -dSupport); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., dy, -dSupport); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., dy, -dSupport); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., dy, -dSupport); - fprintf(fout, "%6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, "%6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f %6.2f 0.\n", dx / 2., dy); - fprintf(fout, "-%6.2f -%6.2f 0.\n", dx / 2., dy); - fprintf(fout, "%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode - lTube); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - if (dGlass > 0) { - fprintf(fout, "rich1dgl#2\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - fprintf(fout, "rich1d#2\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - if (lTube > 0) { - fprintf(fout, "rich1dtube#2\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - if (dSupport > 0) { - fprintf(fout, "rich1dsupport#2\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode - lTube); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - if (dGlass > 0) { - fprintf(fout, "rich1dgl#3\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - fprintf(fout, "rich1d#3\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - if (lTube > 0) { - fprintf(fout, "rich1dtube#3\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - if (dSupport > 0) { - fprintf(fout, "rich1dsupport#3\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f %6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode - lTube); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - if (dGlass > 0) { - fprintf(fout, "rich1dgl#4\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - fprintf(fout, "rich1d#4\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - if (lTube > 0) { - fprintf(fout, "rich1dtube#4\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - if (dSupport > 0) { - fprintf(fout, "rich1dsupport#4\n"); - fprintf(fout, "rich1gas1\n"); - fprintf(fout, "-%6.2f -%6.2f %6.2f\n", dx / 2., yPMT, zPMT - dGlass - dCathode - lTube); - fprintf(fout, " %6.4f 0. %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", - TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), -TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()), - -TMath::Sin((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Sin((-anglePMTy) / 180. * TMath::Pi()), - TMath::Sin((-anglePMTx) / 180. * TMath::Pi()), - TMath::Cos((-anglePMTx) / 180. * TMath::Pi()) * TMath::Cos((-anglePMTy) / 180. * TMath::Pi())); - fprintf(fout, "//-----------------------------------------------------------\n"); - } - - fclose(fout); - - printf("new geometry file done\n\n"); - } -} diff --git a/macro/rich/geotest/run_many.py b/macro/rich/geotest/run_many.py index 29c0e0b740c8ba9c158ff6aace5e239df8384315..c4840d8921068a7f2b0a30c6e7881b39af0f266a 100755 --- a/macro/rich/geotest/run_many.py +++ b/macro/rich/geotest/run_many.py @@ -1,14 +1,9 @@ import os -commandXterm1 = ('xterm -hold -e python3 run_one.py {} {}&').format(1, "4gev") +commandXterm1 = ('xterm -hold -e python3 run_one.py {} {}&').format(1, "urqmdtest") os.system(commandXterm1) - -commandXterm2 = ('xterm -hold -e python3 run_one.py {} {}&').format(2, "8gev") -os.system(commandXterm2) -commandXterm3 = ('xterm -hold -e python3 run_one.py {} {}&').format(3, "10gev") -os.system(commandXterm3) +commandXterm11 = ('xterm -hold -e python3 run_one.py {} {}&').format(1, "geotest") +os.system(commandXterm11) -commandXterm4 = ('xterm -hold -e python3 run_one.py {} {}&').format(4, "12gev") -os.system(commandXterm4) diff --git a/macro/rich/geotest/run_one.py b/macro/rich/geotest/run_one.py index d82951383448502f038b64bac4983b82aa7092a2..d638f9d157d81b9065b6143888435faa9b0e34c1 100755 --- a/macro/rich/geotest/run_one.py +++ b/macro/rich/geotest/run_one.py @@ -7,30 +7,32 @@ import argparse def main(): runId = sys.argv[1] - energy = sys.argv[2] + testType = sys.argv[2] # geotest or urqmdtest + + #runId = "0" + geoSetup = "sis100_electron" + nEvents = 3000 if testType == "geotest" else 100 + targetZ = -44.0 + energy = "10gev" cbmrootConfigPath = "/Users/slebedev/Development/cbm/git/build/config.sh" urqmdFile = ("/Users/slebedev/Development/cbm/data/urqmd/auau/{}/mbias/urqmd.auau.{}.mbias.00001.root").format(energy, energy) + if testType == "geotest": + urqmdFile = "" + plutoFile = "" - dataDir = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/" - resultDir = "results_" + runId + "_"+ energy +"/" + dataDir = "/Users/slebedev/Development/cbm/data/sim/rich/" + testType + resultDir = "results_" + testType + "_" + runId + "_"+ energy +"/" - #runId = "0" - geoSetup = "sis100_electron_APR21" - nEvents = 10 - testType = "geoTest" # urqmdTest or geoTest - - if testType == "geoTest": - urqmdFile = "" traFile = dataDir + "/tra." + runId + ".root" - parFile = dataDir + "/param." + runId + ".root" + parFile = dataDir + "/par." + runId + ".root" digiFile = dataDir + "/digi." + runId + ".root" recoFile = dataDir + "/reco." + runId + ".root" qaFile = dataDir + "/qa." + runId + ".root" geoSimFile = dataDir + "/geosim." + runId + ".root" - traCmd = ('root -l -b -q run_transport.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(urqmdFile, plutoFile, traFile, parFile, geoSimFile, geoSetup, nEvents) + traCmd = ('root -l -b -q run_transport.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{},{}\)').format(urqmdFile, plutoFile, traFile, parFile, geoSimFile, geoSetup, nEvents, targetZ) digiCmd = ('root -l -b -q run_digi.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(traFile, parFile, digiFile, nEvents) recoCmd = ('root -l -b -q run_reco.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(testType, traFile, parFile, digiFile, recoFile, geoSetup, nEvents) qaCmd = ('root -l -b -q run_qa.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(testType, traFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nEvents) diff --git a/macro/rich/geotest/run_qa.C b/macro/rich/geotest/run_qa.C index caeb15bc2b22dbf70f4a47184b5a6a146c23b13b..1a3a69851f19f73d83f0a97ca49454c8b32a379e 100644 --- a/macro/rich/geotest/run_qa.C +++ b/macro/rich/geotest/run_qa.C @@ -2,12 +2,12 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Semen Lebedev [committer] */ -void run_qa(const string& testType, // "geoTest" or "urqmdTest" +void run_qa(const string& testType, // "geotest" or "urqmdtest" const string& traFile, const string& parFile, const string& digiFile, const string& recoFile, const string& qaFile, const string& geoSetup, const string& resultDir, int nEvents) { - if (testType != "urqmdTest" && testType != "geoTest") { - std::cout << "ERROR testType is not correct. It must be urqmdTest or geoTest" << std::endl; + if (testType != "urqmdtest" && testType != "geotest") { + std::cout << "ERROR testType is not correct. It must be urqmdtest or geotest" << std::endl; return; } @@ -40,14 +40,14 @@ void run_qa(const string& testType, // "geoTest" or "urqmdTest" mcManager->AddFile(traFile.c_str()); run->AddTask(mcManager); - if (testType == "geoTest") { + if (testType == "geotest") { CbmRichGeoTest* geoTest = new CbmRichGeoTest(); geoTest->SetDrawPmts(false); //geoTest->SetDrawEventDisplay(false); geoTest->SetOutputDir(resultDir); run->AddTask(geoTest); } - else if (testType == "urqmdTest") { + else if (testType == "urqmdtest") { CbmRichUrqmdTest* urqmdTest = new CbmRichUrqmdTest(); urqmdTest->SetOutputDir(resultDir); run->AddTask(urqmdTest); diff --git a/macro/rich/geotest/run_reco.C b/macro/rich/geotest/run_reco.C index 42eedb8125776e1168e2315e09e0658fc9eff0db..9d10dc4915ea5c1e436f701a2f7ae53fbc07c8ab 100644 --- a/macro/rich/geotest/run_reco.C +++ b/macro/rich/geotest/run_reco.C @@ -2,12 +2,12 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Semen Lebedev [committer], Andrey Lebedev */ -void run_reco(const string& testType, // "geoTest" or "urqmdTest" +void run_reco(const string& testType, // "geotest" or "urqmdtest" const string& traFile, const string& parFile, const string& digiFile, const string& recoFile, const string& geoSetup, int nEvents) { - if (testType != "urqmdTest" && testType != "geoTest") { + if (testType != "urqmdtest" && testType != "geotest") { std::cout << "ERROR testType:" << testType << " is not correct. It must be urqmdTest or geoTest" << std::endl; return; } @@ -23,6 +23,11 @@ void run_reco(const string& testType, // "geoTest" or "urqmdTest" CbmSetup* geo = CbmSetup::Instance(); geo->LoadSetup(geoSetup.c_str()); + Bool_t eventBased = false; + Bool_t useMC = true; + Bool_t useMvd = geo->IsActive(ECbmModuleId::kMvd); + Bool_t useSts = geo->IsActive(ECbmModuleId::kSts); + TList* parFileList = new TList(); TStopwatch timer; @@ -40,26 +45,48 @@ void run_reco(const string& testType, // "geoTest" or "urqmdTest" mcManager->AddFile(traFile.c_str()); run->AddTask(mcManager); - if (testType == "urqmdTest") { - CbmRecoSts* stsReco = new CbmRecoSts(kCbmRecoTimeslice); - run->AddTask(stsReco); + if (testType == "urqmdtest") { + if (useMvd) { + CbmMvdClusterfinder* mvdCluster = new CbmMvdClusterfinder("MVD Cluster Finder", 0, 0); + run->AddTask(mvdCluster); - run->AddTask(new CbmTrackingDetectorInterfaceInit()); - CbmKF* kalman = new CbmKF(); - run->AddTask(kalman); - CbmL1* l1 = new CbmL1("L1", 0); + CbmMvdHitfinder* mvdHit = new CbmMvdHitfinder("MVD Hit Finder", 0, 0); + mvdHit->UseClusterfinder(kTRUE); + run->AddTask(mvdHit); + } - TString stsGeoTag; - if (geo->GetGeoTag(ECbmModuleId::kSts, stsGeoTag)) { - TString parFile = gSystem->Getenv("VMCWORKDIR"); - parFile += "/parameters/sts/sts_matbudget_" + stsGeoTag + ".root"; - l1->SetStsMaterialBudgetFileName(parFile.Data()); + if (useSts) { + CbmRecoSts* stsReco = new CbmRecoSts(ECbmRecoMode::kCbmRecoTimeslice); + run->AddTask(stsReco); } - run->AddTask(l1); - CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); - FairTask* stsFindTracks = new CbmStsFindTracksEvents(stsTrackFinder, false); - run->AddTask(stsFindTracks); + if (useMvd || useSts) { + run->AddTask(new CbmTrackingDetectorInterfaceInit()); + CbmKF* kalman = new CbmKF(); + run->AddTask(kalman); + CbmL1* l1 = new CbmL1("L1", 0); + + // --- Material budget file names + TString mvdGeoTag; + if (geo->GetGeoTag(ECbmModuleId::kMvd, mvdGeoTag)) { + TString parFile = gSystem->Getenv("VMCWORKDIR"); + parFile += "/parameters/mvd/mvd_matbudget_" + mvdGeoTag + ".root"; + std::cout << "Using material budget file " << parFile << std::endl; + l1->SetMvdMaterialBudgetFileName(parFile.Data()); + } + TString stsGeoTag; + if (geo->GetGeoTag(ECbmModuleId::kSts, stsGeoTag)) { + TString parFile = gSystem->Getenv("VMCWORKDIR"); + parFile += "/parameters/sts/sts_matbudget_" + stsGeoTag + ".root"; + std::cout << "Using material budget file " << parFile << std::endl; + l1->SetStsMaterialBudgetFileName(parFile.Data()); + } + run->AddTask(l1); + + CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); + FairTask* stsFindTracks = new CbmStsFindTracks(0, stsTrackFinder, useMvd); + run->AddTask(stsFindTracks); + } CbmLitFindGlobalTracks* finder = new CbmLitFindGlobalTracks(); finder->SetTrackingType("branch"); @@ -71,7 +98,7 @@ void run_reco(const string& testType, // "geoTest" or "urqmdTest" run->AddTask(richHitProd); CbmRichReconstruction* richReco = new CbmRichReconstruction(); - if (testType == "geoTest") { + if (testType == "geotest") { richReco->SetRunExtrapolation(false); richReco->SetRunProjection(false); } @@ -100,7 +127,6 @@ void run_reco(const string& testType, // "geoTest" or "urqmdTest" run->Run(0, nEvents); - timer.Stop(); std::cout << std::endl << std::endl; std::cout << "Macro finished succesfully." << std::endl; diff --git a/macro/rich/geotest/run_transport.C b/macro/rich/geotest/run_transport.C index 7564e15521ea0f39e6ed71c4102dee213bc9ec92..18271deccb06a6eb30fdeef092cfe97187726694 100644 --- a/macro/rich/geotest/run_transport.C +++ b/macro/rich/geotest/run_transport.C @@ -6,7 +6,7 @@ void run_transport(const string& urqmdFile, // only for "urqmdTest" const string& plutoFile, // only for "geoTest", if "", BoxGenerator is used const string& traFile, const string& parFile, const string& geoFile, const string& geoSetup, - int nEvents) + int nEvents, double targetZ = -44.) { TTree::SetMaxTreeSize(90000000000); @@ -27,6 +27,8 @@ void run_transport(const string& urqmdFile, // only for "urqmdTest" boxGen1->SetPtRange(0., 3.); boxGen1->SetPhiRange(0., 360.); boxGen1->SetThetaRange(2.5, 25.); + //boxGen1->SetYRange(0., 4.); + //boxGen1->SetXYZ(0., 0., targetZ); boxGen1->SetCosTheta(); boxGen1->Init(); run.AddInput(boxGen1); @@ -35,17 +37,18 @@ void run_transport(const string& urqmdFile, // only for "urqmdTest" boxGen2->SetPtRange(0., 3.); boxGen2->SetPhiRange(0., 360.); boxGen2->SetThetaRange(2.5, 25.); + //boxGen2->SetYRange(0., 4.); + //boxGen2->SetXYZ(0., 0., targetZ); boxGen2->SetCosTheta(); boxGen2->Init(); run.AddInput(boxGen2); } - run.SetOutFileName(traFile.c_str()); run.SetParFileName(parFile.c_str()); run.SetGeoFileName(geoFile.c_str()); run.LoadSetup(geoSetup.c_str()); - run.SetTarget("Gold", 0.025, 2.5); + run.SetTarget("Gold", 0.025, 2.5, 0, 0, targetZ); run.SetBeamPosition(0., 0., 0.1, 0.1); //run.SetEngine(kGeant4); //run.StoreTrajectories(true); diff --git a/macro/rich/rich_compact.dat b/macro/rich/rich_compact.dat deleted file mode 100644 index 23f4578b2b2bb9aaa3bdc83150123b02c56cf1ce..0000000000000000000000000000000000000000 --- a/macro/rich/rich_compact.dat +++ /dev/null @@ -1,9 +0,0 @@ -RICH barrel - z length dWindows dVessel lRadiator radiator -1600. 1900. 0.25 5. 1500. RICHgas_CO2_dis -RICH mirror - radius thickness material yBeamhole angle - 3000. 6. RICHglass 200. -1. -RICH photodetector (PMT) - z y dx dy angle_x angle_y dGlass dCathode lTube dSupport - 200. 1275. 1000. 300. 5. -5. 0. 0.5 0. 0. diff --git a/macro/rich/run/run_digi.C b/macro/rich/run/run_digi.C index e111160b9d5f0ae111bf6e34cc288494ee89d332..8b91747631f48b9af7d912882d59571c5c3509f4 100644 --- a/macro/rich/run/run_digi.C +++ b/macro/rich/run/run_digi.C @@ -2,10 +2,10 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Semen Lebedev [committer], Andrey Lebedev, Semen Lebedev [committer] */ -void run_digi(const string& traFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/tra.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/par.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/raw.00000.root", - int nEvents = 3) +void run_digi(const string& traFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/tra.0.root", + const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/par.0.root", + const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/digi.0.root", + int nEvents = 100) { TTree::SetMaxTreeSize(90000000000); FairLogger::GetLogger()->SetLogScreenLevel("INFO"); diff --git a/macro/rich/run/run_many.py b/macro/rich/run/run_many.py index a49ae4d136a400555a71d925a77dbe57807d9a4c..c24eae4d36e1480fe009bb452e3da2affb75c82b 100755 --- a/macro/rich/run/run_many.py +++ b/macro/rich/run/run_many.py @@ -1,6 +1,6 @@ import os -for taskId in range(1,5): +for taskId in range(1,4): commandXterm = ('xterm -hold -e python3 run_one.py {}&').format(taskId) print(commandXterm + " " + str(taskId)) os.system(commandXterm) diff --git a/macro/rich/run/run_one.py b/macro/rich/run/run_one.py index 543b01e609b0826b2b9c6b203271ced5dd09619b..abfaf2ff48b3aee648b2d2d1977c988ff1925000 100755 --- a/macro/rich/run/run_one.py +++ b/macro/rich/run/run_one.py @@ -4,43 +4,29 @@ import os import sys taskId = sys.argv[1] -cbmrootConfigPath = "/Users/slebedev/Development/cbm/trunk/build/config.sh" -macroDir = "/Users/slebedev/Development/cbm/trunk/cbmroot/macro/rich/" -nofEvents = 10 - -os.system(("source {}").format(cbmrootConfigPath)) +cbmrootConfigPath = "/Users/slebedev/Development/cbm/git/build/config.sh" +macroDir = "/Users/slebedev/Development/cbm/git/cbmroot/macro/rich/" +nofEvents = 100 urqmdFile = "/Users/slebedev/Development/cbm/data/urqmd/auau/10gev/centr/urqmd.auau.10gev.centr.00001.root" dataDir= "/Users/slebedev/Development/cbm/data/sim/rich/reco/" -mcFile = dataDir + "/mc."+ taskId + ".root" -parFile = dataDir + "/param."+ taskId + ".root" +traFile = dataDir + "/tra."+ taskId + ".root" +parFile = dataDir + "/par."+ taskId + ".root" digiFile = dataDir + "/digi."+ taskId + ".root" recoFile = dataDir + "/reco."+ taskId + ".root" qaFile = dataDir + "/qa."+ taskId + ".root" geoSimFile = dataDir + "/geosim."+ taskId + ".root" -geoSetup = "rich_pipe_v" + taskId -resultDir = "results_rich_pipe/results_" + geoSetup + "/recoqa/" - - -#geotest -#commandSim=('root -l -b -q {}/geotest/run_sim_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, geoSimFile, geoSetup, nofEvents) -#commandDigi=('root -l -b -q {}/geotest/run_digi_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, nofEvents) -#commandReco=('root -l -b -q {}/geotest/run_reco_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, geoSetup, resultDir, nofEvents) -#commandQa=('root -l -b -q {}/geotest/run_qa_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nofEvents) -#urqmdtest -# commandSim=('root -l -b -q {}/geotest/run_sim_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, urqmdFile, mcFile, parFile, geoSimFile, geoSetup, nofEvents) -# commandDigi=('root -l -b -q {}/geotest/run_digi_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, nofEvents) -# commandReco=('root -l -b -q {}/geotest/run_reco_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, geoSetup, resultDir, nofEvents) -# commandQa=('root -l -b -q {}/geotest/run_qa_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nofEvents) +geoSetup = "sis100_electron" +resultDir = "results_recoqa/" +targetZ = -44.0 -#recoqa -# commandSim=('root -l -b -q {}/run/run_sim.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{},{},\\"{}\\",\\"{}\\",{}\)').format(macroDir, urqmdFile, mcFile, parFile, geoSimFile, 5, 5, "", geoSetup, nofEvents) -# commandDigi=('root -l -b -q {}/run/run_digi.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, nofEvents) -# commandReco=('root -l -b -q {}/run/run_reco.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, geoSetup, resultDir, nofEvents) -commandQa=('root -l -b -q {}/run/run_qa.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nofEvents) +traCmd=('root -l -b -q {}/run/run_transport.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{},{},\\"{}\\",\\"{}\\",{},{}\)').format(macroDir, urqmdFile, traFile, parFile, geoSimFile, 5, 5, "", geoSetup, nofEvents, targetZ) +digiCmd=('root -l -b -q {}/run/run_digi.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, traFile, parFile, digiFile, nofEvents) +recoCmd=('root -l -b -q {}/run/run_reco.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, traFile, parFile, digiFile, recoFile, geoSetup, resultDir, nofEvents) +qaCmd=('root -l -b -q {}/run/run_qa.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, traFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nofEvents) -# os.system(commandSim) -# os.system(commandDigi) -# os.system(commandReco) -os.system(commandQa) +os.system((". /{} -a; {}").format(cbmrootConfigPath, traCmd)) +os.system((". /{} -a; {}").format(cbmrootConfigPath, digiCmd)) +os.system((". /{} -a; {}").format(cbmrootConfigPath, recoCmd)) +os.system((". /{} -a; {}").format(cbmrootConfigPath, qaCmd)) diff --git a/macro/rich/run/run_qa.C b/macro/rich/run/run_qa.C index 316d70509c3dc3fe29838a75c28355f6f29fc856..14b95da9e08810ef215fab213f22700e5fe2eeaa 100644 --- a/macro/rich/run/run_qa.C +++ b/macro/rich/run/run_qa.C @@ -2,24 +2,25 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Semen Lebedev [committer] */ -void run_qa(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/param.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/digi.00000.root", - const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/reco.00000.root", - const string& qaFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/qa.00000.root", - const string& geoSetup = "sis100_electron", const string& resultDir = "results_recoqa_newqa/", +void run_qa(const string& traFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/tra.0.root", + const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/par.0.root", + const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/digi.0.root", + const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/reco.0.root", + const string& qaFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/qa.0.root", + const string& geoSetup = "sis100_electron", const string& resultDir = "results_recoqa_apr21plus/", int nEvents = 100) { + TTree::SetMaxTreeSize(90000000000); + FairLogger::GetLogger()->SetLogScreenLevel("INFO"); + FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); + remove(qaFile.c_str()); - TString myName = "run_reco"; TString srcDir = gSystem->Getenv("VMCWORKDIR"); - remove(qaFile.c_str()); - - CbmSetup::Instance()->LoadSetup(geoSetup.c_str()); + CbmSetup* geo = CbmSetup::Instance(); + geo->LoadSetup(geoSetup.c_str()); - std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl; TList* parFileList = new TList(); TString geoTag; @@ -30,18 +31,13 @@ void run_qa(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/r for (Int_t i(0); i < 4; i++) { trdParFile = new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + "." + npar[i] + ".par"); parFileList->Add(trdParFile); - std::cout << "-I- " << myName << ": Using parameter file " << trdParFile->GetString() << std::endl; } } // - TOF digitisation parameters if (CbmSetup::Instance()->GetGeoTag(ECbmModuleId::kTof, geoTag)) { - TObjString* tofFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); - parFileList->Add(tofFile); - std::cout << "-I- " << myName << ": Using parameter file " << tofFile->GetString() << std::endl; TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); parFileList->Add(tofBdfFile); - std::cout << "-I- " << myName << ": Using parameter file " << tofBdfFile->GetString() << std::endl; } TStopwatch timer; @@ -51,19 +47,14 @@ void run_qa(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/r FairRunAna* run = new FairRunAna(); FairFileSource* inputSource = new FairFileSource(digiFile.c_str()); - inputSource->AddFriend(mcFile.c_str()); + inputSource->AddFriend(traFile.c_str()); inputSource->AddFriend(recoFile.c_str()); run->SetSource(inputSource); run->SetOutputFile(qaFile.c_str()); run->SetGenerateRunInfo(kTRUE); - - FairLogger::GetLogger()->SetLogScreenLevel("INFO"); - FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - - CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); - mcManager->AddFile(mcFile.c_str()); + mcManager->AddFile(traFile.c_str()); run->AddTask(mcManager); // // RICH reco QA @@ -106,13 +97,13 @@ void run_qa(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/r CbmLitClusteringQa* clusteringQa = new CbmLitClusteringQa(); clusteringQa->SetOutputDir(resultDir); - run->AddTask(clusteringQa); + //run->AddTask(clusteringQa); CbmLitTofQa* tofQa = new CbmLitTofQa(); tofQa->SetOutputDir(std::string(resultDir)); //run->AddTask(tofQa); - std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl; + FairRuntimeDb* rtdb = run->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); @@ -122,15 +113,12 @@ void run_qa(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/r parIo2->open(parFileList, "in"); rtdb->setSecondInput(parIo2); } - - std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl; run->Init(); rtdb->setOutput(parIo1); rtdb->saveOutput(); rtdb->print(); - std::cout << "-I- " << myName << ": Starting run" << std::endl; run->Run(0, nEvents); timer.Stop(); diff --git a/macro/rich/run/run_reco.C b/macro/rich/run/run_reco.C index fc895706c60dab9770af9298f55c92fed71b415c..31295f5deecf4c49e1ff1fccfd9d542f0536ced8 100644 --- a/macro/rich/run/run_reco.C +++ b/macro/rich/run/run_reco.C @@ -2,12 +2,12 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Semen Lebedev [committer], Semen Lebedev [committer], Andrey Lebedev */ -void run_reco(const string& traFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/tra.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/par.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/raw.00000.root", - const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/reco.00000.root", +void run_reco(const string& traFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/tra.0.root", + const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/par.0.root", + const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/digi.0.root", + const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/reco.0.root", const string& geoSetup = "sis100_electron", const string& resultDir = "results_recoqa_newqa/", - int nofTimeSlices = 3) + int nofTimeSlices = 100) { TTree::SetMaxTreeSize(90000000000); @@ -42,8 +42,6 @@ void run_reco(const string& traFile = "/Users/slebedev/Development/cbm/data/sim for (Int_t i(0); i < 4; i++) { trdParFile = new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + "." + npar[i] + ".par"); parFileList->Add(trdParFile); - std::cout << "-I- " - << ": Using parameter file " << trdParFile->GetString() << std::endl; } } @@ -51,8 +49,6 @@ void run_reco(const string& traFile = "/Users/slebedev/Development/cbm/data/sim if (CbmSetup::Instance()->GetGeoTag(ECbmModuleId::kTof, geoTag)) { TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); parFileList->Add(tofBdfFile); - std::cout << "-I- " - << ": Using parameter file " << tofBdfFile->GetString() << std::endl; } TStopwatch timer; @@ -193,21 +189,11 @@ void run_reco(const string& traFile = "/Users/slebedev/Development/cbm/data/sim } // ------------------------------------------------------------------------ - if (useMC) { - CbmMatchRecoToMC* match1 = new CbmMatchRecoToMC(); - run->AddTask(match1); - } - - if (useMvd || useSts) { run->AddTask(new CbmTrackingDetectorInterfaceInit()); CbmKF* kalman = new CbmKF(); run->AddTask(kalman); - CbmL1* l1 = 0; - if (useMC) { l1 = new CbmL1("L1", 2, 3); } - else { - l1 = new CbmL1("L1", 0); - } + CbmL1* l1 = new CbmL1("L1", 0); // --- Material budget file names TString mvdGeoTag; @@ -253,6 +239,15 @@ void run_reco(const string& traFile = "/Users/slebedev/Development/cbm/data/sim std::cout << "-I- : Added task " << finder->GetName() << std::endl; // ---------------------------------------------------------------------- + // --- Particle Id in TRD ----------------------------------------- + if (useTrd) { + CbmTrdSetTracksPidLike* trdLI = new CbmTrdSetTracksPidLike("TRDLikelihood", "TRDLikelihood"); + trdLI->SetUseMCInfo(kTRUE); + trdLI->SetUseMomDependence(kTRUE); + run->AddTask(trdLI); + std::cout << "-I- : Added task " << trdLI->GetName() << std::endl; + } + // ------------------------------------------------------------------------ // ----- RICH reconstruction ---------------------------------------- if (useRich) { @@ -289,6 +284,9 @@ void run_reco(const string& traFile = "/Users/slebedev/Development/cbm/data/sim } //? time-based reco + CbmMatchRecoToMC* match = new CbmMatchRecoToMC(); + run->AddTask(match); + // ----- Parameter database -------------------------------------------- std::cout << std::endl << std::endl; diff --git a/macro/rich/run/run_transport.C b/macro/rich/run/run_transport.C index e26b1aca342b3a7b91adeef964b1898618a3a610..af74a747e2fe7b67976447de9c14f57a62459096 100644 --- a/macro/rich/run/run_transport.C +++ b/macro/rich/run/run_transport.C @@ -4,13 +4,13 @@ void run_transport(const string& urqmdFile = "/Users/slebedev/Development/cbm/data/urqmd/auau/8gev/centr/" "urqmd.auau.8gev.centr.00001.root", // if "", no urqmd - const string& traFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/tra.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/par.00000.root", - const string& geoFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/geo.00000.root", + const string& traFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/tra.0.root", + const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/par.0.root", + const string& geoFile = "/Users/slebedev/Development/cbm/data/sim/rich/reco/geo.0.root", int nofElectrons = 5, // number of e- to be generated, if <=0 no e- are embedded into event int nofPositrons = 5, // number of e+ to be generated, if <=0 no e+ are embedded into event const string& plutoFile = "", // if "", no pluto particles are embedded into event - const string& geoSetup = "sis100_electron", int nEvents = 3) + const string& geoSetup = "sis100_electron", int nEvents = 2, double targetZ = -44.) { TTree::SetMaxTreeSize(90000000000); @@ -33,6 +33,7 @@ void run_transport(const string& urqmdFile = "/Users/slebedev/Development/cbm/da boxGen1->SetPtRange(0., 3.); boxGen1->SetPhiRange(0., 360.); boxGen1->SetThetaRange(2.5, 25.); + //boxGen1->SetXYZ(0., 0., targetZ); boxGen1->SetCosTheta(); boxGen1->Init(); run.AddInput(boxGen1); @@ -42,6 +43,7 @@ void run_transport(const string& urqmdFile = "/Users/slebedev/Development/cbm/da boxGen2->SetPtRange(0., 3.); boxGen2->SetPhiRange(0., 360.); boxGen2->SetThetaRange(2.5, 25.); + // boxGen2->SetXYZ(0., 0., targetZ); boxGen2->SetCosTheta(); boxGen2->Init(); run.AddInput(boxGen2); @@ -53,9 +55,11 @@ void run_transport(const string& urqmdFile = "/Users/slebedev/Development/cbm/da run.SetParFileName(parFile.c_str()); run.SetGeoFileName(geoFile.c_str()); run.LoadSetup(geoSetup.c_str()); - run.SetTarget("Gold", 0.025, 2.5); + run.SetTarget("Gold", 0.025, 2.5, 0, 0, targetZ); run.SetBeamPosition(0., 0., 0.1, 0.1); - run.SetRandomEventPlane(); + //run.SetRandomEventPlane(); + //run.SetEngine(kGeant4); + //run.StoreTrajectories(true); run.Run(nEvents); diff --git a/macro/rich/run_radius_correction.C b/macro/rich/run_radius_correction.C deleted file mode 100644 index c6a669d006a96f3a540176c8917751bdf07e67b9..0000000000000000000000000000000000000000 --- a/macro/rich/run_radius_correction.C +++ /dev/null @@ -1,325 +0,0 @@ -/* Copyright (C) 2007-2021 Justus-Liebig-Universitaet Giessen, Giessen - SPDX-License-Identifier: GPL-3.0-only - Authors: Simeon Lebedev, Semen Lebedev, Claudia Höhne [committer] */ - -/* Description: This macro calculate MAP for radius correction - To use this macro, first run CbmRichRingQa task. - It sets recFlag to the rings. -*/ -#include "../../littrack/utils/CbmLitDrawHist.cxx" -#include "../../littrack/utils/CbmLitUtils.cxx" - -#include <vector> -void run_radius_correction() -{ - TStopwatch timer; - timer.Start(); - - gStyle->SetPalette(1, 0); - gStyle->SetHistLineWidth(2); - - // ---- Load libraries ------------------------------------------------- - gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); - basiclibs(); - gROOT->LoadMacro("$VMCWORKDIR/macro/rich/cbmlibs.C"); - cbmlibs(); - - // gROOT->LoadMacro("$VMCWORKDIR/macro/rich/setstyle.C"); - // setphdStyle(); - SetStyles(); - - char fileMC[200], fileRec[200]; - - sprintf(fileMC, "/d/cbm02/slebedev/rich/JUL09/correction/mc.00.root"); - cout << fileMC << endl; - TFile* f1 = new TFile(fileMC, "R"); - TTree* t1 = f1->Get("cbmsim"); - TFolder* fd1 = f1->Get("cbmroot"); - TClonesArray* fMCTracks = (TClonesArray*) fd1->FindObjectAny("MCTrack"); - t1->SetBranchAddress(fMCTracks->GetName(), &fMCTracks); - - sprintf(fileRec, "/d/cbm02/slebedev/rich/JUL09/correction/reco.00.root"); - TFile* f = new TFile(fileRec, "R"); - TTree* t = f->Get("cbmsim"); - TFolder* fd = f->Get("cbmout"); - TClonesArray* fRichRings = (TClonesArray*) fd->FindObjectAny("RichRing"); - t->SetBranchAddress(fRichRings->GetName(), &fRichRings); - TClonesArray* fRichMatches = (TClonesArray*) fd->FindObjectAny("RichRingMatch"); - t->SetBranchAddress(fRichMatches->GetName(), &fRichMatches); - - //Int_t fNofBinsX = 40; - //Int_t fNofBinsY = 50; - Int_t fNofBinsX = 25; - Int_t fNofBinsY = 25; - ///A axis - TH2D* fh_axisAXYCount; - TH2D* fh_axisAXYW; - TH2D* fh_axisAXY; - TH2D* fh_axisASigma; - TH2D* mapaxisAXY; - - - ///B axis - TH2D* fh_axisBXYCount; - TH2D* fh_axisBXYW; - TH2D* fh_axisBXY; - TH2D* fh_axisBSigma; - TH2D* mapaxisBXY; - - mapaxisAXY = - new TH2D("fh_mapaxisAXY", "dA distribution (x,y);X, [cm];Y, [cm]", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - mapaxisBXY = - new TH2D("fh_mapaxisBXY", "dB distribution (x,y);X, [cm];Y, [cm]", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - fh_axisAXYCount = new TH2D("fh_axisAXYCount", "A Count", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - fh_axisAXYW = new TH2D("fh_axisAXYW", "", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - fh_axisBXYCount = new TH2D("fh_axisBXYCount", "B Count", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - fh_axisBXYW = new TH2D("fh_axisBXYW", "", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - fh_axisAXY = - new TH2D("fh_axisAXY", "A distribution (x,y);X, [cm];Y, [cm]", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - fh_axisBXY = - new TH2D("fh_axisBXY", "B distribution (x,y);X, [cm];Y, [cm]", fNofBinsX, -200, 200, fNofBinsY, -250, 250); - - Double_t fMinAaxis = 4.5; - Double_t fMaxAaxis = 7.5; - - ///Set Mean value of A and B axeses, Compact RICH - //Double_t fMeanAaxis = 5.06; - //Double_t fMeanBaxis = 4.65; - - ///Set Mean value of A and B axeses, Large RICH - Double_t fMeanAaxis = 6.17; - Double_t fMeanBaxis = 5.6; - - Int_t nEvents = t->GetEntries(); - cout << " nEvents =" << nEvents << endl; - for (Int_t ievent = 0; ievent < nEvents; ievent++) { - cout << "ievent = " << ievent; - CbmRichRing* ring = NULL; - CbmRichRingMatch* match = NULL; - t->GetEntry(ievent); - t1->GetEntry(ievent); - Int_t nofRings = fRichRings->GetEntriesFast(); - cout << " nofRings = " << nofRings; - cout << " nofMatches = " << fRichMatches->GetEntriesFast(); - cout << " nofMCTracks = " << fMCTracks->GetEntriesFast() << endl; - - for (Int_t iRing = 0; iRing < nofRings; iRing++) { - ring = (CbmRichRing*) fRichRings->At(iRing); - if (!ring) continue; - match = (CbmRichRingMatch*) fRichMatches->At(iRing); - if (!match) continue; - - Int_t trackId = match->GetMCTrackID(); - if (trackId == -1) continue; - if (trackId > fMCTracks->GetEntriesFast()) continue; - - CbmMCTrack* mcTrack = (CbmMCTrack*) fMCTracks->At(trackId); - if (!mcTrack) continue; - Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); - Int_t motherId = mcTrack->GetMotherId(); - if (pdg != 11) continue; - if (motherId != -1) continue; - - Double_t radius = ring->GetRadius(); - Double_t axisA = ring->GetAaxis(); - Double_t axisB = ring->GetBaxis(); - Double_t centerX = ring->GetCenterX(); - Double_t centerY = ring->GetCenterY(); - - if (axisA > fMaxAaxis || axisB > fMaxAaxis) continue; - if (axisA < fMinAaxis || axisB < fMinAaxis) continue; - - fh_axisAXYW->Fill(centerX, centerY, axisA); - fh_axisAXYCount->Fill(centerX, centerY); - - fh_axisBXYW->Fill(centerX, centerY, axisB); - fh_axisBXYCount->Fill(centerX, centerY); - } //iRing - } //iEvent - - fh_axisAXY->Divide(fh_axisAXYW, fh_axisAXYCount); - fh_axisBXY->Divide(fh_axisBXYW, fh_axisBXYCount); - - - ///create two correction maps - for (Int_t iX = 1; iX < mapaxisAXY->GetNbinsX() + 1; iX++) { - for (Int_t iY = 1; iY < mapaxisAXY->GetNbinsY() + 1; iY++) { - if (fh_axisAXYCount->GetBinContent(iX, iY) != 0) { - mapaxisAXY->SetBinContent(iX, iY, fMeanAaxis - fh_axisAXY->GetBinContent(iX, iY)); - } - else { - mapaxisAXY->SetBinContent(iX, iY, -99999999.); - } - - if (fh_axisBXYCount->GetBinContent(iX, iY) != 0) { - mapaxisBXY->SetBinContent(iX, iY, fMeanBaxis - fh_axisBXY->GetBinContent(iX, iY)); - } - else { - mapaxisBXY->SetBinContent(iX, iY, -99999999.); - } - } - } - - c1_0 = new TCanvas("c1_0", "c1_0", 10, 10, 600, 600); - c1_0->Divide(1, 2); - c1_0->cd(1); - fh_axisAXYCount->Draw("COLZ"); - c1_0->cd(2); - fh_axisBXYCount->Draw("COLZ"); - - c1 = new TCanvas("c1", "c1", 10, 10, 600, 600); - c1->Divide(1, 2); - c1->cd(1); - fh_axisAXY->SetMinimum(5.0); - fh_axisAXY->SetMaximum(6.4); - fh_axisAXY->Draw("COLZ"); - c1->cd(2); - fh_axisBXY->SetMinimum(5.0); - fh_axisBXY->SetMaximum(6.0); - fh_axisBXY->Draw("COLZ"); - - c2 = new TCanvas("c2", "c2", 10, 10, 600, 600); - c2->Divide(1, 2); - c2->cd(1); - mapaxisAXY->SetMinimum(-0.5); - mapaxisAXY->SetMaximum(0.5); - mapaxisAXY->Draw("COLZ"); - c2->cd(2); - mapaxisBXY->SetMinimum(-0.5); - mapaxisBXY->SetMaximum(0.5); - mapaxisBXY->Draw("COLZ"); - - - ///// Check correction procedure - TH1D* fh_Abefore = new TH1D("fh_Abefore", "A before;A, [cm];yield", 300, 0., 9.); - ; - TH1D* fh_Bbefore = new TH1D("fh_Bbefore", "B before;B, [cm];yield", 300, 0., 9.); - ; - - TH1D* fh_A = new TH1D("fh_A", "A after;A, [cm];yield", 300, 0., 9.); - ; - TH1D* fh_B = new TH1D("fh_B", "B after;B, [cm];yield", 300, 0., 9.); - ; - - cout << "Check correction procedure......" << endl; - for (Int_t ievent = 0; ievent < nEvents; ievent++) { - CbmRichRing* ring = NULL; - // if (ievent % 100 == 0) cout << ievent << " "; - //t1->GetEntry(ievent); - t->GetEntry(ievent); - t1->GetEntry(ievent); - Int_t nofRings = fRichRings->GetEntriesFast(); - - for (Int_t iRing = 0; iRing < nofRings; iRing++) { - - ring = (CbmRichRing*) fRichRings->At(iRing); - if (!ring) continue; - match = (CbmRichRingMatch*) fRichMatches->At(iRing); - if (!match) continue; - - Int_t trackId = match->GetMCTrackID(); - if (trackId == -1) continue; - if (trackId > fMCTracks->GetEntriesFast()) continue; - - CbmMCTrack* mcTrack = (CbmMCTrack*) fMCTracks->At(trackId); - if (!mcTrack) continue; - Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); - Int_t motherId = mcTrack->GetMotherId(); - if (pdg != 11) continue; - if (motherId != -1) continue; - - Double_t axisA = ring->GetAaxis(); - Double_t axisB = ring->GetBaxis(); - if (axisA > fMaxAaxis || axisB > fMaxAaxis) continue; - if (axisA < fMinAaxis || axisB < fMinAaxis) continue; - - Double_t radius = ring->GetRadius(); - Double_t centerX = ring->GetCenterX(); - Double_t centerY = ring->GetCenterY(); - Double_t axisAbefore = ring->GetAaxis(); - Double_t axisBbefore = ring->GetBaxis(); - fh_Abefore->Fill(axisAbefore); - fh_Bbefore->Fill(axisBbefore); - - Double_t axisA = ring->GetAaxis(); - Double_t axisB = ring->GetBaxis(); - - axisA += mapaxisAXY->GetBinContent(mapaxisAXY->FindBin(centerX, centerY)); - axisB += mapaxisBXY->GetBinContent(mapaxisBXY->FindBin(centerX, centerY)); - - fh_A->Fill(axisA); - fh_B->Fill(axisB); - } //iRing - } //iEvent - - - // gStyle->SetOptStat(0); - c3 = new TCanvas("c3", "c3", 10, 10, 600, 600); - c3->Divide(2, 2); - c3->cd(1); - fh_Abefore->Scale(1. / fh_Abefore->Integral()); - fh_Abefore->SetMaximum(fh_Abefore->GetMaximum() * 1.3); - fh_Abefore->Draw(); - fh_Abefore->SetAxisRange(fMinAaxis, fMaxAaxis); - fh_Abefore->Fit("gaus"); - Double_t sigmaAb = fh_Abefore->GetFunction("gaus")->GetParameter("Sigma"); - char sigmaTxtAb[30]; - sprintf(sigmaTxtAb, "sigma = %.3f", sigmaAb); - TText* txtAb = new TText(4.3, fh_Abefore->GetMaximum() * 0.85, sigmaTxtAb); - txtAb->SetTextSize(0.1); - txtAb->Draw(); - gPad->SetGridx(true); - gPad->SetGridy(true); - - c3->cd(2); - fh_Bbefore->Scale(1. / fh_Bbefore->Integral()); - fh_Bbefore->SetMaximum(fh_Bbefore->GetMaximum() * 1.3); - fh_Bbefore->Draw(); - fh_Bbefore->SetAxisRange(fMinAaxis, fMaxAaxis); - fh_Bbefore->Fit("gaus"); - Double_t sigmaBb = fh_Bbefore->GetFunction("gaus")->GetParameter("Sigma"); - char sigmaTxtBb[30]; - sprintf(sigmaTxtBb, "sigma = %.3f", sigmaBb); - TText* txtBb = new TText(4.3, fh_Bbefore->GetMaximum() * 0.85, sigmaTxtBb); - txtBb->SetTextSize(0.1); - txtBb->Draw(); - gPad->SetGridx(true); - gPad->SetGridy(true); - - c3->cd(3); - fh_A->Scale(1. / fh_A->Integral()); - fh_A->SetMaximum(fh_A->GetMaximum() * 1.3); - fh_A->SetAxisRange(fMinAaxis, fMaxAaxis); - fh_A->Draw(); - fh_A->Fit("gaus"); - Double_t sigmaA = fh_A->GetFunction("gaus")->GetParameter("Sigma"); - char sigmaTxtA[30]; - sprintf(sigmaTxtA, "sigma = %.3f", sigmaA); - TText* txtA = new TText(4.3, fh_A->GetMaximum() * 0.85, sigmaTxtA); - txtA->SetTextSize(0.1); - txtA->Draw(); - gPad->SetGridx(true); - gPad->SetGridy(true); - - c3->cd(4); - fh_B->Scale(1. / fh_B->Integral()); - fh_B->SetMaximum(fh_B->GetMaximum() * 1.3); - fh_B->SetAxisRange(fMinAaxis, fMaxAaxis); - fh_B->Draw(); - fh_B->Fit("gaus"); - Double_t sigmaB = fh_B->GetFunction("gaus")->GetParameter("Sigma"); - char sigmaTxtB[30]; - sprintf(sigmaTxtB, "sigma = %.3f", sigmaB); - TText* txtB = new TText(4.3, fh_B->GetMaximum() * 0.85, sigmaTxtB); - txtB->SetTextSize(0.1); - txtB->Draw(); - gPad->SetGridx(true); - gPad->SetGridy(true); - - - /// Write correction map to the file - TFile* file = new TFile("radius_correction_map.root", "recreate"); - mapaxisAXY->Write(); - mapaxisBXY->Write(); - file->Close(); -} diff --git a/reco/detectors/rich/qa/CbmRichGeoTest.cxx b/reco/detectors/rich/qa/CbmRichGeoTest.cxx index b508221a207cb951378c611a9b2c420290032120..98b93c400d25e18d052cffa803d8cba5e64fc4f4 100644 --- a/reco/detectors/rich/qa/CbmRichGeoTest.cxx +++ b/reco/detectors/rich/qa/CbmRichGeoTest.cxx @@ -33,7 +33,7 @@ #include "CbmRichRingFitterEllipseTau.h" #include "CbmStudyReport.h" #include "CbmTrackMatchNew.h" -#include "utils/CbmUtils.h" +#include "CbmUtils.h" #include "FairGeoNode.h" #include "FairGeoTransform.h" @@ -66,81 +66,27 @@ #include <vector> using namespace std; +using namespace Cbm; -CbmRichGeoTest::CbmRichGeoTest() - : FairTask("RichGeoTestQa") - , fOutputDir("") - , fRichHits(NULL) - , fRichRings(NULL) - , fRichPoints(NULL) - , fMcTracks(NULL) - , fRichRingMatches(NULL) - , fEventList(NULL) - , fCopFit(NULL) - , fTauFit(NULL) - , fHM(NULL) - , fEventNum(0) - , fMinNofHits(0) - , fMinAaxis(0.) - , fMaxAaxis(0.) - , fMinBaxis(0.) - , fMaxBaxis(0.) - , fMinRadius(0.) - , fMaxRadius(0.) - , fNofDrawnRings(0) - , fDrawPmts(true) - , fDrawEventDisplay(true) -{ - fEventNum = 0; - fNofDrawnRings = 0; - fMinNofHits = 7; - - fMinAaxis = 3.; - fMaxAaxis = 7.; - fMinBaxis = 3.; - fMaxBaxis = 7.; - fMinRadius = 3.; - fMaxRadius = 7.; -} +CbmRichGeoTest::CbmRichGeoTest() : FairTask("RichGeoTestQa") {} CbmRichGeoTest::~CbmRichGeoTest() {} InitStatus CbmRichGeoTest::Init() { - cout << "CbmRichGeoTest::Init" << endl; - FairRootManager* ioman = FairRootManager::Instance(); - if (NULL == ioman) { Fatal("CbmRichGeoTest::Init", "RootManager not instantised!"); } - - CbmMCDataManager* mcManager = (CbmMCDataManager*) ioman->GetObject("MCDataManager"); - if (mcManager == nullptr) LOG(fatal) << "CbmRichGeoTest::Init() NULL MCDataManager."; - - fMcTracks = mcManager->InitBranch("MCTrack"); - if (NULL == fMcTracks) { LOG(fatal) << "CbmRichGeoTest::Init No MCTrack!"; } - - fRichPoints = mcManager->InitBranch("RichPoint"); - if (NULL == fRichPoints) { LOG(fatal) << "CbmRichGeoTest::Init No RichPoint!"; } - - fRichRefPlanePoints = mcManager->InitBranch("RefPlanePoint"); - if (NULL == fRichRefPlanePoints) { LOG(fatal) << "CbmRichGeoTest::Init No RefPlanePoint!"; } - - fRichHits = (TClonesArray*) ioman->GetObject("RichHit"); - if (NULL == fRichHits) { LOG(fatal) << "CbmRichGeoTest::Init No RichHit!"; } + fMcTracks = InitOrFatalMc("MCTrack", "CbmRichGeoTest::Init"); + fRichPoints = InitOrFatalMc("RichPoint", "CbmRichGeoTest::Init"); + fRichRefPlanePoints = InitOrFatalMc("RefPlanePoint", "CbmRichGeoTest::Init"); + fRichHits = GetOrFatal<TClonesArray>("RichHit", "CbmRichUrqmdTest::Init"); + fRichRings = GetOrFatal<TClonesArray>("RichRing", "CbmRichUrqmdTest::Init"); + fRichRingMatches = GetOrFatal<TClonesArray>("RichRingMatch", "CbmRichUrqmdTest::Init"); + fEventList = GetOrFatal<CbmMCEventList>("MCEventList.", "CbmRichUrqmdTest::Init"); fDigiMan = CbmDigiManager::Instance(); fDigiMan->Init(); if (!fDigiMan->IsPresent(ECbmModuleId::kRich)) { LOG(fatal) << "CbmRichGeoTest::Init No RichDigi!"; } - if (!fDigiMan->IsMatchPresent(ECbmModuleId::kRich)) { LOG(fatal) << "CbmRichGeoTest::Init No RichDigiMatch!"; } - fRichRings = (TClonesArray*) ioman->GetObject("RichRing"); - if (NULL == fRichRings) { LOG(fatal) << "CbmRichGeoTest::Init No RichRing!"; } - - fRichRingMatches = (TClonesArray*) ioman->GetObject("RichRingMatch"); - if (NULL == fRichRingMatches) { LOG(fatal) << "CbmRichGeoTest::Init No RichRingMatch!"; } - - fEventList = (CbmMCEventList*) ioman->GetObject("MCEventList."); - if (NULL == fEventList) { LOG(fatal) << "CbmRichGeoTest::Init No MCEventList!"; } - fCopFit = new CbmRichRingFitterCOP(); fTauFit = new CbmRichRingFitterEllipseTau(); @@ -161,13 +107,6 @@ void CbmRichGeoTest::Exec(Option_t* /*option*/) void CbmRichGeoTest::InitHistograms() { - // double xMin = -120.; - // double xMax = 120.; - // int nBinsX = 60; - // double yMin = -210; - // double yMax = 210.; - // int nBinsY = 105; - double xMin = -120.; double xMax = 120.; int nBinsX = 300; @@ -181,34 +120,34 @@ void CbmRichGeoTest::InitHistograms() fHM->Create2<TH2D>("fhPointsXY", "fhPointsXY;X [cm];Y [cm];Counter", nBinsX, xMin, xMax, nBinsY, yMin, yMax); fHM->Create2<TH2D>("fhPointsXYNoRotation", "fhPointsXYNoRotation;X [cm];Y [cm];Counter", nBinsX, xMin, xMax, nBinsY, yMin, yMax); - fHM->Create1<TH1D>("fhHitsZ", "fhHitsZ;Z [cm];Yield", 1000, 150, 250); - fHM->Create1<TH1D>("fhPointsZ", "fhPointsZ;Z [cm];Yield", 100, 190, 250); - - for (Int_t i = 0; i < 2; i++) { - stringstream ss; - if (i == 0) ss << "_hits"; - if (i == 1) ss << "_points"; - string t = ss.str(); - if (i == 0) fHM->Create1<TH1D>("fhNofHits" + t, "fhNofHits" + t + ";Nof hits in ring;Yield", 50, -.5, 49.5); - if (i == 1) fHM->Create1<TH1D>("fhNofHits" + t, "fhNofHits" + t + ";Nof points in ring;Yield", 400, -.5, 399.5); + fHM->Create1<TH1D>("fhHitsZ", "fhHitsZ;Z [cm];Yield", 150, 100, 250); + fHM->Create1<TH1D>("fhPointsZ", "fhPointsZ;Z [cm];Yield", 150, 100, 250); + fHM->Create1<TH1D>("fhMcVertexZEl", "fhMcVertexZEl;Z [cm];Counter", 250, -100., 150); + fHM->Create2<TH2D>("fhMcVertexXYEl", "fhMcVertexXYEl;X [cm];Y [cm];Counter", 50, -5., 5., 50, -5., 5.); + + vector<string> hp = {"_hits", "_points"}; + for (size_t i = 0; i < hp.size(); i++) { + string t = hp[i]; + if (i == 0) fHM->Create1<TH1D>("fhNofHits" + t, "fhNofHits" + t + ";# hits/ring;Yield", 50, -.5, 49.5); + if (i == 1) fHM->Create1<TH1D>("fhNofHits" + t, "fhNofHits" + t + ";# points/ring;Yield", 400, -.5, 399.5); // ellipse fitting parameters - fHM->Create2<TH2D>("fhBoverAVsMom" + t, "fhBoverAVsMom" + t + ";p [GeV/c];B/A;Yield", 40, 0., 10, 100, 0, 1); + fHM->Create2<TH2D>("fhBoAVsMom" + t, "fhBoAVsMom" + t + ";P [GeV/c];B/A;Yield", 40, 0., 10, 100, 0, 1); fHM->Create2<TH2D>("fhXcYcEllipse" + t, "fhXcYcEllipse" + t + ";X [cm];Y [cm];Yield", nBinsX, xMin, xMax, nBinsY, yMin, yMax); - fHM->Create2<TH2D>("fhBaxisVsMom" + t, "fhBaxisVsMom" + t + ";p [GeV/c];B axis [cm];Yield", 40, 0., 10, 200, 0., + fHM->Create2<TH2D>("fhBaxisVsMom" + t, "fhBaxisVsMom" + t + ";P [GeV/c];B axis [cm];Yield", 40, 0., 10, 200, 0., 10.); - fHM->Create2<TH2D>("fhAaxisVsMom" + t, "fhAaxisVsMom" + t + ";p [GeV/c];A axis [cm];Yield", 40, 0., 10, 200, 0., + fHM->Create2<TH2D>("fhAaxisVsMom" + t, "fhAaxisVsMom" + t + ";P [GeV/c];A axis [cm];Yield", 40, 0., 10, 200, 0., 10.); - fHM->Create2<TH2D>("fhChi2EllipseVsMom" + t, "fhChi2EllipseVsMom" + t + ";p [GeV/c];#Chi^{2};Yield", 40, 0., 10., + fHM->Create2<TH2D>("fhChi2EllipseVsMom" + t, "fhChi2EllipseVsMom" + t + ";P [GeV/c];#Chi^{2};Yield", 40, 0., 10., 50, 0., 0.5); // circle fitting parameters - fHM->Create2<TH2D>("fhXcYcCircle" + t, "fhXcYcCircle" + t + ";x [cm];y [cm];Yield", nBinsX, xMin, xMax, nBinsY, + fHM->Create2<TH2D>("fhXcYcCircle" + t, "fhXcYcCircle" + t + ";X [cm];Y [cm];Yield", nBinsX, xMin, xMax, nBinsY, yMin, yMax); - fHM->Create2<TH2D>("fhRadiusVsMom" + t, "fhRadiusVsMom" + t + ";p [GeV/c];Radius [cm];Yield", 40, 0., 10, 200, 0., + fHM->Create2<TH2D>("fhRadiusVsMom" + t, "fhRadiusVsMom" + t + ";P [GeV/c];Radius [cm];Yield", 40, 0., 10, 200, 0., 10.); - fHM->Create2<TH2D>("fhChi2CircleVsMom" + t, "fhChi2CircleVsMom" + t + ";p [GeV/c];#Chi^{2};Yield", 40, 0., 10., 50, + fHM->Create2<TH2D>("fhChi2CircleVsMom" + t, "fhChi2CircleVsMom" + t + ";P [GeV/c];#Chi^{2};Yield", 40, 0., 10., 50, 0., .5); - fHM->Create2<TH2D>("fhDRVsMom" + t, "fhDRVsMom" + t + ";p [GeV/c];dR [cm];Yield", 40, 0, 10, 200, -2., 2.); + fHM->Create2<TH2D>("fhDRVsMom" + t, "fhDRVsMom" + t + ";P [GeV/c];dR [cm];Yield", 40, 0, 10, 200, -2., 2.); fHM->Create1<TH1D>("fhBaxisUpHalf" + t, "fhBaxisUpHalf" + t + ";B axis [cm];Yield", 200, 0., 10.); fHM->Create1<TH1D>("fhBaxisDownHalf" + t, "fhBaxisDownHalf" + t + ";B axis [cm];Yield", 200, 0., 10.); @@ -217,59 +156,50 @@ void CbmRichGeoTest::InitHistograms() fHM->Create1<TH1D>("fhNofPhotonsPerHit", "fhNofPhotonsPerHit;Number of photons per hit;Yield", 10, -0.5, 9.5); // Difference between Mc Points and Hits fitting. - fHM->Create2<TH2D>("fhDiffAaxis", "fhDiffAaxis;Nof hits in ring;A_{point}-A_{hit} [cm];Yield", 40, 0., 40., 100, -1.5, - 1.5); - fHM->Create2<TH2D>("fhDiffBaxis", "fhDiffBaxis;Nof hits in ring;B_{point}-B_{hit} [cm];Yield", 40, 0., 40., 100, -1.5, - 1.5); - fHM->Create2<TH2D>("fhDiffXcEllipse", "fhDiffXcEllipse;Nof hits in ring;Xc_{point}-Xc_{hit} [cm];Yield", 40, 0., 40., - 100, -1.5, 1.5); - fHM->Create2<TH2D>("fhDiffYcEllipse", "fhDiffYcEllipse;Nof hits in ring;Yc_{point}-Yc_{hit} [cm];Yield", 40, 0., 40., - 100, -1.5, 1.5); - fHM->Create2<TH2D>("fhDiffXcCircle", "fhDiffXcCircle;Nof hits in ring;Xc_{point}-Xc_{hit} [cm];Yield", 40, 0., 40., - 100, -1.5, 1.5); - fHM->Create2<TH2D>("fhDiffYcCircle", "fhDiffYcCircle;Nof hits in ring;Yc_{point}-Yc_{hit} [cm];Yield", 40, 0., 40., - 100, -1.5, 1.5); - fHM->Create2<TH2D>("fhDiffRadius", "fhDiffRadius;Nof hits in ring;Radius_{point}-Radius_{hit} [cm];Yield", 40, 0., - 40., 100, -1.5, 1.5); + fHM->Create2<TH2D>("fhDiffAaxis", "fhDiffAaxis;# hits/ring;A_{point}-A_{hit} [cm];Yield", 25, 0., 50., 100, -1., 1.); + fHM->Create2<TH2D>("fhDiffBaxis", "fhDiffBaxis;# hits/ring;B_{point}-B_{hit} [cm];Yield", 25, 0., 50., 100, -1., 1.); + fHM->Create2<TH2D>("fhDiffXcEllipse", "fhDiffXcEllipse;# hits/ring;Xc_{point}-Xc_{hit} [cm];Yield", 25, 0., 50., 100, + -1., 1.); + fHM->Create2<TH2D>("fhDiffYcEllipse", "fhDiffYcEllipse;# hits/ring;Yc_{point}-Yc_{hit} [cm];Yield", 25, 0., 50., 100, + -1., 1.); + fHM->Create2<TH2D>("fhDiffXcCircle", "fhDiffXcCircle;# hits/ring;Xc_{point}-Xc_{hit} [cm];Yield", 25, 0., 50., 100, + -1., 1.); + fHM->Create2<TH2D>("fhDiffYcCircle", "fhDiffYcCircle;# hits/ring;Yc_{point}-Yc_{hit} [cm];Yield", 25, 0., 50., 100, + -1., 1.); + fHM->Create2<TH2D>("fhDiffRadius", "fhDiffRadius;# hits/ring;Radius_{point}-Radius_{hit} [cm];Yield", 25, 0., 50., + 100, -1., 1.); // R, A, B distribution for different number of hits from 0 to 40. - fHM->Create2<TH2D>("fhRadiusVsNofHits", "fhRadiusVsNofHits;Nof hits in ring;Radius [cm];Yield", 40, 0., 40., 100, 0., - 10.); - fHM->Create2<TH2D>("fhAaxisVsNofHits", "fhAaxisVsNofHits;Nof hits in ring;A axis [cm];Yield", 40, 0., 40., 100, 0., - 10.); - fHM->Create2<TH2D>("fhBaxisVsNofHits", "fhBaxisVsNofHits;Nof hits in ring;B axis [cm];Yield", 40, 0., 40., 100, 0., - 10.); - fHM->Create2<TH2D>("fhDRVsNofHits", "fhDRVsNofHits;Nof hits in ring;dR [cm];Yield", 40, 0., 40., 200, -2., 2.); + fHM->Create2<TH2D>("fhRadiusVsNofHits", "fhRadiusVsNofHits;# hits/ring;Radius [cm];Yield", 40, 0., 40., 100, 0., 10.); + fHM->Create2<TH2D>("fhAaxisVsNofHits", "fhAaxisVsNofHits;# hits/ring;A axis [cm];Yield", 40, 0., 40., 100, 0., 10.); + fHM->Create2<TH2D>("fhBaxisVsNofHits", "fhBaxisVsNofHits;# hits/ring;B axis [cm];Yield", 40, 0., 40., 100, 0., 10.); + fHM->Create2<TH2D>("fhDRVsNofHits", "fhDRVsNofHits;# hits/ring;dR [cm];Yield", 40, 0., 40., 200, -2., 2.); // Hits and points. fHM->Create1<TH1D>("fhDiffXhit", "fhDiffXhit;X_{point}-X_{hit} [cm];Yield", 200, -.5, .5); fHM->Create1<TH1D>("fhDiffYhit", "fhDiffYhit;Y_{point}-Y_{hit} [cm];Yield", 200, -.5, .5); // Fitting efficiency. - fHM->Create1<TH1D>("fhNofHitsAll", "fhNofHitsAll;Nof hits in ring;Yield", 50, 0., 50.); - fHM->Create1<TH1D>("fhNofHitsCircleFit", "fhNofHitsCircleFit;Nof hits in ring;Yield", 50, 0., 50.); - fHM->Create1<TH1D>("fhNofHitsEllipseFit", "fhNofHitsEllipseFit;Nof hits in ring;Yield", 50, 0., 50.); - fHM->Create1<TH1D>("fhNofHitsCircleFitEff", "fhNofHitsCircleFitEff;Nof hits in ring;Efficiency [%]", 50, 0., 50.); - fHM->Create1<TH1D>("fhNofHitsEllipseFitEff", "fhNofHitsEllipseFitEff;Nof hits in ring;Efficiency [%]", 50, 0., 50.); - - // Detector acceptance efficiency vs. (pt,y) and p - fHM->Create1<TH1D>("fhMcMomEl", "fhMcMomEl;p [GeV/c];Yield", 24, 0., 12.); - fHM->Create2<TH2D>("fhMcPtyEl", "fhMcPtyEl;Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 20, 0., 3.); - fHM->Create1<TH1D>("fhAccMomEl", "fhAccMomEl;p [GeV/c];Yield", 24, 0., 12.); - fHM->Create2<TH2D>("fhAccPtyEl", "fhAccPtyEl;Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 20, 0., 3.); - - fHM->Create1<TH1D>("fhMcMomPi", "fhMcMomPi;p [GeV/c];Yield", 24, 0., 12.); - fHM->Create2<TH2D>("fhMcPtyPi", "fhMcPtyPi;Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 20, 0., 3.); - fHM->Create1<TH1D>("fhAccMomPi", "fhAccMomPi;p [GeV/c];Yield", 24, 0., 12.); - fHM->Create2<TH2D>("fhAccPtyPi", "fhAccPtyPi;Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 20, 0., 3.); + fHM->Create1<TH1D>("fhNofHitsAll", "fhNofHitsAll;# hits/ring;Yield", 50, 0., 50.); + fHM->Create1<TH1D>("fhNofHitsCircleFit", "fhNofHitsCircleFit;# hits/ring;Yield", 50, 0., 50.); + fHM->Create1<TH1D>("fhNofHitsEllipseFit", "fhNofHitsEllipseFit;# hits/ring;Yield", 50, 0., 50.); + fHM->Create1<TH1D>("fhNofHitsCircleFitEff", "fhNofHitsCircleFitEff;# hits/ring;Efficiency [%]", 50, 0., 50.); + fHM->Create1<TH1D>("fhNofHitsEllipseFitEff", "fhNofHitsEllipseFitEff;# hits/ring;Efficiency [%]", 50, 0., 50.); + + // Detector acceptance efficiency 2D:Pt-Rapidity, 2D:P-Rapidity, 1D:P + vector<string> mcAccTypes {"Mc", "Acc"}; + for (const string& t : mcAccTypes) { + fHM->Create1<TH1D>("fhMomEl" + t, "fhMomEl" + t + ";p [GeV/c];Yield", 50, 0., 10.); + fHM->Create2<TH2D>("fhPtYEl" + t, "fhPtYEl" + t + ";Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 25, 0., 3.); + fHM->Create2<TH2D>("fhPYEl" + t, "fhPYEl" + t + ";Rapidity;P [GeV/c];Yield", 25, 0., 4., 25, 0., 10.); + } // Numbers in dependence on XY position onto the photodetector. - fHM->Create3<TH3D>("fhNofHitsXYZ", "fhNofHitsXYZ;X [cm];Y [cm];Nof hits in ring", nBinsX, xMin, xMax, nBinsY, yMin, - yMax, 50, 0., 50); - fHM->Create3<TH3D>("fhNofPointsXYZ", "fhNofPointsXYZ;X [cm];Y [cm];Nof points in ring", nBinsX, xMin, xMax, nBinsY, - yMin, yMax, 50, 100., 300.); - fHM->Create3<TH3D>("fhBoverAXYZ", "fhBoverAXYZ;X [cm];Y [cm];B/A", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 100, 0., - 1.); + fHM->Create3<TH3D>("fhNofHitsXYZ", "fhNofHitsXYZ;X [cm];Y [cm];# hits/ring", nBinsX, xMin, xMax, nBinsY, yMin, yMax, + 50, 0., 50); + fHM->Create3<TH3D>("fhNofPointsXYZ", "fhNofPointsXYZ;X [cm];Y [cm];# points/ring", nBinsX, xMin, xMax, nBinsY, yMin, + yMax, 50, 100., 300.); + fHM->Create3<TH3D>("fhBoAXYZ", "fhBoAXYZ;X [cm];Y [cm];B/A", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 100, 0., 1.); fHM->Create3<TH3D>("fhBaxisXYZ", "fhBaxisXYZ;X [cm];Y [cm];B axis [cm]", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 80, 3., 7.); fHM->Create3<TH3D>("fhAaxisXYZ", "fhAaxisXYZ;X [cm];Y [cm];A axis [cm]", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 80, @@ -285,16 +215,15 @@ void CbmRichGeoTest::InitHistograms() int yMin1 = 100; int yMax1 = 200; // Numbers in dependence X or Y position onto the photodetector plane - fHM->Create2<TH2D>("fhNofHitsVsX", "fhNofHitsVsX;X [cm];Nof hits in ring", nBinsX1, xMin1, xMax1, 50, 0., 50); - fHM->Create2<TH2D>("fhNofHitsVsY", "fhNofHitsVsY;Abs(Y) [cm];Nof hits in ring", nBinsY1, yMin1, yMax1, 50, 0., 50); + fHM->Create2<TH2D>("fhNofHitsVsX", "fhNofHitsVsX;X [cm];# hits/ring", nBinsX1, xMin1, xMax1, 50, 0., 50); + fHM->Create2<TH2D>("fhNofHitsVsY", "fhNofHitsVsY;Abs(Y) [cm];# hits/ring", nBinsY1, yMin1, yMax1, 50, 0., 50); - fHM->Create2<TH2D>("fhNofPointsVsX", "fhNofPointsVsX;X [cm];Nof points in ring", nBinsX1, xMin1, xMax1, 50, 100., - 300.); - fHM->Create2<TH2D>("fhNofPointsVsY", "fhNofPointsVsY;Abs(Y) [cm];Nof points in ring", nBinsY1, yMin1, yMax1, 50, 100., + fHM->Create2<TH2D>("fhNofPointsVsX", "fhNofPointsVsX;X [cm];# points/ring", nBinsX1, xMin1, xMax1, 50, 100., 300.); + fHM->Create2<TH2D>("fhNofPointsVsY", "fhNofPointsVsY;Abs(Y) [cm];# points/ring", nBinsY1, yMin1, yMax1, 50, 100., 300.); - fHM->Create2<TH2D>("fhBoverAVsX", "fhBoverAVsX;X [cm];B/A", nBinsX1, xMin1, xMax1, 100, 0., 1.); - fHM->Create2<TH2D>("fhBoverAVsY", "fhBoverAVsY;Abs(Y) [cm];B/A", nBinsY1, yMin1, yMax1, 100, 0., 1.); + fHM->Create2<TH2D>("fhBoAVsX", "fhBoAVsX;X [cm];B/A", nBinsX1, xMin1, xMax1, 100, 0., 1.); + fHM->Create2<TH2D>("fhBoAVsY", "fhBoAVsY;Abs(Y) [cm];B/A", nBinsY1, yMin1, yMax1, 100, 0., 1.); fHM->Create2<TH2D>("fhBaxisVsX", "fhBaxisVsX;X [cm];B axis [cm]", nBinsX1, xMin1, xMax1, 80, 3., 7.); fHM->Create2<TH2D>("fhBaxisVsY", "fhBaxisVsY;Abs(Y) [cm];B axis [cm]", nBinsY1, yMin1, yMax1, 80, 3., 7.); @@ -308,48 +237,50 @@ void CbmRichGeoTest::InitHistograms() fHM->Create2<TH2D>("fhdRVsX", "fhdRVsX;X [cm];dR [cm]", nBinsX1, xMin1, xMax1, 100, -1., 1.); fHM->Create2<TH2D>("fhdRVsY", "fhdRVsY;Abs(Y) [cm];dR [cm]", nBinsY1, yMin1, yMax1, 100, -1., 1.); - fHM->Create1<TH1D>("fhPhotonEPlaneZ+", "fhPhotonEPlaneZ+;Photon energy [eV];Counter", 100, 0., 10.); - fHM->Create1<TH1D>("fhPhotonEPlaneZ-", "fhPhotonEPlaneZ-;Photon energy [eV];Counter", 100, 0., 10.); - fHM->Create1<TH1D>("fhPhotonEPmtPoint", "fhPhotonEPmtPoint;Photon energy [eV];Counter", 100, 0., 10.); - fHM->Create1<TH1D>("fhPhotonEPmtHit", "fhPhotonEPmtHit;Photon energy [eV];Counter", 100, 0., 10.); - - fHM->Create1<TH1D>("fhLambdaPlaneZ+", "fhLambdaPlaneZ+;Photon wavelength [nm];Counter", 100, 0., 700.); - fHM->Create1<TH1D>("fhLambdaPlaneZ-", "fhLambdaPlaneZ-;Photon wavelength [nm];Counter", 100, 0., 700.); - fHM->Create1<TH1D>("fhLambdaPmtPoint", "fhLambdaPmtPoint;Photon wavelength [nm];Counter", 100, 0., 700.); - fHM->Create1<TH1D>("fhLambdaPmtHit", "fhLambdaPmtHit;Photon wavelength [nm];Counter", 100, 0., 700.); + //Photon energy and wevelength + vector<string> photonECat = {"PlaneZ+", "PlaneZ-", "PmtPoint", "PmtHit"}; + for (const auto& t : photonECat) { + fHM->Create1<TH1D>("fhPhotonE" + t, "fhPhotonE" + t + ";Photon energy [eV];Counter", 100, 0., 10.); + fHM->Create1<TH1D>("fhLambda" + t, "fhLambda" + t + ";Photon wavelength [nm];Counter", 100, 0., 700.); + } } void CbmRichGeoTest::ProcessMc() { - Int_t nofEvents = fEventList->GetNofEvents(); - for (Int_t iE = 0; iE < nofEvents; iE++) { - Int_t fileId = fEventList->GetFileIdByIndex(iE); - Int_t eventId = fEventList->GetEventIdByIndex(iE); + size_t nofEvents = fEventList->GetNofEvents(); + for (size_t iE = 0; iE < nofEvents; iE++) { + int fileId = fEventList->GetFileIdByIndex(iE); + int eventId = fEventList->GetEventIdByIndex(iE); - Int_t nofMcTracks = fMcTracks->Size(fileId, eventId); - for (Int_t iT = 0; iT < nofMcTracks; iT++) { + int nofMcTracks = fMcTracks->Size(fileId, eventId); + for (int iT = 0; iT < nofMcTracks; iT++) { const CbmMCTrack* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, iT)); - if (!mcTrack) continue; - Int_t motherId = mcTrack->GetMotherId(); - Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); - Bool_t isMcPrimaryElectron = - (pdg == 11 && motherId == -1) || (mcTrack->GetGeantProcessId() == kPPrimary && pdg == 11); + if (mcTrack == nullptr) continue; + int motherId = mcTrack->GetMotherId(); + int pdgAbs = std::abs(mcTrack->GetPdgCode()); + bool isMcPrimaryElectron = + (pdgAbs == 11 && motherId == -1) || (mcTrack->GetGeantProcessId() == kPPrimary && pdgAbs == 11); if (isMcPrimaryElectron) { - fHM->H1("fhMcMomEl")->Fill(mcTrack->GetP()); - fHM->H2("fhMcPtyEl")->Fill(mcTrack->GetRapidity(), mcTrack->GetPt()); + fHM->H1("fhMomElMc")->Fill(mcTrack->GetP()); + fHM->H2("fhPtYElMc")->Fill(mcTrack->GetRapidity(), mcTrack->GetPt()); + fHM->H2("fhPYElMc")->Fill(mcTrack->GetRapidity(), mcTrack->GetP()); + TVector3 v; + mcTrack->GetStartVertex(v); + fHM->H1("fhMcVertexZEl")->Fill(v.Z()); + fHM->H1("fhMcVertexXYEl")->Fill(v.X(), v.Y()); } - if (pdg == 211 && motherId == -1) { + if (pdgAbs == 211 && motherId == -1) { fHM->H1("fhMcMomPi")->Fill(mcTrack->GetP()); fHM->H2("fhMcPtyPi")->Fill(mcTrack->GetRapidity(), mcTrack->GetPt()); } } - Int_t nofPoints = fRichPoints->Size(fileId, eventId); - for (Int_t iP = 0; iP < nofPoints; iP++) { + int nofPoints = fRichPoints->Size(fileId, eventId); + for (int iP = 0; iP < nofPoints; iP++) { const CbmRichPoint* point = static_cast<CbmRichPoint*>(fRichPoints->Get(fileId, eventId, iP)); - if (point == NULL) continue; + if (point == nullptr) continue; TVector3 inPos(point->GetX(), point->GetY(), point->GetZ()); TVector3 outPos; CbmRichGeoManager::GetInstance().RotatePoint(&inPos, &outPos); @@ -359,20 +290,20 @@ void CbmRichGeoTest::ProcessMc() TVector3 mom; point->Momentum(mom); - Double_t momMag = mom.Mag(); + double momMag = mom.Mag(); fHM->H1("fhPhotonEPmtPoint")->Fill(1.e9 * momMag); - Double_t lambda = CbmRichPmt::getLambda(momMag); + double lambda = CbmRichPmt::getLambda(momMag); fHM->H1("fhLambdaPmtPoint")->Fill(lambda); } - Int_t nofPlanePoints = fRichRefPlanePoints->Size(fileId, eventId); - for (Int_t iP = 0; iP < nofPlanePoints; iP++) { + int nofPlanePoints = fRichRefPlanePoints->Size(fileId, eventId); + for (int iP = 0; iP < nofPlanePoints; iP++) { const CbmRichPoint* point = static_cast<CbmRichPoint*>(fRichRefPlanePoints->Get(fileId, eventId, iP)); - if (point == NULL) continue; + if (point == nullptr) continue; TVector3 mom; point->Momentum(mom); - Double_t momMag = mom.Mag(); - Double_t lambda = CbmRichPmt::getLambda(momMag); + double momMag = mom.Mag(); + double lambda = CbmRichPmt::getLambda(momMag); if (point->GetPz() > 0) { fHM->H1("fhPhotonEPlaneZ+")->Fill(1.e9 * momMag); fHM->H1("fhLambdaPlaneZ+")->Fill(lambda); @@ -385,67 +316,69 @@ void CbmRichGeoTest::ProcessMc() } } +CbmRichRingLight CbmRichGeoTest::CreateRingLightWithPoints(int fileId, int mcEventId, int mcTrackId) +{ + CbmRichRingLight ringPoint; + int nofRichPoints = fRichPoints->Size(fileId, mcEventId); + for (int iPoint = 0; iPoint < nofRichPoints; iPoint++) { + const CbmRichPoint* richPoint = static_cast<CbmRichPoint*>(fRichPoints->Get(fileId, mcEventId, iPoint)); + if (richPoint == nullptr) continue; + int trackId = richPoint->GetTrackID(); + if (trackId < 0) continue; + const CbmMCTrack* mcTrackRich = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, mcEventId, trackId)); + if (mcTrackRich == nullptr) continue; + int motherIdRich = mcTrackRich->GetMotherId(); + if (motherIdRich == mcTrackId) { + TVector3 posPoint; + richPoint->Position(posPoint); + TVector3 detPoint; + CbmRichGeoManager::GetInstance().RotatePoint(&posPoint, &detPoint); + CbmRichHitLight hit(detPoint.X(), detPoint.Y()); + ringPoint.AddHit(hit); + } + } + return ringPoint; +} + void CbmRichGeoTest::RingParameters() { - Int_t fileId = 0; - Int_t nofRings = fRichRings->GetEntriesFast(); - for (Int_t iR = 0; iR < nofRings; iR++) { - CbmRichRing* ring = (CbmRichRing*) fRichRings->At(iR); - if (NULL == ring) continue; + int fileId = 0; + int nofRings = fRichRings->GetEntriesFast(); + for (int iR = 0; iR < nofRings; iR++) { + const CbmRichRing* ring = static_cast<CbmRichRing*>(fRichRings->At(iR)); + if (ring == nullptr) continue; const CbmTrackMatchNew* ringMatch = static_cast<CbmTrackMatchNew*>(fRichRingMatches->At(iR)); - if (NULL == ringMatch) continue; - Int_t mcEventId = ringMatch->GetMatchedLink().GetEntry(); - Int_t mcTrackId = ringMatch->GetMatchedLink().GetIndex(); + if (ringMatch == nullptr) continue; + int mcEventId = ringMatch->GetMatchedLink().GetEntry(); + int mcTrackId = ringMatch->GetMatchedLink().GetIndex(); const CbmMCTrack* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, mcEventId, mcTrackId)); - if (NULL == mcTrack) continue; - - Int_t motherId = mcTrack->GetMotherId(); - Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); - Double_t momentum = mcTrack->GetP(); - Double_t pt = mcTrack->GetPt(); - Double_t rapidity = mcTrack->GetRapidity(); - Bool_t isMcPrimaryElectron = - (pdg == 11 && motherId == -1) || (mcTrack->GetGeantProcessId() == kPPrimary && pdg == 11); + if (mcTrack == nullptr) continue; + int motherId = mcTrack->GetMotherId(); + int pdgAbs = std::abs(mcTrack->GetPdgCode()); + double mom = mcTrack->GetP(); + double pt = mcTrack->GetPt(); + double rapidity = mcTrack->GetRapidity(); + bool isMcPrimaryElectron = + (pdgAbs == 11 && motherId == -1) || (mcTrack->GetGeantProcessId() == kPPrimary && pdgAbs == 11); if (ring->GetNofHits() >= fMinNofHits) { if (isMcPrimaryElectron) { - fHM->H1("fhAccMomEl")->Fill(momentum); - fHM->H2("fhAccPtyEl")->Fill(rapidity, pt); - } - if (pdg == 211 && motherId == -1) { - fHM->H1("fhAccMomPi")->Fill(momentum); - fHM->H2("fhAccPtyPi")->Fill(rapidity, pt); + fHM->H1("fhMomElAcc")->Fill(mom); + fHM->H2("fhPtYElAcc")->Fill(rapidity, pt); + fHM->H2("fhPYElAcc")->Fill(rapidity, mom); } } if (!isMcPrimaryElectron) continue; // only primary electrons - CbmRichRingLight ringPoint; - int nofRichPoints = fRichPoints->Size(fileId, mcEventId); - for (int iPoint = 0; iPoint < nofRichPoints; iPoint++) { - const CbmRichPoint* richPoint = static_cast<CbmRichPoint*>(fRichPoints->Get(fileId, mcEventId, iPoint)); - if (NULL == richPoint) continue; - Int_t trackId = richPoint->GetTrackID(); - if (trackId < 0) continue; - CbmMCTrack* mcTrackRich = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, mcEventId, trackId)); - if (NULL == mcTrackRich) continue; - int motherIdRich = mcTrackRich->GetMotherId(); - if (motherIdRich == mcTrackId) { - TVector3 posPoint; - richPoint->Position(posPoint); - TVector3 detPoint; - CbmRichGeoManager::GetInstance().RotatePoint(&posPoint, &detPoint); - CbmRichHitLight hit(detPoint.X(), detPoint.Y()); - ringPoint.AddHit(hit); - } - } + CbmRichRingLight ringPoint = CreateRingLightWithPoints(fileId, mcEventId, mcTrackId); fHM->H1("fhNofHitsAll")->Fill(ring->GetNofHits()); CbmRichRingLight ringHit; CbmRichConverter::CopyHitsToRingLight(ring, &ringHit); - FitAndFillHistCircle(0, &ringHit, momentum); //hits - FitAndFillHistCircle(1, &ringPoint, momentum); // points + FitAndFillHistCircle(0, &ringHit, mom); //hits + FitAndFillHistCircle(1, &ringPoint, mom); // points FillMcVsHitFitCircle(&ringHit, &ringPoint); double r = ringHit.GetRadius(); @@ -457,8 +390,8 @@ void CbmRichGeoTest::RingParameters() } if (fDrawEventDisplay && fNofDrawnRings < 10) { DrawRing(&ringHit, &ringPoint); } - FitAndFillHistEllipse(0, &ringHit, momentum); // hits - FitAndFillHistEllipse(1, &ringPoint, momentum); // points + FitAndFillHistEllipse(0, &ringHit, mom); // hits + FitAndFillHistEllipse(1, &ringPoint, mom); // points FillMcVsHitFitEllipse(&ringHit, &ringPoint); if (ringHit.GetAaxis() > fMinAaxis && ringHit.GetAaxis() < fMaxAaxis && ringHit.GetBaxis() > fMinBaxis @@ -472,21 +405,21 @@ void CbmRichGeoTest::RingParameters() fHM->H3("fhNofHitsXYZ")->Fill(xc, yc, nh); fHM->H3("fhNofPointsXYZ")->Fill(xc, yc, np); - fHM->H3("fhBoverAXYZ")->Fill(xc, yc, b / a); + fHM->H3("fhBoAXYZ")->Fill(xc, yc, b / a); fHM->H3("fhBaxisXYZ")->Fill(xc, yc, b); fHM->H3("fhAaxisXYZ")->Fill(xc, yc, a); fHM->H3("fhRadiusXYZ")->Fill(xc, yc, r); fHM->H2("fhNofHitsVsX")->Fill(xc, nh); fHM->H2("fhNofPointsVsX")->Fill(xc, np); - fHM->H2("fhBoverAVsX")->Fill(xc, b / a); + fHM->H2("fhBoAVsX")->Fill(xc, b / a); fHM->H2("fhBaxisVsX")->Fill(xc, b); fHM->H2("fhAaxisVsX")->Fill(xc, a); fHM->H2("fhRadiusVsX")->Fill(xc, r); fHM->H2("fhNofHitsVsY")->Fill(abs(yc), nh); fHM->H2("fhNofPointsVsY")->Fill(abs(yc), np); - fHM->H2("fhBoverAVsY")->Fill(abs(yc), b / a); + fHM->H2("fhBoAVsY")->Fill(abs(yc), b / a); fHM->H2("fhBaxisVsY")->Fill(abs(yc), b); fHM->H2("fhAaxisVsY")->Fill(abs(yc), a); fHM->H2("fhRadiusVsY")->Fill(abs(yc), r); @@ -511,13 +444,10 @@ void CbmRichGeoTest::FitAndFillHistEllipse(int histIndex, CbmRichRingLight* ring double xcEllipse = ring->GetCenterX(); double ycEllipse = ring->GetCenterY(); int nofHitsRing = ring->GetNofHits(); - string t = ""; - if (histIndex == 0) { t = "_hits"; } - else if (histIndex == 1) { - t = "_points"; - } + string t = (histIndex == 0) ? "_hits" : "_points"; + if (axisA > fMinAaxis && axisA < fMaxAaxis && axisB > fMinBaxis && axisB < fMaxBaxis) { - fHM->H1("fhBoverAVsMom" + t)->Fill(momentum, axisB / axisA); + fHM->H1("fhBoAVsMom" + t)->Fill(momentum, axisB / axisA); fHM->H2("fhXcYcEllipse" + t)->Fill(xcEllipse, ycEllipse); } fHM->H1("fhNofHits" + t)->Fill(nofHitsRing); @@ -543,11 +473,8 @@ void CbmRichGeoTest::FitAndFillHistCircle(int histIndex, CbmRichRingLight* ring, double xcCircle = ring->GetCenterX(); double ycCircle = ring->GetCenterY(); int nofHitsRing = ring->GetNofHits(); - string t = ""; - if (histIndex == 0) { t = "_hits"; } - else if (histIndex == 1) { - t = "_points"; - } + string t = (histIndex == 0) ? "_hits" : "_points"; + fHM->H1("fhXcYcCircle" + t)->Fill(xcCircle, ycCircle); fHM->H1("fhRadiusVsMom" + t)->Fill(momentum, radius); fHM->H1("fhChi2CircleVsMom" + t)->Fill(momentum, ring->GetChi2() / ring->GetNofHits()); @@ -585,39 +512,38 @@ void CbmRichGeoTest::FillMcVsHitFitCircle(CbmRichRingLight* ring, CbmRichRingLig void CbmRichGeoTest::ProcessHits() { - int fileId = 0; - Int_t nofHits = fRichHits->GetEntriesFast(); - for (Int_t iH = 0; iH < nofHits; iH++) { + int fileId = 0; + int nofHits = fRichHits->GetEntriesFast(); + for (int iH = 0; iH < nofHits; iH++) { const CbmRichHit* hit = static_cast<CbmRichHit*>(fRichHits->At(iH)); - if (hit == NULL) continue; - - Int_t digiIndex = hit->GetRefId(); + if (hit == nullptr) continue; + int digiIndex = hit->GetRefId(); if (digiIndex < 0) continue; const CbmRichDigi* digi = fDigiMan->Get<CbmRichDigi>(digiIndex); - if (NULL == digi) continue; + if (digi == nullptr) continue; const CbmMatch* digiMatch = fDigiMan->GetMatch(ECbmModuleId::kRich, digiIndex); - if (NULL == digiMatch) continue; + if (digiMatch == nullptr) continue; vector<CbmLink> links = digiMatch->GetLinks(); - for (UInt_t i = 0; i < links.size(); i++) { - Int_t pointId = links[i].GetIndex(); - Int_t eventId = links[i].GetEntry(); + for (size_t i = 0; i < links.size(); i++) { + int pointId = links[i].GetIndex(); + int eventId = links[i].GetEntry(); if (pointId < 0) continue; // noise hit - const CbmRichPoint* pMCpt = static_cast<CbmRichPoint*>(fRichPoints->Get(fileId, eventId, pointId)); - if (NULL == pMCpt) continue; + const CbmRichPoint* point = static_cast<CbmRichPoint*>(fRichPoints->Get(fileId, eventId, pointId)); + if (point == nullptr) continue; - TVector3 inPos(pMCpt->GetX(), pMCpt->GetY(), pMCpt->GetZ()); + TVector3 inPos(point->GetX(), point->GetY(), point->GetZ()); TVector3 outPos; CbmRichGeoManager::GetInstance().RotatePoint(&inPos, &outPos); fHM->H1("fhDiffXhit")->Fill(hit->GetX() - outPos.X()); fHM->H1("fhDiffYhit")->Fill(hit->GetY() - outPos.Y()); TVector3 mom; - pMCpt->Momentum(mom); - Double_t momMag = mom.Mag(); + point->Momentum(mom); + double momMag = mom.Mag(); fHM->H1("fhPhotonEPmtHit")->Fill(1.e9 * momMag); - Double_t lambda = CbmRichPmt::getLambda(momMag); + double lambda = CbmRichPmt::getLambda(momMag); fHM->H1("fhLambdaPmtHit")->Fill(lambda); } @@ -629,18 +555,21 @@ void CbmRichGeoTest::ProcessHits() void CbmRichGeoTest::DrawRing(CbmRichRingLight* ringHit, CbmRichRingLight* ringPoint) { + if (ringHit->GetNofHits() < 1 || ringPoint->GetNofHits() < 1) return; stringstream ss; - ss << "Event" << fNofDrawnRings; + ss << "event_display/richgeo_event_display_" << fNofDrawnRings; fNofDrawnRings++; - TCanvas* c = fHM->CreateCanvas(ss.str().c_str(), ss.str().c_str(), 500, 500); + TCanvas* c = fHM->CreateCanvas(ss.str().c_str(), ss.str().c_str(), 800, 800); c->SetGrid(true, true); TH2D* pad = new TH2D(ss.str().c_str(), (ss.str() + ";X [cm];Y [cm]").c_str(), 1, -15., 15., 1, -15., 15); pad->SetStats(false); pad->Draw(); - // find min and max x and y positions of the hits - // in order to shift drawing - double xmin = 99999., xmax = -99999., ymin = 99999., ymax = -99999.; + // find min and max x and y positions of the hits in order to shift drawing + double xmin = ringHit->GetHit(0).fX; + double xmax = ringHit->GetHit(0).fX; + double ymin = ringHit->GetHit(0).fY; + double ymax = ringHit->GetHit(0).fY; for (int i = 0; i < ringHit->GetNofHits(); i++) { double hitX = ringHit->GetHit(i).fX; double hitY = ringHit->GetHit(i).fY; @@ -683,11 +612,11 @@ void CbmRichGeoTest::DrawRing(CbmRichRingLight* ringHit, CbmRichRingLight* ringP TH1D* CbmRichGeoTest::CreateAccVsMinNofHitsHist() { - Int_t nofMc = (Int_t) fHM->H1("fhMcMomEl")->GetEntries(); - TH1D* hist = (TH1D*) fHM->H1("fhNofHits_hits")->Clone("fhAccVsMinNofHitsHist"); + int nofMc = fHM->H1("fhMomElMc")->GetEntries(); + TH1D* hist = static_cast<TH1D*>(fHM->H1("fhNofHits_hits")->Clone("fhAccVsMinNofHitsHist")); hist->GetXaxis()->SetTitle("Required min nof hits in ring"); hist->GetYaxis()->SetTitle("Detector acceptance [%]"); - Double_t sum = 0.; + double sum = 0.; for (int i = hist->GetNbinsX(); i > 1; i--) { sum += fHM->H1("fhNofHits_hits")->GetBinContent(i); hist->SetBinContent(i, 100. * sum / nofMc); @@ -703,7 +632,9 @@ void CbmRichGeoTest::DrawH2MeanRms(TH2* hist, const string& canvasName) DrawH2WithProfile(hist); c->cd(2); TH1D* py = (TH1D*) hist->ProjectionY((string(hist->GetName()) + "_py").c_str())->Clone(); - DrawH1andFitGauss(py); + //DrawH1andFitGauss(py); + DrawH1(py, kLinear, kLinear, "hist"); + py->SetStats(true); py->Scale(1. / py->Integral()); py->GetYaxis()->SetTitle("Yield"); } @@ -712,6 +643,15 @@ void CbmRichGeoTest::DrawHist() { SetDefaultDrawStyle(); + { + TCanvas* c = fHM->CreateCanvas("richgeo_vertex_el", "richgeo_vertex_el", 2000, 1000); + c->Divide(2, 1); + c->cd(1); + DrawH1(fHM->H1("fhMcVertexZEl"), kLinear, kLinear, "hist"); + c->cd(2); + DrawH2(fHM->H2("fhMcVertexXYEl")); + } + { TCanvas* c = fHM->CreateCanvas("richgeo_hits_xy", "richgeo_hits_xy", 1200, 1200); CbmRichDraw::DrawPmtH2(fHM->H2("fhHitsXY"), c); @@ -728,82 +668,82 @@ void CbmRichGeoTest::DrawHist() } { - fHM->CreateCanvas("richgeo_hits_z", "richgeo_hits_z", 800, 800); - fHM->H1("fhHitsZ")->Scale(1. / fHM->H1("fhHitsZ")->Integral()); + fHM->CreateCanvas("richgeo_hits_z", "richgeo_hits_z", 1200, 1200); + fHM->NormalizeToIntegral("fhHitsZ"); DrawH1(fHM->H1("fhHitsZ"), kLinear, kLinear, "hist"); } { - fHM->CreateCanvas("richgeo_points_z", "richgeo_points_z", 800, 800); - fHM->H1("fhPointsZ")->Scale(1. / fHM->H1("fhPointsZ")->Integral()); + fHM->CreateCanvas("richgeo_points_z", "richgeo_points_z", 1200, 1200); + fHM->NormalizeToIntegral("fhPointsZ"); DrawH1(fHM->H1("fhPointsZ"), kLinear, kLinear, "hist"); } - for (int i = 0; i < 2; i++) { - string t; - if (i == 0) { t = "_hits"; } - else if (i == 1) { - t = "_points"; - } + vector<string> ph = {"_hits", "_points"}; + for (const string& t : ph) { - DrawH2MeanRms((TH2D*) fHM->H2("fhBoverAVsMom" + t), "richgeo" + t + "_ellipse_boa_vs_mom"); - fHM->H2("fhBoverAVsMom" + t)->GetYaxis()->SetRangeUser(0.8, 1.0); + DrawH2MeanRms(fHM->H2("fhBoAVsMom" + t), "richgeo" + t + "_ellipse_boa_vs_mom"); + fHM->H2("fhBoAVsMom" + t)->GetYaxis()->SetRangeUser(0.8, 1.0); { - fHM->CreateCanvas(("richgeo" + t + "_ellipse_xc_yc").c_str(), ("richgeo" + t + "_ellipse_xc_yc").c_str(), 800, - 800); + string name = "richgeo" + t + "_ellipse_xc_yc"; + fHM->CreateCanvas(name.c_str(), name.c_str(), 1200, 1200); DrawH2(fHM->H2("fhXcYcEllipse" + t)); } - DrawH2MeanRms((TH2D*) fHM->H2("fhChi2EllipseVsMom" + t), "richgeo" + t + "_chi2_ellipse_vs_mom"); - DrawH2MeanRms((TH2D*) fHM->H2("fhAaxisVsMom" + t), "richgeo" + t + "_a_vs_mom"); - DrawH2MeanRms((TH2D*) fHM->H2("fhBaxisVsMom" + t), "richgeo" + t + "_b_vs_mom"); + DrawH2MeanRms(fHM->H2("fhChi2EllipseVsMom" + t), "richgeo" + t + "_chi2_ellipse_vs_mom"); + DrawH2MeanRms(fHM->H2("fhAaxisVsMom" + t), "richgeo" + t + "_a_vs_mom"); + DrawH2MeanRms(fHM->H2("fhBaxisVsMom" + t), "richgeo" + t + "_b_vs_mom"); { - TCanvas* c = fHM->CreateCanvas(("richgeo" + t + "_b_up_down_halves").c_str(), - ("richgeo" + t + "_b_up_down_halves").c_str(), 1200, 600); + string name = "richgeo" + t + "_b_up_down_halves"; + TCanvas* c = fHM->CreateCanvas(name.c_str(), name.c_str(), 2000, 1000); c->Divide(2, 1); c->cd(1); - DrawH1andFitGauss((TH1D*) fHM->H1("fhBaxisUpHalf" + t)->Clone(), true, true, 3., 6.); + TH1* hUp = fHM->H1Clone("fhBaxisUpHalf" + t); + DrawH1(hUp, kLinear, kLinear, "hist"); + hUp->SetStats(true); c->cd(2); - DrawH1andFitGauss((TH1D*) fHM->H1("fhBaxisDownHalf" + t)->Clone(), true, true, 3., 6.); + TH1* hDown = fHM->H1Clone("fhBaxisDownHalf" + t); + DrawH1(hDown, kLinear, kLinear, "hist"); + hDown->SetStats(true); } { - TCanvas* c = - fHM->CreateCanvas(("richgeo" + t + "_circle").c_str(), ("richgeo" + t + "_circle").c_str(), 1200, 600); + string name = "richgeo" + t + "_circle"; + TCanvas* c = fHM->CreateCanvas(name.c_str(), name.c_str(), 2000, 1000); c->Divide(2, 1); c->cd(1); - DrawH1andFitGauss((TH1D*) fHM->H1("fhNofHits" + t)->Clone()); - cout << "Number of hits/points = " << fHM->H1("fhNofHits" + t)->GetMean() << endl; + DrawH1andFitGauss(fHM->H1Clone("fhNofHits" + t)); + LOG(info) << "Number of hits/points = " << fHM->H1("fhNofHits" + t)->GetMean(); //gPad->SetLogy(true); c->cd(2); DrawH2(fHM->H2("fhXcYcCircle" + t)); } - DrawH2MeanRms((TH2D*) fHM->H2("fhChi2CircleVsMom" + t), "richgeo" + t + "_chi2_circle_vs_mom"); - DrawH2MeanRms((TH2D*) fHM->H2("fhRadiusVsMom" + t), "richgeo" + t + "_r_vs_mom"); - DrawH2MeanRms((TH2D*) fHM->H2("fhDRVsMom" + t), "richgeo" + t + "_dr_vs_mom"); + DrawH2MeanRms(fHM->H2("fhChi2CircleVsMom" + t), "richgeo" + t + "_chi2_circle_vs_mom"); + DrawH2MeanRms(fHM->H2("fhRadiusVsMom" + t), "richgeo" + t + "_r_vs_mom"); + DrawH2MeanRms(fHM->H2("fhDRVsMom" + t), "richgeo" + t + "_dr_vs_mom"); fHM->H2("fhDRVsMom" + t)->GetYaxis()->SetRangeUser(-1.05, 1.05); - } // for loop + } // _hits, _points { - fHM->CreateCanvas("richgeo_nof_photons_per_hit", "richgeo_nof_photons_per_hit", 800, 800); - fHM->H1("fhNofPhotonsPerHit")->Scale(1. / fHM->H1("fhNofPhotonsPerHit")->Integral()); + fHM->CreateCanvas("richgeo_nof_photons_per_hit", "richgeo_nof_photons_per_hit", 1200, 1200); + fHM->NormalizeToIntegral("fhNofPhotonsPerHit"); DrawH1(fHM->H1("fhNofPhotonsPerHit"), kLinear, kLinear, "hist"); } { - TCanvas* c = fHM->CreateCanvas("richgeo_diff_ellipse", "richgeo_diff_ellipse", 1200, 600); + TCanvas* c = fHM->CreateCanvas("richgeo_diff_ellipse", "richgeo_diff_ellipse", 2000, 1000); c->Divide(4, 2); c->cd(1); - DrawH2(fHM->H2("fhDiffAaxis")); + DrawH2WithProfile(fHM->H2("fhDiffAaxis")); c->cd(2); - DrawH2(fHM->H2("fhDiffBaxis")); + DrawH2WithProfile(fHM->H2("fhDiffBaxis")); c->cd(3); - DrawH2(fHM->H2("fhDiffXcEllipse")); + DrawH2WithProfile(fHM->H2("fhDiffXcEllipse")); c->cd(4); - DrawH2(fHM->H2("fhDiffYcEllipse")); + DrawH2WithProfile(fHM->H2("fhDiffYcEllipse")); c->cd(5); DrawH1(fHM->H2("fhDiffAaxis")->ProjectionY(), kLinear, kLog, "hist"); c->cd(6); @@ -815,14 +755,14 @@ void CbmRichGeoTest::DrawHist() } { - TCanvas* c = fHM->CreateCanvas("richgeo_diff_circle", "richgeo_diff_circle", 900, 600); + TCanvas* c = fHM->CreateCanvas("richgeo_diff_circle", "richgeo_diff_circle", 1500, 1000); c->Divide(3, 2); c->cd(1); - DrawH2(fHM->H2("fhDiffXcCircle")); + DrawH2WithProfile(fHM->H2("fhDiffXcCircle")); c->cd(2); - DrawH2(fHM->H2("fhDiffYcCircle")); + DrawH2WithProfile(fHM->H2("fhDiffYcCircle")); c->cd(3); - DrawH2(fHM->H2("fhDiffRadius")); + DrawH2WithProfile(fHM->H2("fhDiffRadius")); c->cd(4); DrawH1(fHM->H2("fhDiffXcCircle")->ProjectionY(), kLinear, kLog, "hist"); c->cd(5); @@ -832,13 +772,13 @@ void CbmRichGeoTest::DrawHist() } { - TCanvas* c = fHM->CreateCanvas("richgeo_hits_residual", "richgeo_hits", 1200, 600); + TCanvas* c = fHM->CreateCanvas("richgeo_hits_residual", "richgeo_hits", 2000, 1000); c->Divide(2, 1); c->cd(1); - fHM->H1("fhDiffXhit")->Scale(1. / fHM->H1("fhDiffXhit")->Integral()); + fHM->NormalizeToIntegral("fhDiffXhit"); DrawH1(fHM->H1("fhDiffXhit"), kLinear, kLinear, "hist"); c->cd(2); - fHM->H1("fhDiffYhit")->Scale(1. / fHM->H1("fhDiffYhit")->Integral()); + fHM->NormalizeToIntegral("fhDiffYhit"); DrawH1(fHM->H1("fhDiffYhit"), kLinear, kLinear, "hist"); } @@ -846,8 +786,7 @@ void CbmRichGeoTest::DrawHist() TCanvas* c = fHM->CreateCanvas("richgeo_fit_eff", "richgeo_fit_eff", 1800, 600); c->Divide(3, 1); c->cd(1); - DrawH1({(TH1D*) fHM->H1("fhNofHitsAll")->Clone(), (TH1D*) fHM->H1("fhNofHitsCircleFit")->Clone(), - (TH1D*) fHM->H1("fhNofHitsEllipseFit")->Clone()}, + DrawH1({fHM->H1Clone("fhNofHitsAll"), fHM->H1Clone("fhNofHitsCircleFit"), fHM->H1Clone("fhNofHitsEllipseFit")}, {"All", "Circle fit", "Ellipse fit"}, kLinear, kLog, true, 0.7, 0.7, 0.99, 0.99, "hist"); TH1D* fhNofHitsCircleFitEff = Cbm::DivideH1(fHM->H1("fhNofHitsCircleFit"), fHM->H1("fhNofHitsAll")); TH1D* fhNofHitsEllipseFitEff = Cbm::DivideH1(fHM->H1("fhNofHitsEllipseFit"), fHM->H1("fhNofHitsAll")); @@ -866,78 +805,65 @@ void CbmRichGeoTest::DrawHist() } { - TCanvas* c = fHM->CreateCanvas("richgeo_acc_el", "richgeo_acc_el", 1500, 500); - c->Divide(3, 1); + TCanvas* c = fHM->CreateCanvas("richgeo_acc_el", "richgeo_acc_el", 1800, 1200); + c->Divide(3, 2); c->cd(1); - DrawH1({(TH1D*) fHM->H1("fhMcMomEl"), (TH1D*) fHM->H1("fhAccMomEl")}, {"MC", "ACC"}, kLinear, kLog, true, 0.8, 0.8, - 0.99, 0.99, "hist"); + DrawH1(fHM->H1Vector({string("fhMomElMc"), "fhMomElAcc"}), {"MC", "ACC"}, kLinear, kLog, true, 0.8, 0.8, 0.99, 0.99, + "hist"); c->cd(2); - DrawH2(fHM->H2("fhMcPtyEl")); + DrawH2(fHM->H2("fhPtYElMc")); + fHM->H2("fhPtYElMc")->SetMinimum(0.); c->cd(3); - DrawH2(fHM->H2("fhAccPtyEl")); + DrawH2(fHM->H2("fhPtYElAcc")); + fHM->H2("fhPtYElAcc")->SetMinimum(0.); + c->cd(4); + DrawH2(fHM->H2("fhPYElMc")); + fHM->H2("fhPYElMc")->SetMinimum(0.); + c->cd(5); + DrawH2(fHM->H2("fhPYElAcc")); + fHM->H2("fhPYElAcc")->SetMinimum(0.); } - TH1D* pxEff = Cbm::DivideH1((TH1D*) fHM->H1("fhAccMomEl")->Clone(), (TH1D*) fHM->H1("fhMcMomEl")->Clone(), "", 100., + + TH1D* pxEff = Cbm::DivideH1(fHM->H1Clone("fhMomElAcc"), (TH1D*) fHM->H1Clone("fhMomElMc"), "", 100., "Geometrical acceptance [%]"); - TH2D* pyzEff = Cbm::DivideH2((TH2D*) fHM->H1("fhAccPtyEl")->Clone(), (TH2D*) fHM->H1("fhMcPtyEl")->Clone(), "", 100., - "Geometrical acceptance [%]"); { fHM->CreateCanvas("richgeo_acc_eff_el_mom", "richgeo_acc_eff_el_mom", 800, 800); - string effEl = CalcEfficiency((TH1D*) fHM->H1("fhAccMomEl")->Clone(), (TH1D*) fHM->H1("fhMcMomEl")->Clone()); + string effEl = CalcEfficiency(fHM->H1Clone("fhMomElAcc"), fHM->H1Clone("fhMomElMc")); cout << "Geometrical acceptance electrons:" << effEl << "%" << endl; DrawH1({pxEff}, {"e^{#pm} (" + effEl + "%)"}, kLinear, kLinear, true, 0.6, 0.55, 0.88, 0.65); } { + TH2D* pyzEff = + Cbm::DivideH2(fHM->H2Clone("fhPtYElAcc"), fHM->H2Clone("fhPtYElMc"), "", 100., "Geometrical acceptance [%]"); fHM->CreateCanvas("richgeo_acc_eff_el_pty", "richgeo_acc_eff_el_pty", 800, 800); DrawH2(pyzEff); } { - TCanvas* c = fHM->CreateCanvas("richgeo_acc_pi", "richgeo_acc_pi", 1500, 500); - c->Divide(3, 1); - c->cd(1); - DrawH1({(TH1D*) fHM->H1("fhMcMomPi"), (TH1D*) fHM->H1("fhAccMomPi")}, {"MC", "ACC"}, kLinear, kLog, true, 0.8, 0.8, - 0.99, 0.99, "hist"); - c->cd(2); - DrawH2(fHM->H2("fhMcPtyPi")); - c->cd(3); - DrawH2(fHM->H2("fhAccPtyPi")); - } - - TH1D* pxPiEff = Cbm::DivideH1((TH1D*) fHM->H1("fhAccMomPi")->Clone(), (TH1D*) fHM->H1("fhMcMomPi")->Clone(), "", 100., - "Geometrical acceptance [%]"); - TH2D* pyzPiEff = Cbm::DivideH2((TH2D*) fHM->H1("fhAccPtyPi")->Clone(), (TH2D*) fHM->H1("fhMcPtyPi")->Clone(), "", - 100., "Geometrical acceptance [%]"); - { - fHM->CreateCanvas("richgeo_acc_eff_pi_mom", "richgeo_acc_eff_pi_mom", 800, 800); - string effPi = CalcEfficiency((TH1D*) fHM->H1("fhAccMomPi")->Clone(), (TH1D*) fHM->H1("fhMcMomPi")->Clone()); - cout << "Geometrical acceptance pions:" << effPi << "%" << endl; - DrawH1({pxPiEff}, {"#pi^{#pm} (" + effPi + "%)"}, kLinear, kLinear, true, 0.6, 0.55, 0.88, 0.65); - } - - { - fHM->CreateCanvas("richgeo_acc_eff_pi_pty", "richgeo_acc_eff_pi_pty", 800, 800); - DrawH2(pyzPiEff); - pyzPiEff->GetZaxis()->SetRangeUser(0, 100); + TH2D* pyzEff = + Cbm::DivideH2(fHM->H2Clone("fhPYElAcc"), fHM->H2Clone("fhPYElMc"), "", 100., "Geometrical acceptance [%]"); + fHM->CreateCanvas("richgeo_acc_eff_el_py", "richgeo_acc_eff_el_py", 800, 800); + DrawH2(pyzEff); } { TCanvas* c = fHM->CreateCanvas("richgeo_acc_eff_el_zoom", "richgeo_acc_eff_el_zoom", 1000, 500); c->Divide(2, 1); c->cd(1); - TH1D* fhMcMomElClone = (TH1D*) fHM->H1("fhMcMomEl")->Clone(); - TH1D* fhAccMomElClone = (TH1D*) fHM->H1("fhAccMomEl")->Clone(); - fhMcMomElClone->GetXaxis()->SetRangeUser(0., 3.); - fhAccMomElClone->GetXaxis()->SetRangeUser(0., 3.); - fhMcMomElClone->SetMinimum(0.); - DrawH1({fhMcMomElClone, fhAccMomElClone}, {"MC", "ACC"}, kLinear, kLog, true, 0.8, 0.8, 0.99, 0.99); + TH1* fhMcMomEl = fHM->H1Clone("fhMomElMc"); + TH1* fhAccMomEl = fHM->H1Clone("fhMomElAcc"); + fhMcMomEl->GetXaxis()->SetRangeUser(0., 3.); + fhAccMomEl->GetXaxis()->SetRangeUser(0., 3.); + fhMcMomEl->SetMinimum(0.); + DrawH1({fhMcMomEl, fhAccMomEl}, {"MC", "ACC"}, kLinear, kLog, true, 0.8, 0.8, 0.99, 0.99); gPad->SetLogy(false); c->cd(2); - TH1D* px_eff_clone = (TH1D*) pxEff->Clone(); - px_eff_clone->GetXaxis()->SetRangeUser(0., 3.); - px_eff_clone->SetMinimum(0.); - DrawH1(px_eff_clone); + TH1D* pxEffClone = static_cast<TH1D*>(pxEff->Clone()); + pxEffClone->GetXaxis()->SetRangeUser(0., 3.); + pxEffClone->SetMinimum(0.); + DrawH1(pxEffClone); } // Draw number vs position onto the photodetector plane @@ -967,13 +893,13 @@ void CbmRichGeoTest::DrawHist() TCanvas* c = fHM->CreateCanvas("richgeo_numbers_vs_xy_boa", "richgeo_numbers_vs_xy_boa", 1800, 600); c->Divide(3, 1); c->cd(1); - DrawH3Profile(fHM->H3("fhBoverAXYZ"), true, false, 0.75, 1.0); + DrawH3Profile(fHM->H3("fhBoAXYZ"), true, false, 0.75, 1.0); c->cd(2); - DrawH2WithProfile(fHM->H2("fhBoverAVsX"), false, true); - fHM->H2("fhBoverAVsX")->GetYaxis()->SetRangeUser(0.75, 1.0); + DrawH2WithProfile(fHM->H2("fhBoAVsX"), false, true); + fHM->H2("fhBoAVsX")->GetYaxis()->SetRangeUser(0.75, 1.0); c->cd(3); - DrawH2WithProfile(fHM->H2("fhBoverAVsY"), false, true); - fHM->H2("fhBoverAVsY")->GetYaxis()->SetRangeUser(0.75, 1.0); + DrawH2WithProfile(fHM->H2("fhBoAVsY"), false, true); + fHM->H2("fhBoAVsY")->GetYaxis()->SetRangeUser(0.75, 1.0); } { @@ -1021,7 +947,7 @@ void CbmRichGeoTest::DrawHist() } { - fHM->CreateCanvas("richgeo_acc_vs_min_nof_hits", "richgeo_acc_vs_min_nof_hits", 600, 600); + fHM->CreateCanvas("richgeo_acc_vs_min_nof_hits", "richgeo_acc_vs_min_nof_hits", 1000, 1000); TH1D* h = CreateAccVsMinNofHitsHist(); h->GetXaxis()->SetRangeUser(0., 40.0); DrawH1(h); @@ -1037,31 +963,31 @@ void CbmRichGeoTest::DrawHist() TCanvas* c = fHM->CreateCanvas("richgeo_hits_rab", "richgeo_hits_rab", 1500, 600); c->Divide(3, 1); c->cd(1); - DrawH1andFitGauss( - fHM->H2("fhRadiusVsNofHits")->ProjectionY((string(fHM->H2("fhRadiusVsNofHits")->GetName()) + "_py").c_str()), - true, true, 2., 8.); + TH1D* pyR = + fHM->H2("fhRadiusVsNofHits")->ProjectionY((string(fHM->H2("fhRadiusVsNofHits")->GetName()) + "_py").c_str()); + DrawH1(pyR, kLinear, kLinear, "hist"); + pyR->SetStats(true); c->cd(2); - DrawH1andFitGauss( - fHM->H2("fhAaxisVsNofHits")->ProjectionY((string(fHM->H2("fhAaxisVsNofHits")->GetName()) + "_py").c_str()), true, - true, 2., 8.); + TH1D* pyA = + fHM->H2("fhAaxisVsNofHits")->ProjectionY((string(fHM->H2("fhAaxisVsNofHits")->GetName()) + "_py").c_str()); + DrawH1(pyA, kLinear, kLinear, "hist"); + pyA->SetStats(true); c->cd(3); - DrawH1andFitGauss( - fHM->H2("fhBaxisVsNofHits")->ProjectionY((string(fHM->H2("fhBaxisVsNofHits")->GetName()) + "_py").c_str()), true, - true, 2., 8.); + TH1D* pyB = + fHM->H2("fhBaxisVsNofHits")->ProjectionY((string(fHM->H2("fhBaxisVsNofHits")->GetName()) + "_py").c_str()); + DrawH1(pyB, kLinear, kLinear, "hist"); + pyB->SetStats(true); } { - TCanvas* c = fHM->CreateCanvas("richgeo_photon_energy", "richgeo_photon_energy", 1500, 750); + TCanvas* c = fHM->CreateCanvas("richgeo_photon_energy", "richgeo_photon_energy", 2000, 1000); + vector<string> labels = {"Sens plane Z+", "Sens plane Z-", "PMT Point", "PMT hit"}; c->Divide(2, 1); c->cd(1); - DrawH1({fHM->H1("fhPhotonEPlaneZ+"), fHM->H1("fhPhotonEPlaneZ-"), fHM->H1("fhPhotonEPmtPoint"), - fHM->H1("fhPhotonEPmtHit")}, - {"Sens plane Z+", "Sens plane Z-", "PMT point", "PMT hit"}); + DrawH1(fHM->H1Vector({"fhPhotonEPlaneZ+", "fhPhotonEPlaneZ-", "fhPhotonEPmtPoint", "fhPhotonEPmtHit"}), labels); c->cd(2); - DrawH1( - {fHM->H1("fhLambdaPlaneZ+"), fHM->H1("fhLambdaPlaneZ-"), fHM->H1("fhLambdaPmtPoint"), fHM->H1("fhLambdaPmtHit")}, - {"Sens plane Z+", "Sens plane Z-", "PMT Point", "PMT hit"}); + DrawH1(fHM->H1Vector({"fhLambdaPlaneZ+", "fhLambdaPlaneZ-", "fhLambdaPmtPoint", "fhLambdaPmtHit"}), labels); } } @@ -1071,8 +997,8 @@ void CbmRichGeoTest::DrawPmts() fHM->Create3<TH3D>("fhPointsXYZ", "fhPointsXYZ;X [cm];Y [cm];Z [cm];Yield", 100, -50, 50, 100, -300, 300, 100, 100, 300); fHM->Create3<TH3D>("fhHitsXYZ", "fhHitsXYZ;X [cm];Y [cm];Z [cm];Yield", 100, -50, 50, 100, -300, 300, 100, 100, 300); - vector<Int_t> pixels = CbmRichDigiMapManager::GetInstance().GetPixelAddresses(); - vector<Int_t> pmts = CbmRichDigiMapManager::GetInstance().GetPmtIds(); + vector<int> pixels = CbmRichDigiMapManager::GetInstance().GetPixelAddresses(); + vector<int> pmts = CbmRichDigiMapManager::GetInstance().GetPmtIds(); { TCanvas* c = fHM->CreateCanvas("richgeo_pixels_xy", "richgeo_pixels_xy", 1500, 1500); @@ -1132,59 +1058,51 @@ void CbmRichGeoTest::DrawPmts() } } -void CbmRichGeoTest::DrawPmtPoint(const string& coordinates, const vector<Int_t>& ids, Bool_t isDrawPixel) +void CbmRichGeoTest::DrawPmtPoint(const string& coordOpt, const vector<int>& ids, bool isDrawPixel) { - for (unsigned int i = 0; i < ids.size(); i++) { + for (size_t i = 0; i < ids.size(); i++) { TVector3 inPos; - Double_t boxHalfSize = 0.0; + double halfSize = 0.0; if (isDrawPixel) { CbmRichPixelData* pixelData = CbmRichDigiMapManager::GetInstance().GetPixelDataByAddress(ids[i]); inPos.SetXYZ(pixelData->fX, pixelData->fY, pixelData->fZ); - boxHalfSize = 0.15; + halfSize = 0.15; } else { CbmRichPmtData* pmtData = CbmRichDigiMapManager::GetInstance().GetPmtDataById(ids[i]); inPos.SetXYZ(pmtData->fX, pmtData->fY, pmtData->fZ); - boxHalfSize = 0.5 * pmtData->fHeight; + halfSize = 0.5 * pmtData->fHeight; } + TVector3 outPos; CbmRichGeoManager::GetInstance().RotatePoint(&inPos, &outPos); TBox* boxOut = nullptr; + TBox* boxIn = nullptr; + if (coordOpt == "xy") { + boxOut = new TBox(outPos.X() - halfSize, outPos.Y() - halfSize, outPos.X() + halfSize, outPos.Y() + halfSize); + boxIn = new TBox(inPos.X() - halfSize, inPos.Y() - halfSize, inPos.X() + halfSize, inPos.Y() + halfSize); + } + else if (coordOpt == "zx") { + boxOut = new TBox(outPos.Z() - halfSize, outPos.X() - halfSize, outPos.Z() + halfSize, outPos.X() + halfSize); + boxIn = new TBox(inPos.Z() - halfSize, inPos.X() - halfSize, inPos.Z() + halfSize, inPos.X() + halfSize); + } + else if (coordOpt == "zy") { + boxOut = new TBox(outPos.Z() - halfSize, outPos.Y() - halfSize, outPos.Z() + halfSize, outPos.Y() + halfSize); + boxIn = new TBox(inPos.Z() - halfSize, inPos.Y() - halfSize, inPos.Z() + halfSize, inPos.Y() + halfSize); + } - if (coordinates == string("xy")) - boxOut = new TBox(outPos.X() - boxHalfSize, outPos.Y() - boxHalfSize, outPos.X() + boxHalfSize, - outPos.Y() + boxHalfSize); - if (coordinates == string("zx")) - boxOut = new TBox(outPos.Z() - boxHalfSize, outPos.X() - boxHalfSize, outPos.Z() + boxHalfSize, - outPos.X() + boxHalfSize); - if (coordinates == string("zy")) - boxOut = new TBox(outPos.Z() - boxHalfSize, outPos.Y() - boxHalfSize, outPos.Z() + boxHalfSize, - outPos.Y() + boxHalfSize); - if (boxOut != NULL) { - if (isDrawPixel) { boxOut->SetFillColor(kBlue); } + if (boxOut != nullptr && boxIn != nullptr) { + if (isDrawPixel) { + boxOut->SetFillColor(kBlue); + boxIn->SetFillColor(kRed); + } else { boxOut->SetFillStyle(0); boxOut->SetLineColor(kBlue); - } - boxOut->Draw(); - } - - TBox* boxIn = nullptr; - if (coordinates == string("xy")) - boxIn = - new TBox(inPos.X() - boxHalfSize, inPos.Y() - boxHalfSize, inPos.X() + boxHalfSize, inPos.Y() + boxHalfSize); - if (coordinates == string("zx")) - boxIn = - new TBox(inPos.Z() - boxHalfSize, inPos.X() - boxHalfSize, inPos.Z() + boxHalfSize, inPos.X() + boxHalfSize); - if (coordinates == string("zy")) - boxIn = - new TBox(inPos.Z() - boxHalfSize, inPos.Y() - boxHalfSize, inPos.Z() + boxHalfSize, inPos.Y() + boxHalfSize); - if (boxIn != NULL) { - if (isDrawPixel) { boxIn->SetFillColor(kRed); } - else { boxIn->SetFillStyle(0); boxIn->SetLineColor(kRed); } + boxOut->Draw(); boxIn->Draw(); } } @@ -1198,7 +1116,7 @@ void CbmRichGeoTest::Finish() TDirectory* oldir = gDirectory; TFile* outFile = FairRootManager::Instance()->GetOutFile(); - if (outFile != NULL) { + if (outFile != nullptr) { outFile->cd(); fHM->WriteToFile(); } @@ -1210,7 +1128,7 @@ string CbmRichGeoTest::CalcEfficiency(TH1* histRec, TH1* histAcc) { if (histAcc->GetEntries() == 0) { return "0"; } else { - Double_t eff = 100. * Double_t(histRec->GetEntries()) / Double_t(histAcc->GetEntries()); + double eff = 100. * double(histRec->GetEntries()) / double(histAcc->GetEntries()); return Cbm::NumberToString(eff, 2); } } @@ -1223,7 +1141,7 @@ void CbmRichGeoTest::DrawFromFile(const string& fileName, const string& outputDi TFile* oldFile = gFile; TDirectory* oldDir = gDirectory; - if (fHM != NULL) delete fHM; + if (fHM != nullptr) delete fHM; fHM = new CbmHistManager(); TFile* file = new TFile(fileName.c_str()); diff --git a/reco/detectors/rich/qa/CbmRichGeoTest.h b/reco/detectors/rich/qa/CbmRichGeoTest.h index 34be1cf8df14e1b8f2811769bba660216006cbc7..cdf70358f2fb0b8498da85d3d0d54c475ef8024a 100644 --- a/reco/detectors/rich/qa/CbmRichGeoTest.h +++ b/reco/detectors/rich/qa/CbmRichGeoTest.h @@ -27,9 +27,7 @@ class CbmRichRingFitterCOP; class CbmRichRingFitterEllipseTau; class CbmRichRing; class CbmRichRingLight; -class TCanvas; class CbmHistManager; -class TVector3; class CbmMCDataArray; class CbmMCEventList; class CbmDigiManager; @@ -37,8 +35,6 @@ class CbmDigiManager; #include <string> #include <vector> -using namespace std; - /** * \class CbmRichGeoTest * @@ -79,15 +75,15 @@ public: * \brief Set output directory where you want to write results (figures and json). * \param[in] dir Path to the output directory. */ - void SetOutputDir(const string& dir) { fOutputDir = dir; } + void SetOutputDir(const std::string& dir) { fOutputDir = dir; } /** * \brief Draw histogram from file */ - void DrawFromFile(const string& fileName, const string& outputDir); + void DrawFromFile(const std::string& fileName, const std::string& outputDir); - void SetDrawPmts(Bool_t draw) { fDrawPmts = draw; } - void SetDrawEventDisplay(Bool_t draw) { fDrawEventDisplay = draw; } + void SetDrawPmts(bool draw) { fDrawPmts = draw; } + void SetDrawEventDisplay(bool draw) { fDrawEventDisplay = draw; } private: /** @@ -101,6 +97,8 @@ private: */ void ProcessMc(); + CbmRichRingLight CreateRingLightWithPoints(int fileId, int mcEventId, int mcTrackId); + /** * \brief Loop over all rings in array and fill ring parameters histograms. */ @@ -112,7 +110,7 @@ private: * \param[in] ring Pointer to CbmRichRing to be fitted and filled in histograms. * \param[in] momentum MC momentum of particle produced ring. */ - void FitAndFillHistEllipse(Int_t histIndex, CbmRichRingLight* ring, Double_t momentum); + void FitAndFillHistEllipse(int histIndex, CbmRichRingLight* ring, double momentum); /** * \brief Fit ring using circle fitter and fill histograms. @@ -120,7 +118,7 @@ private: * \param[in] ring Pointer to CbmRichRingLight to be fitted and filled in histograms. * \param[in] momentum MC momentum of particle produced ring. */ - void FitAndFillHistCircle(Int_t histIndex, CbmRichRingLight* ring, Double_t momentum); + void FitAndFillHistCircle(int histIndex, CbmRichRingLight* ring, double momentum); /** * \brief Calculate difference between ellipse parameters @@ -164,21 +162,21 @@ private: void DrawRing(CbmRichRingLight* ringHit, CbmRichRingLight* ringPoint); - void DrawH2MeanRms(TH2* hist, const string& canvasName); + void DrawH2MeanRms(TH2* hist, const std::string& canvasName); /** * \brief DrawPmts */ void DrawPmts(); - void DrawPmtPoint(const string& coordinates, const vector<Int_t>& ids, Bool_t isDrawPixel); + void DrawPmtPoint(const std::string& coordOpt, const std::vector<int>& ids, bool isDrawPixel); /** * \brief Calculate efficiency. * \param[in] histRec * \param[in] histAcc */ - string CalcEfficiency(TH1* histRec, TH1* histAcc); + std::string CalcEfficiency(TH1* histRec, TH1* histAcc); /** * \brief Copy constructor. @@ -190,37 +188,37 @@ private: */ CbmRichGeoTest& operator=(const CbmRichGeoTest&); - string fOutputDir; // output directory for results + std::string fOutputDir = ""; // output directory for results - TClonesArray* fRichHits; - TClonesArray* fRichRings; - CbmMCDataArray* fRichRefPlanePoints; - CbmDigiManager* fDigiMan = nullptr; - CbmMCDataArray* fRichPoints; - CbmMCDataArray* fMcTracks; - TClonesArray* fRichRingMatches; - CbmMCEventList* fEventList; + TClonesArray* fRichHits = nullptr; + TClonesArray* fRichRings = nullptr; + CbmMCDataArray* fRichRefPlanePoints = nullptr; + CbmDigiManager* fDigiMan = nullptr; + CbmMCDataArray* fRichPoints = nullptr; + CbmMCDataArray* fMcTracks = nullptr; + TClonesArray* fRichRingMatches = nullptr; + CbmMCEventList* fEventList = nullptr; // rings will be fitted on a fly - CbmRichRingFitterCOP* fCopFit; - CbmRichRingFitterEllipseTau* fTauFit; + CbmRichRingFitterCOP* fCopFit = nullptr; + CbmRichRingFitterEllipseTau* fTauFit = nullptr; - CbmHistManager* fHM; // Histogram manager + CbmHistManager* fHM = nullptr; // Histogram manager - Int_t fEventNum; - Int_t fMinNofHits; // Min number of hits in ring for detector acceptance calculation. + int fEventNum = 0; + int fMinNofHits = 7; // Min number of hits in ring for detector acceptance calculation. // fitting efficiency - Double_t fMinAaxis; - Double_t fMaxAaxis; - Double_t fMinBaxis; - Double_t fMaxBaxis; - Double_t fMinRadius; - Double_t fMaxRadius; - - Int_t fNofDrawnRings; // store number of drawn rings - Bool_t fDrawPmts; // draw pixels and PMTs to test rotation procedure - Bool_t fDrawEventDisplay; + double fMinAaxis = 3.; + double fMaxAaxis = 7.; + double fMinBaxis = 3.; + double fMaxBaxis = 7.; + double fMinRadius = 3.; + double fMaxRadius = 7.; + + int fNofDrawnRings = 0; // store number of drawn rings + bool fDrawPmts = true; // draw pixels and PMTs to test rotation procedure + bool fDrawEventDisplay = true; ClassDef(CbmRichGeoTest, 1) }; diff --git a/reco/detectors/rich/qa/CbmRichRecoQa.cxx b/reco/detectors/rich/qa/CbmRichRecoQa.cxx index 9cbd35326787786935efa2df3eaa8421e277961f..f6d4eabf2c275fcdcbfe4eb95b2a6ffc2744dc37 100644 --- a/reco/detectors/rich/qa/CbmRichRecoQa.cxx +++ b/reco/detectors/rich/qa/CbmRichRecoQa.cxx @@ -8,6 +8,8 @@ #include "CbmDrawHist.h" #include "CbmGlobalTrack.h" #include "CbmHistManager.h" +#include "CbmMCDataArray.h" +#include "CbmMCEventList.h" #include "CbmMCTrack.h" #include "CbmMatchRecoToMC.h" #include "CbmRichDraw.h" @@ -34,76 +36,35 @@ #include "TStyle.h" #include <TFile.h> -#include <boost/assign/list_of.hpp> - #include <iostream> #include <sstream> #include <string> using namespace std; -using boost::assign::list_of; - -CbmRichRecoQa::CbmRichRecoQa() - : FairTask("CbmRichRecoQa") - , fHM(nullptr) - , fEventNum(0) - , fOutputDir("") - , fMCTracks(nullptr) - , fRichPoints(nullptr) - , fRichHits(nullptr) - , fRichRings(nullptr) - , fRichRingMatches(nullptr) - , fGlobalTracks(nullptr) - , fStsTracks(nullptr) - , fStsTrackMatches(nullptr) - , fRichProjections(nullptr) - , fDigiMan(nullptr) - , fNofHitsInRingMap() - , fCanvas() -{ -} +using namespace Cbm; + +CbmRichRecoQa::CbmRichRecoQa() : FairTask("CbmRichRecoQa") {} InitStatus CbmRichRecoQa::Init() { - cout << "CbmRichRecoQa::Init" << endl; - FairRootManager* ioman = FairRootManager::Instance(); - if (nullptr == ioman) { Fatal("CbmRichRecoQa::Init", "RootManager not instantised!"); } - - fMCTracks = (TClonesArray*) ioman->GetObject("MCTrack"); - if (nullptr == fMCTracks) { Fatal("CbmRichRecoQa::Init", "No MC Tracks!"); } - - fRichPoints = (TClonesArray*) ioman->GetObject("RichPoint"); - if (nullptr == fRichPoints) { Fatal("CbmRichRecoQa::Init", "No Rich Points!"); } + fMcTracks = InitOrFatalMc("MCTrack", "CbmRichRecoQa::Init"); + fRichPoints = InitOrFatalMc("RichPoint", "CbmRichRecoQa::Init"); + fRichHits = GetOrFatal<TClonesArray>("RichHit", "CbmRichRecoQa::Init"); + fRichRings = GetOrFatal<TClonesArray>("RichRing", "CbmRichRecoQa::Init"); + fRichRingMatches = GetOrFatal<TClonesArray>("RichRingMatch", "CbmRichRecoQa::Init"); + fRichProjections = GetOrFatal<TClonesArray>("RichProjection", "CbmRichRecoQa::Init"); + fGlobalTracks = GetOrFatal<TClonesArray>("GlobalTrack", "CbmRichRecoQa::Init"); + fStsTracks = GetOrFatal<TClonesArray>("StsTrack", "CbmRichRecoQa::Init"); + fStsTrackMatches = GetOrFatal<TClonesArray>("StsTrackMatch", "CbmRichRecoQa::Init"); + fEventList = GetOrFatal<CbmMCEventList>("MCEventList.", "CbmRichUrqmdTest::Init"); fDigiMan = CbmDigiManager::Instance(); fDigiMan->Init(); - fRichHits = (TClonesArray*) ioman->GetObject("RichHit"); - if (nullptr == fRichHits) { Fatal("CbmRichRecoQa::Init", "No RichHits!"); } - - fRichRings = (TClonesArray*) ioman->GetObject("RichRing"); - if (nullptr == fRichRings) { Fatal("CbmRichRecoQa::Init", "No RichRings!"); } - - fRichRingMatches = (TClonesArray*) ioman->GetObject("RichRingMatch"); - if (nullptr == fRichRingMatches) { Fatal("CbmRichRecoQa::Init", "No RichRingMatch array!"); } - - fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack"); - if (nullptr == fGlobalTracks) { Fatal("CbmRichRecoQa::Init", "No GlobalTrack array!"); } - - fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack"); - if (nullptr == fStsTracks) { Fatal("CbmRichRecoQa::Init", ": No StsTrack array!"); } - - fStsTrackMatches = (TClonesArray*) ioman->GetObject("StsTrackMatch"); - if (nullptr == fStsTrackMatches) { Fatal("CbmRichRecoQa::Init", ": No StsTrackMatch array!"); } - - fRichProjections = (TClonesArray*) ioman->GetObject("RichProjection"); - if (nullptr == fRichProjections) { Fatal("CbmRichUrqmdTest::Init", "No fRichProjections array!"); } - InitHistograms(); // CbmLitGlobalElectronId::GetInstance(); - cout << "CbmRichRecoQa::Init finished" << endl; return kSUCCESS; } @@ -128,73 +89,45 @@ void CbmRichRecoQa::InitHistograms() int yMin1 = 100; int yMax1 = 200; - for (Int_t i = 0; i < 4; i++) { - string s; - if (i == 0) s = "Primel"; - if (i == 1) s = "Pi"; - if (i == 2) s = "PrimelPlus"; - if (i == 3) s = "PrimelMinus"; - - fHM->Create2<TH2D>("fhRingTrackDistVsMomTruematch" + s, - "fhRingTrackDistVsMomTruematch" + s + ";P [GeV/c];Ring-track distance [cm];Yield (a.u.)", 20, 0., - 10., 100, 0., 5.); - fHM->Create2<TH2D>("fhRingTrackDistVsMomWrongmatch" + s, - "fhRingTrackDistVsMomWrongmatch" + s + ";P [GeV/c];Ring-track distance [cm];Yield (a.u.)", 20, - 0., 10., 100, 0., 5.); - - fHM->Create2<TH2D>("fhRingTrackDistVsNofHitsTruematch" + s, - "fhRingTrackDistVsNofHitsTruematch" + s - + ";Nof hits in found ring;Ring-track distance [cm];Yield (a.u.)", - 40, -.5, 39.5, 100, 0., 5.); - fHM->Create3<TH3D>("fhRingTrackDistVsXYTruematch" + s, - "fhRingTrackDistVsXYTruematch" + s + ";X [cm];Y [cm];Ring-track distance [cm]", nBinsX, xMin, - xMax, nBinsY, yMin, yMax, 100, 0., 5.); - fHM->Create2<TH2D>("fhRingTrackDistVsXTruematch" + s, - "fhRingTrackDistVsXTruematch" + s + ";X [cm];Ring-track distance [cm]", nBinsX1, xMin1, xMax1, + vector<string> matchTypes {"Primel", "Pi", "PrimelPlus", "PrimelMinus"}; + for (const string& t : matchTypes) { + fHM->Create2<TH2D>("fhRTDistVsMomTruematch" + t, + "fhRTDistVsMomTruematch" + t + ";P [GeV/c];Ring-track distance [cm];Yield", 20, 0., 10., 100, 0., + 5.); + fHM->Create2<TH2D>("fhRTDistVsMomWrongmatch" + t, + "fhRTDistVsMomWrongmatch" + t + ";P [GeV/c];Ring-track distance [cm];Yield", 20, 0., 10., 100, + 0., 5.); + + fHM->Create2<TH2D>("fhRTDistVsNofHitsTruematch" + t, + "fhRTDistVsNofHitsTruematch" + t + ";# hits/ring;Ring-track distance [cm];Yield", 40, -.5, 39.5, 100, 0., 5.); - fHM->Create2<TH2D>("fhRingTrackDistVsYTruematch" + s, - "fhRingTrackDistVsYTruematch" + s + ";Abs(Y) [cm];Ring-track distance [cm]", nBinsY1, yMin1, - yMax1, 100, 0., 5.); + fHM->Create3<TH3D>("fhRTDistVsXYTruematch" + t, + "fhRTDistVsXYTruematch" + t + ";X [cm];Y [cm];Ring-track distance [cm]", nBinsX, xMin, xMax, + nBinsY, yMin, yMax, 100, 0., 5.); + fHM->Create2<TH2D>("fhRTDistVsXTruematch" + t, "fhRTDistVsXTruematch" + t + ";X [cm];Ring-track distance [cm]", + nBinsX1, xMin1, xMax1, 100, 0., 5.); + fHM->Create2<TH2D>("fhRTDistVsYTruematch" + t, "fhRTDistVsYTruematch" + t + ";Abs(Y) [cm];Ring-track distance [cm]", + nBinsY1, yMin1, yMax1, 100, 0., 5.); } // after electron identification - fHM->Create2<TH2D>("fhRingTrackDistVsMomTruematchElId", - "fhRingTrackDistVsMomTruematchElId;P [GeV/c];Ring-track " - "distance [cm];Yield (a.u.)", - 20, 0., 10., 100, 0., 5.); - - fHM->Create1<TH1D>("fhMismatchSource", "fhMismatchSource;Global track category;% from MC", 13, -0.5, 12.5); - - fHM->Create1<TH1D>("fhMismatchSourceMomMc", "fhMismatchSourceMomMc;Momentum [GeV/c];Yield", 40, 0., 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomSts", "fhMismatchSourceMomSts;Momentum [GeV/c];Yield", 40, 0., 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsAccRich", "fhMismatchSourceMomStsAccRich;Momentum [GeV/c];Yield", 40, 0., - 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsRich", "fhMismatchSourceMomStsRich;Momentum [GeV/c];Yield", 40, 0., 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsRichTrue", "fhMismatchSourceMomStsRichTrue;Momentum [GeV/c];Yield", 40, 0., - 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRich", "fhMismatchSourceMomStsNoRich;Momentum [GeV/c];Yield", 40, 0., - 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRichRF", "fhMismatchSourceMomStsNoRichRF;Momentum [GeV/c];Yield", 40, 0., - 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRichRM", "fhMismatchSourceMomStsNoRichRM;Momentum [GeV/c];Yield", 40, 0., - 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRichNoRF", "fhMismatchSourceMomStsNoRichNoRF;Momentum [GeV/c];Yield", 40, - 0., 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRichNoProj", "fhMismatchSourceMomStsNoRichNoProj;Momentum [GeV/c];Yield", - 40, 0., 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsRichWrong", "fhMismatchSourceMomStsRichWrong;Momentum [GeV/c];Yield", 40, - 0., 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsRichWrongRF", "fhMismatchSourceMomStsRichWrongRF;Momentum [GeV/c];Yield", - 40, 0., 10.); - fHM->Create1<TH1D>("fhMismatchSourceMomStsRichWrongRM", "fhMismatchSourceMomStsRichWrongRM;Momentum [GeV/c];Yield", - 40, 0., 10.); + fHM->Create2<TH2D>("fhRTDistVsMomTruematchElId", + "fhRTDistVsMomTruematchElId;P [GeV/c];Ring-track distance [cm];Yield", 20, 0., 10., 100, 0., 5.); + + fHM->Create1<TH1D>("fhMismatchSrc", "fhMismatchSrc;Global track category;% from MC", 13, -0.5, 12.5); + + vector<string> mismatchTypes { + "Mc", "Sts", "StsAccRich", "StsRich", "StsRichTrue", "StsNoRich", "StsNoRichRF", + "StsNoRichRM", "StsNoRichNoRF", "StsNoRichNoProj", "StsRichWrong", "StsRichWrongRF", "StsRichWrongRM"}; + for (const string& t : mismatchTypes) { + fHM->Create1<TH1D>("fhMismatchSrcMom" + t, "fhMismatchSrcMom" + t + ";P [GeV/c];Yield", 40, 0., 10.); + } } void CbmRichRecoQa::Exec(Option_t* /*option*/) { fEventNum++; - cout << "CbmRichRecoQa, event No. " << fEventNum << endl; - + LOG(info) << "CbmRichRecoQa, event No. " << fEventNum; FillRichRingNofHits(); FillRingTrackDistance(); RingTrackMismatchSource(); @@ -203,13 +136,14 @@ void CbmRichRecoQa::Exec(Option_t* /*option*/) void CbmRichRecoQa::FillRichRingNofHits() { fNofHitsInRingMap.clear(); - Int_t nofRichHits = fRichHits->GetEntriesFast(); - for (Int_t iHit = 0; iHit < nofRichHits; iHit++) { - CbmRichHit* hit = static_cast<CbmRichHit*>(fRichHits->At(iHit)); + int nofRichHits = fRichHits->GetEntriesFast(); + for (int iHit = 0; iHit < nofRichHits; iHit++) { + const CbmRichHit* hit = static_cast<CbmRichHit*>(fRichHits->At(iHit)); if (nullptr == hit) continue; + vector<pair<int, int>> motherIds = + CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit(fDigiMan, hit, fRichPoints, fMcTracks, fEventNum); - vector<Int_t> motherIds = CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit(fDigiMan, hit, fRichPoints, fMCTracks); - for (UInt_t i = 0; i < motherIds.size(); i++) { + for (size_t i = 0; i < motherIds.size(); i++) { fNofHitsInRingMap[motherIds[i]]++; } } @@ -217,120 +151,112 @@ void CbmRichRecoQa::FillRichRingNofHits() void CbmRichRecoQa::RingTrackMismatchSource() { - Int_t nofMcTracks = fMCTracks->GetEntriesFast(); - for (Int_t iTrack = 0; iTrack < nofMcTracks; iTrack++) { - const CbmMCTrack* mcTrack = static_cast<const CbmMCTrack*>(fMCTracks->At(iTrack)); - if (mcTrack == nullptr) continue; - bool isEl = IsMcPrimaryElectron(mcTrack); - if (isEl) { - //MC - fHM->H1("fhMismatchSource")->Fill(0); - fHM->H1("fhMismatchSourceMomMc")->Fill(mcTrack->GetP()); + + int nofEvents = fEventList->GetNofEvents(); + for (int iE = 0; iE < nofEvents; iE++) { + int fileId = fEventList->GetFileIdByIndex(iE); + int eventId = fEventList->GetEventIdByIndex(iE); + + int nMcTracks = fMcTracks->Size(fileId, eventId); + for (int i = 0; i < nMcTracks; i++) { + //At least one hit in RICH + pair<int, int> val = std::make_pair(eventId, i); + if (fNofHitsInRingMap[val] < 1) continue; + const CbmMCTrack* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, i)); + if (IsMcPrimaryElectron(mcTrack)) { + fHM->H1("fhMismatchSrc")->Fill(0); // MC + fHM->H1("fhMismatchSrcMomMc")->Fill(mcTrack->GetP()); + } } } - - Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast(); - for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) { + int nofGlobalTracks = fGlobalTracks->GetEntriesFast(); + for (int iTrack = 0; iTrack < nofGlobalTracks; iTrack++) { const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(iTrack)); - Int_t stsId = globalTrack->GetStsTrackIndex(); + int stsId = globalTrack->GetStsTrackIndex(); if (stsId < 0) continue; const CbmTrackMatchNew* stsTrackMatch = static_cast<const CbmTrackMatchNew*>(fStsTrackMatches->At(stsId)); if (stsTrackMatch == nullptr) continue; - int stsMcTrackId = stsTrackMatch->GetMatchedLink().GetIndex(); - - CbmMCTrack* mctrack = static_cast<CbmMCTrack*>(fMCTracks->At(stsMcTrackId)); - if (mctrack == nullptr) continue; - Double_t mom = mctrack->GetP(); - - bool isEl = IsMcPrimaryElectron(mctrack); - if (!isEl) continue; - + int stsMcTrackId = stsTrackMatch->GetMatchedLink().GetIndex(); + int stsMcEventId = stsTrackMatch->GetMatchedLink().GetEntry(); + const CbmMCTrack* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(0, stsMcEventId, stsMcTrackId)); + if (!IsMcPrimaryElectron(mcTrack)) continue; + double mom = mcTrack->GetP(); //STS - fHM->H1("fhMismatchSource")->Fill(1); - fHM->H1("fhMismatchSourceMomSts")->Fill(mom); + fHM->H1("fhMismatchSrc")->Fill(1); + fHM->H1("fhMismatchSrcMomSts")->Fill(mom); - if (fNofHitsInRingMap[stsMcTrackId] >= 7) { + pair<int, int> val = std::make_pair(stsMcEventId, stsMcTrackId); + if (fNofHitsInRingMap[val] >= 7) { //Sts-AccRich - fHM->H1("fhMismatchSource")->Fill(2); - fHM->H1("fhMismatchSourceMomStsAccRich")->Fill(mctrack->GetP()); + fHM->H1("fhMismatchSrc")->Fill(2); + fHM->H1("fhMismatchSrcMomStsAccRich")->Fill(mcTrack->GetP()); } - Int_t richId = globalTrack->GetRichRingIndex(); - + int richId = globalTrack->GetRichRingIndex(); // No RICH segment if (richId < 0) { - //STS-noRICH - fHM->H1("fhMismatchSource")->Fill(5); - fHM->H1("fhMismatchSourceMomStsNoRich")->Fill(mom); + fHM->H1("fhMismatchSrc")->Fill(5); //STS-noRICH + fHM->H1("fhMismatchSrcMomStsNoRich")->Fill(mom); bool ringFound = WasRingFound(stsMcTrackId); bool ringMatched = WasRingMatched(stsMcTrackId); bool hasProj = HasRichProjection(stsId); if (ringFound) { - //STS-NoRich RF - fHM->H1("fhMismatchSource")->Fill(6); - fHM->H1("fhMismatchSourceMomStsNoRichRF")->Fill(mom); + fHM->H1("fhMismatchSrc")->Fill(6); //STS-NoRich RF + fHM->H1("fhMismatchSrcMomStsNoRichRF")->Fill(mom); } else { - //STS-NoRich NoRF - fHM->H1("fhMismatchSource")->Fill(8); - fHM->H1("fhMismatchSourceMomStsNoRichNoRF")->Fill(mom); + fHM->H1("fhMismatchSrc")->Fill(8); //STS-NoRich NoRF + fHM->H1("fhMismatchSrcMomStsNoRichNoRF")->Fill(mom); } if (ringMatched) { - //STS-NoRich RM - fHM->H1("fhMismatchSource")->Fill(7); - fHM->H1("fhMismatchSourceMomStsNoRichRM")->Fill(mom); + fHM->H1("fhMismatchSrc")->Fill(7); //STS-NoRich RM + fHM->H1("fhMismatchSrcMomStsNoRichRM")->Fill(mom); } if (!hasProj) { - //STS-NoRich NoProj - fHM->H1("fhMismatchSource")->Fill(9); - fHM->H1("fhMismatchSourceMomStsNoRichNoProj")->Fill(mom); + fHM->H1("fhMismatchSrc")->Fill(9); //STS-NoRich NoProj + fHM->H1("fhMismatchSrcMomStsNoRichNoProj")->Fill(mom); } - - continue; } + else { - //STS-RICH - fHM->H1("fhMismatchSource")->Fill(3); - fHM->H1("fhMismatchSourceMomStsRich")->Fill(mom); - - const CbmTrackMatchNew* richRingMatch = static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(richId)); - if (richRingMatch == nullptr) continue; - int richMcTrackId = richRingMatch->GetMatchedLink().GetIndex(); - const CbmRichRing* ring = static_cast<const CbmRichRing*>(fRichRings->At(richId)); - if (nullptr == ring) continue; + //STS-RICH + fHM->H1("fhMismatchSrc")->Fill(3); + fHM->H1("fhMismatchSrcMomStsRich")->Fill(mom); + const CbmTrackMatchNew* richRingMatch = static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(richId)); + if (richRingMatch == nullptr) continue; + int richMcTrackId = richRingMatch->GetMatchedLink().GetIndex(); + const CbmRichRing* ring = static_cast<const CbmRichRing*>(fRichRings->At(richId)); + if (nullptr == ring) continue; - if (stsMcTrackId == richMcTrackId) { - //STS-RICH true - fHM->H1("fhMismatchSource")->Fill(4); - fHM->H1("fhMismatchSourceMomStsRichTrue")->Fill(mom); - } - else { - //STS-RICH wrong - fHM->H1("fhMismatchSource")->Fill(10); - fHM->H1("fhMismatchSourceMomStsRichWrong")->Fill(mom); - if (WasRingFound(stsMcTrackId)) { - //STS-RICH wrong RF - fHM->H1("fhMismatchSource")->Fill(11); - fHM->H1("fhMismatchSourceMomStsRichWrongRF")->Fill(mom); + if (stsMcTrackId == richMcTrackId) { + fHM->H1("fhMismatchSrc")->Fill(4); //STS-RICH true + fHM->H1("fhMismatchSrcMomStsRichTrue")->Fill(mom); } + else { + fHM->H1("fhMismatchSrc")->Fill(10); //STS-RICH wrong + fHM->H1("fhMismatchSrcMomStsRichWrong")->Fill(mom); + if (WasRingFound(stsMcTrackId)) { + fHM->H1("fhMismatchSrc")->Fill(11); //STS-RICH wrong RF + fHM->H1("fhMismatchSrcMomStsRichWrongRF")->Fill(mom); + } - if (WasRingFound(stsMcTrackId)) { - //STS-RICH wrong RM - fHM->H1("fhMismatchSource")->Fill(12); - fHM->H1("fhMismatchSourceMomStsRichWrongRM")->Fill(mom); + if (WasRingFound(stsMcTrackId)) { + fHM->H1("fhMismatchSrc")->Fill(12); //STS-RICH wrong RM + fHM->H1("fhMismatchSrcMomStsRichWrongRM")->Fill(mom); + } } } } } -bool CbmRichRecoQa::WasRingFound(Int_t mcTrackId) +bool CbmRichRecoQa::WasRingFound(int mcTrackId) { - Int_t nofRings = fRichRings->GetEntriesFast(); - for (Int_t iR = 0; iR < nofRings; iR++) { + int nofRings = fRichRings->GetEntriesFast(); + for (int iR = 0; iR < nofRings; iR++) { const CbmRichRing* ring = static_cast<const CbmRichRing*>(fRichRings->At(iR)); if (ring == nullptr) continue; const CbmTrackMatchNew* richRingMatch = static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(iR)); @@ -341,13 +267,13 @@ bool CbmRichRecoQa::WasRingFound(Int_t mcTrackId) return false; } -bool CbmRichRecoQa::WasRingMatched(Int_t mcTrackId) +bool CbmRichRecoQa::WasRingMatched(int mcTrackId) { - Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast(); - for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) { + int nofGlobalTracks = fGlobalTracks->GetEntriesFast(); + for (int iTrack = 0; iTrack < nofGlobalTracks; iTrack++) { const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(iTrack)); - Int_t richId = globalTrack->GetRichRingIndex(); + int richId = globalTrack->GetRichRingIndex(); if (richId < 0) continue; const CbmTrackMatchNew* richRingMatch = static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(richId)); if (richRingMatch == nullptr) continue; @@ -359,31 +285,31 @@ bool CbmRichRecoQa::WasRingMatched(Int_t mcTrackId) } -bool CbmRichRecoQa::HasRichProjection(Int_t stsTrackId) +bool CbmRichRecoQa::HasRichProjection(int stsTrackId) { - if (stsTrackId < 0) { return false; } - FairTrackParam* pTrack = (FairTrackParam*) fRichProjections->At(stsTrackId); - if (pTrack == nullptr) { return false; } + if (stsTrackId < 0) return false; + const FairTrackParam* pTrack = static_cast<FairTrackParam*>(fRichProjections->At(stsTrackId)); + if (pTrack == nullptr) return false; - if (pTrack->GetX() == 0. && pTrack->GetY() == 0.) { return false; } - else { - return true; - } + if (pTrack->GetX() == 0. && pTrack->GetY() == 0.) return false; + + return true; } void CbmRichRecoQa::FillRingTrackDistance() { - Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast(); - for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) { + int nofGlobalTracks = fGlobalTracks->GetEntriesFast(); + for (int iTrack = 0; iTrack < nofGlobalTracks; iTrack++) { const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(iTrack)); - Int_t stsId = globalTrack->GetStsTrackIndex(); - Int_t richId = globalTrack->GetRichRingIndex(); + int stsId = globalTrack->GetStsTrackIndex(); + int richId = globalTrack->GetRichRingIndex(); if (stsId < 0 || richId < 0) continue; const CbmTrackMatchNew* stsTrackMatch = static_cast<const CbmTrackMatchNew*>(fStsTrackMatches->At(stsId)); if (stsTrackMatch == nullptr) continue; int stsMcTrackId = stsTrackMatch->GetMatchedLink().GetIndex(); + int stsMcEventId = stsTrackMatch->GetMatchedLink().GetEntry(); const CbmTrackMatchNew* richRingMatch = static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(richId)); if (richRingMatch == nullptr) continue; @@ -396,58 +322,40 @@ void CbmRichRecoQa::FillRingTrackDistance() double yc = ring->GetCenterY(); int nofHits = ring->GetNofHits(); - CbmMCTrack* mctrack = static_cast<CbmMCTrack*>(fMCTracks->At(stsMcTrackId)); - if (mctrack == nullptr) continue; - double mom = mctrack->GetP(); - int charge = mctrack->GetCharge(); + const CbmMCTrack* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(0, stsMcEventId, stsMcTrackId)); + if (mcTrack == nullptr) continue; + double mom = mcTrack->GetP(); + int charge = mcTrack->GetCharge(); - bool isEl = IsMcPrimaryElectron(mctrack); - bool isPi = IsMcPion(mctrack); + bool isEl = IsMcPrimaryElectron(mcTrack); + bool isPi = IsMcPion(mcTrack); if (!isEl && !isPi) continue; - string s = ""; - - for (int i = 0; i < 2; i++) { - if (i == 0) { - if (isEl) { s = "Primel"; } - else if (isPi) { - s = "Pi"; - } - else { - continue; - } - } - else if (i == 1) { - if (isEl) { - if (charge > 0) { s = "PrimelPlus"; } - else if (charge < 0) { - s = "PrimelMinus"; - } - else { - continue; - } - } - else { - continue; - } - } - + vector<string> matchTypes {"Primel", "Pi", "PrimelPlus", "PrimelMinus"}; + for (const string& t : matchTypes) { + //cout << "t:" << t << " iT:" << iTrack << " dist:" << rtDistance << " if:" << (!(t == "Primel" && isEl)?"true":"false")<< endl; + bool isGood = false; + if (t == "Primel" && isEl) isGood = true; + if (t == "Pi" && isPi) isGood = true; + if (t == "PrimelPlus" && isEl && charge > 0) isGood = true; + if (t == "PrimelMinus" && isEl && charge < 0) isGood = true; + if (!isGood) continue; if (stsMcTrackId == richMcTrackId) { - fHM->H2("fhRingTrackDistVsMomTruematch" + s)->Fill(mom, rtDistance); - fHM->H3("fhRingTrackDistVsXYTruematch" + s)->Fill(xc, yc, rtDistance); - fHM->H2("fhRingTrackDistVsXTruematch" + s)->Fill(xc, rtDistance); - fHM->H2("fhRingTrackDistVsYTruematch" + s)->Fill(abs(yc), rtDistance); - fHM->H2("fhRingTrackDistVsNofHitsTruematch" + s)->Fill(nofHits, rtDistance); + fHM->H2("fhRTDistVsMomTruematch" + t)->Fill(mom, rtDistance); + fHM->H3("fhRTDistVsXYTruematch" + t)->Fill(xc, yc, rtDistance); + fHM->H2("fhRTDistVsXTruematch" + t)->Fill(xc, rtDistance); + fHM->H2("fhRTDistVsYTruematch" + t)->Fill(abs(yc), rtDistance); + fHM->H2("fhRTDistVsNofHitsTruematch" + t)->Fill(nofHits, rtDistance); - if (i == 0 && isEl) { + if (t == "Primel" && isEl) { //if (CbmLitGlobalElectronId::GetInstance().IsRichElectron(iTrack, mom)){ - fHM->H2("fhRingTrackDistVsMomTruematchElId")->Fill(mom, rtDistance); + fHM->H2("fhRTDistVsMomTruematchElId")->Fill(mom, rtDistance); //} } } else { - fHM->H2("fhRingTrackDistVsMomWrongmatch" + s)->Fill(mom, rtDistance); + fHM->H2("fhRTDistVsMomWrongmatch" + t)->Fill(mom, rtDistance); } } } @@ -456,175 +364,157 @@ void CbmRichRecoQa::FillRingTrackDistance() void CbmRichRecoQa::DrawHist() { - cout.precision(4); - - SetDefaultDrawStyle(); - //fHM->ScaleByPattern("fh_.*", 1./fEventNum); { - fHM->CreateCanvas("fh_ring_track_distance_truematch_comparison_primel", - "fh_ring_track_distance_truematch_comparison_primel", 800, 800); - TH1D* py_minus = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimelMinus") - ->ProjectionY("fhRingTrackDistVsMomTruematchPrimelMinus_py") + fHM->CreateCanvas("richqa_RTDist_truematch_epem", "richqa_RTDist_truematch_epem", 1000, 1000); + TH1D* py_minus = (TH1D*) (fHM->H2("fhRTDistVsMomTruematchPrimelMinus") + ->ProjectionY("fhRTDistVsMomTruematchPrimelMinus_py") ->Clone()); py_minus->Scale(1. / py_minus->Integral()); - TH1D* py_plus = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimelPlus") - ->ProjectionY("fhRingTrackDistVsMomTruematchPrimelPlus_py") + TH1D* py_plus = (TH1D*) (fHM->H2("fhRTDistVsMomTruematchPrimelPlus") + ->ProjectionY("fhRTDistVsMomTruematchPrimelPlus_py") ->Clone()); py_plus->Scale(1. / py_plus->Integral()); DrawH1({py_minus, py_plus}, - {"e_{prim}^{-} (" + this->GetMeanRmsOverflowString(py_minus, false) + ")", - "e_{prim}^{+} (" + this->GetMeanRmsOverflowString(py_plus, false) + ")"}, - kLinear, kLog, true, 0.5, 0.85, 0.99, 0.99); + {"e_{prim}^{-} (" + GetMeanRmsOverflowString(py_minus, false) + ")", + "e_{prim}^{+} (" + GetMeanRmsOverflowString(py_plus, false) + ")"}, + kLinear, kLog, true, 0.5, 0.85, 0.99, 0.99, "hist"); } { - fHM->CreateCanvas("fh_ring_track_distance_truematch_comparison_elpi", - "fh_ring_track_distance_truematch_comparison_elpi", 800, 800); - TH1D* py_el = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimel") - ->ProjectionY("fhRingTrackDistVsMomTruematchPrimel_py") - ->Clone()); + fHM->CreateCanvas("richqa_RTDist_truematch_elpi", "richqa_RTDist_truematch_elpi", 800, 800); + TH1D* py_el = + (TH1D*) (fHM->H2("fhRTDistVsMomTruematchPrimel")->ProjectionY("fhRTDistVsMomTruematchPrimel_py")->Clone()); py_el->Scale(1. / py_el->Integral()); - TH1D* py_pi = - (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPi")->ProjectionY("fhRingTrackDistVsMomTruematchPi_py")->Clone()); + TH1D* py_pi = (TH1D*) (fHM->H2("fhRTDistVsMomTruematchPi")->ProjectionY("fhRTDistVsMomTruematchPi_py")->Clone()); py_pi->Scale(1. / py_pi->Integral()); DrawH1({py_el, py_pi}, - {"e_{prim}^{#pm} (" + this->GetMeanRmsOverflowString(py_el, false) + ")", - "#pi^{#pm} (" + this->GetMeanRmsOverflowString(py_pi, false) + ")"}, - kLinear, kLog, true, 0.5, 0.85, 0.99, 0.99); + {"e_{prim}^{#pm} (" + GetMeanRmsOverflowString(py_el, false) + ")", + "#pi^{#pm} (" + GetMeanRmsOverflowString(py_pi, false) + ")"}, + kLinear, kLog, true, 0.5, 0.85, 0.99, 0.99, "hist"); } { gStyle->SetPaintTextFormat("4.1f"); - fHM->CreateCanvas("fh_mismatch_source", "fh_mismatch_source", 1000, 800); - Double_t nofMcEl = fHM->H1("fhMismatchSource")->GetBinContent(1); - cout << "nofMcEl = " << nofMcEl << endl; - fHM->H1("fhMismatchSource")->Scale(100. / nofMcEl); - DrawH1(fHM->H1("fhMismatchSource"), kLinear, kLog, "hist text"); - fHM->H1("fhMismatchSource")->SetMarkerSize(1.9); - - vector<string> labels = {"MC", - "STS", - "STS-Acc RICH", - "STS-RICH", - "STS-RICH true", - "STS-NoRICH", - "STS-NoRICH RF", - "STS-NoRICH RM", - "STS-NoRICH NoRF", - "STS-NoRICH NoPrj", - "STS-RICH wrong", - "STS-RICH wrong RF", - "STS-RICH wrong RM"}; - for (unsigned int i = 0; i < labels.size(); i++) { - fHM->H1("fhMismatchSource")->GetXaxis()->SetBinLabel(i + 1, labels[i].c_str()); + fHM->CreateCanvas("richqa_mismatch_src", "richqa_mismatch_src", 1000, 800); + double nofMcEl = fHM->H1("fhMismatchSrc")->GetBinContent(1); + fHM->Scale("fhMismatchSrc", 100. / nofMcEl); + DrawH1(fHM->H1("fhMismatchSrc"), kLinear, kLog, "hist text"); + fHM->H1("fhMismatchSrc")->SetMarkerSize(1.9); + + vector<string> labels {"MC", + "STS", + "STS-Acc RICH", + "STS-RICH", + "STS-RICH true", + "STS-NoRICH", + "STS-NoRICH RF", + "STS-NoRICH RM", + "STS-NoRICH NoRF", + "STS-NoRICH NoPrj", + "STS-RICH wrong", + "STS-RICH wrong RF", + "STS-RICH wrong RM"}; + + for (size_t i = 0; i < labels.size(); i++) { + fHM->H1("fhMismatchSrc")->GetXaxis()->SetBinLabel(i + 1, labels[i].c_str()); } - fHM->H1("fhMismatchSource")->GetXaxis()->SetLabelSize(0.03); + fHM->H1("fhMismatchSrc")->GetXaxis()->SetLabelSize(0.03); } { - fHM->CreateCanvas("fh_mismatch_source_mom", "fh_mismatch_source_mom", 1000, 800); - vector<string> labels = {"MC", - "STS", - "STS-Acc RICH", - "STS-RICH", - "STS-RICH true", - "STS-NoRICH", - "STS-NoRICH RF", - "STS-NoRICH RM", - "STS-NoRICH NoRF", - "STS-NoRICH NoPrj", - "STS-RICH wrong", - "STS-RICH wrong RF", - "STS-RICH wrong RM"}; - vector<TH1*> hists = {fHM->H1("fhMismatchSourceMomMc"), - fHM->H1("fhMismatchSourceMomSts"), - fHM->H1("fhMismatchSourceMomStsAccRich"), - fHM->H1("fhMismatchSourceMomStsRich"), - fHM->H1("fhMismatchSourceMomStsRichTrue"), - fHM->H1("fhMismatchSourceMomStsNoRich"), - fHM->H1("fhMismatchSourceMomStsNoRichRF"), - fHM->H1("fhMismatchSourceMomStsNoRichRM"), - fHM->H1("fhMismatchSourceMomStsNoRichNoRF"), - fHM->H1("fhMismatchSourceMomStsNoRichNoProj"), - fHM->H1("fhMismatchSourceMomStsRichWrong"), - fHM->H1("fhMismatchSourceMomStsRichWrongRF"), - fHM->H1("fhMismatchSourceMomStsRichWrongRM")}; + fHM->CreateCanvas("richqa_mismatch_src_mom", "richqa_mismatch_src_mom", 1000, 800); + vector<string> labels {"MC", + "STS", + "STS-Acc RICH", + "STS-RICH", + "STS-RICH true", + "STS-NoRICH", + "STS-NoRICH RF", + "STS-NoRICH RM", + "STS-NoRICH NoRF", + "STS-NoRICH NoPrj", + "STS-RICH wrong", + "STS-RICH wrong RF", + "STS-RICH wrong RM"}; + vector<TH1*> hists = fHM->H1Vector( + {"fhMismatchSrcMomMc", "fhMismatchSrcMomSts", "fhMismatchSrcMomStsAccRich", "fhMismatchSrcMomStsRich", + "fhMismatchSrcMomStsRichTrue", "fhMismatchSrcMomStsNoRich", "fhMismatchSrcMomStsNoRichRF", + "fhMismatchSrcMomStsNoRichRM", "fhMismatchSrcMomStsNoRichNoRF", "fhMismatchSrcMomStsNoRichNoProj", + "fhMismatchSrcMomStsRichWrong", "fhMismatchSrcMomStsRichWrongRF", "fhMismatchSrcMomStsRichWrongRM"}); DrawH1(hists, labels, kLinear, kLog, true, 0.8, 0.35, 0.99, 0.99); - fHM->H1("fhMismatchSourceMomMc")->SetMinimum(0.9); + fHM->H1("fhMismatchSrcMomMc")->SetMinimum(0.9); } - DrawRingTrackDistHistWithSuffix("Primel"); - DrawRingTrackDistHistWithSuffix("PrimelPlus"); - DrawRingTrackDistHistWithSuffix("PrimelMinus"); - DrawRingTrackDistHistWithSuffix("Pi"); + DrawRingTrackDist("Primel"); + DrawRingTrackDist("PrimelPlus"); + DrawRingTrackDist("PrimelMinus"); + DrawRingTrackDist("Pi"); // before and after electron identification { - TCanvas* c = - fHM->CreateCanvas("fh_ring_track_distance_truematch_elid", "fh_ring_track_distance_truematch_elid", 1800, 600); + TCanvas* c = fHM->CreateCanvas("richqa_RTDist_truematch_elid", "richqa_RTDist_truematch_elid", 1800, 600); c->Divide(3, 1); c->cd(1); - DrawH2WithProfile(fHM->H2("fhRingTrackDistVsMomTruematchPrimel"), false, true); + DrawH2WithProfile(fHM->H2("fhRTDistVsMomTruematchPrimel"), false, true); c->cd(2); - DrawH2WithProfile(fHM->H2("fhRingTrackDistVsMomTruematchElId"), false, true); + DrawH2WithProfile(fHM->H2("fhRTDistVsMomTruematchElId"), false, true); c->cd(3); - TH1D* py = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimel") - ->ProjectionY(string("fhRingTrackDistVsMomTruematchPrimel_py2").c_str()) + TH1D* py = (TH1D*) (fHM->H2("fhRTDistVsMomTruematchPrimel") + ->ProjectionY(string("fhRTDistVsMomTruematchPrimel_py2").c_str()) ->Clone()); - TH1D* pyElId = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchElId") - ->ProjectionY(string("fhRingTrackDistVsMomTruematchElId_py").c_str()) + TH1D* pyElId = (TH1D*) (fHM->H2("fhRTDistVsMomTruematchElId") + ->ProjectionY(string("fhRTDistVsMomTruematchElId_py").c_str()) ->Clone()); - DrawH1({py, pyElId}, - {string("before ElId (" + this->GetMeanRmsOverflowString(py) + ")"), - string("after ElId (" + this->GetMeanRmsOverflowString(pyElId) + ")")}, - kLinear, kLog, true, 0.3, 0.75, 0.99, 0.99); - fHM->H2("fhRingTrackDistVsMomTruematchPrimel")->GetYaxis()->SetRangeUser(0., 2.); - fHM->H2("fhRingTrackDistVsMomTruematchElId")->GetYaxis()->SetRangeUser(0., 2.); + DrawH1( + {py, pyElId}, + {"before ElId (" + GetMeanRmsOverflowString(py) + ")", "after ElId (" + GetMeanRmsOverflowString(pyElId) + ")"}, + kLinear, kLog, true, 0.3, 0.75, 0.99, 0.99); + fHM->H2("fhRTDistVsMomTruematchPrimel")->GetYaxis()->SetRangeUser(0., 2.); + fHM->H2("fhRTDistVsMomTruematchElId")->GetYaxis()->SetRangeUser(0., 2.); } } -string CbmRichRecoQa::GetMeanRmsOverflowString(TH1* h, Bool_t withOverflow) +string CbmRichRecoQa::GetMeanRmsOverflowString(TH1* h, bool withOverflow) { if (withOverflow) { double overflow = h->GetBinContent(h->GetNbinsX() + 1); - return Cbm::NumberToString<Double_t>(h->GetMean(), 2) + " / " + Cbm::NumberToString<Double_t>(h->GetRMS(), 2) - + " / " + Cbm::NumberToString<Double_t>(100. * overflow / h->Integral(0, h->GetNbinsX() + 1), 2) + "%"; + return Cbm::NumberToString<double>(h->GetMean(), 2) + " / " + Cbm::NumberToString<double>(h->GetRMS(), 2) + " / " + + Cbm::NumberToString<double>(100. * overflow / h->Integral(0, h->GetNbinsX() + 1), 2) + "%"; } else { - return Cbm::NumberToString<Double_t>(h->GetMean(), 2) + " / " + Cbm::NumberToString<Double_t>(h->GetRMS(), 2); + return Cbm::NumberToString<double>(h->GetMean(), 2) + " / " + Cbm::NumberToString<double>(h->GetRMS(), 2); } } -void CbmRichRecoQa::DrawRingTrackDistHistWithSuffix(const string& s) +void CbmRichRecoQa::DrawRingTrackDist(const string& opt) { { - TCanvas* c = - fHM->CreateCanvas("fh_ring_track_distance_truematch_" + s, "fh_ring_track_distance_truematch_" + s, 1800, 600); + TCanvas* c = fHM->CreateCanvas("richqa_RTDist_truematch_" + opt, "richqa_RTDist_truematch_" + opt, 1800, 600); c->Divide(3, 1); c->cd(1); - DrawH2WithProfile(fHM->H2("fhRingTrackDistVsMomTruematch" + s), false, true); + DrawH2WithProfile(fHM->H2("fhRTDistVsMomTruematch" + opt), false, true); c->cd(2); - DrawH2WithProfile(fHM->H2("fhRingTrackDistVsNofHitsTruematch" + s), false, true); + DrawH2WithProfile(fHM->H2("fhRTDistVsNofHitsTruematch" + opt), false, true); c->cd(3); - TH1D* py = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematch" + s) - ->ProjectionY(("fhRingTrackDistVsMomTruematch_py" + s).c_str()) + TH1D* py = (TH1D*) (fHM->H2("fhRTDistVsMomTruematch" + opt) + ->ProjectionY(("fhRTDistVsMomTruematch_py" + opt).c_str()) ->Clone()); DrawH1(py); DrawTextOnPad(this->GetMeanRmsOverflowString(py), 0.2, 0.9, 0.8, 0.99); gPad->SetLogy(true); - fHM->H2("fhRingTrackDistVsMomTruematch" + s)->GetYaxis()->SetRangeUser(0., 2.); - fHM->H2("fhRingTrackDistVsNofHitsTruematch" + s)->GetYaxis()->SetRangeUser(0., 2.); + fHM->H2("fhRTDistVsMomTruematch" + opt)->GetYaxis()->SetRangeUser(0., 2.); + fHM->H2("fhRTDistVsNofHitsTruematch" + opt)->GetYaxis()->SetRangeUser(0., 2.); } { - fHM->CreateCanvas("fh_ring_track_distance_wrongmatch" + s, "fh_ring_track_distance_wrongmatch" + s, 600, 600); - TH1D* py = (TH1D*) (fHM->H2("fhRingTrackDistVsMomWrongmatch" + s) - ->ProjectionY(("fhRingTrackDistVsMomWrongmatch_py" + s).c_str()) + fHM->CreateCanvas("richqa_RTDist_wrongmatch" + opt, "richqa_RTDist_wrongmatch" + opt, 600, 600); + TH1D* py = (TH1D*) (fHM->H2("fhRTDistVsMomWrongmatch" + opt) + ->ProjectionY(("fhRTDistVsMomWrongmatch_py" + opt).c_str()) ->Clone()); DrawH1(py); DrawTextOnPad(this->GetMeanRmsOverflowString(py), 0.2, 0.9, 0.8, 0.99); @@ -632,34 +522,30 @@ void CbmRichRecoQa::DrawRingTrackDistHistWithSuffix(const string& s) } { - TCanvas* c = fHM->CreateCanvas("fh_ring_track_distance_vs_xy_truematch" + s, - "fh_ring_track_distance_vs_xy_truematch" + s, 1800, 600); + TCanvas* c = fHM->CreateCanvas("richqa_RTDist_xy_truematch" + opt, "richqa_RTDist_xy_truematch" + opt, 1800, 600); c->Divide(3, 1); c->cd(1); - DrawH3Profile(fHM->H3("fhRingTrackDistVsXYTruematch" + s), true, false, 0., .4); + DrawH3Profile(fHM->H3("fhRTDistVsXYTruematch" + opt), true, false, 0., .4); c->cd(2); - DrawH2WithProfile(fHM->H2("fhRingTrackDistVsXTruematch" + s), false, true); - fHM->H2("fhRingTrackDistVsXTruematch" + s)->GetYaxis()->SetRangeUser(0., 2.); + DrawH2WithProfile(fHM->H2("fhRTDistVsXTruematch" + opt), false, true); + fHM->H2("fhRTDistVsXTruematch" + opt)->GetYaxis()->SetRangeUser(0., 2.); c->cd(3); - DrawH2WithProfile(fHM->H2("fhRingTrackDistVsYTruematch" + s), false, true); - fHM->H2("fhRingTrackDistVsYTruematch" + s)->GetYaxis()->SetRangeUser(0., 2.); + DrawH2WithProfile(fHM->H2("fhRTDistVsYTruematch" + opt), false, true); + fHM->H2("fhRTDistVsYTruematch" + opt)->GetYaxis()->SetRangeUser(0., 2.); } } bool CbmRichRecoQa::IsMcPrimaryElectron(const CbmMCTrack* mctrack) { if (mctrack == nullptr) return false; - int pdg = TMath::Abs(mctrack->GetPdgCode()); - if (mctrack->GetGeantProcessId() == kPPrimary && pdg == 11) return true; + if (mctrack->GetGeantProcessId() == kPPrimary && std::abs(mctrack->GetPdgCode()) == 11) return true; return false; } bool CbmRichRecoQa::IsMcPion(const CbmMCTrack* mctrack) { - if (mctrack == nullptr) return false; - int pdg = TMath::Abs(mctrack->GetPdgCode()); - if (pdg == 211) return true; - return false; + if (mctrack == nullptr || std::abs(mctrack->GetPdgCode()) != 211) return false; + return true; } void CbmRichRecoQa::Finish() @@ -669,7 +555,7 @@ void CbmRichRecoQa::Finish() TDirectory* oldir = gDirectory; TFile* outFile = FairRootManager::Instance()->GetOutFile(); - if (outFile != NULL) { + if (outFile != nullptr) { outFile->cd(); fHM->WriteToFile(); } diff --git a/reco/detectors/rich/qa/CbmRichRecoQa.h b/reco/detectors/rich/qa/CbmRichRecoQa.h index f12613654e6769d90fcfb554c58fe1c1f18403b3..6519a2aab45b1961706b6938d90edce5da08d1a2 100644 --- a/reco/detectors/rich/qa/CbmRichRecoQa.h +++ b/reco/detectors/rich/qa/CbmRichRecoQa.h @@ -7,8 +7,8 @@ #include "FairTask.h" class TClonesArray; +class CbmMCDataArray; class CbmRichRing; -class TCanvas; class CbmHistManager; class TH1D; class TH2D; @@ -16,12 +16,11 @@ class TH2; class TH3; class CbmMCTrack; class CbmDigiManager; +class CbmMCEventList; #include <map> #include <vector> -using namespace std; - class CbmRichRecoQa : public FairTask { public: @@ -50,20 +49,20 @@ public: */ virtual void Finish(); - static Bool_t IsMcPrimaryElectron(const CbmMCTrack* mctrack); + static bool IsMcPrimaryElectron(const CbmMCTrack* mctrack); - static Bool_t IsMcPion(const CbmMCTrack* mctrack); + static bool IsMcPion(const CbmMCTrack* mctrack); /** * \brief Set output directory where you want to write results (figures and json). * \param[in] dir Path to the output directory. */ - void SetOutputDir(const string& dir) { fOutputDir = dir; } + void SetOutputDir(const std::string& dir) { fOutputDir = dir; } /** * \brief Draw histogram from file */ - void DrawFromFile(const string& fileName, const string& outputDir); + void DrawFromFile(const std::string& fileName, const std::string& outputDir); private: /** @@ -94,32 +93,32 @@ private: /** * \brief Return string with mean, RMS and overflow percent for input TH1. */ - string GetMeanRmsOverflowString(TH1* h, Bool_t withOverflow = true); + std::string GetMeanRmsOverflowString(TH1* h, bool withOverflow = true); /** * \brief Draw histograms related to ring-track distance for pions or electrons (+/-). */ - void DrawRingTrackDistHistWithSuffix(const string& suffix); + void DrawRingTrackDist(const std::string& opt); /* * \brief Check that the ring with an input MCTrackId was found */ - bool WasRingFound(Int_t mcTrackId); + bool WasRingFound(int mcTrackId); /* * \brief Check that the ring was matched with some global track */ - bool WasRingMatched(Int_t mcTrackId); + bool WasRingMatched(int mcTrackId); /* * \brief Check that the Sts track projection was matched with RICH ring */ - bool WasRichProjectionMatched(Int_t stsTrackId); + bool WasRichProjectionMatched(int stsTrackId); /* * Check that STS track has projection in the RICH */ - bool HasRichProjection(Int_t stsTrackId); + bool HasRichProjection(int stsTrackId); /** @@ -133,27 +132,26 @@ private: CbmRichRecoQa& operator=(const CbmRichRecoQa&); - CbmHistManager* fHM; + CbmHistManager* fHM = nullptr; - Int_t fEventNum; + int fEventNum = 0; - string fOutputDir; // output dir for results + std::string fOutputDir = ""; // output dir for results - TClonesArray* fMCTracks; - TClonesArray* fRichPoints; - TClonesArray* fRichHits; - TClonesArray* fRichRings; - TClonesArray* fRichRingMatches; - TClonesArray* fGlobalTracks; - TClonesArray* fStsTracks; - TClonesArray* fStsTrackMatches; - TClonesArray* fRichProjections; - CbmDigiManager* fDigiMan; + CbmMCDataArray* fMcTracks = nullptr; + CbmMCDataArray* fRichPoints = nullptr; + TClonesArray* fRichHits = nullptr; + TClonesArray* fRichRings = nullptr; + TClonesArray* fRichRingMatches = nullptr; + TClonesArray* fGlobalTracks = nullptr; + TClonesArray* fStsTracks = nullptr; + TClonesArray* fStsTrackMatches = nullptr; + TClonesArray* fRichProjections = nullptr; + CbmDigiManager* fDigiMan = nullptr; + CbmMCEventList* fEventList = nullptr; // Number of hits in the MC RICH ring - std::map<Int_t, Int_t> fNofHitsInRingMap; - - vector<TCanvas*> fCanvas; + std::map<std::pair<int, int>, int> fNofHitsInRingMap; ClassDef(CbmRichRecoQa, 1) }; diff --git a/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx b/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx index 0c61bb252bb25ec2f64b008307664604838ba0e4..75ff25a53b269168ff0c1f91ae29e6b0ecad4109 100644 --- a/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx +++ b/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx @@ -46,7 +46,6 @@ CbmRichUrqmdTest::~CbmRichUrqmdTest() {} InitStatus CbmRichUrqmdTest::Init() { - cout << "CbmRichUrqmdTest::Init" << endl; fMcTracks = InitOrFatalMc("MCTrack", "CbmRichUrqmdTest::Init"); fRichPoints = InitOrFatalMc("RichPoint", "CbmRichUrqmdTest::Init"); fRichHits = GetOrFatal<TClonesArray>("RichHit", "CbmRichUrqmdTest::Init"); @@ -86,94 +85,91 @@ void CbmRichUrqmdTest::InitHistograms() { fHM = new CbmHistManager(); - fHM->Create1<TH1D>("fh_vertex_z", "fh_vertex_z;z [cm];# vertices/ev.", 350, -1., 350); - fHM->Create1<TH1D>("fh_vertex_z_sts", "fh_vertex_z_sts;z [cm];# vertices/ev.", 222, -1., 110.); - fHM->Create2<TH2D>("fh_vertex_xy", "fh_vertex_xy;x [cm];y [cm];# vertices/ev.", 100, -200., 200., 100, -200., 200.); - fHM->Create2<TH2D>("fh_vertex_zy", "fh_vertex_zy;z [cm];y [cm];# vertices/ev.", 350, -1., 350, 100, -200., 200.); - fHM->Create2<TH2D>("fh_vertex_zx", "fh_vertex_zx;z [cm];x [cm];# vertices/ev.", 350, -1., 350, 100, -200., 200.); + fHM->Create1<TH1D>("fh_vertex_z", "fh_vertex_z;Z [cm];# vertices/ev.", 400, -50., 350); + fHM->Create1<TH1D>("fh_vertex_z_sts", "fh_vertex_z_sts;Z [cm];# vertices/ev.", 320, -50., 110.); + fHM->Create2<TH2D>("fh_vertex_xy", "fh_vertex_xy;X [cm];Y [cm];# vertices/ev.", 100, -200., 200., 100, -200., 200.); + fHM->Create2<TH2D>("fh_vertex_zy", "fh_vertex_zy;Z [cm];Y [cm];# vertices/ev.", 400, -50., 350, 100, -200., 200.); + fHM->Create2<TH2D>("fh_vertex_zx", "fh_vertex_zx;Z [cm];X [cm];# vertices/ev.", 400, -50., 350, 100, -200., 200.); - - fHM->Create2<TH2D>("fh_vertex_xy_z100_180", "fh_vertex_xy_z100_180;x [cm];y [cm];# vertices/ev.", 100, -200., 200., - 100, -200., 200.); - fHM->Create2<TH2D>("fh_vertex_xy_z180_370", "fh_vertex_xy_z180_370;x [cm];y [cm];# vertices/ev.", 100, -200., 200., - 100, -200., 200.); - fHM->Create2<TH2D>("fh_vertex_xy_z180_230", "fh_vertex_xy_z180_230;x [cm];y [cm];# vertices/ev.", 100, -200., 200., - 100, -200., 200.); + vector<string> vertexZTypes {"z60_140", "z140_330", "z140_190"}; + for (const string& t : vertexZTypes) { + fHM->Create2<TH2D>("fh_vertex_xy_" + t, "fh_vertex_xy_" + t + ";X [cm];Y [cm];# vertices/ev.", 100, -200., 200., + 100, -200., 200.); + } for (auto pair : fVertexZStsSlices) { string name = "fh_vertex_xy_z" + to_string(pair.first) + "_" + to_string(pair.second); fHM->Create2<TH2D>(name, name + ";x [cm];y [cm];# vertices/ev.", 100, -100., 100., 100, -100., 100.); } - fHM->Create1<TH1D>("fh_nof_rings_1hit", "fh_nof_rings_1hit;# detected particles/ev.;Yield", 250, -.5, 249.5); - fHM->Create1<TH1D>("fh_nof_rings_7hits", "fh_nof_rings_7hits;# detected particles/ev.;Yield", 250, -.5, 249.5); - fHM->Create1<TH1D>("fh_nof_rings_prim_1hit", "fh_nof_rings_prim_1hit;# detected particles/ev.;Yield", 50, -.5, 69.5); - fHM->Create1<TH1D>("fh_nof_rings_prim_7hits", "fh_nof_rings_prim_7hits;# detected particles/ev.;Yield", 50, -.5, - 69.5); - fHM->Create1<TH1D>("fh_nof_rings_target_1hit", "fh_nof_rings_target_1hit;# detected particles/ev.;Yield", 60, -.5, - 79.5); - fHM->Create1<TH1D>("fh_nof_rings_target_7hits", "fh_nof_rings_target_7hits;# detected particles/ev.;Yield", 60, -.5, - 79.5); + vector<string> nofRingsTypes {"1hit", "7hits", "prim_1hit", "prim_7hits", "target_1hit", "target_7hits"}; + for (const string& t : nofRingsTypes) { + double nofBins = (t == "1hit" || t == "7hits") ? 30 : 100; + fHM->Create1<TH1D>("fh_nof_rings_" + t, "fh_nof_rings_" + t + ";# particles/ev.;Yield", nofBins, -.5, + nofBins - 0.5); + } - fHM->Create1<TH1D>("fh_secel_mom", "fh_secel_mom;p [GeV/c];Number per event", 100, 0., 20); - fHM->Create1<TH1D>("fh_gamma_target_mom", "fh_gamma_target_mom;p [GeV/c];Number per event", 100, 0., 20); - fHM->Create1<TH1D>("fh_gamma_nontarget_mom", "fh_gamma_nontarget_mom;p [GeV/c];Number per event", 100, 0., 20); - fHM->Create1<TH1D>("fh_pi_mom", "fh_pi_mom;p [GeV/c];Number per event", 100, 0., 20); - fHM->Create1<TH1D>("fh_kaon_mom", "fh_kaon_mom;p [GeV/c];Number per event", 100, 0., 20); - fHM->Create1<TH1D>("fh_mu_mom", "fh_mu_mom;p [GeV/c];Number per event", 100, 0., 20); + vector<string> momP {"fh_secel_mom", "fh_gamma_target_mom", "fh_gamma_nontarget_mom", + "fh_pi_mom", "fh_kaon_mom", "fh_mu_mom"}; + for (const string& t : momP) { + fHM->Create1<TH1D>(t, t + ";P [GeV/c];Number per event", 100, 0., 20); + } - fHM->Create1<TH1D>("fh_nof_points_per_event", "fh_nof_points_per_event;Particle;# MC points/ev.", 7, .5, 7.5); - fHM->Create1<TH1D>("fh_nof_hits_per_event", "fh_nof_hits_per_event;# hits per event;Yield", 200, 0, 2000); - fHM->Create1<TH1D>("fh_nof_hits_per_pmt", "fh_nof_hits_per_pmt;# hits per PMT;% of total", 65, -0.5, 64.5); + fHM->Create1<TH1D>("fh_nof_points_per_event_src", "fh_nof_points_per_event_src;Particle;# MC points/ev.", 7, .5, 7.5); + fHM->Create1<TH1D>("fh_nof_hits_per_event", "fh_nof_hits_per_event;# hits/ev.;Yield", 200, 0, 2000); + fHM->Create1<TH1D>("fh_nof_points_per_event", "fh_nof_points_per_event;# points/ev.;Yield", 200, 0, 10000); + fHM->Create1<TH1D>("fh_nof_hits_per_pmt", "fh_nof_hits_per_pmt;# hits/PMT;% of total", 65, -0.5, 64.5); vector<double> xPmtBins = CbmRichUtil::GetPmtHistXbins(); vector<double> yPmtBins = CbmRichUtil::GetPmtHistYbins(); - // before drawing must be normalized by 1/64 + // before drawing this histogram must be normalized by 1/64 fHM->Create2<TH2D>("fh_hitrate_xy", "fh_hitrate_xy;X [cm];Y [cm];# hits/pixel/s", xPmtBins, yPmtBins); + fHM->Create2<TH2D>("fh_hits_xy", "fh_hits_xy;X [cm];Y [cm];# hits/PMT/ev.", xPmtBins, yPmtBins); - fHM->Create2<TH2D>("fh_points_xy", "fh_points_xy;X [cm];Y [cm];# MC points/PMT/ev.", xPmtBins, yPmtBins); - fHM->Create2<TH2D>("fh_points_xy_pions", "fh_points_xy_pions;X [cm];Y [cm];# MC points/PMT/ev.", xPmtBins, yPmtBins); - fHM->Create2<TH2D>("fh_points_xy_gamma_target", "fh_points_xy_gamma_target;X [cm];Y [cm];# MC points/PMT/ev.", - xPmtBins, yPmtBins); - fHM->Create2<TH2D>("fh_points_xy_gamma_nontarget", "fh_points_xy_gamma_nontarget;X [cm];Y [cm];# MC points/PMT/ev.", - xPmtBins, yPmtBins); - fHM->Create2<TH2D>("fh_skipped_pmt_10_xy", "fh_skipped_pmt_10_xy;X [cm];Y [cm];# skipped PMTs (>10 hits) [%]", - xPmtBins, yPmtBins); - fHM->Create2<TH2D>("fh_skipped_pmt_20_xy", "fh_skipped_pmt_20_xy;X [cm];Y [cm];# skipped PMTs (>20 hits) [%]", - xPmtBins, yPmtBins); - fHM->Create2<TH2D>("fh_skipped_pmt_30_xy", "fh_skipped_pmt_30_xy;X [cm];Y [cm];# skipped PMTs (>30 hits) [%]", - xPmtBins, yPmtBins); - - fHM->Create1<TH1D>("fh_nof_proj_per_event", "fh_nof_proj_per_event;# tracks/ev.;Yield", 50, 0, 1000); + + vector<string> pointXYTypes {"", "_pions", "_gamma_target", "_gamma_nontarget"}; + for (const string& t : pointXYTypes) { + fHM->Create2<TH2D>("fh_points_xy" + t, "fh_points_xy" + t + ";X [cm];Y [cm];# MC points/PMT/ev.", xPmtBins, + yPmtBins); + } + + vector<string> skippedPmtTypes {"10", "20", "30"}; + for (const string& t : skippedPmtTypes) { + fHM->Create2<TH2D>("fh_skipped_pmt_xy_" + t, + "fh_skipped_pmt_xy_" + t + ";X [cm];Y [cm];# skipped PMTs (>" + t + " hits) [%]", xPmtBins, + yPmtBins); + } + + fHM->Create1<TH1D>("fh_nof_proj_per_event", "fh_nof_proj_per_event;# tracks/ev.;Yield", 600, -.5, 599.5); fHM->Create2<TH2D>("fh_proj_xy", "fh_proj_xy;X [cm];Y [cm];# tracks/cm^{2}/ev.", 240, -120, 120, 420, -210, 210); } void CbmRichUrqmdTest::NofRings() { - Int_t fileId = 0; - Int_t nofRings = fRichRings->GetEntriesFast(); + int fileId = 0; + int nofRings = fRichRings->GetEntriesFast(); int nRings1hit = 0, nRings7hits = 0; int nRingsPrim1hit = 0, nRingsPrim7hits = 0; int nRingsTarget1hit = 0, nRingsTarget7hits = 0; - for (Int_t iR = 0; iR < nofRings; iR++) { + for (int iR = 0; iR < nofRings; iR++) { const CbmRichRing* ring = static_cast<CbmRichRing*>(fRichRings->At(iR)); - if (NULL == ring) continue; + if (ring == nullptr) continue; const CbmTrackMatchNew* ringMatch = static_cast<CbmTrackMatchNew*>(fRichRingMatches->At(iR)); - if (NULL == ringMatch) continue; + if (ringMatch == nullptr) continue; - Int_t mcEventId = ringMatch->GetMatchedLink().GetEntry(); - Int_t mcTrackId = ringMatch->GetMatchedLink().GetIndex(); + int mcEventId = ringMatch->GetMatchedLink().GetEntry(); + int mcTrackId = ringMatch->GetMatchedLink().GetIndex(); const CbmMCTrack* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, mcEventId, mcTrackId)); - if (NULL == mcTrack) continue; - Int_t motherId = mcTrack->GetMotherId(); - Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); - double mom = mcTrack->GetP(); + if (mcTrack == nullptr) continue; + int motherId = mcTrack->GetMotherId(); + int pdgAbs = std::abs(mcTrack->GetPdgCode()); + double mom = mcTrack->GetP(); TVector3 vert; mcTrack->GetStartVertex(vert); double dZ = vert.Z(); - if (motherId == -1 && pdg == 11) continue; // do not calculate embedded electrons + if (motherId == -1 && pdgAbs == 11) continue; // do not calculate embedded electrons int nofHits = ring->GetNofHits(); if (nofHits >= 1) nRings1hit++; @@ -189,19 +185,19 @@ void CbmRichUrqmdTest::NofRings() if (motherId != -1) { int motherPdg = -1; const CbmMCTrack* mother = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, mcEventId, motherId)); - if (NULL != mother) motherPdg = mother->GetPdgCode(); - if (motherId != -1 && pdg == 11 && motherPdg != 22) fHM->H1("fh_secel_mom")->Fill(mom); + if (mother != nullptr) motherPdg = mother->GetPdgCode(); + if (motherId != -1 && pdgAbs == 11 && motherPdg != 22) fHM->H1("fh_secel_mom")->Fill(mom); - if (motherId != -1 && pdg == 11 && motherPdg == 22) { + if (motherId != -1 && pdgAbs == 11 && motherPdg == 22) { if (dZ < 0.1) { fHM->H1("fh_gamma_target_mom")->Fill(mom); } else { fHM->H1("fh_gamma_nontarget_mom")->Fill(mom); } } } - if (pdg == 211) fHM->H1("fh_pi_mom")->Fill(mom); - if (pdg == 321) fHM->H1("fh_kaon_mom")->Fill(mom); - if (pdg == 13) fHM->H1("fh_mu_mom")->Fill(mom); + if (pdgAbs == 211) fHM->H1("fh_pi_mom")->Fill(mom); + if (pdgAbs == 321) fHM->H1("fh_kaon_mom")->Fill(mom); + if (pdgAbs == 13) fHM->H1("fh_mu_mom")->Fill(mom); } } fHM->H1("fh_nof_rings_1hit")->Fill(nRings1hit); @@ -218,107 +214,108 @@ void CbmRichUrqmdTest::NofHitsAndPoints() { int nofHits = fRichHits->GetEntriesFast(); fHM->H1("fh_nof_hits_per_event")->Fill(nofHits); - map<Int_t, Int_t> digisPerPmtMap; + map<int, int> digisPerPmtMap; for (int iH = 0; iH < nofHits; iH++) { - CbmRichHit* hit = static_cast<CbmRichHit*>(fRichHits->At(iH)); - if (nullptr == hit) continue; + const CbmRichHit* hit = static_cast<CbmRichHit*>(fRichHits->At(iH)); + if (hit == nullptr) continue; fHM->H2("fh_hits_xy")->Fill(hit->GetX(), hit->GetY()); fHM->H2("fh_hitrate_xy")->Fill(hit->GetX(), hit->GetY()); - Int_t digiInd = hit->GetRefId(); + int digiInd = hit->GetRefId(); const CbmRichDigi* richDigi = fDigiMan->Get<CbmRichDigi>(digiInd); - if (nullptr == richDigi) continue; + if (richDigi == nullptr) continue; CbmRichPixelData* pixelData = CbmRichDigiMapManager::GetInstance().GetPixelDataByAddress(richDigi->GetAddress()); - if (nullptr == pixelData) continue; - Int_t pmtId = pixelData->fPmtId; + if (pixelData == nullptr) continue; + int pmtId = pixelData->fPmtId; digisPerPmtMap[pmtId]++; } for (auto const& it : digisPerPmtMap) { - Int_t pmtId = it.first; - Int_t nofDigis = it.second; + int pmtId = it.first; + int nofDigis = it.second; CbmRichPmtData* pmtData = CbmRichDigiMapManager::GetInstance().GetPmtDataById(pmtId); TVector3 inPos(pmtData->fX, pmtData->fY, pmtData->fZ); TVector3 outPos; CbmRichGeoManager::GetInstance().RotatePoint(&inPos, &outPos); - if (nofDigis > 10) fHM->H2("fh_skipped_pmt_10_xy")->Fill(outPos.X(), outPos.Y()); - if (nofDigis > 20) fHM->H2("fh_skipped_pmt_20_xy")->Fill(outPos.X(), outPos.Y()); - if (nofDigis > 30) fHM->H2("fh_skipped_pmt_30_xy")->Fill(outPos.X(), outPos.Y()); + if (nofDigis > 10) fHM->H2("fh_skipped_pmt_xy_10")->Fill(outPos.X(), outPos.Y()); + if (nofDigis > 20) fHM->H2("fh_skipped_pmt_xy_20")->Fill(outPos.X(), outPos.Y()); + if (nofDigis > 30) fHM->H2("fh_skipped_pmt_xy_30")->Fill(outPos.X(), outPos.Y()); } - vector<Int_t> allPmtIds = CbmRichDigiMapManager::GetInstance().GetPmtIds(); - for (Int_t pmtId : allPmtIds) { + vector<int> allPmtIds = CbmRichDigiMapManager::GetInstance().GetPmtIds(); + for (int pmtId : allPmtIds) { fHM->H1("fh_nof_hits_per_pmt")->Fill(digisPerPmtMap[pmtId]); } - Int_t nofEvents = fEventList->GetNofEvents(); - for (Int_t iE = 0; iE < nofEvents; iE++) { - Int_t fileId = fEventList->GetFileIdByIndex(iE); - Int_t eventId = fEventList->GetEventIdByIndex(iE); + int nofEvents = fEventList->GetNofEvents(); + for (int iE = 0; iE < nofEvents; iE++) { + int fileId = fEventList->GetFileIdByIndex(iE); + int eventId = fEventList->GetEventIdByIndex(iE); int nofPoints = fRichPoints->Size(fileId, eventId); + fHM->H1("fh_nof_points_per_event")->Fill(nofPoints); for (int i = 0; i < nofPoints; i++) { const CbmRichPoint* point = static_cast<CbmRichPoint*>(fRichPoints->Get(fileId, eventId, i)); - if (NULL == point) continue; - fHM->H1("fh_nof_points_per_event")->Fill(1); + if (point == nullptr) continue; + fHM->H1("fh_nof_points_per_event_src")->Fill(1); - Int_t mcPhotonTrackId = point->GetTrackID(); + int mcPhotonTrackId = point->GetTrackID(); if (mcPhotonTrackId < 0) continue; const CbmMCTrack* mcPhotonTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, mcPhotonTrackId)); - if (NULL == mcPhotonTrack) continue; - Int_t motherPhotonId = mcPhotonTrack->GetMotherId(); + if (mcPhotonTrack == nullptr) continue; + int motherPhotonId = mcPhotonTrack->GetMotherId(); if (motherPhotonId < 0) continue; const CbmMCTrack* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, motherPhotonId)); - if (NULL == mcTrack) continue; - Int_t motherId = mcTrack->GetMotherId(); + if (mcTrack == nullptr) continue; + int motherId = mcTrack->GetMotherId(); - Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); + int pdgAbs = std::abs(mcTrack->GetPdgCode()); TVector3 vert; mcTrack->GetStartVertex(vert); double dZ = vert.Z(); - if (motherId == -1 && pdg == 11) continue; // do not calculate embedded electrons + if (motherId == -1 && pdgAbs == 11) continue; // do not calculate embedded electrons if (motherId != -1) { int motherPdg = -1; const CbmMCTrack* mother = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, motherId)); - if (NULL != mother) motherPdg = mother->GetPdgCode(); - if (motherId != -1 && pdg == 11 && motherPdg != 22) fHM->H1("fh_nof_points_per_event")->Fill(2); + if (mother != nullptr) motherPdg = mother->GetPdgCode(); + if (motherId != -1 && pdgAbs == 11 && motherPdg != 22) fHM->H1("fh_nof_points_per_event_src")->Fill(2); - if (motherId != -1 && pdg == 11 && motherPdg == 22) { - if (dZ < 0.1) { fHM->H1("fh_nof_points_per_event")->Fill(3); } + if (motherId != -1 && pdgAbs == 11 && motherPdg == 22) { + if (dZ < 0.1) { fHM->H1("fh_nof_points_per_event_src")->Fill(3); } else { - fHM->H1("fh_nof_points_per_event")->Fill(4); + fHM->H1("fh_nof_points_per_event_src")->Fill(4); } } } - if (pdg == 211) fHM->H1("fh_nof_points_per_event")->Fill(5); - if (pdg == 321) fHM->H1("fh_nof_points_per_event")->Fill(6); - if (pdg == 13) fHM->H1("fh_nof_points_per_event")->Fill(7); + if (pdgAbs == 211) fHM->H1("fh_nof_points_per_event_src")->Fill(5); + if (pdgAbs == 321) fHM->H1("fh_nof_points_per_event_src")->Fill(6); + if (pdgAbs == 13) fHM->H1("fh_nof_points_per_event_src")->Fill(7); } } } void CbmRichUrqmdTest::PmtXYSource() { - Int_t nofEvents = fEventList->GetNofEvents(); - for (Int_t iE = 0; iE < nofEvents; iE++) { - Int_t fileId = fEventList->GetFileIdByIndex(iE); - Int_t eventId = fEventList->GetEventIdByIndex(iE); + int nofEvents = fEventList->GetNofEvents(); + for (int iE = 0; iE < nofEvents; iE++) { + int fileId = fEventList->GetFileIdByIndex(iE); + int eventId = fEventList->GetEventIdByIndex(iE); int nofPoints = fRichPoints->Size(fileId, eventId); for (int i = 0; i < nofPoints; i++) { const CbmRichPoint* point = static_cast<CbmRichPoint*>(fRichPoints->Get(fileId, eventId, i)); - if (NULL == point) continue; + if (point == nullptr) continue; - Int_t iMCTrack = point->GetTrackID(); + int iMCTrack = point->GetTrackID(); const CbmMCTrack* track = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, iMCTrack)); - if (NULL == track) continue; + if (track == nullptr) continue; - Int_t iMother = track->GetMotherId(); + int iMother = track->GetMotherId(); if (iMother == -1) continue; const CbmMCTrack* track2 = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, iMother)); - if (NULL == track2) continue; - int pdg = TMath::Abs(track2->GetPdgCode()); + if (track2 == nullptr) continue; + int pdgAbs = std::abs(track2->GetPdgCode()); int motherId = track2->GetMotherId(); TVector3 inPos(point->GetX(), point->GetY(), point->GetZ()); TVector3 outPos; @@ -328,29 +325,29 @@ void CbmRichUrqmdTest::PmtXYSource() if (motherId != -1) { int motherPdg = -1; const CbmMCTrack* mother = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, motherId)); - if (NULL != mother) motherPdg = mother->GetPdgCode(); + if (mother != nullptr) motherPdg = mother->GetPdgCode(); TVector3 vert; track2->GetStartVertex(vert); - if (motherId != -1 && pdg == 11 && motherPdg == 22) { + if (motherId != -1 && pdgAbs == 11 && motherPdg == 22) { if (vert.Z() < 0.1) { fHM->H2("fh_points_xy_gamma_target")->Fill(outPos.X(), outPos.Y()); } else { fHM->H2("fh_points_xy_gamma_nontarget")->Fill(outPos.X(), outPos.Y()); } } } - if (pdg == 211) fHM->H2("fh_points_xy_pions")->Fill(outPos.X(), outPos.Y()); + if (pdgAbs == 211) fHM->H2("fh_points_xy_pions")->Fill(outPos.X(), outPos.Y()); } } } void CbmRichUrqmdTest::NofProjections() { - if (fRichProjections == NULL) return; + if (fRichProjections == nullptr) return; int nofProj = fRichProjections->GetEntriesFast(); int nofGoodProj = 0; for (int i = 0; i < nofProj; i++) { FairTrackParam* proj = (FairTrackParam*) fRichProjections->At(i); - if (NULL == proj) continue; + if (proj == nullptr) continue; fHM->H2("fh_proj_xy")->Fill(proj->GetX(), proj->GetY()); if (proj->GetX() != 0 && proj->GetY() != 0) nofGoodProj++; } @@ -359,15 +356,15 @@ void CbmRichUrqmdTest::NofProjections() void CbmRichUrqmdTest::Vertex() { - Int_t nofEvents = fEventList->GetNofEvents(); - for (Int_t iE = 0; iE < nofEvents; iE++) { - Int_t fileId = fEventList->GetFileIdByIndex(iE); - Int_t eventId = fEventList->GetEventIdByIndex(iE); + int nofEvents = fEventList->GetNofEvents(); + for (int iE = 0; iE < nofEvents; iE++) { + int fileId = fEventList->GetFileIdByIndex(iE); + int eventId = fEventList->GetEventIdByIndex(iE); int nMcTracks = fMcTracks->Size(fileId, eventId); for (int i = 0; i < nMcTracks; i++) { //At least one hit in RICH - pair<Int_t, Int_t> val = std::make_pair(eventId, i); + pair<int, int> val = std::make_pair(eventId, i); if (fNofHitsInRingMap[val] < 1) continue; const CbmMCTrack* mctrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, i)); TVector3 v; @@ -377,9 +374,9 @@ void CbmRichUrqmdTest::Vertex() fHM->H2("fh_vertex_xy")->Fill(v.X(), v.Y()); fHM->H2("fh_vertex_zy")->Fill(v.Z(), v.Y()); fHM->H2("fh_vertex_zx")->Fill(v.Z(), v.X()); - if (v.Z() >= 100 && v.Z() <= 180) fHM->H2("fh_vertex_xy_z100_180")->Fill(v.X(), v.Y()); - if (v.Z() >= 180 && v.Z() <= 370) fHM->H2("fh_vertex_xy_z180_370")->Fill(v.X(), v.Y()); - if (v.Z() >= 180 && v.Z() <= 230) fHM->H2("fh_vertex_xy_z180_230")->Fill(v.X(), v.Y()); + if (v.Z() >= 60 && v.Z() <= 140) fHM->H2("fh_vertex_xy_z60_140")->Fill(v.X(), v.Y()); + if (v.Z() >= 140 && v.Z() <= 330) fHM->H2("fh_vertex_xy_z140_330")->Fill(v.X(), v.Y()); + if (v.Z() >= 140 && v.Z() <= 190) fHM->H2("fh_vertex_xy_z140_190")->Fill(v.X(), v.Y()); for (auto pair : fVertexZStsSlices) { string name = "fh_vertex_xy_z" + to_string(pair.first) + "_" + to_string(pair.second); @@ -396,23 +393,23 @@ void CbmRichUrqmdTest::DrawHist() SetDefaultDrawStyle(); { - fHM->H1("fh_vertex_z")->Scale(1. / fEventNum); - fHM->CreateCanvas("rich_urqmd_vertex_z", "rich_urqmd_vertex_z", 800, 800); + fHM->Scale("fh_vertex_z", 1. / fEventNum); + fHM->CreateCanvas("richurqmd_vertex_z", "richurqmd_vertex_z", 1000, 1000); DrawH1(fHM->H1("fh_vertex_z"), kLinear, kLog, "hist"); } { - fHM->H1("fh_vertex_z_sts")->Scale(1. / fEventNum); - fHM->CreateCanvas("rich_urqmd_vertex_z_sts", "rich_urqmd_vertex_z_sts", 800, 800); + fHM->Scale("fh_vertex_z_sts", 1. / fEventNum); + fHM->CreateCanvas("richurqmd_vertex_z_sts", "richurqmd_vertex_z_sts", 1000, 1000); DrawH1(fHM->H1("fh_vertex_z_sts"), kLinear, kLog, "hist"); } { - fHM->H2("fh_vertex_xy")->Scale(1. / fEventNum); - fHM->H2("fh_vertex_zy")->Scale(1. / fEventNum); - fHM->H2("fh_vertex_zx")->Scale(1. / fEventNum); - TCanvas* c = fHM->CreateCanvas("rich_urqmd_vertex_xyz", "rich_urqmd_vertex_xyz", 1500, 500); + fHM->Scale("fh_vertex_xy", 1. / fEventNum); + fHM->Scale("fh_vertex_zy", 1. / fEventNum); + fHM->Scale("fh_vertex_zx", 1. / fEventNum); + TCanvas* c = fHM->CreateCanvas("richurqmd_vertex_xyz", "richurqmd_vertex_xyz", 1800, 600); c->Divide(3, 1); c->cd(1); DrawH2(fHM->H2("fh_vertex_xy"), kLinear, kLinear, kLog); @@ -425,12 +422,12 @@ void CbmRichUrqmdTest::DrawHist() { gStyle->SetOptTitle(1); - TCanvas* c = fHM->CreateCanvas("rich_urqmd_vertex_sts_xyz", "rich_urqmd_vertex_sts_xyz", 1600, 1200); + TCanvas* c = fHM->CreateCanvas("richurqmd_vertex_sts_xyz", "richurqmd_vertex_sts_xyz", 1600, 1200); c->Divide(4, 3); int i = 1; for (auto pair : fVertexZStsSlices) { string name = "fh_vertex_xy_z" + to_string(pair.first) + "_" + to_string(pair.second); - fHM->H2(name)->Scale(1. / fEventNum); + fHM->Scale(name, 1. / fEventNum); c->cd(i++); DrawH2(fHM->H2(name), kLinear, kLinear, kLog); DrawTextOnPad(to_string(pair.first) + " cm < Z < " + to_string(pair.second) + " cm", 0.3, 0.9, 0.7, 0.98); @@ -439,27 +436,17 @@ void CbmRichUrqmdTest::DrawHist() gStyle->SetOptTitle(0); } - { - fHM->H2("fh_vertex_xy_z100_180")->Scale(1. / fEventNum); - fHM->CreateCanvas("rich_urqmd_vertex_xy_z100_180", "rich_urqmd_vertex_xy_z100_180", 800, 800); - DrawH2(fHM->H2("fh_vertex_xy_z100_180")); - } - - { - fHM->H2("fh_vertex_xy_z180_370")->Scale(1. / fEventNum); - fHM->CreateCanvas("rich_urqmd_vertex_xy_z180_370", "rich_urqmd_vertex_xy_z180_370", 800, 800); - DrawH2(fHM->H2("fh_vertex_xy_z180_370")); - } - - { - fHM->H2("fh_vertex_xy_z180_230")->Scale(1. / fEventNum); - fHM->CreateCanvas("rich_urqmd_vertex_xy_z180_230", "rich_urqmd_vertex_xy_z180_230", 800, 800); - DrawH2(fHM->H2("fh_vertex_xy_z180_230")); + vector<string> vertexZTypes {"z60_140", "z140_330", "z140_190"}; + for (const string& t : vertexZTypes) { + string name = "richurqmd_vertex_xy_" + t; + fHM->Scale("fh_vertex_xy_" + t, 1. / fEventNum); + fHM->CreateCanvas(name, name, 1000, 1000); + DrawH2(fHM->H2("fh_vertex_xy_" + t)); } { - fHM->H1("fh_nof_points_per_event")->Scale(1. / fEventNum); - fHM->CreateCanvas("rich_urqmd_nof_points_per_event", "rich_urqmd_nof_points_per_event", 800, 800); + fHM->Scale("fh_nof_points_per_event_src", 1. / fEventNum); + fHM->CreateCanvas("richurqmd_nof_points_per_event_src", "richurqmd_nof_points_per_event_src", 1000, 1000); //gStyle->SetPaintTextFormat("4.1f"); string labels[7] = {"all", "e^{#pm}_{sec} other", @@ -468,55 +455,39 @@ void CbmRichUrqmdTest::DrawHist() "#pi^{#pm}", "K^{#pm}", "#mu^{#pm}"}; - for (Int_t i = 1; i <= 7; i++) { - fHM->H1("fh_nof_points_per_event")->GetXaxis()->SetBinLabel(i, labels[i - 1].c_str()); + for (int i = 1; i <= 7; i++) { + fHM->H1("fh_nof_points_per_event_src")->GetXaxis()->SetBinLabel(i, labels[i - 1].c_str()); } - fHM->H1("fh_nof_points_per_event")->GetXaxis()->SetLabelSize(0.05); - //fHM->H1("fh_nof_points_per_event")->SetMarkerSize(0.15); - DrawH1(fHM->H1("fh_nof_points_per_event"), kLinear, kLog, "hist text0"); - } - - { - fHM->CreateCanvas("rich_urqmd_nof_rings", "rich_urqmd_nof_rings", 800, 800); - fHM->H1("fh_nof_rings_1hit")->Scale(1. / fHM->H1("fh_nof_rings_1hit")->Integral()); - fHM->H1("fh_nof_rings_7hits")->Scale(1. / fHM->H1("fh_nof_rings_7hits")->Integral()); - stringstream ss1, ss2; - ss1 << "At least 1 hit detected (" << fHM->H1("fh_nof_rings_1hit")->GetMean() << ")"; - ss2 << "At least 7 hits detected (" << fHM->H1("fh_nof_rings_7hits")->GetMean() << ")"; - DrawH1({fHM->H1("fh_nof_rings_1hit"), fHM->H1("fh_nof_rings_7hits")}, {ss1.str(), ss2.str()}, kLinear, kLinear, - true, 0.3, 0.85, 0.99, 0.99, "hist"); - } - - { - fHM->CreateCanvas("rich_urqmd_nof_rings_prim", "rich_urqmd_nof_rings_prim", 800, 800); - fHM->H1("fh_nof_rings_prim_1hit")->Scale(1. / fHM->H1("fh_nof_rings_prim_1hit")->Integral()); - fHM->H1("fh_nof_rings_prim_7hits")->Scale(1. / fHM->H1("fh_nof_rings_prim_7hits")->Integral()); - stringstream ss1, ss2; - ss1 << "At least 1 hit detected (" << fHM->H1("fh_nof_rings_prim_1hit")->GetMean() << ")"; - ss2 << "At least 7 hits detected (" << fHM->H1("fh_nof_rings_prim_7hits")->GetMean() << ")"; - DrawH1({fHM->H1("fh_nof_rings_prim_1hit"), fHM->H1("fh_nof_rings_prim_7hits")}, {ss1.str(), ss2.str()}, kLinear, - kLinear, true, 0.3, 0.85, 0.99, 0.99, "hist"); + fHM->H1("fh_nof_points_per_event_src")->GetXaxis()->SetLabelSize(0.05); + //fHM->H1("fh_nof_points_per_event_src")->SetMarkerSize(0.15); + DrawH1(fHM->H1("fh_nof_points_per_event_src"), kLinear, kLog, "hist text0"); } { - fHM->CreateCanvas("rich_urqmd_nof_rings_target", "rich_urqmd_nof_rings_target", 800, 800); - fHM->H1("fh_nof_rings_target_1hit")->Scale(1. / fHM->H1("fh_nof_rings_target_1hit")->Integral()); - fHM->H1("fh_nof_rings_target_7hits")->Scale(1. / fHM->H1("fh_nof_rings_target_7hits")->Integral()); - stringstream ss1, ss2; - ss1 << "At least 1 hit detected (" << fHM->H1("fh_nof_rings_target_1hit")->GetMean() << ")"; - ss2 << "At least 7 hits detected (" << fHM->H1("fh_nof_rings_target_7hits")->GetMean() << ")"; - DrawH1({fHM->H1("fh_nof_rings_target_1hit"), fHM->H1("fh_nof_rings_target_7hits")}, {ss1.str(), ss2.str()}, kLinear, - kLinear, true, 0.3, 0.85, 0.99, 0.99, "hist"); + vector<string> nofRingsTypes {"", "_prim", "_target"}; + for (const string& t : nofRingsTypes) { + string cName = "richurqmd_nof_rings" + t; + string h1Name = "fh_nof_rings" + t + "_1hit"; + string h7Name = "fh_nof_rings" + t + "_7hits"; + fHM->CreateCanvas(cName, cName, 1000, 1000); + fHM->NormalizeToIntegral(h1Name); + fHM->NormalizeToIntegral(h7Name); + stringstream ss1, ss2; + ss1 << "At least 1 hit (" << fHM->H1(h1Name)->GetMean() << ")"; + ss2 << "At least 7 hits (" << fHM->H1(h7Name)->GetMean() << ")"; + DrawH1({fHM->H1(h1Name), fHM->H1(h7Name)}, {ss1.str(), ss2.str()}, kLinear, kLinear, true, 0.4, 0.85, 0.99, 0.99, + "hist"); + } } { - fHM->CreateCanvas("rich_urqmd_sources_mom", "rich_urqmd_sources_mom", 800, 800); - fHM->H1("fh_gamma_target_mom")->Scale(1. / fEventNum); - fHM->H1("fh_gamma_nontarget_mom")->Scale(1. / fEventNum); - fHM->H1("fh_secel_mom")->Scale(1. / fEventNum); - fHM->H1("fh_pi_mom")->Scale(1. / fEventNum); - fHM->H1("fh_kaon_mom")->Scale(1. / fEventNum); - fHM->H1("fh_mu_mom")->Scale(1. / fEventNum); + fHM->CreateCanvas("richurqmd_sources_mom", "richurqmd_sources_mom", 1000, 1000); + fHM->Scale("fh_gamma_target_mom", 1. / fEventNum); + fHM->Scale("fh_gamma_nontarget_mom", 1. / fEventNum); + fHM->Scale("fh_secel_mom", 1. / fEventNum); + fHM->Scale("fh_pi_mom", 1. / fEventNum); + fHM->Scale("fh_kaon_mom", 1. / fEventNum); + fHM->Scale("fh_mu_mom", 1. / fEventNum); stringstream ss1, ss2, ss3, ss4, ss5, ss6; ss1 << "e^{#pm}_{target} from #gamma (" << fHM->H1("fh_gamma_target_mom")->GetEntries() / fEventNum << ")"; ss2 << "e^{#pm}_{not target} from #gamma (" << fHM->H1("fh_gamma_nontarget_mom")->GetEntries() / fEventNum << ")"; @@ -524,101 +495,88 @@ void CbmRichUrqmdTest::DrawHist() ss4 << "#pi^{#pm} (" << fHM->H1("fh_pi_mom")->GetEntries() / fEventNum << ")"; ss5 << "K^{#pm} (" << fHM->H1("fh_kaon_mom")->GetEntries() / fEventNum << ")"; ss6 << "#mu^{#pm} (" << fHM->H1("fh_mu_mom")->GetEntries() / fEventNum << ")"; - DrawH1({fHM->H1("fh_gamma_target_mom"), fHM->H1("fh_gamma_nontarget_mom"), fHM->H1("fh_secel_mom"), - fHM->H1("fh_pi_mom"), fHM->H1("fh_kaon_mom"), fHM->H1("fh_mu_mom")}, + DrawH1(fHM->H1Vector({"fh_gamma_target_mom", "fh_gamma_nontarget_mom", "fh_secel_mom", "fh_pi_mom", "fh_kaon_mom", + "fh_mu_mom"}), {ss1.str(), ss2.str(), ss3.str(), ss4.str(), ss5.str(), ss6.str()}, kLinear, kLog, true, 0.5, 0.7, 0.99, 0.99, "hist"); } { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_hits_xy", "rich_urqmd_hits_xy", 800, 800); - TH2D* clone = (TH2D*) fHM->H2("fh_hits_xy")->Clone(); + TCanvas* c = fHM->CreateCanvas("richurqmd_hits_xy", "richurqmd_hits_xy", 1000, 1000); + TH2* clone = fHM->H2Clone("fh_hits_xy"); clone->Scale(1. / (fEventNum)); CbmRichDraw::DrawPmtH2(clone, c, true); } { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_occupancy_xy", "rich_urqmd_occupancy_xy", 800, 800); - TH2D* clone = (TH2D*) fHM->H2("fh_hits_xy")->Clone(); + TCanvas* c = fHM->CreateCanvas("richurqmd_occupancy_xy", "richurqmd_occupancy_xy", 1000, 1000); + TH2* clone = fHM->H2Clone("fh_hits_xy"); clone->GetZaxis()->SetTitle("Occupancy:# hits/PMT/ev./64 [%]"); clone->Scale(100. / (fEventNum * 64.)); CbmRichDraw::DrawPmtH2(clone, c, true); } { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_skipped_pmt_10_xy", "rich_urqmd_skipped_pmt_10_xy", 800, 800); - fHM->H2("fh_skipped_pmt_10_xy")->Scale(100. / (fEventNum)); - CbmRichDraw::DrawPmtH2(fHM->H2("fh_skipped_pmt_10_xy"), c, true); - } - - { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_skipped_pmt_20_xy", "rich_urqmd_skipped_pmt_20_xy", 800, 800); - fHM->H2("fh_skipped_pmt_20_xy")->Scale(100. / (fEventNum)); - CbmRichDraw::DrawPmtH2(fHM->H2("fh_skipped_pmt_20_xy"), c, true); - } - - { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_skipped_pmt_30_xy", "rich_urqmd_skipped_pmt_30_xy", 800, 800); - fHM->H2("fh_skipped_pmt_30_xy")->Scale(100. / (fEventNum)); - CbmRichDraw::DrawPmtH2(fHM->H2("fh_skipped_pmt_30_xy"), c, true); + vector<string> skippedPmtTypes {"10", "20", "30"}; + for (const string& t : skippedPmtTypes) { + string name = "richurqmd_skipped_pmt_xy_" + t; + TCanvas* c = fHM->CreateCanvas(name, name, 1000, 1000); + fHM->Scale("fh_skipped_pmt_xy_" + t, 100. / fEventNum); + CbmRichDraw::DrawPmtH2(fHM->H2("fh_skipped_pmt_xy_" + t), c, true); + } } { - fHM->CreateCanvas("rich_urqmd_nof_hits_per_pmt", "rich_urqmd_nof_hits_per_pmt", 800, 800); - fHM->H1("fh_nof_hits_per_pmt")->Scale(100. / fHM->H1("fh_nof_hits_per_pmt")->Integral()); + fHM->CreateCanvas("richurqmd_nof_hits_per_pmt", "richurqmd_nof_hits_per_pmt", 1000, 1000); + fHM->NormalizeToIntegral("fh_nof_hits_per_pmt"); DrawH1(fHM->H1("fh_nof_hits_per_pmt"), kLinear, kLog, "hist"); + fHM->H1("fh_nof_hits_per_pmt")->SetStats(true); } { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_points_xy", "rich_urqmd_points_xy", 800, 800); - fHM->H2("fh_points_xy")->Scale(1. / fEventNum); - CbmRichDraw::DrawPmtH2(fHM->H2("fh_points_xy"), c, true); - } - - { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_points_xy_pions", "rich_urqmd_points_xy_pions", 800, 800); - fHM->H2("fh_points_xy_pions")->Scale(1. / fEventNum); - CbmRichDraw::DrawPmtH2(fHM->H2("fh_points_xy_pions"), c, true); - } - - { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_points_xy_gamma_target", "rich_urqmd_points_xy_gamma_target", 800, 800); - fHM->H2("fh_points_xy_gamma_target")->Scale(1. / fEventNum); - CbmRichDraw::DrawPmtH2(fHM->H2("fh_points_xy_gamma_target"), c, true); - } - - { - TCanvas* c = - fHM->CreateCanvas("rich_urqmd_points_xy_gamma_nontarget", "rich_urqmd_points_xy_gamma_nontarget", 800, 800); - fHM->H2("fh_points_xy_gamma_nontarget")->Scale(1. / fEventNum); - CbmRichDraw::DrawPmtH2(fHM->H2("fh_points_xy_gamma_nontarget"), c, true); + vector<string> pointXYTypes {"", "_pions", "_gamma_target", "_gamma_nontarget"}; + for (const string& t : pointXYTypes) { + string name = "richurqmd_points_xy" + t; + TCanvas* c = fHM->CreateCanvas(name, name, 1000, 1000); + fHM->Scale("fh_points_xy" + t, 1. / fEventNum); + CbmRichDraw::DrawPmtH2(fHM->H2("fh_points_xy" + t), c, true); + } } { - fHM->CreateCanvas("rich_urqmd_nof_hits_per_event", "rich_urqmd_nof_hits_per_event", 800, 800); - fHM->H1("fh_nof_hits_per_event")->Scale(1. / fHM->H1("fh_nof_hits_per_event")->Integral()); + fHM->CreateCanvas("richurqmd_nof_hits_per_event", "richurqmd_nof_hits_per_event", 1000, 1000); + fHM->NormalizeToIntegral("fh_nof_hits_per_event"); DrawH1(fHM->H1("fh_nof_hits_per_event"), kLinear, kLinear, "hist"); fHM->H1("fh_nof_hits_per_event")->SetStats(true); cout << "Mean number of hits per event = " << fHM->H1("fh_nof_hits_per_event")->GetMean() << endl; } { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_hitrate_xy", "rich_urqmd_hitrate_xy", 800, 800); - fHM->H2("fh_hitrate_xy")->Scale(1e7 / (fEventNum * 64.)); + fHM->CreateCanvas("richurqmd_nof_points_per_event", "richurqmd_nof_points_per_event", 1000, 1000); + fHM->NormalizeToIntegral("fh_nof_points_per_event"); + DrawH1(fHM->H1("fh_nof_points_per_event"), kLinear, kLinear, "hist"); + fHM->H1("fh_nof_points_per_event")->SetStats(true); + cout << "Mean number of points per event = " << fHM->H1("fh_nof_points_per_event")->GetMean() << endl; + } + + { + TCanvas* c = fHM->CreateCanvas("richurqmd_hitrate_xy", "richurqmd_hitrate_xy", 1000, 1000); + fHM->Scale("fh_hitrate_xy", 1e7 / (fEventNum * 64.)); CbmRichDraw::DrawPmtH2(fHM->H2("fh_hitrate_xy"), c, true); //DrawH2(fHM->H2("fh_hitrate_xy")); } { - TCanvas* c = fHM->CreateCanvas("rich_urqmd_proj_xy", "rich_urqmd_proj_xy", 800, 800); - fHM->H2("fh_proj_xy")->Scale(1. / fEventNum); + TCanvas* c = fHM->CreateCanvas("richurqmd_proj_xy", "richurqmd_proj_xy", 1000, 1000); + fHM->Scale("fh_proj_xy", 1. / fEventNum); CbmRichDraw::DrawPmtH2(fHM->H2("fh_proj_xy"), c); } { - fHM->CreateCanvas("rich_urqmd_nof_proj_per_event", "rich_urqmd_nof_proj_per_event", 800, 800); - fHM->H1("fh_nof_proj_per_event")->Scale(1. / fEventNum); - DrawH1andFitGauss(fHM->H1("fh_nof_proj_per_event")); + fHM->CreateCanvas("richurqmd_nof_proj_per_event", "richurqmd_nof_proj_per_event", 1000, 1000); + fHM->Scale("fh_nof_proj_per_event", 1. / fEventNum); + DrawH1(fHM->H1("fh_nof_proj_per_event"), kLinear, kLinear, "hist"); + fHM->H1("fh_nof_proj_per_event")->SetStats(true); cout << "Number of track projections per event = " << fHM->H1("fh_nof_proj_per_event")->GetMean() << endl; } } @@ -629,7 +587,7 @@ void CbmRichUrqmdTest::Finish() fHM->SaveCanvasToImage(fOutputDir); TDirectory* oldir = gDirectory; TFile* outFile = FairRootManager::Instance()->GetOutFile(); - if (outFile != NULL) { + if (outFile != nullptr) { outFile->cd(); fHM->WriteToFile(); } diff --git a/reco/detectors/rich/qa/CbmRichUrqmdTest.h b/reco/detectors/rich/qa/CbmRichUrqmdTest.h index 26f5b142ff0d6637f0ead922639b85e88c89d8df..61332bfa80479ab56e7eb1f0cd3f98d9d4e06b04 100644 --- a/reco/detectors/rich/qa/CbmRichUrqmdTest.h +++ b/reco/detectors/rich/qa/CbmRichUrqmdTest.h @@ -68,10 +68,10 @@ private: CbmDigiManager* fDigiMan = nullptr; CbmMCEventList* fEventList = nullptr; - Int_t fEventNum = 0; - Int_t fMinNofHits = 7; // Min number of hits in ring for detector acceptance calculation. + int fEventNum = 0; + int fMinNofHits = 7; // Min number of hits in ring for detector acceptance calculation. - std::map<std::pair<Int_t, Int_t>, Int_t> fNofHitsInRingMap; // Number of hits in the MC RICH ring + std::map<std::pair<int, int>, int> fNofHitsInRingMap; // Number of hits in the MC RICH ring std::vector<std::pair<int, int>> fVertexZStsSlices; // Slices (Zmin - Zmax) inside STS diff --git a/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx b/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx index 384abe0583c5100eda4ac709b2bf89ef17d87e3b..16c747a8192269b29381f969a2ecad673386a677 100644 --- a/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx +++ b/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx @@ -89,7 +89,7 @@ void CbmLitTofQa::Exec(Option_t* /*opt*/) nofEvents++; std::cout << "CbmLitTofQa::Exec: event=" << nofEvents << std::endl; ProcessMC(nofEvents - 1); - ProcessGlobalTracks(); + //ProcessGlobalTracks(); ProcessTofHits(); ProcessTofTracks(); } @@ -198,6 +198,11 @@ void CbmLitTofQa::CreateHistograms() fHM->Add(name, new TH1F(name.c_str(), string(name + ";Number of tracks;Counter").c_str(), 100, 0., 100.)); name = "hmp_Tof_Time_FirstTrack"; fHM->Add(name, new TH1F(name.c_str(), string(name + ";Time [ns];Counter").c_str(), 2000, 0., 36.)); + + name = "hmp_Tof_Z"; + fHM->Add(name, new TH1F(name.c_str(), string(name + ";Z [cm];Counter").c_str(), 200, 650, 900)); + name = "hmp_TofTrack_Z"; + fHM->Add(name, new TH1F(name.c_str(), string(name + ";Z [cm];Counter").c_str(), 200, 650, 900)); } void CbmLitTofQa::ProcessMC(Int_t iEvent) @@ -208,7 +213,7 @@ void CbmLitTofQa::ProcessMC(Int_t iEvent) Int_t nofHits = fTofHits->GetEntriesFast(); for (Int_t iHit = 0; iHit < nofHits; iHit++) { //const CbmTofHit* tofHit = static_cast<const CbmTofHit*>(fTofHits->At(iHit)); - CbmMatch* tofHitMatch = static_cast<CbmMatch*>(fTofHitsMatches->At(iHit)); + CbmMatch* tofHitMatch = static_cast<CbmMatch*>(fTofHitsMatches->At(iHit)); if (tofHitMatch == NULL) { continue; } Int_t tofPointIndex = tofHitMatch->GetMatchedLink().GetIndex(); Int_t tofPointEventNo = tofHitMatch->GetMatchedLink().GetEntry(); @@ -263,7 +268,7 @@ void CbmLitTofQa::ProcessGlobalTracks() Double_t ctCorrection = 0.0; Double_t ctReco = 0.299792458 * tofHit->GetTime() + ctCorrection; // ToF time in ns -> transfrom to ct in m //Double_t ctMC = 0.299792458 * tofPoint->GetTime(); // mc time in ns -> transfrom to ct in m - Double_t trackLengthReco = globalTrack->GetLength() / 100.; //global length + Double_t trackLengthReco = globalTrack->GetLength() / 100.; //global length // Double_t trackLengthMC = tofPoint->GetLength() / 100.; //mc length Double_t preco = (vtxTrack.GetQp() != 0) ? std::abs(1. / vtxTrack.GetQp()) : 0; Double_t t = (trackLengthReco != 0) ? (ctReco / trackLengthReco) : 0; @@ -325,6 +330,7 @@ void CbmLitTofQa::ProcessTofHits() //Int_t tofMCTrackId = tofPoint->GetTrackID(); fHM->H1("hmp_Tof_dTime")->Fill(1000 * (tofPoint->GetTime() - tofHit->GetTime())); + fHM->H1("hmp_Tof_Z")->Fill(tofHit->GetZ()); } } @@ -352,6 +358,8 @@ void CbmLitTofQa::ProcessTofTracks() Double_t dy = par->GetY() - tofHit->GetY(); Double_t distance = sqrt(dx * dx + dy * dy); + fHM->H1("hmp_TofTrack_Z")->Fill(tofHit->GetZ()); + Int_t nofTrackCategories = fTrackCategories.size(); for (Int_t iCat = 0; iCat < nofTrackCategories; iCat++) { string category = fTrackCategories[iCat]; diff --git a/reco/littrack/cbm/qa/tof/CbmLitTofQaReport.cxx b/reco/littrack/cbm/qa/tof/CbmLitTofQaReport.cxx index b935275e1e41cd0fe89a8d50160b1026af6158b8..233884691fb3794cb8bae27ce04c5203b0051c5b 100644 --- a/reco/littrack/cbm/qa/tof/CbmLitTofQaReport.cxx +++ b/reco/littrack/cbm/qa/tof/CbmLitTofQaReport.cxx @@ -65,6 +65,11 @@ void CbmLitTofQaReport::Draw() DrawH1ByPattern("hmp_TofTrack_All_.+"); + DrawH1ByPattern("hmp_TofTrack_Z"); + gPad->SetLogy(true); + DrawH1ByPattern("hmp_Tof_Z"); + gPad->SetLogy(true); + FitHistograms(); } diff --git a/sim/detectors/rich/CbmRichDigitizer.cxx b/sim/detectors/rich/CbmRichDigitizer.cxx index a10b086ba34711a28e5dbb54eb59ba49807912bb..05be1505ea9b290045446944cdea6090b3f50af5 100644 --- a/sim/detectors/rich/CbmRichDigitizer.cxx +++ b/sim/detectors/rich/CbmRichDigitizer.cxx @@ -186,6 +186,7 @@ void CbmRichDigitizer::ProcessPoint(CbmRichPoint* point, Int_t pointId, Int_t ev Int_t address = CbmRichDigiMapManager::GetInstance().GetPixelAddressByPath(path); Int_t trackId = point->GetTrackID(); + //LOG(info) << "address:" << address << " path:" << path << " trackId:" << trackId << "X:" << point->GetX() << " Y:" << point->GetY() << " Z:" << zNew; if (trackId < 0) return; CbmMCTrack* p = (CbmMCTrack*) fMcTracks->At(trackId); if (p == NULL) return;