5151#include < array>
5252#include < cmath>
5353#include < cstdlib>
54+ #include < string>
5455#include < vector>
5556
5657using namespace o2 ;
5758using namespace o2 ::framework;
5859using namespace o2 ::framework::expressions;
5960using namespace o2 ::soa;
61+ using namespace o2 ::aod::rctsel;
6062// using namespace o2::constants::physics;
6163using std::array;
6264
@@ -67,6 +69,16 @@ struct HigherMassResonances {
6769 HistogramRegistry hglue{" hglueball" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
6870 HistogramRegistry hMChists{" hMChists" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
6971
72+ struct RCTCut : ConfigurableGroup {
73+ Configurable<bool > requireRCTFlagChecker{" requireRCTFlagChecker" , true , " Check event quality in run condition table" };
74+ Configurable<std::string> cfgEvtRCTFlagCheckerLabel{" cfgEvtRCTFlagCheckerLabel" , " CBT_hadronPID" , " Evt sel: RCT flag checker label" };
75+ Configurable<bool > cfgEvtRCTFlagCheckerZDCCheck{" cfgEvtRCTFlagCheckerZDCCheck" , false , " Evt sel: RCT flag checker ZDC check" };
76+ Configurable<bool > cfgEvtRCTFlagCheckerLimitAcceptAsBad{" cfgEvtRCTFlagCheckerLimitAcceptAsBad" , true , " Evt sel: RCT flag checker treat Limited Acceptance As Bad" };
77+
78+ RCTFlagsChecker rctChecker;
79+ };
80+ RCTCut rctCut;
81+
7082 struct : ConfigurableGroup {
7183 // PID and QA
7284 Configurable<bool > qAv0{" qAv0" , false , " qAv0" };
@@ -123,6 +135,7 @@ struct HigherMassResonances {
123135 ConfigurableAxis binsCent{" binsCent" , {VARIABLE_WIDTH, 0 ., 5 ., 10 ., 30 ., 50 ., 70 ., 100 ., 110 ., 150 .}, " Binning of the centrality axis" };
124136
125137 // Configurable for MC
138+ Configurable<bool > isMC{" isMC" , false , " Is MC" };
126139 Configurable<bool > allGenCollisions{" allGenCollisions" , true , " To fill all generated collisions for the signal loss calculations" };
127140 Configurable<bool > cTVXEvsel{" cTVXEvsel" , true , " Triggger selection" };
128141 Configurable<bool > avoidsplitrackMC{" avoidsplitrackMC" , false , " avoid split track in MC" };
@@ -145,23 +158,16 @@ struct HigherMassResonances {
145158 Configurable<int > tpcCrossedrows{" tpcCrossedrows" , 70 , " TPC crossed rows" };
146159 Configurable<float > tpcCrossedrowsOverfcls{" tpcCrossedrowsOverfcls" , 0.8 , " TPC crossed rows over findable clusters" };
147160
148- // Mass and pT axis as configurables
149- Configurable<float > cPtMin{" cPtMin" , 0 .0f , " Minimum pT" };
150- Configurable<float > cPtMax{" cPtMax" , 30 .0f , " Maximum pT" };
151- Configurable<int > cPtBins{" cPtBins" , 300 , " Number of pT bins" };
152- Configurable<float > cMassMin{" cMassMin" , 0 .9f , " Minimum mass of glueball" };
153- Configurable<float > cMassMax{" cMassMax" , 3 .0f , " Maximum mass of glueball" };
154- Configurable<int > cMassBins{" cMassBins" , 210 , " Number of mass bins for glueball" };
155- Configurable<float > ksMassMin{" ksMassMin" , 0 .45f , " Minimum mass of K0s" };
156- Configurable<float > ksMassMax{" ksMassMax" , 0 .55f , " Maximum mass of K0s" };
157- Configurable<int > ksMassBins{" ksMassBins" , 200 , " Number of mass bins for K0s" };
161+ // // Mass and pT axis as configurables
158162 Configurable<int > rotationalCut{" rotationalCut" , 10 , " Cut value (Rotation angle pi - pi/cut and pi + pi/cut)" };
159163 ConfigurableAxis configThnAxisPOL{" configThnAxisPOL" , {20 , -1.0 , 1.0 }, " Costheta axis" };
160164 ConfigurableAxis configThnAxisPhi{" configThnAxisPhi" , {70 , 0 .0f , 7 .0f }, " Phi axis" }; // 0 to 2pi
165+ ConfigurableAxis ksMassBins{" ksMassBins" , {200 , 0 .45f , 0 .55f }, " K0s invariant mass axis" };
166+ ConfigurableAxis cMassBins{" cMassBins" , {200 , 0 .9f , 3 .0f }, " Glueball invariant mass axis" };
167+ ConfigurableAxis cPtBins{" cPtBins" , {200 , 0 .0f , 20 .0f }, " Glueball pT axis" };
161168 // ConfigurableAxis axisdEdx{"axisdEdx", {20000, 0.0f, 200.0f}, "dE/dx (a.u.)"};
162169 // ConfigurableAxis axisPtfordEbydx{"axisPtfordEbydx", {2000, 0, 20}, "pT (GeV/c)"};
163170 // ConfigurableAxis axisMultdist{"axisMultdist", {3500, 0, 70000}, "Multiplicity distribution"};
164- // ConfigurableAxis occupancyBins{"occupancyBins", {VARIABLE_WIDTH, 0.0, 100, 500, 600, 1000, 1100, 1500, 1600, 2000, 2100, 2500, 2600, 3000, 3100, 3500, 3600, 4000, 4100, 4500, 4600, 5000, 5100, 9999}, "Binning: occupancy axis"};
165171 } config;
166172
167173 // Service<o2::framework::O2DatabasePDG> PDGdatabase;
@@ -180,16 +186,19 @@ struct HigherMassResonances {
180186
181187 void init (InitContext const &)
182188 {
189+ rctCut.rctChecker .init (
190+ rctCut.cfgEvtRCTFlagCheckerLabel ,
191+ rctCut.cfgEvtRCTFlagCheckerZDCCheck ,
192+ rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad );
193+
183194 // Axes
184- AxisSpec k0ShortMassAxis = {config.ksMassBins , config. ksMassMin , config. ksMassMax , " #it{M}_{inv} [GeV/#it{c}^{2}]" };
185- AxisSpec glueballMassAxis = {config.cMassBins , config. cMassMin , config. cMassMax , " #it{M}_{inv} [GeV/#it{c}^{2}]" };
195+ AxisSpec k0ShortMassAxis = {config.ksMassBins , " #it{M}_{inv} [GeV/#it{c}^{2}]" };
196+ AxisSpec glueballMassAxis = {config.ksMassBins , " #it{M}_{inv} [GeV/#it{c}^{2}]" };
186197 AxisSpec vertexZAxis = {60 , -15 .f , 15 .f , " vrtx_{Z} [cm]" }; // for histogram
187- AxisSpec ptAxis = {config.cPtBins , config.cPtMin , config.cPtMax , " #it{p}_{T} (GeV/#it{c})" };
188- // AxisSpec multiplicityAxis = {110, 0.0f, 150.0f, "Multiplicity Axis"};
198+ AxisSpec ptAxis = {config.cPtBins , " #it{p}_{T} (GeV/#it{c})" };
189199 AxisSpec multiplicityAxis = {config.binsCent , " Multiplicity Axis" };
190200 AxisSpec thnAxisPOL{config.configThnAxisPOL , " Configurabel theta axis" };
191201 AxisSpec thnAxisPhi = {config.configThnAxisPhi , " Configurabel phi axis" }; // 0 to 2pi
192- // AxisSpec occupancyAxis = {occupancyBins, "Occupancy [-40,100]"};
193202
194203 // THnSparses
195204 std::array<int , 4 > sparses = {config.activateTHnSparseCosThStarHelicity , config.activateTHnSparseCosThStarProduction , config.activateTHnSparseCosThStarBeam , config.activateTHnSparseCosThStarRandom };
@@ -293,27 +302,28 @@ struct HigherMassResonances {
293302 // }
294303
295304 // For MC
296- hMChists.add (" events_check" , " No. of events in the generated MC" , kTH1I , {{20 , 0 , 20 }});
297- hMChists.add (" events_checkrec" , " No. of events in the reconstructed MC" , kTH1I , {{20 , 0 , 20 }});
298- hMChists.add (" Genf1710" , " Gen f_{0}(1710)" , kTHnSparseF , {multiplicityAxis, ptAxis});
299- hMChists.add (" Recf1710_pt1" , " Rec f_{0}(1710) p_{T}" , kTHnSparseF , {multiplicityAxis, ptAxis, glueballMassAxis});
300- hMChists.add (" Recf1710_pt2" , " Rec f_{0}(1710) p_{T}" , kTHnSparseF , {multiplicityAxis, ptAxis, glueballMassAxis});
301- hMChists.add (" Recf1710_p" , " Rec f_{0}(1710) p" , kTH1F , {ptAxis});
302- hMChists.add (" h1Recsplit" , " Rec p_{T}2" , kTH1F , {ptAxis});
303-
304- hMChists.add (" Recf1710_mass" , " Rec f_{0}(1710) mass" , kTH1F , {glueballMassAxis});
305- hMChists.add (" Genf1710_mass" , " Gen f_{0}(1710) mass" , kTH1F , {glueballMassAxis});
306- hMChists.add (" GenEta" , " Gen Eta" , kTHnSparseF , {ptAxis, {100 , -1 .0f , 1 .0f }});
307- hMChists.add (" GenPhi" , " Gen Phi" , kTH1F , {{70 , -3 .5f , 3 .5f }});
308- hMChists.add (" GenRapidity" , " Gen Rapidity" , kTHnSparseF , {ptAxis, {100 , -1 .0f , 1 .0f }});
309- hMChists.add (" RecEta" , " Rec Eta" , kTH1F , {{100 , -1 .0f , 1 .0f }});
310- hMChists.add (" RecPhi" , " Rec Phi" , kTH1F , {{70 , 0 .0f , 7 .0f }});
311- hMChists.add (" RecRapidity" , " Rec Rapidity" , kTH1F , {{100 , -1 .0f , 1 .0f }});
312- hMChists.add (" MC_mult" , " Multiplicity in MC" , kTH1F , {multiplicityAxis});
313- hMChists.add (" MC_mult_after_event_sel" , " Multiplicity in MC" , kTH1F , {multiplicityAxis});
314- // hMChists.add("GenPx", "Gen Px", kTH1F, {{100, -10.0f, 10.0f}});
315- // hMChists.add("GenPy", "Gen Py", kTH1F, {{100, -10.0f, 10.0f}});
316- // hMChists.add("GenPz", "Gen Pz", kTH1F, {{100, -10.0f, 10.0f}});
305+ if (config.isMC ) {
306+ hMChists.add (" events_check" , " No. of events in the generated MC" , kTH1I , {{20 , 0 , 20 }});
307+ hMChists.add (" events_checkrec" , " No. of events in the reconstructed MC" , kTH1I , {{20 , 0 , 20 }});
308+ hMChists.add (" Genf1710" , " Gen f_{0}(1710)" , kTHnSparseF , {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
309+ hMChists.add (" Recf1710_pt1" , " Rec f_{0}(1710) p_{T}" , kTHnSparseF , {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
310+ hMChists.add (" Recf1710_pt2" , " Rec f_{0}(1710) p_{T}" , kTHnSparseF , {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
311+ // hMChists.add("Recf1710_p", "Rec f_{0}(1710) p", kTH1F, {ptAxis});
312+ hMChists.add (" h1Recsplit" , " Rec p_{T}2" , kTH1F , {ptAxis});
313+ // hMChists.add("Recf1710_mass", "Rec f_{0}(1710) mass", kTH1F, {glueballMassAxis});
314+ // hMChists.add("Genf1710_mass", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis});
315+ hMChists.add (" GenEta" , " Gen Eta" , kTHnSparseF , {ptAxis, {100 , -1 .0f , 1 .0f }});
316+ hMChists.add (" GenPhi" , " Gen Phi" , kTH1F , {{70 , -3 .5f , 3 .5f }});
317+ hMChists.add (" GenRapidity" , " Gen Rapidity" , kTHnSparseF , {ptAxis, {100 , -1 .0f , 1 .0f }});
318+ hMChists.add (" RecEta" , " Rec Eta" , kTH1F , {{100 , -1 .0f , 1 .0f }});
319+ hMChists.add (" RecPhi" , " Rec Phi" , kTH1F , {{70 , 0 .0f , 7 .0f }});
320+ hMChists.add (" RecRapidity" , " Rec Rapidity" , kTH1F , {{100 , -1 .0f , 1 .0f }});
321+ hMChists.add (" MC_mult" , " Multiplicity in MC" , kTH1F , {multiplicityAxis});
322+ hMChists.add (" MC_mult_after_event_sel" , " Multiplicity in MC" , kTH1F , {multiplicityAxis});
323+ // hMChists.add("GenPx", "Gen Px", kTH1F, {{100, -10.0f, 10.0f}});
324+ // hMChists.add("GenPy", "Gen Py", kTH1F, {{100, -10.0f, 10.0f}});
325+ // hMChists.add("GenPz", "Gen Pz", kTH1F, {{100, -10.0f, 10.0f}});
326+ }
317327 }
318328
319329 template <typename Collision>
@@ -699,6 +709,10 @@ struct HigherMassResonances {
699709 return ;
700710 }
701711
712+ if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker (collision)) {
713+ return ;
714+ }
715+
702716 // auto occupancyNumber = collision.trackOccupancyInTimeRange();
703717 // if (applyOccupancyCut && occupancyNumber < occupancyCut) {
704718 // return;
@@ -839,6 +853,13 @@ struct HigherMassResonances {
839853 // return;
840854 // }
841855
856+ if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker (c1)) {
857+ return ;
858+ }
859+ if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker (c2)) {
860+ return ;
861+ }
862+
842863 for (const auto & [t1, t2] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (tracks1, tracks2))) {
843864
844865 if (t1.size () == 0 || t2.size () == 0 ) {
@@ -963,7 +984,10 @@ struct HigherMassResonances {
963984 float multiplicityGen = 0.0 ;
964985 void processGen (aod::McCollision const & mcCollision, aod::McParticles const & mcParticles, const soa::SmallGroups<EventCandidatesMC>& collisions)
965986 {
966- TLorentzVector genvec;
987+ if (config.isMC == false ) {
988+ return ;
989+ }
990+ TLorentzVector lResonance_gen;
967991 hMChists.fill (HIST (" events_check" ), 0.5 );
968992 if (std::abs (mcCollision.posZ ()) < config.cutzvertex ) {
969993 hMChists.fill (HIST (" events_check" ), 1.5 );
@@ -1049,12 +1073,19 @@ struct HigherMassResonances {
10491073 if (std::abs (kCurrentDaughter .pdgCode ()) == 310 ) {
10501074 passKs = true ;
10511075 hMChists.fill (HIST (" events_check" ), 9.5 );
1076+ fourVecDau1 = ROOT::Math::PxPyPzMVector (kCurrentDaughter .px (), kCurrentDaughter .py (), kCurrentDaughter .pz (), o2::constants::physics::MassK0Short);
10521077 }
10531078 }
10541079 if (passKs) {
1055- genvec.SetPtEtaPhiE (mcParticle.pt (), mcParticle.eta (), mcParticle.phi (), mcParticle.e ());
1056- hMChists.fill (HIST (" Genf1710_mass" ), genvec.M ());
1057- hMChists.fill (HIST (" Genf1710" ), multiplicityGen, mcParticle.pt ());
1080+ lResonance_gen.SetPtEtaPhiE (mcParticle.pt (), mcParticle.eta (), mcParticle.phi (), mcParticle.e ());
1081+ fourVecMother = ROOT::Math::PxPyPzMVector (lResonance_gen.Px (), lResonance_gen.Py (), lResonance_gen.Pz (), lResonance_gen.M ());
1082+ ROOT::Math::Boost boost{fourVecMother.BoostToCM ()};
1083+ fourVecDauCM = boost (fourVecDau1); // boost the frame of daughter to the center of mass frame
1084+
1085+ auto helicity_gen = fourVecDau1.Vect ().Dot (fourVecDauCM.Vect ()) / (std::sqrt (fourVecDauCM.Vect ().Mag2 ()) * std::sqrt (fourVecDau1.Vect ().Mag2 ()));
1086+
1087+ hMChists.fill (HIST (" Genf1710" ), multiplicityGen, mcParticle.pt (), lResonance_gen.M (), helicity_gen);
1088+ // hMChists.fill(HIST("Genf1710_mass"), lResonance_gen.M());
10581089 }
10591090 }
10601091 }
@@ -1065,11 +1096,11 @@ struct HigherMassResonances {
10651096 std::vector<int > gindex1, gindex2;
10661097 void processRec (EventCandidatesMC::iterator const & collision, TrackCandidatesMC const &, V0TrackCandidatesMC const & V0s, aod::McParticles const &, aod::McCollisions const & /* mcCollisions*/ )
10671098 {
1099+ if (config.isMC == false ) {
1100+ return ;
1101+ }
10681102
10691103 TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
1070- // lDecayDaughter1.SetXYZM(0.0,0.0,0.0,0.0);
1071- // lDecayDaughter2.SetXYZM(0.0,0.0,0.0,0.0);
1072- // lDecayDaughter1.SetXYZM(0.0,0.0,0.0,0.0);
10731104 auto multiplicity = collision.centFT0C ();
10741105 hMChists.fill (HIST (" MC_mult" ), multiplicity);
10751106
@@ -1226,7 +1257,7 @@ struct HigherMassResonances {
12261257 pvec0 = std::array{v01.px (), v01.py (), v01.pz ()};
12271258 pvec1 = std::array{v02.px (), v02.py (), v02.pz ()};
12281259 auto arrMomrec = std::array{pvec0, pvec1};
1229- auto motherP = mothertrack1.p ();
1260+ // auto motherP = mothertrack1.p();
12301261 // auto motherE = mothertrack1.e();
12311262 // auto genMass = std::sqrt(motherE * motherE - motherP * motherP);
12321263 auto recMass = RecoDecay::m (arrMomrec, std::array{o2::constants::physics::MassK0Short, o2::constants::physics::MassK0Short});
@@ -1235,12 +1266,18 @@ struct HigherMassResonances {
12351266 lDecayDaughter1.SetXYZM (v01.px (), v01.py (), v01.pz (), o2::constants::physics::MassK0Short);
12361267 lDecayDaughter2.SetXYZM (v02.px (), v02.py (), v02.pz (), o2::constants::physics::MassK0Short);
12371268 lResonance = lDecayDaughter1 + lDecayDaughter2;
1238-
1239- hMChists.fill (HIST (" Recf1710_p" ), motherP);
1240- hMChists.fill (HIST (" Recf1710_mass" ), recMass);
1241- hMChists.fill (HIST (" Recf1710_pt1" ), multiplicity, mothertrack1.pt (), recMass);
1269+ // fourVecDau1, fourVecMother, fourVecDauCM
1270+ fourVecMother = ROOT::Math::PxPyPzMVector (lResonance.Px (), lResonance.Py (), lResonance.Pz (), lResonance.M ());
1271+ fourVecDau1 = ROOT::Math::PxPyPzMVector (lDecayDaughter1.Px (), lDecayDaughter1.Py (), lDecayDaughter1.Pz (), o2::constants::physics::MassK0Short);
1272+ ROOT::Math::Boost boost{fourVecMother.BoostToCM ()};
1273+ fourVecDauCM = boost (fourVecDau1); // boost the frame of daughter to the center of mass frame
1274+ auto helicity_rec = fourVecDau1.Vect ().Dot (fourVecDauCM.Vect ()) / (std::sqrt (fourVecDauCM.Vect ().Mag2 ()) * std::sqrt (fourVecDau1.Vect ().Mag2 ()));
1275+
1276+ // hMChists.fill(HIST("Recf1710_p"), motherP);
1277+ // hMChists.fill(HIST("Recf1710_mass"), recMass);
1278+ hMChists.fill (HIST (" Recf1710_pt1" ), multiplicity, mothertrack1.pt (), recMass, helicity_rec);
12421279 // hMChists.fill(HIST("Genf1710_mass"), genMass);
1243- hMChists.fill (HIST (" Recf1710_pt2" ), multiplicity, lResonance.Pt (), recMass);
1280+ hMChists.fill (HIST (" Recf1710_pt2" ), multiplicity, lResonance.Pt (), recMass, helicity_rec );
12441281
12451282 hMChists.fill (HIST (" RecRapidity" ), mothertrack1.y ());
12461283 hMChists.fill (HIST (" RecPhi" ), mothertrack1.phi ());
0 commit comments