From 542b4ed95ca750bf815fe4766393d42f47481ca6 Mon Sep 17 00:00:00 2001 From: alberica toia <a.toia@gsi.de> Date: Mon, 9 Nov 2020 22:18:00 +0100 Subject: [PATCH] adding sts reco with abs and rel path --- .../mcbm2020/build_event_win_kronos.C | 59 +++++- macro/beamtime/mcbm2020/mcbm_reco.C | 8 +- macro/beamtime/mcbm2020/mcbm_reco_kronos.C | 194 ++++++++++++++++++ 3 files changed, 251 insertions(+), 10 deletions(-) create mode 100644 macro/beamtime/mcbm2020/mcbm_reco_kronos.C diff --git a/macro/beamtime/mcbm2020/build_event_win_kronos.C b/macro/beamtime/mcbm2020/build_event_win_kronos.C index dd087cf1eb..909bdc2421 100644 --- a/macro/beamtime/mcbm2020/build_event_win_kronos.C +++ b/macro/beamtime/mcbm2020/build_event_win_kronos.C @@ -25,7 +25,9 @@ void build_event_win_kronos(UInt_t uRunIdx = 0, }; if (vuListRunId.size() <= uRunIdx) return kFALSE; uRunId = vuListRunId[uRunIdx]; - fileName = Form("data/unp_mcbm_%03u.root", uRunId); + //fileName = Form("data/unp_mcbm_%03u.root", uRunId); + fileName = Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/unp_mcbm_%i.root", + uRunId); } // if( 99999 != uRunIdx ) if (uRunId < 692 && 0 != uRunId) return kFALSE; @@ -103,13 +105,58 @@ void build_event_win_kronos(UInt_t uRunIdx = 0, fRun->AddTask(eventBuilder); - // ----- Parameter database -------------------------------------------- - // FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - // FairParRootFileIo* parIo1 = new FairParRootFileIo(); - // parIo1->open(parFile.Data(),"UPDATE"); - // rtdb->setFirstInput(parIo1); + // ----- Parameter database -------------------------------------------- + TString parFile = + Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/unp_mcbm_params_%i.root", + uRunId); + FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); + parIo1->open(parFile.Data(),"UPDATE"); + rtdb->setFirstInput(parIo1); // ------------------------------------------------------------------------ + TString geoFileSts = + "/lustre/cbm/users/alberica/cbmroot/macro/beamtime/mcbm2020/data/test.geo.root"; // to be created by a simulation run + fRun->SetGeomFile(geoFileSts); + + // ----- Local reconstruction in STS ---------------------------------- + CbmRecoSts* recoSts = new CbmRecoSts(); + recoSts->SetMode(kCbmRecoEvent); + + //recoSts->SetTimeCutDigisAbs( 20 );// cluster finder: time cut in ns + //recoSts->SetTimeCutClustersAbs(20.); // hit finder: time cut in ns + + // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time, + // noise RMS, zero-threshold crossing rate + auto parAsic = new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3); + + // Module params: number of channels, number of channels per ASIC + auto parMod = new CbmStsParModule(2048, 128); + parMod->SetAllAsics(*parAsic); + recoSts->UseModulePar(parMod); + + // Sensor params + auto sensorPar = new CbmStsParSensor(CbmStsSensorClass::kDssdStereo); + sensorPar->SetPar(0, 6.2092); // Extension in x + sensorPar->SetPar(1, 6.2); // Extension in y + sensorPar->SetPar(2, 0.03); // Extension in z + sensorPar->SetPar(3, 5.9692); // Active size in y + sensorPar->SetPar(4, 1024.); // Number of strips front side + sensorPar->SetPar(5, 1024.); // Number of strips back side + sensorPar->SetPar(6, 0.0058); // Strip pitch front side + sensorPar->SetPar(7, 0.0058); // Strip pitch back side + sensorPar->SetPar(8, 7.5); // Stereo angle front side + sensorPar->SetPar(9, 0.0); // Stereo angle back side + recoSts->UseSensorPar(sensorPar); + + // Sensor conditions: full depletion voltage, bias voltage, temperature, + // coupling capacitance, inter-strip capacitance + auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.); + recoSts->UseSensorCond(sensorCond); + + fRun->AddTask(recoSts); + std::cout << "-I- : Added task " << recoSts->GetName() << std::endl; + // ------------------------------------------------------------------------ // ----- Intialise and run -------------------------------------------- fRun->Init(); diff --git a/macro/beamtime/mcbm2020/mcbm_reco.C b/macro/beamtime/mcbm2020/mcbm_reco.C index feabf2254c..e28de7a526 100644 --- a/macro/beamtime/mcbm2020/mcbm_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_reco.C @@ -20,10 +20,10 @@ void mcbm_reco(Int_t runId = 812, Int_t nTimeslices = 0) { // ----- In- and output file names ------------------------------------ - TString inFile = Form("unp_mcbm_%i.root", runId); - TString parFile = Form("unp_mcbm_params_%i.root", runId); - TString geoFile = "test.geo.root"; // to be created by a simulation run - TString outFile = Form("reco_mcbm_%i.root", runId); + TString inFile = Form(".data/unp_mcbm_%i.root", runId); + TString parFile = Form(".data/unp_mcbm_params_%i.root", runId); + TString geoFile = ".data/test.geo.root"; // to be created by a simulation run + TString outFile = Form(".data/reco_mcbm_%i.root", runId); // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C new file mode 100644 index 0000000000..1f6a281506 --- /dev/null +++ b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C @@ -0,0 +1,194 @@ +// -------------------------------------------------------------------------- +// +// Macro for reconstruction of mcbm data (2019) +// Only STS local reconstruction (cluster + hit finder) for the time being +// +// -------------------------------------------------------------------------- + +void mcbm_reco(Int_t runId = 812, Int_t nTimeslices = 0) { + + // --- Logger settings ---------------------------------------------------- + TString logLevel = "INFO"; + TString logVerbosity = "LOW"; + // ------------------------------------------------------------------------ + + + // ----- Environment -------------------------------------------------- + TString myName = "mcbm_reco"; // this macro's name for screen output + TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory + // TString srcDir1 = gSystem->Getenv("SLURM_INDEX"); // ------------------------------------------------------------------------ + + + // ----- In- and output file names ------------------------------------ + TString inFile = Form("/lustre/cbm/users/ploizeau/mcbm2020/" + "unp_evt_data_7f229b3f_20201103/unp_mcbm_%i.root", + runId); + TString parFile = + Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/unp_mcbm_params_%i.root", + runId); + TString geoFile = + "/lustre/cbm/users/alberica/cbmroot/macro/beamtime/mcbm2020/data/test.geo.root"; // to be created by a simulation run + TString outFile = + Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/reco_mcbm_%i.root", runId); + // ------------------------------------------------------------------------ + + + // ----- Timer -------------------------------------------------------- + TStopwatch timer; + timer.Start(); + // ------------------------------------------------------------------------ + + + // ---- Debug option ------------------------------------------------- + gDebug = 0; + // ------------------------------------------------------------------------ + + + // ----- FairRunAna --------------------------------------------------- + FairRunAna* run = new FairRunAna(); + FairFileSource* inputSource = new FairFileSource(inFile); + run->SetSource(inputSource); + + run->SetOutputFile(outFile); + run->SetGenerateRunInfo(kTRUE); + run->SetGeomFile(geoFile); + + TString monitorFile {outFile}; + monitorFile.ReplaceAll("rec", "rec.monitor"); + FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); + // ----------------------------------------------------------------------- + + + // ----- Logger settings ---------------------------------------------- + FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); + FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); + // ------------------------------------------------------------------------ + + + // ----- Reconstruction tasks ----------------------------------------- + + + // ----- Psd hit producer ---------------------------------------------- + CbmPsdMCbmHitProducer* hitProd = new CbmPsdMCbmHitProducer(); + run->AddTask(hitProd); + // ------------------------------------------------------------------------ + + + // ----- Local reconstruction in STS ---------------------------------- + CbmRecoSts* recoSts = new CbmRecoSts(); + //recoSts->SetTimeCutDigisAbs( 100 );// cluster finder: time cut in ns + //recoSts->SetTimeCutClustersAbs(100.); // hit finder: time cut in ns + + // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time, + // noise RMS, zero-threshold crossing rate + auto parAsic = + new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3); + + // Module params: number of channels, number of channels per ASIC + auto parMod = new CbmStsParModule(2048, 128); + parMod->SetAllAsics(*parAsic); + recoSts->UseModulePar(parMod); + + // Sensor params + auto sensorPar = new CbmStsParSensor(CbmStsSensorClass::kDssdStereo); + sensorPar->SetPar(0, 6.2092); // Extension in x + sensorPar->SetPar(1, 6.2); // Extension in y + sensorPar->SetPar(2, 0.03); // Extension in z + sensorPar->SetPar(3, 5.9692); // Active size in y + sensorPar->SetPar(4, 1024.); // Number of strips front side + sensorPar->SetPar(5, 1024.); // Number of strips back side + sensorPar->SetPar(6, 0.0058); // Strip pitch front side + sensorPar->SetPar(7, 0.0058); // Strip pitch back side + sensorPar->SetPar(8, 7.5); // Stereo angle front side + sensorPar->SetPar(9, 0.0); // Stereo angle back side + recoSts->UseSensorPar(sensorPar); + + // Sensor conditions: full depletion voltage, bias voltage, temperature, + // coupling capacitance, inter-strip capacitance + auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.); + recoSts->UseSensorCond(sensorCond); + + run->AddTask(recoSts); + std::cout << "-I- : Added task " << recoSts->GetName() << std::endl; + // ------------------------------------------------------------------------ + + + // ----- Local reconstruction of RICH Hits ------------------------------ + CbmRichMCbmHitProducer* hitProd = new CbmRichMCbmHitProducer(); + hitProd->setToTLimits(23.7, 30.0); + hitProd->applyToTCut(); + run->AddTask(hitProd); + // ------------------------------------------------------------------------ + + + // ----- Local reconstruction in RICh -> Finding of Rings --------------- + CbmRichReconstruction* richReco = new CbmRichReconstruction(); + richReco->UseMCbmSetup(); + run->AddTask(richReco); + // ------------------------------------------------------------------------ + + // ----- Parameter database -------------------------------------------- + std::cout << std::endl << std::endl; + std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); + FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); + parIo1->open(parFile.Data(), "UPDATE"); + rtdb->setFirstInput(parIo1); + // ------------------------------------------------------------------------ + + + // ----- Run initialisation ------------------------------------------- + std::cout << std::endl; + std::cout << "-I- " << myName << ": Initialise run" << std::endl; + run->Init(); + rtdb->setOutput(parIo1); + rtdb->saveOutput(); + rtdb->print(); + // ------------------------------------------------------------------------ + + + // ----- Start run ---------------------------------------------------- + std::cout << std::endl << std::endl; + std::cout << "-I- " << myName << ": Starting run" << std::endl; + run->Run(0, nTimeslices); + // ------------------------------------------------------------------------ + + + // ----- Finish ------------------------------------------------------- + timer.Stop(); + FairMonitor::GetMonitor()->Print(); + Double_t rtime = timer.RealTime(); + Double_t ctime = timer.CpuTime(); + std::cout << std::endl << std::endl; + std::cout << "Macro finished successfully." << std::endl; + std::cout << "Output file is " << outFile << std::endl; + std::cout << "Parameter file is " << parFile << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" + << std::endl; + std::cout << std::endl; + std::cout << " Test passed" << std::endl; + std::cout << " All ok " << std::endl; + // ------------------------------------------------------------------------ + + + // ----- Resource monitoring ------------------------------------------ + // Extract the maximal used memory an add is as Dart measurement + // This line is filtered by CTest and the value send to CDash + FairSystemInfo sysInfo; + Float_t maxMemory = sysInfo.GetMaxMemory(); + std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; + std::cout << maxMemory; + std::cout << "</DartMeasurement>" << std::endl; + + Float_t cpuUsage = ctime / rtime; + std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; + std::cout << cpuUsage; + std::cout << "</DartMeasurement>" << std::endl; + // ------------------------------------------------------------------------ + + + // ----- Function needed for CTest runtime dependency ----------------- + // RemoveGeoManager(); + // ------------------------------------------------------------------------ +} -- GitLab