From 195f1c2700352a917b61e3514f72e2022289387c Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Fri, 18 Jan 2019 16:25:56 +0100 Subject: [PATCH 01/25] first separation T0 V0 --- Detectors/FIT/CMakeLists.txt | 6 +- Detectors/FIT/T0/CMakeLists.txt | 4 + Detectors/FIT/T0/base/CMakeLists.txt | 23 +++++ .../base/files/quartzOptProperties.txt | 0 .../base/include/T0Base}/Geometry.h | 4 +- Detectors/FIT/{ => T0}/base/src/Geometry.cxx | 6 +- .../base/src/T0BaseLinkDef.h} | 4 +- Detectors/FIT/T0/macros/readHitsDigits.C | 87 +++++++++++++++++ Detectors/FIT/T0/macros/readRecPoints.C | 58 +++++++++++ Detectors/FIT/T0/macros/run_digi_fit.C | 96 +++++++++++++++++++ Detectors/FIT/T0/macros/test/run_test.sh | 5 + .../{ => T0}/reconstruction/CMakeLists.txt | 4 +- .../T0Reconstruction}/CollisionTimeRecoTask.h | 8 +- .../include/T0Reconstruction}/RecPoints.h | 16 ++-- .../src/CollisionTimeRecoTask.cxx | 6 +- .../{ => T0}/reconstruction/src/RecPoints.cxx | 13 +-- .../src/T0ReconstructionLinkDef.h | 21 ++++ Detectors/FIT/T0/simulation/CMakeLists.txt | 19 ++++ .../include/T0Simulation}/Detector.h | 20 ++-- .../T0Simulation/DigitizationParameters.h | 26 +++++ .../include/T0Simulation}/DigitizerTask.h | 30 +++--- .../FIT/{ => T0}/simulation/src/Detector.cxx | 10 +- .../{ => T0}/simulation/src/DigitizerTask.cxx | 6 +- .../T0/simulation/src/T0SimulationLinkDef.h | 24 +++++ Detectors/FIT/common/CMakeLists.txt | 4 + .../FIT/{ => common}/base/CMakeLists.txt | 9 +- .../{ => common}/base/include/FITBase/Digit.h | 0 .../base/include/FITBase}/MCLabel.h | 0 Detectors/FIT/{ => common}/base/src/Digit.cxx | 0 .../{ => common}/base/src/FITBaseLinkDef.h | 3 +- .../{ => common}/simulation/CMakeLists.txt | 11 +-- .../FITSimulation/DigitizationParameters.h | 21 ++++ .../include/FITSimulation/Digitizer.h | 12 ++- .../{ => common}/simulation/src/Digitizer.cxx | 46 ++++----- .../simulation/src/FITSimulationLinkDef.h | 10 +- .../src/FITDigitizerSpec.cxx | 26 ++--- cmake/O2Dependencies.cmake | 15 ++- macro/build_geometry.C | 4 +- run/O2HitMerger.h | 4 +- 39 files changed, 525 insertions(+), 136 deletions(-) create mode 100644 Detectors/FIT/T0/CMakeLists.txt create mode 100644 Detectors/FIT/T0/base/CMakeLists.txt rename Detectors/FIT/{ => T0}/base/files/quartzOptProperties.txt (100%) rename Detectors/FIT/{base/include/FITBase => T0/base/include/T0Base}/Geometry.h (98%) rename Detectors/FIT/{ => T0}/base/src/Geometry.cxx (97%) rename Detectors/FIT/{reconstruction/src/FITReconstructionLinkDef.h => T0/base/src/T0BaseLinkDef.h} (80%) create mode 100644 Detectors/FIT/T0/macros/readHitsDigits.C create mode 100644 Detectors/FIT/T0/macros/readRecPoints.C create mode 100644 Detectors/FIT/T0/macros/run_digi_fit.C create mode 100755 Detectors/FIT/T0/macros/test/run_test.sh rename Detectors/FIT/{ => T0}/reconstruction/CMakeLists.txt (79%) rename Detectors/FIT/{reconstruction/include/FITReconstruction => T0/reconstruction/include/T0Reconstruction}/CollisionTimeRecoTask.h (86%) rename Detectors/FIT/{reconstruction/include/FITReconstruction => T0/reconstruction/include/T0Reconstruction}/RecPoints.h (80%) rename Detectors/FIT/{ => T0}/reconstruction/src/CollisionTimeRecoTask.cxx (91%) rename Detectors/FIT/{ => T0}/reconstruction/src/RecPoints.cxx (86%) create mode 100644 Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h create mode 100644 Detectors/FIT/T0/simulation/CMakeLists.txt rename Detectors/FIT/{simulation/include/FITSimulation => T0/simulation/include/T0Simulation}/Detector.h (93%) create mode 100644 Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h rename Detectors/FIT/{simulation/include/FITSimulation => T0/simulation/include/T0Simulation}/DigitizerTask.h (61%) rename Detectors/FIT/{ => T0}/simulation/src/Detector.cxx (99%) rename Detectors/FIT/{ => T0}/simulation/src/DigitizerTask.cxx (97%) create mode 100644 Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h create mode 100644 Detectors/FIT/common/CMakeLists.txt rename Detectors/FIT/{ => common}/base/CMakeLists.txt (69%) rename Detectors/FIT/{ => common}/base/include/FITBase/Digit.h (100%) rename Detectors/FIT/{simulation/include/FITSimulation => common/base/include/FITBase}/MCLabel.h (100%) rename Detectors/FIT/{ => common}/base/src/Digit.cxx (100%) rename Detectors/FIT/{ => common}/base/src/FITBaseLinkDef.h (90%) rename Detectors/FIT/{ => common}/simulation/CMakeLists.txt (63%) create mode 100644 Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h rename Detectors/FIT/{ => common}/simulation/include/FITSimulation/Digitizer.h (85%) rename Detectors/FIT/{ => common}/simulation/src/Digitizer.cxx (82%) rename Detectors/FIT/{ => common}/simulation/src/FITSimulationLinkDef.h (70%) diff --git a/Detectors/FIT/CMakeLists.txt b/Detectors/FIT/CMakeLists.txt index 7153b888b9502..c8c3ba0078283 100644 --- a/Detectors/FIT/CMakeLists.txt +++ b/Detectors/FIT/CMakeLists.txt @@ -1,4 +1,4 @@ # Libraries -add_subdirectory(base) -add_subdirectory(simulation) -add_subdirectory(reconstruction) +add_subdirectory(common) +add_subdirectory(T0) +#add_subdirectory(V0) diff --git a/Detectors/FIT/T0/CMakeLists.txt b/Detectors/FIT/T0/CMakeLists.txt new file mode 100644 index 0000000000000..7153b888b9502 --- /dev/null +++ b/Detectors/FIT/T0/CMakeLists.txt @@ -0,0 +1,4 @@ +# Libraries +add_subdirectory(base) +add_subdirectory(simulation) +add_subdirectory(reconstruction) diff --git a/Detectors/FIT/T0/base/CMakeLists.txt b/Detectors/FIT/T0/base/CMakeLists.txt new file mode 100644 index 0000000000000..968e4b262374c --- /dev/null +++ b/Detectors/FIT/T0/base/CMakeLists.txt @@ -0,0 +1,23 @@ +set(MODULE_NAME "T0Base") + +O2_SETUP(NAME ${MODULE_NAME}) + +set(SRCS + src/Geometry.cxx + ) + +set(HEADERS + include/${MODULE_NAME}/Geometry.h + ) + + +Set(LINKDEF src/T0BaseLinkDef.h) +Set(LIBRARY_NAME ${MODULE_NAME}) +set(BUCKET_NAME fit_base_bucket) + +O2_GENERATE_LIBRARY() + +install( + DIRECTORY files + DESTINATION share/Detectors/T0/ +) diff --git a/Detectors/FIT/base/files/quartzOptProperties.txt b/Detectors/FIT/T0/base/files/quartzOptProperties.txt similarity index 100% rename from Detectors/FIT/base/files/quartzOptProperties.txt rename to Detectors/FIT/T0/base/files/quartzOptProperties.txt diff --git a/Detectors/FIT/base/include/FITBase/Geometry.h b/Detectors/FIT/T0/base/include/T0Base/Geometry.h similarity index 98% rename from Detectors/FIT/base/include/FITBase/Geometry.h rename to Detectors/FIT/T0/base/include/T0Base/Geometry.h index d07065a00185b..71580b4a20e6a 100644 --- a/Detectors/FIT/base/include/FITBase/Geometry.h +++ b/Detectors/FIT/T0/base/include/T0Base/Geometry.h @@ -18,7 +18,7 @@ #include namespace o2 { -namespace fit +namespace t0 { // FIT is not tracking detector, Geometry could be used in future but not now. So just simple settings class Geometry @@ -52,6 +52,6 @@ class Geometry ClassDefNV(Geometry, 1); }; -} // namespace fit +} // namespace t0 } // namespace o2 #endif diff --git a/Detectors/FIT/base/src/Geometry.cxx b/Detectors/FIT/T0/base/src/Geometry.cxx similarity index 97% rename from Detectors/FIT/base/src/Geometry.cxx rename to Detectors/FIT/T0/base/src/Geometry.cxx index 0c31ea91587a9..46084df237544 100644 --- a/Detectors/FIT/base/src/Geometry.cxx +++ b/Detectors/FIT/T0/base/src/Geometry.cxx @@ -9,14 +9,14 @@ // or submit itself to any jurisdiction. #include //#include -#include "FITBase/Geometry.h" +#include "T0Base/Geometry.h" #include #include -ClassImp(o2::fit::Geometry); +ClassImp(o2::t0::Geometry); -using namespace o2::fit; +using namespace o2::t0; Geometry::Geometry() : mMCP{ { 0, 0, 0 } } { diff --git a/Detectors/FIT/reconstruction/src/FITReconstructionLinkDef.h b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h similarity index 80% rename from Detectors/FIT/reconstruction/src/FITReconstructionLinkDef.h rename to Detectors/FIT/T0/base/src/T0BaseLinkDef.h index 9b9f866b49c00..4be48bd4b2466 100644 --- a/Detectors/FIT/reconstruction/src/FITReconstructionLinkDef.h +++ b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h @@ -14,8 +14,6 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::fit::CollisionTimeRecoTask+; -#pragma link C++ class o2::fit::RecPoints+; -#pragma link C++ class o2::fit::Channel+; +#pragma link C++ class o2::t0::Geometry + ; #endif diff --git a/Detectors/FIT/T0/macros/readHitsDigits.C b/Detectors/FIT/T0/macros/readHitsDigits.C new file mode 100644 index 0000000000000..8d1886387b0f1 --- /dev/null +++ b/Detectors/FIT/T0/macros/readHitsDigits.C @@ -0,0 +1,87 @@ +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include "FITSimulation/Detector.h" +#include "FITBase/Digit.h" +#include +#endif + +void readHitsDigits() +{ + using namespace o2::fit; + // using namespace o2::fit::Digit; + + // Create histograms + TDirectory* cwd = gDirectory; + gDirectory = 0x0; + + TH2F* hMultHit = new TH2F("hMultHits", "photons Hits ", 210, 0, 210, 500, 0, 5000); + TH2F* hTimeHit = new TH2F("hTimeAChit", "Time Hits", 210, 0, 210, 1000, 0, 15); + TH2F* hMultDig = new TH2F("hMultDig", "photons Digits ", 210, 0, 210, 500, 0, 20); + TH2F* hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 300, 0, 15); + + gDirectory = cwd; + + TFile* fhit = new TFile("o2sim.root"); + TTree* hitTree = (TTree*)fhit->Get("o2sim"); + std::vector* hitArray = nullptr; + hitTree->SetBranchAddress("FITHit", &hitArray); + Int_t nevH = hitTree->GetEntries(); // hits are stored as one event per entry + std::cout << "Found " << nevH << " events with hits " << std::endl; + + Double_t hit_time[240]; + Int_t countE[240]; + // Event ------------------------- LOOP + for (Int_t ievent = 0; ievent < nevH; ievent++) { + hitTree->GetEntry(ievent); + for (int ii = 0; ii < 240; ii++) { + countE[ii] = 0; + hit_time[ii] = 0; + } + for (auto& hit : *hitArray) { + Int_t detID = hit.GetDetectorID(); + hit_time[detID] = hit.GetTime(); + hTimeHit->Fill(detID, hit_time[detID]); + if (hit_time[detID] < 10 && detID < 96) + std::cout << ievent << " " << detID << " time " << hit_time[detID] << endl; + + countE[detID]++; + } + for (int ii = 0; ii < 208; ii++) { + if (countE[ii] > 100) { + hMultHit->Fill(ii, countE[ii]); + // std::cout<Get("o2sim"); + o2::fit::Digit* digArr = new Digit; + digTree->SetBranchAddress("FITDigit", &digArr); + Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry + std::cout << "Found " << nevD << " events with digits " << std::endl; + Float_t cfd[208], amp[208]; + for (Int_t iev = 0; iev < nevD; iev++) { + digTree->GetEvent(iev); + for (int ii = 0; ii < 208; ii++) { + cfd[ii] = amp[ii] = 0; + } + for (const auto& d : digArr->getChDgData()) { + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime; + amp[mcp] = d.QTCAmpl; + // cout<Fill(Float_t(mcp), amp[mcp]); + hTimeDig->Fill(Float_t(mcp), cfd[mcp]); + } + } + TFile* Hfile = new TFile("FigFit_dig_pp.root", "RECREATE"); + printf("Writting histograms to root file \n"); + Hfile->cd(); + //Create a canvas, set the view range, show histograms + // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); + hTimeHit->Write(); + hMultHit->Write(); + hTimeDig->Write(); + hMultDig->Write(); + +} // end of macro diff --git a/Detectors/FIT/T0/macros/readRecPoints.C b/Detectors/FIT/T0/macros/readRecPoints.C new file mode 100644 index 0000000000000..941d2a241fd60 --- /dev/null +++ b/Detectors/FIT/T0/macros/readRecPoints.C @@ -0,0 +1,58 @@ +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include "FITSimulation/Detector.h" +#include "FITBase/Digit.h" +#include "FITReconstruction/RecPoints.h" +#include +#endif +void readRecPoints() +{ + using namespace o2::fit; + // using namespace o2::fit::Digit; + + // Create histograms + TDirectory* cwd = gDirectory; + gDirectory = 0x0; + + TH2F* hMultRec = new TH2F("hMultRec", "photons Recits ", 210, 0, 210, 500, 0, 1000); + TH2F* hTimeRec = new TH2F("hTimeRec", "Time Recits", 210, 0, 210, 1000, 1, 13); + TH1F* ht0AC = new TH1F("hT0AC", "T0AC", 100, -1, 1); + + gDirectory = cwd; + + TFile* frec = TFile::Open("o2reco_fit.root"); + std::cout << " Open rec file " << std::endl; + TTree* recTree = (TTree*)frec->Get("o2sim"); + o2::fit::RecPoints* recArr = new RecPoints; + recTree->SetBranchAddress("FITRecPoints", &recArr); + Int_t nevD = recTree->GetEntries(); // recits in cont. readout may be grouped as few events per entry + std::cout << "Found " << nevD << " events with recits " << std::endl; + Float_t cfd[208], amp[208]; + for (Int_t iev = 0; iev < nevD; iev++) { + recTree->GetEvent(iev); + + Float_t t0AC = recArr->GetCollisionTime(0); + Float_t eventtime = recArr->GetTimeFromDigit(); + ht0AC->Fill(t0AC - eventtime); + std::cout << iev << " AC " << recArr->GetCollisionTime(0) << " " << eventtime << std::endl; + for (int ii = 0; ii < 208; ii++) { + cfd[ii] = amp[ii] = 0; + } + for (const auto& d : recArr->getChDgData()) { + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime; + amp[mcp] = d.QTCAmpl; + // cout<Fill(Float_t(mcp), amp[mcp]); + hTimeRec->Fill(Float_t(mcp), cfd[mcp]); + } + } + TFile* Hfile = new TFile("FigFit_rec_pp.root", "RECREATE"); + printf("Writting histograms to root file \n"); + Hfile->cd(); + //Create a canvas, set the view range, show histograms + // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); + hTimeRec->Write(); + hMultRec->Write(); + ht0AC->Write(); + +} // end of macro diff --git a/Detectors/FIT/T0/macros/run_digi_fit.C b/Detectors/FIT/T0/macros/run_digi_fit.C new file mode 100644 index 0000000000000..8c9f513087903 --- /dev/null +++ b/Detectors/FIT/T0/macros/run_digi_fit.C @@ -0,0 +1,96 @@ +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include + +#include + +#include "FairLogger.h" +#include "FairRunAna.h" +#include "FairFileSource.h" +#include "FairRuntimeDb.h" +#include "FairParRootFileIo.h" +#include "FairSystemInfo.h" + +#include "FITSimulation/DigitizerTask.h" +#endif + +void run_digi_fit(Int_t nEvents = 10, Float_t rate = 50.e3) +{ + // if rate>0 then continuous simulation for this rate will be performed + + // Initialize logger + FairLogger* logger = FairLogger::GetLogger(); + logger->SetLogVerbosityLevel("LOW"); + logger->SetLogScreenLevel("DEBUG"); + + // Input and output file name + std::stringstream inputfile, outputfile, paramfile; + inputfile << "o2sim.root"; + paramfile << "o2sim_par.root"; + outputfile << "o2sim_digi.root"; + + // Setup timer + TStopwatch timer; + + // Setup FairRoot analysis manager + FairRunAna* fRun = new FairRunAna(); + FairFileSource* fFileSource = new FairFileSource(inputfile.str().c_str()); + fRun->SetSource(fFileSource); + std::cout << "@@@@ input " << inputfile.str().c_str() << std::endl; + fRun->SetOutputFile(outputfile.str().c_str()); + std::cout << "@@@@ output " << outputfile.str().c_str() << std::endl; + + if (rate > 0) { + fFileSource->SetEventMeanTime(1.e9 / rate); // is in us + } + + // Setup Runtime DB + + FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); + std::cout << "@@@@ param " << paramfile.str().c_str() << std::endl; + FairParRootFileIo* parInput1 = new FairParRootFileIo(); + parInput1->open(paramfile.str().c_str()); + rtdb->setFirstInput(parInput1); + + // Setup digitizer + o2::fit::DigitizerTask* digi = new o2::fit::DigitizerTask(); + // digi->setContinuous(rate > 0); + // digi->setFairTimeUnitInNS(1.0); // tell in which units (wrt nanosecond) FAIT timestamps are + fRun->AddTask(digi); + + std::cout << "@@@@ Add task " << std::endl; + fRun->Init(); + std::cout << "@@@@ Run Init " << std::endl; + + timer.Start(); + fRun->Run(); + + std::cout << std::endl + << std::endl; + + // 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 << ""; + std::cout << maxMemory; + std::cout << "" << std::endl; + + timer.Stop(); + Double_t rtime = timer.RealTime(); + Double_t ctime = timer.CpuTime(); + + Float_t cpuUsage = ctime / rtime; + cout << ""; + cout << cpuUsage; + cout << "" << endl; + cout << endl + << endl; + std::cout << "Macro finished succesfully" << std::endl; + + std::cout << endl + << std::endl; + std::cout << "Output file is " << outputfile.str() << std::endl; + // std::cout << "Parameter file is " << parFile << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl + << endl; +} diff --git a/Detectors/FIT/T0/macros/test/run_test.sh b/Detectors/FIT/T0/macros/test/run_test.sh new file mode 100755 index 0000000000000..9e1f69e98dc2c --- /dev/null +++ b/Detectors/FIT/T0/macros/test/run_test.sh @@ -0,0 +1,5 @@ +# +nEvents=10 +mcEngine=\"TGeant3\" +# +# will be fill later diff --git a/Detectors/FIT/reconstruction/CMakeLists.txt b/Detectors/FIT/T0/reconstruction/CMakeLists.txt similarity index 79% rename from Detectors/FIT/reconstruction/CMakeLists.txt rename to Detectors/FIT/T0/reconstruction/CMakeLists.txt index 38d1f821e51ec..66bddb7503563 100644 --- a/Detectors/FIT/reconstruction/CMakeLists.txt +++ b/Detectors/FIT/T0/reconstruction/CMakeLists.txt @@ -1,4 +1,4 @@ -set(MODULE_NAME "FITReconstruction") +set(MODULE_NAME "T0Reconstruction") O2_SETUP(NAME ${MODULE_NAME}) @@ -13,7 +13,7 @@ set(HEADERS ) -Set(LINKDEF src/FITReconstructionLinkDef.h) +Set(LINKDEF src/T0ReconstructionLinkDef.h) Set(LIBRARY_NAME ${MODULE_NAME}) set(BUCKET_NAME fit_reconstruction_bucket) diff --git a/Detectors/FIT/reconstruction/include/FITReconstruction/CollisionTimeRecoTask.h b/Detectors/FIT/T0/reconstruction/include/T0Reconstruction/CollisionTimeRecoTask.h similarity index 86% rename from Detectors/FIT/reconstruction/include/FITReconstruction/CollisionTimeRecoTask.h rename to Detectors/FIT/T0/reconstruction/include/T0Reconstruction/CollisionTimeRecoTask.h index df9f2f0f2242a..717977c7c1707 100644 --- a/Detectors/FIT/reconstruction/include/FITReconstruction/CollisionTimeRecoTask.h +++ b/Detectors/FIT/T0/reconstruction/include/T0Reconstruction/CollisionTimeRecoTask.h @@ -15,22 +15,22 @@ #include #include "FITBase/Digit.h" -#include "FITReconstruction/RecPoints.h" +#include "T0Reconstruction/RecPoints.h" namespace o2 { -namespace fit +namespace t0 { class CollisionTimeRecoTask { public: CollisionTimeRecoTask() = default; ~CollisionTimeRecoTask() = default; - void Process(const Digit& digits, RecPoints& recPoints) const; + void Process(const o2::fit::Digit& digits, RecPoints& recPoints) const; void FinishTask(); private: ClassDefNV(CollisionTimeRecoTask, 1); }; -} // namespace fit +} // namespace t0 } // namespace o2 #endif diff --git a/Detectors/FIT/reconstruction/include/FITReconstruction/RecPoints.h b/Detectors/FIT/T0/reconstruction/include/T0Reconstruction/RecPoints.h similarity index 80% rename from Detectors/FIT/reconstruction/include/FITReconstruction/RecPoints.h rename to Detectors/FIT/T0/reconstruction/include/T0Reconstruction/RecPoints.h index b61266b27d17e..324b199387a3f 100644 --- a/Detectors/FIT/reconstruction/include/FITReconstruction/RecPoints.h +++ b/Detectors/FIT/T0/reconstruction/include/T0Reconstruction/RecPoints.h @@ -21,7 +21,7 @@ namespace o2 { -namespace fit +namespace t0 { struct Channel { Int_t index; @@ -34,7 +34,7 @@ class RecPoints RecPoints() = default; RecPoints(const std::array& collisiontime, Float_t vertex, - std::vector timeamp) + std::vector timeamp) : mCollisionTime(collisiontime), mVertex(vertex), mTimeAmp(std::move(timeamp)) @@ -42,7 +42,7 @@ class RecPoints } ~RecPoints() = default; - void FillFromDigits(const Digit& digit); + void FillFromDigits(const o2::fit::Digit& digit); Float_t GetCollisionTime(int side) const { return mCollisionTime[side]; } void setCollisionTime(Float_t time, int side) { mCollisionTime[side] = time; } @@ -56,20 +56,20 @@ class RecPoints void setBC(Int_t bc) { mBC = bc; } void setOrbit(Int_t orbit) { mOrbit = orbit; } - const std::vector& getChDgData() const { return mTimeAmp; } - void setChDgData(const std::vector& TimeAmp) { mTimeAmp = TimeAmp; } - void setChDgData(std::vector&& TimeAmp) { mTimeAmp = std::move(TimeAmp); } + const std::vector& getChDgData() const { return mTimeAmp; } + void setChDgData(const std::vector& TimeAmp) { mTimeAmp = TimeAmp; } + void setChDgData(std::vector&& TimeAmp) { mTimeAmp = std::move(TimeAmp); } private: std::array mCollisionTime; Float_t mVertex = 0; Double_t mEventTime; //event time from Fair for continuous - std::vector mTimeAmp; + std::vector mTimeAmp; Int_t mBC = 0; // BC from digits Int_t mOrbit = 0; // orbit from digits ClassDefNV(RecPoints, 1); }; -} // namespace fit +} // namespace t0 } // namespace o2 #endif diff --git a/Detectors/FIT/reconstruction/src/CollisionTimeRecoTask.cxx b/Detectors/FIT/T0/reconstruction/src/CollisionTimeRecoTask.cxx similarity index 91% rename from Detectors/FIT/reconstruction/src/CollisionTimeRecoTask.cxx rename to Detectors/FIT/T0/reconstruction/src/CollisionTimeRecoTask.cxx index 97bcad7286348..6fe69ac3964f0 100644 --- a/Detectors/FIT/reconstruction/src/CollisionTimeRecoTask.cxx +++ b/Detectors/FIT/T0/reconstruction/src/CollisionTimeRecoTask.cxx @@ -11,10 +11,10 @@ /// \file CollisionTimeRecoTask.cxx /// \brief Implementation of the FIT reconstruction task -#include "FITReconstruction/CollisionTimeRecoTask.h" -#include "FairLogger.h" // for LOG - +#include "T0Reconstruction/CollisionTimeRecoTask.h" +#include "FairLogger.h" // for LOG +using namespace o2::t0; using namespace o2::fit; /* //_____________________________________________________________________ diff --git a/Detectors/FIT/reconstruction/src/RecPoints.cxx b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx similarity index 86% rename from Detectors/FIT/reconstruction/src/RecPoints.cxx rename to Detectors/FIT/T0/reconstruction/src/RecPoints.cxx index 50aa761dc5991..84392b5d66816 100644 --- a/Detectors/FIT/reconstruction/src/RecPoints.cxx +++ b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx @@ -8,24 +8,25 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "FITReconstruction/RecPoints.h" -#include "FITBase/Geometry.h" +#include "T0Reconstruction/RecPoints.h" +#include "T0Base/Geometry.h" #include #include #include +using namespace o2::t0; using namespace o2::fit; -ClassImp(o2::fit::RecPoints); +ClassImp(o2::t0::RecPoints); -void RecPoints::FillFromDigits(const Digit& digit) +void RecPoints::FillFromDigits(const o2::fit::Digit& digit) { mTimeAmp.clear(); mCollisionTime = {}; Int_t ndigitsC = 0, ndigitsA = 0; - constexpr Int_t nMCPsA = 4 * o2::fit::Geometry::NCellsA; - constexpr Int_t nMCPsC = 4 * o2::fit::Geometry::NCellsC; + constexpr Int_t nMCPsA = 4 * o2::t0::Geometry::NCellsA; + constexpr Int_t nMCPsC = 4 * o2::t0::Geometry::NCellsC; constexpr Int_t nMCPs = nMCPsA + nMCPsC; Float_t cfd[nMCPs] = {}, amp[nMCPs] = {}; Float_t sideAtime = 0, sideCtime = 0; diff --git a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h new file mode 100644 index 0000000000000..f9eb23c55fa4e --- /dev/null +++ b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h @@ -0,0 +1,21 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::t0::CollisionTimeRecoTask + ; +#pragma link C++ class o2::t0::RecPoints + ; +#pragma link C++ class o2::t0::Channel + ; + +#endif diff --git a/Detectors/FIT/T0/simulation/CMakeLists.txt b/Detectors/FIT/T0/simulation/CMakeLists.txt new file mode 100644 index 0000000000000..e70cf0c0ae85a --- /dev/null +++ b/Detectors/FIT/T0/simulation/CMakeLists.txt @@ -0,0 +1,19 @@ +set(MODULE_NAME "T0Simulation") + +O2_SETUP(NAME ${MODULE_NAME}) + +set(SRCS + src/Detector.cxx + #src/DigitizerTask.cxx + ) + +set(HEADERS + include/${MODULE_NAME}/Detector.h + #include/${MODULE_NAME}/DigitizerTask.h + ) + +Set(LINKDEF src/T0SimulationLinkDef.h) +Set(LIBRARY_NAME ${MODULE_NAME}) +set(BUCKET_NAME fit_simulation_bucket) + +O2_GENERATE_LIBRARY() diff --git a/Detectors/FIT/simulation/include/FITSimulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h similarity index 93% rename from Detectors/FIT/simulation/include/FITSimulation/Detector.h rename to Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index 7651614ae2800..f87e5fb7ad52b 100644 --- a/Detectors/FIT/simulation/include/FITSimulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -11,12 +11,12 @@ /// \file Detector.h /// \brief Definition of the Detector class -#ifndef ALICEO2_FIT_DETECTOR_H_ -#define ALICEO2_FIT_DETECTOR_H_ +#ifndef ALICEO2_T0_DETECTOR_H_ +#define ALICEO2_T0_DETECTOR_H_ #include "SimulationDataFormat/BaseHits.h" #include "DetectorsBase/Detector.h" // for Detector -#include "FITBase/Geometry.h" +#include "T0Base/Geometry.h" #include "CommonUtils/ShmAllocator.h" class FairModule; @@ -27,21 +27,21 @@ class TGraph; namespace o2 { -namespace fit +namespace t0 { class HitType : public o2::BasicXYZEHit { public: using BasicXYZEHit::BasicXYZEHit; }; -} // namespace fit +} // namespace t0 } // namespace o2 #ifdef USESHM namespace std { template <> -class allocator : public o2::utils::ShmAllocator +class allocator : public o2::utils::ShmAllocator { }; } // namespace std @@ -49,7 +49,7 @@ class allocator : public o2::utils::ShmAllocator; class Geometry; @@ -169,7 +169,7 @@ class Detector : public o2::Base::DetImpl std::ostream& operator<<(std::ostream& os, Detector& source); std::istream& operator>>(std::istream& os, Detector& source); -} // namespace fit +} // namespace t0 } // namespace o2 #ifdef USESHM @@ -178,7 +178,7 @@ namespace o2 namespace Base { template <> -struct UseShm { +struct UseShm { static constexpr bool value = true; }; } // namespace Base diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h new file mode 100644 index 0000000000000..dda2b551feaec --- /dev/null +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h @@ -0,0 +1,26 @@ +#ifndef ALICEO2_T0_DIGITIZATION_PARAMETERS +#define ALICEO2_T0_DIGITIZATION_PARAMETERS +#include +#include + +namespace o2::t0 +{ +inline o2::fit::DigitizationParameters T0DigitizationParameters() +{ + o2::fit::DigitizationParameters result; + result.NCellsA = Geometry::NCellsA; + result.NCellsC = Geometry::NCellsC; + result.ZdetA = Geometry::ZdetA; + result.ZdetC = Geometry::ZdetC; + result.ChannelWidth = Geometry::ChannelWidth; + result.mBC_clk_center = 12.5; // clk center + result.mMCPs = (Geometry::NCellsA + Geometry::NCellsC) * 4; //number of MCPs + result.mCFD_trsh_mip = 0.4; // = 4[mV] / 10[mV/mip] + result.mTime_trg_gate = 4.; // ns + result.mAmpThreshold = 100; // number of photoelectrons + result.mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); + + return result; +} +} // namespace o2::t0 +#endif diff --git a/Detectors/FIT/simulation/include/FITSimulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h similarity index 61% rename from Detectors/FIT/simulation/include/FITSimulation/DigitizerTask.h rename to Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index 5dcc1e00c98d0..a15647de1606c 100644 --- a/Detectors/FIT/simulation/include/FITSimulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -18,15 +18,15 @@ #include "Rtypes.h" // for DigitizerTask::Class, ClassDef, etc #include "FITBase/Digit.h" -#include "FITSimulation/Detector.h" // for HitType +#include "T0Simulation/Detector.h" // for HitType #include "FITSimulation/Digitizer.h" #include "SimulationDataFormat/MCTruthContainer.h" #include "SimulationDataFormat/MCCompLabel.h" -#include "FITSimulation/MCLabel.h" +#include "FITBase/MCLabel.h" namespace o2 { -namespace fit +namespace t0 { class DigitizerTask : public FairTask @@ -54,25 +54,25 @@ class DigitizerTask : public FairTask Bool_t mContinuous = kFALSE; ///< flag to do continuous simulation double mFairTimeUnitInNS = 1; ///< Fair time unit in ns - Int_t mSourceID = 0; ///< current source - Int_t mEventID = 0; ///< current event id from the source - Digitizer mDigitizer; ///< Digitizer - const std::vector* mHitsArray = nullptr; ///< Array of MC hits + Int_t mSourceID = 0; ///< current source + Int_t mEventID = 0; ///< current event id from the source + Digitizer mDigitizer; ///< Digitizer + const std::vector* mHitsArray = nullptr; ///< Array of MC hits - TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions - const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED - float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. - double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) - int mLastQEDEntry = -1; ///< last used QED entry - UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) + TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions + const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED + float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. + double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) + int mLastQEDEntry = -1; ///< last used QED entry + UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) - Digit* mEventDigit = nullptr; + o2::fit::Digit* mEventDigit = nullptr; o2::dataformats::MCTruthContainer mMCTruthArray; //! Labels containter o2::dataformats::MCTruthContainer* mMCTruthArrayPtr = &mMCTruthArray; //! Labels containter pointer ClassDefOverride(DigitizerTask, 1); }; -} // namespace fit +} // namespace t0 } // namespace o2 #endif /* ALICEO2_TOF_DIGITIZERTASK_H */ diff --git a/Detectors/FIT/simulation/src/Detector.cxx b/Detectors/FIT/T0/simulation/src/Detector.cxx similarity index 99% rename from Detectors/FIT/simulation/src/Detector.cxx rename to Detectors/FIT/T0/simulation/src/Detector.cxx index 9bd812cda3de0..2723440d205e8 100644 --- a/Detectors/FIT/simulation/src/Detector.cxx +++ b/Detectors/FIT/T0/simulation/src/Detector.cxx @@ -24,12 +24,12 @@ #include "FairVolume.h" #include -#include "FITBase/Geometry.h" -#include "FITSimulation/Detector.h" +#include "T0Base/Geometry.h" +#include "T0Simulation/Detector.h" #include "SimulationDataFormat/Stack.h" -using namespace o2::fit; -using o2::fit::Geometry; +using namespace o2::t0; +using o2::t0::Geometry; ClassImp(Detector); @@ -66,7 +66,7 @@ void Detector::InitializeO2Detector() void Detector::ConstructGeometry() { - LOG(DEBUG) << "Creating FIT geometry\n"; + LOG(DEBUG) << "Creating FIT T0 geometry\n"; CreateMaterials(); Float_t zdetA = 333; diff --git a/Detectors/FIT/simulation/src/DigitizerTask.cxx b/Detectors/FIT/T0/simulation/src/DigitizerTask.cxx similarity index 97% rename from Detectors/FIT/simulation/src/DigitizerTask.cxx rename to Detectors/FIT/T0/simulation/src/DigitizerTask.cxx index 938b0c8148cfe..ada15d5e5cdbe 100644 --- a/Detectors/FIT/simulation/src/DigitizerTask.cxx +++ b/Detectors/FIT/T0/simulation/src/DigitizerTask.cxx @@ -11,15 +11,16 @@ /// \file DigitizerTask.cxx /// \brief Implementation of the TOF digitizer task -#include "FITSimulation/DigitizerTask.h" +#include "T0Simulation/DigitizerTask.h" #include "MathUtils/Utils.h" #include "FairLogger.h" // for LOG #include "FairRootManager.h" // for FairRootManager -ClassImp(o2::fit::DigitizerTask); +ClassImp(o2::t0::DigitizerTask); using namespace o2::fit; +using namespace o2::t0; DigitizerTask::DigitizerTask() : FairTask("FITDigitizerTask"), mDigitizer() {} DigitizerTask::~DigitizerTask() @@ -96,7 +97,6 @@ void DigitizerTask::FinishTask() mgr->SetLastFill(kTRUE); /// necessary, otherwise the data is not written out mDigitizer.finish(); - } //________________________________________________________ void DigitizerTask::processQEDBackground(double tMax) diff --git a/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h b/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h new file mode 100644 index 0000000000000..68a389ba8d0d1 --- /dev/null +++ b/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h @@ -0,0 +1,24 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::t0::Detector + ; +//#pragma link C++ class o2::t0::DigitizerTask + ; +#pragma link C++ class o2::t0::HitType + ; +#pragma link C++ class vector < o2::t0::HitType > +; + +#pragma link C++ class o2::Base::DetImpl < o2::t0::Detector > +; + +#endif diff --git a/Detectors/FIT/common/CMakeLists.txt b/Detectors/FIT/common/CMakeLists.txt new file mode 100644 index 0000000000000..32a36ff118835 --- /dev/null +++ b/Detectors/FIT/common/CMakeLists.txt @@ -0,0 +1,4 @@ +# Libraries +add_subdirectory(base) +add_subdirectory(simulation) +#add_subdirectory(reconstruction) diff --git a/Detectors/FIT/base/CMakeLists.txt b/Detectors/FIT/common/base/CMakeLists.txt similarity index 69% rename from Detectors/FIT/base/CMakeLists.txt rename to Detectors/FIT/common/base/CMakeLists.txt index 2c41f4b4ed87f..e0ad1e42cafff 100644 --- a/Detectors/FIT/base/CMakeLists.txt +++ b/Detectors/FIT/common/base/CMakeLists.txt @@ -3,23 +3,18 @@ set(MODULE_NAME "FITBase") O2_SETUP(NAME ${MODULE_NAME}) set(SRCS - src/Geometry.cxx src/Digit.cxx ) set(HEADERS - include/${MODULE_NAME}/Geometry.h include/${MODULE_NAME}/Digit.h + include/${MODULE_NAME}/MCLabel.h ) - Set(LINKDEF src/FITBaseLinkDef.h) Set(LIBRARY_NAME ${MODULE_NAME}) set(BUCKET_NAME fit_base_bucket) O2_GENERATE_LIBRARY() -install( - DIRECTORY files - DESTINATION share/Detectors/FIT/ -) + diff --git a/Detectors/FIT/base/include/FITBase/Digit.h b/Detectors/FIT/common/base/include/FITBase/Digit.h similarity index 100% rename from Detectors/FIT/base/include/FITBase/Digit.h rename to Detectors/FIT/common/base/include/FITBase/Digit.h diff --git a/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h b/Detectors/FIT/common/base/include/FITBase/MCLabel.h similarity index 100% rename from Detectors/FIT/simulation/include/FITSimulation/MCLabel.h rename to Detectors/FIT/common/base/include/FITBase/MCLabel.h diff --git a/Detectors/FIT/base/src/Digit.cxx b/Detectors/FIT/common/base/src/Digit.cxx similarity index 100% rename from Detectors/FIT/base/src/Digit.cxx rename to Detectors/FIT/common/base/src/Digit.cxx diff --git a/Detectors/FIT/base/src/FITBaseLinkDef.h b/Detectors/FIT/common/base/src/FITBaseLinkDef.h similarity index 90% rename from Detectors/FIT/base/src/FITBaseLinkDef.h rename to Detectors/FIT/common/base/src/FITBaseLinkDef.h index 0953222bedcae..6f296f68a0a68 100644 --- a/Detectors/FIT/base/src/FITBaseLinkDef.h +++ b/Detectors/FIT/common/base/src/FITBaseLinkDef.h @@ -14,8 +14,7 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::fit::Geometry+; -#pragma link C++ class o2::fit::Digit+; +#pragma link C++ class o2::fit::Digit + ; #pragma link C++ class o2::fit::ChannelData + ; #pragma link C++ class vector < o2::fit::ChannelData > +; #pragma link C++ class vector < o2::fit::Digit > +; diff --git a/Detectors/FIT/simulation/CMakeLists.txt b/Detectors/FIT/common/simulation/CMakeLists.txt similarity index 63% rename from Detectors/FIT/simulation/CMakeLists.txt rename to Detectors/FIT/common/simulation/CMakeLists.txt index d62bdd9ff067c..5bd07c681e44e 100644 --- a/Detectors/FIT/simulation/CMakeLists.txt +++ b/Detectors/FIT/common/simulation/CMakeLists.txt @@ -3,20 +3,19 @@ set(MODULE_NAME "FITSimulation") O2_SETUP(NAME ${MODULE_NAME}) set(SRCS - src/Detector.cxx src/Digitizer.cxx - src/DigitizerTask.cxx - ) + ) set(HEADERS - include/${MODULE_NAME}/Detector.h include/${MODULE_NAME}/Digitizer.h - include/${MODULE_NAME}/DigitizerTask.h - include/${MODULE_NAME}/MCLabel.h + include/${MODULE_NAME}/DigitizationParameters.h ) + Set(LINKDEF src/FITSimulationLinkDef.h) Set(LIBRARY_NAME ${MODULE_NAME}) set(BUCKET_NAME fit_simulation_bucket) O2_GENERATE_LIBRARY() + + diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h new file mode 100644 index 0000000000000..8607a4d1849ab --- /dev/null +++ b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h @@ -0,0 +1,21 @@ +#ifndef ALICEO2_FIT_DIGITIZATION_PARAMETERS +#define ALICEO2_FIT_DIGITIZATION_PARAMETERS + +namespace o2::fit +{ +struct DigitizationParameters { + int NCellsA; // number of radiatiors on A side + int NCellsC; // number of radiatiors on C side + float ZdetA; // number of radiatiors on A side + float ZdetC; // number of radiatiors on C side + float ChannelWidth; // channel width in ps + + Float_t mBC_clk_center; // clk center + Int_t mMCPs; //number of MCPs + Float_t mCFD_trsh_mip; // = 4[mV] / 10[mV/mip] + Float_t mTime_trg_gate; // ns + Int_t mAmpThreshold; // number of photoelectrons + Float_t mTimeDiffAC; +}; +} // namespace o2::fit +#endif diff --git a/Detectors/FIT/simulation/include/FITSimulation/Digitizer.h b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h similarity index 85% rename from Detectors/FIT/simulation/include/FITSimulation/Digitizer.h rename to Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h index 1b8815a1ba2b3..8e02e50d4e92f 100644 --- a/Detectors/FIT/simulation/include/FITSimulation/Digitizer.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h @@ -12,10 +12,11 @@ #define ALICEO2_FIT_DIGITIZER_H #include "FITBase/Digit.h" -#include "FITSimulation/Detector.h" +#include "T0Simulation/Detector.h" #include "SimulationDataFormat/MCTruthContainer.h" #include "SimulationDataFormat/MCCompLabel.h" -#include "FITSimulation/MCLabel.h" +#include "FITBase/MCLabel.h" +#include "FITSimulation/DigitizationParameters.h" namespace o2 { @@ -24,11 +25,11 @@ namespace fit class Digitizer { public: - Digitizer(Int_t mode = 0) : mMode(mode) { initParameters(); }; + Digitizer(const DigitizationParameters& params, Int_t mode = 0) : mMode(mode), parameters(params) { initParameters(); }; ~Digitizer() = default; //void process(const std::vector* hits, std::vector* digits); - void process(const std::vector* hits, Digit* digit); + void process(const std::vector* hits, Digit* digit); void initParameters(); // void printParameters(); @@ -56,12 +57,15 @@ class Digitizer Int_t mSrcID; // signal, background or QED Double_t mEventTime; // timestamp + DigitizationParameters parameters; + /* Float_t mBC_clk_center = 12.5; // clk center Int_t mMCPs = (Geometry::NCellsA + Geometry::NCellsC) * 4; //number of MCPs Float_t mCFD_trsh_mip = 0.4; // = 4[mV] / 10[mV/mip] Float_t mTime_trg_gate = 4.; // ns Int_t mAmpThreshold = 100; // number of photoelectrons Float_t mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); + */ o2::dataformats::MCTruthContainer* mMCLabels = nullptr; diff --git a/Detectors/FIT/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx similarity index 82% rename from Detectors/FIT/simulation/src/Digitizer.cxx rename to Detectors/FIT/common/simulation/src/Digitizer.cxx index 3820a6527a4f5..9e982f9be7688 100644 --- a/Detectors/FIT/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -9,7 +9,7 @@ // or submit itself to any jurisdiction. #include "FITSimulation/Digitizer.h" -#include "FITSimulation/MCLabel.h" +#include "FITBase/MCLabel.h" #include "SimulationDataFormat/MCTruthContainer.h" #include @@ -20,11 +20,11 @@ #include using namespace o2::fit; -using o2::fit::Geometry; +//using o2::fit::Geometry; ClassImp(Digitizer); -void Digitizer::process(const std::vector* hits, Digit* digit) +void Digitizer::process(const std::vector* hits, Digit* digit) { //parameters constants TO DO: move to class @@ -48,7 +48,7 @@ void Digitizer::process(const std::vector* hits, Digit* digit) for (auto& hit : *hits) { Int_t hit_ch = hit.GetDetectorID(); Double_t hit_time = hit.GetTime(); - Bool_t is_A_side = (hit_ch <= 4 * Geometry::NCellsA); + Bool_t is_A_side = (hit_ch <= 4 * parameters.NCellsA); Float_t time_compensate = is_A_side ? A_side_cable_cmps : C_side_cable_cmps; Bool_t is_hit_in_signal_gate = (hit_time > time_compensate - signal_width * .5) && @@ -81,18 +81,18 @@ void Digitizer::process(const std::vector* hits, Digit* digit) amp[mcp] = d.QTCAmpl; } - for (Int_t ch_iter = 0; ch_iter < mMCPs; ch_iter++) { + for (Int_t ch_iter = 0; ch_iter < parameters.mMCPs; ch_iter++) { if (ch_signal_nPe[ch_iter] != 0) { ch_signal_MIP[ch_iter] = amp[ch_iter] + ch_signal_nPe[ch_iter] / nPe_in_mip; if (cfd[ch_iter] > 0) { - cfd[ch_iter] = cfd[ch_iter] - mBC_clk_center - mEventTime; - ch_signal_time[ch_iter] = ((cfd[ch_iter] + ch_signal_time[ch_iter] / (float)ch_signal_nPe[ch_iter]) / 2.) + mBC_clk_center + mEventTime; + cfd[ch_iter] = cfd[ch_iter] - parameters.mBC_clk_center - mEventTime; + ch_signal_time[ch_iter] = ((cfd[ch_iter] + ch_signal_time[ch_iter] / (float)ch_signal_nPe[ch_iter]) / 2.) + parameters.mBC_clk_center + mEventTime; } else - ch_signal_time[ch_iter] = (ch_signal_time[ch_iter] / (float)ch_signal_nPe[ch_iter]) + mBC_clk_center + mEventTime; + ch_signal_time[ch_iter] = (ch_signal_time[ch_iter] / (float)ch_signal_nPe[ch_iter]) + parameters.mBC_clk_center + mEventTime; - if (ch_signal_MIP[ch_iter] > mCFD_trsh_mip) { + if (ch_signal_MIP[ch_iter] > parameters.mCFD_trsh_mip) { LOG(DEBUG) << ch_iter << " : " - << " : " << ch_signal_time[ch_iter] - mBC_clk_center - mEventTime << " : " + << " : " << ch_signal_time[ch_iter] - parameters.mBC_clk_center - mEventTime << " : " << ch_signal_MIP[ch_iter] << " : " << mEventTime << " cfd " << cfd[ch_iter] << FairLogger::endl; mChDgDataArr.emplace_back(ChannelData{ ch_iter, ch_signal_time[ch_iter], ch_signal_MIP[ch_iter] }); } else { @@ -112,10 +112,10 @@ void Digitizer::smearCFDtime(Digit* digit) std::vector mChDgDataArr; for (const auto& d : digit->getChDgData()) { Int_t mcp = d.ChId; - Double_t cfd = d.CFDTime - mBC_clk_center - mEventTime; + Double_t cfd = d.CFDTime - parameters.mBC_clk_center - mEventTime; Float_t amp = d.QTCAmpl; - if (amp > mCFD_trsh_mip) { - Double_t smeared_time = gRandom->Gaus(cfd, 0.050) + mBC_clk_center + mEventTime; + if (amp > parameters.mCFD_trsh_mip) { + Double_t smeared_time = gRandom->Gaus(cfd, 0.050) + parameters.mBC_clk_center + mEventTime; mChDgDataArr.emplace_back(ChannelData{ mcp, smeared_time, amp }); } } @@ -143,14 +143,14 @@ void Digitizer::setTriggers(Digit* digit) Float_t amp[300] = {}; for (const auto& d : digit->getChDgData()) { Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime - mBC_clk_center - mEventTime; + cfd[mcp] = d.CFDTime - parameters.mBC_clk_center - mEventTime; amp[mcp] = d.QTCAmpl; - if (amp[mcp] < mCFD_trsh_mip) + if (amp[mcp] < parameters.mCFD_trsh_mip) continue; - if (cfd[mcp] < -mTime_trg_gate / 2. || cfd[mcp] > mTime_trg_gate / 2.) + if (cfd[mcp] < -parameters.mTime_trg_gate / 2. || cfd[mcp] > parameters.mTime_trg_gate / 2.) continue; - Bool_t is_A_side = (mcp <= 4 * Geometry::NCellsA); + Bool_t is_A_side = (mcp <= 4 * parameters.NCellsA); if (is_A_side) { n_hit_A++; summ_ampl_A += amp[mcp]; @@ -193,11 +193,13 @@ void Digitizer::setTriggers(Digit* digit) void Digitizer::initParameters() { - mBC_clk_center = 12.5; // clk center - mMCPs = (Geometry::NCellsA + Geometry::NCellsC) * 4; - mCFD_trsh_mip = 0.4; // = 4[mV] / 10[mV/mip] - mTime_trg_gate = 4.; // ns - mAmpThreshold = 100; + /* + parameters.mBC_clk_center = 12.5; // clk center + parameters.mMCPs = (parameters.NCellsA + parameters.NCellsC) * 4; + parameters.mCFD_trsh_mip = 0.4; // = 4[mV] / 10[mV/mip] + parameters.mTime_trg_gate = 4.; // ns + parameters.mAmpThreshold = 100; + */ mEventTime = 0; // murmur } diff --git a/Detectors/FIT/simulation/src/FITSimulationLinkDef.h b/Detectors/FIT/common/simulation/src/FITSimulationLinkDef.h similarity index 70% rename from Detectors/FIT/simulation/src/FITSimulationLinkDef.h rename to Detectors/FIT/common/simulation/src/FITSimulationLinkDef.h index 21d1780df2b38..b3829fb0e762b 100644 --- a/Detectors/FIT/simulation/src/FITSimulationLinkDef.h +++ b/Detectors/FIT/common/simulation/src/FITSimulationLinkDef.h @@ -14,14 +14,10 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::fit::Detector+; #pragma link C++ class o2::fit::Digitizer + ; -#pragma link C++ class o2::fit::DigitizerTask + ; -#pragma link C++ class o2::fit::MCLabel + ; +#pragma link C++ class o2::fit::DigitizationParameters + ; +//#pragma link C++ class o2::fit::MCLabel + ; #pragma link C++ class o2::dataformats::MCTruthContainer < o2::fit::MCLabel > +; -#pragma link C++ class o2::fit::HitType + ; -#pragma link C++ class vector < o2::fit::HitType> + ; - -#pragma link C++ class o2::Base::DetImpl+; +#pragma link C++ class o2::Base::DetImpl < o2::fit::Detector > +; #endif diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index 4c2a37ea28dee..703ac609d6670 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -18,6 +18,7 @@ #include "Steer/HitProcessingManager.h" // for RunContext #include "TChain.h" #include "FITSimulation/Digitizer.h" +#include "T0Simulation/DigitizationParameters.h" #include #include #include "Framework/Task.h" @@ -70,10 +71,10 @@ class FITDPLDigitizerTask mSimChains.back()->AddFile(signalfilename.c_str()); } - mDigitizer.init(); + mT0Digitizer.init(); const bool isContinuous = ic.options().get("pileup"); - // mDigitizer.setContinuous(isContinuous); - // mDigitizer.setMCTruthContainer(labels.get()); + // mT0Digitizer.setContinuous(isContinuous); + // mT0Digitizer.setMCTruthContainer(labels.get()); } void run(framework::ProcessingContext& pc) @@ -97,7 +98,7 @@ class FITDPLDigitizerTask LOG(INFO) << "CALLING FIT DIGITIZATION"; - static std::vector hits; + static std::vector hits; o2::dataformats::MCTruthContainer labelAccum; o2::dataformats::MCTruthContainer labels; o2::fit::Digit digit; @@ -107,9 +108,9 @@ class FITDPLDigitizerTask // loop over all composite collisions given from context // (aka loop over all the interaction records) for (int collID = 0; collID < timesview.size(); ++collID) { - mDigitizer.setEventTime(timesview[collID].timeNS); - mDigitizer.setOrbit(timesview[collID].orbit); - mDigitizer.setBC(timesview[collID].bc); + mT0Digitizer.setEventTime(timesview[collID].timeNS); + mT0Digitizer.setOrbit(timesview[collID].orbit); + mT0Digitizer.setBC(timesview[collID].bc); digit.cleardigits(); // for each collision, loop over the constituents event and source IDs // (background signal merging is basically taking place here) @@ -122,19 +123,19 @@ class FITDPLDigitizerTask // call actual digitization procedure labels.clear(); // digits.clear(); - mDigitizer.process(&hits, &digit); + mT0Digitizer.process(&hits, &digit); auto data = digit.getChDgData(); LOG(INFO) << "Have " << data.size() << " fired channels "; // copy digits into accumulator // labelAccum.mergeAtBack(*labels); } - mDigitizer.setTriggers(&digit); - mDigitizer.smearCFDtime(&digit); + mT0Digitizer.setTriggers(&digit); + mT0Digitizer.smearCFDtime(&digit); digitAccum.push_back(digit); // we should move it there actually LOG(INFO) << "Have " << digitAccum.back().getChDgData().size() << " fired channels "; digit.printStream(std::cout); } - // if (mDigitizer.isContinuous()) { + // if (mT0Digitizer.isContinuous()) { // digits->clear(); // labels->clear(); // digitizer->flushOutputContainer(*digits.get()); @@ -162,7 +163,8 @@ class FITDPLDigitizerTask Bool_t mContinuous = kFALSE; ///< flag to do continuous simulation double mFairTimeUnitInNS = 1; ///< Fair time unit in ns - Digitizer mDigitizer; ///< Digitizer + Digitizer mT0Digitizer{ o2::t0::T0DigitizationParameters() }; ///< Digitizer + //Digitizer mV0Digitizer; ///< Digitizer // RS: at the moment using hardcoded flag for continuos readout o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::CONTINUOUS; // readout mode diff --git a/cmake/O2Dependencies.cmake b/cmake/O2Dependencies.cmake index 20edcfa52b1fd..69fd8ae946463 100644 --- a/cmake/O2Dependencies.cmake +++ b/cmake/O2Dependencies.cmake @@ -1472,7 +1472,7 @@ o2_define_bucket( ${CMAKE_SOURCE_DIR}/Detectors/Base/include ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/base/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/base/include ) @@ -1490,6 +1490,7 @@ o2_define_bucket( Matrix Physics FITBase + T0Base DetectorsBase detectors_base_bucket SimulationDataFormat @@ -1501,9 +1502,11 @@ o2_define_bucket( ${FAIRROOT_INCLUDE_DIR} ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/base/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/base/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/base/include ${CMAKE_SOURCE_DIR}/Detectors/Simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/Simulations/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/simulation/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/simulation/include ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include ${CMAKE_SOURCE_DIR}/Common/MathUtils/include ) @@ -1570,8 +1573,8 @@ o2_define_bucket( ${FAIRROOT_INCLUDE_DIR} ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/base/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/reconstruction/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/base/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/reconstruction/include ${CMAKE_SOURCE_DIR}/Detectors/FITsimulation/include ) @@ -1795,6 +1798,7 @@ o2_define_bucket( EMCALSimulation TOFSimulation FITSimulation + T0Simulation HMPIDSimulation PHOSSimulation PHOSReconstruction @@ -1828,6 +1832,7 @@ o2_define_bucket( TOFSimulation TOFReconstruction FITSimulation + T0Simulation EMCALSimulation HMPIDBase HMPIDSimulation diff --git a/macro/build_geometry.C b/macro/build_geometry.C index 56a3a88085a61..0945ce7342a4a 100644 --- a/macro/build_geometry.C +++ b/macro/build_geometry.C @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -185,7 +185,7 @@ void build_geometry(FairRunSim* run = nullptr) if (isActivated("FIT")) { // FIT - run->AddModule(new o2::fit::Detector(true)); + run->AddModule(new o2::t0::Detector(true)); } if (isActivated("HMP")) { diff --git a/run/O2HitMerger.h b/run/O2HitMerger.h index 2d69e70b4835c..c598f38b93c95 100644 --- a/run/O2HitMerger.h +++ b/run/O2HitMerger.h @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -467,7 +467,7 @@ void O2HitMerger::initDetInstances() counter++; } if (i == DetID::FIT) { - mDetectorInstances[i] = std::move(std::make_unique(true)); + mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } if (i == DetID::MCH) { From 4b6daad3402f5be78cf89ff8d2ff58898fa1fcdb Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Tue, 22 Jan 2019 11:13:23 +0100 Subject: [PATCH 02/25] T0 simulation works with this --- .../DetectorsCommonDataFormats/DetID.h | 6 +- DataFormats/Detectors/Common/src/DetID.cxx | 2 +- .../Headers/include/Headers/DataHeader.h | 2 +- Detectors/FIT/T0/simulation/src/Detector.cxx | 4 +- .../FIT/T0/simulation/src/DigitizerTask.cxx | 4 +- .../src/FITDigitWriterSpec.cxx | 191 +++++++++++------- .../src/FITDigitWriterSpec.h | 9 +- .../src/FITDigitizerSpec.cxx | 45 +++-- .../DigitizerWorkflow/src/FITDigitizerSpec.h | 3 +- .../DigitizerWorkflow/src/GRPUpdaterSpec.cxx | 2 +- .../src/SimpleDigitizerWorkflow.cxx | 10 +- macro/build_geometry.C | 2 +- run/O2HitMerger.h | 2 +- 13 files changed, 173 insertions(+), 109 deletions(-) diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index 3454d47113745..c8ee861e530b4 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -58,7 +58,7 @@ class DetID static constexpr ID MCH = 9; static constexpr ID MID = 10; static constexpr ID ZDC = 11; - static constexpr ID FIT = 12; + static constexpr ID T0 = 12; static constexpr ID ACO = 13; static constexpr ID First = ITS; static constexpr ID Last = ACO; ///< if extra detectors added, update this !!! @@ -105,13 +105,13 @@ class DetID ID mID = First; ///< detector ID static constexpr const char* sDetNames[nDetectors + 1] = ///< defined detector names - { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FIT", "ACO", nullptr }; + { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "T0", "ACO", nullptr }; // detector names, will be defined in DataSources static constexpr std::array sMasks = ///< detectot masks { utils::bit2Mask(ITS), utils::bit2Mask(TPC), utils::bit2Mask(TRD), utils::bit2Mask(TOF), utils::bit2Mask(PHS), utils::bit2Mask(CPV), utils::bit2Mask(EMC), utils::bit2Mask(HMP), utils::bit2Mask(MFT), utils::bit2Mask(MCH), - utils::bit2Mask(MID), utils::bit2Mask(ZDC), utils::bit2Mask(FIT), utils::bit2Mask(ACO) }; + utils::bit2Mask(MID), utils::bit2Mask(ZDC), utils::bit2Mask(T0), utils::bit2Mask(ACO) }; ClassDefNV(DetID, 1); }; diff --git a/DataFormats/Detectors/Common/src/DetID.cxx b/DataFormats/Detectors/Common/src/DetID.cxx index 649bca757e3a2..961593b4c870f 100644 --- a/DataFormats/Detectors/Common/src/DetID.cxx +++ b/DataFormats/Detectors/Common/src/DetID.cxx @@ -25,7 +25,7 @@ constexpr std::array DetID::sMasks; // redundant declarations constexpr DetID::ID DetID::ITS, DetID::TPC, DetID::TRD, DetID::TOF, DetID::PHS, DetID::CPV, DetID::EMC, - DetID::HMP, DetID::MFT, DetID::MCH, DetID::MID, DetID::ZDC, DetID::FIT, DetID::ACO, DetID::First, DetID::Last; + DetID::HMP, DetID::MFT, DetID::MCH, DetID::MID, DetID::ZDC, DetID::T0, DetID::ACO, DetID::First, DetID::Last; constexpr int DetID::nDetectors; diff --git a/DataFormats/Headers/include/Headers/DataHeader.h b/DataFormats/Headers/include/Headers/DataHeader.h index d748a009f479a..4b743139427ab 100644 --- a/DataFormats/Headers/include/Headers/DataHeader.h +++ b/DataFormats/Headers/include/Headers/DataHeader.h @@ -589,7 +589,7 @@ constexpr o2::header::DataOrigin gDataOriginACO{ "ACO" }; constexpr o2::header::DataOrigin gDataOriginCPV{ "CPV" }; constexpr o2::header::DataOrigin gDataOriginCTP{ "CTP" }; constexpr o2::header::DataOrigin gDataOriginEMC{ "EMC" }; -constexpr o2::header::DataOrigin gDataOriginFIT{ "FIT" }; +constexpr o2::header::DataOrigin gDataOriginT0{ "T0" }; constexpr o2::header::DataOrigin gDataOriginHMP{ "HMP" }; constexpr o2::header::DataOrigin gDataOriginITS{ "ITS" }; constexpr o2::header::DataOrigin gDataOriginMCH{ "MCH" }; diff --git a/Detectors/FIT/T0/simulation/src/Detector.cxx b/Detectors/FIT/T0/simulation/src/Detector.cxx index 2723440d205e8..e2d5880bc6750 100644 --- a/Detectors/FIT/T0/simulation/src/Detector.cxx +++ b/Detectors/FIT/T0/simulation/src/Detector.cxx @@ -34,7 +34,7 @@ using o2::t0::Geometry; ClassImp(Detector); Detector::Detector(Bool_t Active) - : o2::Base::DetImpl("FIT", Active), mIdSens1(0), mPMTeff(nullptr), mHits(o2::utils::createSimVector()) + : o2::Base::DetImpl("T0", Active), mIdSens1(0), mPMTeff(nullptr), mHits(o2::utils::createSimVector()) { // Gegeo = GetGeometry() ; @@ -384,7 +384,7 @@ void Detector::DefineOpticalProperties() const char* aliceO2env = std::getenv("O2_ROOT"); if (aliceO2env) inputDir = aliceO2env; - inputDir += "/share/Detectors/FIT/files/"; + inputDir += "/share/Detectors/T0/files/"; TString optPropPath = inputDir + "quartzOptProperties.txt"; optPropPath = gSystem->ExpandPathName(optPropPath.Data()); // Expand $(ALICE_ROOT) into real system path diff --git a/Detectors/FIT/T0/simulation/src/DigitizerTask.cxx b/Detectors/FIT/T0/simulation/src/DigitizerTask.cxx index ada15d5e5cdbe..7492dc367ab6f 100644 --- a/Detectors/FIT/T0/simulation/src/DigitizerTask.cxx +++ b/Detectors/FIT/T0/simulation/src/DigitizerTask.cxx @@ -22,7 +22,7 @@ ClassImp(o2::t0::DigitizerTask); using namespace o2::fit; using namespace o2::t0; -DigitizerTask::DigitizerTask() : FairTask("FITDigitizerTask"), mDigitizer() {} +DigitizerTask::DigitizerTask() : FairTask("T0DigitizerTask"), mDigitizer() {} DigitizerTask::~DigitizerTask() { if (mEventDigit) @@ -50,7 +50,7 @@ InitStatus DigitizerTask::Init() mDigitizer.setMCLabels(mMCTruthArrayPtr); // Register output container - mgr->RegisterAny("FITDigit", mEventDigit, kTRUE); + mgr->RegisterAny("FITT0Digit", mEventDigit, kTRUE); // mMCTruthArray = new typename std::remove_pointer::type; mgr->RegisterAny("FITDigitMCTruth", mMCTruthArrayPtr, kTRUE); mDigitizer.init(); diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx index fd16a3329e6d6..56c6760fcc0fb 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx @@ -8,19 +8,24 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// @brief Processor spec for a ROOT file writer for TOF digits +/// @brief Processor spec for a ROOT file writer for FIT T0&V0 digits #include "FITDigitWriterSpec.h" #include "Framework/CallbackService.h" #include "Framework/ControlService.h" -#include -#include -#include "TTree.h" -#include "TBranch.h" -#include "TFile.h" +#include "Framework/Task.h" #include "FITBase/Digit.h" +#include "Headers/DataHeader.h" +#include "DetectorsCommonDataFormats/DetID.h" +#include "SimulationDataFormat/MCTruthContainer.h" +#include "SimulationDataFormat/MCCompLabel.h" +#include +#include +#include #include // for make_shared, make_unique, unique_ptr #include +#include +#include using namespace o2::framework; using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType; @@ -30,88 +35,124 @@ namespace o2 namespace fit { -template -TBranch* getOrMakeBranch(TTree& tree, std::string brname, T* ptr) +class FITDPLDigitWriter { - if (auto br = tree.GetBranch(brname.c_str())) { - br->SetAddress(static_cast(&ptr)); - return br; + + using MCCont = o2::dataformats::MCTruthContainer; + + public: + void init(framework::InitContext& ic) + { + std::string detStrL = mID.getName(); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + + auto filename = ic.options().get((detStrL + "-digit-outfile").c_str()); + auto treename = ic.options().get("treename"); + + mOutFile = std::make_unique(filename.c_str(), "RECREATE"); + if (!mOutFile || mOutFile->IsZombie()) { + LOG(ERROR) << "Failed to open " << filename << " output file"; + } else { + LOG(INFO) << "Opened " << filename << " output file"; + } + mOutTree = std::make_unique(treename.c_str(), treename.c_str()); } - // otherwise make it - return tree.Branch(brname.c_str(), ptr); -} + void run(framework::ProcessingContext& pc) + { + if (mFinished) { + return; + } + std::string detStr = mID.getName(); + std::string detStrL = mID.getName(); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + + // retrieve the digits from the input + auto inDigits = pc.inputs().get>((detStr + "digits").c_str()); + // auto inROFs = pc.inputs().get>((detStr + "digitsROF").c_str()); + // auto inMC2ROFs = pc.inputs().get>((detStr + "digitsMC2ROF").c_str()); + // auto inLabels = pc.inputs().get((detStr + "digitsMCTR").c_str()); + LOG(INFO) << "RECEIVED DIGITS SIZE " << inDigits.size(); + + auto digitsP = &inDigits; + // auto labelsRaw = inLabels.get(); + // connect this to a particular branch + + auto brDig = getOrMakeBranch(*mOutTree.get(), (detStr + "Digit").c_str(), &digitsP); + // auto brLbl = getOrMakeBranch(*mOutTree.get(), (detStr + "DigitMCTruth").c_str(), &labelsRaw); + mOutTree->Fill(); + + mOutFile->cd(); + mOutTree->Write(); + mOutTree.reset(); // delete the tree before closing the file + mOutFile->Close(); + mFinished = true; + pc.services().get().readyToQuit(false); + } + + protected: + FITDPLDigitWriter() {} + template + TBranch* getOrMakeBranch(TTree& tree, std::string brname, T* ptr) + { + if (auto br = tree.GetBranch(brname.c_str())) { + br->SetAddress(static_cast(ptr)); + return br; + } + // otherwise make it + return tree.Branch(brname.c_str(), ptr); + } + + bool mFinished = false; + o2::detectors::DetID mID; + o2::header::DataOrigin mOrigin = o2::header::gDataOriginInvalid; + std::vector mDigits; // input digits + std::unique_ptr mOutFile; + std::unique_ptr mOutTree; +}; + +//_______________________________________________ +class T0DPLDigitWriter : public FITDPLDigitWriter +{ + public: + // FIXME: origina should be extractable from the DetID, the problem is 3d party header dependencies + static constexpr o2::detectors::DetID::ID DETID = o2::detectors::DetID::T0; + static constexpr o2::header::DataOrigin DETOR = o2::header::gDataOriginT0; + T0DPLDigitWriter() + { + mID = DETID; + mOrigin = DETOR; + } +}; + +constexpr o2::detectors::DetID::ID T0DPLDigitWriter::DETID; +constexpr o2::header::DataOrigin T0DPLDigitWriter::DETOR; + +//_______________________________________________ /// create the processor spec -/// TODO: replace by generic processor once this is working -DataProcessorSpec getFITDigitWriterSpec() +/// describing a processor receiving digits for ITS/MFT and writing them to file +DataProcessorSpec getT0DigitWriterSpec() { - auto initFunction = [](InitContext& ic) { - // get the option from the init context - auto filename = ic.options().get("fit-digit-outfile"); - auto treename = ic.options().get("treename"); + std::string detStr = o2::detectors::DetID::getName(T0DPLDigitWriter::DETID); + std::string detStrL = detStr; + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + auto detOrig = T0DPLDigitWriter::DETOR; - auto outputfile = std::make_shared(filename.c_str(), "RECREATE"); - auto outputtree = std::make_shared(treename.c_str(), treename.c_str()); - - // container for incoming digits - auto digits = std::make_shared>(); - - // the callback to be set as hook at stop of processing for the framework - auto finishWriting = [outputfile, outputtree]() { - outputtree->SetEntries(1); - outputtree->Write(); - outputfile->Close(); - }; - ic.services().get().set(CallbackService::Id::Stop, finishWriting); - - // setup the processing function - // using by-copy capture of the worker instance shared pointer - // the shared pointer makes sure to clean up the instance when the processing - // function gets out of scope - auto processingFct = [outputfile, outputtree, digits](ProcessingContext& pc) { - static bool finished = false; - if (finished) { - // avoid being executed again when marked as finished; - return; - } - - // retrieve the digits from the input - auto indata = pc.inputs().get>("fitdigits"); - LOG(INFO) << "RECEIVED DIGITS SIZE " << indata.size(); - *digits.get() = std::move(indata); - - // connect this to a particular branch - auto br = getOrMakeBranch(*outputtree.get(), "FITDigit", digits.get()); - br->Fill(); - - // retrieve labels from the input - //auto labeldata = pc.inputs().get*>("tofdigitlabels"); - //LOG(INFO) << "TOF GOT " << labeldata->getNElements() << " LABELS "; - //auto labeldataraw = labeldata.get(); - // connect this to a particular branch - //auto labelbr = getOrMakeBranch(*outputtree.get(), "TOFDigitMCTruth", &labeldataraw); - //labelbr->Fill(); - - finished = true; - pc.services().get().readyToQuit(false); - }; - - // return the actual processing function as a lambda function using variables - // of the init function - return processingFct; - }; + std::vector inputs; + inputs.emplace_back(InputSpec{ (detStr + "digits").c_str(), detOrig, "DIGITS", 0, Lifetime::Timeframe }); return DataProcessorSpec{ - "FITDigitWriter", - Inputs{ InputSpec{ "fitdigits", "FIT", "DIGITS", 0, Lifetime::Timeframe }, - /* InputSpec{ "tofdigitlabels", "TOF", "DIGITSMCTR", 0, Lifetime::Timeframe } */ }, + (detStr + "DigitWriter").c_str(), + inputs, {}, // no output - AlgorithmSpec(initFunction), + AlgorithmSpec(adaptFromTask()), Options{ - { "fit-digit-outfile", VariantType::String, "fitdigits.root", { "Name of the input file" } }, + { (detStrL + "-digit-outfile").c_str(), VariantType::String, (detStrL + "digits.root").c_str(), { "Name of the input file" } }, { "treename", VariantType::String, "o2sim", { "Name of top-level TTree" } }, } }; } + + } // end namespace fit } // end namespace o2 diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h index 8f828e5bfd40c..dda287ec48906 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h @@ -18,9 +18,10 @@ namespace o2 namespace fit { -o2::framework::DataProcessorSpec getFITDigitWriterSpec(); +o2::framework::DataProcessorSpec getT0DigitWriterSpec(); +//o2::framework::DataProcessorSpec getMFTDigitWriterSpec(); -} // end namespace tof +} // end namespace itsmft } // end namespace o2 - -#endif /* STEER_DIGITIZERWORKFLOW_FITDIGITWRITER_H_ */ + +#endif /* STEER_DIGITIZERWORKFLOW_ITSMFTDIGITWRITER_H_ */ diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index 703ac609d6670..5b36841d7c0a7 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -71,7 +71,7 @@ class FITDPLDigitizerTask mSimChains.back()->AddFile(signalfilename.c_str()); } - mT0Digitizer.init(); + if (mID == o2::detectors::DetID::T0) mT0Digitizer.init(); const bool isContinuous = ic.options().get("pileup"); // mT0Digitizer.setContinuous(isContinuous); // mT0Digitizer.setMCTruthContainer(labels.get()); @@ -117,7 +117,7 @@ class FITDPLDigitizerTask for (auto& part : eventParts[collID]) { // get the hits for this event and this source hits.clear(); - retrieveHits(mSimChains, "FITHit", part.sourceID, part.entryID, &hits); + retrieveHits(mSimChains, "FITT0Hit", part.sourceID, part.entryID, &hits); LOG(INFO) << "For collision " << collID << " eventID " << part.entryID << " found " << hits.size() << " hits "; // call actual digitization procedure @@ -147,10 +147,10 @@ class FITDPLDigitizerTask // LOG(INFO) << "Have " << labelAccum.getNElements() << " TOF labels "; // here we have all digits and we can send them to consumer (aka snapshot it onto output) - pc.outputs().snapshot(Output{ "FIT", "DIGITS", 0, Lifetime::Timeframe }, digitAccum); + pc.outputs().snapshot(Output{ mOrigin, "DIGITS", 0, Lifetime::Timeframe }, digitAccum); // pc.outputs().snapshot(Output{ "FIT", "DIGITSMCTR", 0, Lifetime::Timeframe }, labelAccum); LOG(INFO) << "FIT: Sending ROMode= " << mROMode << " to GRPUpdater"; - pc.outputs().snapshot(Output{ "FIT", "ROMode", 0, Lifetime::Timeframe }, mROMode); + pc.outputs().snapshot(Output{ mOrigin, "ROMode", 0, Lifetime::Timeframe }, mROMode); timer.Stop(); LOG(INFO) << "Digitization took " << timer.CpuTime() << "s"; @@ -159,10 +159,12 @@ class FITDPLDigitizerTask finished = true; } - private: + // private: + protected: Bool_t mContinuous = kFALSE; ///< flag to do continuous simulation double mFairTimeUnitInNS = 1; ///< Fair time unit in ns - + o2::detectors::DetID mID; + o2::header::DataOrigin mOrigin = o2::header::gDataOriginInvalid; Digitizer mT0Digitizer{ o2::t0::T0DigitizationParameters() }; ///< Digitizer //Digitizer mV0Digitizer; ///< Digitizer // RS: at the moment using hardcoded flag for continuos readout @@ -171,18 +173,37 @@ class FITDPLDigitizerTask std::vector mSimChains; }; -o2::framework::DataProcessorSpec getFITDigitizerSpec(int channel) +//_______________________________________________ +class FITT0DPLDigitizerTask : public FITDPLDigitizerTask +{ + public: + // FIXME: origina should be extractable from the DetID, the problem is 3d party header dependencies + static constexpr o2::detectors::DetID::ID DETID = o2::detectors::DetID::T0; + static constexpr o2::header::DataOrigin DETOR = o2::header::gDataOriginT0; + FITT0DPLDigitizerTask() + { + mID = DETID; + mOrigin = DETOR; + } +}; + +constexpr o2::detectors::DetID::ID FITT0DPLDigitizerTask::DETID; +constexpr o2::header::DataOrigin FITT0DPLDigitizerTask::DETOR; + +o2::framework::DataProcessorSpec getFITT0DigitizerSpec(int channel) { // create the full data processor spec using // a name identifier // input description // algorithmic description (here a lambda getting called once to setup the actual processing function) // options that can be used for this processor (here: input file names where to take the hits) - return DataProcessorSpec{ - "FITDigitizer", Inputs{ InputSpec{ "collisioncontext", "SIM", "COLLISIONCONTEXT", static_cast(channel), Lifetime::Timeframe } }, - Outputs{ OutputSpec{ "FIT", "DIGITS", 0, Lifetime::Timeframe }, - /*OutputSpec{ "FIT", "DIGITSMCTR", 0, Lifetime::Timeframe }*/ - OutputSpec{ "FIT", "ROMode", 0, Lifetime::Timeframe } }, + std::string detStr = o2::detectors::DetID::getName(FITT0DPLDigitizerTask::DETID); + auto detOrig = FITT0DPLDigitizerTask::DETOR; + return DataProcessorSpec{ (detStr + "Digitizer").c_str(), + Inputs{ InputSpec{ "collisioncontext", "SIM", "COLLISIONCONTEXT", static_cast(channel), Lifetime::Timeframe } }, + Outputs{ OutputSpec{ detOrig, "DIGITS", 0, Lifetime::Timeframe }, + /*OutputSpec{ detOrig "FIT", "DIGITSMCTR", 0, Lifetime::Timeframe }*/ + OutputSpec{ detOrig, "ROMode", 0, Lifetime::Timeframe } }, AlgorithmSpec{ adaptFromTask() }, Options{ { "simFile", VariantType::String, "o2sim.root", { "Sim (background) input filename" } }, { "simFileS", VariantType::String, "", { "Sim (signal) input filename" } }, diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.h b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.h index bcf4c4eabde02..b47d0148ebab1 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.h +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.h @@ -18,7 +18,8 @@ namespace o2 namespace fit { -o2::framework::DataProcessorSpec getFITDigitizerSpec(int channel); +o2::framework::DataProcessorSpec getFITT0DigitizerSpec(int channel); +//o2::framework::DataProcessorSpec getFITV0DigitizerSpec(int channel); } // end namespace fit } // end namespace o2 diff --git a/Steer/DigitizerWorkflow/src/GRPUpdaterSpec.cxx b/Steer/DigitizerWorkflow/src/GRPUpdaterSpec.cxx index 5c6c93b01dba2..55d87e7b49079 100644 --- a/Steer/DigitizerWorkflow/src/GRPUpdaterSpec.cxx +++ b/Steer/DigitizerWorkflow/src/GRPUpdaterSpec.cxx @@ -87,7 +87,7 @@ o2::framework::DataProcessorSpec getGRPUpdaterSpec(const std::vectorAddModule(new o2::phos::Detector(true)); } - if (isActivated("FIT")) { + if (isActivated("T0")) { // FIT run->AddModule(new o2::t0::Detector(true)); } diff --git a/run/O2HitMerger.h b/run/O2HitMerger.h index c598f38b93c95..84b48fc5d7da8 100644 --- a/run/O2HitMerger.h +++ b/run/O2HitMerger.h @@ -466,7 +466,7 @@ void O2HitMerger::initDetInstances() mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } - if (i == DetID::FIT) { + if (i == DetID::T0) { mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } From 2e5709a471428c94b60233f6caa6795bcef6c864 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Wed, 23 Jan 2019 21:26:36 +0100 Subject: [PATCH 03/25] move Hit to common --- Detectors/FIT/T0/base/CMakeLists.txt | 1 - .../include/T0Simulation/Detector.h | 30 +----- .../include/T0Simulation/DigitizerTask.h | 2 +- Detectors/FIT/T0/simulation/src/Detector.cxx | 6 +- .../T0/simulation/src/T0SimulationLinkDef.h | 4 +- .../include/FITSimulation/Digitizer.h | 2 +- .../include/FITSimulation/HitType.h | 30 ++++++ .../FIT/common/simulation/src/Digitizer.cxx | 6 +- .../simulation/src/FITSimulationLinkDef.h | 2 + .../include/FITSimulation/MCLabel.h~HEAD | 39 ++++++++ ...h~e6c90292b4ea1ca164bf869789a6c1755aac715a | 39 ++++++++ .../src/FITDigitWriterSpec.cxx | 3 +- .../src/FITDigitizerSpec.cxx | 91 +++++++++++-------- 13 files changed, 183 insertions(+), 72 deletions(-) create mode 100644 Detectors/FIT/common/simulation/include/FITSimulation/HitType.h create mode 100644 Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD create mode 100644 Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a diff --git a/Detectors/FIT/T0/base/CMakeLists.txt b/Detectors/FIT/T0/base/CMakeLists.txt index 968e4b262374c..f4ce749ff13cd 100644 --- a/Detectors/FIT/T0/base/CMakeLists.txt +++ b/Detectors/FIT/T0/base/CMakeLists.txt @@ -10,7 +10,6 @@ set(HEADERS include/${MODULE_NAME}/Geometry.h ) - Set(LINKDEF src/T0BaseLinkDef.h) Set(LIBRARY_NAME ${MODULE_NAME}) set(BUCKET_NAME fit_base_bucket) diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index f87e5fb7ad52b..41c2b8617cf2a 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -17,7 +17,8 @@ #include "SimulationDataFormat/BaseHits.h" #include "DetectorsBase/Detector.h" // for Detector #include "T0Base/Geometry.h" -#include "CommonUtils/ShmAllocator.h" +//#include "CommonUtils/ShmAllocator.h" +#include "FITSimulation/HitType.h" class FairModule; @@ -25,27 +26,6 @@ class FairVolume; class TGeoVolume; class TGraph; -namespace o2 -{ -namespace t0 -{ -class HitType : public o2::BasicXYZEHit -{ - public: - using BasicXYZEHit::BasicXYZEHit; -}; -} // namespace t0 -} // namespace o2 - -#ifdef USESHM -namespace std -{ -template <> -class allocator : public o2::utils::ShmAllocator -{ -}; -} // namespace std -#endif namespace o2 { @@ -91,11 +71,11 @@ class Detector : public o2::Base::DetImpl /// This method is called for each step during simulation (see FairMCApplication::Stepping()) Bool_t ProcessHits(FairVolume* v) override; - HitType* AddHit(float x, float y, float z, float time, float energy, Int_t trackId, Int_t detId); + o2::fit::HitType* AddHit(float x, float y, float z, float time, float energy, Int_t trackId, Int_t detId); void Register() override; - std::vector* getHits(Int_t iColl) + std::vector* getHits(Int_t iColl) { if (iColl == 0) { return mHits; @@ -151,7 +131,7 @@ class Detector : public o2::Base::DetImpl std::vector mReflMet; /// Container for data points - std::vector* mHits = nullptr; + std::vector* mHits = nullptr; /// Define the sensitive volumes of the geometry void defineSensitiveVolumes(); diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index a15647de1606c..360745ee24090 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -60,7 +60,7 @@ class DigitizerTask : public FairTask const std::vector* mHitsArray = nullptr; ///< Array of MC hits TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions - const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED + const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) int mLastQEDEntry = -1; ///< last used QED entry diff --git a/Detectors/FIT/T0/simulation/src/Detector.cxx b/Detectors/FIT/T0/simulation/src/Detector.cxx index e2d5880bc6750..47b0ac34afcd4 100644 --- a/Detectors/FIT/T0/simulation/src/Detector.cxx +++ b/Detectors/FIT/T0/simulation/src/Detector.cxx @@ -34,7 +34,7 @@ using o2::t0::Geometry; ClassImp(Detector); Detector::Detector(Bool_t Active) - : o2::Base::DetImpl("T0", Active), mIdSens1(0), mPMTeff(nullptr), mHits(o2::utils::createSimVector()) + : o2::Base::DetImpl ("T0", Active), mIdSens1(0), mPMTeff(nullptr), mHits(o2::utils::createSimVector()) { // Gegeo = GetGeometry() ; @@ -43,7 +43,7 @@ Detector::Detector(Bool_t Active) } Detector::Detector(const Detector& rhs) - : o2::Base::DetImpl(rhs), mIdSens1(rhs.mIdSens1), mPMTeff(rhs.mPMTeff), mHits(o2::utils::createSimVector()) + : o2::Base::DetImpl (rhs), mIdSens1(rhs.mIdSens1), mPMTeff(rhs.mPMTeff), mHits(o2::utils::createSimVector()) { } @@ -309,7 +309,7 @@ Bool_t Detector::ProcessHits(FairVolume* v) return kFALSE; } -HitType* Detector::AddHit(float x, float y, float z, float time, float energy, Int_t trackId, Int_t detId) +o2::fit::HitType* Detector::AddHit(float x, float y, float z, float time, float energy, Int_t trackId, Int_t detId) { mHits->emplace_back(x, y, z, time, energy, trackId, detId); auto stack = (o2::Data::Stack*)fMC->GetStack(); diff --git a/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h b/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h index 68a389ba8d0d1..5c8b19e609955 100644 --- a/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h +++ b/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h @@ -16,8 +16,8 @@ #pragma link C++ class o2::t0::Detector + ; //#pragma link C++ class o2::t0::DigitizerTask + ; -#pragma link C++ class o2::t0::HitType + ; -#pragma link C++ class vector < o2::t0::HitType > +; +//#pragma link C++ class o2::t0::HitType + ; +//#pragma link C++ class vector < o2::t0::HitType > +; #pragma link C++ class o2::Base::DetImpl < o2::t0::Detector > +; diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h index 8e02e50d4e92f..4882ab2a9217c 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h @@ -29,7 +29,7 @@ class Digitizer ~Digitizer() = default; //void process(const std::vector* hits, std::vector* digits); - void process(const std::vector* hits, Digit* digit); + void process(const std::vector* hits, Digit* digit); void initParameters(); // void printParameters(); diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h new file mode 100644 index 0000000000000..a964c15100457 --- /dev/null +++ b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h @@ -0,0 +1,30 @@ +#ifndef ALICEO2_FIT_HITTYPE_H_ +#define ALICEO2_FIT_HITTYPE_H_ + +#include "SimulationDataFormat/BaseHits.h" +#include "SimulationDataFormat/Stack.h" +#include "CommonUtils/ShmAllocator.h" + +namespace o2 +{ +namespace fit +{ +class HitType : public o2::BasicXYZEHit +{ + public: + using BasicXYZEHit::BasicXYZEHit; +}; +} // namespace t0 +} // namespace o2 + +#endif + +#ifdef USESHM +namespace std +{ + template <> + class allocator : public o2::utils::ShmAllocator +{ +}; +} // namespace std +#endif diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index 9e982f9be7688..bea8b29b3eeff 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -24,7 +24,7 @@ using namespace o2::fit; ClassImp(Digitizer); -void Digitizer::process(const std::vector* hits, Digit* digit) +void Digitizer::process(const std::vector* hits, Digit* digit) { //parameters constants TO DO: move to class @@ -204,7 +204,9 @@ void Digitizer::initParameters() // murmur } //_______________________________________________________________________ -void Digitizer::init() {} +void Digitizer::init() { + std::cout<<" @@@ Digitizer::init "< +; //#pragma link C++ class o2::fit::MCLabel + ; #pragma link C++ class o2::dataformats::MCTruthContainer < o2::fit::MCLabel > +; #pragma link C++ class o2::Base::DetImpl < o2::fit::Detector > +; diff --git a/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD b/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD new file mode 100644 index 0000000000000..7a82415ec5e08 --- /dev/null +++ b/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD @@ -0,0 +1,39 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// Declaration of a transient MC label class for FIT + +#ifndef ALICEO2_FIT_MCLABEL_H_ +#define ALICEO2_FIT_MCLABEL_H_ + +#include "SimulationDataFormat/MCCompLabel.h" + +namespace o2 +{ +namespace fit +{ +class MCLabel : public o2::MCCompLabel +{ + private: + Int_t mDetID = -1; + + public: + MCLabel() = default; + MCLabel(Int_t trackID, Int_t eventID, Int_t srcID, Int_t qID) + : o2::MCCompLabel(trackID, eventID, srcID), mDetID(qID) {} + + Int_t getDetID() const { return mDetID; } + + ClassDefNV(MCLabel, 1); +}; +} // namespace fit +} // namespace o2 + +#endif diff --git a/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a b/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a new file mode 100644 index 0000000000000..7a82415ec5e08 --- /dev/null +++ b/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a @@ -0,0 +1,39 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// Declaration of a transient MC label class for FIT + +#ifndef ALICEO2_FIT_MCLABEL_H_ +#define ALICEO2_FIT_MCLABEL_H_ + +#include "SimulationDataFormat/MCCompLabel.h" + +namespace o2 +{ +namespace fit +{ +class MCLabel : public o2::MCCompLabel +{ + private: + Int_t mDetID = -1; + + public: + MCLabel() = default; + MCLabel(Int_t trackID, Int_t eventID, Int_t srcID, Int_t qID) + : o2::MCCompLabel(trackID, eventID, srcID), mDetID(qID) {} + + Int_t getDetID() const { return mDetID; } + + ClassDefNV(MCLabel, 1); +}; +} // namespace fit +} // namespace o2 + +#endif diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx index 56c6760fcc0fb..74b8524c965f7 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx @@ -44,10 +44,11 @@ class FITDPLDigitWriter void init(framework::InitContext& ic) { std::string detStrL = mID.getName(); - std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); auto filename = ic.options().get((detStrL + "-digit-outfile").c_str()); auto treename = ic.options().get("treename"); + std::cout<<" @@@ FITDPLDigitWriter " <(filename.c_str(), "RECREATE"); if (!mOutFile || mOutFile->IsZombie()) { diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index 5b36841d7c0a7..8a75a14bca3de 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -14,16 +14,17 @@ #include "Framework/DataRefUtils.h" #include "Framework/Lifetime.h" #include "Headers/DataHeader.h" -#include "TStopwatch.h" #include "Steer/HitProcessingManager.h" // for RunContext -#include "TChain.h" #include "FITSimulation/Digitizer.h" #include "T0Simulation/DigitizationParameters.h" -#include -#include +#include "FITBase/Digit.h" +#include "SimulationDataFormat/MCCompLabel.h" +#include "SimulationDataFormat/MCTruthContainer.h" #include "Framework/Task.h" -#include #include "DataFormatsParameters/GRPObject.h" +#include +#include +#include using namespace o2::framework; using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType; @@ -32,46 +33,37 @@ namespace o2 { namespace fit { - // helper function which will be offered as a service -template -void retrieveHits(std::vector const& chains, - const char* brname, - int sourceID, - int entryID, - std::vector* hits) -{ - auto br = chains[sourceID]->GetBranch(brname); - if (!br) { - LOG(ERROR) << "No branch found"; - return; - } - br->SetAddress(&hits); - br->GetEntry(entryID); -} +//template class FITDPLDigitizerTask { + public: FITDPLDigitizerTask() = default; ~FITDPLDigitizerTask() = default; void init(framework::InitContext& ic) { + std::cout<<" @@@@ init "<AddFile(ic.options().get("simFile").c_str()); - + std::cout<<" @@@@@ sim file "<< ic.options().get("simFile").c_str() << std::endl; // maybe add a particular signal file auto signalfilename = ic.options().get("simFileS"); if (signalfilename.size() > 0) { mSimChains.emplace_back(new TChain("o2sim")); mSimChains.back()->AddFile(signalfilename.c_str()); } - - if (mID == o2::detectors::DetID::T0) mT0Digitizer.init(); + static constexpr o2::detectors::DetID::ID DETID = o2::detectors::DetID::T0; + std::cout << " o2::detectors::DetID::T0 " << mID.getName() << std::endl; + if (mID == o2::detectors::DetID::T0) { + mT0Digitizer.init(); + std::cout << " @@@@ mT0Digitizer.init" << std::endl; + } const bool isContinuous = ic.options().get("pileup"); // mT0Digitizer.setContinuous(isContinuous); // mT0Digitizer.setMCTruthContainer(labels.get()); @@ -79,10 +71,13 @@ class FITDPLDigitizerTask void run(framework::ProcessingContext& pc) { + static bool finished = false; if (finished) { return; } + std::string detStr = mID.getName(); + std::cout << " @@@@ run !!!!!!! " << detStr << std::endl; // read collision context from input auto context = pc.inputs().get("collisioncontext"); @@ -98,7 +93,7 @@ class FITDPLDigitizerTask LOG(INFO) << "CALLING FIT DIGITIZATION"; - static std::vector hits; + static std::vector hits; o2::dataformats::MCTruthContainer labelAccum; o2::dataformats::MCTruthContainer labels; o2::fit::Digit digit; @@ -114,10 +109,11 @@ class FITDPLDigitizerTask digit.cleardigits(); // for each collision, loop over the constituents event and source IDs // (background signal merging is basically taking place here) + std::cout << " @@@@ mOrigin " << mOrigin << " mID " << mID.getName() << std::endl; for (auto& part : eventParts[collID]) { // get the hits for this event and this source hits.clear(); - retrieveHits(mSimChains, "FITT0Hit", part.sourceID, part.entryID, &hits); + retrieveHits(mSimChains, "T0Hit", part.sourceID, part.entryID, &hits); LOG(INFO) << "For collision " << collID << " eventID " << part.entryID << " found " << hits.size() << " hits "; // call actual digitization procedure @@ -149,7 +145,7 @@ class FITDPLDigitizerTask // here we have all digits and we can send them to consumer (aka snapshot it onto output) pc.outputs().snapshot(Output{ mOrigin, "DIGITS", 0, Lifetime::Timeframe }, digitAccum); // pc.outputs().snapshot(Output{ "FIT", "DIGITSMCTR", 0, Lifetime::Timeframe }, labelAccum); - LOG(INFO) << "FIT: Sending ROMode= " << mROMode << " to GRPUpdater"; + LOG(INFO) << "FIT: " << mID.getName() << " Sending ROMode= " << mROMode << " to GRPUpdater"; pc.outputs().snapshot(Output{ mOrigin, "ROMode", 0, Lifetime::Timeframe }, mROMode); timer.Stop(); LOG(INFO) << "Digitization took " << timer.CpuTime() << "s"; @@ -171,9 +167,28 @@ class FITDPLDigitizerTask o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::CONTINUOUS; // readout mode std::vector mSimChains; + + void retrieveHits(std::vector const& chains, + const char* brname, + int sourceID, + int entryID, + std::vector* hits) + { + std::string detStr = mID.getName(); + std::cout << "@@@@ retrieveHit " << detStr << std::endl; + auto br = mSimChains[sourceID]->GetBranch((detStr + "Hit").c_str()); + // auto br = chains[sourceID]->GetBranch(brname); + std::cout << " @@@@ " << brname << " " << sourceID << " " << entryID << " size " << hits->size() << std::endl; + + if (!br) { + LOG(ERROR) << "No branch found"; + return; + } + br->SetAddress(&hits); + br->GetEntry(entryID); + } }; -//_______________________________________________ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask { public: @@ -184,6 +199,7 @@ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask { mID = DETID; mOrigin = DETOR; + std::cout << " @@@@ DETOR FITT0DPLDigitizerTask " << mOrigin << " " << mID.getName() << std::endl; } }; @@ -199,15 +215,18 @@ o2::framework::DataProcessorSpec getFITT0DigitizerSpec(int channel) // options that can be used for this processor (here: input file names where to take the hits) std::string detStr = o2::detectors::DetID::getName(FITT0DPLDigitizerTask::DETID); auto detOrig = FITT0DPLDigitizerTask::DETOR; - return DataProcessorSpec{ (detStr + "Digitizer").c_str(), - Inputs{ InputSpec{ "collisioncontext", "SIM", "COLLISIONCONTEXT", static_cast(channel), Lifetime::Timeframe } }, - Outputs{ OutputSpec{ detOrig, "DIGITS", 0, Lifetime::Timeframe }, + std::cout << "@@@@ getFITT0DigitizerSpec " << detStr << " dteOrig " <(channel), Lifetime::Timeframe } }, + Outputs{ OutputSpec{ detOrig, "DIGITS", 0, Lifetime::Timeframe }, /*OutputSpec{ detOrig "FIT", "DIGITSMCTR", 0, Lifetime::Timeframe }*/ - OutputSpec{ detOrig, "ROMode", 0, Lifetime::Timeframe } }, - AlgorithmSpec{ adaptFromTask() }, - Options{ { "simFile", VariantType::String, "o2sim.root", { "Sim (background) input filename" } }, - { "simFileS", VariantType::String, "", { "Sim (signal) input filename" } }, - { "pileup", VariantType::Int, 1, { "whether to run in continuous time mode" } } } + OutputSpec{ detOrig, "ROMode", 0, Lifetime::Timeframe } }, + AlgorithmSpec{ adaptFromTask() }, + Options{ { "simFile", VariantType::String, "o2sim.root", { "Sim (background) input filename" } }, + { "simFileS", VariantType::String, "", { "Sim (signal) input filename" } }, + { "pileup", VariantType::Int, 1, { "whether to run in continuous time mode" } } } + // I can't use VariantType::Bool as it seems to have a problem }; } From 9abcec91014a43e54464f31483334ab6a3fd2fd8 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sat, 26 Jan 2019 20:58:19 +0100 Subject: [PATCH 04/25] T0 digitzation as a part of FIT --- .../include/T0Simulation/Detector.h | 1 - .../T0Simulation/DigitizationParameters.h | 1 + .../include/T0Simulation/DigitizerTask.h | 10 +-- Detectors/FIT/T0/simulation/src/Detector.cxx | 4 +- .../FIT/common/base/include/FITBase/Digit.h | 4 +- .../FITSimulation/DigitizationParameters.h | 1 + .../include/FITSimulation/Digitizer.h | 9 +- .../include/FITSimulation/HitType.h | 6 +- .../FIT/common/simulation/src/Digitizer.cxx | 83 +++++++++---------- .../src/FITDigitWriterSpec.cxx | 7 +- .../src/FITDigitWriterSpec.h | 4 +- .../src/FITDigitizerSpec.cxx | 47 +++++------ 12 files changed, 81 insertions(+), 96 deletions(-) diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index 41c2b8617cf2a..bc3d81a3db7d2 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -26,7 +26,6 @@ class FairVolume; class TGeoVolume; class TGraph; - namespace o2 { namespace t0 diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h index dda2b551feaec..a90adc1216d37 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h @@ -19,6 +19,7 @@ inline o2::fit::DigitizationParameters T0DigitizationParameters() result.mTime_trg_gate = 4.; // ns result.mAmpThreshold = 100; // number of photoelectrons result.mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); + result.mIsT0 = true; return result; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index 360745ee24090..dd10eb5712ab7 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -59,12 +59,12 @@ class DigitizerTask : public FairTask Digitizer mDigitizer; ///< Digitizer const std::vector* mHitsArray = nullptr; ///< Array of MC hits - TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions + TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED - float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. - double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) - int mLastQEDEntry = -1; ///< last used QED entry - UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) + float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. + double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) + int mLastQEDEntry = -1; ///< last used QED entry + UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) o2::fit::Digit* mEventDigit = nullptr; o2::dataformats::MCTruthContainer mMCTruthArray; //! Labels containter diff --git a/Detectors/FIT/T0/simulation/src/Detector.cxx b/Detectors/FIT/T0/simulation/src/Detector.cxx index 47b0ac34afcd4..6c7ec8bb9bc26 100644 --- a/Detectors/FIT/T0/simulation/src/Detector.cxx +++ b/Detectors/FIT/T0/simulation/src/Detector.cxx @@ -34,7 +34,7 @@ using o2::t0::Geometry; ClassImp(Detector); Detector::Detector(Bool_t Active) - : o2::Base::DetImpl ("T0", Active), mIdSens1(0), mPMTeff(nullptr), mHits(o2::utils::createSimVector()) + : o2::Base::DetImpl("T0", Active), mIdSens1(0), mPMTeff(nullptr), mHits(o2::utils::createSimVector()) { // Gegeo = GetGeometry() ; @@ -43,7 +43,7 @@ Detector::Detector(Bool_t Active) } Detector::Detector(const Detector& rhs) - : o2::Base::DetImpl (rhs), mIdSens1(rhs.mIdSens1), mPMTeff(rhs.mPMTeff), mHits(o2::utils::createSimVector()) + : o2::Base::DetImpl(rhs), mIdSens1(rhs.mIdSens1), mPMTeff(rhs.mPMTeff), mHits(o2::utils::createSimVector()) { } diff --git a/Detectors/FIT/common/base/include/FITBase/Digit.h b/Detectors/FIT/common/base/include/FITBase/Digit.h index f2e17419a4b36..430371fd41dff 100644 --- a/Detectors/FIT/common/base/include/FITBase/Digit.h +++ b/Detectors/FIT/common/base/include/FITBase/Digit.h @@ -24,7 +24,8 @@ struct ChannelData { Int_t ChId; //channel Id Double_t CFDTime; //time in ns, 0 at lhc clk center Double_t QTCAmpl; // Amplitude in mips - ClassDefNV(ChannelData, 1); + int numberOfParticles; + ClassDefNV(ChannelData, 2); }; /// \class Digit @@ -71,6 +72,7 @@ class Digit : public DigitBase } const std::vector& getChDgData() const { return mChDgDataArr; } + std::vector& getChDgData() { return mChDgDataArr; } void setChDgData(const std::vector& ChDgDataArr) { mChDgDataArr = ChDgDataArr; } void setChDgData(std::vector&& ChDgDataArr) { mChDgDataArr = std::move(ChDgDataArr); } diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h index 8607a4d1849ab..6c10e0fc74821 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h @@ -16,6 +16,7 @@ struct DigitizationParameters { Float_t mTime_trg_gate; // ns Int_t mAmpThreshold; // number of photoelectrons Float_t mTimeDiffAC; + bool mIsT0; //amplitude T0(true) or V0 (false) }; } // namespace o2::fit #endif diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h index 4882ab2a9217c..693b77f2e8fbd 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h @@ -30,6 +30,7 @@ class Digitizer //void process(const std::vector* hits, std::vector* digits); void process(const std::vector* hits, Digit* digit); + void computeAverage(Digit& digit); void initParameters(); // void printParameters(); @@ -58,14 +59,6 @@ class Digitizer Double_t mEventTime; // timestamp DigitizationParameters parameters; - /* - Float_t mBC_clk_center = 12.5; // clk center - Int_t mMCPs = (Geometry::NCellsA + Geometry::NCellsC) * 4; //number of MCPs - Float_t mCFD_trsh_mip = 0.4; // = 4[mV] / 10[mV/mip] - Float_t mTime_trg_gate = 4.; // ns - Int_t mAmpThreshold = 100; // number of photoelectrons - Float_t mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); - */ o2::dataformats::MCTruthContainer* mMCLabels = nullptr; diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h index a964c15100457..0290970a94084 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h @@ -14,7 +14,7 @@ class HitType : public o2::BasicXYZEHit public: using BasicXYZEHit::BasicXYZEHit; }; -} // namespace t0 +} // namespace fit } // namespace o2 #endif @@ -22,8 +22,8 @@ class HitType : public o2::BasicXYZEHit #ifdef USESHM namespace std { - template <> - class allocator : public o2::utils::ShmAllocator +template <> +class allocator : public o2::utils::ShmAllocator { }; } // namespace std diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index bea8b29b3eeff..c33fb9763e866 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -28,10 +28,9 @@ void Digitizer::process(const std::vector* hits, Digit* digit) { //parameters constants TO DO: move to class - constexpr Float_t C_side_cable_cmps = 2.8; //ns - constexpr Float_t A_side_cable_cmps = 11.; //ns - constexpr Float_t signal_width = 5.; // time gate for signal, ns - constexpr Float_t nPe_in_mip = 250.; // n ph. e. in one mip + constexpr Float_t C_side_cable_cmps = 2.877; //ns + constexpr Float_t A_side_cable_cmps = 11.08; //ns + constexpr Float_t signal_width = 5.; // time gate for signal, ns Int_t nlbl = 0; //number of MCtrues @@ -40,11 +39,13 @@ void Digitizer::process(const std::vector* hits, Digit* digit) digit->setOrbit(mOrbit); //Calculating signal time, amplitude in mean_time +- time_gate -------------- - Double_t cfd[300] = {}; - Float_t amp[300] = {}; - Int_t ch_signal_nPe[300] = {}; - Double_t ch_signal_MIP[300] = {}; - Double_t ch_signal_time[300] = {}; + std::vector& channel_data = digit->getChDgData(); + if (channel_data.size() == 0) { + channel_data.reserve(parameters.mMCPs); + for (int i = 0; i < parameters.mMCPs; ++i) + channel_data.emplace_back(ChannelData{ i, 0, 0, 0 }); + } + assert(digit->getChDgData().size() == parameters.mMCPs); for (auto& hit : *hits) { Int_t hit_ch = hit.GetDetectorID(); Double_t hit_time = hit.GetTime(); @@ -56,9 +57,10 @@ void Digitizer::process(const std::vector* hits, Digit* digit) Double_t hit_time_corr = hit_time - time_compensate /* + mBC_clk_center + mEventTime*/; - if (/*is_time_in_gate &&*/ is_hit_in_signal_gate) { - ch_signal_nPe[hit_ch]++; - ch_signal_time[hit_ch] += hit_time_corr; + if (is_hit_in_signal_gate) { + channel_data[hit_ch].numberOfParticles++; + channel_data[hit_ch].QTCAmpl += hit.GetEnergyLoss(); + channel_data[hit_ch].CFDTime += hit_time_corr; } //charge particles in MCLabel @@ -72,37 +74,24 @@ void Digitizer::process(const std::vector* hits, Digit* digit) } } } +} - // sum different sources - std::vector mChDgDataArr; - for (const auto& d : digit->getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime; - amp[mcp] = d.QTCAmpl; - } - - for (Int_t ch_iter = 0; ch_iter < parameters.mMCPs; ch_iter++) { - if (ch_signal_nPe[ch_iter] != 0) { - ch_signal_MIP[ch_iter] = amp[ch_iter] + ch_signal_nPe[ch_iter] / nPe_in_mip; - if (cfd[ch_iter] > 0) { - cfd[ch_iter] = cfd[ch_iter] - parameters.mBC_clk_center - mEventTime; - ch_signal_time[ch_iter] = ((cfd[ch_iter] + ch_signal_time[ch_iter] / (float)ch_signal_nPe[ch_iter]) / 2.) + parameters.mBC_clk_center + mEventTime; - } else - ch_signal_time[ch_iter] = (ch_signal_time[ch_iter] / (float)ch_signal_nPe[ch_iter]) + parameters.mBC_clk_center + mEventTime; - - if (ch_signal_MIP[ch_iter] > parameters.mCFD_trsh_mip) { - LOG(DEBUG) << ch_iter << " : " - << " : " << ch_signal_time[ch_iter] - parameters.mBC_clk_center - mEventTime << " : " - << ch_signal_MIP[ch_iter] << " : " << mEventTime << " cfd " << cfd[ch_iter] << FairLogger::endl; - mChDgDataArr.emplace_back(ChannelData{ ch_iter, ch_signal_time[ch_iter], ch_signal_MIP[ch_iter] }); - } else { - ch_signal_MIP[ch_iter] = 0; - ch_signal_time[ch_iter] = 0; - } - } +void Digitizer::computeAverage(Digit& digit) +{ + constexpr Float_t nPe_in_mip = 250.; // n ph. e. in one mip + auto& channel_data = digit.getChDgData(); + for (auto& ch_data : channel_data) { + if (ch_data.numberOfParticles == 0) + continue; + ch_data.CFDTime /= ch_data.numberOfParticles; + if (parameters.mIsT0) + ch_data.QTCAmpl = ch_data.numberOfParticles / nPe_in_mip; } - - digit->setChDgData(std::move(mChDgDataArr)); + channel_data.erase(std::remove_if(channel_data.begin(), channel_data.end(), + [this](ChannelData const& ch_data) { + return ch_data.QTCAmpl < parameters.mCFD_trsh_mip; + }), + channel_data.end()); } //------------------------------------------------------------------------ @@ -112,11 +101,12 @@ void Digitizer::smearCFDtime(Digit* digit) std::vector mChDgDataArr; for (const auto& d : digit->getChDgData()) { Int_t mcp = d.ChId; - Double_t cfd = d.CFDTime - parameters.mBC_clk_center - mEventTime; + Double_t cfd = d.CFDTime; Float_t amp = d.QTCAmpl; + int numpart = d.numberOfParticles; if (amp > parameters.mCFD_trsh_mip) { Double_t smeared_time = gRandom->Gaus(cfd, 0.050) + parameters.mBC_clk_center + mEventTime; - mChDgDataArr.emplace_back(ChannelData{ mcp, smeared_time, amp }); + mChDgDataArr.emplace_back(ChannelData{ mcp, smeared_time, amp, numpart }); } } digit->setChDgData(std::move(mChDgDataArr)); @@ -143,7 +133,7 @@ void Digitizer::setTriggers(Digit* digit) Float_t amp[300] = {}; for (const auto& d : digit->getChDgData()) { Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime - parameters.mBC_clk_center - mEventTime; + cfd[mcp] = d.CFDTime; amp[mcp] = d.QTCAmpl; if (amp[mcp] < parameters.mCFD_trsh_mip) continue; @@ -204,8 +194,9 @@ void Digitizer::initParameters() // murmur } //_______________________________________________________________________ -void Digitizer::init() { - std::cout<<" @@@ Digitizer::init "< // for make_shared, make_unique, unique_ptr #include #include -#include +#include using namespace o2::framework; using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType; @@ -44,11 +44,11 @@ class FITDPLDigitWriter void init(framework::InitContext& ic) { std::string detStrL = mID.getName(); - std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); auto filename = ic.options().get((detStrL + "-digit-outfile").c_str()); auto treename = ic.options().get("treename"); - std::cout<<" @@@ FITDPLDigitWriter " <(filename.c_str(), "RECREATE"); if (!mOutFile || mOutFile->IsZombie()) { @@ -154,6 +154,5 @@ DataProcessorSpec getT0DigitWriterSpec() }; } - } // end namespace fit } // end namespace o2 diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h index dda287ec48906..7a08e28c87114 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h @@ -21,7 +21,7 @@ namespace fit o2::framework::DataProcessorSpec getT0DigitWriterSpec(); //o2::framework::DataProcessorSpec getMFTDigitWriterSpec(); -} // end namespace itsmft +} // namespace fit } // end namespace o2 - + #endif /* STEER_DIGITIZERWORKFLOW_ITSMFTDIGITWRITER_H_ */ diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index 8a75a14bca3de..3b48f9adf4286 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -40,18 +40,19 @@ class FITDPLDigitizerTask { public: - FITDPLDigitizerTask() = default; + FITDPLDigitizerTask(o2::fit::DigitizationParameters const& parameters) + : mDigitizer(parameters) {} ~FITDPLDigitizerTask() = default; void init(framework::InitContext& ic) { - std::cout<<" @@@@ init "<AddFile(ic.options().get("simFile").c_str()); - std::cout<<" @@@@@ sim file "<< ic.options().get("simFile").c_str() << std::endl; + std::cout << " @@@@@ sim file " << ic.options().get("simFile").c_str() << std::endl; // maybe add a particular signal file auto signalfilename = ic.options().get("simFileS"); if (signalfilename.size() > 0) { @@ -59,9 +60,9 @@ class FITDPLDigitizerTask mSimChains.back()->AddFile(signalfilename.c_str()); } static constexpr o2::detectors::DetID::ID DETID = o2::detectors::DetID::T0; - std::cout << " o2::detectors::DetID::T0 " << mID.getName() << std::endl; + std::cout << " o2::detectors::DetID::T0 " << mID.getName() << std::endl; if (mID == o2::detectors::DetID::T0) { - mT0Digitizer.init(); + mDigitizer.init(); std::cout << " @@@@ mT0Digitizer.init" << std::endl; } const bool isContinuous = ic.options().get("pileup"); @@ -103,9 +104,9 @@ class FITDPLDigitizerTask // loop over all composite collisions given from context // (aka loop over all the interaction records) for (int collID = 0; collID < timesview.size(); ++collID) { - mT0Digitizer.setEventTime(timesview[collID].timeNS); - mT0Digitizer.setOrbit(timesview[collID].orbit); - mT0Digitizer.setBC(timesview[collID].bc); + mDigitizer.setEventTime(timesview[collID].timeNS); + mDigitizer.setOrbit(timesview[collID].orbit); + mDigitizer.setBC(timesview[collID].bc); digit.cleardigits(); // for each collision, loop over the constituents event and source IDs // (background signal merging is basically taking place here) @@ -113,20 +114,21 @@ class FITDPLDigitizerTask for (auto& part : eventParts[collID]) { // get the hits for this event and this source hits.clear(); - retrieveHits(mSimChains, "T0Hit", part.sourceID, part.entryID, &hits); + retrieveHits(mSimChains, part.sourceID, part.entryID, &hits); LOG(INFO) << "For collision " << collID << " eventID " << part.entryID << " found " << hits.size() << " hits "; // call actual digitization procedure labels.clear(); // digits.clear(); - mT0Digitizer.process(&hits, &digit); - auto data = digit.getChDgData(); + mDigitizer.process(&hits, &digit); + const auto& data = digit.getChDgData(); LOG(INFO) << "Have " << data.size() << " fired channels "; // copy digits into accumulator // labelAccum.mergeAtBack(*labels); } - mT0Digitizer.setTriggers(&digit); - mT0Digitizer.smearCFDtime(&digit); + mDigitizer.computeAverage(digit); + mDigitizer.setTriggers(&digit); + mDigitizer.smearCFDtime(&digit); digitAccum.push_back(digit); // we should move it there actually LOG(INFO) << "Have " << digitAccum.back().getChDgData().size() << " fired channels "; digit.printStream(std::cout); @@ -161,7 +163,7 @@ class FITDPLDigitizerTask double mFairTimeUnitInNS = 1; ///< Fair time unit in ns o2::detectors::DetID mID; o2::header::DataOrigin mOrigin = o2::header::gDataOriginInvalid; - Digitizer mT0Digitizer{ o2::t0::T0DigitizationParameters() }; ///< Digitizer + o2::fit::Digitizer mDigitizer; ///< Digitizer //Digitizer mV0Digitizer; ///< Digitizer // RS: at the moment using hardcoded flag for continuos readout o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::CONTINUOUS; // readout mode @@ -169,7 +171,6 @@ class FITDPLDigitizerTask std::vector mSimChains; void retrieveHits(std::vector const& chains, - const char* brname, int sourceID, int entryID, std::vector* hits) @@ -178,8 +179,6 @@ class FITDPLDigitizerTask std::cout << "@@@@ retrieveHit " << detStr << std::endl; auto br = mSimChains[sourceID]->GetBranch((detStr + "Hit").c_str()); // auto br = chains[sourceID]->GetBranch(brname); - std::cout << " @@@@ " << brname << " " << sourceID << " " << entryID << " size " << hits->size() << std::endl; - if (!br) { LOG(ERROR) << "No branch found"; return; @@ -195,7 +194,7 @@ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask // FIXME: origina should be extractable from the DetID, the problem is 3d party header dependencies static constexpr o2::detectors::DetID::ID DETID = o2::detectors::DetID::T0; static constexpr o2::header::DataOrigin DETOR = o2::header::gDataOriginT0; - FITT0DPLDigitizerTask() + FITT0DPLDigitizerTask() : FITDPLDigitizerTask{ o2::t0::T0DigitizationParameters() } { mID = DETID; mOrigin = DETOR; @@ -215,18 +214,18 @@ o2::framework::DataProcessorSpec getFITT0DigitizerSpec(int channel) // options that can be used for this processor (here: input file names where to take the hits) std::string detStr = o2::detectors::DetID::getName(FITT0DPLDigitizerTask::DETID); auto detOrig = FITT0DPLDigitizerTask::DETOR; - std::cout << "@@@@ getFITT0DigitizerSpec " << detStr << " dteOrig " <(channel), Lifetime::Timeframe } }, Outputs{ OutputSpec{ detOrig, "DIGITS", 0, Lifetime::Timeframe }, /*OutputSpec{ detOrig "FIT", "DIGITSMCTR", 0, Lifetime::Timeframe }*/ OutputSpec{ detOrig, "ROMode", 0, Lifetime::Timeframe } }, - AlgorithmSpec{ adaptFromTask() }, - Options{ { "simFile", VariantType::String, "o2sim.root", { "Sim (background) input filename" } }, - { "simFileS", VariantType::String, "", { "Sim (signal) input filename" } }, - { "pileup", VariantType::Int, 1, { "whether to run in continuous time mode" } } } - + AlgorithmSpec{ adaptFromTask() }, + Options{ { "simFile", VariantType::String, "o2sim.root", { "Sim (background) input filename" } }, + { "simFileS", VariantType::String, "", { "Sim (signal) input filename" } }, + { "pileup", VariantType::Int, 1, { "whether to run in continuous time mode" } } } + // I can't use VariantType::Bool as it seems to have a problem }; } From 15dc66a45710d68eafd1eaa522d751be4ad86352 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Wed, 6 Feb 2019 17:50:13 +0100 Subject: [PATCH 05/25] add run_reco_t0 --- .../src/CollisionTimeRecoTask.cxx | 2 +- .../FIT/T0/reconstruction/src/RecPoints.cxx | 49 +++++-------- .../src/T0ReconstructionLinkDef.h | 1 + Detectors/FIT/macros/run_reco_t0.C | 72 +++++++++++++++++++ 4 files changed, 92 insertions(+), 32 deletions(-) create mode 100644 Detectors/FIT/macros/run_reco_t0.C diff --git a/Detectors/FIT/T0/reconstruction/src/CollisionTimeRecoTask.cxx b/Detectors/FIT/T0/reconstruction/src/CollisionTimeRecoTask.cxx index 6fe69ac3964f0..db42d06de8cab 100644 --- a/Detectors/FIT/T0/reconstruction/src/CollisionTimeRecoTask.cxx +++ b/Detectors/FIT/T0/reconstruction/src/CollisionTimeRecoTask.cxx @@ -29,7 +29,7 @@ CollisionTimeRecoTask::CollisionTimeRecoTask() void CollisionTimeRecoTask::Process(const Digit& digits, RecPoints& recPoints) const { - LOG(INFO) << "Running reconstruction on new event" << FairLogger::endl; + // LOG(INFO) << "Running reconstruction on new event" << FairLogger::endl; recPoints.FillFromDigits(digits); } //________________________________________________________ diff --git a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx index 84392b5d66816..be86dd75bd00f 100644 --- a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx +++ b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx @@ -21,14 +21,12 @@ ClassImp(o2::t0::RecPoints); void RecPoints::FillFromDigits(const o2::fit::Digit& digit) { - mTimeAmp.clear(); mCollisionTime = {}; Int_t ndigitsC = 0, ndigitsA = 0; constexpr Int_t nMCPsA = 4 * o2::t0::Geometry::NCellsA; constexpr Int_t nMCPsC = 4 * o2::t0::Geometry::NCellsC; constexpr Int_t nMCPs = nMCPsA + nMCPsC; - Float_t cfd[nMCPs] = {}, amp[nMCPs] = {}; Float_t sideAtime = 0, sideCtime = 0; mBC = digit.getBC(); @@ -37,39 +35,28 @@ void RecPoints::FillFromDigits(const o2::fit::Digit& digit) Float_t BCEventTime = 12.5; - for (const auto& d : digit.getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime - mEventTime - BCEventTime; - amp[mcp] = d.QTCAmpl; - mTimeAmp.push_back(ChannelData{ mcp, cfd[mcp], amp[mcp] }); - // LOG(DEBUG) << " mcp " << mcp<<" time "<< cfd[mcp]<<" amplitude "<< amp[mcp] << FairLogger::endl; - } - - for (Int_t imcp = 0; imcp < nMCPsA; imcp++) { - if (cfd[imcp] > -2 && cfd[imcp] < 2) { - sideAtime += (cfd[imcp]); - ndigitsA++; - } - } - for (Int_t imcp = 0; imcp < nMCPsC; imcp++) { - if (cfd[imcp + nMCPsA] > 0) { - sideCtime += (cfd[imcp + nMCPsA]); - ndigitsC++; + mTimeAmp = digit.getChDgData(); + for (auto& d : mTimeAmp) { + d.CFDTime -= mEventTime /*- BCEventTime*/; + if (abs(d.CFDTime - BCEventTime) < 2) { + if (d.ChId < nMCPsA) { + sideAtime += d.CFDTime; + ndigitsA++; + } else { + sideCtime += d.CFDTime; + ndigitsC++; + } } } + if (ndigitsA > 0) - sideAtime = sideAtime / Float_t(ndigitsA); + mCollisionTime[1] = sideAtime / Float_t(ndigitsA); + if (ndigitsC > 0) - sideCtime = sideCtime / Float_t(ndigitsC); + mCollisionTime[2] = sideCtime / Float_t(ndigitsC); - if (sideAtime > 0 && sideCtime > 0) { - mVertex = (sideAtime - sideCtime) / 2.; - mCollisionTime[0] = (sideAtime + sideCtime) / 2.; - } - if (sideAtime > 0) { - mCollisionTime[1] = sideAtime; - } - if (sideCtime > 0) { - mCollisionTime[2] = sideCtime; + if (ndigitsA > 0 && ndigitsC > 0) { + mVertex = (mCollisionTime[1] - mCollisionTime[2]) / 2.; + mCollisionTime[0] = (mCollisionTime[1] + mCollisionTime[2]) / 2.; } } diff --git a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h index f9eb23c55fa4e..01b854ff4c295 100644 --- a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h +++ b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h @@ -16,6 +16,7 @@ #pragma link C++ class o2::t0::CollisionTimeRecoTask + ; #pragma link C++ class o2::t0::RecPoints + ; +#pragma link C++ class std::vector < o2::t0::RecPoints > +; #pragma link C++ class o2::t0::Channel + ; #endif diff --git a/Detectors/FIT/macros/run_reco_t0.C b/Detectors/FIT/macros/run_reco_t0.C new file mode 100644 index 0000000000000..0091998fdc53b --- /dev/null +++ b/Detectors/FIT/macros/run_reco_t0.C @@ -0,0 +1,72 @@ +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include +#include +#include +#include +#include +#include +#include + +#include "FairLogger.h" + +#include "T0Reconstruction/CollisionTimeRecoTask.h" +#include "T0Reconstruction/RecPoints.h" +#include "FITBase/Digit.h" +#endif + +void run_reco_t0(std::string inpudDig = "t0digits.root", + std::string outName = "o2reco_t0.root", + std::string inputGRP = "o2sim_grp.root") +{ + + // Initialize logger + FairLogger* logger = FairLogger::GetLogger(); + logger->SetLogVerbosityLevel("LOW"); + logger->SetLogScreenLevel("DEBUG"); + + // Setup timer + TStopwatch timer; + + TFile* fdig = TFile::Open("t0digits.root"); + std::cout << " Open digits file " << std::endl; + TTree* digTree = (TTree*)fdig->Get("o2sim"); + digTree->Print(); + std::vector* digits = new std::vector; + digTree->SetBranchAddress("T0Digit", &digits); + Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry + std::cout << "Found " << nevD << " events with digits " << std::endl; + + //std::vector recPoints; + std::vector* recPointsP = new std::vector; + + TFile outFile(outName.c_str(), "recreate"); + TTree outTree("o2sim", "T0RecPoints"); + outTree.Branch("T0Cluster", &recPointsP); + + o2::t0::CollisionTimeRecoTask recoFIT; + timer.Start(); + for (int iEv = 0; iEv < nevD; iEv++) { + digTree->GetEntry(iEv); + recPointsP->resize(digits->size()); + for (size_t collID = 0; collID < digits->size(); ++collID) + recoFIT.Process((*digits)[collID], (*recPointsP)[collID]); + outTree.Fill(); + } + + outTree.Print(); + outFile.ls(); + timer.Stop(); + outTree.Write(); + Double_t rtime = timer.RealTime(); + Double_t ctime = timer.CpuTime(); + + Float_t cpuUsage = ctime / rtime; + std::cout << ""; + std::cout << cpuUsage; + std::cout << "" << std::endl; + std::cout << "Macro finished succesfully." << std::endl; + + std::cout << "Real time " << rtime << " s, CPU time " << ctime + << "s" << std::endl + << std::endl; +} From cb8dc52ac34b6b184a62834ddf97aaf7cf68ffa5 Mon Sep 17 00:00:00 2001 From: Maciej Slupecki Date: Tue, 19 Mar 2019 19:44:56 +0200 Subject: [PATCH 06/25] Added V0: Detector and Geometry classes; no proper hits yet --- .../DetectorsCommonDataFormats/DetID.h | 7 +- DataFormats/Detectors/Common/src/DetID.cxx | 2 +- .../Headers/include/Headers/DataHeader.h | 1 + Detectors/FIT/CMakeLists.txt | 2 +- Detectors/FIT/V0/CMakeLists.txt | 4 + Detectors/FIT/V0/base/CMakeLists.txt | 22 + .../FIT/V0/base/files/quartzOptProperties.txt | 884 ++++++++++++++++++ .../FIT/V0/base/include/V0Base/Geometry.h | 85 ++ Detectors/FIT/V0/base/src/Geometry.cxx | 122 +++ Detectors/FIT/V0/base/src/V0BaseLinkDef.h | 19 + Detectors/FIT/V0/simulation/CMakeLists.txt | 19 + .../include/V0Simulation/Detector.h | 146 +++ .../V0/simulation/include/V0Simulation/Hit.h | 129 +++ Detectors/FIT/V0/simulation/src/Detector.cxx | 383 ++++++++ Detectors/FIT/V0/simulation/src/Hit.cxx | 36 + .../V0/simulation/src/V0SimulationLinkDef.h | 20 + cmake/O2Dependencies.cmake | 4 + macro/build_geometry.C | 9 +- run/O2HitMerger.h | 5 + 19 files changed, 1893 insertions(+), 6 deletions(-) create mode 100644 Detectors/FIT/V0/CMakeLists.txt create mode 100644 Detectors/FIT/V0/base/CMakeLists.txt create mode 100644 Detectors/FIT/V0/base/files/quartzOptProperties.txt create mode 100644 Detectors/FIT/V0/base/include/V0Base/Geometry.h create mode 100644 Detectors/FIT/V0/base/src/Geometry.cxx create mode 100644 Detectors/FIT/V0/base/src/V0BaseLinkDef.h create mode 100644 Detectors/FIT/V0/simulation/CMakeLists.txt create mode 100644 Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h create mode 100644 Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h create mode 100644 Detectors/FIT/V0/simulation/src/Detector.cxx create mode 100644 Detectors/FIT/V0/simulation/src/Hit.cxx create mode 100644 Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index c8ee861e530b4..12d3fcd0161cd 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -60,8 +60,9 @@ class DetID static constexpr ID ZDC = 11; static constexpr ID T0 = 12; static constexpr ID ACO = 13; + static constexpr ID V0 = 14; static constexpr ID First = ITS; - static constexpr ID Last = ACO; ///< if extra detectors added, update this !!! + static constexpr ID Last = V0; ///< if extra detectors added, update this !!! static constexpr int nDetectors = Last + 1; ///< number of defined detectors @@ -105,13 +106,13 @@ class DetID ID mID = First; ///< detector ID static constexpr const char* sDetNames[nDetectors + 1] = ///< defined detector names - { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "T0", "ACO", nullptr }; + { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "T0", "ACO", "V0", nullptr }; // detector names, will be defined in DataSources static constexpr std::array sMasks = ///< detectot masks { utils::bit2Mask(ITS), utils::bit2Mask(TPC), utils::bit2Mask(TRD), utils::bit2Mask(TOF), utils::bit2Mask(PHS), utils::bit2Mask(CPV), utils::bit2Mask(EMC), utils::bit2Mask(HMP), utils::bit2Mask(MFT), utils::bit2Mask(MCH), - utils::bit2Mask(MID), utils::bit2Mask(ZDC), utils::bit2Mask(T0), utils::bit2Mask(ACO) }; + utils::bit2Mask(MID), utils::bit2Mask(ZDC), utils::bit2Mask(T0), utils::bit2Mask(ACO), utils::bit2Mask(V0) }; ClassDefNV(DetID, 1); }; diff --git a/DataFormats/Detectors/Common/src/DetID.cxx b/DataFormats/Detectors/Common/src/DetID.cxx index 961593b4c870f..3883126996794 100644 --- a/DataFormats/Detectors/Common/src/DetID.cxx +++ b/DataFormats/Detectors/Common/src/DetID.cxx @@ -25,7 +25,7 @@ constexpr std::array DetID::sMasks; // redundant declarations constexpr DetID::ID DetID::ITS, DetID::TPC, DetID::TRD, DetID::TOF, DetID::PHS, DetID::CPV, DetID::EMC, - DetID::HMP, DetID::MFT, DetID::MCH, DetID::MID, DetID::ZDC, DetID::T0, DetID::ACO, DetID::First, DetID::Last; + DetID::HMP, DetID::MFT, DetID::MCH, DetID::MID, DetID::ZDC, DetID::T0, DetID::ACO, DetID::V0, DetID::First, DetID::Last; constexpr int DetID::nDetectors; diff --git a/DataFormats/Headers/include/Headers/DataHeader.h b/DataFormats/Headers/include/Headers/DataHeader.h index 4b743139427ab..04dab374c25ef 100644 --- a/DataFormats/Headers/include/Headers/DataHeader.h +++ b/DataFormats/Headers/include/Headers/DataHeader.h @@ -590,6 +590,7 @@ constexpr o2::header::DataOrigin gDataOriginCPV{ "CPV" }; constexpr o2::header::DataOrigin gDataOriginCTP{ "CTP" }; constexpr o2::header::DataOrigin gDataOriginEMC{ "EMC" }; constexpr o2::header::DataOrigin gDataOriginT0{ "T0" }; +constexpr o2::header::DataOrigin gDataOriginV0{ "V0" }; constexpr o2::header::DataOrigin gDataOriginHMP{ "HMP" }; constexpr o2::header::DataOrigin gDataOriginITS{ "ITS" }; constexpr o2::header::DataOrigin gDataOriginMCH{ "MCH" }; diff --git a/Detectors/FIT/CMakeLists.txt b/Detectors/FIT/CMakeLists.txt index c8c3ba0078283..b917369d336aa 100644 --- a/Detectors/FIT/CMakeLists.txt +++ b/Detectors/FIT/CMakeLists.txt @@ -1,4 +1,4 @@ # Libraries add_subdirectory(common) add_subdirectory(T0) -#add_subdirectory(V0) +add_subdirectory(V0) diff --git a/Detectors/FIT/V0/CMakeLists.txt b/Detectors/FIT/V0/CMakeLists.txt new file mode 100644 index 0000000000000..32a36ff118835 --- /dev/null +++ b/Detectors/FIT/V0/CMakeLists.txt @@ -0,0 +1,4 @@ +# Libraries +add_subdirectory(base) +add_subdirectory(simulation) +#add_subdirectory(reconstruction) diff --git a/Detectors/FIT/V0/base/CMakeLists.txt b/Detectors/FIT/V0/base/CMakeLists.txt new file mode 100644 index 0000000000000..97d21db10eccf --- /dev/null +++ b/Detectors/FIT/V0/base/CMakeLists.txt @@ -0,0 +1,22 @@ +set(MODULE_NAME "V0Base") + +O2_SETUP(NAME ${MODULE_NAME}) + +set(SRCS + src/Geometry.cxx + ) + +set(HEADERS + include/${MODULE_NAME}/Geometry.h + ) + +Set(LINKDEF src/V0BaseLinkDef.h) +Set(LIBRARY_NAME ${MODULE_NAME}) +set(BUCKET_NAME fit_base_bucket) + +O2_GENERATE_LIBRARY() + +install( + DIRECTORY files + DESTINATION share/Detectors/V0/ +) diff --git a/Detectors/FIT/V0/base/files/quartzOptProperties.txt b/Detectors/FIT/V0/base/files/quartzOptProperties.txt new file mode 100644 index 0000000000000..00f77b1ed0894 --- /dev/null +++ b/Detectors/FIT/V0/base/files/quartzOptProperties.txt @@ -0,0 +1,884 @@ +# Optical properties of quartz Spectrasil2000 & QE of MCP-PMT XP85012 +# Number of elements: +880 +# PhotonEnergy [eV] AbsorptionLength [cm] RefractionIndex QuantumEfficiency + 1.24104 3421.18 1.45043 0 + 1.24228 3187.97 1.45044 0 + 1.24353 2820.29 1.45045 0 + 1.24478 2574.7 1.45046 0 + 1.24603 2699.84 1.45048 0 + 1.24728 2737.22 1.45049 0 + 1.24854 2507.31 1.4505 0 + 1.2498 2314.62 1.45051 0 + 1.25106 2479.35 1.45053 0 + 1.25232 2472.61 1.45054 0 + 1.25359 2248.48 1.45055 0 + 1.25486 2145.82 1.45057 0 + 1.25613 2037.05 1.45058 0 + 1.2574 2011.96 1.45059 0 + 1.25868 2019.61 1.45061 0 + 1.25996 1936.23 1.45062 0 + 1.26124 1846.23 1.45063 0 + 1.26253 1721.89 1.45064 0 + 1.26381 1711.03 1.45066 0 + 1.2651 1640.42 1.45067 0 + 1.26639 1588.92 1.45068 0 + 1.26769 1498.78 1.4507 0 + 1.26899 1424.72 1.45071 0 + 1.27029 1384.31 1.45072 0 + 1.27159 1314.28 1.45073 0 + 1.2729 1232.36 1.45075 0 + 1.2742 1189.45 1.45076 0 + 1.27551 1170.79 1.45077 0 + 1.27683 1089.01 1.45079 0 + 1.27814 1044.86 1.4508 0 + 1.27946 996.898 1.45081 0 + 1.28079 958.358 1.45082 0 + 1.28211 894.071 1.45084 0 + 1.28344 852.745 1.45085 0 + 1.28477 817.429 1.45086 0 + 1.2861 778.062 1.45088 0 + 1.28744 724.415 1.45089 0 + 1.28877 684.809 1.4509 0 + 1.29011 637.656 1.45092 0 + 1.29146 608.727 1.45093 0 + 1.29281 572.549 1.45094 0 + 1.29415 535.834 1.45096 0 + 1.29551 503.829 1.45097 0 + 1.29686 472.131 1.45098 0 + 1.29822 444.765 1.451 0 + 1.29958 421.134 1.45101 0 + 1.30094 400.311 1.45102 0 + 1.30231 380.157 1.45104 0 + 1.30368 364.707 1.45105 0 + 1.30505 349.772 1.45106 0 + 1.30643 338.073 1.45108 0 + 1.30781 326.177 1.45109 0 + 1.30919 320.817 1.4511 0 + 1.31057 320.247 1.45112 0 + 1.31196 323.879 1.45113 0 + 1.31335 328.772 1.45114 0 + 1.31474 338.753 1.45116 0 + 1.31614 354.774 1.45117 0 + 1.31753 374.608 1.45118 0 + 1.31894 402.916 1.4512 0 + 1.32034 443.293 1.45121 0 + 1.32175 491.579 1.45122 0 + 1.32316 553.494 1.45124 0 + 1.32457 621.13 1.45125 0 + 1.32599 705.315 1.45126 0 + 1.32741 808.477 1.45128 0 + 1.32883 941.607 1.45129 0 + 1.33026 1120.52 1.4513 0 + 1.33169 1311.39 1.45132 0 + 1.33312 1555.4 1.45133 0 + 1.33455 1772.21 1.45134 0 + 1.33599 2049.9 1.45136 0 + 1.33743 2469.52 1.45137 0 + 1.33888 3234.15 1.45139 0 + 1.34032 4075.02 1.4514 0 + 1.34177 5238.78 1.45141 0 + 1.34323 6346.16 1.45143 0 + 1.34469 8609.41 1.45144 0 + 1.34615 14356.7 1.45146 0 + 1.34761 28235.8 1.45147 0 + 1.34908 31902.9 1.45148 0 + 1.35054 30650.1 1.4515 0 + 1.35202 16845.3 1.45151 0 + 1.35349 23981.6 1.45153 0 + 1.35497 33594.5 1.45154 0 + 1.35646 31844.8 1.45155 0 + 1.35794 20637.2 1.45157 0 + 1.35943 21299.3 1.45158 0 + 1.36092 25968.8 1.4516 0 + 1.36242 19319.9 1.45161 0 + 1.36392 19084.6 1.45162 0 + 1.36542 22465.1 1.45164 0 + 1.36692 21680.1 1.45165 0 + 1.36843 23287.1 1.45167 0 + 1.36994 18774.5 1.45168 0 + 1.37146 22270.5 1.45169 0 + 1.37298 18643.6 1.45171 0 + 1.3745 18862.8 1.45172 0 + 1.37603 13847.8 1.45174 0 + 1.37756 13591.2 1.45175 0 + 1.37909 14707.3 1.45176 0 + 1.38062 14086.8 1.45178 0 + 1.38216 13242.3 1.45179 0 + 1.38371 16987 1.45181 0 + 1.38525 19030.4 1.45182 0 + 1.3868 16546.3 1.45184 0 + 1.38835 17337.1 1.45185 0 + 1.38991 22495.4 1.45187 0 + 1.39147 17355.2 1.45188 0 + 1.39303 16113.4 1.45189 0 + 1.3946 18332.7 1.45191 0 + 1.39617 15573.7 1.45192 0 + 1.39775 14509.7 1.45194 0 + 1.39932 14027.5 1.45195 0 + 1.4009 16695 1.45197 0 + 1.40249 14687 1.45198 0 + 1.40408 13213.8 1.452 0 + 1.40567 19363 1.45201 0 + 1.40726 15111 1.45203 0 + 1.40886 13874.6 1.45204 0 + 1.41047 17189.1 1.45206 0 + 1.41207 21826.3 1.45207 0 + 1.41368 14468.3 1.45209 0 + 1.4153 15494.6 1.4521 0 + 1.41691 30339.7 1.45212 0 + 1.41854 23447.4 1.45213 0 + 1.42016 18049.6 1.45215 0 + 1.42179 16864.9 1.45216 0 + 1.42342 15929.2 1.45218 0 + 1.42506 14080.8 1.45219 0 + 1.4267 15859 1.45221 0 + 1.42834 19753.6 1.45222 0 + 1.42999 14587.8 1.45223 0 + 1.43164 13548.8 1.45225 0 + 1.43329 13530.3 1.45227 0 + 1.43495 13504.1 1.45228 0 + 1.43662 17036.4 1.4523 0 + 1.43828 12763.5 1.45231 0 + 1.43995 40956.2 1.45233 0 + 1.44163 28235.8 1.45234 0 + 1.44331 31902.9 1.45236 0 + 1.44499 30650.1 1.45237 0 + 1.44667 16845.3 1.45239 0 + 1.44836 23981.6 1.4524 0 + 1.45006 33594.5 1.45242 0 + 1.45176 31844.8 1.45243 0 + 1.45346 20637.2 1.45245 0 + 1.45516 21299.3 1.45246 0 + 1.45687 25968.8 1.45248 0 + 1.45859 19319.9 1.4525 0 + 1.46031 19084.6 1.45251 0 + 1.46203 22465.1 1.45253 0 + 1.46375 21680.1 1.45254 0 + 1.46548 23287.1 1.45256 0 + 1.46722 18774.5 1.45257 0 + 1.46896 22270.5 1.45259 0 + 1.4707 18643.6 1.45261 0 + 1.47245 18862.8 1.45262 0 + 1.4742 13847.8 1.45264 0 + 1.47595 13591.2 1.45265 0 + 1.47771 14707.3 1.45267 0 + 1.47947 14086.8 1.45268 0 + 1.48124 13242.3 1.4527 0 + 1.48301 16987 1.45272 0 + 1.48479 19030.4 1.45273 0 + 1.48657 16546.3 1.45275 0 + 1.48836 17337.1 1.45276 0 + 1.49014 22495.4 1.45278 0 + 1.49194 17355.2 1.4528 0 + 1.49373 16113.4 1.45281 0 + 1.49554 18332.7 1.45283 0 + 1.49734 15573.7 1.45285 0 + 1.49915 14509.7 1.45286 0 + 1.50097 14027.5 1.45288 0 + 1.50279 16695 1.45289 0 + 1.50461 13045.7 1.45291 0 + 1.50644 13777.4 1.45293 0 + 1.50827 13538.5 1.45294 0 + 1.51011 9940.26 1.45296 0 + 1.51195 12057.5 1.45298 0 + 1.5138 14083.7 1.45299 0 + 1.51565 13766.6 1.45301 0 + 1.5175 11149.1 1.45303 0 + 1.51936 11339.5 1.45304 0 + 1.52123 12540 1.45306 0 + 1.5231 10753 1.45308 0 + 1.52497 10679.7 1.45309 0 + 1.52685 11661.7 1.45311 0 + 1.52873 11446.6 1.45313 0 + 1.53062 11879.4 1.45314 0 + 1.53251 10581.9 1.45316 0 + 1.53441 11609 1.45318 0 + 1.53631 10540.2 1.45319 0 + 1.53821 10609.9 1.45321 0 + 1.54012 8814.39 1.45323 0 + 1.54204 8709.73 1.45325 0 + 1.54396 9154.92 1.45326 0 + 1.54589 8910.62 1.45328 0 + 1.54782 8565.09 1.4533 0 + 1.54975 9989.43 1.45331 0 + 1.55169 10662.7 1.45333 0 + 1.55363 9835.36 1.45335 0 + 1.55558 10109.5 1.45337 0 + 1.55754 11669.9 1.45338 0 + 1.5595 10115.6 1.4534 0 + 1.56146 9680.78 1.45342 0 + 1.56343 10440.1 1.45344 0 + 1.5654 9483.31 1.45345 0 + 1.56738 9077.99 1.45347 0 + 1.56937 8886.83 1.45349 0 + 1.57136 9887.74 1.45351 0 + 1.57335 9147.07 1.45353 0 + 1.57535 8553.17 1.45354 0 + 1.57735 10766.3 1.45356 0 + 1.57936 9309.77 1.45358 0 + 1.58138 8825.23 1.4536 0 + 1.5834 10059 1.45361 0 + 1.58542 11487.2 1.45363 0 + 1.58745 9061.75 1.45365 0 + 1.58949 9453.94 1.45367 0 + 1.59153 13477.6 1.45369 0 + 1.59357 11920.9 1.45371 0 + 1.59562 10347.7 1.45372 0 + 1.59768 9947.08 1.45374 0 + 1.59974 9613.99 1.45376 0 + 1.60181 8908.22 1.45378 0 + 1.60388 9588.38 1.4538 0 + 1.60596 10886 1.45382 0 + 1.60804 9108.47 1.45383 0 + 1.61013 8692.28 1.45385 0 + 1.61222 8684.64 1.45387 0 + 1.61432 8673.85 1.45389 0 + 1.61643 10006.5 1.45391 0 + 1.61854 8362.2 1.45393 0 + 1.62065 8499.98 1.45395 0 + 1.62277 8196.07 1.45397 0 + 1.6249 8503.37 1.45398 0 + 1.62703 8703.71 1.454 0 + 1.62917 8247.21 1.45402 0 + 1.63132 8968.87 1.45404 0 + 1.63347 10025.4 1.45406 0 + 1.63562 8495.1 1.45408 0 + 1.63778 9090.44 1.4541 0 + 1.63995 7348.7 1.45412 0 + 1.64212 6985.31 1.45414 0 + 1.6443 8265.87 1.45416 0 + 1.64648 8196.47 1.45418 0 + 1.64867 8417.99 1.4542 0 + 1.65087 8220.7 1.45422 0 + 1.65307 7929.1 1.45423 0 + 1.65527 7089.84 1.45425 0 + 1.65749 7142.57 1.45427 0 + 1.65971 6029.66 1.45429 0 + 1.66193 6652.67 1.45431 0 + 1.66416 6090.11 1.45433 0 + 1.6664 6668.48 1.45435 0 + 1.66864 6745.95 1.45437 0 + 1.67089 6193.83 1.45439 0 + 1.67314 5448.14 1.45441 0 + 1.67541 5113.36 1.45443 0 + 1.67767 5263.34 1.45445 0 + 1.67995 5051.55 1.45447 0 + 1.68223 5287.77 1.45449 0 + 1.68451 4977.7 1.45451 0 + 1.6868 4618.24 1.45453 0 + 1.6891 4305.09 1.45456 0 + 1.69141 4278.88 1.45458 0 + 1.69372 4104.84 1.4546 0 + 1.69603 3972.64 1.45462 0 + 1.69836 3824.7 1.45464 0 + 1.70069 3321.36 1.45466 0 + 1.70302 3404.79 1.45468 0 + 1.70536 3224.11 1.4547 0 + 1.70771 3170.67 1.45472 0 + 1.71007 3338.81 1.45474 0 + 1.71243 3266.66 1.45476 0 + 1.7148 3498.6 1.45479 0 + 1.71717 3681.34 1.45481 0 + 1.71956 3846.83 1.45483 0 + 1.72194 4164 1.45485 0 + 1.72434 4452.22 1.45487 0 + 1.72674 5582.66 1.45489 0 + 1.72915 5852.34 1.45491 0 + 1.73156 6717.85 1.45494 0 + 1.73399 6897.01 1.45496 0 + 1.73641 8024.52 1.45498 0 + 1.73885 7052.72 1.455 0 + 1.74129 7266.13 1.45502 0 + 1.74374 7555.4 1.45504 0 + 1.7462 8204.14 1.45507 0 + 1.74866 6842.3 1.45509 0 + 1.75113 6577.01 1.45511 0 + 1.75361 6665.74 1.45513 0 + 1.75609 7791.78 1.45516 0 + 1.75858 7159.82 1.45518 0 + 1.76108 7329.74 1.4552 0 + 1.76358 6550.73 1.45522 0 + 1.7661 7658.27 1.45524 0 + 1.76862 7527.43 1.45527 0 + 1.77114 6680.9 1.45529 0 + 1.77368 6921.32 1.45531 0 + 1.77622 7534.53 1.45534 0 + 1.77877 7105.91 1.45536 0 + 1.78132 6576.86 1.45538 0 + 1.78388 7105.52 1.45541 0 + 1.78646 7516.12 1.45543 0 + 1.78903 6586.22 1.45545 0 + 1.79162 6678.6 1.45548 0 + 1.79421 6528.98 1.4555 0 + 1.79681 6754.96 1.45552 0 + 1.79942 6190.62 1.45555 0 + 1.80203 6633.9 1.45557 0 + 1.80466 6118.1 1.45559 0 + 1.80729 6332.51 1.45562 0 + 1.80993 6914.27 1.45564 0 + 1.81257 6516.36 1.45567 0 + 1.81523 6239.68 1.45569 0 + 1.81789 6485.72 1.45571 0 + 1.82056 6374.42 1.45574 0 + 1.82324 6764.41 1.45576 0 + 1.82592 6742.36 1.45579 0 + 1.82861 6572.9 1.45581 0 + 1.83131 6307.78 1.45584 0 + 1.83402 6397.4 1.45586 0 + 1.83674 6387.81 1.45589 0 + 1.83947 6378.99 1.45591 0 + 1.8422 6463.05 1.45593 0 + 1.84494 6303.98 1.45596 0 + 1.84769 6722.72 1.45598 0 + 1.85045 6406.16 1.45601 0 + 1.85321 6565.68 1.45603 0 + 1.85599 6819.33 1.45606 0 + 1.85877 6328.03 1.45609 0 + 1.86156 6090.01 1.45611 0 + 1.86436 6770.2 1.45614 0 + 1.86717 5914.52 1.45616 0 + 1.86998 5752.02 1.45619 0 + 1.87281 6257.32 1.45621 0 + 1.87564 6413.27 1.45624 0 + 1.87848 5903.16 1.45627 0 + 1.88134 5793.12 1.45629 0 + 1.88419 5770.87 1.45632 0 + 1.88706 6059.61 1.45635 0 + 1.88994 5976.07 1.45637 0 + 1.89282 5776.72 1.4564 0 + 1.89572 5679.77 1.45643 0 + 1.89862 5875.57 1.45645 0 + 1.90153 5844.96 1.45648 0 + 1.90445 5827.5 1.45651 0 + 1.90738 6085.94 1.45654 0 + 1.91032 5735.58 1.45656 0 + 1.91327 5706.5 1.45659 0 + 1.91623 6058.46 1.45662 0 + 1.9192 6025.58 1.45664 0 + 1.92217 5732.59 1.45667 0 + 1.92516 5292.18 1.4567 0 + 1.92815 5346.84 1.45673 0 + 1.93115 5517.05 1.45676 0 + 1.93417 5371.91 1.45678 0 + 1.93719 5128.82 1.45681 0 + 1.94022 5283.72 1.45684 0 + 1.94326 5522.64 1.45687 0 + 1.94631 5623.17 1.4569 0 + 1.94937 5801.2 1.45692 0 + 1.95244 5416.49 1.45695 0 + 1.95552 5253.11 1.45698 0 + 1.95861 5106.41 1.45701 0 + 1.96171 5271.79 1.45704 0 + 1.96482 5350.39 1.45707 0 + 1.96794 4918.41 1.4571 0 + 1.97107 4775.55 1.45713 0 + 1.9742 5048.62 1.45716 0 + 1.97735 4791.19 1.45719 0 + 1.98051 5175.5 1.45722 0 + 1.98368 4889.51 1.45725 0 + 1.98686 4715.69 1.45728 0 + 1.99005 4655.05 1.45731 0 + 1.99325 4546.09 1.45734 0 + 1.99646 4686.26 1.45737 0 + 1.99968 4685.33 1.4574 0 + 2.00291 4782.69 1.45743 0 + 2.00615 4791.15 1.45746 0 + 2.0094 4567 1.45749 0 + 2.01266 4555.15 1.45752 0.000603488 + 2.01593 4630.48 1.45756 0.00132496 + 2.01922 4449.01 1.45759 0.00204879 + 2.02251 4489.24 1.45762 0.00277497 + 2.02582 4195.16 1.45765 0.00350353 + 2.02913 4350.13 1.45768 0.00423448 + 2.03246 4486.32 1.45771 0.00496782 + 2.0358 4311.57 1.45775 0.00570357 + 2.03914 4346.81 1.45778 0.00644174 + 2.0425 4370.95 1.45781 0.00718234 + 2.04587 4457.37 1.45784 0.00792538 + 2.04926 4564.34 1.45787 0.00867089 + 2.05265 4528.91 1.45791 0.00941886 + 2.05605 4279.44 1.45794 0.0101693 + 2.05947 4361.76 1.45797 0.0109223 + 2.0629 4266.35 1.458 0.0116777 + 2.06633 4380.62 1.45804 0.0124357 + 2.06978 4391.72 1.45807 0.0131962 + 2.07324 4371.55 1.4581 0.0139592 + 2.07672 4522 1.45814 0.0147248 + 2.0802 4557.19 1.45817 0.015493 + 2.0837 4344.64 1.4582 0.0162637 + 2.08721 4223.66 1.45824 0.0170371 + 2.09073 4226.52 1.45827 0.017813 + 2.09426 4214.77 1.45831 0.0185916 + 2.0978 4265.91 1.45834 0.0193728 + 2.10136 4314.81 1.45838 0.0201567 + 2.10492 4180.91 1.45841 0.0209422 + 2.1085 4281.24 1.45845 0.0217303 + 2.1121 4487.77 1.45848 0.0225212 + 2.1157 4466.63 1.45852 0.0233148 + 2.11932 4605.61 1.45856 0.024111 + 2.12295 4516.4 1.45859 0.0242948 + 2.12659 4357.74 1.45863 0.0244792 + 2.13024 4676.07 1.45866 0.0246642 + 2.13391 4929.74 1.4587 0.0248498 + 2.13759 4863.94 1.45874 0.0250361 + 2.14128 4666.59 1.45877 0.0255008 + 2.14498 4647.73 1.45881 0.0259671 + 2.1487 4514.46 1.45885 0.026435 + 2.15243 4308.44 1.45889 0.0269046 + 2.15617 4599 1.45892 0.0273757 + 2.15993 4918.94 1.45896 0.0276054 + 2.1637 4857.92 1.459 0.0278359 + 2.16748 4740.43 1.45903 0.0280672 + 2.17128 4850.82 1.45907 0.0282992 + 2.17509 4726.37 1.45911 0.0285322 + 2.17891 4617.67 1.45915 0.0296464 + 2.18275 4517.97 1.45919 0.0307646 + 2.1866 4246.9 1.45922 0.0318868 + 2.19046 4323.95 1.45926 0.0330129 + 2.19434 4539.88 1.4593 0.034143 + 2.19823 4566.95 1.45934 0.034927 + 2.20213 4862.73 1.45938 0.0357138 + 2.20605 5121.36 1.45942 0.0365035 + 2.20998 4887.94 1.45946 0.0372959 + 2.21393 4875.82 1.4595 0.0380912 + 2.21789 5110.65 1.45954 0.0388852 + 2.22186 5101.39 1.45958 0.0396821 + 2.22585 5100.88 1.45962 0.0404818 + 2.22986 5185.85 1.45966 0.0412845 + 2.23387 5183.42 1.4597 0.04209 + 2.23791 5350 1.45975 0.0427888 + 2.24195 5545.73 1.45979 0.04349 + 2.24601 5462.92 1.45983 0.0441939 + 2.25009 5245.71 1.45987 0.0449003 + 2.25418 5359.82 1.45991 0.0456092 + 2.25829 5399.1 1.45996 0.046386 + 2.26241 5248.18 1.46 0.0471657 + 2.26654 5572.24 1.46004 0.0479482 + 2.2707 5647.23 1.46009 0.0487335 + 2.27486 5441.83 1.46013 0.0495218 + 2.27904 5424.38 1.46017 0.0503124 + 2.28324 5654.86 1.46022 0.0511058 + 2.28745 5589.6 1.46026 0.0519023 + 2.29168 5627.61 1.46031 0.0527016 + 2.29593 5938.15 1.46035 0.0535039 + 2.30019 5874.43 1.46039 0.0545754 + 2.30446 5955.23 1.46044 0.0556509 + 2.30875 5887.32 1.46048 0.0567303 + 2.31306 6014.47 1.46053 0.0578138 + 2.31738 5925.86 1.46057 0.0589014 + 2.32172 5759.84 1.46062 0.0607477 + 2.32608 5831.67 1.46066 0.0626009 + 2.33045 6416.52 1.46071 0.0644611 + 2.33484 6792.22 1.46075 0.0663283 + 2.33925 6558.62 1.4608 0.0682026 + 2.34367 6339.55 1.46085 0.0701951 + 2.34811 6171.57 1.46089 0.0721951 + 2.35256 5976.79 1.46094 0.0742028 + 2.35703 6074.57 1.46099 0.0762181 + 2.36152 6251.36 1.46103 0.078241 + 2.36603 6178.66 1.46108 0.0812495 + 2.37055 6174.3 1.46113 0.0842695 + 2.3751 6349.78 1.46118 0.087301 + 2.37965 6112.55 1.46123 0.0903442 + 2.38423 6322.74 1.46128 0.0933991 + 2.38882 5874.7 1.46133 0.0966295 + 2.39344 6160.3 1.46138 0.0998724 + 2.39807 6100.82 1.46144 0.103128 + 2.40271 6043.85 1.46149 0.106396 + 2.40738 5584.07 1.46154 0.109677 + 2.41206 5230.66 1.46159 0.11218 + 2.41676 5150.21 1.46164 0.114692 + 2.42148 5486.7 1.46169 0.117215 + 2.42622 6018.45 1.46175 0.119747 + 2.43098 5334.08 1.4618 0.12229 + 2.43576 4945.97 1.46185 0.123772 + 2.44055 4938.44 1.4619 0.12526 + 2.44536 5076.67 1.46196 0.126754 + 2.4502 4888.5 1.46201 0.128254 + 2.45505 4509.28 1.46206 0.12976 + 2.45992 4692.47 1.46212 0.130429 + 2.46481 4902.71 1.46217 0.1311 + 2.46972 4767.89 1.46223 0.131774 + 2.47465 4860.02 1.46228 0.132451 + 2.4796 4860.22 1.46233 0.13313 + 2.48457 4842.79 1.46239 0.133825 + 2.48956 5264.15 1.46244 0.134521 + 2.49457 5457.33 1.4625 0.135221 + 2.4996 5138.56 1.46255 0.135924 + 2.50465 4850.35 1.46261 0.136629 + 2.50972 4712.94 1.46267 0.13674 + 2.51481 4533.44 1.46272 0.136851 + 2.51992 4522.65 1.46278 0.136963 + 2.52505 4870.09 1.46284 0.137075 + 2.5302 5018.23 1.46289 0.137188 + 2.53538 4967.84 1.46295 0.137946 + 2.54057 5081.86 1.46301 0.138708 + 2.54579 4896.89 1.46308 0.139472 + 2.55103 5035.75 1.46314 0.14024 + 2.55629 4823.14 1.4632 0.141011 + 2.56157 5600.66 1.46326 0.143063 + 2.56687 6008.92 1.46332 0.145124 + 2.5722 6060.05 1.46339 0.147193 + 2.57755 6381.85 1.46345 0.149271 + 2.58292 6865.87 1.46351 0.151357 + 2.58831 6959.87 1.46358 0.152411 + 2.59372 7010.76 1.46364 0.153469 + 2.59916 7078.14 1.46371 0.154532 + 2.60462 7304.25 1.46377 0.155599 + 2.61011 7093.41 1.46383 0.15667 + 2.61561 6934.71 1.4639 0.158349 + 2.62114 6769.26 1.46396 0.160034 + 2.62669 6637.03 1.46403 0.161727 + 2.63227 7790.4 1.4641 0.163427 + 2.63787 6967.7 1.46416 0.165135 + 2.6435 7336.66 1.46423 0.165215 + 2.64915 7168.11 1.4643 0.165296 + 2.65482 6766.29 1.46436 0.165377 + 2.66052 6934.87 1.46443 0.165458 + 2.66624 7055.96 1.4645 0.16554 + 2.67198 7782.03 1.46456 0.168134 + 2.67775 7346.41 1.46463 0.170739 + 2.68355 7847.76 1.4647 0.173355 + 2.68937 8341.04 1.46477 0.175983 + 2.69522 7745.01 1.46484 0.178622 + 2.70109 7177.32 1.46491 0.180839 + 2.70699 7488.85 1.46498 0.183065 + 2.71291 7990.88 1.46505 0.1853 + 2.71886 7955.46 1.46512 0.187546 + 2.72484 8104.51 1.46519 0.189801 + 2.73084 7602.15 1.46526 0.190908 + 2.73687 8572.2 1.46534 0.19202 + 2.74292 9542.06 1.46542 0.193137 + 2.749 8293.76 1.4655 0.194259 + 2.75511 8744.62 1.46557 0.195385 + 2.76125 8213.58 1.46565 0.197107 + 2.76741 9258.11 1.46573 0.198836 + 2.7736 8754.93 1.46581 0.200572 + 2.77982 8776.55 1.46589 0.202317 + 2.78607 8673.88 1.46597 0.204069 + 2.79234 9232.67 1.46605 0.205326 + 2.79865 8087.54 1.46613 0.206588 + 2.80498 9828.85 1.46621 0.207856 + 2.81134 11918.4 1.46629 0.20913 + 2.81773 9656.51 1.46637 0.21041 + 2.82415 9084.49 1.46646 0.210022 + 2.83059 9402.49 1.46654 0.209633 + 2.83707 10386.4 1.46662 0.209241 + 2.84358 11590.7 1.4667 0.208848 + 2.85011 11397.6 1.46679 0.208453 + 2.85668 8793.37 1.46687 0.209131 + 2.86328 11625.7 1.46696 0.209811 + 2.86991 10560.2 1.46704 0.210495 + 2.87657 11182.2 1.46713 0.211182 + 2.88326 10639.5 1.46721 0.211873 + 2.88998 11209.4 1.4673 0.213663 + 2.89673 10839.7 1.46738 0.215462 + 2.90351 10583.9 1.46747 0.217269 + 2.91033 11584.1 1.46756 0.219085 + 2.91718 12219.4 1.46764 0.220909 + 2.92406 9336.2 1.46773 0.221313 + 2.93097 9654.91 1.46782 0.221719 + 2.93791 11366.8 1.46791 0.222127 + 2.94489 11299.8 1.468 0.222537 + 2.9519 11385.7 1.46809 0.222949 + 2.95895 9915.4 1.46819 0.224175 + 2.96603 10685.8 1.46828 0.225406 + 2.97314 10674 1.46838 0.226644 + 2.98029 12964 1.46848 0.227887 + 2.98747 11843.6 1.46859 0.229137 + 2.99469 11543 1.46869 0.229239 + 3.00194 13338.8 1.46879 0.229342 + 3.00922 10463.9 1.46889 0.229446 + 3.01655 14787.8 1.46899 0.22955 + 3.0239 11856.7 1.4691 0.229654 + 3.0313 12075.4 1.4692 0.230149 + 3.03873 12705 1.4693 0.230646 + 3.04619 10609.6 1.46941 0.231146 + 3.05369 10013.2 1.46951 0.231649 + 3.06123 10626.4 1.46962 0.232153 + 3.06881 12890.3 1.46973 0.233597 + 3.07643 13581.1 1.46983 0.235049 + 3.08408 11229.7 1.46994 0.236507 + 3.09177 11472.1 1.47005 0.237973 + 3.0995 10195.6 1.47016 0.239446 + 3.10727 10548.6 1.47026 0.239794 + 3.11508 9966.17 1.47037 0.240144 + 3.12292 9673.65 1.47048 0.240496 + 3.13081 10448 1.47059 0.240849 + 3.13873 9235.51 1.47071 0.241205 + 3.1467 10901.9 1.47082 0.241242 + 3.15471 9225.32 1.47093 0.241279 + 3.16276 11731.5 1.47104 0.241317 + 3.17084 9566.08 1.47116 0.241355 + 3.17897 12271.8 1.47127 0.241393 + 3.18715 14356.1 1.47138 0.24078 + 3.19536 10715.1 1.4715 0.240164 + 3.20362 10488.9 1.47162 0.239545 + 3.21192 11085 1.47173 0.238923 + 3.22026 10754.4 1.47185 0.238297 + 3.22865 11265.8 1.47198 0.238017 + 3.23708 10101.9 1.47211 0.237736 + 3.24555 9025.44 1.47224 0.237453 + 3.25407 11559.7 1.47238 0.237168 + 3.26263 10259.3 1.47251 0.236882 + 3.27124 9857.02 1.47264 0.236787 + 3.27989 12999.2 1.47278 0.236691 + 3.28859 13345.5 1.47292 0.236595 + 3.29734 23646.7 1.47305 0.236498 + 3.30613 15601.3 1.47319 0.236401 + 3.31497 15518.7 1.47333 0.236576 + 3.32386 19566.8 1.47347 0.236752 + 3.3328 14939.7 1.47361 0.236929 + 3.34178 15236.9 1.47375 0.237106 + 3.35081 11883 1.47389 0.237285 + 3.35989 13499.1 1.47403 0.237076 + 3.36902 11113.4 1.47417 0.236867 + 3.3782 12880.7 1.47432 0.236656 + 3.38743 11690.4 1.47446 0.236444 + 3.39671 11697.1 1.47461 0.236231 + 3.40604 10168.6 1.47475 0.236046 + 3.41543 10994.1 1.4749 0.23586 + 3.42486 9144.58 1.47505 0.235673 + 3.43435 9802.3 1.47519 0.235485 + 3.44389 8845.76 1.47534 0.235296 + 3.45348 8441.16 1.47549 0.234754 + 3.46313 7968.34 1.47564 0.234209 + 3.47283 8982.26 1.4758 0.233661 + 3.48258 8789.07 1.47595 0.23311 + 3.49239 8059.54 1.4761 0.232556 + 3.50226 7160.54 1.47626 0.232441 + 3.51218 8608.07 1.47641 0.232326 + 3.52216 8334.9 1.47657 0.23221 + 3.53219 8199.58 1.47672 0.232093 + 3.54229 7473.83 1.47688 0.231976 + 3.55244 7992.58 1.47706 0.232028 + 3.56264 7598.74 1.47724 0.232081 + 3.57291 7569.08 1.47743 0.232134 + 3.58324 7586.28 1.47761 0.232188 + 3.59362 7994.28 1.4778 0.232241 + 3.60407 7676.33 1.47798 0.232159 + 3.61458 8582.41 1.47817 0.232076 + 3.62515 8527.88 1.47836 0.231993 + 3.63578 8731.97 1.47855 0.231909 + 3.64647 7097.15 1.47874 0.231825 + 3.65723 7442.32 1.47893 0.231847 + 3.66805 7232.72 1.47912 0.23187 + 3.67893 7802.04 1.47931 0.231893 + 3.68988 6815.36 1.47951 0.231916 + 3.7009 8112.69 1.47971 0.231939 + 3.71198 7976.21 1.4799 0.232056 + 3.72312 7518.95 1.4801 0.232174 + 3.73434 7129.07 1.4803 0.232292 + 3.74562 6605.36 1.4805 0.232412 + 3.75697 6938.29 1.4807 0.232532 + 3.76839 7343.29 1.48091 0.232449 + 3.77988 7465.4 1.48111 0.232366 + 3.79144 7620.21 1.48132 0.232282 + 3.80307 6652.65 1.48152 0.232198 + 3.81477 5868.5 1.48173 0.232114 + 3.82654 5987.61 1.48194 0.231788 + 3.83839 6544.72 1.48215 0.23146 + 3.85031 7304.02 1.48237 0.23113 + 3.86231 6785.85 1.48258 0.230798 + 3.87437 6568.61 1.48279 0.230463 + 3.88652 6541.39 1.48301 0.229834 + 3.89874 4918.77 1.48323 0.229201 + 3.91104 6681.45 1.48345 0.228564 + 3.92342 6168.32 1.48367 0.227922 + 3.93587 5868.57 1.48389 0.227277 + 3.94841 6118.12 1.48415 0.226647 + 3.96102 6149.43 1.48441 0.226014 + 3.97372 6258.03 1.48468 0.225376 + 3.9865 5824.66 1.48494 0.224734 + 3.99935 5797.65 1.48521 0.224088 + 4.0123 5594.66 1.48548 0.223465 + 4.02532 5747.69 1.48575 0.222838 + 4.03844 5789.42 1.48603 0.222206 + 4.05163 5818.49 1.4863 0.221571 + 4.06492 5543.46 1.48658 0.220931 + 4.07829 5211.72 1.48686 0.219714 + 4.09175 5046.62 1.48714 0.218488 + 4.1053 4957.41 1.48742 0.217255 + 4.11894 5128.48 1.48771 0.216013 + 4.13267 5187.96 1.48799 0.214764 + 4.14649 4927.56 1.48828 0.213563 + 4.1604 4821.81 1.48857 0.212355 + 4.17441 4891.24 1.48886 0.211139 + 4.18851 5177.64 1.48916 0.209914 + 4.20271 5124.2 1.48945 0.208681 + 4.21701 5151.36 1.48975 0.207758 + 4.2314 5236.82 1.49005 0.206829 + 4.24589 4869.67 1.49035 0.205894 + 4.26048 4871.71 1.49066 0.204952 + 4.27517 4666.08 1.49096 0.204003 + 4.28997 4383.56 1.49127 0.202881 + 4.30486 4203.12 1.49158 0.201751 + 4.31986 4402.24 1.4919 0.200613 + 4.33497 4587.1 1.49221 0.199468 + 4.35018 4471.17 1.49253 0.198314 + 4.36549 4267.72 1.49285 0.197222 + 4.38092 3992.98 1.49317 0.196122 + 4.39645 3874.69 1.49349 0.195014 + 4.4121 3779.49 1.49382 0.193898 + 4.42786 3675.45 1.49415 0.192774 + 4.44373 3602.88 1.49455 0.19185 + 4.45971 3671.33 1.49496 0.19092 + 4.47581 3876.48 1.49537 0.189982 + 4.49203 3613.91 1.49578 0.189038 + 4.50836 3411.4 1.4962 0.188087 + 4.52482 3493.46 1.49661 0.186929 + 4.54139 3400.96 1.49704 0.185763 + 4.55809 3248.27 1.49746 0.184588 + 4.57491 3104.18 1.49789 0.183405 + 4.59185 3007.9 1.49832 0.182212 + 4.60892 2914.21 1.49876 0.181477 + 4.62612 2870.88 1.49919 0.180735 + 4.64345 2941.63 1.49963 0.179989 + 4.6609 2910.71 1.50008 0.179236 + 4.67849 2728.11 1.50053 0.178478 + 4.69621 2603.23 1.50098 0.177884 + 4.71407 2627.66 1.50143 0.177285 + 4.73206 2577.68 1.50189 0.176682 + 4.75019 2442.49 1.50235 0.176074 + 4.76846 2408.94 1.50282 0.175461 + 4.78687 2386.65 1.50329 0.174629 + 4.80543 2334 1.50376 0.173789 + 4.82412 2278.74 1.50424 0.172944 + 4.84297 2217.99 1.50472 0.172091 + 4.86196 2134.06 1.5052 0.171232 + 4.8811 2097.74 1.50569 0.170733 + 4.9004 2097.77 1.50618 0.17023 + 4.91984 2055.2 1.50667 0.169723 + 4.93944 1992.34 1.50717 0.169212 + 4.9592 1951.1 1.50767 0.168697 + 4.97912 1923.29 1.50818 0.168375 + 4.99919 1923.66 1.50869 0.168051 + 5.01943 1908.47 1.50921 0.167725 + 5.03984 1850.26 1.50973 0.167395 + 5.06041 1785.48 1.51025 0.167063 + 5.08115 1756.03 1.51094 0.166787 + 5.10206 1709.54 1.51163 0.166509 + 5.12314 1640.42 1.51233 0.166228 + 5.1444 1615.88 1.51304 0.165945 + 5.16583 1594.34 1.51376 0.16566 + 5.18745 1520.19 1.51447 0.165735 + 5.20924 1486.17 1.5152 0.16581 + 5.23122 1476.55 1.51593 0.165886 + 5.25339 1450.24 1.51667 0.165962 + 5.27574 1403.36 1.51741 0.166039 + 5.29829 1358.23 1.51817 0.16609 + 5.32103 1357.9 1.51892 0.166142 + 5.34397 1321.94 1.51969 0.166194 + 5.3671 1279.2 1.52046 0.166247 + 5.39043 1264.16 1.52123 0.1663 + 5.41397 1233.16 1.52202 0.166164 + 5.43772 1202.8 1.52281 0.166027 + 5.46167 1167.21 1.52361 0.165889 + 5.48584 1136.48 1.52441 0.16575 + 5.51022 1111.15 1.52522 0.165609 + 5.53482 1078.99 1.52604 0.165417 + 5.55964 1055.39 1.52687 0.165223 + 5.58468 1028.72 1.5277 0.165027 + 5.60995 1001.34 1.52854 0.16483 + 5.63545 962.885 1.52939 0.164631 + 5.66119 939.395 1.53025 0.164954 + 5.68716 926.548 1.53111 0.165281 + 5.71336 904.427 1.53199 0.16561 + 5.73981 881.682 1.53287 0.165943 + 5.76651 848.42 1.53375 0.166278 + 5.79346 818.019 1.53465 0.167092 + 5.82066 788.519 1.53556 0.167914 + 5.84811 769.593 1.53647 0.168743 + 5.87583 747.919 1.53739 0.169581 + 5.90381 722.293 1.53833 0.170426 + 5.93206 704.71 1.53939 0.171972 + 5.96058 682.603 1.54048 0.173534 + 5.98937 653.73 1.54159 0.17511 + 6.01845 641.046 1.54272 0.176702 + 6.0478 617.682 1.54387 0.178309 + 6.07745 600.051 1.54504 0.180543 + 6.10739 580.477 1.54623 0.182799 + 6.13762 562.153 1.54744 0.185077 + 6.16816 545.291 1.54867 0.187379 + 6.199 529.478 1.54993 0.189703 + 6.23015 514.628 1.55121 0.192684 + 6.26162 513.434 1.55251 0.195696 + 6.2934 512.133 1.55384 0.198738 + 6.32551 511.447 1.55519 0.201811 + 6.35795 439.93 1.55656 0.204916 + 6.39072 428.416 1.55797 0.208053 + 6.42383 366.054 1.55939 0.211703 + 6.45729 353.782 1.56085 0.215597 + 6.4911 320.244 1.56233 0.219533 + 6.52526 307.814 1.56384 0.22351 + 6.55979 275.783 1.56537 0.227529 + 6.59468 262.084 1.56694 0.231591 + 6.62995 238.497 1.56854 0.233567 + 6.66559 213.698 1.57017 0.235325 + 6.70162 188.606 1.57182 0.237103 + 6.73804 165.035 1.57351 0.2389 + 6.77486 139.914 1.57524 0.240717 + 6.81209 119.153 1.577 0.241684 + 6.84972 96.5308 1.57879 0.240623 + 6.88778 76.5459 1.58061 0.239549 + 6.92626 56.442 1.58248 0.238464 + 6.96517 42.4659 1.58438 0.237367 + 7.00452 30.8679 1.58631 0.236257 + 7.04432 22.1757 1.58829 0.235135 + 7.08457 16.0269 1.5903 0.234 + 7.12529 11.435 1.59236 0.225402 + 7.16647 8.15213 1.59446 0.216705 + 7.20814 5.90063 1.5966 0.207907 + 7.25029 4.31129 1.59878 0.199006 + 7.29294 2.51662 1.60101 0.19 + 7.33609 1.40588 1.60329 0.165996 + 7.37976 0.90473 1.60561 0.141707 + 7.42395 0.607825 1.60798 0.117127 + 7.46867 0.406217 1.6104 0.0922502 + 7.51394 0.280283 1.61288 0.0670723 + 7.55976 0.200589 1.6154 0.0504302 + 7.60613 0.147386 1.61798 0.0358083 + 7.65309 0.114884 1.62061 0.0210059 + 7.70062 0.0912859 1.6233 0.00601963 + 7.74875 0.0734036 1.62605 0.00263214 + 7.79748 0.0589519 1.62885 0.00216712 + 7.84684 0.0469131 1.63172 0.0016962 + 7.89682 0.0371046 1.63465 0.00121929 + 7.94744 0.0294007 1.63765 0.000736264 + 7.99871 0.0241944 1.64071 0.000247005 + 8.05065 0.0206966 1.64384 8.324e-05 + 8.10327 0.0194338 1.64704 0.000251352 + 8.15658 0.0193915 1.65031 0.000421676 + 8.2106 0.0189303 1.65366 0.000594257 + 8.26533 0.0185381 1.65708 0.000769138 + 8.32081 0.0190375 1.66058 0.000946367 + 8.37703 0.0187298 1.66416 0.001 + 8.43401 0.018829 1.66783 0.001 + 8.49178 0.0187354 1.67158 0.001 + 8.55034 0.0192285 1.67542 0.001 + 8.60972 0.0188919 1.67935 0.001 + 8.66993 0.0192815 1.68337 0.001 + 8.73099 0.0194481 1.68748 0.001 + 8.79291 0.019913 1.6917 0.001 + 8.85571 0.0195815 1.69602 0.000940787 + 8.91942 0.0192759 1.70044 0.000741565 + 8.98406 0.0191289 1.70497 0.000539456 + 9.04964 0.0203454 1.70961 0.000334396 + 9.11618 0.0208513 1.71437 0.000126321 + 9.1837 0.0197308 1.71925 3.71556e-05 + 9.25224 0.0191745 1.72425 0.000131015 + 9.3218 0.019876 1.72937 0.000226286 + 9.39242 0.019708 1.73462 0.000323 + 9.46412 0.0205427 1.74001 0.000421191 + 9.53692 0.0190949 1.74554 0.000520892 + 9.61085 0.0188724 1.75121 0.00062214 + 9.68594 0.0186789 1.75703 0.000724969 + 9.7622 0.0182816 1.763 0.000829417 + 9.83968 0.0182196 1.76913 0.000935524 + 9.9184 0.018432 1.77542 0.001 + 9.99839 0.0182141 1.78189 0.001 + 10.0797 0.0182135 1.78852 0.001 + 10.1623 0.0186466 1.79534 0.001 + 10.2463 0.0184323 1.80234 0.00116253 + 10.3317 0.0184357 1.80954 0.00143704 diff --git a/Detectors/FIT/V0/base/include/V0Base/Geometry.h b/Detectors/FIT/V0/base/include/V0Base/Geometry.h new file mode 100644 index 0000000000000..09da0758504b3 --- /dev/null +++ b/Detectors/FIT/V0/base/include/V0Base/Geometry.h @@ -0,0 +1,85 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file Geometry.h +/// \brief Base definition of FIT-V0+ geometry. +/// +/// \author Maciej Slupecki, University of Jyvaskyla, Finland + +#ifndef ALICEO2_FITV0_GEOMETRY_H_ +#define ALICEO2_FITV0_GEOMETRY_H_ + +#include +#include +#include + +namespace o2 +{ +namespace v0 +{ +/// FIT-V0+ Geometry +class Geometry +{ + public: + enum EGeoType { + eUninitilized, + eDummy, + eOnlySensitive, + eFull + }; // Geometry type options possible to be initialized + + /// + /// Default constructor. + /// It must be kept public for root persistency purposes, + /// but should never be called by the outside world + Geometry(){mGeometryType = eUninitilized;}; + /// Standard constructor + /// \param initType[in] The type of geometry, that will be initialized + /// -> initType == 0 => only sensitive detector parts + /// -> initType == 1 => sensitive parts and rough structural elements + /// -> initType == 2 => complete, detailed geometry (including screws, etc.) + /// \return - + Geometry(EGeoType initType); + /// Copy constructor. + Geometry(const Geometry& geom); + + static constexpr float sEpsilon = 0.01; // variable used to make sure one spatial dimension is infinitesimaly larger than the other + static constexpr float sDrSeparationScint = 0.03 + 0.04; // paint thickness + separation gap + static constexpr float sDzScint = 2; + static constexpr float sPhiMinScint = 0; + static constexpr float sDphiScint = 45; + static constexpr float sGlobalPhiRotation = 90; + static constexpr float sDySeparationScint = sDrSeparationScint; + static constexpr int sBaseNumberOfSectors = 8; // number of sectors + // TODO: Adjust the sZposition once the simulation geometry is implemented, T0 starts at 328 + // at sZposition==320, there is a gap (to be filled with fibers and support) of 8 cm between the plastic of V0+ and aluminum covers of T0+ + static constexpr float sZposition = 320-sDzScint; // z-position of the geometrical center of the detectors sensitive part + + private: + void initializeVectors(); + void initializeLuts(); + + void buildGeometry(); + void assembleSectors(TGeoVolumeAssembly *volV0); + TGeoVolumeAssembly* buildSector(uint16_t iSector); + + std::vector mvrAvgScint; // average ring radii (index 0 -> ring 1 min, index 1 -> ring 1 max and ring 2 min, ... index 5 -> ring 5 max) + // The following radii include separation between rings + std::vector mvrMinScint; // lower radii of a ring (.at(0) -> ring 1, .at(4) -> ring 5) + std::vector mvrMaxScint; // upper radii of a ring (.at(0) -> ring 1, .at(4) -> ring 5) + std::vector mvPhiRot; + + int mGeometryType; // same meaning as initType in constructor + + ClassDefNV(Geometry, 1); +}; +} // namespace v0 +} // namespace o2 +#endif diff --git a/Detectors/FIT/V0/base/src/Geometry.cxx b/Detectors/FIT/V0/base/src/Geometry.cxx new file mode 100644 index 0000000000000..334b49c5dd796 --- /dev/null +++ b/Detectors/FIT/V0/base/src/Geometry.cxx @@ -0,0 +1,122 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include +//#include +#include "V0Base/Geometry.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +ClassImp(o2::v0::Geometry); + +using namespace o2::v0; + +Geometry::Geometry(EGeoType initType){ + mGeometryType = initType; + initializeVectors(); + initializeLuts(); + buildGeometry(); +} + +Geometry::Geometry(const Geometry& geom){ + this->mGeometryType = geom.mGeometryType; +} + +void Geometry::initializeVectors(){ + // RADII + // Index of rAvgScint is NOT linked directly to any ring number + mvrAvgScint.push_back(4.01); // ring 1 lower radius + mvrAvgScint.push_back(7.25); // ring 1 upper radius and ring 2 lower radius + mvrAvgScint.push_back(12.83); + mvrAvgScint.push_back(21.22); + mvrAvgScint.push_back(38.664); + mvrAvgScint.push_back(72.09); + + // Set real plastic radi (reduced by painting of 0.06 and separation gap of 0.08) + for(uint16_t ir=1; irRegisterYourself(); + } +} + +void Geometry::buildGeometry(){ + TGeoVolume* vALIC = gGeoManager->GetVolume("cave"); + if (!vALIC) { + LOG(FATAL) << "Could not find the top volume"; + } + + // Top volume of FIT V0 detector + TGeoVolumeAssembly* volV0 = new TGeoVolumeAssembly("FITV0"); + LOG(INFO) << "Geometry::buildGeometry()::Volume name = " << volV0->GetName(); + assembleSectors(volV0); + + TGeoTranslation* trGlobalZshift = new TGeoTranslation(0,0,sZposition); + + vALIC->AddNode(volV0, 0, trGlobalZshift); +} + +TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ + TGeoBBox *geoBoxClockwise = new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size()-1), sDySeparationScint*2, sDzScint+sEpsilon); + + std::stringstream ssName; + ssName << "sector" << iSector+1; + TGeoVolumeAssembly *sector = new TGeoVolumeAssembly(ssName.str().c_str()); + for(uint16_t ir=0; irGetMedium("V0_Scintillator"); + TGeoVolume *volCell = new TGeoVolume("cell", geoCell, kMed); + + volCell->SetLineColor(kYellow); + sector->AddNode(volCell, iCell+1); + } + return sector; +} + +void Geometry::assembleSectors(TGeoVolumeAssembly *volV0){ +// for(uint16_t isector=0; isector<1; isector++){ + for(uint16_t isector=0; isectorAddNode(sector, isector+1, mvPhiRot.at(isector)); + } +} + +void Geometry::initializeLuts(){ + // TODO: initialize sth +} diff --git a/Detectors/FIT/V0/base/src/V0BaseLinkDef.h b/Detectors/FIT/V0/base/src/V0BaseLinkDef.h new file mode 100644 index 0000000000000..7de04be8eb1c8 --- /dev/null +++ b/Detectors/FIT/V0/base/src/V0BaseLinkDef.h @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::v0::Geometry + ; + +#endif diff --git a/Detectors/FIT/V0/simulation/CMakeLists.txt b/Detectors/FIT/V0/simulation/CMakeLists.txt new file mode 100644 index 0000000000000..10e250fc4cc77 --- /dev/null +++ b/Detectors/FIT/V0/simulation/CMakeLists.txt @@ -0,0 +1,19 @@ +set(MODULE_NAME "V0Simulation") + +O2_SETUP(NAME ${MODULE_NAME}) + +set(SRCS + src/Detector.cxx + #src/DigitizerTask.cxx + ) + +set(HEADERS + include/${MODULE_NAME}/Detector.h + #include/${MODULE_NAME}/DigitizerTask.h + ) + +Set(LINKDEF src/V0SimulationLinkDef.h) +Set(LIBRARY_NAME ${MODULE_NAME}) +set(BUCKET_NAME fit_simulation_bucket) + +O2_GENERATE_LIBRARY() diff --git a/Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h b/Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h new file mode 100644 index 0000000000000..73ba671ac58c8 --- /dev/null +++ b/Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h @@ -0,0 +1,146 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file Detector.h +/// \brief Definition of the Detector class + +#ifndef ALICEO2_V0_DETECTOR_H_ +#define ALICEO2_V0_DETECTOR_H_ + +#include "TLorentzVector.h" + +#include "SimulationDataFormat/BaseHits.h" +#include "DetectorsBase/Detector.h" // for Detector +#include "V0Base/Geometry.h" +#include "V0Simulation/Hit.h" + +class FairModule; + +class FairVolume; +class TGeoVolume; +class TGraph; + +// TODO: Check run/O2HitMerger.h:471 - problem with merging stage of o2sim (no o2sim.root file is created) +// TODO: Perhaps it will start working correctly once any geometry with sensitive parts is defined and hit processing works + +namespace o2 +{ +namespace v0 +{ +class Geometry; +} +} // namespace o2 + +namespace o2 +{ +namespace v0 +{ +// using HitType = o2::BasicXYZEHit; +class Geometry; +class Detector : public o2::Base::DetImpl +{ + public: + /// Default constructor + Detector(); + + /// Default destructor + ~Detector() override; + + /// Constructor with on/off flag + /// \param isActive kTRUE for active detectors (ProcessHits() will be called), + /// kFALSE for inactive detectors + Detector(Bool_t isActive); + + /// Initializes the detector (adds sensitive volume) + void InitializeO2Detector() override; + + /// This method is called for each step during simulation (see FairMCApplication::Stepping()) + Bool_t ProcessHits(FairVolume* v = nullptr) override; + +// ------------------------------------------------------------------ + + /// Registers the produced collections in FAIRRootManager + void Register() override; + + std::vector* getHits(Int_t iColl) {if (iColl == 0) {return mHits;} return nullptr;} + /// Gets the produced hits + + /// Has to be called after each event to reset the containers + void Reset() override; + + /// Called at the end of event + void EndOfEvent() override; + +// TODO: From MFT -> are they needed? +// void FinishPrimary() override { ; } +// void FinishRun() override { ; } +// void BeginPrimary() override { ; } +// void PostTrack() override { ; } +// void PreTrack() override { ; } +// void SetSpecialPhysicsCuts() override { ; } + + // TODO: move to private + /// Creates materials for the detector + void createMaterials(); + + /// Creates materials and geometry + void ConstructGeometry() override; // inherited from FairModule + + enum EMedia { + Zero, + Air, + Scintillator + }; // media IDs used in CreateMaterials + + private: + /// Container for hits + std::vector* mHits = nullptr; + + /// Geometry pointer + Geometry* mGeometry = nullptr; //! Geometry + + /// Transient data about track passing the sensor, needed by ProcessHits() + struct TrackData { // this is transient + bool mHitStarted; //! hit creation started + unsigned char mTrkStatusStart; //! track status flag + TLorentzVector mPositionStart; //! position at entrance + TLorentzVector mMomentumStart; //! momentum + double mEnergyLoss; //! energy loss + } mTrackData; //! + + o2::v0::Hit* addHit(Int_t trackId, Int_t cellId, Int_t particleId, + TVector3 startPos, TVector3 endPos, + TVector3 startMom, double startE, + double endTime, double eLoss, float eTot, float eDep); + + template + friend class o2::Base::DetImpl; + ClassDefOverride(Detector, 1) +}; + +// Input and output function for standard C++ input/output. +std::ostream& operator<<(std::ostream& os, Detector& source); +std::istream& operator>>(std::istream& os, Detector& source); +} // namespace v0 +} // namespace o2 +#ifdef USESHM +namespace o2 +{ +namespace Base +{ +template <> +struct UseShm { + static constexpr bool value = true; +}; +} // namespace Base +} // namespace o2 +#endif + +#endif diff --git a/Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h b/Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h new file mode 100644 index 0000000000000..035e7727fc1fa --- /dev/null +++ b/Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h @@ -0,0 +1,129 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file Hit.h +/// \brief Definition of the FIT-V0 Hit class (based on ITSMFT) + +#ifndef ALICEO2_FIT_V0_HIT_H_ +#define ALICEO2_FIT_V0_HIT_H_ + +#include "SimulationDataFormat/BaseHits.h" // for BasicXYZEHit +#include "Rtypes.h" // for Bool_t, Double_t, Int_t, Double32_t, etc +#include "TVector3.h" // for TVector3 +#include +#include "CommonUtils/ShmAllocator.h" + +namespace o2 { +namespace v0 { + +class Hit : public o2::BasicXYZEHit +{ + public: + + /// Default constructor + Hit() = default; + + /// Class Constructor + /// \param trackID Index of MCTrack + /// \param cellID Cell ID + /// \param startPos Coordinates at entrance to active volume [cm] + /// \param pos Coordinates to active volume [cm] + /// \param mom Momentum of track at entrance [GeV] + /// \param endTime Time at entrance [ns] + /// \param time Time since event start [ns] + /// \param eLoss Energy deposit [GeV] + /// \param startStatus: status at entrance + /// \param endStatus: status at exit + inline Hit(int trackID, int cellID, const TVector3& startPos, const TVector3& endPos, + const TVector3& startMom, double startE, double endTime, double eLoss, + float eTot, float eDep); // last two are for testing only + + // Entrance position getters + Point3D GetPosStart() const { return mPosStart; } + Float_t GetStartX() const { return mPosStart.X(); } + Float_t GetStartY() const { return mPosStart.Y(); } + Float_t GetStartZ() const { return mPosStart.Z(); } + template void GetStartPosition(F &x, F &y, F &z) const + { + x = GetStartX(); + y = GetStartY(); + z = GetStartZ(); + } + // momentum getters + Vector3D GetMomentum() const { return mMomentum; } + Vector3D& GetMomentum() { return mMomentum; } + Float_t GetPx() const { return mMomentum.X(); } + Float_t GetPy() const { return mMomentum.Y(); } + Float_t GetPz() const { return mMomentum.Z(); } + Float_t GetE() const { return mE; } + Float_t GetTotalEnergy() const { return GetE(); } +/* + UChar_t GetStatusEnd() const { return mTrackStatusEnd; } + UChar_t GetStatusStart() const { return mTrackStatusStart; } + + Bool_t IsEntering() const { return mTrackStatusEnd & kTrackEntering; } + Bool_t IsInside() const { return mTrackStatusEnd & kTrackInside; } + Bool_t IsExiting() const { return mTrackStatusEnd & kTrackExiting; } + Bool_t IsOut() const { return mTrackStatusEnd & kTrackOut; } + Bool_t IsStopped() const { return mTrackStatusEnd & kTrackStopped; } + Bool_t IsAlive() const { return mTrackStatusEnd & kTrackAlive; } + + Bool_t IsEnteringStart() const { return mTrackStatusStart & kTrackEntering; } + Bool_t IsInsideStart() const { return mTrackStatusStart & kTrackInside; } + Bool_t IsExitingStart() const { return mTrackStatusStart & kTrackExiting; } + Bool_t IsOutStart() const { return mTrackStatusStart & kTrackOut; } + Bool_t IsStoppedStart() const { return mTrackStatusStart & kTrackStopped; } + Bool_t IsAliveStart() const { return mTrackStatusStart & kTrackAlive; } + + /// Output to screen + friend std::ostream &operator<<(std::ostream &of, const Hit &point) + { + of << "-I- Hit: O2its point for track " << point.GetTrackID() << " in detector " << point.GetDetectorID() << std::endl; + //of << " Position (" << point.fX << ", " << point.fY << ", " << point.fZ << ") cm" << std::endl; + //of << " Momentum (" << point.fPx << ", " << point.fPy << ", " << point.fPz << ") GeV" << std::endl; + //of << " Time " << point.fTime << " ns, Length " << point.fLength << " cm, Energy loss " + //<< point.fELoss * 1.0e06 << " keV" << std::endl; + return of; + } +*/ + void Print(const Option_t *opt) const; + + private: + Vector3D mMomentum; ///< momentum at entrance + Point3D mPosStart; ///< position at entrance (base mPos give position on exit) + Float_t mE; ///< total energy at entrance + + ClassDefNV(Hit, 1) +}; + +Hit::Hit(int trackID, int detID, const TVector3& startPos, const TVector3& endPos, + const TVector3& startMom, double startE, double endTime, double eLoss, + float eTot, float eDep) + : BasicXYZEHit(endPos.X(), endPos.Y(), endPos.Z(), endTime, eLoss, trackID, detID), + mMomentum(startMom.Px(), startMom.Py(), startMom.Pz()), + mPosStart(startPos.X(), startPos.Y(), startPos.Z()), + mE(startE) +// TODO: may require adding initialization to eTot and eDep and corresponding fields in the Hit.h header +{} + +} // namespace v0 +} // namespace o2 + +#ifdef USESHM +namespace std +{ +template <> +class allocator : public o2::utils::ShmAllocator +{ +}; + +} // namespace std +#endif /* USESHM */ +#endif /* ALICEO2_FIT_V0_HIT_H_ */ diff --git a/Detectors/FIT/V0/simulation/src/Detector.cxx b/Detectors/FIT/V0/simulation/src/Detector.cxx new file mode 100644 index 0000000000000..ca21a05fce0c5 --- /dev/null +++ b/Detectors/FIT/V0/simulation/src/Detector.cxx @@ -0,0 +1,383 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "TGeoManager.h" // for TGeoManager +#include "TMath.h" +#include "TGraph.h" +#include "TString.h" +#include "TSystem.h" +#include "TVirtualMC.h" +#include "TVector3.h" +#include "TLorentzVector.h" + +#include "FairRootManager.h" // for FairRootManager +#include "FairLogger.h" +#include "FairVolume.h" + +#include "FairRootManager.h" +#include "FairVolume.h" + +#include +#include "V0Simulation/Detector.h" +#include "V0Base/Geometry.h" +#include "SimulationDataFormat/Stack.h" + +using namespace o2::v0; +using o2::v0::Geometry; + +ClassImp(Detector); + +Detector::Detector() + : o2::Base::DetImpl("V0", kTRUE), + mHits(o2::utils::createSimVector()), + mGeometry(nullptr), + mTrackData(){ + // Empty +} + +Detector::~Detector() { + if (mHits) { + o2::utils::freeSimVector(mHits); // delete mHits; + } + if (mGeometry){ + delete mGeometry; + } +} + +Detector::Detector(Bool_t isActive) + : o2::Base::DetImpl ("V0", isActive), + mHits(o2::utils::createSimVector()), + mGeometry(nullptr), + mTrackData(){ + // Empty +} + +void Detector::InitializeO2Detector() +{ + LOG(INFO) << "Initializing FIT V0 geometry\n"; + + TGeoVolume* volSensitive = gGeoManager->GetVolume("cell"); + if (!volSensitive) { + LOG(FATAL) << "Can't find FIT V0 sensitive volume: cell"; + } + else { + AddSensitiveVolume(volSensitive); + LOG(INFO) << "FIT-V0: Sensitive volume: " << volSensitive->GetName() << " " << volSensitive->GetNumber(); + // TODO: Code from MFT +// if (!mftGeom->getSensorVolumeID()) { +// mftGeom->setSensorVolumeID(vol->GetNumber()); +// } +// else if (mftGeom->getSensorVolumeID() != vol->GetNumber()) { +// LOG(FATAL) << "CreateSensors: different Sensor volume ID !!!!"; +// } + } +} + +// TODO: Check if it works and remove some fields if same in MFT base as in T0 +Bool_t Detector::ProcessHits(FairVolume* v){ + // This method is called from the MC stepping + + // Track only charged particles and photons + bool isPhotonTrack = false; + Int_t particleId = fMC->TrackPid(); + if (particleId == 50000050){ // If particle is photon + isPhotonTrack = true; + } + if (!(isPhotonTrack || fMC->TrackCharge())) { + return kFALSE; + } + + // TODO: Uncomment or change the approach after geometry is ready +// Geometry* v0Geo = Geometry::instance(); +// Int_t copy; + // Check if hit is into a FIT-V0 sensitive volume +// if (fMC->CurrentVolID(copy) != v0Geo->getSensorVolumeID()) +// return kFALSE; + + // Get unique ID of the cell + Int_t cellId = -1; + fMC->CurrentVolOffID(1, cellId); + + // Check track status to define when hit is started and when it is stopped + bool startHit = false, stopHit = false; + if ((fMC->IsTrackEntering()) || (fMC->IsTrackInside() && !mTrackData.mHitStarted)) { + startHit = true; + } else if ((fMC->IsTrackExiting() || fMC->IsTrackOut() || fMC->IsTrackStop())) { + stopHit = true; + } + + // Track is entering or created in the volume + if (startHit) { + mTrackData.mEnergyLoss = 0.; + fMC->TrackMomentum(mTrackData.mMomentumStart); + fMC->TrackPosition(mTrackData.mPositionStart); + mTrackData.mHitStarted = true; + } + // Track is exiting or stopped within the volume + if (stopHit) { + TLorentzVector positionStop; + fMC->TrackPosition(positionStop); + Int_t trackID = fMC->GetStack()->GetCurrentTrackNumber(); + + // TODO: compare this base with methods used by T0 (3 lines below) + float etot = fMC->Etot(); + float eDep = fMC->Edep(); + addHit(trackID, cellId, particleId, + mTrackData.mPositionStart.Vect(), positionStop.Vect(), + mTrackData.mMomentumStart.Vect(), mTrackData.mMomentumStart.E(), + positionStop.T(), mTrackData.mEnergyLoss, etot, eDep); + } + return kTRUE; +} + +o2::v0::Hit* Detector::addHit(Int_t trackId, Int_t cellId, Int_t particleId, + TVector3 startPos, TVector3 endPos, + TVector3 startMom, double startE, + double endTime, double eLoss, float eTot, float eDep){ + + mHits->emplace_back(trackId, cellId, startPos, endPos, startMom, startE, endTime, eLoss, eTot, eDep); + auto stack = (o2::Data::Stack*)fMC->GetStack(); + stack->addHit(GetDetId()); + return &(mHits->back()); +} + +// TODO: -> verify Todos inside the function +void Detector::createMaterials() +{ + // Air mixture + const Int_t nAir = 4; + Float_t aAir[nAir] = { 12.0107, 14.0067, 15.9994, 39.948 }; + Float_t zAir[nAir] = { 6, 7, 8, 18 }; + Float_t wAir[nAir] = { 0.000124, 0.755267, 0.231781, 0.012827 }; + Float_t dAir = 0.00120479; + + // Scintillator mixture; TODO: Looks very rough, improve these numbers? + const Int_t nScint = 2; + Float_t aScint[nScint] = { 1, 12.01}; + Float_t zScint[nScint] = { 1, 6, }; + Float_t wScint[nScint] = { 0.016, 0.984}; + Float_t dScint = 1.023; + + // Aluminum +// Float_t aAlu = 26.98; +// Float_t zAlu = 13.; +// Float_t dAlu = 2.70; // density [gr/cm^3] +// Float_t radAlu = 8.897; // rad len [cm] +// Float_t absAlu = 39.70; // abs len [cm] + + + Int_t matId = 0; // tmp material id number + const Int_t unsens = 0, sens = 1; // sensitive or unsensitive medium + + // TODO: After the simulation is running cross run for both sets of numbers and verify if they matter to us -> choose faster solution + Float_t tmaxfd = -10.0; // in t0: 10 // max deflection angle due to magnetic field in one step + Float_t stemax = 0.001; // in t0: 0.1 // max step allowed [cm] + Float_t deemax = -0.2; // in t0: 1.0 // maximum fractional energy loss in one step 0>>>> fieldType " << fieldType << " maxField " << maxField; + + // TODO: Comment out two lines below once tested that the above function assigns field type and max correctly + fieldType = 2; + maxField = 10.; + + o2::Base::Detector::Mixture(++matId, "Air$", aAir, zAir, dAir, nAir, wAir); + o2::Base::Detector::Medium(Air, "Air$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); + + o2::Base::Detector::Mixture(++matId, "Scintillator", aScint, zScint, dScint, nScint, wScint); + o2::Base::Detector::Medium(Scintillator, "Scintillator$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); + +// o2::Base::Detector::Material(++matId, "Alu$", aAlu, zAlu, dAlu, radAlu, absAlu); +// o2::Base::Detector::Medium(Alu, "Alu$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); + + LOG(DEBUG) << "Detector::createMaterials -----> matId = " << matId; +} + +void Detector::ConstructGeometry() +{ + LOG(DEBUG) << "Creating FIT V0 geometry\n"; + createMaterials(); + mGeometry = new Geometry(Geometry::eOnlySensitive); +} + +void Detector::Register() +{ + // This will create a branch in the output tree called Hit, setting the last + // parameter to kFALSE means that this collection will not be written to the file, + // it will exist only during the simulation + + if (FairRootManager::Instance()) { + FairRootManager::Instance()->RegisterAny(addNameTo("Hit").data(), mHits, kTRUE); + } +} + +void Detector::EndOfEvent() +{ + Reset(); +} + +void Detector::Reset() +{ + if (!o2::utils::ShmManager::Instance().isOperational()) { + mHits->clear(); + } +} + + + + + + +/*void Detector::DefineOpticalProperties() +{ + // Path of the optical properties input file + TString inputDir; + const char* aliceO2env = std::getenv("O2_ROOT"); + if (aliceO2env) + inputDir = aliceO2env; + inputDir += "/share/Detectors/T0/files/"; + + TString optPropPath = inputDir + "quartzOptProperties.txt"; + optPropPath = gSystem->ExpandPathName(optPropPath.Data()); // Expand $(ALICE_ROOT) into real system path + + if (ReadOptProperties(optPropPath.Data()) < 0) { + // Error reading file + LOG(ERROR) << "Could not read FIT optical properties" << FairLogger::endl; + return; + } + Int_t nBins = mPhotonEnergyD.size(); + // set QE + mPMTeff = new TGraph(nBins, &(mPhotonEnergyD[0]), &(mQuantumEfficiency[0])); + + // Prepare pointers for arrays with constant and hardcoded values (independent on wavelength) + FillOtherOptProperties(); + + // Quick conversion from vector to Double_t*: photonEnergyD -> &(photonEnergyD[0]) + TVirtualMC::GetMC()->SetCerenkov(getMediumID(kOpGlass), nBins, &(mPhotonEnergyD[0]), &(mAbsorptionLength[0]), + &(mEfficAll[0]), &(mRefractionIndex[0])); + // TVirtualMC::GetMC()->SetCerenkov (getMediumID(kOpGlassCathode), kNbins, aPckov, aAbsSiO2, effCathode, rindexSiO2); + TVirtualMC::GetMC()->SetCerenkov(getMediumID(kOpGlassCathode), nBins, &(mPhotonEnergyD[0]), &(mAbsorptionLength[0]), + &(mEfficAll[0]), &(mRefractionIndex[0])); + + // Define a border for radiator optical properties + //TVirtualMC::GetMC()->DefineOpSurface("surfRd", kGlisur, kDielectric_metal, kPolished, 0.); + TVirtualMC::GetMC()->DefineOpSurface("surfRd", kUnified, kDielectric_metal, kPolished, 0.); + TVirtualMC::GetMC()->SetMaterialProperty("surfRd", "EFFICIENCY", nBins, &(mPhotonEnergyD[0]), &(mEfficMet[0])); + TVirtualMC::GetMC()->SetMaterialProperty("surfRd", "REFLECTIVITY", nBins, &(mPhotonEnergyD[0]), &(mReflMet[0])); +} + +void Detector::FillOtherOptProperties() +{ + // Set constant values to the other arrays + for (Int_t i = 0; i < mPhotonEnergyD.size(); i++) { + mEfficAll.push_back(1.); + mRindexAir.push_back(1.); + mAbsorAir.push_back(0.3); + mRindexCathodeNext.push_back(0.); + mAbsorbCathodeNext.push_back(0.); + mEfficMet.push_back(0.); + mReflMet.push_back(1.); + } +} + +//------------------------------------------------------------------------ +Bool_t Detector::RegisterPhotoE(float energy) +{ + // Float_t hc=197.326960*1.e6; //mev*nm + float hc = 1.973 * 1.e-6; // gev*nm + float lambda = hc / energy; + float eff = mPMTeff->Eval(lambda); + float p = gRandom->Rndm(); + + if (p > eff) + return kFALSE; + + return kTRUE; +} + +Int_t Detector::ReadOptProperties(const std::string filePath) +{ + std::ifstream infile; + infile.open(filePath.c_str()); + + // Check if file is opened correctly + if (infile.fail() == true) { + // AliFatal(Form("Error opening ascii file: %s", filePath.c_str())); + return -1; + } + + std::string comment; // dummy, used just to read 4 first lines and move the cursor to the 5th, otherwise unused + if (!getline(infile, comment)) { // first comment line + // AliFatal(Form("Error opening ascii file (it is probably a folder!): %s", filePath.c_str())); + return -2; + } + getline(infile, comment); // 2nd comment line + + // Get number of elements required for the array + Int_t nLines; + infile >> nLines; + if (nLines < 0 || nLines > 1e4) { + // AliFatal(Form("Input arraySize out of range 0..1e4: %i. Check input file: %s", kNbins, filePath.c_str())); + return -4; + } + + getline(infile, comment); // finish 3rd line after the nEntries are read + getline(infile, comment); // 4th comment line + + // read the main body of the file (table of values: energy, absorption length and refractive index) + Int_t iLine = 0; + std::string sLine; + getline(infile, sLine); + while (!infile.eof()) { + if (iLine >= nLines) { + // AliFatal(Form("Line number: %i reaches range of declared arraySize: %i. Check input file: %s", iLine, + // kNbins, filePath.c_str())); + return -5; + } + std::stringstream ssLine(sLine); + // First column: + Double_t energy; + ssLine >> energy; + energy *= 1e-9; // Convert eV -> GeV immediately + mPhotonEnergyD.push_back(energy); + // Second column: + Double_t absorption; + ssLine >> absorption; + mAbsorptionLength.push_back(absorption); + // Third column: + Double_t refraction; + ssLine >> refraction; + mRefractionIndex.push_back(refraction); + // Fourth column: + Double_t efficiency; + ssLine >> efficiency; + mQuantumEfficiency.push_back(efficiency); + if (!(ssLine.good() || ssLine.eof())) { // check if there were problems with numbers conversion + // AliFatal(Form("Error while reading line %i: %s", iLine, ssLine.str().c_str())); + return -6; + } + getline(infile, sLine); + iLine++; + } + if (iLine != mPhotonEnergyD.size()) { + // AliFatal(Form("Total number of lines %i is different than declared %i. Check input file: %s", iLine, kNbins, + // filePath.c_str())); + return -7; + } + + // AliInfo(Form("Optical properties taken from the file: %s. Number of lines read: %i",filePath.c_str(),iLine)); + return 0; +} +*/ + diff --git a/Detectors/FIT/V0/simulation/src/Hit.cxx b/Detectors/FIT/V0/simulation/src/Hit.cxx new file mode 100644 index 0000000000000..2de4203ef2e62 --- /dev/null +++ b/Detectors/FIT/V0/simulation/src/Hit.cxx @@ -0,0 +1,36 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file Hit.cxx +/// \brief Implementation of the Hit class + +#include "V0Simulation/Hit.h" + +#include + +ClassImp(o2::v0::Hit) + +using std::cout; +using std::endl; +using namespace o2::v0; +using namespace o2; //::Base; + +void Hit::Print(const Option_t *opt) const +{ + printf("Det: %5d Track: %6d E.loss: %.3e P: %+.3e %+.3e %+.3e\n" + "PosIn: %+.3e %+.3e %+.3e PosOut: %+.3e %+.3e %+.3e\n", + GetDetectorID(),GetTrackID(),GetEnergyLoss(),GetPx(),GetPy(),GetPz(), + GetStartX(),GetStartY(),GetStartZ(),GetX(),GetY(),GetZ() ); +} + + + + + diff --git a/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h b/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h new file mode 100644 index 0000000000000..3b192f3c23dcb --- /dev/null +++ b/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h @@ -0,0 +1,20 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::v0::Detector + ; +#pragma link C++ class o2::Base::DetImpl < o2::v0::Detector > +; + +#endif diff --git a/cmake/O2Dependencies.cmake b/cmake/O2Dependencies.cmake index 69fd8ae946463..a869fc369a676 100644 --- a/cmake/O2Dependencies.cmake +++ b/cmake/O2Dependencies.cmake @@ -1491,6 +1491,7 @@ o2_define_bucket( Physics FITBase T0Base + V0Base DetectorsBase detectors_base_bucket SimulationDataFormat @@ -1504,9 +1505,11 @@ o2_define_bucket( ${CMAKE_SOURCE_DIR}/Detectors/Base/include ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/base/include ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/base/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/V0/base/include ${CMAKE_SOURCE_DIR}/Detectors/Simulation/include ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/simulation/include ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/simulation/include + ${CMAKE_SOURCE_DIR}/Detectors/FIT/V0/simulation/include ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include ${CMAKE_SOURCE_DIR}/Common/MathUtils/include ) @@ -1799,6 +1802,7 @@ o2_define_bucket( TOFSimulation FITSimulation T0Simulation + V0Simulation HMPIDSimulation PHOSSimulation PHOSReconstruction diff --git a/macro/build_geometry.C b/macro/build_geometry.C index 64a109289dadd..0781adfcf1a80 100644 --- a/macro/build_geometry.C +++ b/macro/build_geometry.C @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -184,10 +185,16 @@ void build_geometry(FairRunSim* run = nullptr) } if (isActivated("T0")) { - // FIT + // FIT-T0 run->AddModule(new o2::t0::Detector(true)); } +// TODO: Fix this typo ("T0"->"V0"), after fixing the o2::v0::Detector constructor - so that it does not cause o2sim crash + if (isActivated("T0")) { + // FIT-V0 + run->AddModule(new o2::v0::Detector(true)); + } + if (isActivated("HMP")) { // HMP run->AddModule(new o2::hmpid::Detector(true)); diff --git a/run/O2HitMerger.h b/run/O2HitMerger.h index 84b48fc5d7da8..9943de77f3cd8 100644 --- a/run/O2HitMerger.h +++ b/run/O2HitMerger.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -470,6 +471,10 @@ void O2HitMerger::initDetInstances() mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } + if (i == DetID::V0) { + mDetectorInstances[i] = std::move(std::make_unique(true)); + counter++; + } if (i == DetID::MCH) { mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; From 0acd64a7cf6d6f32fa65b578087acc967f829da8 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Fri, 18 Jan 2019 16:25:56 +0100 Subject: [PATCH 07/25] first separation T0 V0 --- Detectors/FIT/CMakeLists.txt | 1 + Detectors/FIT/T0/base/CMakeLists.txt | 4 ++ .../{T0BaseLinkDef.h => T0BaseLinkDef.h~HEAD} | 0 .../T0BaseLinkDef.h~first separation T0 V0 | 19 +++++++ .../FIT/T0/reconstruction/src/RecPoints.cxx | 49 ++++++++++++------- .../src/T0ReconstructionLinkDef.h | 3 ++ .../include/T0Simulation/Detector.h | 25 ++++++++++ .../T0Simulation/DigitizationParameters.h | 3 ++ .../include/T0Simulation/DigitizerTask.h | 12 ++--- .../FITSimulation/DigitizationParameters.h | 1 + .../include/FITSimulation/Digitizer.h | 11 +++++ .../FIT/common/simulation/src/Digitizer.cxx | 2 + .../src/FITDigitizerSpec.cxx | 9 ++-- macro/build_geometry.C | 2 +- run/O2HitMerger.h | 5 ++ 15 files changed, 117 insertions(+), 29 deletions(-) rename Detectors/FIT/T0/base/src/{T0BaseLinkDef.h => T0BaseLinkDef.h~HEAD} (100%) create mode 100644 Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 diff --git a/Detectors/FIT/CMakeLists.txt b/Detectors/FIT/CMakeLists.txt index b917369d336aa..43679bef67d46 100644 --- a/Detectors/FIT/CMakeLists.txt +++ b/Detectors/FIT/CMakeLists.txt @@ -2,3 +2,4 @@ add_subdirectory(common) add_subdirectory(T0) add_subdirectory(V0) + diff --git a/Detectors/FIT/T0/base/CMakeLists.txt b/Detectors/FIT/T0/base/CMakeLists.txt index f4ce749ff13cd..aefd356d763f8 100644 --- a/Detectors/FIT/T0/base/CMakeLists.txt +++ b/Detectors/FIT/T0/base/CMakeLists.txt @@ -10,6 +10,10 @@ set(HEADERS include/${MODULE_NAME}/Geometry.h ) +<<<<<<< HEAD +======= + +>>>>>>> first separation T0 V0 Set(LINKDEF src/T0BaseLinkDef.h) Set(LIBRARY_NAME ${MODULE_NAME}) set(BUCKET_NAME fit_base_bucket) diff --git a/Detectors/FIT/T0/base/src/T0BaseLinkDef.h b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~HEAD similarity index 100% rename from Detectors/FIT/T0/base/src/T0BaseLinkDef.h rename to Detectors/FIT/T0/base/src/T0BaseLinkDef.h~HEAD diff --git a/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 new file mode 100644 index 0000000000000..4be48bd4b2466 --- /dev/null +++ b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::t0::Geometry + ; + +#endif diff --git a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx index be86dd75bd00f..84392b5d66816 100644 --- a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx +++ b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx @@ -21,12 +21,14 @@ ClassImp(o2::t0::RecPoints); void RecPoints::FillFromDigits(const o2::fit::Digit& digit) { + mTimeAmp.clear(); mCollisionTime = {}; Int_t ndigitsC = 0, ndigitsA = 0; constexpr Int_t nMCPsA = 4 * o2::t0::Geometry::NCellsA; constexpr Int_t nMCPsC = 4 * o2::t0::Geometry::NCellsC; constexpr Int_t nMCPs = nMCPsA + nMCPsC; + Float_t cfd[nMCPs] = {}, amp[nMCPs] = {}; Float_t sideAtime = 0, sideCtime = 0; mBC = digit.getBC(); @@ -35,28 +37,39 @@ void RecPoints::FillFromDigits(const o2::fit::Digit& digit) Float_t BCEventTime = 12.5; - mTimeAmp = digit.getChDgData(); - for (auto& d : mTimeAmp) { - d.CFDTime -= mEventTime /*- BCEventTime*/; - if (abs(d.CFDTime - BCEventTime) < 2) { - if (d.ChId < nMCPsA) { - sideAtime += d.CFDTime; - ndigitsA++; - } else { - sideCtime += d.CFDTime; - ndigitsC++; - } - } + for (const auto& d : digit.getChDgData()) { + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime - mEventTime - BCEventTime; + amp[mcp] = d.QTCAmpl; + mTimeAmp.push_back(ChannelData{ mcp, cfd[mcp], amp[mcp] }); + // LOG(DEBUG) << " mcp " << mcp<<" time "<< cfd[mcp]<<" amplitude "<< amp[mcp] << FairLogger::endl; } + for (Int_t imcp = 0; imcp < nMCPsA; imcp++) { + if (cfd[imcp] > -2 && cfd[imcp] < 2) { + sideAtime += (cfd[imcp]); + ndigitsA++; + } + } + for (Int_t imcp = 0; imcp < nMCPsC; imcp++) { + if (cfd[imcp + nMCPsA] > 0) { + sideCtime += (cfd[imcp + nMCPsA]); + ndigitsC++; + } + } if (ndigitsA > 0) - mCollisionTime[1] = sideAtime / Float_t(ndigitsA); - + sideAtime = sideAtime / Float_t(ndigitsA); if (ndigitsC > 0) - mCollisionTime[2] = sideCtime / Float_t(ndigitsC); + sideCtime = sideCtime / Float_t(ndigitsC); - if (ndigitsA > 0 && ndigitsC > 0) { - mVertex = (mCollisionTime[1] - mCollisionTime[2]) / 2.; - mCollisionTime[0] = (mCollisionTime[1] + mCollisionTime[2]) / 2.; + if (sideAtime > 0 && sideCtime > 0) { + mVertex = (sideAtime - sideCtime) / 2.; + mCollisionTime[0] = (sideAtime + sideCtime) / 2.; + } + if (sideAtime > 0) { + mCollisionTime[1] = sideAtime; + } + if (sideCtime > 0) { + mCollisionTime[2] = sideCtime; } } diff --git a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h index 01b854ff4c295..33ab5dddbc898 100644 --- a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h +++ b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h @@ -16,7 +16,10 @@ #pragma link C++ class o2::t0::CollisionTimeRecoTask + ; #pragma link C++ class o2::t0::RecPoints + ; +<<<<<<< HEAD #pragma link C++ class std::vector < o2::t0::RecPoints > +; +======= +>>>>>>> first separation T0 V0 #pragma link C++ class o2::t0::Channel + ; #endif diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index bc3d81a3db7d2..a94ee7a6b5890 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -29,6 +29,31 @@ class TGraph; namespace o2 { namespace t0 +<<<<<<< HEAD:Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +======= +{ +class HitType : public o2::BasicXYZEHit +{ + public: + using BasicXYZEHit::BasicXYZEHit; +}; +} // namespace t0 +} // namespace o2 + +#ifdef USESHM +namespace std +{ +template <> +class allocator : public o2::utils::ShmAllocator +{ +}; +} // namespace std +#endif + +namespace o2 +{ +namespace t0 +>>>>>>> first separation T0 V0:Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h { class Geometry; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h index a90adc1216d37..b5390adf62455 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h @@ -19,7 +19,10 @@ inline o2::fit::DigitizationParameters T0DigitizationParameters() result.mTime_trg_gate = 4.; // ns result.mAmpThreshold = 100; // number of photoelectrons result.mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); +<<<<<<< HEAD result.mIsT0 = true; +======= +>>>>>>> first separation T0 V0 return result; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index dd10eb5712ab7..a15647de1606c 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -59,12 +59,12 @@ class DigitizerTask : public FairTask Digitizer mDigitizer; ///< Digitizer const std::vector* mHitsArray = nullptr; ///< Array of MC hits - TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions - const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED - float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. - double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) - int mLastQEDEntry = -1; ///< last used QED entry - UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) + TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions + const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED + float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. + double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) + int mLastQEDEntry = -1; ///< last used QED entry + UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) o2::fit::Digit* mEventDigit = nullptr; o2::dataformats::MCTruthContainer mMCTruthArray; //! Labels containter diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h index 6c10e0fc74821..be8943f734c5d 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h @@ -17,6 +17,7 @@ struct DigitizationParameters { Int_t mAmpThreshold; // number of photoelectrons Float_t mTimeDiffAC; bool mIsT0; //amplitude T0(true) or V0 (false) + }; } // namespace o2::fit #endif diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h index 693b77f2e8fbd..6117bc7c05627 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h @@ -59,6 +59,17 @@ class Digitizer Double_t mEventTime; // timestamp DigitizationParameters parameters; +<<<<<<< HEAD:Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h +======= + /* + Float_t mBC_clk_center = 12.5; // clk center + Int_t mMCPs = (Geometry::NCellsA + Geometry::NCellsC) * 4; //number of MCPs + Float_t mCFD_trsh_mip = 0.4; // = 4[mV] / 10[mV/mip] + Float_t mTime_trg_gate = 4.; // ns + Int_t mAmpThreshold = 100; // number of photoelectrons + Float_t mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); + */ +>>>>>>> first separation T0 V0:Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h o2::dataformats::MCTruthContainer* mMCLabels = nullptr; diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index c33fb9763e866..3031012137f4a 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -76,6 +76,7 @@ void Digitizer::process(const std::vector* hits, Digit* digit) } } +<<<<<<< HEAD:Detectors/FIT/common/simulation/src/Digitizer.cxx void Digitizer::computeAverage(Digit& digit) { constexpr Float_t nPe_in_mip = 250.; // n ph. e. in one mip @@ -86,6 +87,7 @@ void Digitizer::computeAverage(Digit& digit) ch_data.CFDTime /= ch_data.numberOfParticles; if (parameters.mIsT0) ch_data.QTCAmpl = ch_data.numberOfParticles / nPe_in_mip; + } channel_data.erase(std::remove_if(channel_data.begin(), channel_data.end(), [this](ChannelData const& ch_data) { diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index 3b48f9adf4286..c760a233f1f87 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -94,7 +94,7 @@ class FITDPLDigitizerTask LOG(INFO) << "CALLING FIT DIGITIZATION"; - static std::vector hits; + static std::vector hits; o2::dataformats::MCTruthContainer labelAccum; o2::dataformats::MCTruthContainer labels; o2::fit::Digit digit; @@ -104,9 +104,9 @@ class FITDPLDigitizerTask // loop over all composite collisions given from context // (aka loop over all the interaction records) for (int collID = 0; collID < timesview.size(); ++collID) { - mDigitizer.setEventTime(timesview[collID].timeNS); - mDigitizer.setOrbit(timesview[collID].orbit); - mDigitizer.setBC(timesview[collID].bc); + mT0Digitizer.setEventTime(timesview[collID].timeNS); + mT0Digitizer.setOrbit(timesview[collID].orbit); + mT0Digitizer.setBC(timesview[collID].bc); digit.cleardigits(); // for each collision, loop over the constituents event and source IDs // (background signal merging is basically taking place here) @@ -164,6 +164,7 @@ class FITDPLDigitizerTask o2::detectors::DetID mID; o2::header::DataOrigin mOrigin = o2::header::gDataOriginInvalid; o2::fit::Digitizer mDigitizer; ///< Digitizer + //Digitizer mV0Digitizer; ///< Digitizer // RS: at the moment using hardcoded flag for continuos readout o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::CONTINUOUS; // readout mode diff --git a/macro/build_geometry.C b/macro/build_geometry.C index 0781adfcf1a80..6db272e1044d8 100644 --- a/macro/build_geometry.C +++ b/macro/build_geometry.C @@ -190,7 +190,7 @@ void build_geometry(FairRunSim* run = nullptr) } // TODO: Fix this typo ("T0"->"V0"), after fixing the o2::v0::Detector constructor - so that it does not cause o2sim crash - if (isActivated("T0")) { + if (isActivated("V0")) { // FIT-V0 run->AddModule(new o2::v0::Detector(true)); } diff --git a/run/O2HitMerger.h b/run/O2HitMerger.h index 9943de77f3cd8..42594bc9f7d96 100644 --- a/run/O2HitMerger.h +++ b/run/O2HitMerger.h @@ -467,12 +467,17 @@ void O2HitMerger::initDetInstances() mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } +<<<<<<< HEAD if (i == DetID::T0) { mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } if (i == DetID::V0) { mDetectorInstances[i] = std::move(std::make_unique(true)); +======= + if (i == DetID::FIT) { + mDetectorInstances[i] = std::move(std::make_unique(true)); +>>>>>>> first separation T0 V0 counter++; } if (i == DetID::MCH) { From 83f3b13a3574726e71c49e6c8122264b40501a5b Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Tue, 22 Jan 2019 11:13:23 +0100 Subject: [PATCH 08/25] T0 simulation works with this --- DataFormats/Headers/include/Headers/DataHeader.h | 3 +++ Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h | 6 ++++++ run/O2HitMerger.h | 6 +----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/DataFormats/Headers/include/Headers/DataHeader.h b/DataFormats/Headers/include/Headers/DataHeader.h index 04dab374c25ef..34c314d438bbd 100644 --- a/DataFormats/Headers/include/Headers/DataHeader.h +++ b/DataFormats/Headers/include/Headers/DataHeader.h @@ -590,7 +590,10 @@ constexpr o2::header::DataOrigin gDataOriginCPV{ "CPV" }; constexpr o2::header::DataOrigin gDataOriginCTP{ "CTP" }; constexpr o2::header::DataOrigin gDataOriginEMC{ "EMC" }; constexpr o2::header::DataOrigin gDataOriginT0{ "T0" }; +<<<<<<< HEAD constexpr o2::header::DataOrigin gDataOriginV0{ "V0" }; +======= +>>>>>>> T0 simulation works with this constexpr o2::header::DataOrigin gDataOriginHMP{ "HMP" }; constexpr o2::header::DataOrigin gDataOriginITS{ "ITS" }; constexpr o2::header::DataOrigin gDataOriginMCH{ "MCH" }; diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h index 7a08e28c87114..9fa099095ee5f 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h @@ -21,7 +21,13 @@ namespace fit o2::framework::DataProcessorSpec getT0DigitWriterSpec(); //o2::framework::DataProcessorSpec getMFTDigitWriterSpec(); +<<<<<<< HEAD } // namespace fit } // end namespace o2 +======= +} // end namespace itsmft +} // end namespace o2 + +>>>>>>> T0 simulation works with this #endif /* STEER_DIGITIZERWORKFLOW_ITSMFTDIGITWRITER_H_ */ diff --git a/run/O2HitMerger.h b/run/O2HitMerger.h index 42594bc9f7d96..b1940cbf57b14 100644 --- a/run/O2HitMerger.h +++ b/run/O2HitMerger.h @@ -467,19 +467,15 @@ void O2HitMerger::initDetInstances() mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } -<<<<<<< HEAD if (i == DetID::T0) { mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } if (i == DetID::V0) { mDetectorInstances[i] = std::move(std::make_unique(true)); -======= - if (i == DetID::FIT) { - mDetectorInstances[i] = std::move(std::make_unique(true)); ->>>>>>> first separation T0 V0 counter++; } + if (i == DetID::MCH) { mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; From f1b2bfac41ee833c90dcf6cc87afbee352d76015 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Wed, 23 Jan 2019 21:26:36 +0100 Subject: [PATCH 09/25] move Hit to common --- Detectors/FIT/T0/base/CMakeLists.txt | 6 +---- .../include/T0Simulation/Detector.h | 24 ------------------- .../include/T0Simulation/DigitizerTask.h | 2 +- Detectors/FIT/T0/simulation/src/Detector.cxx | 1 + .../include/FITSimulation/Digitizer.h | 11 --------- .../include/FITSimulation/HitType.h | 2 ++ .../FIT/common/simulation/src/Digitizer.cxx | 2 +- .../src/FITDigitWriterSpec.cxx | 2 +- .../src/FITDigitizerSpec.cxx | 2 +- 9 files changed, 8 insertions(+), 44 deletions(-) diff --git a/Detectors/FIT/T0/base/CMakeLists.txt b/Detectors/FIT/T0/base/CMakeLists.txt index aefd356d763f8..8c01845330d72 100644 --- a/Detectors/FIT/T0/base/CMakeLists.txt +++ b/Detectors/FIT/T0/base/CMakeLists.txt @@ -10,11 +10,7 @@ set(HEADERS include/${MODULE_NAME}/Geometry.h ) -<<<<<<< HEAD -======= - ->>>>>>> first separation T0 V0 -Set(LINKDEF src/T0BaseLinkDef.h) + Set(LINKDEF src/T0BaseLinkDef.h) Set(LIBRARY_NAME ${MODULE_NAME}) set(BUCKET_NAME fit_base_bucket) diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index a94ee7a6b5890..41c2b8617cf2a 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -26,34 +26,10 @@ class FairVolume; class TGeoVolume; class TGraph; -namespace o2 -{ -namespace t0 -<<<<<<< HEAD:Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h -======= -{ -class HitType : public o2::BasicXYZEHit -{ - public: - using BasicXYZEHit::BasicXYZEHit; -}; -} // namespace t0 -} // namespace o2 - -#ifdef USESHM -namespace std -{ -template <> -class allocator : public o2::utils::ShmAllocator -{ -}; -} // namespace std -#endif namespace o2 { namespace t0 ->>>>>>> first separation T0 V0:Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h { class Geometry; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index a15647de1606c..360745ee24090 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -60,7 +60,7 @@ class DigitizerTask : public FairTask const std::vector* mHitsArray = nullptr; ///< Array of MC hits TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions - const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED + const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) int mLastQEDEntry = -1; ///< last used QED entry diff --git a/Detectors/FIT/T0/simulation/src/Detector.cxx b/Detectors/FIT/T0/simulation/src/Detector.cxx index 6c7ec8bb9bc26..54132fb456a9e 100644 --- a/Detectors/FIT/T0/simulation/src/Detector.cxx +++ b/Detectors/FIT/T0/simulation/src/Detector.cxx @@ -44,6 +44,7 @@ Detector::Detector(Bool_t Active) Detector::Detector(const Detector& rhs) : o2::Base::DetImpl(rhs), mIdSens1(rhs.mIdSens1), mPMTeff(rhs.mPMTeff), mHits(o2::utils::createSimVector()) + { } diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h index 6117bc7c05627..693b77f2e8fbd 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h @@ -59,17 +59,6 @@ class Digitizer Double_t mEventTime; // timestamp DigitizationParameters parameters; -<<<<<<< HEAD:Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h -======= - /* - Float_t mBC_clk_center = 12.5; // clk center - Int_t mMCPs = (Geometry::NCellsA + Geometry::NCellsC) * 4; //number of MCPs - Float_t mCFD_trsh_mip = 0.4; // = 4[mV] / 10[mV/mip] - Float_t mTime_trg_gate = 4.; // ns - Int_t mAmpThreshold = 100; // number of photoelectrons - Float_t mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); - */ ->>>>>>> first separation T0 V0:Detectors/FIT/common/simulation/include/FITSimulation/Digitizer.h o2::dataformats::MCTruthContainer* mMCLabels = nullptr; diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h index 0290970a94084..109735018084c 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h @@ -14,7 +14,9 @@ class HitType : public o2::BasicXYZEHit public: using BasicXYZEHit::BasicXYZEHit; }; + } // namespace fit + } // namespace o2 #endif diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index 3031012137f4a..7c38badb2b57f 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -76,7 +76,6 @@ void Digitizer::process(const std::vector* hits, Digit* digit) } } -<<<<<<< HEAD:Detectors/FIT/common/simulation/src/Digitizer.cxx void Digitizer::computeAverage(Digit& digit) { constexpr Float_t nPe_in_mip = 250.; // n ph. e. in one mip @@ -199,6 +198,7 @@ void Digitizer::initParameters() void Digitizer::init() { std::cout << " @@@ Digitizer::init " << std::endl; + } //_______________________________________________________________________ diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx index 20b15710e4d46..d548993bcbf2f 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx @@ -44,7 +44,7 @@ class FITDPLDigitWriter void init(framework::InitContext& ic) { std::string detStrL = mID.getName(); - std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); auto filename = ic.options().get((detStrL + "-digit-outfile").c_str()); auto treename = ic.options().get("treename"); diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index c760a233f1f87..912097137585d 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -94,7 +94,7 @@ class FITDPLDigitizerTask LOG(INFO) << "CALLING FIT DIGITIZATION"; - static std::vector hits; + static std::vector hits; o2::dataformats::MCTruthContainer labelAccum; o2::dataformats::MCTruthContainer labels; o2::fit::Digit digit; From a8f333cc6c7d08c982ab257ea98d231ab76c31d6 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sat, 26 Jan 2019 20:58:19 +0100 Subject: [PATCH 10/25] T0 digitzation as a part of FIT --- .../FIT/T0/simulation/include/T0Simulation/Detector.h | 1 - .../include/T0Simulation/DigitizationParameters.h | 3 --- .../T0/simulation/include/T0Simulation/DigitizerTask.h | 10 +++++----- Detectors/FIT/T0/simulation/src/Detector.cxx | 2 +- Detectors/FIT/common/simulation/src/Digitizer.cxx | 1 - Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx | 2 +- Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h | 6 ------ Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx | 6 +++--- 8 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index 41c2b8617cf2a..bc3d81a3db7d2 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -26,7 +26,6 @@ class FairVolume; class TGeoVolume; class TGraph; - namespace o2 { namespace t0 diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h index b5390adf62455..a90adc1216d37 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h @@ -19,10 +19,7 @@ inline o2::fit::DigitizationParameters T0DigitizationParameters() result.mTime_trg_gate = 4.; // ns result.mAmpThreshold = 100; // number of photoelectrons result.mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); -<<<<<<< HEAD result.mIsT0 = true; -======= ->>>>>>> first separation T0 V0 return result; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index 360745ee24090..dd10eb5712ab7 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -59,12 +59,12 @@ class DigitizerTask : public FairTask Digitizer mDigitizer; ///< Digitizer const std::vector* mHitsArray = nullptr; ///< Array of MC hits - TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions + TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED - float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. - double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) - int mLastQEDEntry = -1; ///< last used QED entry - UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) + float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. + double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) + int mLastQEDEntry = -1; ///< last used QED entry + UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) o2::fit::Digit* mEventDigit = nullptr; o2::dataformats::MCTruthContainer mMCTruthArray; //! Labels containter diff --git a/Detectors/FIT/T0/simulation/src/Detector.cxx b/Detectors/FIT/T0/simulation/src/Detector.cxx index 54132fb456a9e..511acef4f4260 100644 --- a/Detectors/FIT/T0/simulation/src/Detector.cxx +++ b/Detectors/FIT/T0/simulation/src/Detector.cxx @@ -44,8 +44,8 @@ Detector::Detector(Bool_t Active) Detector::Detector(const Detector& rhs) : o2::Base::DetImpl(rhs), mIdSens1(rhs.mIdSens1), mPMTeff(rhs.mPMTeff), mHits(o2::utils::createSimVector()) - { + } Detector::~Detector() diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index 7c38badb2b57f..07b7f0e4aa353 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -198,7 +198,6 @@ void Digitizer::initParameters() void Digitizer::init() { std::cout << " @@@ Digitizer::init " << std::endl; - } //_______________________________________________________________________ diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx index d548993bcbf2f..20b15710e4d46 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx @@ -44,7 +44,7 @@ class FITDPLDigitWriter void init(framework::InitContext& ic) { std::string detStrL = mID.getName(); - std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); auto filename = ic.options().get((detStrL + "-digit-outfile").c_str()); auto treename = ic.options().get("treename"); diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h index 9fa099095ee5f..7a08e28c87114 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h @@ -21,13 +21,7 @@ namespace fit o2::framework::DataProcessorSpec getT0DigitWriterSpec(); //o2::framework::DataProcessorSpec getMFTDigitWriterSpec(); -<<<<<<< HEAD } // namespace fit } // end namespace o2 -======= -} // end namespace itsmft -} // end namespace o2 - ->>>>>>> T0 simulation works with this #endif /* STEER_DIGITIZERWORKFLOW_ITSMFTDIGITWRITER_H_ */ diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index 912097137585d..0335beb640535 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -104,9 +104,9 @@ class FITDPLDigitizerTask // loop over all composite collisions given from context // (aka loop over all the interaction records) for (int collID = 0; collID < timesview.size(); ++collID) { - mT0Digitizer.setEventTime(timesview[collID].timeNS); - mT0Digitizer.setOrbit(timesview[collID].orbit); - mT0Digitizer.setBC(timesview[collID].bc); + mDigitizer.setEventTime(timesview[collID].timeNS); + mDigitizer.setOrbit(timesview[collID].orbit); + mDigitizer.setBC(timesview[collID].bc); digit.cleardigits(); // for each collision, loop over the constituents event and source IDs // (background signal merging is basically taking place here) From 8553ebd27f0a5eb9c8244dd6854e177cad60e890 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Wed, 6 Feb 2019 17:50:13 +0100 Subject: [PATCH 11/25] add run_reco_t0 --- .../FIT/T0/reconstruction/src/RecPoints.cxx | 49 +++++++------------ .../src/T0ReconstructionLinkDef.h | 3 -- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx index 84392b5d66816..be86dd75bd00f 100644 --- a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx +++ b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx @@ -21,14 +21,12 @@ ClassImp(o2::t0::RecPoints); void RecPoints::FillFromDigits(const o2::fit::Digit& digit) { - mTimeAmp.clear(); mCollisionTime = {}; Int_t ndigitsC = 0, ndigitsA = 0; constexpr Int_t nMCPsA = 4 * o2::t0::Geometry::NCellsA; constexpr Int_t nMCPsC = 4 * o2::t0::Geometry::NCellsC; constexpr Int_t nMCPs = nMCPsA + nMCPsC; - Float_t cfd[nMCPs] = {}, amp[nMCPs] = {}; Float_t sideAtime = 0, sideCtime = 0; mBC = digit.getBC(); @@ -37,39 +35,28 @@ void RecPoints::FillFromDigits(const o2::fit::Digit& digit) Float_t BCEventTime = 12.5; - for (const auto& d : digit.getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime - mEventTime - BCEventTime; - amp[mcp] = d.QTCAmpl; - mTimeAmp.push_back(ChannelData{ mcp, cfd[mcp], amp[mcp] }); - // LOG(DEBUG) << " mcp " << mcp<<" time "<< cfd[mcp]<<" amplitude "<< amp[mcp] << FairLogger::endl; - } - - for (Int_t imcp = 0; imcp < nMCPsA; imcp++) { - if (cfd[imcp] > -2 && cfd[imcp] < 2) { - sideAtime += (cfd[imcp]); - ndigitsA++; - } - } - for (Int_t imcp = 0; imcp < nMCPsC; imcp++) { - if (cfd[imcp + nMCPsA] > 0) { - sideCtime += (cfd[imcp + nMCPsA]); - ndigitsC++; + mTimeAmp = digit.getChDgData(); + for (auto& d : mTimeAmp) { + d.CFDTime -= mEventTime /*- BCEventTime*/; + if (abs(d.CFDTime - BCEventTime) < 2) { + if (d.ChId < nMCPsA) { + sideAtime += d.CFDTime; + ndigitsA++; + } else { + sideCtime += d.CFDTime; + ndigitsC++; + } } } + if (ndigitsA > 0) - sideAtime = sideAtime / Float_t(ndigitsA); + mCollisionTime[1] = sideAtime / Float_t(ndigitsA); + if (ndigitsC > 0) - sideCtime = sideCtime / Float_t(ndigitsC); + mCollisionTime[2] = sideCtime / Float_t(ndigitsC); - if (sideAtime > 0 && sideCtime > 0) { - mVertex = (sideAtime - sideCtime) / 2.; - mCollisionTime[0] = (sideAtime + sideCtime) / 2.; - } - if (sideAtime > 0) { - mCollisionTime[1] = sideAtime; - } - if (sideCtime > 0) { - mCollisionTime[2] = sideCtime; + if (ndigitsA > 0 && ndigitsC > 0) { + mVertex = (mCollisionTime[1] - mCollisionTime[2]) / 2.; + mCollisionTime[0] = (mCollisionTime[1] + mCollisionTime[2]) / 2.; } } diff --git a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h index 33ab5dddbc898..01b854ff4c295 100644 --- a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h +++ b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h @@ -16,10 +16,7 @@ #pragma link C++ class o2::t0::CollisionTimeRecoTask + ; #pragma link C++ class o2::t0::RecPoints + ; -<<<<<<< HEAD #pragma link C++ class std::vector < o2::t0::RecPoints > +; -======= ->>>>>>> first separation T0 V0 #pragma link C++ class o2::t0::Channel + ; #endif From 8100ae2d84f1c0737ade996dadb1988a89d4ec1b Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Fri, 18 Jan 2019 16:25:56 +0100 Subject: [PATCH 12/25] first separation T0 V0 --- .../FIT/T0/reconstruction/src/RecPoints.cxx | 49 ++++++++++++------- .../src/T0ReconstructionLinkDef.h | 1 + .../include/T0Simulation/Detector.h | 2 +- .../T0Simulation/DigitizationParameters.h | 3 ++ .../include/T0Simulation/DigitizerTask.h | 12 ++--- .../T0/simulation/src/T0SimulationLinkDef.h | 4 -- .../FIT/common/simulation/src/Digitizer.cxx | 2 + .../src/FITDigitizerSpec.cxx | 8 +-- 8 files changed, 48 insertions(+), 33 deletions(-) diff --git a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx index be86dd75bd00f..84392b5d66816 100644 --- a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx +++ b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx @@ -21,12 +21,14 @@ ClassImp(o2::t0::RecPoints); void RecPoints::FillFromDigits(const o2::fit::Digit& digit) { + mTimeAmp.clear(); mCollisionTime = {}; Int_t ndigitsC = 0, ndigitsA = 0; constexpr Int_t nMCPsA = 4 * o2::t0::Geometry::NCellsA; constexpr Int_t nMCPsC = 4 * o2::t0::Geometry::NCellsC; constexpr Int_t nMCPs = nMCPsA + nMCPsC; + Float_t cfd[nMCPs] = {}, amp[nMCPs] = {}; Float_t sideAtime = 0, sideCtime = 0; mBC = digit.getBC(); @@ -35,28 +37,39 @@ void RecPoints::FillFromDigits(const o2::fit::Digit& digit) Float_t BCEventTime = 12.5; - mTimeAmp = digit.getChDgData(); - for (auto& d : mTimeAmp) { - d.CFDTime -= mEventTime /*- BCEventTime*/; - if (abs(d.CFDTime - BCEventTime) < 2) { - if (d.ChId < nMCPsA) { - sideAtime += d.CFDTime; - ndigitsA++; - } else { - sideCtime += d.CFDTime; - ndigitsC++; - } - } + for (const auto& d : digit.getChDgData()) { + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime - mEventTime - BCEventTime; + amp[mcp] = d.QTCAmpl; + mTimeAmp.push_back(ChannelData{ mcp, cfd[mcp], amp[mcp] }); + // LOG(DEBUG) << " mcp " << mcp<<" time "<< cfd[mcp]<<" amplitude "<< amp[mcp] << FairLogger::endl; } + for (Int_t imcp = 0; imcp < nMCPsA; imcp++) { + if (cfd[imcp] > -2 && cfd[imcp] < 2) { + sideAtime += (cfd[imcp]); + ndigitsA++; + } + } + for (Int_t imcp = 0; imcp < nMCPsC; imcp++) { + if (cfd[imcp + nMCPsA] > 0) { + sideCtime += (cfd[imcp + nMCPsA]); + ndigitsC++; + } + } if (ndigitsA > 0) - mCollisionTime[1] = sideAtime / Float_t(ndigitsA); - + sideAtime = sideAtime / Float_t(ndigitsA); if (ndigitsC > 0) - mCollisionTime[2] = sideCtime / Float_t(ndigitsC); + sideCtime = sideCtime / Float_t(ndigitsC); - if (ndigitsA > 0 && ndigitsC > 0) { - mVertex = (mCollisionTime[1] - mCollisionTime[2]) / 2.; - mCollisionTime[0] = (mCollisionTime[1] + mCollisionTime[2]) / 2.; + if (sideAtime > 0 && sideCtime > 0) { + mVertex = (sideAtime - sideCtime) / 2.; + mCollisionTime[0] = (sideAtime + sideCtime) / 2.; + } + if (sideAtime > 0) { + mCollisionTime[1] = sideAtime; + } + if (sideCtime > 0) { + mCollisionTime[2] = sideCtime; } } diff --git a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h index 01b854ff4c295..a8d4cc4b2a857 100644 --- a/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h +++ b/Detectors/FIT/T0/reconstruction/src/T0ReconstructionLinkDef.h @@ -17,6 +17,7 @@ #pragma link C++ class o2::t0::CollisionTimeRecoTask + ; #pragma link C++ class o2::t0::RecPoints + ; #pragma link C++ class std::vector < o2::t0::RecPoints > +; + #pragma link C++ class o2::t0::Channel + ; #endif diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index bc3d81a3db7d2..6ce867f1df1dc 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -17,7 +17,6 @@ #include "SimulationDataFormat/BaseHits.h" #include "DetectorsBase/Detector.h" // for Detector #include "T0Base/Geometry.h" -//#include "CommonUtils/ShmAllocator.h" #include "FITSimulation/HitType.h" class FairModule; @@ -29,6 +28,7 @@ class TGraph; namespace o2 { namespace t0 + { class Geometry; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h index a90adc1216d37..b5390adf62455 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h @@ -19,7 +19,10 @@ inline o2::fit::DigitizationParameters T0DigitizationParameters() result.mTime_trg_gate = 4.; // ns result.mAmpThreshold = 100; // number of photoelectrons result.mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); +<<<<<<< HEAD result.mIsT0 = true; +======= +>>>>>>> first separation T0 V0 return result; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index dd10eb5712ab7..a15647de1606c 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -59,12 +59,12 @@ class DigitizerTask : public FairTask Digitizer mDigitizer; ///< Digitizer const std::vector* mHitsArray = nullptr; ///< Array of MC hits - TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions - const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED - float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. - double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) - int mLastQEDEntry = -1; ///< last used QED entry - UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) + TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions + const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED + float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. + double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) + int mLastQEDEntry = -1; ///< last used QED entry + UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) o2::fit::Digit* mEventDigit = nullptr; o2::dataformats::MCTruthContainer mMCTruthArray; //! Labels containter diff --git a/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h b/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h index 5c8b19e609955..57f5c478301ad 100644 --- a/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h +++ b/Detectors/FIT/T0/simulation/src/T0SimulationLinkDef.h @@ -15,10 +15,6 @@ #pragma link off all functions; #pragma link C++ class o2::t0::Detector + ; -//#pragma link C++ class o2::t0::DigitizerTask + ; -//#pragma link C++ class o2::t0::HitType + ; -//#pragma link C++ class vector < o2::t0::HitType > +; - #pragma link C++ class o2::Base::DetImpl < o2::t0::Detector > +; #endif diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index 07b7f0e4aa353..22db1fe56664d 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -25,6 +25,7 @@ using namespace o2::fit; ClassImp(Digitizer); void Digitizer::process(const std::vector* hits, Digit* digit) + { //parameters constants TO DO: move to class @@ -108,6 +109,7 @@ void Digitizer::smearCFDtime(Digit* digit) if (amp > parameters.mCFD_trsh_mip) { Double_t smeared_time = gRandom->Gaus(cfd, 0.050) + parameters.mBC_clk_center + mEventTime; mChDgDataArr.emplace_back(ChannelData{ mcp, smeared_time, amp, numpart }); + } } digit->setChDgData(std::move(mChDgDataArr)); diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index 0335beb640535..c760a233f1f87 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -94,7 +94,7 @@ class FITDPLDigitizerTask LOG(INFO) << "CALLING FIT DIGITIZATION"; - static std::vector hits; + static std::vector hits; o2::dataformats::MCTruthContainer labelAccum; o2::dataformats::MCTruthContainer labels; o2::fit::Digit digit; @@ -104,9 +104,9 @@ class FITDPLDigitizerTask // loop over all composite collisions given from context // (aka loop over all the interaction records) for (int collID = 0; collID < timesview.size(); ++collID) { - mDigitizer.setEventTime(timesview[collID].timeNS); - mDigitizer.setOrbit(timesview[collID].orbit); - mDigitizer.setBC(timesview[collID].bc); + mT0Digitizer.setEventTime(timesview[collID].timeNS); + mT0Digitizer.setOrbit(timesview[collID].orbit); + mT0Digitizer.setBC(timesview[collID].bc); digit.cleardigits(); // for each collision, loop over the constituents event and source IDs // (background signal merging is basically taking place here) From d748e728fadb4391c39f2e2bb1ab13ea7d1fb013 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Tue, 22 Jan 2019 11:13:23 +0100 Subject: [PATCH 13/25] T0 simulation works with this --- .../DigitizerWorkflow/src/FITDigitWriterSpec.h | 1 - .../DigitizerWorkflow/src/FITDigitizerSpec.cxx | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h index 7a08e28c87114..4f07f79d6c028 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.h @@ -19,7 +19,6 @@ namespace fit { o2::framework::DataProcessorSpec getT0DigitWriterSpec(); -//o2::framework::DataProcessorSpec getMFTDigitWriterSpec(); } // namespace fit } // end namespace o2 diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index c760a233f1f87..f5c0bc9a72ec8 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -115,6 +115,7 @@ class FITDPLDigitizerTask // get the hits for this event and this source hits.clear(); retrieveHits(mSimChains, part.sourceID, part.entryID, &hits); + LOG(INFO) << "For collision " << collID << " eventID " << part.entryID << " found " << hits.size() << " hits "; // call actual digitization procedure @@ -147,7 +148,8 @@ class FITDPLDigitizerTask // here we have all digits and we can send them to consumer (aka snapshot it onto output) pc.outputs().snapshot(Output{ mOrigin, "DIGITS", 0, Lifetime::Timeframe }, digitAccum); // pc.outputs().snapshot(Output{ "FIT", "DIGITSMCTR", 0, Lifetime::Timeframe }, labelAccum); - LOG(INFO) << "FIT: " << mID.getName() << " Sending ROMode= " << mROMode << " to GRPUpdater"; + + LOG(INFO) << "FIT: Sending ROMode= " << mROMode << " to GRPUpdater"; pc.outputs().snapshot(Output{ mOrigin, "ROMode", 0, Lifetime::Timeframe }, mROMode); timer.Stop(); LOG(INFO) << "Digitization took " << timer.CpuTime() << "s"; @@ -203,6 +205,20 @@ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask } }; +//_______________________________________________ +class FITT0DPLDigitizerTask : public FITDPLDigitizerTask +{ + public: + // FIXME: origina should be extractable from the DetID, the problem is 3d party header dependencies + static constexpr o2::detectors::DetID::ID DETID = o2::detectors::DetID::T0; + static constexpr o2::header::DataOrigin DETOR = o2::header::gDataOriginT0; + FITT0DPLDigitizerTask() + { + mID = DETID; + mOrigin = DETOR; + } +}; + constexpr o2::detectors::DetID::ID FITT0DPLDigitizerTask::DETID; constexpr o2::header::DataOrigin FITT0DPLDigitizerTask::DETOR; From 9d0e919346a1e1ba4734bb91dcaf76d752d991d2 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Wed, 23 Jan 2019 21:26:36 +0100 Subject: [PATCH 14/25] move Hit to common --- .../FIT/T0/simulation/include/T0Simulation/Detector.h | 1 - .../T0/simulation/include/T0Simulation/DigitizerTask.h | 2 +- Detectors/FIT/common/simulation/src/Digitizer.cxx | 5 +++++ Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx | 2 +- Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx | 10 ++++++++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h index 6ce867f1df1dc..8a935f4a8c6be 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/Detector.h @@ -28,7 +28,6 @@ class TGraph; namespace o2 { namespace t0 - { class Geometry; } diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index a15647de1606c..360745ee24090 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -60,7 +60,7 @@ class DigitizerTask : public FairTask const std::vector* mHitsArray = nullptr; ///< Array of MC hits TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions - const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED + const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) int mLastQEDEntry = -1; ///< last used QED entry diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index 22db1fe56664d..370416d483fcb 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -197,9 +197,14 @@ void Digitizer::initParameters() // murmur } //_______________________________________________________________________ +<<<<<<< HEAD void Digitizer::init() { std::cout << " @@@ Digitizer::init " << std::endl; +======= +void Digitizer::init() { + std::cout<<" @@@ Digitizer::init "<>>>>>> move Hit to common } //_______________________________________________________________________ diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx index 20b15710e4d46..d548993bcbf2f 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx @@ -44,7 +44,7 @@ class FITDPLDigitWriter void init(framework::InitContext& ic) { std::string detStrL = mID.getName(); - std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); auto filename = ic.options().get((detStrL + "-digit-outfile").c_str()); auto treename = ic.options().get("treename"); diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index f5c0bc9a72ec8..bd4224d219af2 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -94,7 +94,7 @@ class FITDPLDigitizerTask LOG(INFO) << "CALLING FIT DIGITIZATION"; - static std::vector hits; + static std::vector hits; o2::dataformats::MCTruthContainer labelAccum; o2::dataformats::MCTruthContainer labels; o2::fit::Digit digit; @@ -114,8 +114,12 @@ class FITDPLDigitizerTask for (auto& part : eventParts[collID]) { // get the hits for this event and this source hits.clear(); +<<<<<<< HEAD retrieveHits(mSimChains, part.sourceID, part.entryID, &hits); +======= + retrieveHits(mSimChains, "T0Hit", part.sourceID, part.entryID, &hits); +>>>>>>> move Hit to common LOG(INFO) << "For collision " << collID << " eventID " << part.entryID << " found " << hits.size() << " hits "; // call actual digitization procedure @@ -203,9 +207,9 @@ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask mOrigin = DETOR; std::cout << " @@@@ DETOR FITT0DPLDigitizerTask " << mOrigin << " " << mID.getName() << std::endl; } + }; -//_______________________________________________ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask { public: @@ -216,6 +220,7 @@ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask { mID = DETID; mOrigin = DETOR; + std::cout << " @@@@ DETOR FITT0DPLDigitizerTask " << mOrigin << " " << mID.getName() << std::endl; } }; @@ -232,6 +237,7 @@ o2::framework::DataProcessorSpec getFITT0DigitizerSpec(int channel) std::string detStr = o2::detectors::DetID::getName(FITT0DPLDigitizerTask::DETID); auto detOrig = FITT0DPLDigitizerTask::DETOR; std::cout << "@@@@ getFITT0DigitizerSpec " << detStr << " dteOrig " << detOrig << std::endl; + return DataProcessorSpec{ (detStr + "Digitizer").c_str(), Inputs{ InputSpec{ "collisioncontext", "SIM", "COLLISIONCONTEXT", static_cast(channel), Lifetime::Timeframe } }, From a75c6e1a5f6462f21177994d20933ee205224b5b Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sat, 26 Jan 2019 20:58:19 +0100 Subject: [PATCH 15/25] T0 digitzation as a part of FIT --- .../include/T0Simulation/DigitizationParameters.h | 5 +---- .../simulation/include/T0Simulation/DigitizerTask.h | 10 +++++----- .../common/simulation/include/FITSimulation/HitType.h | 3 +++ Detectors/FIT/common/simulation/src/Digitizer.cxx | 7 ------- Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx | 2 +- Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx | 11 +++-------- 6 files changed, 13 insertions(+), 25 deletions(-) diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h index b5390adf62455..631164a592bdb 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h @@ -19,11 +19,8 @@ inline o2::fit::DigitizationParameters T0DigitizationParameters() result.mTime_trg_gate = 4.; // ns result.mAmpThreshold = 100; // number of photoelectrons result.mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); -<<<<<<< HEAD result.mIsT0 = true; -======= ->>>>>>> first separation T0 V0 - + return result; } } // namespace o2::t0 diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h index 360745ee24090..dd10eb5712ab7 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizerTask.h @@ -59,12 +59,12 @@ class DigitizerTask : public FairTask Digitizer mDigitizer; ///< Digitizer const std::vector* mHitsArray = nullptr; ///< Array of MC hits - TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions + TBranch* mQEDBranch = nullptr; //! optional special branch of hits from QED collitions const std::vector* mHitsArrayQED = nullptr; //! array of MC hits from ED - float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. - double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) - int mLastQEDEntry = -1; ///< last used QED entry - UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) + float mQEDEntryTimeBinNS = 0.f; ///< every entry in the QED branch integrates QED for so many nanosec. + double mLastQEDTimeNS = 0.; ///< center of the time-bin of last added QED bg slot (entry of mQEDBranch) + int mLastQEDEntry = -1; ///< last used QED entry + UChar_t mQEDSourceID = 0; ///< MC ID source of the QED (stored in the labels) o2::fit::Digit* mEventDigit = nullptr; o2::dataformats::MCTruthContainer mMCTruthArray; //! Labels containter diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h index 109735018084c..9a931ecfc9f4d 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h @@ -16,7 +16,10 @@ class HitType : public o2::BasicXYZEHit }; } // namespace fit +<<<<<<< HEAD +======= +>>>>>>> T0 digitzation as a part of FIT } // namespace o2 #endif diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index 370416d483fcb..a6e44584d66fe 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -109,7 +109,6 @@ void Digitizer::smearCFDtime(Digit* digit) if (amp > parameters.mCFD_trsh_mip) { Double_t smeared_time = gRandom->Gaus(cfd, 0.050) + parameters.mBC_clk_center + mEventTime; mChDgDataArr.emplace_back(ChannelData{ mcp, smeared_time, amp, numpart }); - } } digit->setChDgData(std::move(mChDgDataArr)); @@ -197,16 +196,10 @@ void Digitizer::initParameters() // murmur } //_______________________________________________________________________ -<<<<<<< HEAD void Digitizer::init() { std::cout << " @@@ Digitizer::init " << std::endl; -======= -void Digitizer::init() { - std::cout<<" @@@ Digitizer::init "<>>>>>> move Hit to common } - //_______________________________________________________________________ void Digitizer::finish() {} /* diff --git a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx index d548993bcbf2f..20b15710e4d46 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitWriterSpec.cxx @@ -44,7 +44,7 @@ class FITDPLDigitWriter void init(framework::InitContext& ic) { std::string detStrL = mID.getName(); - std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); + std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower); auto filename = ic.options().get((detStrL + "-digit-outfile").c_str()); auto treename = ic.options().get("treename"); diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index bd4224d219af2..dbebea32ef1b7 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -104,9 +104,9 @@ class FITDPLDigitizerTask // loop over all composite collisions given from context // (aka loop over all the interaction records) for (int collID = 0; collID < timesview.size(); ++collID) { - mT0Digitizer.setEventTime(timesview[collID].timeNS); - mT0Digitizer.setOrbit(timesview[collID].orbit); - mT0Digitizer.setBC(timesview[collID].bc); + mDigitizer.setEventTime(timesview[collID].timeNS); + mDigitizer.setOrbit(timesview[collID].orbit); + mDigitizer.setBC(timesview[collID].bc); digit.cleardigits(); // for each collision, loop over the constituents event and source IDs // (background signal merging is basically taking place here) @@ -114,12 +114,7 @@ class FITDPLDigitizerTask for (auto& part : eventParts[collID]) { // get the hits for this event and this source hits.clear(); -<<<<<<< HEAD retrieveHits(mSimChains, part.sourceID, part.entryID, &hits); - -======= - retrieveHits(mSimChains, "T0Hit", part.sourceID, part.entryID, &hits); ->>>>>>> move Hit to common LOG(INFO) << "For collision " << collID << " eventID " << part.entryID << " found " << hits.size() << " hits "; // call actual digitization procedure From 419cfdc371b662bb32289ef70d2bb56a70a1bd12 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Wed, 6 Feb 2019 17:50:13 +0100 Subject: [PATCH 16/25] add run_reco_t0 --- .../FIT/T0/reconstruction/src/RecPoints.cxx | 49 +++++++------------ 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx index 84392b5d66816..be86dd75bd00f 100644 --- a/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx +++ b/Detectors/FIT/T0/reconstruction/src/RecPoints.cxx @@ -21,14 +21,12 @@ ClassImp(o2::t0::RecPoints); void RecPoints::FillFromDigits(const o2::fit::Digit& digit) { - mTimeAmp.clear(); mCollisionTime = {}; Int_t ndigitsC = 0, ndigitsA = 0; constexpr Int_t nMCPsA = 4 * o2::t0::Geometry::NCellsA; constexpr Int_t nMCPsC = 4 * o2::t0::Geometry::NCellsC; constexpr Int_t nMCPs = nMCPsA + nMCPsC; - Float_t cfd[nMCPs] = {}, amp[nMCPs] = {}; Float_t sideAtime = 0, sideCtime = 0; mBC = digit.getBC(); @@ -37,39 +35,28 @@ void RecPoints::FillFromDigits(const o2::fit::Digit& digit) Float_t BCEventTime = 12.5; - for (const auto& d : digit.getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime - mEventTime - BCEventTime; - amp[mcp] = d.QTCAmpl; - mTimeAmp.push_back(ChannelData{ mcp, cfd[mcp], amp[mcp] }); - // LOG(DEBUG) << " mcp " << mcp<<" time "<< cfd[mcp]<<" amplitude "<< amp[mcp] << FairLogger::endl; - } - - for (Int_t imcp = 0; imcp < nMCPsA; imcp++) { - if (cfd[imcp] > -2 && cfd[imcp] < 2) { - sideAtime += (cfd[imcp]); - ndigitsA++; - } - } - for (Int_t imcp = 0; imcp < nMCPsC; imcp++) { - if (cfd[imcp + nMCPsA] > 0) { - sideCtime += (cfd[imcp + nMCPsA]); - ndigitsC++; + mTimeAmp = digit.getChDgData(); + for (auto& d : mTimeAmp) { + d.CFDTime -= mEventTime /*- BCEventTime*/; + if (abs(d.CFDTime - BCEventTime) < 2) { + if (d.ChId < nMCPsA) { + sideAtime += d.CFDTime; + ndigitsA++; + } else { + sideCtime += d.CFDTime; + ndigitsC++; + } } } + if (ndigitsA > 0) - sideAtime = sideAtime / Float_t(ndigitsA); + mCollisionTime[1] = sideAtime / Float_t(ndigitsA); + if (ndigitsC > 0) - sideCtime = sideCtime / Float_t(ndigitsC); + mCollisionTime[2] = sideCtime / Float_t(ndigitsC); - if (sideAtime > 0 && sideCtime > 0) { - mVertex = (sideAtime - sideCtime) / 2.; - mCollisionTime[0] = (sideAtime + sideCtime) / 2.; - } - if (sideAtime > 0) { - mCollisionTime[1] = sideAtime; - } - if (sideCtime > 0) { - mCollisionTime[2] = sideCtime; + if (ndigitsA > 0 && ndigitsC > 0) { + mVertex = (mCollisionTime[1] - mCollisionTime[2]) / 2.; + mCollisionTime[0] = (mCollisionTime[1] + mCollisionTime[2]) / 2.; } } From 297b9f78c6ad43db1113abb424fab648f5d371e4 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Thu, 28 Mar 2019 10:33:42 +0100 Subject: [PATCH 17/25] remove <<<< after mergeing --- DataFormats/Headers/include/Headers/DataHeader.h | 3 --- .../FIT/common/simulation/include/FITSimulation/HitType.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/DataFormats/Headers/include/Headers/DataHeader.h b/DataFormats/Headers/include/Headers/DataHeader.h index 34c314d438bbd..04dab374c25ef 100644 --- a/DataFormats/Headers/include/Headers/DataHeader.h +++ b/DataFormats/Headers/include/Headers/DataHeader.h @@ -590,10 +590,7 @@ constexpr o2::header::DataOrigin gDataOriginCPV{ "CPV" }; constexpr o2::header::DataOrigin gDataOriginCTP{ "CTP" }; constexpr o2::header::DataOrigin gDataOriginEMC{ "EMC" }; constexpr o2::header::DataOrigin gDataOriginT0{ "T0" }; -<<<<<<< HEAD constexpr o2::header::DataOrigin gDataOriginV0{ "V0" }; -======= ->>>>>>> T0 simulation works with this constexpr o2::header::DataOrigin gDataOriginHMP{ "HMP" }; constexpr o2::header::DataOrigin gDataOriginITS{ "ITS" }; constexpr o2::header::DataOrigin gDataOriginMCH{ "MCH" }; diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h index 9a931ecfc9f4d..109735018084c 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/HitType.h @@ -16,10 +16,7 @@ class HitType : public o2::BasicXYZEHit }; } // namespace fit -<<<<<<< HEAD -======= ->>>>>>> T0 digitzation as a part of FIT } // namespace o2 #endif From 314bd4392cf9f23806e216ba934668875ce28fbd Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Fri, 29 Mar 2019 14:49:10 +0100 Subject: [PATCH 18/25] fix conflict --- .../DetectorsCommonDataFormats/DetID.h | 11 +- DataFormats/Detectors/Common/src/DetID.cxx | 2 +- .../FIT/V0/base/include/V0Base/Geometry.h | 20 ++-- Detectors/FIT/V0/base/src/Geometry.cxx | 4 +- .../include/V0Simulation/Detector.h | 30 +++-- .../V0/simulation/include/V0Simulation/Hit.h | 105 +++++++++--------- .../V0/simulation/src/V0SimulationLinkDef.h | 2 +- .../include/FITSimulation/MCLabel.h | 39 +++++++ Framework/Core/src/DataProcessingStatus.h | 1 + macro/build_geometry.C | 1 - 10 files changed, 132 insertions(+), 83 deletions(-) create mode 100644 Detectors/FIT/common/simulation/include/FITSimulation/MCLabel.h diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index 12d3fcd0161cd..08318a17ec545 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -59,10 +59,10 @@ class DetID static constexpr ID MID = 10; static constexpr ID ZDC = 11; static constexpr ID T0 = 12; - static constexpr ID ACO = 13; - static constexpr ID V0 = 14; + static constexpr ID V0 = 13; + static constexpr ID ACO = 14; static constexpr ID First = ITS; - static constexpr ID Last = V0; ///< if extra detectors added, update this !!! + static constexpr ID Last = ACO; ///< if extra detectors added, update this !!! static constexpr int nDetectors = Last + 1; ///< number of defined detectors @@ -106,13 +106,14 @@ class DetID ID mID = First; ///< detector ID static constexpr const char* sDetNames[nDetectors + 1] = ///< defined detector names - { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "T0", "ACO", "V0", nullptr }; + + { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "T0", "V0", "ACO", nullptr }; // detector names, will be defined in DataSources static constexpr std::array sMasks = ///< detectot masks { utils::bit2Mask(ITS), utils::bit2Mask(TPC), utils::bit2Mask(TRD), utils::bit2Mask(TOF), utils::bit2Mask(PHS), utils::bit2Mask(CPV), utils::bit2Mask(EMC), utils::bit2Mask(HMP), utils::bit2Mask(MFT), utils::bit2Mask(MCH), - utils::bit2Mask(MID), utils::bit2Mask(ZDC), utils::bit2Mask(T0), utils::bit2Mask(ACO), utils::bit2Mask(V0) }; + utils::bit2Mask(MID), utils::bit2Mask(ZDC), utils::bit2Mask(T0), utils::bit2Mask(V0), utils::bit2Mask(ACO) }; ClassDefNV(DetID, 1); }; diff --git a/DataFormats/Detectors/Common/src/DetID.cxx b/DataFormats/Detectors/Common/src/DetID.cxx index 3883126996794..329cc03c0509c 100644 --- a/DataFormats/Detectors/Common/src/DetID.cxx +++ b/DataFormats/Detectors/Common/src/DetID.cxx @@ -25,7 +25,7 @@ constexpr std::array DetID::sMasks; // redundant declarations constexpr DetID::ID DetID::ITS, DetID::TPC, DetID::TRD, DetID::TOF, DetID::PHS, DetID::CPV, DetID::EMC, - DetID::HMP, DetID::MFT, DetID::MCH, DetID::MID, DetID::ZDC, DetID::T0, DetID::ACO, DetID::V0, DetID::First, DetID::Last; + DetID::HMP, DetID::MFT, DetID::MCH, DetID::MID, DetID::ZDC, DetID::T0, DetID::V0, DetID::ACO, DetID::First, DetID::Last; constexpr int DetID::nDetectors; diff --git a/Detectors/FIT/V0/base/include/V0Base/Geometry.h b/Detectors/FIT/V0/base/include/V0Base/Geometry.h index 09da0758504b3..4e67e0de6df9f 100644 --- a/Detectors/FIT/V0/base/include/V0Base/Geometry.h +++ b/Detectors/FIT/V0/base/include/V0Base/Geometry.h @@ -28,18 +28,18 @@ namespace v0 class Geometry { public: - enum EGeoType { - eUninitilized, - eDummy, - eOnlySensitive, - eFull - }; // Geometry type options possible to be initialized + enum EGeoType { + eUninitilized, + eDummy, + eOnlySensitive, + eFull + }; // Geometry type options possible to be initialized /// /// Default constructor. /// It must be kept public for root persistency purposes, /// but should never be called by the outside world - Geometry(){mGeometryType = eUninitilized;}; + Geometry() { mGeometryType = eUninitilized; }; /// Standard constructor /// \param initType[in] The type of geometry, that will be initialized /// -> initType == 0 => only sensitive detector parts @@ -50,7 +50,7 @@ class Geometry /// Copy constructor. Geometry(const Geometry& geom); - static constexpr float sEpsilon = 0.01; // variable used to make sure one spatial dimension is infinitesimaly larger than the other + static constexpr float sEpsilon = 0.01; // variable used to make sure one spatial dimension is infinitesimaly larger than the other static constexpr float sDrSeparationScint = 0.03 + 0.04; // paint thickness + separation gap static constexpr float sDzScint = 2; static constexpr float sPhiMinScint = 0; @@ -60,14 +60,14 @@ class Geometry static constexpr int sBaseNumberOfSectors = 8; // number of sectors // TODO: Adjust the sZposition once the simulation geometry is implemented, T0 starts at 328 // at sZposition==320, there is a gap (to be filled with fibers and support) of 8 cm between the plastic of V0+ and aluminum covers of T0+ - static constexpr float sZposition = 320-sDzScint; // z-position of the geometrical center of the detectors sensitive part + static constexpr float sZposition = 320 - sDzScint; // z-position of the geometrical center of the detectors sensitive part private: void initializeVectors(); void initializeLuts(); void buildGeometry(); - void assembleSectors(TGeoVolumeAssembly *volV0); + void assembleSectors(TGeoVolumeAssembly* volV0); TGeoVolumeAssembly* buildSector(uint16_t iSector); std::vector mvrAvgScint; // average ring radii (index 0 -> ring 1 min, index 1 -> ring 1 max and ring 2 min, ... index 5 -> ring 5 max) diff --git a/Detectors/FIT/V0/base/src/Geometry.cxx b/Detectors/FIT/V0/base/src/Geometry.cxx index 334b49c5dd796..d6c0cfdbd3176 100644 --- a/Detectors/FIT/V0/base/src/Geometry.cxx +++ b/Detectors/FIT/V0/base/src/Geometry.cxx @@ -82,7 +82,7 @@ void Geometry::buildGeometry(){ } TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ - TGeoBBox *geoBoxClockwise = new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size()-1), sDySeparationScint*2, sDzScint+sEpsilon); + new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size()-1), sDySeparationScint*2, sDzScint+sEpsilon); std::stringstream ssName; ssName << "sector" << iSector+1; @@ -94,7 +94,7 @@ TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ ssNameGeoComposite << "cellGeoComposite" << iCell+1; // Generate separation between sectors by subtracting two cuboids from each tube segment - TGeoTubeSeg *geoCellTube = new TGeoTubeSeg(ssNameGeoTube.str().c_str(), mvrMinScint.at(ir), mvrMaxScint.at(ir), sDzScint, sPhiMinScint, sDphiScint); + new TGeoTubeSeg(ssNameGeoTube.str().c_str(), mvrMinScint.at(ir), mvrMaxScint.at(ir), sDzScint, sPhiMinScint, sDphiScint); std::string booleanFormula = "("; booleanFormula += ssNameGeoTube.str() + "-boolBoxScintSeparator)"; // subtract counter-clockwise box booleanFormula += (std::string)"-boolBoxScintSeparator" + ":rotPhiSector1"; // subtract clockwise box (same but rotated by 45 degrees) diff --git a/Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h b/Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h index 73ba671ac58c8..dda7f8a03ad58 100644 --- a/Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h +++ b/Detectors/FIT/V0/simulation/include/V0Simulation/Detector.h @@ -64,12 +64,18 @@ class Detector : public o2::Base::DetImpl /// This method is called for each step during simulation (see FairMCApplication::Stepping()) Bool_t ProcessHits(FairVolume* v = nullptr) override; -// ------------------------------------------------------------------ + // ------------------------------------------------------------------ /// Registers the produced collections in FAIRRootManager void Register() override; - std::vector* getHits(Int_t iColl) {if (iColl == 0) {return mHits;} return nullptr;} + std::vector* getHits(Int_t iColl) + { + if (iColl == 0) { + return mHits; + } + return nullptr; + } /// Gets the produced hits /// Has to be called after each event to reset the containers @@ -78,13 +84,13 @@ class Detector : public o2::Base::DetImpl /// Called at the end of event void EndOfEvent() override; -// TODO: From MFT -> are they needed? -// void FinishPrimary() override { ; } -// void FinishRun() override { ; } -// void BeginPrimary() override { ; } -// void PostTrack() override { ; } -// void PreTrack() override { ; } -// void SetSpecialPhysicsCuts() override { ; } + // TODO: From MFT -> are they needed? + // void FinishPrimary() override { ; } + // void FinishRun() override { ; } + // void BeginPrimary() override { ; } + // void PostTrack() override { ; } + // void PreTrack() override { ; } + // void SetSpecialPhysicsCuts() override { ; } // TODO: move to private /// Creates materials for the detector @@ -116,9 +122,9 @@ class Detector : public o2::Base::DetImpl } mTrackData; //! o2::v0::Hit* addHit(Int_t trackId, Int_t cellId, Int_t particleId, - TVector3 startPos, TVector3 endPos, - TVector3 startMom, double startE, - double endTime, double eLoss, float eTot, float eDep); + TVector3 startPos, TVector3 endPos, + TVector3 startMom, double startE, + double endTime, double eLoss, float eTot, float eDep); template friend class o2::Base::DetImpl; diff --git a/Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h b/Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h index 035e7727fc1fa..854d1dbc8889f 100644 --- a/Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h +++ b/Detectors/FIT/V0/simulation/include/V0Simulation/Hit.h @@ -14,57 +14,59 @@ #ifndef ALICEO2_FIT_V0_HIT_H_ #define ALICEO2_FIT_V0_HIT_H_ -#include "SimulationDataFormat/BaseHits.h" // for BasicXYZEHit -#include "Rtypes.h" // for Bool_t, Double_t, Int_t, Double32_t, etc -#include "TVector3.h" // for TVector3 +#include "SimulationDataFormat/BaseHits.h" // for BasicXYZEHit +#include "Rtypes.h" // for Bool_t, Double_t, Int_t, Double32_t, etc +#include "TVector3.h" // for TVector3 #include #include "CommonUtils/ShmAllocator.h" -namespace o2 { -namespace v0 { +namespace o2 +{ +namespace v0 +{ -class Hit : public o2::BasicXYZEHit +class Hit : public o2::BasicXYZEHit { - public: - - /// Default constructor - Hit() = default; - - /// Class Constructor - /// \param trackID Index of MCTrack - /// \param cellID Cell ID - /// \param startPos Coordinates at entrance to active volume [cm] - /// \param pos Coordinates to active volume [cm] - /// \param mom Momentum of track at entrance [GeV] - /// \param endTime Time at entrance [ns] - /// \param time Time since event start [ns] - /// \param eLoss Energy deposit [GeV] - /// \param startStatus: status at entrance - /// \param endStatus: status at exit - inline Hit(int trackID, int cellID, const TVector3& startPos, const TVector3& endPos, - const TVector3& startMom, double startE, double endTime, double eLoss, - float eTot, float eDep); // last two are for testing only - - // Entrance position getters - Point3D GetPosStart() const { return mPosStart; } - Float_t GetStartX() const { return mPosStart.X(); } - Float_t GetStartY() const { return mPosStart.Y(); } - Float_t GetStartZ() const { return mPosStart.Z(); } - template void GetStartPosition(F &x, F &y, F &z) const - { - x = GetStartX(); - y = GetStartY(); - z = GetStartZ(); - } - // momentum getters - Vector3D GetMomentum() const { return mMomentum; } - Vector3D& GetMomentum() { return mMomentum; } - Float_t GetPx() const { return mMomentum.X(); } - Float_t GetPy() const { return mMomentum.Y(); } - Float_t GetPz() const { return mMomentum.Z(); } - Float_t GetE() const { return mE; } - Float_t GetTotalEnergy() const { return GetE(); } -/* + public: + /// Default constructor + Hit() = default; + + /// Class Constructor + /// \param trackID Index of MCTrack + /// \param cellID Cell ID + /// \param startPos Coordinates at entrance to active volume [cm] + /// \param pos Coordinates to active volume [cm] + /// \param mom Momentum of track at entrance [GeV] + /// \param endTime Time at entrance [ns] + /// \param time Time since event start [ns] + /// \param eLoss Energy deposit [GeV] + /// \param startStatus: status at entrance + /// \param endStatus: status at exit + inline Hit(int trackID, int cellID, const TVector3& startPos, const TVector3& endPos, + const TVector3& startMom, double startE, double endTime, double eLoss, + float eTot, float eDep); // last two are for testing only + + // Entrance position getters + Point3D GetPosStart() const { return mPosStart; } + Float_t GetStartX() const { return mPosStart.X(); } + Float_t GetStartY() const { return mPosStart.Y(); } + Float_t GetStartZ() const { return mPosStart.Z(); } + template + void GetStartPosition(F& x, F& y, F& z) const + { + x = GetStartX(); + y = GetStartY(); + z = GetStartZ(); + } + // momentum getters + Vector3D GetMomentum() const { return mMomentum; } + Vector3D& GetMomentum() { return mMomentum; } + Float_t GetPx() const { return mMomentum.X(); } + Float_t GetPy() const { return mMomentum.Y(); } + Float_t GetPz() const { return mMomentum.Z(); } + Float_t GetE() const { return mE; } + Float_t GetTotalEnergy() const { return GetE(); } + /* UChar_t GetStatusEnd() const { return mTrackStatusEnd; } UChar_t GetStatusStart() const { return mTrackStatusStart; } @@ -93,12 +95,12 @@ class Hit : public o2::BasicXYZEHit return of; } */ - void Print(const Option_t *opt) const; + void Print(const Option_t* opt) const; private: - Vector3D mMomentum; ///< momentum at entrance - Point3D mPosStart; ///< position at entrance (base mPos give position on exit) - Float_t mE; ///< total energy at entrance + Vector3D mMomentum; ///< momentum at entrance + Point3D mPosStart; ///< position at entrance (base mPos give position on exit) + Float_t mE; ///< total energy at entrance ClassDefNV(Hit, 1) }; @@ -111,7 +113,8 @@ Hit::Hit(int trackID, int detID, const TVector3& startPos, const TVector3& endPo mPosStart(startPos.X(), startPos.Y(), startPos.Z()), mE(startE) // TODO: may require adding initialization to eTot and eDep and corresponding fields in the Hit.h header -{} +{ +} } // namespace v0 } // namespace o2 diff --git a/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h b/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h index 3b192f3c23dcb..258904407fbb5 100644 --- a/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h +++ b/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h @@ -15,6 +15,6 @@ #pragma link off all functions; #pragma link C++ class o2::v0::Detector + ; -#pragma link C++ class o2::Base::DetImpl < o2::v0::Detector > +; +#pragma link C++ class o2::Base::DetImpl < o2::v0::Detector> + ; #endif diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/MCLabel.h b/Detectors/FIT/common/simulation/include/FITSimulation/MCLabel.h new file mode 100644 index 0000000000000..7a82415ec5e08 --- /dev/null +++ b/Detectors/FIT/common/simulation/include/FITSimulation/MCLabel.h @@ -0,0 +1,39 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// Declaration of a transient MC label class for FIT + +#ifndef ALICEO2_FIT_MCLABEL_H_ +#define ALICEO2_FIT_MCLABEL_H_ + +#include "SimulationDataFormat/MCCompLabel.h" + +namespace o2 +{ +namespace fit +{ +class MCLabel : public o2::MCCompLabel +{ + private: + Int_t mDetID = -1; + + public: + MCLabel() = default; + MCLabel(Int_t trackID, Int_t eventID, Int_t srcID, Int_t qID) + : o2::MCCompLabel(trackID, eventID, srcID), mDetID(qID) {} + + Int_t getDetID() const { return mDetID; } + + ClassDefNV(MCLabel, 1); +}; +} // namespace fit +} // namespace o2 + +#endif diff --git a/Framework/Core/src/DataProcessingStatus.h b/Framework/Core/src/DataProcessingStatus.h index 2192ccf2de529..a298b51e80e02 100644 --- a/Framework/Core/src/DataProcessingStatus.h +++ b/Framework/Core/src/DataProcessingStatus.h @@ -38,6 +38,7 @@ enum struct DriverStatus : uint32_t { BYTES_READ = 0, BYTES_PROCESSED = 1, BUFFER_OVERFLOWS = 2 + }; } // namespace framework diff --git a/macro/build_geometry.C b/macro/build_geometry.C index 6db272e1044d8..c7b22415c2ff4 100644 --- a/macro/build_geometry.C +++ b/macro/build_geometry.C @@ -189,7 +189,6 @@ void build_geometry(FairRunSim* run = nullptr) run->AddModule(new o2::t0::Detector(true)); } -// TODO: Fix this typo ("T0"->"V0"), after fixing the o2::v0::Detector constructor - so that it does not cause o2sim crash if (isActivated("V0")) { // FIT-V0 run->AddModule(new o2::v0::Detector(true)); From a04fde069efff0918a8329a982d2ba371b18d565 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Fri, 29 Mar 2019 17:29:39 +0100 Subject: [PATCH 19/25] merge with V0 --- .../DetectorsCommonDataFormats/DetID.h | 2 +- Detectors/FIT/T0/base/src/T0BaseLinkDef.h | 19 ++++ .../T0Simulation/DigitizationParameters.h | 2 +- Detectors/FIT/T0/simulation/src/Detector.cxx | 1 - Detectors/FIT/V0/base/src/Geometry.cxx | 2 +- .../V0/simulation/src/V0SimulationLinkDef.h | 2 +- Detectors/FIT/macros/readRecPoints.C | 58 ----------- Detectors/FIT/macros/run_digi_fit.C | 96 ------------------- Detectors/FIT/macros/test/run_test.sh | 5 - .../include/FITSimulation/MCLabel.h~HEAD | 39 -------- ...h~e6c90292b4ea1ca164bf869789a6c1755aac715a | 39 -------- .../src/FITDigitizerSpec.cxx | 15 --- 12 files changed, 23 insertions(+), 257 deletions(-) create mode 100644 Detectors/FIT/T0/base/src/T0BaseLinkDef.h delete mode 100644 Detectors/FIT/macros/readRecPoints.C delete mode 100644 Detectors/FIT/macros/run_digi_fit.C delete mode 100755 Detectors/FIT/macros/test/run_test.sh delete mode 100644 Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD delete mode 100644 Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index 08318a17ec545..09263376baa4e 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -107,7 +107,7 @@ class DetID static constexpr const char* sDetNames[nDetectors + 1] = ///< defined detector names - { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "T0", "V0", "ACO", nullptr }; + { "ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "T0", "V0", "ACO", nullptr }; // detector names, will be defined in DataSources static constexpr std::array sMasks = ///< detectot masks diff --git a/Detectors/FIT/T0/base/src/T0BaseLinkDef.h b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h new file mode 100644 index 0000000000000..4be48bd4b2466 --- /dev/null +++ b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::t0::Geometry + ; + +#endif diff --git a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h index 631164a592bdb..a90adc1216d37 100644 --- a/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h +++ b/Detectors/FIT/T0/simulation/include/T0Simulation/DigitizationParameters.h @@ -20,7 +20,7 @@ inline o2::fit::DigitizationParameters T0DigitizationParameters() result.mAmpThreshold = 100; // number of photoelectrons result.mTimeDiffAC = (Geometry::ZdetA - Geometry::ZdetC) * TMath::C(); result.mIsT0 = true; - + return result; } } // namespace o2::t0 diff --git a/Detectors/FIT/T0/simulation/src/Detector.cxx b/Detectors/FIT/T0/simulation/src/Detector.cxx index 511acef4f4260..6c7ec8bb9bc26 100644 --- a/Detectors/FIT/T0/simulation/src/Detector.cxx +++ b/Detectors/FIT/T0/simulation/src/Detector.cxx @@ -45,7 +45,6 @@ Detector::Detector(Bool_t Active) Detector::Detector(const Detector& rhs) : o2::Base::DetImpl(rhs), mIdSens1(rhs.mIdSens1), mPMTeff(rhs.mPMTeff), mHits(o2::utils::createSimVector()) { - } Detector::~Detector() diff --git a/Detectors/FIT/V0/base/src/Geometry.cxx b/Detectors/FIT/V0/base/src/Geometry.cxx index d6c0cfdbd3176..4b3627e7e3ad7 100644 --- a/Detectors/FIT/V0/base/src/Geometry.cxx +++ b/Detectors/FIT/V0/base/src/Geometry.cxx @@ -82,7 +82,7 @@ void Geometry::buildGeometry(){ } TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ - new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size()-1), sDySeparationScint*2, sDzScint+sEpsilon); + new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size() - 1), sDySeparationScint * 2, sDzScint + sEpsilon); std::stringstream ssName; ssName << "sector" << iSector+1; diff --git a/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h b/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h index 258904407fbb5..3b192f3c23dcb 100644 --- a/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h +++ b/Detectors/FIT/V0/simulation/src/V0SimulationLinkDef.h @@ -15,6 +15,6 @@ #pragma link off all functions; #pragma link C++ class o2::v0::Detector + ; -#pragma link C++ class o2::Base::DetImpl < o2::v0::Detector> + ; +#pragma link C++ class o2::Base::DetImpl < o2::v0::Detector > +; #endif diff --git a/Detectors/FIT/macros/readRecPoints.C b/Detectors/FIT/macros/readRecPoints.C deleted file mode 100644 index 941d2a241fd60..0000000000000 --- a/Detectors/FIT/macros/readRecPoints.C +++ /dev/null @@ -1,58 +0,0 @@ -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include "FITSimulation/Detector.h" -#include "FITBase/Digit.h" -#include "FITReconstruction/RecPoints.h" -#include -#endif -void readRecPoints() -{ - using namespace o2::fit; - // using namespace o2::fit::Digit; - - // Create histograms - TDirectory* cwd = gDirectory; - gDirectory = 0x0; - - TH2F* hMultRec = new TH2F("hMultRec", "photons Recits ", 210, 0, 210, 500, 0, 1000); - TH2F* hTimeRec = new TH2F("hTimeRec", "Time Recits", 210, 0, 210, 1000, 1, 13); - TH1F* ht0AC = new TH1F("hT0AC", "T0AC", 100, -1, 1); - - gDirectory = cwd; - - TFile* frec = TFile::Open("o2reco_fit.root"); - std::cout << " Open rec file " << std::endl; - TTree* recTree = (TTree*)frec->Get("o2sim"); - o2::fit::RecPoints* recArr = new RecPoints; - recTree->SetBranchAddress("FITRecPoints", &recArr); - Int_t nevD = recTree->GetEntries(); // recits in cont. readout may be grouped as few events per entry - std::cout << "Found " << nevD << " events with recits " << std::endl; - Float_t cfd[208], amp[208]; - for (Int_t iev = 0; iev < nevD; iev++) { - recTree->GetEvent(iev); - - Float_t t0AC = recArr->GetCollisionTime(0); - Float_t eventtime = recArr->GetTimeFromDigit(); - ht0AC->Fill(t0AC - eventtime); - std::cout << iev << " AC " << recArr->GetCollisionTime(0) << " " << eventtime << std::endl; - for (int ii = 0; ii < 208; ii++) { - cfd[ii] = amp[ii] = 0; - } - for (const auto& d : recArr->getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime; - amp[mcp] = d.QTCAmpl; - // cout<Fill(Float_t(mcp), amp[mcp]); - hTimeRec->Fill(Float_t(mcp), cfd[mcp]); - } - } - TFile* Hfile = new TFile("FigFit_rec_pp.root", "RECREATE"); - printf("Writting histograms to root file \n"); - Hfile->cd(); - //Create a canvas, set the view range, show histograms - // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); - hTimeRec->Write(); - hMultRec->Write(); - ht0AC->Write(); - -} // end of macro diff --git a/Detectors/FIT/macros/run_digi_fit.C b/Detectors/FIT/macros/run_digi_fit.C deleted file mode 100644 index 8c9f513087903..0000000000000 --- a/Detectors/FIT/macros/run_digi_fit.C +++ /dev/null @@ -1,96 +0,0 @@ -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include - -#include - -#include "FairLogger.h" -#include "FairRunAna.h" -#include "FairFileSource.h" -#include "FairRuntimeDb.h" -#include "FairParRootFileIo.h" -#include "FairSystemInfo.h" - -#include "FITSimulation/DigitizerTask.h" -#endif - -void run_digi_fit(Int_t nEvents = 10, Float_t rate = 50.e3) -{ - // if rate>0 then continuous simulation for this rate will be performed - - // Initialize logger - FairLogger* logger = FairLogger::GetLogger(); - logger->SetLogVerbosityLevel("LOW"); - logger->SetLogScreenLevel("DEBUG"); - - // Input and output file name - std::stringstream inputfile, outputfile, paramfile; - inputfile << "o2sim.root"; - paramfile << "o2sim_par.root"; - outputfile << "o2sim_digi.root"; - - // Setup timer - TStopwatch timer; - - // Setup FairRoot analysis manager - FairRunAna* fRun = new FairRunAna(); - FairFileSource* fFileSource = new FairFileSource(inputfile.str().c_str()); - fRun->SetSource(fFileSource); - std::cout << "@@@@ input " << inputfile.str().c_str() << std::endl; - fRun->SetOutputFile(outputfile.str().c_str()); - std::cout << "@@@@ output " << outputfile.str().c_str() << std::endl; - - if (rate > 0) { - fFileSource->SetEventMeanTime(1.e9 / rate); // is in us - } - - // Setup Runtime DB - - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - std::cout << "@@@@ param " << paramfile.str().c_str() << std::endl; - FairParRootFileIo* parInput1 = new FairParRootFileIo(); - parInput1->open(paramfile.str().c_str()); - rtdb->setFirstInput(parInput1); - - // Setup digitizer - o2::fit::DigitizerTask* digi = new o2::fit::DigitizerTask(); - // digi->setContinuous(rate > 0); - // digi->setFairTimeUnitInNS(1.0); // tell in which units (wrt nanosecond) FAIT timestamps are - fRun->AddTask(digi); - - std::cout << "@@@@ Add task " << std::endl; - fRun->Init(); - std::cout << "@@@@ Run Init " << std::endl; - - timer.Start(); - fRun->Run(); - - std::cout << std::endl - << std::endl; - - // 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 << ""; - std::cout << maxMemory; - std::cout << "" << std::endl; - - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - - Float_t cpuUsage = ctime / rtime; - cout << ""; - cout << cpuUsage; - cout << "" << endl; - cout << endl - << endl; - std::cout << "Macro finished succesfully" << std::endl; - - std::cout << endl - << std::endl; - std::cout << "Output file is " << outputfile.str() << std::endl; - // std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl - << endl; -} diff --git a/Detectors/FIT/macros/test/run_test.sh b/Detectors/FIT/macros/test/run_test.sh deleted file mode 100755 index 9e1f69e98dc2c..0000000000000 --- a/Detectors/FIT/macros/test/run_test.sh +++ /dev/null @@ -1,5 +0,0 @@ -# -nEvents=10 -mcEngine=\"TGeant3\" -# -# will be fill later diff --git a/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD b/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD deleted file mode 100644 index 7a82415ec5e08..0000000000000 --- a/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~HEAD +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -// Declaration of a transient MC label class for FIT - -#ifndef ALICEO2_FIT_MCLABEL_H_ -#define ALICEO2_FIT_MCLABEL_H_ - -#include "SimulationDataFormat/MCCompLabel.h" - -namespace o2 -{ -namespace fit -{ -class MCLabel : public o2::MCCompLabel -{ - private: - Int_t mDetID = -1; - - public: - MCLabel() = default; - MCLabel(Int_t trackID, Int_t eventID, Int_t srcID, Int_t qID) - : o2::MCCompLabel(trackID, eventID, srcID), mDetID(qID) {} - - Int_t getDetID() const { return mDetID; } - - ClassDefNV(MCLabel, 1); -}; -} // namespace fit -} // namespace o2 - -#endif diff --git a/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a b/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a deleted file mode 100644 index 7a82415ec5e08..0000000000000 --- a/Detectors/FIT/simulation/include/FITSimulation/MCLabel.h~e6c90292b4ea1ca164bf869789a6c1755aac715a +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -// Declaration of a transient MC label class for FIT - -#ifndef ALICEO2_FIT_MCLABEL_H_ -#define ALICEO2_FIT_MCLABEL_H_ - -#include "SimulationDataFormat/MCCompLabel.h" - -namespace o2 -{ -namespace fit -{ -class MCLabel : public o2::MCCompLabel -{ - private: - Int_t mDetID = -1; - - public: - MCLabel() = default; - MCLabel(Int_t trackID, Int_t eventID, Int_t srcID, Int_t qID) - : o2::MCCompLabel(trackID, eventID, srcID), mDetID(qID) {} - - Int_t getDetID() const { return mDetID; } - - ClassDefNV(MCLabel, 1); -}; -} // namespace fit -} // namespace o2 - -#endif diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index dbebea32ef1b7..a5bed772c7c4c 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -202,21 +202,6 @@ class FITT0DPLDigitizerTask : public FITDPLDigitizerTask mOrigin = DETOR; std::cout << " @@@@ DETOR FITT0DPLDigitizerTask " << mOrigin << " " << mID.getName() << std::endl; } - -}; - -class FITT0DPLDigitizerTask : public FITDPLDigitizerTask -{ - public: - // FIXME: origina should be extractable from the DetID, the problem is 3d party header dependencies - static constexpr o2::detectors::DetID::ID DETID = o2::detectors::DetID::T0; - static constexpr o2::header::DataOrigin DETOR = o2::header::gDataOriginT0; - FITT0DPLDigitizerTask() - { - mID = DETID; - mOrigin = DETOR; - std::cout << " @@@@ DETOR FITT0DPLDigitizerTask " << mOrigin << " " << mID.getName() << std::endl; - } }; constexpr o2::detectors::DetID::ID FITT0DPLDigitizerTask::DETID; From dcb391556ad78356fe96d8c8a2c230e54783684c Mon Sep 17 00:00:00 2001 From: Maciej Slupecki Date: Sat, 30 Mar 2019 15:27:30 +0200 Subject: [PATCH 20/25] Fixed material definition in FIT-V0+ --- Detectors/FIT/V0/base/src/Geometry.cxx | 7 +- Detectors/FIT/V0/simulation/src/Detector.cxx | 157 +------------------ 2 files changed, 8 insertions(+), 156 deletions(-) diff --git a/Detectors/FIT/V0/base/src/Geometry.cxx b/Detectors/FIT/V0/base/src/Geometry.cxx index 4b3627e7e3ad7..21953f10256a7 100644 --- a/Detectors/FIT/V0/base/src/Geometry.cxx +++ b/Detectors/FIT/V0/base/src/Geometry.cxx @@ -82,7 +82,7 @@ void Geometry::buildGeometry(){ } TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ - new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size() - 1), sDySeparationScint * 2, sDzScint + sEpsilon); + new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size()-1), sDySeparationScint*2, sDzScint+sEpsilon); std::stringstream ssName; ssName << "sector" << iSector+1; @@ -100,8 +100,8 @@ TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ booleanFormula += (std::string)"-boolBoxScintSeparator" + ":rotPhiSector1"; // subtract clockwise box (same but rotated by 45 degrees) TGeoCompositeShape* geoCell = new TGeoCompositeShape(ssNameGeoComposite.str().c_str(), booleanFormula.c_str()); - TGeoMedium* kMed = gGeoManager->GetMedium("V0_Scintillator"); - TGeoVolume *volCell = new TGeoVolume("cell", geoCell, kMed); + TGeoMedium* kMed = gGeoManager->GetMedium("V0_Scintillator$"); + TGeoVolume *volCell = new TGeoVolume("V0cell", geoCell, kMed); volCell->SetLineColor(kYellow); sector->AddNode(volCell, iCell+1); @@ -110,7 +110,6 @@ TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ } void Geometry::assembleSectors(TGeoVolumeAssembly *volV0){ -// for(uint16_t isector=0; isector<1; isector++){ for(uint16_t isector=0; isectorAddNode(sector, isector+1, mvPhiRot.at(isector)); diff --git a/Detectors/FIT/V0/simulation/src/Detector.cxx b/Detectors/FIT/V0/simulation/src/Detector.cxx index ca21a05fce0c5..846180c2905ff 100644 --- a/Detectors/FIT/V0/simulation/src/Detector.cxx +++ b/Detectors/FIT/V0/simulation/src/Detector.cxx @@ -61,9 +61,9 @@ Detector::Detector(Bool_t isActive) void Detector::InitializeO2Detector() { - LOG(INFO) << "Initializing FIT V0 geometry\n"; + LOG(INFO) << "FIT_V0: Initializing O2 detector"; - TGeoVolume* volSensitive = gGeoManager->GetVolume("cell"); + TGeoVolume* volSensitive = gGeoManager->GetVolume("V0cell"); if (!volSensitive) { LOG(FATAL) << "Can't find FIT V0 sensitive volume: cell"; } @@ -151,6 +151,7 @@ o2::v0::Hit* Detector::addHit(Int_t trackId, Int_t cellId, Int_t particleId, // TODO: -> verify Todos inside the function void Detector::createMaterials() { + LOG(INFO) << "FIT_V0: Creating materials"; // Air mixture const Int_t nAir = 4; Float_t aAir[nAir] = { 12.0107, 14.0067, 15.9994, 39.948 }; @@ -195,7 +196,7 @@ void Detector::createMaterials() o2::Base::Detector::Mixture(++matId, "Air$", aAir, zAir, dAir, nAir, wAir); o2::Base::Detector::Medium(Air, "Air$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); - o2::Base::Detector::Mixture(++matId, "Scintillator", aScint, zScint, dScint, nScint, wScint); + o2::Base::Detector::Mixture(++matId, "Scintillator$", aScint, zScint, dScint, nScint, wScint); o2::Base::Detector::Medium(Scintillator, "Scintillator$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); // o2::Base::Detector::Material(++matId, "Alu$", aAlu, zAlu, dAlu, radAlu, absAlu); @@ -206,7 +207,7 @@ void Detector::createMaterials() void Detector::ConstructGeometry() { - LOG(DEBUG) << "Creating FIT V0 geometry\n"; + LOG(INFO) << "FIT_V0: Constructing geometry"; createMaterials(); mGeometry = new Geometry(Geometry::eOnlySensitive); } @@ -233,151 +234,3 @@ void Detector::Reset() mHits->clear(); } } - - - - - - -/*void Detector::DefineOpticalProperties() -{ - // Path of the optical properties input file - TString inputDir; - const char* aliceO2env = std::getenv("O2_ROOT"); - if (aliceO2env) - inputDir = aliceO2env; - inputDir += "/share/Detectors/T0/files/"; - - TString optPropPath = inputDir + "quartzOptProperties.txt"; - optPropPath = gSystem->ExpandPathName(optPropPath.Data()); // Expand $(ALICE_ROOT) into real system path - - if (ReadOptProperties(optPropPath.Data()) < 0) { - // Error reading file - LOG(ERROR) << "Could not read FIT optical properties" << FairLogger::endl; - return; - } - Int_t nBins = mPhotonEnergyD.size(); - // set QE - mPMTeff = new TGraph(nBins, &(mPhotonEnergyD[0]), &(mQuantumEfficiency[0])); - - // Prepare pointers for arrays with constant and hardcoded values (independent on wavelength) - FillOtherOptProperties(); - - // Quick conversion from vector to Double_t*: photonEnergyD -> &(photonEnergyD[0]) - TVirtualMC::GetMC()->SetCerenkov(getMediumID(kOpGlass), nBins, &(mPhotonEnergyD[0]), &(mAbsorptionLength[0]), - &(mEfficAll[0]), &(mRefractionIndex[0])); - // TVirtualMC::GetMC()->SetCerenkov (getMediumID(kOpGlassCathode), kNbins, aPckov, aAbsSiO2, effCathode, rindexSiO2); - TVirtualMC::GetMC()->SetCerenkov(getMediumID(kOpGlassCathode), nBins, &(mPhotonEnergyD[0]), &(mAbsorptionLength[0]), - &(mEfficAll[0]), &(mRefractionIndex[0])); - - // Define a border for radiator optical properties - //TVirtualMC::GetMC()->DefineOpSurface("surfRd", kGlisur, kDielectric_metal, kPolished, 0.); - TVirtualMC::GetMC()->DefineOpSurface("surfRd", kUnified, kDielectric_metal, kPolished, 0.); - TVirtualMC::GetMC()->SetMaterialProperty("surfRd", "EFFICIENCY", nBins, &(mPhotonEnergyD[0]), &(mEfficMet[0])); - TVirtualMC::GetMC()->SetMaterialProperty("surfRd", "REFLECTIVITY", nBins, &(mPhotonEnergyD[0]), &(mReflMet[0])); -} - -void Detector::FillOtherOptProperties() -{ - // Set constant values to the other arrays - for (Int_t i = 0; i < mPhotonEnergyD.size(); i++) { - mEfficAll.push_back(1.); - mRindexAir.push_back(1.); - mAbsorAir.push_back(0.3); - mRindexCathodeNext.push_back(0.); - mAbsorbCathodeNext.push_back(0.); - mEfficMet.push_back(0.); - mReflMet.push_back(1.); - } -} - -//------------------------------------------------------------------------ -Bool_t Detector::RegisterPhotoE(float energy) -{ - // Float_t hc=197.326960*1.e6; //mev*nm - float hc = 1.973 * 1.e-6; // gev*nm - float lambda = hc / energy; - float eff = mPMTeff->Eval(lambda); - float p = gRandom->Rndm(); - - if (p > eff) - return kFALSE; - - return kTRUE; -} - -Int_t Detector::ReadOptProperties(const std::string filePath) -{ - std::ifstream infile; - infile.open(filePath.c_str()); - - // Check if file is opened correctly - if (infile.fail() == true) { - // AliFatal(Form("Error opening ascii file: %s", filePath.c_str())); - return -1; - } - - std::string comment; // dummy, used just to read 4 first lines and move the cursor to the 5th, otherwise unused - if (!getline(infile, comment)) { // first comment line - // AliFatal(Form("Error opening ascii file (it is probably a folder!): %s", filePath.c_str())); - return -2; - } - getline(infile, comment); // 2nd comment line - - // Get number of elements required for the array - Int_t nLines; - infile >> nLines; - if (nLines < 0 || nLines > 1e4) { - // AliFatal(Form("Input arraySize out of range 0..1e4: %i. Check input file: %s", kNbins, filePath.c_str())); - return -4; - } - - getline(infile, comment); // finish 3rd line after the nEntries are read - getline(infile, comment); // 4th comment line - - // read the main body of the file (table of values: energy, absorption length and refractive index) - Int_t iLine = 0; - std::string sLine; - getline(infile, sLine); - while (!infile.eof()) { - if (iLine >= nLines) { - // AliFatal(Form("Line number: %i reaches range of declared arraySize: %i. Check input file: %s", iLine, - // kNbins, filePath.c_str())); - return -5; - } - std::stringstream ssLine(sLine); - // First column: - Double_t energy; - ssLine >> energy; - energy *= 1e-9; // Convert eV -> GeV immediately - mPhotonEnergyD.push_back(energy); - // Second column: - Double_t absorption; - ssLine >> absorption; - mAbsorptionLength.push_back(absorption); - // Third column: - Double_t refraction; - ssLine >> refraction; - mRefractionIndex.push_back(refraction); - // Fourth column: - Double_t efficiency; - ssLine >> efficiency; - mQuantumEfficiency.push_back(efficiency); - if (!(ssLine.good() || ssLine.eof())) { // check if there were problems with numbers conversion - // AliFatal(Form("Error while reading line %i: %s", iLine, ssLine.str().c_str())); - return -6; - } - getline(infile, sLine); - iLine++; - } - if (iLine != mPhotonEnergyD.size()) { - // AliFatal(Form("Total number of lines %i is different than declared %i. Check input file: %s", iLine, kNbins, - // filePath.c_str())); - return -7; - } - - // AliInfo(Form("Optical properties taken from the file: %s. Number of lines read: %i",filePath.c_str(),iLine)); - return 0; -} -*/ - From a705103c2e44775dfbe92790d0a00b819ed39563 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sat, 30 Mar 2019 20:49:24 +0100 Subject: [PATCH 21/25] clang fixed --- .../FIT/T0/base/src/T0BaseLinkDef.h~HEAD | 19 ---- .../T0BaseLinkDef.h~first separation T0 V0 | 19 ---- Detectors/FIT/T0/macros/readHitsDigits.C | 107 +++++++++--------- Detectors/FIT/T0/macros/run_reco_t0.C | 71 ++++++++++++ Detectors/FIT/V0/base/src/Geometry.cxx | 4 +- Detectors/FIT/macros/readHitsDigits.C | 107 +++++++++--------- 6 files changed, 183 insertions(+), 144 deletions(-) delete mode 100644 Detectors/FIT/T0/base/src/T0BaseLinkDef.h~HEAD delete mode 100644 Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 create mode 100644 Detectors/FIT/T0/macros/run_reco_t0.C diff --git a/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~HEAD b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~HEAD deleted file mode 100644 index 4be48bd4b2466..0000000000000 --- a/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~HEAD +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifdef __CLING__ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ class o2::t0::Geometry + ; - -#endif diff --git a/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 b/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 deleted file mode 100644 index 4be48bd4b2466..0000000000000 --- a/Detectors/FIT/T0/base/src/T0BaseLinkDef.h~first separation T0 V0 +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifdef __CLING__ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ class o2::t0::Geometry + ; - -#endif diff --git a/Detectors/FIT/T0/macros/readHitsDigits.C b/Detectors/FIT/T0/macros/readHitsDigits.C index 8d1886387b0f1..eed16d9a87e94 100644 --- a/Detectors/FIT/T0/macros/readHitsDigits.C +++ b/Detectors/FIT/T0/macros/readHitsDigits.C @@ -1,87 +1,90 @@ -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include "FITSimulation/Detector.h" +#include "T0Simulation/Detector.h" #include "FITBase/Digit.h" #include -#endif - -void readHitsDigits() +void readHitsDigits() { using namespace o2::fit; // using namespace o2::fit::Digit; - + // Create histograms TDirectory* cwd = gDirectory; gDirectory = 0x0; + + TH2F *hMultHit = new TH2F("hMultHits","photons Hits ",210, 0, 210, 500, 0, 5000); + TH2F *hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12); + TH2F *hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8); + TH2F *hMultDig = new TH2F("hMultDig","photons Digits ",210, 0, 210, 500, 0, 20); + TH2F *hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1); - TH2F* hMultHit = new TH2F("hMultHits", "photons Hits ", 210, 0, 210, 500, 0, 5000); - TH2F* hTimeHit = new TH2F("hTimeAChit", "Time Hits", 210, 0, 210, 1000, 0, 15); - TH2F* hMultDig = new TH2F("hMultDig", "photons Digits ", 210, 0, 210, 500, 0, 20); - TH2F* hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 300, 0, 15); - - gDirectory = cwd; - - TFile* fhit = new TFile("o2sim.root"); - TTree* hitTree = (TTree*)fhit->Get("o2sim"); - std::vector* hitArray = nullptr; - hitTree->SetBranchAddress("FITHit", &hitArray); + gDirectory = cwd; + + TFile *fhit = new TFile("o2sim.root"); + TTree *hitTree = (TTree*)fhit->Get("o2sim"); + std::vector* hitArray = nullptr; + hitTree->SetBranchAddress("T0Hit", &hitArray); Int_t nevH = hitTree->GetEntries(); // hits are stored as one event per entry - std::cout << "Found " << nevH << " events with hits " << std::endl; - + // std::cout << "Found " << nevH << " events with hits " << std::endl; + Double_t hit_time[240]; Int_t countE[240]; - // Event ------------------------- LOOP - for (Int_t ievent = 0; ievent < nevH; ievent++) { + // Event ------------------------- LOOP + for (Int_t ievent=0; ieventGetEntry(ievent); - for (int ii = 0; ii < 240; ii++) { - countE[ii] = 0; - hit_time[ii] = 0; - } + for (int ii=0; ii<240; ii++) { countE[ii]=0;hit_time[ii]=0; } for (auto& hit : *hitArray) { Int_t detID = hit.GetDetectorID(); hit_time[detID] = hit.GetTime(); - hTimeHit->Fill(detID, hit_time[detID]); - if (hit_time[detID] < 10 && detID < 96) - std::cout << ievent << " " << detID << " time " << hit_time[detID] << endl; - - countE[detID]++; + hTimeHitA -> Fill(detID, hit_time[detID]); + hTimeHitC -> Fill(detID, hit_time[detID]); + countE[detID]++; } - for (int ii = 0; ii < 208; ii++) { - if (countE[ii] > 100) { - hMultHit->Fill(ii, countE[ii]); - // std::cout<100) { + hMultHit -> Fill(ii, countE[ii]); + // std::cout<Get("o2sim"); - o2::fit::Digit* digArr = new Digit; - digTree->SetBranchAddress("FITDigit", &digArr); + std::vector * digArr = new std::vector; + digTree->SetBranchAddress("T0Digit", &digArr); Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry std::cout << "Found " << nevD << " events with digits " << std::endl; - Float_t cfd[208], amp[208]; + Float_t cfd[208], amp[208], part[208]; for (Int_t iev = 0; iev < nevD; iev++) { digTree->GetEvent(iev); - for (int ii = 0; ii < 208; ii++) { - cfd[ii] = amp[ii] = 0; - } - for (const auto& d : digArr->getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime; - amp[mcp] = d.QTCAmpl; - // cout<Fill(Float_t(mcp), amp[mcp]); - hTimeDig->Fill(Float_t(mcp), cfd[mcp]); + for (const auto& digit : *digArr) { + for (int ii=0; ii<208; ii++) { cfd[ii]=amp[ii]=0; } + Double_t evtime = digit.getTime(); + for (const auto& d : digit.getChDgData()) { + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime - evtime - 12.5; + amp[mcp] = d.QTCAmpl; + part[mcp] = d.numberOfParticles; + cout<Fill(Float_t (mcp),amp[mcp]); + hTimeDig ->Fill(Float_t (mcp),cfd[mcp]); + } } - } - TFile* Hfile = new TFile("FigFit_dig_pp.root", "RECREATE"); + } + TFile *Hfile = new TFile("FigFit_hits_pp.root","RECREATE"); printf("Writting histograms to root file \n"); - Hfile->cd(); + Hfile->cd(); //Create a canvas, set the view range, show histograms // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); - hTimeHit->Write(); + hTimeHitA->Write(); + hTimeHitC->Write(); hMultHit->Write(); hTimeDig->Write(); hMultDig->Write(); + } // end of macro + + + + + diff --git a/Detectors/FIT/T0/macros/run_reco_t0.C b/Detectors/FIT/T0/macros/run_reco_t0.C new file mode 100644 index 0000000000000..6895d41909cd1 --- /dev/null +++ b/Detectors/FIT/T0/macros/run_reco_t0.C @@ -0,0 +1,71 @@ +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include +#include +#include +#include +#include +#include +#include + +#include "FairLogger.h" + +#include "T0Reconstruction/CollisionTimeRecoTask.h" +#include "T0Reconstruction/RecPoints.h" +#include "FITBase/Digit.h" +#endif + +void run_reco_t0(std::string inpudDig = "t0digits.root", + std::string outName = "o2reco_t0.root", + std::string inputGRP = "o2sim_grp.root") { + + // Initialize logger + FairLogger *logger = FairLogger::GetLogger(); + logger->SetLogVerbosityLevel("LOW"); + logger->SetLogScreenLevel("DEBUG"); + + // Setup timer + TStopwatch timer; + + TFile* fdig = TFile::Open("t0digits.root"); + std::cout << " Open digits file " << std::endl; + TTree* digTree = (TTree*)fdig->Get("o2sim"); + digTree->Print(); + std::vector * digits = new std::vector; + digTree->SetBranchAddress("T0Digit", &digits); + Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry + std::cout << "Found " << nevD << " events with digits " << std::endl; + + //std::vector recPoints; + std::vector* recPointsP = new std::vector; + + TFile outFile(outName.c_str(),"recreate"); + TTree outTree("o2sim", "T0RecPoints"); + outTree.Branch("T0Cluster", &recPointsP); + + o2::t0::CollisionTimeRecoTask recoFIT; + timer.Start(); + for (int iEv=0; iEvGetEntry(iEv); + recPointsP->resize(digits->size()); + for (size_t collID=0; collID < digits->size(); ++collID) + recoFIT.Process((*digits)[collID], (*recPointsP)[collID]); + outTree.Fill(); + } + + outTree.Print(); + outFile.ls(); + timer.Stop(); + outTree.Write(); + Double_t rtime = timer.RealTime(); + Double_t ctime = timer.CpuTime(); + + Float_t cpuUsage=ctime/rtime; + std::cout << ""; + std::cout << cpuUsage; + std::cout << "" << std::endl; + std::cout << "Macro finished succesfully." << std::endl; + + std::cout << "Real time " << rtime << " s, CPU time " << ctime + << "s" << std::endl << std::endl; + +} diff --git a/Detectors/FIT/V0/base/src/Geometry.cxx b/Detectors/FIT/V0/base/src/Geometry.cxx index 21953f10256a7..bd4ed1eb2471b 100644 --- a/Detectors/FIT/V0/base/src/Geometry.cxx +++ b/Detectors/FIT/V0/base/src/Geometry.cxx @@ -82,7 +82,7 @@ void Geometry::buildGeometry(){ } TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ - new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size()-1), sDySeparationScint*2, sDzScint+sEpsilon); + new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size() - 1), sDySeparationScint * 2, sDzScint + sEpsilon); std::stringstream ssName; ssName << "sector" << iSector+1; @@ -101,7 +101,7 @@ TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ TGeoCompositeShape* geoCell = new TGeoCompositeShape(ssNameGeoComposite.str().c_str(), booleanFormula.c_str()); TGeoMedium* kMed = gGeoManager->GetMedium("V0_Scintillator$"); - TGeoVolume *volCell = new TGeoVolume("V0cell", geoCell, kMed); + TGeoVolume* volCell = new TGeoVolume("V0cell", geoCell, kMed); volCell->SetLineColor(kYellow); sector->AddNode(volCell, iCell+1); diff --git a/Detectors/FIT/macros/readHitsDigits.C b/Detectors/FIT/macros/readHitsDigits.C index 8d1886387b0f1..eed16d9a87e94 100644 --- a/Detectors/FIT/macros/readHitsDigits.C +++ b/Detectors/FIT/macros/readHitsDigits.C @@ -1,87 +1,90 @@ -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include "FITSimulation/Detector.h" +#include "T0Simulation/Detector.h" #include "FITBase/Digit.h" #include -#endif - -void readHitsDigits() +void readHitsDigits() { using namespace o2::fit; // using namespace o2::fit::Digit; - + // Create histograms TDirectory* cwd = gDirectory; gDirectory = 0x0; + + TH2F *hMultHit = new TH2F("hMultHits","photons Hits ",210, 0, 210, 500, 0, 5000); + TH2F *hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12); + TH2F *hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8); + TH2F *hMultDig = new TH2F("hMultDig","photons Digits ",210, 0, 210, 500, 0, 20); + TH2F *hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1); - TH2F* hMultHit = new TH2F("hMultHits", "photons Hits ", 210, 0, 210, 500, 0, 5000); - TH2F* hTimeHit = new TH2F("hTimeAChit", "Time Hits", 210, 0, 210, 1000, 0, 15); - TH2F* hMultDig = new TH2F("hMultDig", "photons Digits ", 210, 0, 210, 500, 0, 20); - TH2F* hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 300, 0, 15); - - gDirectory = cwd; - - TFile* fhit = new TFile("o2sim.root"); - TTree* hitTree = (TTree*)fhit->Get("o2sim"); - std::vector* hitArray = nullptr; - hitTree->SetBranchAddress("FITHit", &hitArray); + gDirectory = cwd; + + TFile *fhit = new TFile("o2sim.root"); + TTree *hitTree = (TTree*)fhit->Get("o2sim"); + std::vector* hitArray = nullptr; + hitTree->SetBranchAddress("T0Hit", &hitArray); Int_t nevH = hitTree->GetEntries(); // hits are stored as one event per entry - std::cout << "Found " << nevH << " events with hits " << std::endl; - + // std::cout << "Found " << nevH << " events with hits " << std::endl; + Double_t hit_time[240]; Int_t countE[240]; - // Event ------------------------- LOOP - for (Int_t ievent = 0; ievent < nevH; ievent++) { + // Event ------------------------- LOOP + for (Int_t ievent=0; ieventGetEntry(ievent); - for (int ii = 0; ii < 240; ii++) { - countE[ii] = 0; - hit_time[ii] = 0; - } + for (int ii=0; ii<240; ii++) { countE[ii]=0;hit_time[ii]=0; } for (auto& hit : *hitArray) { Int_t detID = hit.GetDetectorID(); hit_time[detID] = hit.GetTime(); - hTimeHit->Fill(detID, hit_time[detID]); - if (hit_time[detID] < 10 && detID < 96) - std::cout << ievent << " " << detID << " time " << hit_time[detID] << endl; - - countE[detID]++; + hTimeHitA -> Fill(detID, hit_time[detID]); + hTimeHitC -> Fill(detID, hit_time[detID]); + countE[detID]++; } - for (int ii = 0; ii < 208; ii++) { - if (countE[ii] > 100) { - hMultHit->Fill(ii, countE[ii]); - // std::cout<100) { + hMultHit -> Fill(ii, countE[ii]); + // std::cout<Get("o2sim"); - o2::fit::Digit* digArr = new Digit; - digTree->SetBranchAddress("FITDigit", &digArr); + std::vector * digArr = new std::vector; + digTree->SetBranchAddress("T0Digit", &digArr); Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry std::cout << "Found " << nevD << " events with digits " << std::endl; - Float_t cfd[208], amp[208]; + Float_t cfd[208], amp[208], part[208]; for (Int_t iev = 0; iev < nevD; iev++) { digTree->GetEvent(iev); - for (int ii = 0; ii < 208; ii++) { - cfd[ii] = amp[ii] = 0; - } - for (const auto& d : digArr->getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime; - amp[mcp] = d.QTCAmpl; - // cout<Fill(Float_t(mcp), amp[mcp]); - hTimeDig->Fill(Float_t(mcp), cfd[mcp]); + for (const auto& digit : *digArr) { + for (int ii=0; ii<208; ii++) { cfd[ii]=amp[ii]=0; } + Double_t evtime = digit.getTime(); + for (const auto& d : digit.getChDgData()) { + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime - evtime - 12.5; + amp[mcp] = d.QTCAmpl; + part[mcp] = d.numberOfParticles; + cout<Fill(Float_t (mcp),amp[mcp]); + hTimeDig ->Fill(Float_t (mcp),cfd[mcp]); + } } - } - TFile* Hfile = new TFile("FigFit_dig_pp.root", "RECREATE"); + } + TFile *Hfile = new TFile("FigFit_hits_pp.root","RECREATE"); printf("Writting histograms to root file \n"); - Hfile->cd(); + Hfile->cd(); //Create a canvas, set the view range, show histograms // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); - hTimeHit->Write(); + hTimeHitA->Write(); + hTimeHitC->Write(); hMultHit->Write(); hTimeDig->Write(); hMultDig->Write(); + } // end of macro + + + + + From 0290ee58403964c721bd1fbce3b9259cb917c44c Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sun, 31 Mar 2019 13:12:09 +0200 Subject: [PATCH 22/25] explicit added --- Detectors/FIT/T0/macros/readHitsDigits.C | 91 ++++++++++--------- Detectors/FIT/T0/macros/run_reco_t0.C | 35 +++---- Detectors/FIT/V0/base/src/Geometry.cxx | 57 +++++++----- Detectors/FIT/V0/simulation/src/Detector.cxx | 84 +++++++++-------- Detectors/FIT/V0/simulation/src/Hit.cxx | 18 ++-- .../FITSimulation/DigitizationParameters.h | 1 - .../FIT/common/simulation/src/Digitizer.cxx | 1 - Detectors/FIT/macros/readHitsDigits.C | 91 ++++++++++--------- .../src/FITDigitizerSpec.cxx | 2 +- 9 files changed, 197 insertions(+), 183 deletions(-) diff --git a/Detectors/FIT/T0/macros/readHitsDigits.C b/Detectors/FIT/T0/macros/readHitsDigits.C index eed16d9a87e94..237ad7700a808 100644 --- a/Detectors/FIT/T0/macros/readHitsDigits.C +++ b/Detectors/FIT/T0/macros/readHitsDigits.C @@ -1,78 +1,86 @@ -#include "T0Simulation/Detector.h" +#if !defined(__CLING__) || defined(__ROOTCLING__) #include "FITBase/Digit.h" +#include "FITSimulation/HitType.h" #include -void readHitsDigits() +#include +#include +void readHitsDigits() { using namespace o2::fit; // using namespace o2::fit::Digit; - + // Create histograms TDirectory* cwd = gDirectory; gDirectory = 0x0; - - TH2F *hMultHit = new TH2F("hMultHits","photons Hits ",210, 0, 210, 500, 0, 5000); - TH2F *hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12); - TH2F *hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8); - TH2F *hMultDig = new TH2F("hMultDig","photons Digits ",210, 0, 210, 500, 0, 20); - TH2F *hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1); - gDirectory = cwd; - - TFile *fhit = new TFile("o2sim.root"); - TTree *hitTree = (TTree*)fhit->Get("o2sim"); + TH2F* hMultHit = new TH2F("hMultHits", "photons Hits ", 210, 0, 210, 500, 0, 5000); + TH2F* hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12); + TH2F* hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8); + TH2F* hMultDig = new TH2F("hMultDig", "photons Digits ", 210, 0, 210, 500, 0, 20); + TH2F* hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1); + + gDirectory = cwd; + + TFile* fhit = new TFile("o2sim.root"); + TTree* hitTree = (TTree*)fhit->Get("o2sim"); std::vector* hitArray = nullptr; hitTree->SetBranchAddress("T0Hit", &hitArray); Int_t nevH = hitTree->GetEntries(); // hits are stored as one event per entry // std::cout << "Found " << nevH << " events with hits " << std::endl; - + Double_t hit_time[240]; Int_t countE[240]; - // Event ------------------------- LOOP - for (Int_t ievent=0; ieventGetEntry(ievent); - for (int ii=0; ii<240; ii++) { countE[ii]=0;hit_time[ii]=0; } + for (int ii = 0; ii < 240; ii++) { + countE[ii] = 0; + hit_time[ii] = 0; + } for (auto& hit : *hitArray) { Int_t detID = hit.GetDetectorID(); hit_time[detID] = hit.GetTime(); - hTimeHitA -> Fill(detID, hit_time[detID]); - hTimeHitC -> Fill(detID, hit_time[detID]); - countE[detID]++; + hTimeHitA->Fill(detID, hit_time[detID]); + hTimeHitC->Fill(detID, hit_time[detID]); + countE[detID]++; } - for (int ii=0; ii<208; ii++) { - if (countE[ii]>100) { - hMultHit -> Fill(ii, countE[ii]); - // std::cout< 100) { + hMultHit->Fill(ii, countE[ii]); + // std::cout<Get("o2sim"); - std::vector * digArr = new std::vector; + std::vector* digArr = new std::vector; digTree->SetBranchAddress("T0Digit", &digArr); Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry - std::cout << "Found " << nevD << " events with digits " << std::endl; + // std::cout << "Found " << nevD << " events with digits " << std::endl; Float_t cfd[208], amp[208], part[208]; for (Int_t iev = 0; iev < nevD; iev++) { digTree->GetEvent(iev); for (const auto& digit : *digArr) { - for (int ii=0; ii<208; ii++) { cfd[ii]=amp[ii]=0; } + for (int ii = 0; ii < 208; ii++) { + cfd[ii] = amp[ii] = 0; + } Double_t evtime = digit.getTime(); for (const auto& d : digit.getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime - evtime - 12.5; - amp[mcp] = d.QTCAmpl; - part[mcp] = d.numberOfParticles; - cout<Fill(Float_t (mcp),amp[mcp]); - hTimeDig ->Fill(Float_t (mcp),cfd[mcp]); + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime - evtime - 12.5; + amp[mcp] = d.QTCAmpl; + part[mcp] = d.numberOfParticles; + // cout << iev << " " << mcp << " " << cfd[mcp] << " " << amp[mcp] << " " << part[mcp] << endl; + hMultDig->Fill(Float_t(mcp), amp[mcp]); + hTimeDig->Fill(Float_t(mcp), cfd[mcp]); } } - } - TFile *Hfile = new TFile("FigFit_hits_pp.root","RECREATE"); + } + TFile* Hfile = new TFile("FigFit_hits_pp.root", "RECREATE"); printf("Writting histograms to root file \n"); - Hfile->cd(); + Hfile->cd(); //Create a canvas, set the view range, show histograms // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); hTimeHitA->Write(); @@ -80,11 +88,6 @@ void readHitsDigits() hMultHit->Write(); hTimeDig->Write(); hMultDig->Write(); - } // end of macro - - - - - +#endif diff --git a/Detectors/FIT/T0/macros/run_reco_t0.C b/Detectors/FIT/T0/macros/run_reco_t0.C index 6895d41909cd1..0091998fdc53b 100644 --- a/Detectors/FIT/T0/macros/run_reco_t0.C +++ b/Detectors/FIT/T0/macros/run_reco_t0.C @@ -15,14 +15,15 @@ #endif void run_reco_t0(std::string inpudDig = "t0digits.root", - std::string outName = "o2reco_t0.root", - std::string inputGRP = "o2sim_grp.root") { + std::string outName = "o2reco_t0.root", + std::string inputGRP = "o2sim_grp.root") +{ // Initialize logger - FairLogger *logger = FairLogger::GetLogger(); + FairLogger* logger = FairLogger::GetLogger(); logger->SetLogVerbosityLevel("LOW"); logger->SetLogScreenLevel("DEBUG"); - + // Setup timer TStopwatch timer; @@ -30,42 +31,42 @@ void run_reco_t0(std::string inpudDig = "t0digits.root", std::cout << " Open digits file " << std::endl; TTree* digTree = (TTree*)fdig->Get("o2sim"); digTree->Print(); - std::vector * digits = new std::vector; + std::vector* digits = new std::vector; digTree->SetBranchAddress("T0Digit", &digits); Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry std::cout << "Found " << nevD << " events with digits " << std::endl; - + //std::vector recPoints; std::vector* recPointsP = new std::vector; - - TFile outFile(outName.c_str(),"recreate"); + + TFile outFile(outName.c_str(), "recreate"); TTree outTree("o2sim", "T0RecPoints"); outTree.Branch("T0Cluster", &recPointsP); - + o2::t0::CollisionTimeRecoTask recoFIT; timer.Start(); - for (int iEv=0; iEvGetEntry(iEv); recPointsP->resize(digits->size()); - for (size_t collID=0; collID < digits->size(); ++collID) + for (size_t collID = 0; collID < digits->size(); ++collID) recoFIT.Process((*digits)[collID], (*recPointsP)[collID]); outTree.Fill(); } - + outTree.Print(); outFile.ls(); timer.Stop(); outTree.Write(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); - - Float_t cpuUsage=ctime/rtime; + + Float_t cpuUsage = ctime / rtime; std::cout << ""; std::cout << cpuUsage; std::cout << "" << std::endl; std::cout << "Macro finished succesfully." << std::endl; - + std::cout << "Real time " << rtime << " s, CPU time " << ctime - << "s" << std::endl << std::endl; - + << "s" << std::endl + << std::endl; } diff --git a/Detectors/FIT/V0/base/src/Geometry.cxx b/Detectors/FIT/V0/base/src/Geometry.cxx index bd4ed1eb2471b..4573874d97cb7 100644 --- a/Detectors/FIT/V0/base/src/Geometry.cxx +++ b/Detectors/FIT/V0/base/src/Geometry.cxx @@ -25,18 +25,21 @@ ClassImp(o2::v0::Geometry); using namespace o2::v0; -Geometry::Geometry(EGeoType initType){ +Geometry::Geometry(EGeoType initType) +{ mGeometryType = initType; initializeVectors(); initializeLuts(); buildGeometry(); } -Geometry::Geometry(const Geometry& geom){ +Geometry::Geometry(const Geometry& geom) +{ this->mGeometryType = geom.mGeometryType; } -void Geometry::initializeVectors(){ +void Geometry::initializeVectors() +{ // RADII // Index of rAvgScint is NOT linked directly to any ring number mvrAvgScint.push_back(4.01); // ring 1 lower radius @@ -47,25 +50,26 @@ void Geometry::initializeVectors(){ mvrAvgScint.push_back(72.09); // Set real plastic radi (reduced by painting of 0.06 and separation gap of 0.08) - for(uint16_t ir=1; irRegisterYourself(); + mvPhiRot.at(mvPhiRot.size() - 1)->RegisterYourself(); } } -void Geometry::buildGeometry(){ +void Geometry::buildGeometry() +{ TGeoVolume* vALIC = gGeoManager->GetVolume("cave"); if (!vALIC) { LOG(FATAL) << "Could not find the top volume"; @@ -76,46 +80,49 @@ void Geometry::buildGeometry(){ LOG(INFO) << "Geometry::buildGeometry()::Volume name = " << volV0->GetName(); assembleSectors(volV0); - TGeoTranslation* trGlobalZshift = new TGeoTranslation(0,0,sZposition); + TGeoTranslation* trGlobalZshift = new TGeoTranslation(0, 0, sZposition); vALIC->AddNode(volV0, 0, trGlobalZshift); } -TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){ +TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector) +{ new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size() - 1), sDySeparationScint * 2, sDzScint + sEpsilon); std::stringstream ssName; - ssName << "sector" << iSector+1; - TGeoVolumeAssembly *sector = new TGeoVolumeAssembly(ssName.str().c_str()); - for(uint16_t ir=0; irGetMedium("V0_Scintillator$"); TGeoVolume* volCell = new TGeoVolume("V0cell", geoCell, kMed); volCell->SetLineColor(kYellow); - sector->AddNode(volCell, iCell+1); + sector->AddNode(volCell, iCell + 1); } return sector; } -void Geometry::assembleSectors(TGeoVolumeAssembly *volV0){ - for(uint16_t isector=0; isectorAddNode(sector, isector+1, mvPhiRot.at(isector)); +void Geometry::assembleSectors(TGeoVolumeAssembly* volV0) +{ + for (uint16_t isector = 0; isector < mvPhiRot.size(); isector++) { + TGeoVolumeAssembly* sector = buildSector(isector); + volV0->AddNode(sector, isector + 1, mvPhiRot.at(isector)); } } -void Geometry::initializeLuts(){ +void Geometry::initializeLuts() +{ // TODO: initialize sth } diff --git a/Detectors/FIT/V0/simulation/src/Detector.cxx b/Detectors/FIT/V0/simulation/src/Detector.cxx index 846180c2905ff..9edb4bb0e2cea 100644 --- a/Detectors/FIT/V0/simulation/src/Detector.cxx +++ b/Detectors/FIT/V0/simulation/src/Detector.cxx @@ -38,24 +38,27 @@ Detector::Detector() : o2::Base::DetImpl("V0", kTRUE), mHits(o2::utils::createSimVector()), mGeometry(nullptr), - mTrackData(){ + mTrackData() +{ // Empty } -Detector::~Detector() { +Detector::~Detector() +{ if (mHits) { o2::utils::freeSimVector(mHits); // delete mHits; } - if (mGeometry){ + if (mGeometry) { delete mGeometry; } } Detector::Detector(Bool_t isActive) - : o2::Base::DetImpl ("V0", isActive), + : o2::Base::DetImpl("V0", isActive), mHits(o2::utils::createSimVector()), mGeometry(nullptr), - mTrackData(){ + mTrackData() +{ // Empty } @@ -66,28 +69,28 @@ void Detector::InitializeO2Detector() TGeoVolume* volSensitive = gGeoManager->GetVolume("V0cell"); if (!volSensitive) { LOG(FATAL) << "Can't find FIT V0 sensitive volume: cell"; - } - else { + } else { AddSensitiveVolume(volSensitive); LOG(INFO) << "FIT-V0: Sensitive volume: " << volSensitive->GetName() << " " << volSensitive->GetNumber(); // TODO: Code from MFT -// if (!mftGeom->getSensorVolumeID()) { -// mftGeom->setSensorVolumeID(vol->GetNumber()); -// } -// else if (mftGeom->getSensorVolumeID() != vol->GetNumber()) { -// LOG(FATAL) << "CreateSensors: different Sensor volume ID !!!!"; -// } + // if (!mftGeom->getSensorVolumeID()) { + // mftGeom->setSensorVolumeID(vol->GetNumber()); + // } + // else if (mftGeom->getSensorVolumeID() != vol->GetNumber()) { + // LOG(FATAL) << "CreateSensors: different Sensor volume ID !!!!"; + // } } } // TODO: Check if it works and remove some fields if same in MFT base as in T0 -Bool_t Detector::ProcessHits(FairVolume* v){ +Bool_t Detector::ProcessHits(FairVolume* v) +{ // This method is called from the MC stepping // Track only charged particles and photons bool isPhotonTrack = false; Int_t particleId = fMC->TrackPid(); - if (particleId == 50000050){ // If particle is photon + if (particleId == 50000050) { // If particle is photon isPhotonTrack = true; } if (!(isPhotonTrack || fMC->TrackCharge())) { @@ -95,11 +98,11 @@ Bool_t Detector::ProcessHits(FairVolume* v){ } // TODO: Uncomment or change the approach after geometry is ready -// Geometry* v0Geo = Geometry::instance(); -// Int_t copy; + // Geometry* v0Geo = Geometry::instance(); + // Int_t copy; // Check if hit is into a FIT-V0 sensitive volume -// if (fMC->CurrentVolID(copy) != v0Geo->getSensorVolumeID()) -// return kFALSE; + // if (fMC->CurrentVolID(copy) != v0Geo->getSensorVolumeID()) + // return kFALSE; // Get unique ID of the cell Int_t cellId = -1; @@ -130,17 +133,18 @@ Bool_t Detector::ProcessHits(FairVolume* v){ float etot = fMC->Etot(); float eDep = fMC->Edep(); addHit(trackID, cellId, particleId, - mTrackData.mPositionStart.Vect(), positionStop.Vect(), - mTrackData.mMomentumStart.Vect(), mTrackData.mMomentumStart.E(), - positionStop.T(), mTrackData.mEnergyLoss, etot, eDep); + mTrackData.mPositionStart.Vect(), positionStop.Vect(), + mTrackData.mMomentumStart.Vect(), mTrackData.mMomentumStart.E(), + positionStop.T(), mTrackData.mEnergyLoss, etot, eDep); } return kTRUE; } o2::v0::Hit* Detector::addHit(Int_t trackId, Int_t cellId, Int_t particleId, - TVector3 startPos, TVector3 endPos, - TVector3 startMom, double startE, - double endTime, double eLoss, float eTot, float eDep){ + TVector3 startPos, TVector3 endPos, + TVector3 startMom, double startE, + double endTime, double eLoss, float eTot, float eDep) +{ mHits->emplace_back(trackId, cellId, startPos, endPos, startMom, startE, endTime, eLoss, eTot, eDep); auto stack = (o2::Data::Stack*)fMC->GetStack(); @@ -154,27 +158,29 @@ void Detector::createMaterials() LOG(INFO) << "FIT_V0: Creating materials"; // Air mixture const Int_t nAir = 4; - Float_t aAir[nAir] = { 12.0107, 14.0067, 15.9994, 39.948 }; - Float_t zAir[nAir] = { 6, 7, 8, 18 }; + Float_t aAir[nAir] = { 12.0107, 14.0067, 15.9994, 39.948 }; + Float_t zAir[nAir] = { 6, 7, 8, 18 }; Float_t wAir[nAir] = { 0.000124, 0.755267, 0.231781, 0.012827 }; Float_t dAir = 0.00120479; // Scintillator mixture; TODO: Looks very rough, improve these numbers? const Int_t nScint = 2; - Float_t aScint[nScint] = { 1, 12.01}; - Float_t zScint[nScint] = { 1, 6, }; - Float_t wScint[nScint] = { 0.016, 0.984}; + Float_t aScint[nScint] = { 1, 12.01 }; + Float_t zScint[nScint] = { + 1, + 6, + }; + Float_t wScint[nScint] = { 0.016, 0.984 }; Float_t dScint = 1.023; // Aluminum -// Float_t aAlu = 26.98; -// Float_t zAlu = 13.; -// Float_t dAlu = 2.70; // density [gr/cm^3] -// Float_t radAlu = 8.897; // rad len [cm] -// Float_t absAlu = 39.70; // abs len [cm] - + // Float_t aAlu = 26.98; + // Float_t zAlu = 13.; + // Float_t dAlu = 2.70; // density [gr/cm^3] + // Float_t radAlu = 8.897; // rad len [cm] + // Float_t absAlu = 39.70; // abs len [cm] - Int_t matId = 0; // tmp material id number + Int_t matId = 0; // tmp material id number const Int_t unsens = 0, sens = 1; // sensitive or unsensitive medium // TODO: After the simulation is running cross run for both sets of numbers and verify if they matter to us -> choose faster solution @@ -199,8 +205,8 @@ void Detector::createMaterials() o2::Base::Detector::Mixture(++matId, "Scintillator$", aScint, zScint, dScint, nScint, wScint); o2::Base::Detector::Medium(Scintillator, "Scintillator$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); -// o2::Base::Detector::Material(++matId, "Alu$", aAlu, zAlu, dAlu, radAlu, absAlu); -// o2::Base::Detector::Medium(Alu, "Alu$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); + // o2::Base::Detector::Material(++matId, "Alu$", aAlu, zAlu, dAlu, radAlu, absAlu); + // o2::Base::Detector::Medium(Alu, "Alu$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin); LOG(DEBUG) << "Detector::createMaterials -----> matId = " << matId; } diff --git a/Detectors/FIT/V0/simulation/src/Hit.cxx b/Detectors/FIT/V0/simulation/src/Hit.cxx index 2de4203ef2e62..6c5a4f14ccafb 100644 --- a/Detectors/FIT/V0/simulation/src/Hit.cxx +++ b/Detectors/FIT/V0/simulation/src/Hit.cxx @@ -17,20 +17,16 @@ ClassImp(o2::v0::Hit) -using std::cout; + using std::cout; using std::endl; using namespace o2::v0; using namespace o2; //::Base; -void Hit::Print(const Option_t *opt) const +void Hit::Print(const Option_t* opt) const { - printf("Det: %5d Track: %6d E.loss: %.3e P: %+.3e %+.3e %+.3e\n" - "PosIn: %+.3e %+.3e %+.3e PosOut: %+.3e %+.3e %+.3e\n", - GetDetectorID(),GetTrackID(),GetEnergyLoss(),GetPx(),GetPy(),GetPz(), - GetStartX(),GetStartY(),GetStartZ(),GetX(),GetY(),GetZ() ); + printf( + "Det: %5d Track: %6d E.loss: %.3e P: %+.3e %+.3e %+.3e\n" + "PosIn: %+.3e %+.3e %+.3e PosOut: %+.3e %+.3e %+.3e\n", + GetDetectorID(), GetTrackID(), GetEnergyLoss(), GetPx(), GetPy(), GetPz(), + GetStartX(), GetStartY(), GetStartZ(), GetX(), GetY(), GetZ()); } - - - - - diff --git a/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h index be8943f734c5d..6c10e0fc74821 100644 --- a/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h +++ b/Detectors/FIT/common/simulation/include/FITSimulation/DigitizationParameters.h @@ -17,7 +17,6 @@ struct DigitizationParameters { Int_t mAmpThreshold; // number of photoelectrons Float_t mTimeDiffAC; bool mIsT0; //amplitude T0(true) or V0 (false) - }; } // namespace o2::fit #endif diff --git a/Detectors/FIT/common/simulation/src/Digitizer.cxx b/Detectors/FIT/common/simulation/src/Digitizer.cxx index a6e44584d66fe..bf067050b01bd 100644 --- a/Detectors/FIT/common/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/common/simulation/src/Digitizer.cxx @@ -87,7 +87,6 @@ void Digitizer::computeAverage(Digit& digit) ch_data.CFDTime /= ch_data.numberOfParticles; if (parameters.mIsT0) ch_data.QTCAmpl = ch_data.numberOfParticles / nPe_in_mip; - } channel_data.erase(std::remove_if(channel_data.begin(), channel_data.end(), [this](ChannelData const& ch_data) { diff --git a/Detectors/FIT/macros/readHitsDigits.C b/Detectors/FIT/macros/readHitsDigits.C index eed16d9a87e94..237ad7700a808 100644 --- a/Detectors/FIT/macros/readHitsDigits.C +++ b/Detectors/FIT/macros/readHitsDigits.C @@ -1,78 +1,86 @@ -#include "T0Simulation/Detector.h" +#if !defined(__CLING__) || defined(__ROOTCLING__) #include "FITBase/Digit.h" +#include "FITSimulation/HitType.h" #include -void readHitsDigits() +#include +#include +void readHitsDigits() { using namespace o2::fit; // using namespace o2::fit::Digit; - + // Create histograms TDirectory* cwd = gDirectory; gDirectory = 0x0; - - TH2F *hMultHit = new TH2F("hMultHits","photons Hits ",210, 0, 210, 500, 0, 5000); - TH2F *hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12); - TH2F *hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8); - TH2F *hMultDig = new TH2F("hMultDig","photons Digits ",210, 0, 210, 500, 0, 20); - TH2F *hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1); - gDirectory = cwd; - - TFile *fhit = new TFile("o2sim.root"); - TTree *hitTree = (TTree*)fhit->Get("o2sim"); + TH2F* hMultHit = new TH2F("hMultHits", "photons Hits ", 210, 0, 210, 500, 0, 5000); + TH2F* hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12); + TH2F* hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8); + TH2F* hMultDig = new TH2F("hMultDig", "photons Digits ", 210, 0, 210, 500, 0, 20); + TH2F* hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1); + + gDirectory = cwd; + + TFile* fhit = new TFile("o2sim.root"); + TTree* hitTree = (TTree*)fhit->Get("o2sim"); std::vector* hitArray = nullptr; hitTree->SetBranchAddress("T0Hit", &hitArray); Int_t nevH = hitTree->GetEntries(); // hits are stored as one event per entry // std::cout << "Found " << nevH << " events with hits " << std::endl; - + Double_t hit_time[240]; Int_t countE[240]; - // Event ------------------------- LOOP - for (Int_t ievent=0; ieventGetEntry(ievent); - for (int ii=0; ii<240; ii++) { countE[ii]=0;hit_time[ii]=0; } + for (int ii = 0; ii < 240; ii++) { + countE[ii] = 0; + hit_time[ii] = 0; + } for (auto& hit : *hitArray) { Int_t detID = hit.GetDetectorID(); hit_time[detID] = hit.GetTime(); - hTimeHitA -> Fill(detID, hit_time[detID]); - hTimeHitC -> Fill(detID, hit_time[detID]); - countE[detID]++; + hTimeHitA->Fill(detID, hit_time[detID]); + hTimeHitC->Fill(detID, hit_time[detID]); + countE[detID]++; } - for (int ii=0; ii<208; ii++) { - if (countE[ii]>100) { - hMultHit -> Fill(ii, countE[ii]); - // std::cout< 100) { + hMultHit->Fill(ii, countE[ii]); + // std::cout<Get("o2sim"); - std::vector * digArr = new std::vector; + std::vector* digArr = new std::vector; digTree->SetBranchAddress("T0Digit", &digArr); Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry - std::cout << "Found " << nevD << " events with digits " << std::endl; + // std::cout << "Found " << nevD << " events with digits " << std::endl; Float_t cfd[208], amp[208], part[208]; for (Int_t iev = 0; iev < nevD; iev++) { digTree->GetEvent(iev); for (const auto& digit : *digArr) { - for (int ii=0; ii<208; ii++) { cfd[ii]=amp[ii]=0; } + for (int ii = 0; ii < 208; ii++) { + cfd[ii] = amp[ii] = 0; + } Double_t evtime = digit.getTime(); for (const auto& d : digit.getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime - evtime - 12.5; - amp[mcp] = d.QTCAmpl; - part[mcp] = d.numberOfParticles; - cout<Fill(Float_t (mcp),amp[mcp]); - hTimeDig ->Fill(Float_t (mcp),cfd[mcp]); + Int_t mcp = d.ChId; + cfd[mcp] = d.CFDTime - evtime - 12.5; + amp[mcp] = d.QTCAmpl; + part[mcp] = d.numberOfParticles; + // cout << iev << " " << mcp << " " << cfd[mcp] << " " << amp[mcp] << " " << part[mcp] << endl; + hMultDig->Fill(Float_t(mcp), amp[mcp]); + hTimeDig->Fill(Float_t(mcp), cfd[mcp]); } } - } - TFile *Hfile = new TFile("FigFit_hits_pp.root","RECREATE"); + } + TFile* Hfile = new TFile("FigFit_hits_pp.root", "RECREATE"); printf("Writting histograms to root file \n"); - Hfile->cd(); + Hfile->cd(); //Create a canvas, set the view range, show histograms // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); hTimeHitA->Write(); @@ -80,11 +88,6 @@ void readHitsDigits() hMultHit->Write(); hTimeDig->Write(); hMultDig->Write(); - } // end of macro - - - - - +#endif diff --git a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx index a5bed772c7c4c..8faeeb062ddfa 100644 --- a/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FITDigitizerSpec.cxx @@ -40,7 +40,7 @@ class FITDPLDigitizerTask { public: - FITDPLDigitizerTask(o2::fit::DigitizationParameters const& parameters) + explicit FITDPLDigitizerTask(o2::fit::DigitizationParameters const& parameters) : mDigitizer(parameters) {} ~FITDPLDigitizerTask() = default; From ab36798fd3c0d8d28886fa7920b44ee9d2550e6a Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sun, 31 Mar 2019 14:36:45 +0200 Subject: [PATCH 23/25] remove empty line in HitMerger.h: clang complains --- run/O2HitMerger.h | 1 - 1 file changed, 1 deletion(-) diff --git a/run/O2HitMerger.h b/run/O2HitMerger.h index b1940cbf57b14..9943de77f3cd8 100644 --- a/run/O2HitMerger.h +++ b/run/O2HitMerger.h @@ -475,7 +475,6 @@ void O2HitMerger::initDetInstances() mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; } - if (i == DetID::MCH) { mDetectorInstances[i] = std::move(std::make_unique(true)); counter++; From 1ead4421965abcc937517bec928ffb96ee0f8026 Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sun, 31 Mar 2019 21:12:22 +0200 Subject: [PATCH 24/25] remove unused macros --- Detectors/FIT/T0/macros/readRecPoints.C | 58 -------------- Detectors/FIT/T0/macros/run_digi_fit.C | 96 ------------------------ Detectors/FIT/T0/macros/test/run_test.sh | 5 -- 3 files changed, 159 deletions(-) delete mode 100644 Detectors/FIT/T0/macros/readRecPoints.C delete mode 100644 Detectors/FIT/T0/macros/run_digi_fit.C delete mode 100755 Detectors/FIT/T0/macros/test/run_test.sh diff --git a/Detectors/FIT/T0/macros/readRecPoints.C b/Detectors/FIT/T0/macros/readRecPoints.C deleted file mode 100644 index 941d2a241fd60..0000000000000 --- a/Detectors/FIT/T0/macros/readRecPoints.C +++ /dev/null @@ -1,58 +0,0 @@ -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include "FITSimulation/Detector.h" -#include "FITBase/Digit.h" -#include "FITReconstruction/RecPoints.h" -#include -#endif -void readRecPoints() -{ - using namespace o2::fit; - // using namespace o2::fit::Digit; - - // Create histograms - TDirectory* cwd = gDirectory; - gDirectory = 0x0; - - TH2F* hMultRec = new TH2F("hMultRec", "photons Recits ", 210, 0, 210, 500, 0, 1000); - TH2F* hTimeRec = new TH2F("hTimeRec", "Time Recits", 210, 0, 210, 1000, 1, 13); - TH1F* ht0AC = new TH1F("hT0AC", "T0AC", 100, -1, 1); - - gDirectory = cwd; - - TFile* frec = TFile::Open("o2reco_fit.root"); - std::cout << " Open rec file " << std::endl; - TTree* recTree = (TTree*)frec->Get("o2sim"); - o2::fit::RecPoints* recArr = new RecPoints; - recTree->SetBranchAddress("FITRecPoints", &recArr); - Int_t nevD = recTree->GetEntries(); // recits in cont. readout may be grouped as few events per entry - std::cout << "Found " << nevD << " events with recits " << std::endl; - Float_t cfd[208], amp[208]; - for (Int_t iev = 0; iev < nevD; iev++) { - recTree->GetEvent(iev); - - Float_t t0AC = recArr->GetCollisionTime(0); - Float_t eventtime = recArr->GetTimeFromDigit(); - ht0AC->Fill(t0AC - eventtime); - std::cout << iev << " AC " << recArr->GetCollisionTime(0) << " " << eventtime << std::endl; - for (int ii = 0; ii < 208; ii++) { - cfd[ii] = amp[ii] = 0; - } - for (const auto& d : recArr->getChDgData()) { - Int_t mcp = d.ChId; - cfd[mcp] = d.CFDTime; - amp[mcp] = d.QTCAmpl; - // cout<Fill(Float_t(mcp), amp[mcp]); - hTimeRec->Fill(Float_t(mcp), cfd[mcp]); - } - } - TFile* Hfile = new TFile("FigFit_rec_pp.root", "RECREATE"); - printf("Writting histograms to root file \n"); - Hfile->cd(); - //Create a canvas, set the view range, show histograms - // TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600); - hTimeRec->Write(); - hMultRec->Write(); - ht0AC->Write(); - -} // end of macro diff --git a/Detectors/FIT/T0/macros/run_digi_fit.C b/Detectors/FIT/T0/macros/run_digi_fit.C deleted file mode 100644 index 8c9f513087903..0000000000000 --- a/Detectors/FIT/T0/macros/run_digi_fit.C +++ /dev/null @@ -1,96 +0,0 @@ -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include - -#include - -#include "FairLogger.h" -#include "FairRunAna.h" -#include "FairFileSource.h" -#include "FairRuntimeDb.h" -#include "FairParRootFileIo.h" -#include "FairSystemInfo.h" - -#include "FITSimulation/DigitizerTask.h" -#endif - -void run_digi_fit(Int_t nEvents = 10, Float_t rate = 50.e3) -{ - // if rate>0 then continuous simulation for this rate will be performed - - // Initialize logger - FairLogger* logger = FairLogger::GetLogger(); - logger->SetLogVerbosityLevel("LOW"); - logger->SetLogScreenLevel("DEBUG"); - - // Input and output file name - std::stringstream inputfile, outputfile, paramfile; - inputfile << "o2sim.root"; - paramfile << "o2sim_par.root"; - outputfile << "o2sim_digi.root"; - - // Setup timer - TStopwatch timer; - - // Setup FairRoot analysis manager - FairRunAna* fRun = new FairRunAna(); - FairFileSource* fFileSource = new FairFileSource(inputfile.str().c_str()); - fRun->SetSource(fFileSource); - std::cout << "@@@@ input " << inputfile.str().c_str() << std::endl; - fRun->SetOutputFile(outputfile.str().c_str()); - std::cout << "@@@@ output " << outputfile.str().c_str() << std::endl; - - if (rate > 0) { - fFileSource->SetEventMeanTime(1.e9 / rate); // is in us - } - - // Setup Runtime DB - - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - std::cout << "@@@@ param " << paramfile.str().c_str() << std::endl; - FairParRootFileIo* parInput1 = new FairParRootFileIo(); - parInput1->open(paramfile.str().c_str()); - rtdb->setFirstInput(parInput1); - - // Setup digitizer - o2::fit::DigitizerTask* digi = new o2::fit::DigitizerTask(); - // digi->setContinuous(rate > 0); - // digi->setFairTimeUnitInNS(1.0); // tell in which units (wrt nanosecond) FAIT timestamps are - fRun->AddTask(digi); - - std::cout << "@@@@ Add task " << std::endl; - fRun->Init(); - std::cout << "@@@@ Run Init " << std::endl; - - timer.Start(); - fRun->Run(); - - std::cout << std::endl - << std::endl; - - // 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 << ""; - std::cout << maxMemory; - std::cout << "" << std::endl; - - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - - Float_t cpuUsage = ctime / rtime; - cout << ""; - cout << cpuUsage; - cout << "" << endl; - cout << endl - << endl; - std::cout << "Macro finished succesfully" << std::endl; - - std::cout << endl - << std::endl; - std::cout << "Output file is " << outputfile.str() << std::endl; - // std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl - << endl; -} diff --git a/Detectors/FIT/T0/macros/test/run_test.sh b/Detectors/FIT/T0/macros/test/run_test.sh deleted file mode 100755 index 9e1f69e98dc2c..0000000000000 --- a/Detectors/FIT/T0/macros/test/run_test.sh +++ /dev/null @@ -1,5 +0,0 @@ -# -nEvents=10 -mcEngine=\"TGeant3\" -# -# will be fill later From 939e2a20e23728d9b2fd607e694f98416bab742c Mon Sep 17 00:00:00 2001 From: Alla Maevskaya Date: Sun, 31 Mar 2019 22:23:40 +0200 Subject: [PATCH 25/25] fix T0 part --- macro/analyzeHits.C | 11 ++--- macro/run_digi_fit.C | 99 -------------------------------------------- 2 files changed, 6 insertions(+), 104 deletions(-) delete mode 100644 macro/run_digi_fit.C diff --git a/macro/analyzeHits.C b/macro/analyzeHits.C index 417888f5369c4..7354f864c829b 100644 --- a/macro/analyzeHits.C +++ b/macro/analyzeHits.C @@ -6,7 +6,8 @@ #include "TOFSimulation/Detector.h" #include "EMCALBase/Hit.h" #include "TRDSimulation/Detector.h" // For TRD Hit -#include "FITSimulation/Detector.h" // for Fit Hit +#include "T0Simulation/Detector.h" // for Fit Hit +#include "V0Simulation/Hit.h" #include "HMPIDBase/Hit.h" #include "TPCSimulation/Point.h" #include "PHOSBase/Hit.h" @@ -219,10 +220,10 @@ void analyzePHS(TTree* reftree) refresult.print(); } -void analyzeFIT(TTree* reftree) +void analyzeT0(TTree* reftree) { - auto refresult = analyse>(reftree, "FITHit"); - std::cout << gPrefix << " FIT "; + auto refresult = analyse>(reftree, "T0Hit"); + std::cout << gPrefix << " T0 "; refresult.print(); } @@ -268,6 +269,6 @@ void analyzeHits(const char* filename = "o2sim.root", const char* prefix = "") analyzeEMC(reftree); analyzeTRD(reftree); analyzePHS(reftree); - analyzeFIT(reftree); + analyzeT0(reftree); analyzeHMP(reftree); } diff --git a/macro/run_digi_fit.C b/macro/run_digi_fit.C deleted file mode 100644 index 4a7f070cf7467..0000000000000 --- a/macro/run_digi_fit.C +++ /dev/null @@ -1,99 +0,0 @@ -#if !defined(__CLING__) || defined(__ROOTCLING__) -#include - -#include - -#include "FairLogger.h" -#include "FairRunAna.h" -#include "FairFileSource.h" -#include "FairRuntimeDb.h" -#include "FairParRootFileIo.h" -#include "FairSystemInfo.h" - -#include "FITSimulation/DigitizerTask.h" -#endif - -void run_digi_fit(Int_t nEvents = 10, Float_t rate = 50.e3) -{ - // if rate>0 then continuous simulation for this rate will be performed - - // Initialize logger - FairLogger* logger = FairLogger::GetLogger(); - logger->SetLogVerbosityLevel("LOW"); - logger->SetLogScreenLevel("DEBUG"); - - // Input and output file name - std::stringstream inputfile, outputfile, paramfile; - // inputfile << "AliceO2_" << mcEngine << ".mc_" << nEvents << "_event.root"; - // paramfile << "AliceO2_" << mcEngine << ".params_" << nEvents << ".root"; - // outputfile << "AliceO2_" << mcEngine << ".digi_" << nEvents << "_event.root"; - inputfile << "o2sim.root"; - paramfile << "o2sim_par.root"; - outputfile << "o2sim_digi.root"; - - // Setup timer - TStopwatch timer; - - // Setup FairRoot analysis manager - FairRunAna* fRun = new FairRunAna(); - FairFileSource* fFileSource = new FairFileSource(inputfile.str().c_str()); - fRun->SetSource(fFileSource); - std::cout << "@@@@ input " << inputfile.str().c_str() << std::endl; - fRun->SetOutputFile(outputfile.str().c_str()); - std::cout << "@@@@ output " << outputfile.str().c_str() << std::endl; - /* - if (rate > 0) { - fFileSource->SetEventMeanTime(1.e9 / rate); // is in us - } - */ - // Setup Runtime DB - - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - std::cout << "@@@@ param " << paramfile.str().c_str() << std::endl; - FairParRootFileIo* parInput1 = new FairParRootFileIo(); - parInput1->open(paramfile.str().c_str()); - rtdb->setFirstInput(parInput1); - - // Setup digitizer - o2::fit::DigitizerTask* digi = new o2::fit::DigitizerTask(); - // digi->setContinuous(rate > 0); - // digi->setFairTimeUnitInNS(1.0); // tell in which units (wrt nanosecond) FAIT timestamps are - fRun->AddTask(digi); - - std::cout << "@@@@ Add task " << std::endl; - fRun->Init(); - std::cout << "@@@@ Run Init " << std::endl; - - timer.Start(); - fRun->Run(); - - std::cout << std::endl - << std::endl; - - // 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 << ""; - std::cout << maxMemory; - std::cout << "" << std::endl; - - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - - Float_t cpuUsage = ctime / rtime; - cout << ""; - cout << cpuUsage; - cout << "" << endl; - cout << endl - << endl; - std::cout << "Macro finished succesfully" << std::endl; - - std::cout << endl - << std::endl; - std::cout << "Output file is " << outputfile.str() << std::endl; - // std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl - << endl; -}