@@ -80,7 +80,7 @@ using MyEMCClusters = soa::Join<aod::SkimEMCClusters, aod::EMCEMEventIds>;
8080using MyEMCCluster = MyEMCClusters::iterator;
8181
8282using MyPHOSClusters = soa::Join<aod::PHOSClusters, aod::PHOSEMEventIds>;
83- using MyPHOSCluster = MyEMCClusters ::iterator;
83+ using MyPHOSCluster = MyPHOSClusters ::iterator;
8484
8585template <PairType pairtype, typename ... Types>
8686struct Pi0EtaToGammaGamma {
@@ -210,6 +210,7 @@ struct Pi0EtaToGammaGamma {
210210 Service<o2::ccdb::BasicCCDBManager> ccdb;
211211 int mRunNumber ;
212212 float d_bz;
213+ o2::emcal::Geometry* emcalGeom;
213214
214215 void init (InitContext&)
215216 {
@@ -244,7 +245,7 @@ struct Pi0EtaToGammaGamma {
244245
245246 if constexpr (pairtype == kEMCEMC ) {
246247 fRegistry .addClone (" Pair/same/" , " Pair/rotation/" );
247- o2::emcal::Geometry::GetInstanceFromRunNumber (300000 );
248+ emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber (300000 );
248249 }
249250
250251 mRunNumber = 0 ;
@@ -449,11 +450,31 @@ struct Pi0EtaToGammaGamma {
449450 photon1 = rotationMatrix * photon1;
450451 photon2 = rotationMatrix * photon2;
451452
453+ int iCellID_photon1 = 0 ;
454+ int iCellID_photon2 = 0 ;
455+
456+ try {
457+ iCellID_photon1 = emcalGeom->GetAbsCellIdFromEtaPhi (photon1.Eta (), photon1.Phi ());
458+ } catch (o2::emcal::InvalidPositionException& e) {
459+ iCellID_photon1 = -1 ;
460+ }
461+ try {
462+ iCellID_photon2 = emcalGeom->GetAbsCellIdFromEtaPhi (photon2.Eta (), photon2.Phi ());
463+ } catch (o2::emcal::InvalidPositionException& e) {
464+ iCellID_photon2 = -1 ;
465+ }
466+ if (iCellID_photon1 == -1 && iCellID_photon2 == -1 ) {
467+ return ;
468+ }
469+
452470 for (auto & photon : photons_coll) {
453471 if (photon.globalIndex () == ig1 || photon.globalIndex () == ig2) {
454472 // only combine rotated photons with other photons
455473 continue ;
456474 }
475+ if (!(fEMCCut .IsSelected <MyEMCCluster>(photon))) {
476+ continue ;
477+ }
457478
458479 ROOT::Math::PtEtaPhiMVector photon3 (photon.pt (), photon.eta (), photon.phi (), 0 .);
459480 ROOT::Math::PtEtaPhiMVector mother1 = photon1 + photon3;
@@ -462,27 +483,14 @@ struct Pi0EtaToGammaGamma {
462483 float openingAngle1 = std::acos (photon1.Vect ().Dot (photon3.Vect ()) / (photon1.P () * photon3.P ()));
463484 float openingAngle2 = std::acos (photon2.Vect ().Dot (photon3.Vect ()) / (photon2.P () * photon3.P ()));
464485
465- int iCellID_photon1 = 0 ;
466- int iCellID_photon2 = 0 ;
467-
468- try {
469- iCellID_photon1 = o2::emcal::Geometry::GetInstance ()->GetAbsCellIdFromEtaPhi (photon1.Eta (), photon1.Phi ());
470- } catch (o2::emcal::InvalidPositionException& e) {
471- iCellID_photon1 = -1 ;
472- }
473- try {
474- iCellID_photon2 = o2::emcal::Geometry::GetInstance ()->GetAbsCellIdFromEtaPhi (photon2.Eta (), photon2.Phi ());
475- } catch (o2::emcal::InvalidPositionException& e) {
476- iCellID_photon2 = -1 ;
477- }
478-
479486 if (openingAngle1 > emccuts.minOpenAngle && abs (mother1.Rapidity ()) < maxY && iCellID_photon1 > 0 ) {
480487 fRegistry .fill (HIST (" Pair/rotation/hs" ), mother1.M (), mother1.Pt (), eventWeight);
481488 }
482489 if (openingAngle2 > emccuts.minOpenAngle && abs (mother2.Rapidity ()) < maxY && iCellID_photon2 > 0 ) {
483490 fRegistry .fill (HIST (" Pair/rotation/hs" ), mother2.M (), mother2.Pt (), eventWeight);
484491 }
485492 }
493+ return ;
486494 }
487495
488496 SliceCache cache;
0 commit comments