1616// / \author Nicolò Jacazio <nicolo.jacazio@cern.ch>, Universita del Piemonte Orientale (IT)
1717// /
1818
19- #include " ALICE3/Core/FlatTrackSmearer.h"
20- #include " ALICE3/Core/FlatLutEntry.h"
2119#include " ALICE3/Core/FastTracker.h"
20+ #include " ALICE3/Core/FlatLutEntry.h"
21+ #include " ALICE3/Core/FlatTrackSmearer.h"
2222#include " ALICE3/Core/TrackUtilities.h"
2323#include " ALICE3/DataModel/OTFLUT.h"
24- #include < Framework/O2DatabasePDGPlugin.h>
25- #include < TPDGCode.h>
2624
2725#include < CCDB/BasicCCDBManager.h>
2826#include < Framework/AnalysisTask.h>
2927#include < Framework/HistogramRegistry.h>
28+ #include < Framework/O2DatabasePDGPlugin.h>
3029#include < Framework/runDataProcessing.h>
3130
31+ #include < TPDGCode.h>
32+
3233#include < map>
3334#include < string>
3435#include < vector>
3536
3637struct TestCcdbConsumer0 {
3738 o2::framework::HistogramRegistry histos{" Histos" , {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject};
3839 o2::framework::ConfigurableAxis axisDeltaPt{" axisDeltaPt" , {200 , -0 .2f , +0 .2f }, " #Delta p_{T}" };
40+ o2::framework::ConfigurableAxis axisPt{" axisPt" , {o2::framework::VARIABLE_WIDTH , 0 .0f , 0 .1f , 0 .2f , 0 .3f , 0 .4f , 0 .5f , 0 .6f , 0 .7f , 0 .8f , 0 .9f , 1 .0f , 1 .1f , 1 .2f , 1 .3f , 1 .4f , 1 .5f , 1 .6f , 1 .7f , 1 .8f , 1 .9f , 2 .0f , 2 .2f , 2 .4f , 2 .6f , 2 .8f , 3 .0f , 3 .2f , 3 .4f , 3 .6f , 3 .8f , 4 .0f , 4 .4f , 4 .8f , 5 .2f , 5 .6f , 6 .0f , 6 .5f , 7 .0f , 7 .5f , 8 .0f , 9 .0f , 10 .0f , 11 .0f , 12 .0f , 13 .0f , 14 .0f , 15 .0f , 17 .0f , 19 .0f , 21 .0f , 23 .0f , 25 .0f , 30 .0f , 35 .0f , 40 .0f , 50 .0f }, " #it{p} (GeV/#it{c})" };
3941
4042 o2::framework::Service<o2::framework::O2DatabasePDG> pdgDB;
4143 const std::unordered_set<int > pdgsToBeHandled = {PDG_t::kElectron , PDG_t::kMuonMinus , PDG_t::kPiPlus , PDG_t::kKPlus , PDG_t::kProton };
44+ // const std::unordered_set<int> pdgsToBeHandled = {PDG_t::kMuonMinus};
4245
4346 void init (o2::framework::InitContext&)
4447 {
45- histos.add (" hDeltaPtEl" , " hDeltaPtEl" , o2::framework::kTH1D , {axisDeltaPt});
46- histos.add (" hDeltaPtMu" , " hDeltaPtMu" , o2::framework::kTH1D , {axisDeltaPt});
47- histos.add (" hDeltaPtPi" , " hDeltaPtPi" , o2::framework::kTH1D , {axisDeltaPt});
48- histos.add (" hDeltaPtKa" , " hDeltaPtKa" , o2::framework::kTH1D , {axisDeltaPt});
49- histos.add (" hDeltaPtPr" , " hDeltaPtPr" , o2::framework::kTH1D , {axisDeltaPt});
48+ histos.add (" flat/hDeltaPtEl" , " hDeltaPtEl" , o2::framework::kTH1D , {axisDeltaPt});
49+ histos.add (" flat/hDeltaPtMu" , " hDeltaPtMu" , o2::framework::kTH1D , {axisDeltaPt});
50+ histos.add (" flat/hDeltaPtPi" , " hDeltaPtPi" , o2::framework::kTH1D , {axisDeltaPt});
51+ histos.add (" flat/hDeltaPtKa" , " hDeltaPtKa" , o2::framework::kTH1D , {axisDeltaPt});
52+ histos.add (" flat/hDeltaPtPr" , " hDeltaPtPr" , o2::framework::kTH1D , {axisDeltaPt});
53+ histos.add (" flat/h2dDeltaPtEl" , " h2dhDeltaPtEl" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
54+ histos.add (" flat/h2dDeltaPtMu" , " h2dhDeltaPtMu" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
55+ histos.add (" flat/h2dDeltaPtPi" , " h2dhDeltaPtPi" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
56+ histos.add (" flat/h2dDeltaPtKa" , " h2dhDeltaPtKa" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
57+ histos.add (" flat/h2dDeltaPtPr" , " h2dhDeltaPtPr" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
58+ histos.add (" full/hDeltaPtEl" , " hDeltaPtEl" , o2::framework::kTH1D , {axisDeltaPt});
59+ histos.add (" full/hDeltaPtMu" , " hDeltaPtMu" , o2::framework::kTH1D , {axisDeltaPt});
60+ histos.add (" full/hDeltaPtPi" , " hDeltaPtPi" , o2::framework::kTH1D , {axisDeltaPt});
61+ histos.add (" full/hDeltaPtKa" , " hDeltaPtKa" , o2::framework::kTH1D , {axisDeltaPt});
62+ histos.add (" full/hDeltaPtPr" , " hDeltaPtPr" , o2::framework::kTH1D , {axisDeltaPt});
63+ histos.add (" full/h2dDeltaPtEl" , " h2dhDeltaPtEl" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
64+ histos.add (" full/h2dDeltaPtMu" , " h2dhDeltaPtMu" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
65+ histos.add (" full/h2dDeltaPtPi" , " h2dhDeltaPtPi" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
66+ histos.add (" full/h2dDeltaPtKa" , " h2dhDeltaPtKa" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
67+ histos.add (" full/h2dDeltaPtPr" , " h2dhDeltaPtPr" , o2::framework::kTH2D , {axisPt, axisDeltaPt});
68+ auto hFlatBookkeeping = histos.add <TH1 >(" flat/hBookkeeping" , " hBookkeeping" , o2::framework::kTH1D , {{2 , 0 .5f , 2 .5f }});
69+ hFlatBookkeeping->GetXaxis ()->SetBinLabel (1 , " Entry found" );
70+ hFlatBookkeeping->GetXaxis ()->SetBinLabel (2 , " Entry not found" );
71+ auto hFullBookkeeping = histos.add <TH1 >(" full/hBookkeeping" , " hBookkeeping" , o2::framework::kTH1D , {{2 , 0 .5f , 2 .5f }});
72+ hFullBookkeeping->GetXaxis ()->SetBinLabel (1 , " Entry found" );
73+ hFullBookkeeping->GetXaxis ()->SetBinLabel (2 , " Entry not found" );
5074 LOG (info) << " Initialization completed" ;
5175 }
5276
5377 void process (o2::aod::McCollisions const & mcCollisions, o2::aod::McParticles const & mcParticles, o2::aod::A3LookUpTables const & luts)
5478 {
79+ o2::delphes::TrackSmearer flatSmearer, fullSmearer;
80+ const auto thisTable = luts.begin ();
81+ flatSmearer.viewTable (PDG_t::kElectron , thisTable.lutEl ());
82+ flatSmearer.viewTable (PDG_t::kMuonMinus , thisTable.lutMu ());
83+ flatSmearer.viewTable (PDG_t::kPiPlus , thisTable.lutPi ());
84+ flatSmearer.viewTable (PDG_t::kKPlus , thisTable.lutKa ());
85+ flatSmearer.viewTable (PDG_t::kProton , thisTable.lutPr ());
86+
87+ std::ifstream fileEl (" lutCovm.el.20kG.rmin20.geometry_Petal.dat" , std::ios::binary);
88+ std::ifstream fileMu (" lutCovm.mu.20kG.rmin20.geometry_Petal.dat" , std::ios::binary);
89+ std::ifstream filePi (" lutCovm.pi.20kG.rmin20.geometry_Petal.dat" , std::ios::binary);
90+ std::ifstream fileKa (" lutCovm.ka.20kG.rmin20.geometry_Petal.dat" , std::ios::binary);
91+ std::ifstream filePr (" lutCovm.pr.20kG.rmin20.geometry_Petal.dat" , std::ios::binary);
92+
93+ o2::delphes::FlatLutData lutDataEl = o2::delphes::FlatLutData::loadFromFile (fileEl, " lutCovm.el.20kG.rmin20.geometry_Petal.dat" );
94+ auto lutDataElHeader = lutDataEl.getHeader ();
95+ lutDataEl.initialize (lutDataElHeader);
96+ o2::delphes::FlatLutData lutDataMu = o2::delphes::FlatLutData::loadFromFile (fileMu, " lutCovm.mu.20kG.rmin20.geometry_Petal.dat" );
97+ auto lutDataMuHeader = lutDataMu.getHeader ();
98+ lutDataMu.initialize (lutDataMuHeader);
99+ o2::delphes::FlatLutData lutDataPi = o2::delphes::FlatLutData::loadFromFile (filePi, " lutCovm.pi.20kG.rmin20.geometry_Petal.dat" );
100+ auto lutDataPiHeader = lutDataPi.getHeader ();
101+ lutDataPi.initialize (lutDataPiHeader);
102+ o2::delphes::FlatLutData lutDataKa = o2::delphes::FlatLutData::loadFromFile (fileKa, " lutCovm.ka.20kG.rmin20.geometry_Petal.dat" );
103+ auto lutDataKaHeader = lutDataKa.getHeader ();
104+ lutDataKa.initialize (lutDataKaHeader);
105+ o2::delphes::FlatLutData lutDataPr = o2::delphes::FlatLutData::loadFromFile (filePr, " lutCovm.pr.20kG.rmin20.geometry_Petal.dat" );
106+ auto lutDataPrHeader = lutDataPr.getHeader ();
107+ lutDataPr.initialize (lutDataPrHeader);
108+
55109 for (const auto & _ : mcCollisions) {
56- o2::delphes::TrackSmearer smearer;
57- const auto thisTable = luts.begin ();
58- // smearer.viewTable(static_cast<int>(PDG_t::kElectron), thisTable.lutEl());
59- // smearer.viewTable(static_cast<int>(PDG_t::kMuonMinus), thisTable.lutMu());
60- // smearer.viewTable(static_cast<int>(PDG_t::kPiPlus), thisTable.lutPi());
61- // smearer.viewTable(static_cast<int>(PDG_t::kKPlus), thisTable.lutKa());
62- // smearer.viewTable(static_cast<int>(PDG_t::kProton), thisTable.lutPr());
63- // for (const auto& mcParticle : mcParticles) {
64- // if (!pdgsToBeHandled.count(std::abs(mcParticle.pdgCode()))) {
65- // continue;
66- // }
67-
68- // o2::track::TrackParCov trackParCov = o2::upgrade::convertMCParticleToO2Track(mcParticle, pdgDB);
69- // smearer.smearTrack(trackParCov, std::abs(mcParticle.pdgCode()), mcParticles.size());
70-
71- // switch (std::abs(mcParticle.pdgCode())) {
72- // case PDG_t::kElectron:
73- // histos.fill(HIST("hDeltaPtEl"), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt());
74- // break;
75- // case PDG_t::kMuonMinus:
76- // histos.fill(HIST("hDeltaPtMu"), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt());
77- // break;
78- // case PDG_t::kPiPlus:
79- // histos.fill(HIST("hDeltaPtPi"), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt());
80- // break;
81- // case PDG_t::kKPlus:
82- // histos.fill(HIST("hDeltaPtKa"), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt());
83- // break;
84- // case PDG_t::kProton:
85- // histos.fill(HIST("hDeltaPtPr"), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt());
86- // break;
87- // default:
88- // break;
89- // }
90- // }
110+ for (const auto & mcParticle : mcParticles) {
111+ if (!pdgsToBeHandled.count (std::abs (mcParticle.pdgCode ()))) {
112+ continue ;
113+ }
114+
115+ if (std::abs (mcParticle.eta ()) > 1 .) {
116+ continue ;
117+ }
118+
119+ o2::track::TrackParCov flatTrack = o2::upgrade::convertMCParticleToO2Track (mcParticle, pdgDB);
120+ bool success = flatSmearer.smearTrack (flatTrack, std::abs (mcParticle.pdgCode ()), mcParticles.size ());
121+ if (!success) {
122+ histos.fill (HIST (" flat/hBookkeeping" ), 1 .0f );
123+ } else {
124+ histos.fill (HIST (" flat/hBookkeeping" ), 2 .0f );
125+
126+ switch (std::abs (mcParticle.pdgCode ())) {
127+ case PDG_t::kElectron :
128+ histos.fill (HIST (" flat/hDeltaPtEl" ), (mcParticle.pt () - flatTrack.getPt ()) / flatTrack.getPt ());
129+ histos.fill (HIST (" flat/h2dDeltaPtEl" ), flatTrack.getPt (), (mcParticle.pt () - flatTrack.getPt ()) / flatTrack.getPt ());
130+ break ;
131+ case PDG_t::kMuonMinus :
132+ histos.fill (HIST (" flat/hDeltaPtMu" ), (flatTrack.getPt () - mcParticle.pt ()) / flatTrack.getPt ());
133+ histos.fill (HIST (" flat/h2dDeltaPtMu" ), flatTrack.getPt (), (mcParticle.pt () - flatTrack.getPt ()) / flatTrack.getPt ());
134+ break ;
135+ case PDG_t::kPiPlus :
136+ histos.fill (HIST (" flat/hDeltaPtPi" ), (flatTrack.getPt () - mcParticle.pt ()) / flatTrack.getPt ());
137+ histos.fill (HIST (" flat/h2dDeltaPtPi" ), flatTrack.getPt (), (mcParticle.pt () - flatTrack.getPt ()) / flatTrack.getPt ());
138+ break ;
139+ case PDG_t::kKPlus :
140+ histos.fill (HIST (" flat/hDeltaPtKa" ), (flatTrack.getPt () - mcParticle.pt ()) / flatTrack.getPt ());
141+ histos.fill (HIST (" flat/h2dDeltaPtKa" ), flatTrack.getPt (), (mcParticle.pt () - flatTrack.getPt ()) / flatTrack.getPt ());
142+ break ;
143+ case PDG_t::kProton :
144+ histos.fill (HIST (" flat/hDeltaPtPr" ), (flatTrack.getPt () - mcParticle.pt ()) / flatTrack.getPt ());
145+ histos.fill (HIST (" flat/h2dDeltaPtPr" ), flatTrack.getPt (), (mcParticle.pt () - flatTrack.getPt ()) / flatTrack.getPt ());
146+ break ;
147+
148+ default :
149+ break ;
150+ }
151+ }
152+
153+ o2::track::TrackParCov fullTrack = o2::upgrade::convertMCParticleToO2Track (mcParticle, pdgDB);
154+ switch (std::abs (mcParticle.pdgCode ())) {
155+ case PDG_t::kElectron :
156+ success = fullSmearer.smearTrack (fullTrack, lutDataEl, mcParticles.size ());
157+ if (success) {
158+ histos.fill (HIST (" full/hDeltaPtEl" ), (mcParticle.pt () - fullTrack.getPt ()) / fullTrack.getPt ());
159+ histos.fill (HIST (" full/h2dDeltaPtEl" ), fullTrack.getPt (), (mcParticle.pt () - fullTrack.getPt ()) / fullTrack.getPt ());
160+ }
161+ break ;
162+ case PDG_t::kMuonMinus :
163+ success = fullSmearer.smearTrack (fullTrack, lutDataMu, mcParticles.size ());
164+ histos.fill (HIST (" full/hDeltaPtMu" ), (fullTrack.getPt () - mcParticle.pt ()) / fullTrack.getPt ());
165+ histos.fill (HIST (" full/h2dDeltaPtMu" ), fullTrack.getPt (), (mcParticle.pt () - fullTrack.getPt ()) / fullTrack.getPt ());
166+ break ;
167+ case PDG_t::kPiPlus :
168+ success = fullSmearer.smearTrack (fullTrack, lutDataPi, mcParticles.size ());
169+ if (success) {
170+ histos.fill (HIST (" full/hDeltaPtPi" ), (fullTrack.getPt () - mcParticle.pt ()) / fullTrack.getPt ());
171+ histos.fill (HIST (" full/h2dDeltaPtPi" ), fullTrack.getPt (), (mcParticle.pt () - fullTrack.getPt ()) / fullTrack.getPt ());
172+ }
173+ break ;
174+ case PDG_t::kKPlus :
175+ success = fullSmearer.smearTrack (fullTrack, lutDataKa, mcParticles.size ());
176+ if (success) {
177+ histos.fill (HIST (" full/hDeltaPtKa" ), (fullTrack.getPt () - mcParticle.pt ()) / fullTrack.getPt ());
178+ histos.fill (HIST (" full/h2dDeltaPtKa" ), fullTrack.getPt (), (mcParticle.pt () - fullTrack.getPt ()) / fullTrack.getPt ());
179+ }
180+ break ;
181+ case PDG_t::kProton :
182+ success = fullSmearer.smearTrack (fullTrack, lutDataPr, mcParticles.size ());
183+ if (success) {
184+ histos.fill (HIST (" full/hDeltaPtPr" ), (fullTrack.getPt () - mcParticle.pt ()) / fullTrack.getPt ());
185+ histos.fill (HIST (" full/h2dDeltaPtPr" ), fullTrack.getPt (), (mcParticle.pt () - fullTrack.getPt ()) / fullTrack.getPt ());
186+ }
187+ break ;
188+
189+ default :
190+ break ;
191+ }
192+
193+ if (success) {
194+ histos.fill (HIST (" full/hBookkeeping" ), 1 .0f );
195+ } else {
196+ histos.fill (HIST (" full/hBookkeeping" ), 2 .0f );
197+ }
198+ }
91199 }
92200 }
93201};
@@ -97,4 +205,4 @@ o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext co
97205 o2::framework::WorkflowSpec spec;
98206 spec.push_back (adaptAnalysisTask<TestCcdbConsumer0>(cfgc));
99207 return spec;
100- }
208+ }
0 commit comments