|
@@ -2,36 +2,40 @@
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
|
|
#include <TString.h>
|
|
#include <TString.h>
|
|
|
|
+#include <TH1D.h>
|
|
|
|
+#include <TH1I.h>
|
|
|
|
+#include <TH2D.h>
|
|
|
|
+#include <TProfile.h>
|
|
|
|
+#include <TProfile3D.h>
|
|
#include <TFile.h>
|
|
#include <TFile.h>
|
|
#include <TStopwatch.h>
|
|
#include <TStopwatch.h>
|
|
|
|
|
|
-#include <mciParticle.h>
|
|
|
|
-#include <mciEvent.h>
|
|
|
|
-#include <mciReader_manager.h>
|
|
|
|
-#include <mciReader_smash_root.h>
|
|
|
|
-#include <mciReader_mcpico.h>
|
|
|
|
-#include <mciWriter_manager.h>
|
|
|
|
-#include <mciWriter_mcpico.h>
|
|
|
|
|
|
+#include <qaParticle.h>
|
|
|
|
+#include <qaParticleLight.h>
|
|
|
|
+#include <qaEvent.h>
|
|
|
|
+#include <qaReader_manager.h>
|
|
|
|
+#include <qaReader_smash_root.h>
|
|
|
|
+#include <qaReader_mcpico.h>
|
|
#include <Utility.h>
|
|
#include <Utility.h>
|
|
|
|
|
|
#ifdef _MCINI_
|
|
#ifdef _MCINI_
|
|
-#include <mciReader_mcini.h>
|
|
|
|
|
|
+#include <qaReader_mcini.h>
|
|
#endif
|
|
#endif
|
|
#ifdef _PHQMD_
|
|
#ifdef _PHQMD_
|
|
-#include <mciReader_phqmd.h>
|
|
|
|
|
|
+#include <qaReader_phqmd.h>
|
|
#endif
|
|
#endif
|
|
#ifdef _HSD_ROOT_
|
|
#ifdef _HSD_ROOT_
|
|
-#include <mciReader_hsd_root.h>
|
|
|
|
|
|
+#include <qaReader_hsd_root.h>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
int main(int argc, char **argv)
|
|
{
|
|
{
|
|
- TString iFileName, oFileName;
|
|
|
|
-
|
|
|
|
- if (argc < 9)
|
|
|
|
|
|
+ TString iFileName, oFileName, configFileName = "";
|
|
|
|
+
|
|
|
|
+ if (argc < 7)
|
|
{
|
|
{
|
|
- std::cerr << "./ModelConverter -i input.list -o output.root -input-format [FORMAT] -output-format [FORMAT] [OPTIONAL: -debug]" << std::endl;
|
|
|
|
- std::cerr << "Available input formats:" << std::endl;
|
|
|
|
|
|
+ std::cerr << "./mConvert -i input.list -o qa_output.root -format [FORMAT] [OPTIONAL: -config qa.cfg]" << std::endl;
|
|
|
|
+ std::cerr << "Available formats:" << std::endl;
|
|
std::cerr << "\tmcpico - simple custom ROOT format to store model data." << std::endl;
|
|
std::cerr << "\tmcpico - simple custom ROOT format to store model data." << std::endl;
|
|
std::cerr << "\tparticle - ROOT format that is used by the SMASH model." << std::endl;
|
|
std::cerr << "\tparticle - ROOT format that is used by the SMASH model." << std::endl;
|
|
#ifdef _MCINI_
|
|
#ifdef _MCINI_
|
|
@@ -43,17 +47,14 @@ int main(int argc, char **argv)
|
|
#ifdef _HSD_ROOT_
|
|
#ifdef _HSD_ROOT_
|
|
std::cerr << "\thsd - custom ROOT format to store HSD model data." << std::endl;
|
|
std::cerr << "\thsd - custom ROOT format to store HSD model data." << std::endl;
|
|
#endif
|
|
#endif
|
|
- std::cerr << "Available output formats:" << std::endl;
|
|
|
|
- std::cerr << "\tmcpico - simple custom ROOT format to store model data." << std::endl;
|
|
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
for (int i = 1; i < argc; i++)
|
|
for (int i = 1; i < argc; i++)
|
|
{
|
|
{
|
|
if (std::string(argv[i]) != "-i" &&
|
|
if (std::string(argv[i]) != "-i" &&
|
|
std::string(argv[i]) != "-o" &&
|
|
std::string(argv[i]) != "-o" &&
|
|
- std::string(argv[i]) != "-input-format" &&
|
|
|
|
- std::string(argv[i]) != "-output-format" &&
|
|
|
|
- std::string(argv[i]) != "-debug")
|
|
|
|
|
|
+ std::string(argv[i]) != "-format" &&
|
|
|
|
+ std::string(argv[i]) != "-config")
|
|
{
|
|
{
|
|
std::cerr << "\n[ERROR]: Unknown parameter " << i << ": " << argv[i] << std::endl;
|
|
std::cerr << "\n[ERROR]: Unknown parameter " << i << ": " << argv[i] << std::endl;
|
|
return 2;
|
|
return 2;
|
|
@@ -80,72 +81,106 @@ int main(int argc, char **argv)
|
|
std::cerr << "\n[ERROR]: Output file name was not specified " << std::endl;
|
|
std::cerr << "\n[ERROR]: Output file name was not specified " << std::endl;
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
- if (std::string(argv[i]) == "-input-format" && i != argc - 1)
|
|
|
|
|
|
+ if (std::string(argv[i]) == "-format" && i != argc - 1)
|
|
{
|
|
{
|
|
- mciUtility::GetInstance()->input_format = argv[++i];
|
|
|
|
|
|
+ qaUtility::GetInstance()->format = argv[++i];
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- if (std::string(argv[i]) == "-input-format" && i == argc - 1)
|
|
|
|
|
|
+ if (std::string(argv[i]) == "-format" && i == argc - 1)
|
|
{
|
|
{
|
|
std::cerr << "\n[ERROR]: Output file name was not specified " << std::endl;
|
|
std::cerr << "\n[ERROR]: Output file name was not specified " << std::endl;
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
- if (std::string(argv[i]) == "-output-format" && i != argc - 1)
|
|
|
|
|
|
+ if (std::string(argv[i]) == "-config" && i != argc - 1)
|
|
{
|
|
{
|
|
- mciUtility::GetInstance()->output_format = argv[++i];
|
|
|
|
|
|
+ configFileName = argv[++i];
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- if (std::string(argv[i]) == "-output-format" && i == argc - 1)
|
|
|
|
|
|
+ if (std::string(argv[i]) == "-config" && i == argc - 1)
|
|
{
|
|
{
|
|
std::cerr << "\n[ERROR]: Output file name was not specified " << std::endl;
|
|
std::cerr << "\n[ERROR]: Output file name was not specified " << std::endl;
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
- if (std::string(argv[i]) == "-debug")
|
|
|
|
- {
|
|
|
|
- mciUtility::GetInstance()->debug = 1;
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
TStopwatch timer;
|
|
TStopwatch timer;
|
|
timer.Start();
|
|
timer.Start();
|
|
-
|
|
|
|
- if (mciUtility::GetInstance()->debug)
|
|
|
|
|
|
+
|
|
|
|
+ Bool_t IsRead = true;
|
|
|
|
+
|
|
|
|
+ if (configFileName.Length() > 0)
|
|
{
|
|
{
|
|
- std::cout << "Input format = " << mciUtility::GetInstance()->input_format << std::endl;
|
|
|
|
- std::cout << "Output format = " << mciUtility::GetInstance()->output_format << std::endl;
|
|
|
|
- std::cout << "debug = " << mciUtility::GetInstance()->debug << std::endl;
|
|
|
|
- std::cout << "Nevents = " << mciUtility::GetInstance()->Nevents << std::endl;
|
|
|
|
- std::cout << std::endl;
|
|
|
|
|
|
+ IsRead = qaUtility::GetInstance()->ReadConfig(configFileName);
|
|
}
|
|
}
|
|
|
|
|
|
- mciReader_manager *readerManager = nullptr;
|
|
|
|
- if (mciUtility::GetInstance()->input_format == "mcpico")
|
|
|
|
|
|
+ if (!IsRead)
|
|
{
|
|
{
|
|
- readerManager = new mciReader_mcpico();
|
|
|
|
|
|
+ std::cerr << "Error while reading config file. Exiting..." << std::endl;
|
|
|
|
+ return 2;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ TFile *fo = new TFile(oFileName, "recreate");
|
|
|
|
+
|
|
|
|
+ const int ntracks_max = 15000;
|
|
|
|
+
|
|
|
|
+ Float_t d_bimp;
|
|
|
|
+ Float_t d_phi2;
|
|
|
|
+ Float_t d_phi3;
|
|
|
|
+ Float_t d_ecc2;
|
|
|
|
+ Float_t d_ecc3;
|
|
|
|
+ Int_t d_npart;
|
|
|
|
+ Int_t d_nh;
|
|
|
|
+ Float_t d_momx[ntracks_max]; //[nh]
|
|
|
|
+ Float_t d_momy[ntracks_max]; //[nh]
|
|
|
|
+ Float_t d_momz[ntracks_max]; //[nh]
|
|
|
|
+ Float_t d_ene[ntracks_max]; //[nh]
|
|
|
|
+ Int_t d_hid[ntracks_max]; //[nh]
|
|
|
|
+ Int_t d_pdg[ntracks_max]; //[nh]
|
|
|
|
+ Short_t d_charge[ntracks_max]; //[nh]
|
|
|
|
+
|
|
|
|
+ TTree *oTree = new TTree("mctree","mcpico format");
|
|
|
|
+ oTree->Branch("bimp",&d_bimp,"bimp/F"); // impact parametr
|
|
|
|
+ oTree->Branch("phi2",&d_phi2,"phi2/F"); // phiRP2
|
|
|
|
+ oTree->Branch("phi3",&d_phi3,"phi3/F"); // phiRP3
|
|
|
|
+ oTree->Branch("ecc2",&d_ecc2,"ecc2/F"); // eccentricity2
|
|
|
|
+ oTree->Branch("ecc3",&d_ecc3,"ecc3/F"); // eccentricity3
|
|
|
|
+ oTree->Branch("npart",&d_npart,"npart/I"); // number of participants
|
|
|
|
+ oTree->Branch("nh",&d_nh,"nh/I"); // number of particles
|
|
|
|
+ oTree->Branch("momx",&d_momx,"momx[nh]/F");
|
|
|
|
+ oTree->Branch("momy",&d_momy,"momy[nh]/F");
|
|
|
|
+ oTree->Branch("momz",&d_momz,"momz[nh]/F");
|
|
|
|
+ oTree->Branch("ene",&d_ene,"ene[nh]/F");//[energy]
|
|
|
|
+ oTree->Branch("hid",&d_hid,"hid[nh]/I");//[histrory id]
|
|
|
|
+ oTree->Branch("pdg",&d_pdg,"pdg[nh]/I");//[particle data group code]
|
|
|
|
+ oTree->Branch("charge",&d_charge,"charge[nh]/S");//[electric charge]
|
|
|
|
+
|
|
|
|
+ qaReader_manager *readerManager;
|
|
|
|
+ if (qaUtility::GetInstance()->format == "mcpico")
|
|
|
|
+ {
|
|
|
|
+ readerManager = new qaReader_mcpico();
|
|
}
|
|
}
|
|
#ifdef _MCINI_
|
|
#ifdef _MCINI_
|
|
- if (mciUtility::GetInstance()->input_format == "mcini")
|
|
|
|
|
|
+ if (qaUtility::GetInstance()->format == "mcini")
|
|
{
|
|
{
|
|
- readerManager = new mciReader_mcini();
|
|
|
|
|
|
+ readerManager = new qaReader_mcini();
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
#ifdef _PHQMD_
|
|
#ifdef _PHQMD_
|
|
- if (mciUtility::GetInstance()->input_format == "phqmd")
|
|
|
|
|
|
+ if (qaUtility::GetInstance()->format == "phqmd")
|
|
{
|
|
{
|
|
- readerManager = new mciReader_phqmd();
|
|
|
|
|
|
+ readerManager = new qaReader_phqmd();
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
#ifdef _HSD_ROOT_
|
|
#ifdef _HSD_ROOT_
|
|
- if (mciUtility::GetInstance()->input_format == "hsd")
|
|
|
|
|
|
+ if (qaUtility::GetInstance()->format == "hsd")
|
|
{
|
|
{
|
|
- readerManager = new mciReader_hsd_root();
|
|
|
|
|
|
+ readerManager = new qaReader_hsd_root();
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
- if (mciUtility::GetInstance()->input_format == "particles")
|
|
|
|
|
|
+ if (qaUtility::GetInstance()->format == "particles")
|
|
{
|
|
{
|
|
- readerManager = new mciReader_smash_root();
|
|
|
|
|
|
+ readerManager = new qaReader_smash_root();
|
|
}
|
|
}
|
|
|
|
|
|
if (!readerManager)
|
|
if (!readerManager)
|
|
@@ -157,54 +192,81 @@ int main(int argc, char **argv)
|
|
readerManager->SetChain(iFileName.Data());
|
|
readerManager->SetChain(iFileName.Data());
|
|
|
|
|
|
Long64_t Nentries_chain = readerManager->GetEntries();
|
|
Long64_t Nentries_chain = readerManager->GetEntries();
|
|
- Long64_t Nentries = (mciUtility::GetInstance()->Nevents > Nentries_chain) ? Nentries_chain : mciUtility::GetInstance()->Nevents;
|
|
|
|
- if (mciUtility::GetInstance()->Nevents == -1)
|
|
|
|
|
|
+ Long64_t Nentries = (qaUtility::GetInstance()->Nevents > Nentries_chain) ? Nentries_chain : qaUtility::GetInstance()->Nevents;
|
|
|
|
+ if (qaUtility::GetInstance()->Nevents == -1)
|
|
Nentries = Nentries_chain;
|
|
Nentries = Nentries_chain;
|
|
Int_t Nparticles;
|
|
Int_t Nparticles;
|
|
|
|
|
|
- mciWriter_manager *writerManager = nullptr;
|
|
|
|
- if (mciUtility::GetInstance()->output_format == "mcpico")
|
|
|
|
- {
|
|
|
|
- writerManager = new mciWriter_mcpico();
|
|
|
|
- }
|
|
|
|
- if (!writerManager)
|
|
|
|
|
|
+ qaEvent *event = nullptr;
|
|
|
|
+ qaParticle *particle = nullptr;
|
|
|
|
+
|
|
|
|
+ Long64_t Absolute_counter = 0;
|
|
|
|
+ Long64_t Minbias_counter = 0;
|
|
|
|
+
|
|
|
|
+ while (Minbias_counter < Nentries)
|
|
{
|
|
{
|
|
- std::cerr << "This output format is not found!" << std::endl;
|
|
|
|
- return 30;
|
|
|
|
- }
|
|
|
|
|
|
+ //if (Minbias_counter % 1000 == 0)
|
|
|
|
+ std::cout << "Event [" << Minbias_counter << "/" << Nentries << "]" << std::endl;
|
|
|
|
|
|
- writerManager->SetFile(oFileName.Data());
|
|
|
|
|
|
+ event = (qaEvent *)readerManager->ReadEvent(Absolute_counter);
|
|
|
|
+ Absolute_counter++;
|
|
|
|
|
|
- mciEvent *event = nullptr;
|
|
|
|
- mciParticle *particle = nullptr;
|
|
|
|
|
|
+ if (Absolute_counter > Nentries_chain)
|
|
|
|
+ break;
|
|
|
|
|
|
- for (Long64_t ievent=0; ievent<Nentries; ievent++)
|
|
|
|
- {
|
|
|
|
- std::cout << "Event [" << ievent << "/" << Nentries << "]" << std::endl;
|
|
|
|
-
|
|
|
|
- event = (mciEvent *)readerManager->ReadEvent(ievent);
|
|
|
|
- if (!event) continue;
|
|
|
|
|
|
+ if (!event)
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ Minbias_counter++;
|
|
|
|
|
|
- writerManager->SetEvent(event);
|
|
|
|
|
|
+ d_bimp = event->GetB();
|
|
|
|
+ d_phi2 = event->GetPhiRP();
|
|
|
|
+ d_nh = event->GetNparticles();
|
|
|
|
+ d_npart= 0;
|
|
|
|
+ d_ecc2 = 0.;
|
|
|
|
+ d_ecc3 = 0.;
|
|
|
|
|
|
Nparticles = event->GetNparticles();
|
|
Nparticles = event->GetNparticles();
|
|
for (int iparticle = 0; iparticle < Nparticles; iparticle++)
|
|
for (int iparticle = 0; iparticle < Nparticles; iparticle++)
|
|
{
|
|
{
|
|
- particle = (mciParticle*) readerManager->ReadParticle(iparticle);
|
|
|
|
- if (!particle) continue;
|
|
|
|
|
|
+ particle = readerManager->ReadParticle(iparticle);
|
|
|
|
|
|
- writerManager->SetParticle(particle, iparticle);
|
|
|
|
- }
|
|
|
|
|
|
+ if (!particle)
|
|
|
|
+ {
|
|
|
|
+ particle = new qaParticle();
|
|
|
|
+ particle->SetPx(qaUtility::GetInstance()->error_code);
|
|
|
|
+ particle->SetPy(qaUtility::GetInstance()->error_code);
|
|
|
|
+ particle->SetPz(qaUtility::GetInstance()->error_code);
|
|
|
|
+ particle->SetX(qaUtility::GetInstance()->error_code);
|
|
|
|
+ particle->SetY(qaUtility::GetInstance()->error_code);
|
|
|
|
+ particle->SetZ(qaUtility::GetInstance()->error_code);
|
|
|
|
+ }
|
|
|
|
|
|
- writerManager->Fill();
|
|
|
|
|
|
+ d_momx[iparticle] = particle->GetPx();
|
|
|
|
+ d_momy[iparticle] = particle->GetPy();
|
|
|
|
+ d_momz[iparticle] = particle->GetPz();
|
|
|
|
+ d_ene[iparticle] = particle->GetEnergy();
|
|
|
|
+ d_pdg[iparticle] = particle->GetPdg();
|
|
|
|
+ d_hid[iparticle] = 0.;
|
|
|
|
+ d_charge[iparticle] = particle->GetCharge();
|
|
|
|
+
|
|
|
|
+ delete particle;
|
|
|
|
+ }
|
|
|
|
+ oTree->Fill();
|
|
|
|
+ delete event;
|
|
}
|
|
}
|
|
|
|
|
|
- writerManager->Write();
|
|
|
|
- writerManager->Close();
|
|
|
|
|
|
+ std::cout << "Loop is closed, " << Minbias_counter << " events were counted." << std::endl;
|
|
|
|
+
|
|
|
|
+ std::cout << "Writing output." << std::endl;
|
|
|
|
+
|
|
|
|
+ fo->cd();
|
|
|
|
+ oTree->Write();
|
|
|
|
+ oTree->Print();
|
|
|
|
+ fo->Close();
|
|
|
|
|
|
timer.Stop();
|
|
timer.Stop();
|
|
timer.Print();
|
|
timer.Print();
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
-
|
|
|
|
}
|
|
}
|