Skip to content

Commit 376392c

Browse files
RafRaf11alibuild
andauthored
[PWGCF] FemtoDream: added event sphericity calculation (#12677)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent b9b7d7d commit 376392c

File tree

6 files changed

+74
-1184
lines changed

6 files changed

+74
-1184
lines changed

PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FemtoDreamCollisionSelection
4141
/// \param checkTrigger whether or not to check for the trigger alias
4242
/// \param trig Requested trigger alias
4343
/// \param checkOffline whether or not to check for offline selection criteria
44-
void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool addCheckOffline, bool checkRun3)
44+
void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool addCheckOffline, bool checkRun3, float minSphericity, float sphericityPtmin)
4545
{
4646
mCutsSet = true;
4747
mZvtxMax = zvtxMax;
@@ -50,6 +50,8 @@ class FemtoDreamCollisionSelection
5050
mCheckOffline = checkOffline;
5151
mAddCheckOffline = addCheckOffline;
5252
mCheckIsRun3 = checkRun3;
53+
mMinSphericity = minSphericity;
54+
mSphericityPtmin = sphericityPtmin;
5355
}
5456

5557
/// Initializes histograms for the task
@@ -66,6 +68,7 @@ class FemtoDreamCollisionSelection
6668
mHistogramRegistry->add("Event/MultNTracksPV", "; MultNTracksPV; Entries", kTH1F, {{200, 0, 200}});
6769
mHistogramRegistry->add("Event/MultNTracklets", "; MultNTrackslets; Entries", kTH1F, {{300, 0, 300}});
6870
mHistogramRegistry->add("Event/MultTPC", "; MultTPC; Entries", kTH1F, {{600, 0, 600}});
71+
mHistogramRegistry->add("Event/Sphericity", "; Sphericity; Entries", kTH1F, {{100, 0, 1}});
6972
}
7073

7174
/// Print some debug information
@@ -76,6 +79,8 @@ class FemtoDreamCollisionSelection
7679
LOG(info) << "Check trigger: " << mCheckTrigger;
7780
LOG(info) << "Trigger: " << mTrigger;
7881
LOG(info) << " Check offline: " << mCheckOffline;
82+
LOG(info) << "Min sphericity: " << mMinSphericity;
83+
LOG(info) << "Min Pt (sphericity): " << mSphericityPtmin;
7984
}
8085

8186
/// Check whether the collisions fulfills the specified selections
@@ -180,9 +185,65 @@ class FemtoDreamCollisionSelection
180185
/// \param tracks All tracks
181186
/// \return value of the sphericity of the event
182187
template <typename T1, typename T2>
183-
float computeSphericity(T1 const& /*col*/, T2 const& /*tracks*/)
188+
float computeSphericity(T1 const& col, T2 const& tracks)
184189
{
185-
return 2.f;
190+
double ptTot = 0.;
191+
double s00 = 0.; // elements of the sphericity matrix taken form EPJC72:2124
192+
double s01 = 0.;
193+
// double s10 = 0.;
194+
double s11 = 0.;
195+
196+
int numOfTracks = col.numContrib();
197+
if (numOfTracks < 3)
198+
return -9999.;
199+
200+
for (auto const& track : tracks) {
201+
double pt = track.pt();
202+
double eta = track.eta();
203+
double px = track.px();
204+
double py = track.py();
205+
if (TMath::Abs(pt) < mSphericityPtmin || TMath::Abs(eta) > 0.8) {
206+
continue;
207+
}
208+
209+
ptTot += pt;
210+
211+
s00 += px * px / pt;
212+
s01 += px * py / pt;
213+
// s10 = s01;
214+
s11 += py * py / pt;
215+
}
216+
217+
// normalize to total Pt to obtain a linear form:
218+
if (ptTot == 0.)
219+
return -9999.;
220+
s00 /= ptTot;
221+
s11 /= ptTot;
222+
s01 /= ptTot;
223+
224+
// Calculate the trace of the sphericity matrix:
225+
double T = s00 + s11;
226+
// Calculate the determinant of the sphericity matrix:
227+
double D = s00 * s11 - s01 * s01; // S10 = S01
228+
229+
// Calculate the eigenvalues of the sphericity matrix:
230+
double lambda1 = 0.5 * (T + std::sqrt(T * T - 4. * D));
231+
double lambda2 = 0.5 * (T - std::sqrt(T * T - 4. * D));
232+
233+
if ((lambda1 + lambda2) == 0.)
234+
return -9999.;
235+
236+
double spt = -1.;
237+
238+
if (lambda2 > lambda1) {
239+
spt = 2. * lambda1 / (lambda1 + lambda2);
240+
} else {
241+
spt = 2. * lambda2 / (lambda1 + lambda2);
242+
}
243+
244+
mHistogramRegistry->fill(HIST("Event/Sphericity"), spt);
245+
246+
return spt;
186247
}
187248

188249
private:
@@ -194,6 +255,8 @@ class FemtoDreamCollisionSelection
194255
bool mCheckIsRun3 = false; ///< Check if running on Pilot Beam
195256
triggerAliases mTrigger = kINT7; ///< Trigger to check for
196257
float mZvtxMax = 999.f; ///< Maximal deviation from nominal z-vertex (cm)
258+
float mMinSphericity = 0.f;
259+
float mSphericityPtmin = 0.f;
197260
};
198261
} // namespace o2::analysis::femtoDream
199262

PWGCF/FemtoDream/TableProducer/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ o2physics_add_dpl_workflow(femtodream-producer
1414
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils
1515
COMPONENT_NAME Analysis)
1616

17-
o2physics_add_dpl_workflow(femtodream-producer-withcascades
18-
SOURCES femtoDreamProducerTaskWithCascades.cxx
19-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils
20-
COMPONENT_NAME Analysis)
21-
2217
o2physics_add_dpl_workflow(femtodream-producer-reduced
2318
SOURCES femtoDreamProducerReducedTask.cxx
2419
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore

PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ struct femtoDreamProducerReducedTask {
7979
Configurable<int> ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"};
8080
Configurable<bool> ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"};
8181
Configurable<bool> ConfEvtAddOfflineCheck{"ConfEvtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"};
82+
Configurable<float> ConfEvtMinSphericity{"ConfEvtMinSphericity", 0.0f, "Evt sel: Min. sphericity of event"};
83+
Configurable<float> ConfEvtSphericityPtmin{"ConfEvtSphericityPtmin", 0.0f, "Evt sel: Min. Pt for sphericity calculation"};
8284

8385
Configurable<bool> ConfTrkRejectNotPropagated{"ConfTrkRejectNotPropagated", false, "True: reject not propagated tracks"};
8486

@@ -116,7 +118,7 @@ struct femtoDreamProducerReducedTask {
116118
int CutBits = 8 * sizeof(o2::aod::femtodreamparticle::cutContainerType);
117119
Registry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}});
118120

119-
colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value);
121+
colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value, ConfEvtMinSphericity.value, ConfEvtSphericityPtmin.value);
120122
colCuts.init(&qaRegistry);
121123

122124
trackCuts.setSelection(ConfTrkCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual);

PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ struct femtoDreamProducerTask {
131131
Configurable<bool> ConfEvtAddOfflineCheck{"ConfEvtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"};
132132
Configurable<bool> ConfIsActivateV0{"ConfIsActivateV0", true, "Activate filling of V0 into femtodream tables"};
133133
Configurable<bool> ConfIsActivateReso{"ConfIsActivateReso", false, "Activate filling of sl Resonances into femtodream tables"};
134+
Configurable<float> ConfEvtMinSphericity{"ConfEvtMinSphericity", 0.0f, "Evt sel: Min. sphericity of event"};
135+
Configurable<float> ConfEvtSphericityPtmin{"ConfEvtSphericityPtmin", 0.0f, "Evt sel: Min. Pt for sphericity calculation"};
134136

135137
Configurable<bool> ConfTrkRejectNotPropagated{"ConfTrkRejectNotPropagated", false, "True: reject not propagated tracks"};
136138
// Configurable<bool> ConfRejectITSHitandTOFMissing{ "ConfRejectITSHitandTOFMissing", false, "True: reject if neither ITS hit nor TOF timing satisfied"};
@@ -270,7 +272,7 @@ struct femtoDreamProducerTask {
270272

271273
rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, false, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad);
272274

273-
colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value);
275+
colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value, ConfEvtMinSphericity.value, ConfEvtSphericityPtmin.value);
274276
colCuts.init(&qaRegistry);
275277

276278
trackCuts.setSelection(ConfTrkCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual);

0 commit comments

Comments
 (0)