@@ -37,8 +37,8 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
3737struct pidTOFTask {
3838 using Trks = soa::Join<aod::Tracks, aod::TracksExtra>;
3939 using Coll = aod::Collisions;
40- Produces<aod::pidRespTOF> tofpid ;
41- DetectorResponse resp ;
40+ Produces<aod::pidRespTOF> tablePID ;
41+ DetectorResponse response ;
4242 Service<o2::ccdb::BasicCCDBManager> ccdb;
4343 Configurable<std::string> paramfile{" param-file" , " " , " Path to the parametrization object, if emtpy the parametrization is not taken from file" };
4444 Configurable<std::string> sigmaname{" param-sigma" , " TOFReso" , " Name of the parametrization for the expected sigma, used in both file and CCDB mode" };
@@ -55,80 +55,83 @@ struct pidTOFTask {
5555 ccdb->setCreatedNotAfter (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count ());
5656 //
5757 const std::vector<float > p = {0.008 , 0.008 , 0.002 , 40.0 };
58- resp .SetParameters (DetectorResponse::kSigma , p);
58+ response .SetParameters (DetectorResponse::kSigma , p);
5959 const std::string fname = paramfile.value ;
6060 if (!fname.empty ()) { // Loading the parametrization from file
61- resp .LoadParamFromFile (fname.data (), sigmaname.value , DetectorResponse::kSigma );
61+ response .LoadParamFromFile (fname.data (), sigmaname.value , DetectorResponse::kSigma );
6262 } else { // Loading it from CCDB
6363 const std::string path = " Analysis/PID/TOF" ;
64- resp .LoadParam (DetectorResponse::kSigma , ccdb->getForTimeStamp <Parametrization>(path + " /" + sigmaname.value , timestamp.value ));
64+ response .LoadParam (DetectorResponse::kSigma , ccdb->getForTimeStamp <Parametrization>(path + " /" + sigmaname.value , timestamp.value ));
6565 }
6666 }
6767
68+ template <o2::track::PID::ID pid>
69+ using ResponseImplementation = tof::ExpTimes<Coll::iterator, Trks::iterator, pid>;
6870 void process (Coll const & collisions, Trks const & tracks)
6971 {
70- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Electron> resp_Electron = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Electron>();
71- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Muon> resp_Muon = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Muon>();
72- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Pion> resp_Pion = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Pion>();
73- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Kaon> resp_Kaon = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Kaon>();
74- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Proton> resp_Proton = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Proton>();
75- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Deuteron> resp_Deuteron = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Deuteron>();
76- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Triton> resp_Triton = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Triton>();
77- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Helium3> resp_Helium3 = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Helium3>();
78- constexpr tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Alpha> resp_Alpha = tof::ExpTimes<Coll::iterator, Trks::iterator, PID::Alpha>();
79-
80- tofpid .reserve (tracks.size ());
72+ constexpr auto responseEl = ResponseImplementation< PID::Electron>();
73+ constexpr auto responseMu = ResponseImplementation< PID::Muon>();
74+ constexpr auto responsePi = ResponseImplementation< PID::Pion>();
75+ constexpr auto responseKa = ResponseImplementation< PID::Kaon>();
76+ constexpr auto responsePr = ResponseImplementation< PID::Proton>();
77+ constexpr auto responseDe = ResponseImplementation< PID::Deuteron>();
78+ constexpr auto responseTr = ResponseImplementation< PID::Triton>();
79+ constexpr auto responseHe = ResponseImplementation< PID::Helium3>();
80+ constexpr auto responseAl = ResponseImplementation< PID::Alpha>();
81+
82+ tablePID .reserve (tracks.size ());
8183 for (auto const & trk : tracks) {
82- tofpid (resp_Electron .GetExpectedSigma (resp , trk.collision (), trk),
83- resp_Muon .GetExpectedSigma (resp , trk.collision (), trk),
84- resp_Pion .GetExpectedSigma (resp , trk.collision (), trk),
85- resp_Kaon .GetExpectedSigma (resp , trk.collision (), trk),
86- resp_Proton .GetExpectedSigma (resp , trk.collision (), trk),
87- resp_Deuteron .GetExpectedSigma (resp , trk.collision (), trk),
88- resp_Triton .GetExpectedSigma (resp , trk.collision (), trk),
89- resp_Helium3 .GetExpectedSigma (resp , trk.collision (), trk),
90- resp_Alpha .GetExpectedSigma (resp , trk.collision (), trk),
91- resp_Electron .GetSeparation (resp , trk.collision (), trk),
92- resp_Muon .GetSeparation (resp , trk.collision (), trk),
93- resp_Pion .GetSeparation (resp , trk.collision (), trk),
94- resp_Kaon .GetSeparation (resp , trk.collision (), trk),
95- resp_Proton .GetSeparation (resp , trk.collision (), trk),
96- resp_Deuteron .GetSeparation (resp , trk.collision (), trk),
97- resp_Triton .GetSeparation (resp , trk.collision (), trk),
98- resp_Helium3 .GetSeparation (resp , trk.collision (), trk),
99- resp_Alpha .GetSeparation (resp , trk.collision (), trk));
84+ tablePID (responseEl .GetExpectedSigma (response , trk.collision (), trk),
85+ responseMu .GetExpectedSigma (response , trk.collision (), trk),
86+ responsePi .GetExpectedSigma (response , trk.collision (), trk),
87+ responseKa .GetExpectedSigma (response , trk.collision (), trk),
88+ responsePr .GetExpectedSigma (response , trk.collision (), trk),
89+ responseDe .GetExpectedSigma (response , trk.collision (), trk),
90+ responseTr .GetExpectedSigma (response , trk.collision (), trk),
91+ responseHe .GetExpectedSigma (response , trk.collision (), trk),
92+ responseAl .GetExpectedSigma (response , trk.collision (), trk),
93+ responseEl .GetSeparation (response , trk.collision (), trk),
94+ responseMu .GetSeparation (response , trk.collision (), trk),
95+ responsePi .GetSeparation (response , trk.collision (), trk),
96+ responseKa .GetSeparation (response , trk.collision (), trk),
97+ responsePr .GetSeparation (response , trk.collision (), trk),
98+ responseDe .GetSeparation (response , trk.collision (), trk),
99+ responseTr .GetSeparation (response , trk.collision (), trk),
100+ responseHe .GetSeparation (response , trk.collision (), trk),
101+ responseAl .GetSeparation (response , trk.collision (), trk));
100102 }
101103 }
102104};
103105
104106struct pidTOFTaskBeta {
105107 using Trks = soa::Join<aod::Tracks, aod::TracksExtra>;
106108 using Coll = aod::Collision;
107- Produces<aod::pidRespTOFbeta> tofpidbeta ;
108- tof::Beta<Coll, Trks::iterator, PID::Electron> resp_Electron ;
109+ Produces<aod::pidRespTOFbeta> tablePIDBeta ;
110+ tof::Beta<Coll, Trks::iterator, PID::Electron> responseElectron ;
109111 Configurable<float > expreso{" tof-expreso" , 80 , " Expected resolution for the computation of the expected beta" };
110112
111113 void init (o2::framework::InitContext&)
112114 {
113- resp_Electron .mExpectedResolution = expreso.value ;
115+ responseElectron .mExpectedResolution = expreso.value ;
114116 }
115117
116118 void process (Coll const & collision, Trks const & tracks)
117119 {
118- tofpidbeta .reserve (tracks.size ());
120+ tablePIDBeta .reserve (tracks.size ());
119121 for (auto const & trk : tracks) {
120- tofpidbeta (resp_Electron .GetBeta (collision, trk),
121- resp_Electron .GetExpectedSigma (collision, trk),
122- resp_Electron .GetExpectedSignal (collision, trk),
123- resp_Electron .GetExpectedSigma (collision, trk),
124- resp_Electron .GetSeparation (collision, trk));
122+ tablePIDBeta (responseElectron .GetBeta (collision, trk),
123+ responseElectron .GetExpectedSigma (collision, trk),
124+ responseElectron .GetExpectedSignal (collision, trk),
125+ responseElectron .GetExpectedSigma (collision, trk),
126+ responseElectron .GetSeparation (collision, trk));
125127 }
126128 }
127129};
128130
129131struct pidTOFTaskQA {
130132
131133 static constexpr int Np = 9 ;
134+ static constexpr const char * pT[Np] = {" e" , " #mu" , " #pi" , " K" , " p" , " d" , " t" , " ^{3}He" , " #alpha" };
132135 static constexpr std::string_view hexpected[Np] = {" expected/El" , " expected/Mu" , " expected/Pi" ,
133136 " expected/Ka" , " expected/Pr" , " expected/De" ,
134137 " expected/Tr" , " expected/He" , " expected/Al" };
@@ -138,7 +141,6 @@ struct pidTOFTaskQA {
138141 static constexpr std::string_view hnsigma[Np] = {" nsigma/El" , " nsigma/Mu" , " nsigma/Pi" ,
139142 " nsigma/Ka" , " nsigma/Pr" , " nsigma/De" ,
140143 " nsigma/Tr" , " nsigma/He" , " nsigma/Al" };
141- static constexpr const char * pT[Np] = {" e" , " #mu" , " #pi" , " K" , " p" , " d" , " t" , " ^{3}He" , " #alpha" };
142144 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::QAObject};
143145
144146 Configurable<int > nBinsP{" nBinsP" , 400 , " Number of bins for the momentum" };
0 commit comments