Skip to content

Commit 20e3e5b

Browse files
authored
Casc producer now able to filter (#4888)
1 parent 859c35c commit 20e3e5b

3 files changed

Lines changed: 124 additions & 18 deletions

File tree

Analysis/Tasks/PWGLF/cascadefinder.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct cascadeprefilter {
9797
Configurable<int> mincrossedrows{"mincrossedrows", 70, "min crossed rows"};
9898
Configurable<float> dcav0topv{"dcav0topv", .1, "DCA V0 To PV"};
9999
Configurable<double> cospaV0{"cospaV0", .98, "CosPA V0"};
100+
Configurable<double> v0radius{"v0radius", 0.9, "v0radius"};
100101
Configurable<float> lambdamasswindow{"lambdamasswindow", .006, "Distance from Lambda mass"};
101102
Configurable<float> dcav0dau{"dcav0dau", .6, "DCA V0 Daughters"};
102103
Configurable<float> dcanegtopv{"dcanegtopv", .1, "DCA Neg To PV"};
@@ -143,6 +144,12 @@ struct cascadeprefilter {
143144
if (v0.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < dcav0topv) {
144145
continue;
145146
}
147+
if (v0.dcaV0daughters() > dcav0dau) {
148+
continue;
149+
}
150+
if (v0.v0radius() < v0radius) {
151+
continue;
152+
}
146153

147154
if (fabs(v0.mLambda() - 1.116) < lambdamasswindow) {
148155
cascGoodLambdas(v0.globalIndex(), v0.collisionId());

Analysis/Tasks/PWGLF/cascadeproducer.cxx

Lines changed: 109 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
// Any analysis should loop over the "CascData"
1818
// table as that table contains all information
1919
//
20+
// WARNING: adding filters to the producer IS NOT
21+
// equivalent to re-running the finders. This will only
22+
// ever produce *tighter* selection sections. It is your
23+
// responsibility to check if, by setting a loose filter
24+
// setting, you are going into a region in which no
25+
// candidates exist because the original indices were generated
26+
// using tigher selections.
27+
//
2028
// Comments, questions, complaints, suggestions?
2129
// Please write to:
2230
// david.dobrigkeit.chinellato@cern.ch
@@ -31,6 +39,8 @@
3139
#include "ReconstructionDataFormats/Track.h"
3240
#include "Analysis/RecoDecay.h"
3341
#include "Analysis/trackUtilities.h"
42+
#include "Analysis/TrackSelection.h"
43+
#include "Analysis/TrackSelectionTables.h"
3444
#include "Analysis/StrangenessTables.h"
3545

3646
#include <TFile.h>
@@ -51,6 +61,94 @@ using namespace o2::framework;
5161
using namespace o2::framework::expressions;
5262
using std::array;
5363

64+
namespace o2::aod
65+
{
66+
67+
namespace cascgood
68+
{
69+
DECLARE_SOA_INDEX_COLUMN_FULL(V0, v0, int, V0DataExt, "fV0Id");
70+
DECLARE_SOA_INDEX_COLUMN_FULL(Bachelor, bachelor, int, FullTracks, "fTracksID");
71+
DECLARE_SOA_INDEX_COLUMN(Collision, collision);
72+
} // namespace cascgood
73+
DECLARE_SOA_TABLE(CascGood, "AOD", "CASCGOOD", o2::soa::Index<>,
74+
cascgood::V0Id, cascgood::BachelorId,
75+
cascgood::CollisionId);
76+
} // namespace o2::aod
77+
78+
using FullTracksExt = soa::Join<aod::FullTracks, aod::TracksExtended>;
79+
80+
//This prefilter creates a skimmed list of good V0s to re-reconstruct so that
81+
//CPU is saved in case there are specific selections that are to be done
82+
//Note: more configurables, more options to be added as needed
83+
struct cascadeprefilterpairs {
84+
Configurable<int> mincrossedrows{"mincrossedrows", 70, "min crossed rows"};
85+
Configurable<float> dcav0topv{"dcav0topv", .1, "DCA V0 To PV"};
86+
Configurable<double> cospaV0{"cospaV0", .98, "CosPA V0"};
87+
Configurable<float> lambdamasswindow{"lambdamasswindow", .006, "Distance from Lambda mass"};
88+
Configurable<float> dcav0dau{"dcav0dau", .6, "DCA V0 Daughters"};
89+
Configurable<float> dcanegtopv{"dcanegtopv", .1, "DCA Neg To PV"};
90+
Configurable<float> dcapostopv{"dcapostopv", .1, "DCA Pos To PV"};
91+
Configurable<float> dcabachtopv{"dcabachtopv", .1, "DCA Bach To PV"};
92+
Configurable<bool> tpcrefit{"tpcrefit", 1, "demand TPC refit"};
93+
Configurable<double> v0radius{"v0radius", 0.9, "v0radius"};
94+
95+
Produces<aod::CascGood> cascgood;
96+
void process(aod::Collision const& collision, aod::V0DataExt const& V0s, aod::Cascades const& Cascades,
97+
soa::Join<aod::FullTracks, aod::TracksExtended> const& tracks)
98+
{
99+
for (auto& casc : Cascades) {
100+
//Single-track properties filter
101+
if (tpcrefit) {
102+
if (!(casc.v0().posTrack().flags() & 0x40)) {
103+
continue; //TPC refit
104+
}
105+
if (!(casc.v0().negTrack().flags() & 0x40)) {
106+
continue; //TPC refit
107+
}
108+
if (!(casc.bachelor().flags() & 0x40)) {
109+
continue; //TPC refit
110+
}
111+
}
112+
if (casc.v0().posTrack().tpcNClsCrossedRows() < mincrossedrows) {
113+
continue;
114+
}
115+
if (casc.v0().negTrack().tpcNClsCrossedRows() < mincrossedrows) {
116+
continue;
117+
}
118+
if (casc.bachelor().tpcNClsCrossedRows() < mincrossedrows) {
119+
continue;
120+
}
121+
if (casc.v0().posTrack_as<FullTracksExt>().dcaXY() < dcapostopv) {
122+
continue;
123+
}
124+
if (casc.v0().negTrack_as<FullTracksExt>().dcaXY() < dcanegtopv) {
125+
continue;
126+
}
127+
if (casc.bachelor_as<FullTracksExt>().dcaXY() < dcabachtopv) {
128+
continue;
129+
}
130+
131+
//V0 selections
132+
if (fabs(casc.v0_as<o2::aod::V0DataExt>().mLambda() - 1.116) > lambdamasswindow && fabs(casc.v0_as<o2::aod::V0DataExt>().mAntiLambda() - 1.116) > lambdamasswindow) {
133+
continue;
134+
}
135+
if (casc.v0_as<o2::aod::V0DataExt>().dcaV0daughters() > dcav0dau) {
136+
continue;
137+
}
138+
if (casc.v0_as<o2::aod::V0DataExt>().v0radius() < v0radius) {
139+
continue;
140+
}
141+
if (casc.v0_as<o2::aod::V0DataExt>().v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cospaV0) {
142+
continue;
143+
}
144+
if (casc.v0_as<o2::aod::V0DataExt>().dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < dcav0topv) {
145+
continue;
146+
}
147+
cascgood(casc.v0().globalIndex(), casc.bachelor().globalIndex(), casc.bachelor().collisionId());
148+
}
149+
}
150+
};
151+
54152
/// Cascade builder task: rebuilds cascades
55153
struct cascadeproducer {
56154
Produces<aod::CascData> cascdata;
@@ -62,21 +160,7 @@ struct cascadeproducer {
62160
Configurable<double> d_bz{"d_bz", -5.0, "bz field"};
63161
Configurable<double> d_UseAbsDCA{"d_UseAbsDCA", kTRUE, "Use Abs DCAs"};
64162

65-
/// Extracts dca in the XY plane
66-
/// \return dcaXY
67-
template <typename T, typename U>
68-
auto getdcaXY(const T& track, const U& coll)
69-
{
70-
//Calculate DCAs
71-
auto sinAlpha = sin(track.alpha());
72-
auto cosAlpha = cos(track.alpha());
73-
auto globalX = track.x() * cosAlpha - track.y() * sinAlpha;
74-
auto globalY = track.x() * sinAlpha + track.y() * cosAlpha;
75-
return sqrt(pow((globalX - coll[0]), 2) +
76-
pow((globalY - coll[1]), 2));
77-
}
78-
79-
void process(aod::Collision const& collision, aod::V0s const& V0s, aod::Cascades const& Cascades, aod::FullTracks const& trackss)
163+
void process(aod::Collision const& collision, aod::V0DataExt const& V0s, aod::CascGood const& Cascades, aod::FullTracks const& tracks)
80164
{
81165
//Define o2 fitter, 2-prong
82166
o2::vertexing::DCAFitterN<2> fitterV0, fitterCasc;
@@ -173,15 +257,22 @@ struct cascadeproducer {
173257
pvecneg[0], pvecneg[1], pvecneg[2],
174258
pvecbach[0], pvecbach[1], pvecbach[2],
175259
fitterV0.getChi2AtPCACandidate(), fitterCasc.getChi2AtPCACandidate(),
176-
getdcaXY(casc.v0().posTrack(), pVtx),
177-
getdcaXY(casc.v0().negTrack(), pVtx),
178-
getdcaXY(casc.bachelor(), pVtx));
260+
casc.v0().posTrack_as<FullTracksExt>().dcaXY(),
261+
casc.v0().negTrack_as<FullTracksExt>().dcaXY(),
262+
casc.bachelor_as<FullTracksExt>().dcaXY());
179263
}
180264
}
181265
};
182266

267+
/// Extends the v0data table with expression columns
268+
struct cascprodinitializer {
269+
Spawns<aod::V0DataExt> v0dataext;
270+
void init(InitContext const&) {}
271+
};
272+
183273
WorkflowSpec defineDataProcessing(ConfigContext const&)
184274
{
185275
return WorkflowSpec{
276+
adaptAnalysisTask<cascprodinitializer>("lf-cascprodinitializer"),
186277
adaptAnalysisTask<cascadeproducer>("lf-cascadeproducer")};
187278
}

Analysis/Tasks/PWGLF/lambdakzeroproducer.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
// Any analysis should loop over the "V0Data"
1818
// table as that table contains all information
1919
//
20+
// WARNING: adding filters to the producer IS NOT
21+
// equivalent to re-running the finders. This will only
22+
// ever produce *tighter* selection sections. It is your
23+
// responsibility to check if, by setting a loose filter
24+
// setting, you are going into a region in which no
25+
// candidates exist because the original indices were generated
26+
// using tigher selections.
27+
//
2028
// Comments, questions, complaints, suggestions?
2129
// Please write to:
2230
// david.dobrigkeit.chinellato@cern.ch

0 commit comments

Comments
 (0)