Skip to content

Commit 31e5fe0

Browse files
JimunLeejimun_lee
andauthored
[PWGJE] phiInJets.cxx : Adding a configuration to adjust the mass range and changhing the type of histogram (AliceO2Group#10879)
Co-authored-by: jimun_lee <[email protected]>
1 parent 3761380 commit 31e5fe0

File tree

1 file changed

+103
-30
lines changed

1 file changed

+103
-30
lines changed

PWGJE/Tasks/phiInJets.cxx

Lines changed: 103 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include <TLorentzVector.h>
2121
#include <TVector2.h>
2222
#include <algorithm>
23-
2423
#include <iostream>
2524

25+
#include "TRandom.h"
2626
#include "Framework/ASoA.h"
2727
#include "Framework/AnalysisDataModel.h"
2828
#include "Framework/AnalysisTask.h"
@@ -83,10 +83,15 @@ struct phiInJets {
8383
Configurable<bool> cfgMCRecHists{"cfgMCRecHists", false, "Enables MCRecHists"};
8484
Configurable<bool> cfgMCRecMBHists{"cfgMCRecMBHists", false, "Enables MCRec MB Hists"};
8585
Configurable<bool> cfgMCRecInsideHists{"cfgMCRecInsideHists", false, "Enables MCRec Inside Hists"};
86+
Configurable<bool> cfgMCRecRotationalHists{"cfgMCRecRotationalHists", false, "Enables MCRotational Hists"};
8687
Configurable<bool> cfgMCGenHists{"cfgMCGenHists", false, "Enables MCGenHists"};
8788
Configurable<bool> cfgMCGenMATCHEDHists{"cfgMCGenMATCHEDHists", false, "Enables MCGenMATCHEDHists"};
8889
Configurable<bool> cfgMCRecMATCHEDHists{"cfgMCRecMATCHEDHists", false, "Enables MCRecMATCHEDHists"};
8990

91+
Configurable<int> cfgMinvNBins{"cfgMinvNBins", 500, "Number of bins for Minv axis"};
92+
Configurable<float> cfgMinvMin{"cfgMinvMin", 0.75, "Minimum Minv value"};
93+
Configurable<float> cfgMinvMax{"cfgMinvMax", 1.25, "Maximum Minv value"};
94+
9095
// CONFIG DONE
9196
///////////////////////////////////////// //INIT
9297

@@ -98,7 +103,7 @@ struct phiInJets {
98103
const AxisSpec axisEta{30, -1.5, +1.5, "#eta"};
99104
const AxisSpec axisPhi{200, -1, +7, "#phi"};
100105
const AxisSpec axisPt{200, 0, +200, "#pt"};
101-
const AxisSpec MinvAxis = {500, 0.75, 1.25};
106+
const AxisSpec MinvAxis = {cfgMinvNBins, cfgMinvMin, cfgMinvMax};
102107
const AxisSpec PtAxis = {200, 0, 20.0};
103108
const AxisSpec MultAxis = {100, 0, 100};
104109
const AxisSpec dRAxis = {100, 0, 100};
@@ -131,16 +136,16 @@ struct phiInJets {
131136
JEhistos.add("FJptHistogram", "FJptHistogram", kTH1F, {axisPt});
132137
JEhistos.add("nJetsPerEvent", "nJetsPerEvent", kTH1F, {{10, 0.0, 10.0}});
133138

134-
JEhistos.add("hUSS", "hUSS", kTH3F, {dRAxis, PtAxis, MinvAxis});
139+
JEhistos.add("hUSS", "hUSS", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
135140
JEhistos.add("hUSS_1D", "hUSS_1D", kTH1F, {MinvAxis});
136141
JEhistos.add("hUSS_1D_2_3", "hUSS_1D_2_3", kTH1F, {MinvAxis});
137-
JEhistos.add("hLSS", "hLSS", kTH3F, {dRAxis, PtAxis, MinvAxis});
142+
JEhistos.add("hLSS", "hLSS", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
138143
JEhistos.add("hLSS_1D", "hLSS_1D", kTH1F, {MinvAxis});
139144
JEhistos.add("hLSS_1D_2_3", "hLSS_1D_2_3", kTH1F, {MinvAxis});
140-
JEhistos.add("hUSS_INSIDE", "hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
145+
JEhistos.add("hUSS_INSIDE", "hUSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
141146
JEhistos.add("hUSS_INSIDE_1D", "hUSS_INSIDE_1D", kTH1F, {MinvAxis});
142147
JEhistos.add("hUSS_INSIDE_1D_2_3", "hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis});
143-
JEhistos.add("hLSS_INSIDE", "hLSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
148+
JEhistos.add("hLSS_INSIDE", "hLSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
144149
JEhistos.add("hLSS_INSIDE_1D", "hLSS_INSIDE_1D", kTH1F, {MinvAxis});
145150
JEhistos.add("hLSS_INSIDE_1D_2_3", "hLSS_INSIDE_1D_2_3", kTH1F, {MinvAxis});
146151
}
@@ -170,22 +175,32 @@ struct phiInJets {
170175
// used for Minv closure tests
171176
// MB
172177
if (cfgMCRecMBHists) {
173-
JEhistos.add("hMCRec_hUSS", "hMCRec_hUSS", kTH3F, {dRAxis, PtAxis, MinvAxis});
174-
JEhistos.add("hMCRec_hLSS", "hMCRec_hLSS", kTH3F, {dRAxis, PtAxis, MinvAxis});
175-
JEhistos.add("hMCRecTrue_hUSS", "hMCRecTrue_hUSS", kTH3F, {dRAxis, PtAxis, MinvAxis});
176-
JEhistos.add("hMCRecTrue_hLSS", "hMCRecTrue_hLSS", kTH3F, {dRAxis, PtAxis, MinvAxis});
178+
JEhistos.add("hMCRec_hUSS", "hMCRec_hUSS", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
179+
JEhistos.add("hMCRec_hLSS", "hMCRec_hLSS", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
180+
JEhistos.add("hMCRecTrue_hUSS", "hMCRecTrue_hUSS", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
181+
JEhistos.add("hMCRecTrue_hLSS", "hMCRecTrue_hLSS", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
182+
JEhistos.add("hMCRec_R_distribution", "hMCRec_R_distribution", kTH1F, {{100, 0.0, 2 * TMath::Pi()}});
183+
JEhistos.add("hMCRec_dPhi_distribution", "hMCRec_dPhi_distribution", kTH1F, {{80, -5.0, 7.0}});
184+
JEhistos.add("hMCRec_dEta_distribution", "hMCRec_dEta_distribution", kTH1F, {{100, -2.0, 2.0}});
177185
}
178-
// INSIDE
179-
if (cfgMCRecInsideHists) {
180-
JEhistos.add("hMCRec_hUSS_INSIDE", "hMCRec_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
181-
JEhistos.add("hMCRec_hLSS_INSIDE", "hMCRec_hLSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
182-
JEhistos.add("hMCRecTrue_hUSS_INSIDE", "hMCRecTrue_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
183-
JEhistos.add("hMCRecTrue_hLSS_INSIDE", "hMCRecTrue_hLSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
184-
JEhistos.add("hMCRec_nonmatch_hUSS_INSIDE", "hMCRec_nonmatch_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
185-
JEhistos.add("hMCRec_nonmatch_hUSS_INSIDE_1D", "hMCRec_nonmatch_hUSS_INSIDE_1D", kTH1F, {MinvAxis});
186-
JEhistos.add("hMCRec_nonmatch_hUSS_INSIDE_1D_2_3", "hMCRec_nonmatch_hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis});
186+
if (cfgMCRecRotationalHists) {
187+
JEhistos.add("hMCRec_hUSS_Rotational", "hMCRec_hUSS_Rotational", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
188+
JEhistos.add("hMCRec_R_Rotation_distribution", "hMCRec_R_Rotation_distribution", HistType::kTH1F, {{100, 0.0, 2 * TMath::Pi()}});
189+
JEhistos.add("hMCRec_dPhi_rot_distribution", "hMCRec_dPhi_rot_distribution", kTH1F, {{80, -5.0, 7.0}});
190+
JEhistos.add("hMCRec_dEta_rot_distribution", "hMCRec_dEta_rot_distribution", kTH1F, {{100, -2.0, 2.0}});
191+
JEhistos.add("hMCRec_dEta_qa_rot_distribution", "hMCRec_dEta_qa_rot_distribution", kTH1F, {{100, -4.0, 2.0}});
187192
}
188193
}
194+
// INSIDE
195+
if (cfgMCRecInsideHists) {
196+
JEhistos.add("hMCRec_hUSS_INSIDE", "hMCRec_hUSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
197+
JEhistos.add("hMCRec_hLSS_INSIDE", "hMCRec_hLSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
198+
JEhistos.add("hMCRecTrue_hUSS_INSIDE", "hMCRecTrue_hUSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
199+
JEhistos.add("hMCRecTrue_hLSS_INSIDE", "hMCRecTrue_hLSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
200+
JEhistos.add("hMCRec_nonmatch_hUSS_INSIDE", "hMCRec_nonmatch_hUSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
201+
JEhistos.add("hMCRec_nonmatch_hUSS_INSIDE_1D", "hMCRec_nonmatch_hUSS_INSIDE_1D", kTH1F, {MinvAxis});
202+
JEhistos.add("hMCRec_nonmatch_hUSS_INSIDE_1D_2_3", "hMCRec_nonmatch_hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis});
203+
}
189204

190205
if (cfgMCGenHists) {
191206
JEhistos.add("nEvents_MCGen", "nEvents_MCGen", kTH1F, {{4, 0.0, 4.0}});
@@ -207,7 +222,7 @@ struct phiInJets {
207222
JEhistos.add("hMCTrue_nonmatch_hUSS_INSIDE_pt_v_eta", "hMCTrue_nonmatch_hUSS_INSIDE_pt_v_eta", kTH2F, {PtAxis, axisEta});
208223
JEhistos.add("JetVsPhi_GEN", "JetVsPhi_GEN", kTH2F, {{4000, 0., 200.}, {200, 0, 20.0}});
209224

210-
JEhistos.add("hMCTrue_nonmatch_hUSS_INSIDE", "hMCTrue_nonmatch_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
225+
JEhistos.add("hMCTrue_nonmatch_hUSS_INSIDE", "hMCTrue_nonmatch_hUSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
211226
JEhistos.add("hMCTrue_nonmatch_hUSS_INSIDE_1D", "hMCTrue_nonmatch_hUSS_INSIDE_1D", kTH1F, {MinvAxis});
212227
JEhistos.add("hMCTrue_nonmatch_hUSS_INSIDE_1D_2_3", "hMCTrue_nonmatch_hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis});
213228
}
@@ -225,7 +240,7 @@ struct phiInJets {
225240
JEhistos.add("RespGen_Matrix_MATCHED_rand0", "RespGen_Matrix_MATCHED_rand0", HistType::kTHnSparseD, {PtAxis, axisPt, PtAxis, axisPt}); // REC(Phi,Jet), GEN(Phi,Jet)
226241
JEhistos.add("RespGen_Matrix_MATCHED_rand1", "RespGen_Matrix_MATCHED_rand1", HistType::kTHnSparseD, {PtAxis, axisPt, PtAxis, axisPt}); // REC(Phi,Jet), GEN(Phi,Jet)
227242

228-
JEhistos.add("hMCTrue_hUSS_INSIDE", "hMCTrue_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
243+
JEhistos.add("hMCTrue_hUSS_INSIDE", "hMCTrue_hUSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
229244
JEhistos.add("hMCTrue_hUSS_INSIDE_1D", "hMCTrue_hUSS_INSIDE_1D", kTH1F, {MinvAxis});
230245
JEhistos.add("hMCTrue_hUSS_INSIDE_1D_2_3", "hMCTrue_hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis});
231246
}
@@ -244,7 +259,7 @@ struct phiInJets {
244259
JEhistos.add("2DRecToGen", "2DRecToGen", kTH2F, {PtAxis, axisPt});
245260
JEhistos.add("2DRecToGen_constrained", "2DRecToGen_constrained", kTH2F, {PtAxis, axisPt});
246261

247-
JEhistos.add("hMCRec_hUSS_INSIDE", "hMCRec_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis});
262+
JEhistos.add("hMCRec_hUSS_INSIDE", "hMCRec_hUSS_INSIDE", kTHnSparseF, {dRAxis, PtAxis, MinvAxis});
248263
JEhistos.add("hMCRec_hUSS_INSIDE_1D", "hMCRec_hUSS_INSIDE_1D", kTH1F, {MinvAxis});
249264
JEhistos.add("hMCRec_hUSS_INSIDE_1D_2_3", "hMCRec_hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis});
250265
}
@@ -417,7 +432,9 @@ struct phiInJets {
417432
template <bool IsMC, bool IsMix, typename TracksType, typename JetType>
418433
int minvReconstruction(double mult, const TracksType& trk1, const TracksType& trk2, const JetType& jets)
419434
{
435+
420436
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
437+
//====================================================
421438

422439
if (!trackSelection(trk1) || !trackSelection(trk2))
423440
return -1;
@@ -441,6 +458,8 @@ struct phiInJets {
441458

442459
lResonance = lDecayDaughter1 + lDecayDaughter2;
443460

461+
//==================================================
462+
444463
if (std::abs(lResonance.Eta()) > cfgtrkMaxEta)
445464
return -1;
446465

@@ -475,10 +494,11 @@ struct phiInJets {
475494
}
476495
}
477496

478-
if (cfgSingleJet)
479-
if (goodjets > 1)
497+
if (cfgSingleJet) {
498+
if (goodjets > 1) {
480499
jetpt = DistinguishJets<JetType>(jets, lResonance);
481-
500+
}
501+
}
482502
/////////////////////////////////////////////////////////////////////////////
483503
// Fill inside Jet
484504
if (jetFlag) {
@@ -659,7 +679,7 @@ struct phiInJets {
659679
double RealPhiCandWithJet = 0;
660680
double RealPhiCandInJet = 0;
661681
//============
662-
// Track Eff
682+
// Track Effl
663683
for (const auto& track : tracks) {
664684
auto originalTrack = track.track_as<myCompleteTracks>();
665685
if (!trackSelection(originalTrack))
@@ -697,14 +717,58 @@ struct phiInJets {
697717
if (fabs(originalTrack.eta()) > cfgtrkMaxEta || fabs(originalTrack2.eta()) > cfgtrkMaxEta)
698718
continue;
699719

700-
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
720+
double dPhi = TVector2::Phi_mpi_pi(originalTrack.phi() - originalTrack2.phi());
721+
double dEta = originalTrack.eta() - originalTrack2.eta();
722+
JEhistos.fill(HIST("hMCRec_dPhi_distribution"), dPhi);
723+
JEhistos.fill(HIST("hMCRec_dEta_distribution"), dEta);
724+
725+
double dR = TMath::Sqrt(dPhi * dPhi + dEta * dEta);
726+
double dR_rot = 0;
727+
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance, lRotationalTrack, lRotationalResonance;
701728
lDecayDaughter1.SetXYZM(originalTrack.px(), originalTrack.py(), originalTrack.pz(), massKa);
702-
if (!cfgIsKstar)
729+
//-----------------------------------------------------------------------
730+
731+
TRandom* trand = new TRandom();
732+
double shift = trand->Uniform(TMath::Pi() - TMath::Pi() / 10.0, TMath::Pi() + TMath::Pi() / 10.0);
733+
// double shift = TMath::Pi();
734+
735+
if (!cfgIsKstar) {
703736
lDecayDaughter2.SetXYZM(originalTrack2.px(), originalTrack2.py(), originalTrack2.pz(), massKa);
704-
else
737+
} else {
705738
lDecayDaughter2.SetXYZM(originalTrack2.px(), originalTrack2.py(), originalTrack2.pz(), massPi);
706-
lResonance = lDecayDaughter1 + lDecayDaughter2;
707739

740+
// double pTog = TMath::Sqrt(originalTrack2.px() * originalTrack2.px() + originalTrack2.py() * originalTrack2.py());
741+
// double Pxrot = pTog*TMath::Cos(originalTrack2.phi() + shift);
742+
// double Pyrot = pTog*TMath::Sin(originalTrack2.phi() + shift);
743+
744+
// if(gDebug){
745+
// double Ptrot = TMath::Sqrt(Pxrot*Pxrot + Pyrot*Pyrot);
746+
// if(TMath::Abs(Ptrot-pTog)>0.1) {
747+
// std::cout<<"We are jottettta"<<std::endl;
748+
// std::cout<<Ptrot-pTog<<std::endl;
749+
// }
750+
// }
751+
// lRotationalTrack.SetXYZM(Pxrot, Pyrot,originalTrack.pz(), massPi);
752+
lRotationalTrack = lDecayDaughter2;
753+
754+
// JEhistos.fill(HIST("hMCRec_Phi_Before_Shift"), lRotationalTrack.Phi());
755+
lRotationalTrack.RotateZ(shift);
756+
// JEhistos.fill(HIST("hMCRec_Phi_After_Shift"), lRotationalTrack.Phi());
757+
758+
double dPhi_rot = TVector2::Phi_mpi_pi(lDecayDaughter1.Phi() - lRotationalTrack.Phi());
759+
double dEta_rot = lDecayDaughter1.Eta() - lRotationalTrack.Eta();
760+
double dEta_rot_qa = TMath::Abs(lDecayDaughter2.Eta()) - TMath::Abs(lRotationalTrack.Eta());
761+
762+
dR_rot = TMath::Sqrt(dPhi_rot * dPhi_rot + dEta_rot * dEta_rot);
763+
764+
JEhistos.fill(HIST("hMCRec_dPhi_rot_distribution"), dPhi_rot);
765+
JEhistos.fill(HIST("hMCRec_dEta_rot_distribution"), dEta_rot);
766+
JEhistos.fill(HIST("hMCRec_dEta_qa_rot_distribution"), dEta_rot_qa);
767+
}
768+
//-----------------------------------------------------------------------
769+
lResonance = lDecayDaughter1 + lDecayDaughter2;
770+
if (cfgIsKstar)
771+
lRotationalResonance = lDecayDaughter1 + lRotationalTrack;
708772
if (fabs(lResonance.Eta()) > cfgtrkMaxEta)
709773
continue;
710774

@@ -717,6 +781,15 @@ struct phiInJets {
717781
if (cfgMCRecMBHists) {
718782
if (originalTrack.sign() * originalTrack2.sign() < 0) {
719783
JEhistos.fill(HIST("hMCRec_hUSS"), 1.0, lResonance.Pt(), lResonance.M());
784+
// normal R
785+
JEhistos.fill(HIST("hMCRec_R_distribution"), dR);
786+
787+
// switch because of memory
788+
if (cfgMCRecRotationalHists && cfgIsKstar) {
789+
JEhistos.fill(HIST("hMCRec_hUSS_Rotational"), 1.0, lRotationalResonance.Pt(), lResonance.M());
790+
// Rotational R
791+
JEhistos.fill(HIST("hMCRec_R_Rotation_distribution"), dR_rot);
792+
}
720793
} else if (originalTrack.sign() * originalTrack2.sign() > 0) {
721794
JEhistos.fill(HIST("hMCRec_hLSS"), 1.0, lResonance.Pt(), lResonance.M());
722795
}

0 commit comments

Comments
 (0)