1313// / \author daiki.sekihata@cern.ch
1414
1515#include < map>
16+ #include < string>
17+ #include < vector>
18+ #include < utility>
19+
1620#include " Math/Vector4D.h"
1721#include " Framework/runDataProcessing.h"
1822#include " Framework/AnalysisTask.h"
@@ -35,6 +39,8 @@ using namespace o2::framework::expressions;
3539using namespace o2 ::constants::physics;
3640using namespace o2 ::pwgem::photonmeson;
3741
42+ using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::EMEventsNgPCM>;
43+ using MyCollisionsMC = soa::Join<MyCollisions, aod::McCollisionLabels>;
3844using MyTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TracksCov, aod::pidTPCFullEl, aod::pidTPCFullPi>;
3945using MyTrack = MyTracks::iterator;
4046using MyTracksMC = soa::Join<MyTracks, aod::McTrackLabels>;
@@ -58,24 +64,23 @@ struct skimmerPrimaryElectronFromDalitzEE {
5864 Configurable<int > min_ncluster_tpc{" min_ncluster_tpc" , 0 , " min ncluster tpc" };
5965 Configurable<int > mincrossedrows{" mincrossedrows" , 70 , " min. crossed rows" };
6066 Configurable<float > min_tpc_cr_findable_ratio{" min_tpc_cr_findable_ratio" , 0.8 , " min. TPC Ncr/Nf ratio" };
61- Configurable<int > minitsncls{" minitsncls" , 4 , " min. number of ITS clusters" };
67+ Configurable<float > max_frac_shared_clusters_tpc{" max_frac_shared_clusters_tpc" , 999 .f , " max fraction of shared clusters in TPC" };
68+ Configurable<int > min_ncluster_its{" min_ncluster_its" , 4 , " min ncluster its" };
69+ Configurable<int > min_ncluster_itsib{" min_ncluster_itsib" , 1 , " min ncluster itsib" };
6270 Configurable<float > maxchi2tpc{" maxchi2tpc" , 5.0 , " max. chi2/NclsTPC" };
6371 Configurable<float > maxchi2its{" maxchi2its" , 6.0 , " max. chi2/NclsITS" };
64- Configurable<float > minpt{" minpt" , 0.15 , " min pt for track" };
65- Configurable<float > maxeta{" maxeta" , 0.8 , " eta acceptance" };
66- Configurable<float > dca_xy_max{" dca_xy_max" , 0.1 , " max DCAxy in cm" };
67- Configurable<float > dca_z_max{" dca_z_max" , 0.1 , " max DCAz in cm" };
72+ Configurable<float > minpt{" minpt" , 0.1 , " min pt for track" };
73+ Configurable<float > maxeta{" maxeta" , 0.9 , " eta acceptance" };
74+ Configurable<float > dca_xy_max{" dca_xy_max" , 0.05 , " max DCAxy in cm" };
75+ Configurable<float > dca_z_max{" dca_z_max" , 0.05 , " max DCAz in cm" };
6876 Configurable<float > minTPCNsigmaEl{" minTPCNsigmaEl" , -2.5 , " min. TPC n sigma for electron inclusion" };
6977 Configurable<float > maxTPCNsigmaEl{" maxTPCNsigmaEl" , 3.5 , " max. TPC n sigma for electron inclusion" };
70- Configurable<float > maxTPCNsigmaPi{" maxTPCNsigmaPi" , 2.5 , " max. TPC n sigma for pion exclusion" };
71- Configurable<float > minTPCNsigmaPi{" minTPCNsigmaPi" , -1e+10 , " min. TPC n sigma for pion exclusion" };
72- Configurable<float > maxMee_lowPtee{" maxMee_lowPtee" , 0.02 , " max. mee to store dalitz ee pairs for recovery" };
73- Configurable<float > maxMee_highPtee{" maxMee_highPtee" , 0.04 , " max. mee to store dalitz ee pairs for recovery" };
78+ Configurable<float > maxTPCNsigmaPi{" maxTPCNsigmaPi" , 0.0 , " max. TPC n sigma for pion exclusion" };
79+ Configurable<float > minTPCNsigmaPi{" minTPCNsigmaPi" , 0.0 , " min. TPC n sigma for pion exclusion" };
80+ Configurable<float > maxMee{" maxMee" , 0.06 , " max. mee to store dalitz ee pairs" };
7481
7582 HistogramRegistry fRegistry {" output" , {}, OutputObjHandlingPolicy::AnalysisObject, false , false };
7683
77- std::pair<int8_t , std::set<uint8_t >> itsRequirement = {1 , {0 , 1 , 2 }}; // any hits on 3 ITS ib layers.
78-
7984 int mRunNumber ;
8085 float d_bz;
8186 Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -121,7 +126,7 @@ struct skimmerPrimaryElectronFromDalitzEE {
121126 if (d_bz_input > -990 ) {
122127 d_bz = d_bz_input;
123128 o2::parameters::GRPMagField grpmag;
124- if (fabs (d_bz) > 1e-5 ) {
129+ if (std:: fabs (d_bz) > 1e-5 ) {
125130 grpmag.setL3Current (30000 .f / (d_bz / 5 .0f ));
126131 }
127132 o2::base::Propagator::initFieldFromGRP (&grpmag);
@@ -172,12 +177,10 @@ struct skimmerPrimaryElectronFromDalitzEE {
172177 if (!track.hasITS () || !track.hasTPC ()) {
173178 return false ;
174179 }
175- if (track.itsNCls () < minitsncls ) {
180+ if (track.itsNCls () < min_ncluster_its ) {
176181 return false ;
177182 }
178-
179- auto hits = std::count_if (itsRequirement.second .begin (), itsRequirement.second .end (), [&](auto && requiredLayer) { return track.itsClusterMap () & (1 << requiredLayer); });
180- if (hits < itsRequirement.first ) {
183+ if (track.itsNClsInnerBarrel () < min_ncluster_itsib) {
181184 return false ;
182185 }
183186
@@ -193,11 +196,15 @@ struct skimmerPrimaryElectronFromDalitzEE {
193196 return false ;
194197 }
195198
196- if (abs (track.dcaXY ()) > dca_xy_max || abs (track.dcaZ ()) > dca_z_max) {
199+ if (track.tpcFractionSharedCls () > max_frac_shared_clusters_tpc) {
200+ return false ;
201+ }
202+
203+ if (std::fabs (track.dcaXY ()) > dca_xy_max || std::fabs (track.dcaZ ()) > dca_z_max) {
197204 return false ;
198205 }
199206
200- if (track.pt () < minpt || abs (track.eta ()) > maxeta) {
207+ if (track.pt () < minpt || std::fabs (track.eta ()) > maxeta) {
201208 return false ;
202209 }
203210
@@ -221,7 +228,7 @@ struct skimmerPrimaryElectronFromDalitzEE {
221228 {
222229 if (std::find (stored_trackIds.begin (), stored_trackIds.end (), std::make_pair (collision.globalIndex (), track.globalIndex ())) == stored_trackIds.end ()) {
223230 emprimaryelectrons (collision.globalIndex (), track.globalIndex (), track.sign (),
224- track.pt (), track.eta (), track.phi (), track.dcaXY (), track.dcaZ (),
231+ track.pt (), track.eta (), track.phi (), track.dcaXY (), track.dcaZ (), track. cYY (), track. cZY (), track. cZZ (),
225232 track.tpcNClsFindable (), track.tpcNClsFindableMinusFound (), track.tpcNClsFindableMinusCrossedRows (),
226233 track.tpcChi2NCl (), track.tpcInnerParam (),
227234 track.tpcSignal (), track.tpcNSigmaEl (), track.tpcNSigmaPi (),
@@ -252,8 +259,8 @@ struct skimmerPrimaryElectronFromDalitzEE {
252259 template <bool isMC, typename TCollision, typename TTracks1, typename TTracks2>
253260 void fillPairInfo (TCollision const & collision, TTracks1 const & tracks1, TTracks2 const & tracks2)
254261 {
255- for (auto & t1 : tracks1) {
256- for (auto & t2 : tracks2) {
262+ for (const auto & t1 : tracks1) {
263+ for (const auto & t2 : tracks2) {
257264 if (!checkTrack<isMC>(collision, t1) || !checkTrack<isMC>(collision, t2)) {
258265 continue ;
259266 }
@@ -265,47 +272,44 @@ struct skimmerPrimaryElectronFromDalitzEE {
265272 ROOT::Math::PtEtaPhiMVector v2 (t2.pt (), t2.eta (), t2.phi (), o2::constants::physics::MassElectron);
266273 ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
267274
268- if (v12.Pt () < 1.0 ) { // don't store
269- if (v12.M () > maxMee_lowPtee) { // don't store
270- continue ;
271- }
272- } else {
273- if (v12.M () > maxMee_highPtee) { // don't store
274- continue ;
275- }
275+ if (v12.M () > maxMee) { // don't store
276+ continue ;
276277 }
277278 fRegistry .fill (HIST (" Pair/hMeePtee_ULS" ), v12.M (), v12.Pt ());
278279 fillTrackTable (collision, t1);
279280 fillTrackTable (collision, t2);
280281 } // end of t2
281- } // end of t1
282+ } // end of t1
282283 }
283284
284285 std::vector<std::pair<int64_t , int64_t >> stored_trackIds;
285- Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t )o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t )o2::aod::track::TPC) == true ;
286+ Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t )o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t )o2::aod::track::TPC) == true && nabs(o2::aod::track::dcaXY) < dca_xy_max&& nabs(o2::aod::track::dcaZ) < dca_z_max ;
286287 Filter pidFilter = minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl;
287288 using MyFilteredTracks = soa::Filtered<MyTracks>;
288289 Partition<MyFilteredTracks> posTracks = o2::aod::track::signed1Pt > 0 .f;
289290 Partition<MyFilteredTracks> negTracks = o2::aod::track::signed1Pt < 0 .f;
290291
291292 // ---------- for data ----------
292- void processRec (Join<aod::Collisions, aod::EvSels> const & collisions, aod::BCsWithTimestamps const &, MyFilteredTracks const & tracks)
293+ void processRec (MyCollisions const & collisions, aod::BCsWithTimestamps const &, MyFilteredTracks const & tracks)
293294 {
294295 stored_trackIds.reserve (tracks.size ());
295296
296- for (auto & collision : collisions) {
297- auto bc = collision.bc_as <aod::BCsWithTimestamps>();
297+ for (const auto & collision : collisions) {
298+ auto bc = collision.template foundBC_as <aod::BCsWithTimestamps>();
298299 initCCDB (bc);
299300
300301 if (applyEveSel_at_skimming && (!collision.selection_bit (o2::aod::evsel::kIsTriggerTVX ) || !collision.selection_bit (o2::aod::evsel::kNoTimeFrameBorder ) || !collision.selection_bit (o2::aod::evsel::kNoITSROFrameBorder ))) {
301302 continue ;
302303 }
304+ if (collision.ngpcm () < 1 ) {
305+ continue ;
306+ }
303307
304308 auto posTracks_per_coll = posTracks->sliceByCached (o2::aod::track::collisionId, collision.globalIndex (), cache);
305309 auto negTracks_per_coll = negTracks->sliceByCached (o2::aod::track::collisionId, collision.globalIndex (), cache);
306310
307311 fillPairInfo<false >(collision, posTracks_per_coll, negTracks_per_coll); // ULS
308- } // end of collision loop
312+ } // end of collision loop
309313
310314 stored_trackIds.clear ();
311315 stored_trackIds.shrink_to_fit ();
@@ -316,25 +320,29 @@ struct skimmerPrimaryElectronFromDalitzEE {
316320 Partition<MyFilteredTracksMC> posTracksMC = o2::aod::track::signed1Pt > 0 .f;
317321 Partition<MyFilteredTracksMC> negTracksMC = o2::aod::track::signed1Pt < 0 .f;
318322 // ---------- for MC ----------
319- void processMC (soa::Join<aod::McCollisionLabels, aod::Collisions, aod::EvSels> const & collisions, aod::McCollisions const &, aod::BCsWithTimestamps const &, MyFilteredTracksMC const & tracks)
323+ void processMC (MyCollisionsMC const & collisions, aod::McCollisions const &, aod::BCsWithTimestamps const &, MyFilteredTracksMC const & tracks)
320324 {
321325 stored_trackIds.reserve (tracks.size ());
322326
323- for (auto & collision : collisions) {
327+ for (const auto & collision : collisions) {
324328 if (!collision.has_mcCollision ()) {
325329 continue ;
326330 }
327- auto bc = collision.bc_as <aod::BCsWithTimestamps>();
331+ auto bc = collision.template foundBC_as <aod::BCsWithTimestamps>();
328332 initCCDB (bc);
333+
329334 if (applyEveSel_at_skimming && (!collision.selection_bit (o2::aod::evsel::kIsTriggerTVX ) || !collision.selection_bit (o2::aod::evsel::kNoTimeFrameBorder ) || !collision.selection_bit (o2::aod::evsel::kNoITSROFrameBorder ))) {
330335 continue ;
331336 }
337+ if (collision.ngpcm () < 1 ) {
338+ continue ;
339+ }
332340
333341 auto posTracks_per_coll = posTracksMC->sliceByCached (o2::aod::track::collisionId, collision.globalIndex (), cache);
334342 auto negTracks_per_coll = negTracksMC->sliceByCached (o2::aod::track::collisionId, collision.globalIndex (), cache);
335343
336344 fillPairInfo<true >(collision, posTracks_per_coll, negTracks_per_coll); // ULS
337- } // end of collision loop
345+ } // end of collision loop
338346
339347 stored_trackIds.clear ();
340348 stored_trackIds.shrink_to_fit ();
@@ -351,10 +359,10 @@ struct skimmerPrimaryElectronFromDalitzEE {
351359//
352360// void process(aod::EMPrimaryElectrons const& electrons)
353361// {
354- // for (auto& electron : electrons) {
362+ // for (const auto& electron : electrons) {
355363// auto electrons_with_same_trackId = electrons.sliceBy(perTrack, electron.trackId());
356364// ambele_self_Ids.reserve(electrons_with_same_trackId.size());
357- // for (auto& amp_ele : electrons_with_same_trackId) {
365+ // for (const auto& amp_ele : electrons_with_same_trackId) {
358366// if (amp_ele.globalIndex() == electron.globalIndex()) { // don't store myself.
359367// continue;
360368// }
0 commit comments