2525#include " Framework/AnalysisTask.h"
2626#include " Framework/HistogramRegistry.h"
2727#include " Common/DataModel/EventSelection.h"
28+ #include " EMCALBase/Geometry.h"
2829#include " PWGJE/DataModel/EMCALClusters.h"
2930
3031using namespace o2 ;
@@ -49,6 +50,59 @@ struct Photon { // Struct to store photons (unique and ambiguous clusters that p
4950 float px, py, pz, pt;
5051};
5152
53+ // / \brief returns if cluster is too close to edge of EMCal (using rotation background method only for EMCal!)
54+ bool IsTooCloseToEdge (const int cellID, const int DistanceToBorder = 1 , emcal::Geometry* emcalGeom = nullptr )
55+ {
56+ if (DistanceToBorder <= 0 ) {
57+ return false ;
58+ }
59+ if (cellID < 0 ) {
60+ return true ;
61+ }
62+
63+ int iBadCell = -1 ;
64+
65+ // check distance to border in case the cell is okay
66+ auto [iSupMod, iMod, iPhi, iEta] = emcalGeom->GetCellIndex (cellID);
67+ auto [irow, icol] = emcalGeom->GetCellPhiEtaIndexInSModule (iSupMod, iMod, iPhi, iEta);
68+
69+ // Check rows/phi
70+ int iRowLast = 24 ;
71+ if (emcalGeom->GetSMType (iSupMod) == o2::emcal::EMCALSMType::EMCAL_HALF) {
72+ iRowLast /= 2 ; // 2/3 sm case
73+ } else if (emcalGeom->GetSMType (iSupMod) == o2::emcal::EMCALSMType::EMCAL_THIRD) {
74+ iRowLast /= 3 ; // 1/3 sm case
75+ } else if (emcalGeom->GetSMType (iSupMod) == o2::emcal::EMCALSMType::DCAL_EXT) {
76+ iRowLast /= 3 ; // 1/3 sm case
77+ }
78+
79+ if (irow < DistanceToBorder || (iRowLast - irow) <= DistanceToBorder) {
80+ iBadCell = 1 ;
81+ }
82+
83+ if (iBadCell > 0 ) {
84+ return true ;
85+ }
86+ return false ;
87+ }
88+
89+ bool isPhotonAccepted (Photon const & p, emcal::Geometry* emcalGeom = nullptr )
90+ {
91+ int cellID = 0 ;
92+ try {
93+ cellID = emcalGeom->GetAbsCellIdFromEtaPhi (p.eta , p.phi );
94+ if (IsTooCloseToEdge (cellID, 1 , emcalGeom))
95+ cellID = -1 ;
96+ } catch (o2::emcal::InvalidPositionException& e) {
97+ cellID = -1 ;
98+ }
99+
100+ if (cellID == -1 )
101+ return false ;
102+
103+ return true ;
104+ }
105+
52106struct Meson {
53107 Meson (Photon p1, Photon p2) : p1(p1), p2(p2)
54108 {
@@ -65,20 +119,26 @@ struct Meson {
65119struct EmcalGammaGammaBcWise {
66120 HistogramRegistry mHistManager {" EmcalGammaGammaBcWiseHistograms" };
67121
122+ Configurable<int > cfgClusterDefinition{" cfgClusterDefinition" , 13 , " Clusterizer to be selected, e.g. 13 for kV3MostSplitLowSeed" };
68123 Configurable<float > cfgMinClusterEnergy{" cfgMinClusterEnergy" , 0.7 , " Minimum energy of selected clusters (GeV)" };
69124 Configurable<float > cfgMinM02{" cfgMinM02" , 0.1 , " Minimum M02 of selected clusters" };
70125 Configurable<float > cfgMaxM02{" cfgMaxM02" , 0.7 , " Maximum M02 of selected clusters" };
71126 Configurable<float > cfgMinTime{" cfgMinTime" , -15 , " Minimum time of selected clusters (ns)" };
72127 Configurable<float > cfgMaxTime{" cfgMaxTime" , 15 , " Maximum time of selected clusters (ns)" };
128+ Configurable<float > cfgMinOpenAngle{" cfgMinOpenAngle" , 0.0202 , " Minimum opening angle between photons" };
73129
130+ Filter clusterDefinitionFilter = aod::emcalcluster::definition == cfgClusterDefinition;
74131 Filter energyFilter = aod::emcalcluster::energy > cfgMinClusterEnergy;
75132 Filter m02Filter = (aod::emcalcluster::nCells == 1 || (aod::emcalcluster::m02 > cfgMinM02 && aod::emcalcluster::m02 < cfgMaxM02));
76133 Filter timeFilter = (aod::emcalcluster::time > cfgMinTime && aod::emcalcluster::time < cfgMaxTime);
77134
78135 std::vector<Photon> mPhotons ;
79136
137+ emcal::Geometry* emcalGeom;
138+
80139 void init (InitContext const &)
81140 {
141+ emcalGeom = emcal::Geometry::GetInstanceFromRunNumber (300000 );
82142 mHistManager .add (" nBCs" , " Number of BCs (with (k)TVX);#bf{TVX triggered};#bf{#it{N}_{BCs}}" , HistType::kTH1F , {{3 , -0.5 , 2.5 }});
83143
84144 mHistManager .add (" nCollisionsVsClusters" , " Number of collisions vs number of clusters;N_{Collisions};N_{Clusters}" , HistType::kTH2F , {{4 , -0.5 , 3.5 }, {21 , -0.5 , 20.5 }});
@@ -149,6 +209,8 @@ struct EmcalGammaGammaBcWise {
149209 for (unsigned int ig1 = 0 ; ig1 < mPhotons .size (); ++ig1) {
150210 for (unsigned int ig2 = ig1 + 1 ; ig2 < mPhotons .size (); ++ig2) {
151211 // build meson from photons
212+ if (mPhotons [ig1].photon .Angle (mPhotons [ig2].photon .Vect ()) < cfgMinOpenAngle)
213+ continue ;
152214 Meson meson (mPhotons [ig1], mPhotons [ig2]);
153215 mHistManager .fill (HIST (" invMassVsPt" ), meson.m (), meson.pT ());
154216
@@ -171,6 +233,10 @@ struct EmcalGammaGammaBcWise {
171233 TLorentzVector lvRotationPhoton (mPhotons [ig].px , mPhotons [ig].py , mPhotons [ig].pz , mPhotons [ig].e );
172234 lvRotationPhoton.Rotate (constants::math::PIHalf, lvRotationPion);
173235 Photon rotPhoton (lvRotationPhoton.Eta (), lvRotationPhoton.Phi (), lvRotationPhoton.E ());
236+ if (!isPhotonAccepted (rotPhoton, emcalGeom))
237+ continue ;
238+ if (rotPhoton.photon .Angle (mPhotons [ig3].photon .Vect ()) < cfgMinOpenAngle)
239+ continue ;
174240 Meson mesonRotated (rotPhoton, mPhotons [ig3]);
175241 mHistManager .fill (HIST (" invMassVsPtBackground" ), mesonRotated.m (), mesonRotated.pT ());
176242 }
0 commit comments