@@ -99,6 +99,13 @@ enum Harmonics {
9999 kOctagonal = 8
100100};
101101
102+ enum class MapLevel {
103+ kGood = 1 ,
104+ kNoBad = 2 ,
105+ kInEMC = 3 ,
106+ kAll = 4
107+ };
108+
102109struct TaskPi0FlowEMC {
103110 static constexpr float MinEnergy = 0 .7f ;
104111
@@ -220,14 +227,14 @@ struct TaskPi0FlowEMC {
220227 o2::emcal::Geometry* emcalGeom;
221228 o2::emcal::BadChannelMap* mBadChannels ;
222229 TH1D* h1SPResolution = nullptr ;
223- // Constants for eta and phi ranges
224- double etaMin = -0.75 , etaMax = 0.75 ;
225- int nBinsEta = 150 ; // 150 bins for eta
230+ // Constants for eta and phi ranges for the look up table
231+ static constexpr double EtaMin = -0.75 , etaMax = 0.75 ;
232+ static constexpr int NBinsEta = 150 ; // 150 bins for eta
226233
227- double phiMin = 1.35 , phiMax = 5.75 ;
228- int nBinsPhi = 440 ; // (440 bins = 0.01 step size covering most regions)
234+ static constexpr double PhiMin = 1.35 , phiMax = 5.75 ;
235+ static constexpr int NBinsPhi = 440 ; // (440 bins = 0.01 step size covering most regions)
229236
230- std::vector <int8_t > lookupTable1D;
237+ std::array <int8_t , NBinsEta * NBinsPhi > lookupTable1D;
231238 float epsilon = 1 .e-8 ;
232239
233240 // static constexpr
@@ -239,19 +246,19 @@ struct TaskPi0FlowEMC {
239246 // To access the 1D array
240247 inline int getIndex (int iEta, int iPhi)
241248 {
242- return iEta * nBinsPhi + iPhi;
249+ return iEta * NBinsPhi + iPhi;
243250 }
244251
245252 // Function to access the lookup table
246253 inline int8_t checkEtaPhi1D (double eta, double phi)
247254 {
248- if (eta < etaMin || eta > etaMax || phi < phiMin || phi > phiMax) {
255+ if (eta < EtaMin || eta > etaMax || phi < PhiMin || phi > phiMax) {
249256 return 3 ; // Out of bounds
250257 }
251258
252259 // Compute indices directly
253- int iEta = static_cast <int >((eta - etaMin ) / ((etaMax - etaMin ) / nBinsEta ));
254- int iPhi = static_cast <int >((phi - phiMin ) / ((phiMax - phiMin ) / nBinsPhi ));
260+ int iEta = static_cast <int >((eta - EtaMin ) / ((etaMax - EtaMin ) / NBinsEta ));
261+ int iPhi = static_cast <int >((phi - PhiMin ) / ((phiMax - PhiMin ) / NBinsPhi ));
255262
256263 return lookupTable1D[getIndex (iEta, iPhi)];
257264 }
@@ -437,7 +444,8 @@ struct TaskPi0FlowEMC {
437444 }
438445
439446 if (cfgDoM02.value ) {
440- registry.add (" hSparseFlow" , " THn for SP" , HistType::kTHnSparseF , {thnAxisM02, thnAxisPt, thnAxisCent});
447+ registry.add (" p3DM02Flow" , " <v_n> vs M_{02} vs p_T vs cent" , HistType::kTProfile3D , {thnAxisM02, thnAxisPt, thnAxisCent});
448+ registry.add (" h3DSparsePi0" , " M_{02} vs p_T vs cent" , HistType::kTH3D , {thnAxisM02, thnAxisPt, thnAxisCent});
441449 }
442450
443451 ccdb->setURL (ccdbUrl);
@@ -663,28 +671,33 @@ struct TaskPi0FlowEMC {
663671 emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber (collision.runNumber ());
664672 // Load Bad Channel map
665673 mBadChannels = ccdb->getForTimeStamp <o2::emcal::BadChannelMap>(" EMC/Calib/BadChannelMap" , collision.timestamp ());
666- lookupTable1D = std::vector<int8_t >(nBinsEta * nBinsPhi, -1 );
667- double binWidthEta = (etaMax - etaMin) / nBinsEta;
668- double binWidthPhi = (phiMax - phiMin) / nBinsPhi;
669-
670- for (int iEta = 0 ; iEta < nBinsEta; ++iEta) {
671- double etaCenter = etaMin + (iEta + 0.5 ) * binWidthEta;
672- for (int iPhi = 0 ; iPhi < nBinsPhi; ++iPhi) {
673- double phiCenter = phiMin + (iPhi + 0.5 ) * binWidthPhi;
674- try {
675- // Get the cell ID
676- int cellID = emcalGeom->GetAbsCellIdFromEtaPhi (etaCenter, phiCenter);
677-
678- // Check conditions for the cell
679- if (isTooCloseToEdge (cellID, 1 )) {
680- lookupTable1D[getIndex (iEta, iPhi)] = 2 ; // Edge
681- } else if (isCellMasked (cellID)) {
682- lookupTable1D[getIndex (iEta, iPhi)] = 1 ; // Bad
683- } else {
684- lookupTable1D[getIndex (iEta, iPhi)] = 0 ; // Good
674+ lookupTable1D.fill (-1 );
675+ double binWidthEta = (etaMax - EtaMin) / NBinsEta;
676+ double binWidthPhi = (phiMax - PhiMin) / NBinsPhi;
677+
678+ if (cfgEMCalMapLevelBackground.value >= static_cast <int >(MapLevel::kAll ) && cfgEMCalMapLevelSameEvent >= static_cast <int >(MapLevel::kAll )) {
679+ // in this case we do not want to check the clusters, so just say thery are all good.
680+ lookupTable1D.fill (0 ); // good
681+ } else {
682+ for (int iEta = 0 ; iEta < NBinsEta; ++iEta) {
683+ double etaCenter = EtaMin + (iEta + 0.5 ) * binWidthEta;
684+ for (int iPhi = 0 ; iPhi < NBinsPhi; ++iPhi) {
685+ double phiCenter = PhiMin + (iPhi + 0.5 ) * binWidthPhi;
686+ try {
687+ // Get the cell ID
688+ int cellID = emcalGeom->GetAbsCellIdFromEtaPhi (etaCenter, phiCenter);
689+
690+ // Check conditions for the cell
691+ if (isTooCloseToEdge (cellID, 1 )) {
692+ lookupTable1D[getIndex (iEta, iPhi)] = 2 ; // Edge
693+ } else if (isCellMasked (cellID)) {
694+ lookupTable1D[getIndex (iEta, iPhi)] = 1 ; // Bad
695+ } else {
696+ lookupTable1D[getIndex (iEta, iPhi)] = 0 ; // Good
697+ }
698+ } catch (o2::emcal::InvalidPositionException& e) {
699+ lookupTable1D[getIndex (iEta, iPhi)] = 3 ; // Outside geometry
685700 }
686- } catch (o2::emcal::InvalidPositionException& e) {
687- lookupTable1D[getIndex (iEta, iPhi)] = 3 ; // Outside geometry
688701 }
689702 }
690703 }
@@ -1433,7 +1446,8 @@ struct TaskPi0FlowEMC {
14331446 scalprodCand = scalprodCand / h1SPResolution->GetBinContent (h1SPResolution->FindBin (cent + epsilon));
14341447 }
14351448 if (cfgDoM02.value ) {
1436- registry.fill (HIST (" hSparseFlow" ), photon.m02 (), photon.pt (), cent, scalprodCand);
1449+ registry.fill (HIST (" p3DM02Flow" ), photon.m02 (), photon.pt (), cent, scalprodCand);
1450+ registry.fill (HIST (" h3DSparsePi0" ), photon.m02 (), photon.pt (), cent);
14371451 }
14381452 return ;
14391453 } // end of loop over single cluster
0 commit comments