1212// / \file createPCM.cxx
1313// / \brief This code produces photon data tables.
1414// / \author Daiki Sekihata <daiki.sekihata@cern.ch>, Tokyo
15+ // / \note legacy code, please use the photonconversionbuilder tasks.
1516
1617#include " PWGEM/PhotonMeson/DataModel/gammaTables.h"
1718#include " PWGEM/PhotonMeson/Utils/PCMUtilities.h"
3536#include < Framework/AnalysisDataModel.h>
3637#include < Framework/AnalysisHelpers.h>
3738#include < Framework/AnalysisTask.h>
39+ #include < Framework/Concepts.h>
3840#include < Framework/Configurable.h>
3941#include < Framework/HistogramRegistry.h>
4042#include < Framework/HistogramSpec.h>
@@ -113,9 +115,9 @@ struct createPCM {
113115 Configurable<float > max_r_req_its{" max_r_req_its" , 16.0 , " min Rxy for V0 with ITS hits" };
114116 Configurable<float > min_r_tpconly{" min_r_tpconly" , 32.0 , " min Rxy for V0 with TPConly tracks" };
115117
116- int mRunNumber ;
117- float d_bz;
118- Service<o2::ccdb::BasicCCDBManager> ccdb;
118+ int mRunNumber = 0 ;
119+ float d_bz = 0 ;
120+ Service<o2::ccdb::BasicCCDBManager> ccdb{} ;
119121 o2::base::MatLayerCylSet* lut = nullptr ;
120122 o2::vertexing::DCAFitterN<2 > fitter;
121123 // Material correction in the DCA fitter
@@ -213,7 +215,7 @@ struct createPCM {
213215 }
214216 }
215217
216- template <typename TTrack>
218+ template <o2::soa::is_iterator TTrack>
217219 bool reconstructV0 (TTrack const & ele, TTrack const & pos)
218220 {
219221 bool isITSonly_pos = pos.hasITS () && !pos.hasTPC ();
@@ -257,7 +259,7 @@ struct createPCM {
257259 return false ;
258260 }
259261
260- float xyz[ 3 ] = {0 .f , 0 .f , 0 .f };
262+ std::array< float , 3 > xyz = {0 .f , 0 .f , 0 .f };
261263 Vtx_recalculation (o2::base::Propagator::Instance (), pos, ele, xyz, matCorr);
262264 float recalculatedVtxR = std::sqrt (std::pow (xyz[0 ], 2 ) + std::pow (xyz[1 ], 2 ));
263265 // LOGF(info, "recalculated vtx : x = %f , y = %f , z = %f", xyz[0], xyz[1], xyz[2]);
@@ -275,7 +277,7 @@ struct createPCM {
275277 return true ;
276278 }
277279
278- template <typename TCollision, typename TTrack>
280+ template <o2::soa::is_iterator TCollision, o2::soa::is_iterator TTrack>
279281 void fillV0Table (TCollision const & collision, TTrack const & ele, TTrack const & pos, const bool filltable)
280282 {
281283 std::array<float , 3 > pVtx = {collision.posX (), collision.posY (), collision.posZ ()};
@@ -323,7 +325,7 @@ struct createPCM {
323325 }
324326
325327 registry.fill (HIST (" hV0xy" ), svpos[0 ], svpos[1 ]); // this should have worst resolution
326- float xyz_tmp[ 3 ] = {0 .f , 0 .f , 0 .f };
328+ std::array< float , 3 > xyz_tmp = {0 .f , 0 .f , 0 .f };
327329 Vtx_recalculation (o2::base::Propagator::Instance (), pos, ele, xyz_tmp, matCorr);
328330 registry.fill (HIST (" hV0xy_recalculated" ), xyz_tmp[0 ], xyz_tmp[1 ]); // this should have good resolution
329331
@@ -343,7 +345,7 @@ struct createPCM {
343345 }
344346
345347 std::pair<int8_t , std::set<uint8_t >> its_ib_Requirement = {0 , {0 , 1 , 2 }}; // no hit on 3 ITS ib layers.
346- template <typename TTrack>
348+ template <o2::soa::is_iterator TTrack>
347349 bool isSelected (TTrack const & track)
348350 {
349351 if (track.pt () < minpt || std::abs (track.eta ()) > maxeta) {
@@ -420,7 +422,7 @@ struct createPCM {
420422 // registry.fill(HIST("hEventCounter"), 1);
421423
422424 int32_t min_sw = std::max (static_cast <int64_t >(0 ), collision.globalIndex ());
423- int32_t max_sw = std::min (static_cast <int64_t >(min_sw + nsw), static_cast < int64_t >( collisions.size () ));
425+ int32_t max_sw = std::min (static_cast <int64_t >(min_sw + nsw), collisions.size ());
424426
425427 // LOGF(info, "orphan_posTracks.size() = %d, orphan_negTracks.size() = %d", orphan_posTracks.size(), orphan_negTracks.size());
426428 negTracks_sw.reserve (max_sw - min_sw);
@@ -477,7 +479,7 @@ struct createPCM {
477479 vec_cospa.reserve (max_sw - min_sw);
478480 for (int32_t isw = min_sw; isw < max_sw; isw++) {
479481 auto collision_in_sw = collisions.rawIteratorAt (isw);
480- if (cospa_map.find (std::make_tuple (pos.globalIndex (), ele.globalIndex (), collision_in_sw.globalIndex ())) != cospa_map. end ( )) {
482+ if (cospa_map.contains (std::make_tuple (pos.globalIndex (), ele.globalIndex (), collision_in_sw.globalIndex ()))) {
481483 vec_cospa.emplace_back (cospa_map[std::make_tuple (pos.globalIndex (), ele.globalIndex (), collision_in_sw.globalIndex ())]);
482484 } else {
483485 vec_cospa.emplace_back (-999 .f );
@@ -516,7 +518,7 @@ struct createPCM {
516518 }
517519 } // end of pca_map loop
518520
519- if (is_closest_v0 && used_pair_map.find (std::make_pair (pos.globalIndex (), ele.globalIndex ())) == used_pair_map. end ( )) {
521+ if (is_closest_v0 && ! used_pair_map.contains (std::make_pair (pos.globalIndex (), ele.globalIndex ()))) {
520522 // LOGF(info, "store : pos.globalIndex() = %d , ele.globalIndex() = %d , collision.globalIndex() = %d , cospa = %f , pca = %f", std::get<0>(key), std::get<1>(key), std::get<2>(key), value, pca_map[key]);
521523 fillV0Table (collision_most_prob, ele, pos, true );
522524 used_pair_map[std::make_pair (pos.globalIndex (), ele.globalIndex ())] = true ;
@@ -563,16 +565,16 @@ struct createPCM {
563565 if (ele.sign () < 0 ) {
564566 fillV0Table (collision, ele, pos, true );
565567 } else {
566- fillV0Table (collision, pos, ele, true );
568+ fillV0Table (collision, pos, ele, true ); // NOLINT(readability-suspicious-call-argument) in case the ele is actually positivley charged
567569 }
568570 }
569571 } // end of collision loop
570572 } // end of process
571573 PROCESS_SWITCH (createPCM, processTrkCollAsso, " create V0s with track-to-collision associator" , false );
572574};
573575
574- WorkflowSpec defineDataProcessing (ConfigContext const & cfgc )
576+ WorkflowSpec defineDataProcessing (ConfigContext const & context )
575577{
576578 return WorkflowSpec{
577- adaptAnalysisTask<createPCM>(cfgc , TaskName{" v0-finder" })};
579+ adaptAnalysisTask<createPCM>(context , TaskName{" v0-finder" })};
578580}
0 commit comments