diff --git a/macro/beamtime/mcbm2020/mcbm_build_and_reco.C b/macro/beamtime/mcbm2020/mcbm_build_and_reco.C index 114865dfd963c85165a8600cddbe896824aed133..95f0b46f6c713e40cbfd06a049a1b40aacd5a9f1 100644 --- a/macro/beamtime/mcbm2020/mcbm_build_and_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_build_and_reco.C @@ -27,13 +27,21 @@ void mcbm_build_and_reco(UInt_t uRunId = 28, // ----- In- and output file names ------------------------------------ - TString inFile = Form("./data/unp_mcbm_%i.root", uRunId); - TString parFileIn = Form("./data/unp_mcbm_params_%i.root", uRunId); - TString geoFile = paramDir + "mcbm2020_reco.geo.root"; // Created in sim. run + TString inFile = Form("./data/unp_mcbm_%i.root", uRunId); + TString parFileIn = Form("./data/unp_mcbm_params_%i.root", uRunId); TString parFileOut = Form("./data/reco_mcbm_evt_win_params_%u.root", uRunId); TString outFile = Form("./data/reco_mcbm_evt_win_%u.root", uRunId); // ------------------------------------------------------------------------ + // --- Load the geometry setup ---- + // This is currently only required by the TRD (parameters) + std::string geoSetupTag = "mcbm_beam_2020_03"; + TString geoFile = + paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run + CbmSetup* geoSetup = CbmSetup::Instance(); + geoSetup->LoadSetup(geoSetupTag.data()); + TList* parFileList = new TList(); + // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; @@ -198,6 +206,29 @@ void mcbm_build_and_reco(UInt_t uRunId = 28, // ----- Local reconstruction in TRD ---------------------------------- + // Load parameters <- they are required by the hit producer. + // For now, it is enough to load the default ascii parameters + // if no root file is existing from the unpacking process. + TString geoTagTrd = ""; + bool isActiveTrd = + (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; + if (!isActiveTrd) { + LOG(warning) << Form( + "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " + "can not be loaded correctly!", + geoSetupTag.data()); + } else { + TString paramFilesTrd( + Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); + std::vector<std::string> paramFilesVecTrd; + CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); + for (auto parIt : paramFilesVecTrd) { + parFileList->Add( + new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); + } + } + // -- end trd parameters + // -- beginn trd reco Double_t triggerThreshold = 0.5e-6; // Default CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true, false); @@ -247,8 +278,10 @@ void mcbm_build_and_reco(UInt_t uRunId = 28, FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); FairParRootFileIo* parIo3 = new FairParRootFileIo(); parIo1->open(parFileIn.Data(), "READ"); - parIo3->open(parFileOut.Data(), "RECREATE"); rtdb->setFirstInput(parIo1); + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); + parIo3->open(parFileOut.Data(), "RECREATE"); // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C index 2e34db6e5608ce5ce0119adbb653eaa14eb65f86..f4d51087541a6f1dd88b87ea62ee41a5ab8f02a7 100644 --- a/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C @@ -64,11 +64,19 @@ void mcbm_build_and_reco_kronos(UInt_t uRunIdx = 28, // ----- In- and output file names ------------------------------------ - TString geoFile = paramDir + "mcbm2020_reco.geo.root"; // Created in sim. run TString parFileOut = Form("./data/reco_mcbm_evt_win_params_%u.root", uRunId); TString outFile = Form("./data/reco_mcbm_evt_win_%u.root", uRunId); // ------------------------------------------------------------------------ + // --- Load the geometry setup ---- + // This is currently only required by the TRD (parameters) + std::string geoSetupTag = "mcbm_beam_2020_03"; + TString geoFile = + paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run + CbmSetup* geoSetup = CbmSetup::Instance(); + geoSetup->LoadSetup(geoSetupTag.data()); + TList* parFileList = new TList(); + // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; @@ -233,6 +241,29 @@ void mcbm_build_and_reco_kronos(UInt_t uRunIdx = 28, // ----- Local reconstruction in TRD ---------------------------------- + // Load parameters <- they are required by the hit producer. + // For now, it is enough to load the default ascii parameters + // if no root file is existing from the unpacking process. + TString geoTagTrd = ""; + bool isActiveTrd = + (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; + if (!isActiveTrd) { + LOG(warning) << Form( + "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " + "can not be loaded correctly!", + geoSetupTag.data()); + } else { + TString paramFilesTrd( + Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); + std::vector<std::string> paramFilesVecTrd; + CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); + for (auto parIt : paramFilesVecTrd) { + parFileList->Add( + new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); + } + } + // -- end trd parameters + // -- beginn trd reco Double_t triggerThreshold = 0.5e-6; // Default CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true, false); @@ -282,8 +313,10 @@ void mcbm_build_and_reco_kronos(UInt_t uRunIdx = 28, FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); FairParRootFileIo* parIo3 = new FairParRootFileIo(); parIo1->open(parFileIn.Data(), "READ"); - parIo3->open(parFileOut.Data(), "RECREATE"); rtdb->setFirstInput(parIo1); + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); + parIo3->open(parFileOut.Data(), "RECREATE"); // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_event_reco.C b/macro/beamtime/mcbm2020/mcbm_event_reco.C index 372de87bbd9afd65b026f8f8e5201074108a34ed..ff8aa4d97f034eb1c416f19f4807427683abb5ed 100644 --- a/macro/beamtime/mcbm2020/mcbm_event_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_event_reco.C @@ -24,10 +24,18 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = 300) { // ----- In- and output file names ------------------------------------ TString inFile = Form("./data/unp_mcbm_%i.root", runId); TString parFile = Form("./data/unp_mcbm_params_%i.root", runId); - TString geoFile = paramDir + "mcbm2020_reco.geo.root"; // Created in sim. run TString outFile = Form("./data/reco_mcbm_%i.root", runId); // ------------------------------------------------------------------------ + // --- Load the geometry setup ---- + // This is currently only required by the TRD (parameters) + std::string geoSetupTag = "mcbm_beam_2020_03"; + TString geoFile = + paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run + CbmSetup* geoSetup = CbmSetup::Instance(); + geoSetup->LoadSetup(geoSetupTag.data()); + TList* parFileList = new TList(); + // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; @@ -130,6 +138,29 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = 300) { // ----- Local reconstruction in TRD ---------------------------------- + // Load parameters <- they are required by the hit producer. + // For now, it is enough to load the default ascii parameters + // if no root file is existing from the unpacking process. + TString geoTagTrd = ""; + bool isActiveTrd = + (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; + if (!isActiveTrd) { + LOG(warning) << Form( + "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " + "can not be loaded correctly!", + geoSetupTag.data()); + } else { + TString paramFilesTrd( + Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); + std::vector<std::string> paramFilesVecTrd; + CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); + for (auto parIt : paramFilesVecTrd) { + parFileList->Add( + new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); + } + } + // -- end trd parameters + // -- beginn trd reco Double_t triggerThreshold = 0.5e-6; // Default CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true, false); @@ -179,6 +210,8 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = 300) { FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data(), "UPDATE"); rtdb->setFirstInput(parIo1); + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C index c52aa9730f7cf67e4c64816ac7ef981a70808037..b99fd0b0cc8fe6484b46d5c099bc4340da256a3a 100644 --- a/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C @@ -29,11 +29,19 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = 300) { Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/" "unp_mcbm_params_%i.root", runId); - TString geoFile = paramDir + "mcbm2020_reco.geo.root"; // Created in sim. run TString parFileOut = Form("./data/reco_mcbm_params_%i.root", runId); TString outFile = Form("./data/reco_mcbm_%i.root", runId); // ------------------------------------------------------------------------ + // --- Load the geometry setup ---- + // This is currently only required by the TRD (parameters) + std::string geoSetupTag = "mcbm_beam_2020_03"; + TString geoFile = + paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run + CbmSetup* geoSetup = CbmSetup::Instance(); + geoSetup->LoadSetup(geoSetupTag.data()); + TList* parFileList = new TList(); + // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; @@ -134,6 +142,29 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = 300) { // ----- Local reconstruction in TRD ---------------------------------- + // Load parameters <- they are required by the hit producer. + // For now, it is enough to load the default ascii parameters + // if no root file is existing from the unpacking process. + TString geoTagTrd = ""; + bool isActiveTrd = + (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; + if (!isActiveTrd) { + LOG(warning) << Form( + "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " + "can not be loaded correctly!", + geoSetupTag.data()); + } else { + TString paramFilesTrd( + Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); + std::vector<std::string> paramFilesVecTrd; + CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); + for (auto parIt : paramFilesVecTrd) { + parFileList->Add( + new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); + } + } + // -- end trd parameters + // -- beginn trd reco Double_t triggerThreshold = 0.5e-6; // Default CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true, false); @@ -183,8 +214,10 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = 300) { FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); FairParRootFileIo* parIo3 = new FairParRootFileIo(); parIo1->open(parFileIn.Data(), "READ"); - parIo3->open(parFileOut.Data(), "RECREATE"); rtdb->setFirstInput(parIo1); + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); + parIo3->open(parFileOut.Data(), "RECREATE"); // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_reco.C b/macro/beamtime/mcbm2020/mcbm_reco.C index f593d587c172591b23d86345c05c958691b4aff6..e17246e51186d908e1e996f9c5115b4d718126fb 100644 --- a/macro/beamtime/mcbm2020/mcbm_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_reco.C @@ -24,10 +24,18 @@ void mcbm_reco(Int_t runId = 831, Int_t nTimeslices = 0) { // ----- In- and output file names ------------------------------------ TString inFile = Form("./data/unp_mcbm_%i.root", runId); TString parFile = Form("./data/unp_mcbm_params_%i.root", runId); - TString geoFile = paramDir + "mcbm2020_reco.geo.root"; // Created in sim. run TString outFile = Form("./data/reco_mcbm_%i.root", runId); // ------------------------------------------------------------------------ + // --- Load the geometry setup ---- + // This is currently only required by the TRD (parameters) + std::string geoSetupTag = "mcbm_beam_2020_03"; + TString geoFile = + paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run + CbmSetup* geoSetup = CbmSetup::Instance(); + geoSetup->LoadSetup(geoSetupTag.data()); + TList* parFileList = new TList(); + // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; @@ -113,6 +121,29 @@ void mcbm_reco(Int_t runId = 831, Int_t nTimeslices = 0) { // ----- Local reconstruction in TRD ---------------------------------- + // Load parameters <- they are required by the hit producer. + // For now, it is enough to load the default ascii parameters + // if no root file is existing from the unpacking process. + TString geoTagTrd = ""; + bool isActiveTrd = + (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; + if (!isActiveTrd) { + LOG(warning) << Form( + "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " + "can not be loaded correctly!", + geoSetupTag.data()); + } else { + TString paramFilesTrd( + Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); + std::vector<std::string> paramFilesVecTrd; + CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); + for (auto parIt : paramFilesVecTrd) { + parFileList->Add( + new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); + } + } + // -- end trd parameters + // -- beginn trd reco Double_t triggerThreshold = 0.5e-6; // Default CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true, false); @@ -162,6 +193,8 @@ void mcbm_reco(Int_t runId = 831, Int_t nTimeslices = 0) { FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data(), "UPDATE"); rtdb->setFirstInput(parIo1); + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C index 8eccacdd6da2bdb29e6466404e81ccd411c80fef..2df53707813399d5cfb12e9b62643f87004ea662 100644 --- a/macro/beamtime/mcbm2020/mcbm_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C @@ -28,11 +28,19 @@ void mcbm_reco_kronos(Int_t runId = 831, Int_t nTimeslices = 0) { Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/" "unp_mcbm_params_%i.root", runId); - TString geoFile = paramDir + "mcbm2020_reco.geo.root"; // Created in sim. run TString parFileOut = Form("./data/reco_mcbm_params_%i.root", runId); TString outFile = Form("./data/reco_mcbm_%i.root", runId); // ------------------------------------------------------------------------ + // --- Load the geometry setup ---- + // This is currently only required by the TRD (parameters) + std::string geoSetupTag = "mcbm_beam_2020_03"; + TString geoFile = + paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run + CbmSetup* geoSetup = CbmSetup::Instance(); + geoSetup->LoadSetup(geoSetupTag.data()); + TList* parFileList = new TList(); + // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; @@ -118,6 +126,28 @@ void mcbm_reco_kronos(Int_t runId = 831, Int_t nTimeslices = 0) { // ----- Local reconstruction in TRD ---------------------------------- + // Load parameters <- they are required by the hit producer. + // For now, it is enough to load the default ascii parameters + // if no root file is existing from the unpacking process. + TString geoTagTrd = ""; + bool isActiveTrd = + (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; + if (!isActiveTrd) { + LOG(warning) << Form( + "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " + "can not be loaded correctly!", + geoSetupTag.data()); + } else { + TString paramFilesTrd( + Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); + std::vector<std::string> paramFilesVecTrd; + CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); + for (auto parIt : paramFilesVecTrd) { + parFileList->Add( + new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); + } + } + // -- end trd parameters Double_t triggerThreshold = 0.5e-6; // Default CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true, false); @@ -167,8 +197,10 @@ void mcbm_reco_kronos(Int_t runId = 831, Int_t nTimeslices = 0) { FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); FairParRootFileIo* parIo3 = new FairParRootFileIo(); parIo1->open(parFileIn.Data(), "READ"); - parIo3->open(parFileOut.Data(), "RECREATE"); rtdb->setFirstInput(parIo1); + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); + parIo3->open(parFileOut.Data(), "RECREATE"); // ------------------------------------------------------------------------