@@ -52,23 +52,24 @@ int32_t nBCsPerOrbit = o2::constants::lhc::LHCMaxBunches;
5252// const int nBCinTF = 114048; /// CCDB value // to be obtained from CCDB in future
5353const int nBCinDrift = 114048 / 32 ; // / to get from ccdb in future
5454
55- template <typename T, std::size_t N>
56- void sortVectorOfArray (std::vector<std::array<T,N>> &myVector, const int &myIDX){
57- std::sort (myVector.begin (), myVector.end (), [myIDX](const std::array<T,N>& a, const std::array<T,N>& b){
58- return a[myIDX] < b[myIDX]; // sort at the required index
55+ template <typename T, std::size_t N>
56+ void sortVectorOfArray (std::vector<std::array<T, N>>& myVector, const int & myIDX)
57+ {
58+ std::sort (myVector.begin (), myVector.end (), [myIDX](const std::array<T, N>& a, const std::array<T, N>& b) {
59+ return a[myIDX] < b[myIDX]; // sort at the required index
5960 });
6061}
6162
62- template <typename T, std::size_t N>
63- void checkUniqueness (const std::vector<std::array<T,N>>& myVector, const int &myIDX){
64- for (size_t i = 1 ; i < myVector.size (); i++){
65- if (myVector[i][myIDX] <= myVector[i - 1 ][myIDX]){
66- LOG (error)<<" Duplicate Entries while creating Index tables :: (vec[" <<i<<" ][" <<myIDX<<" ]) " <<myVector[i][myIDX]<<" >= " <<myVector[i - 1 ][myIDX]<<" (vec[" <<i-1 <<" ][" <<myIDX<<" ])" ;
63+ template <typename T, std::size_t N>
64+ void checkUniqueness (const std::vector<std::array<T, N>>& myVector, const int & myIDX)
65+ {
66+ for (size_t i = 1 ; i < myVector.size (); i++) {
67+ if (myVector[i][myIDX] <= myVector[i - 1 ][myIDX]) {
68+ LOG (error) << " Duplicate Entries while creating Index tables :: (vec[" << i << " ][" << myIDX << " ]) " << myVector[i][myIDX] << " >= " << myVector[i - 1 ][myIDX] << " (vec[" << i - 1 << " ][" << myIDX << " ])" ;
6769 }
6870 }
6971}
7072
71-
7273struct OccupancyTableProducer {
7374
7475 Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -1749,7 +1750,7 @@ struct TrackMeanOccTableProducer {
17491750 fillWeightMeanOccTable
17501751 };
17511752
1752- std::vector<std::array<int64_t ,2 >> trackQAGIListforTMOList;
1753+ std::vector<std::array<int64_t , 2 >> trackQAGIListforTMOList;
17531754 template <int processMode, int meanTableMode, int weightMeanTableMode, int qaMode, typename B, typename C, typename T, typename U, typename O, typename V>
17541755 void executeTrackOccProducerProcessing (B const & BCs, C const & collisions, T const & tracks, U const & tracksQA, O const & occsRobustT0V0Prim, V const & occs, bool const & executeInThisBlock)
17551756 {
@@ -1893,7 +1894,7 @@ struct TrackMeanOccTableProducer {
18931894 float weightMeanOccRobustFDDT0V0PrimUnfm80 = 0 ;
18941895 float weightMeanOccRobustNtrackDetUnfm80 = 0 ;
18951896 float weightMeanOccRobustMultTableUnfm80 = 0 ;
1896-
1897+
18971898 int trackTMOcounter = -1 ;
18981899 trackQAGIListforTMOList.clear ();
18991900
@@ -2349,43 +2350,47 @@ struct TrackMeanOccTableProducer {
23492350 }
23502351 } // end of trackQA loop
23512352
2352- // build the IndexTables here
2353+ // build the IndexTables here
23532354 if (executeInThisBlock) {
2354- if (buildPointerTrackQAToTMOTable){
2355- // create pointer table from trackQA to TrackMeanOcc
2356- sortVectorOfArray (trackQAGIListforTMOList, 0 );// sort the list //Its easy to search in a sorted list
2357- checkUniqueness (trackQAGIListforTMOList, 0 ); // check the uniqueness of track.globalIndex()
2355+ if (buildPointerTrackQAToTMOTable) {
2356+ // create pointer table from trackQA to TrackMeanOcc
2357+ sortVectorOfArray (trackQAGIListforTMOList, 0 ); // sort the list //Its easy to search in a sorted list
2358+ checkUniqueness (trackQAGIListforTMOList, 0 ); // check the uniqueness of track.globalIndex()
23582359
23592360 int currentIDXforCheck = 0 ;
23602361 int listSize = trackQAGIListforTMOList.size ();
2361- for (const auto & trackQA : tracksQA){
2362- while (trackQA.globalIndex () > trackQAGIListforTMOList[currentIDXforCheck][0 ]){
2362+ for (const auto & trackQA : tracksQA) {
2363+ while (trackQA.globalIndex () > trackQAGIListforTMOList[currentIDXforCheck][0 ]) {
23632364 currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1;
2364- if (currentIDXforCheck >= listSize) {break ;}
2365+ if (currentIDXforCheck >= listSize) {
2366+ break ;
2367+ }
23652368 }
2366- if (trackQA.globalIndex () == trackQAGIListforTMOList[currentIDXforCheck][0 ]){
2369+ if (trackQA.globalIndex () == trackQAGIListforTMOList[currentIDXforCheck][0 ]) {
23672370 genTrackQAToTmo (trackQAGIListforTMOList[currentIDXforCheck][1 ]);
2368- } else {
2369- genTrackQAToTmo (-1 ); // put a dummy index when track is not found in trackQA
2371+ } else {
2372+ genTrackQAToTmo (-1 ); // put a dummy index when track is not found in trackQA
23702373 }
23712374 }
23722375 }
2373- if (buildPointerTMOToTrackQATable){
2374- // create pointer table from TrackMeanOcc to trackQA
2375- sortVectorOfArray (trackQAGIListforTMOList, 1 );// sort the list //Its easy to search in a sorted list
2376- checkUniqueness (trackQAGIListforTMOList, 1 ); // check the uniqueness of track.globalIndex()
2376+ if (buildPointerTMOToTrackQATable) {
2377+ // create pointer table from TrackMeanOcc to trackQA
2378+ sortVectorOfArray (trackQAGIListforTMOList, 1 ); // sort the list //Its easy to search in a sorted list
2379+ checkUniqueness (trackQAGIListforTMOList, 1 ); // check the uniqueness of track.globalIndex()
23772380
23782381 int currentIDXforCheck = 0 ;
23792382 int listSize = trackQAGIListforTMOList.size ();
2380- for (int iCounter = 0 ; iCounter <= trackTMOcounter ; iCounter++){
2381- while (iCounter > trackQAGIListforTMOList[currentIDXforCheck][1 ]){
2383+ for (int iCounter = 0 ; iCounter <= trackTMOcounter; iCounter++) {
2384+ while (iCounter > trackQAGIListforTMOList[currentIDXforCheck][1 ]) {
23822385 currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1;
2383- if (currentIDXforCheck >= listSize) {break ;}
2386+ if (currentIDXforCheck >= listSize) {
2387+ break ;
2388+ }
23842389 }
2385- if (iCounter == trackQAGIListforTMOList[currentIDXforCheck][1 ]){
2390+ if (iCounter == trackQAGIListforTMOList[currentIDXforCheck][1 ]) {
23862391 genTmoToTrackQA (trackQAGIListforTMOList[currentIDXforCheck][0 ]);
2387- } else {
2388- genTmoToTrackQA (-1 ); // put a dummy index when track is not found in trackQA
2392+ } else {
2393+ genTmoToTrackQA (-1 ); // put a dummy index when track is not found in trackQA
23892394 }
23902395 }
23912396 }
@@ -2672,7 +2677,7 @@ struct TrackMeanOccTableProducer {
26722677 PROCESS_SWITCH (TrackMeanOccTableProducer, processFullOccTableProduer, " processFullOccTableProduer" , false );
26732678};
26742679
2675- struct CreatePointerTables {
2680+ struct CreatePointerTables {
26762681
26772682 Produces<aod::TrackToTracksQA> genTrackToTracksQA;
26782683 Produces<aod::TrackToTmo> genTrackToTmo;
@@ -2683,63 +2688,67 @@ struct CreatePointerTables{
26832688 }
26842689 PROCESS_SWITCH (CreatePointerTables, processNothing, " process Nothing" , true );
26852690
2686- std::vector<std::array<int64_t ,2 >> trackGIForTrackQAIndexList;
2691+ std::vector<std::array<int64_t , 2 >> trackGIForTrackQAIndexList;
26872692 using MyTracksQA = aod::TracksQAVersion;
26882693 void processTrackToTrackQAPointer (aod::Tracks const & tracks, MyTracksQA const & tracksQA)
2689- {
2694+ {
26902695 trackGIForTrackQAIndexList.clear ();
26912696 for (const auto & trackQA : tracksQA) {
26922697 auto const & track = trackQA.template track_as <aod::Tracks>();
26932698 trackGIForTrackQAIndexList.push_back ({track.globalIndex (), trackQA.globalIndex ()});
26942699 }
26952700
2696- sortVectorOfArray (trackGIForTrackQAIndexList, 0 );// sort the list //Its easy to search in a sorted list
2697- checkUniqueness (trackGIForTrackQAIndexList, 0 ); // check the uniqueness of track.globalIndex()
2701+ sortVectorOfArray (trackGIForTrackQAIndexList, 0 ); // sort the list //Its easy to search in a sorted list
2702+ checkUniqueness (trackGIForTrackQAIndexList, 0 ); // check the uniqueness of track.globalIndex()
26982703
2699- // create pointer table
2704+ // create pointer table
27002705 int currentIDXforCheck = 0 ;
27012706 int listSize = trackGIForTrackQAIndexList.size ();
27022707
2703- for (const auto & track : tracks){
2704- while (track.globalIndex () > trackGIForTrackQAIndexList[currentIDXforCheck][0 ]){
2708+ for (const auto & track : tracks) {
2709+ while (track.globalIndex () > trackGIForTrackQAIndexList[currentIDXforCheck][0 ]) {
27052710 currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1;
2706- if (currentIDXforCheck >= listSize) {break ;}
2711+ if (currentIDXforCheck >= listSize) {
2712+ break ;
2713+ }
27072714 }
2708- if (track.globalIndex () == trackGIForTrackQAIndexList[currentIDXforCheck][0 ]){
2715+ if (track.globalIndex () == trackGIForTrackQAIndexList[currentIDXforCheck][0 ]) {
27092716 genTrackToTracksQA (trackGIForTrackQAIndexList[currentIDXforCheck][1 ]);
2710- } else {
2711- genTrackToTracksQA (-1 ); // put a dummy index when track is not found in trackQA
2717+ } else {
2718+ genTrackToTracksQA (-1 ); // put a dummy index when track is not found in trackQA
27122719 }
27132720 }
27142721 }
27152722 PROCESS_SWITCH (CreatePointerTables, processTrackToTrackQAPointer, " processTrackToTrackQAPointer" , false );
27162723
2717- std::vector<std::array<int64_t ,2 >> trackGIForTMOIndexList;
2724+ std::vector<std::array<int64_t , 2 >> trackGIForTMOIndexList;
27182725 void processTrackToTrackMeanOccsPointer (aod::Tracks const & tracks, aod::TmoTrackIds const & tmoTrackIds)
27192726 {
27202727 trackGIForTMOIndexList.clear ();
27212728 int tmoCounter = -1 ;
27222729 for (const auto & tmoTrackId : tmoTrackIds) {
27232730 tmoCounter++;
27242731 auto const & track = tmoTrackId.template track_as <aod::Tracks>();
2725- trackGIForTMOIndexList.push_back ({track.globalIndex (), tmoCounter}); // tmoTrackId Global Index is not working :: tmoTrackId.globalIndex()});
2732+ trackGIForTMOIndexList.push_back ({track.globalIndex (), tmoCounter}); // tmoTrackId Global Index is not working :: tmoTrackId.globalIndex()});
27262733 }
2727- sortVectorOfArray (trackGIForTMOIndexList, 0 );// sort the list //Its easy to search in a sorted list
2728- checkUniqueness (trackGIForTMOIndexList, 0 ); // check the uniqueness of track.globalIndex()
2734+ sortVectorOfArray (trackGIForTMOIndexList, 0 ); // sort the list //Its easy to search in a sorted list
2735+ checkUniqueness (trackGIForTMOIndexList, 0 ); // check the uniqueness of track.globalIndex()
27292736
2730- // create pointer table
2737+ // create pointer table
27312738 int currentIDXforCheck = 0 ;
27322739 int listSize = trackGIForTMOIndexList.size ();
27332740
2734- for (const auto & track : tracks){
2735- while (track.globalIndex () > trackGIForTMOIndexList[currentIDXforCheck][0 ]){
2741+ for (const auto & track : tracks) {
2742+ while (track.globalIndex () > trackGIForTMOIndexList[currentIDXforCheck][0 ]) {
27362743 currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1;
2737- if (currentIDXforCheck >= listSize) {break ;}
2744+ if (currentIDXforCheck >= listSize) {
2745+ break ;
2746+ }
27382747 }
2739- if (track.globalIndex () == trackGIForTMOIndexList[currentIDXforCheck][0 ]){
2748+ if (track.globalIndex () == trackGIForTMOIndexList[currentIDXforCheck][0 ]) {
27402749 genTrackToTmo (trackGIForTMOIndexList[currentIDXforCheck][1 ]);
2741- } else {
2742- genTrackToTmo (-1 ); // put a dummy index when track is not found in trackQA
2750+ } else {
2751+ genTrackToTmo (-1 ); // put a dummy index when track is not found in trackQA
27432752 }
27442753 }
27452754 }
0 commit comments