88// In applying this license CERN does not waive the privileges and immunities
99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
11- // ========================
1211//
13- // This code perform a check for all mcparticles and tracks
14- // which has corresponding mcparticles to find out the properties
15- // of hypertriton 3-body decay
16- //
17- // author: yuanzhe.wang@cern.ch
12+ // / \file hypertriton3bodyMcqa.cxx
13+ // / \brief QA for MC productions which contain hypertriton 3body decay process, including special checks for TOF PID
14+ // / \author Yuanzhe Wang <yuanzhe.wang@cern.ch>
1815
1916#include < cmath>
2017#include < array>
@@ -60,7 +57,7 @@ bool is3bodyDecayedH3L(TMCParticle const& particle)
6057 }
6158 bool haveProton = false , havePion = false , haveDeuteron = false ;
6259 bool haveAntiProton = false , haveAntiPion = false , haveAntiDeuteron = false ;
63- for (auto & mcDaughter : particle.template daughters_as <TMCTrackTo>()) {
60+ for (const auto & mcDaughter : particle.template daughters_as <TMCTrackTo>()) {
6461 if (mcDaughter.pdgCode () == 2212 )
6562 haveProton = true ;
6663 if (mcDaughter.pdgCode () == -2212 )
@@ -85,13 +82,13 @@ bool is3bodyDecayedH3L(TMCParticle const& particle)
8582template <class TMCTrackTo , typename TMCParticle>
8683bool isPairedH3LDaughters (TMCParticle const & mctrack0, TMCParticle const & mctrack1, TMCParticle const & mctrack2)
8784{
88- for (auto & particleMother : mctrack0.template mothers_as <TMCTrackTo>()) {
85+ for (const auto & particleMother : mctrack0.template mothers_as <TMCTrackTo>()) {
8986 if (!(particleMother.pdgCode () == 1010010030 && mctrack0.pdgCode () == 2212 && mctrack1.pdgCode () == -211 && mctrack2.pdgCode () == 1000010020 ) &&
9087 !(particleMother.pdgCode () == -1010010030 && mctrack0.pdgCode () == -2212 && mctrack1.pdgCode () == 211 && mctrack2.pdgCode () == -1000010020 )) {
9188 continue ;
9289 }
9390 bool flag1 = false , flag2 = false ;
94- for (auto & mcDaughter : particleMother.template daughters_as <TMCTrackTo>()) {
91+ for (const auto & mcDaughter : particleMother.template daughters_as <TMCTrackTo>()) {
9592 if (mcDaughter.globalIndex () == mctrack1.globalIndex ())
9693 flag1 = true ;
9794 if (mcDaughter.globalIndex () == mctrack2.globalIndex ())
@@ -108,11 +105,13 @@ bool isPairedH3LDaughters(TMCParticle const& mctrack0, TMCParticle const& mctrac
108105}
109106
110107// check the properties of daughters candidates and true daughters
111- struct hypertriton3bodyTrackMcinfo {
108+ struct Hypertriton3bodyMcqa {
112109
113110 Service<o2::ccdb::BasicCCDBManager> ccdb;
114111 Preslice<MCLabeledTracksIU> perCollisionTracks = aod::track::collisionId;
115112
113+ int mRunNumber ;
114+
116115 // Basic checks
117116 HistogramRegistry registry{
118117 " registry" ,
@@ -224,11 +223,11 @@ struct hypertriton3bodyTrackMcinfo {
224223 registry.get <TH1>(HIST (" hParticleCounter" ))->GetXaxis ()->SetBinLabel (6 , " McisPion" );
225224 registry.get <TH1>(HIST (" hParticleCounter" ))->GetXaxis ()->SetBinLabel (7 , " McisDeuteron" );
226225
227- TString TrackCounterbinLabel [2 ] = {" hasMom" , " FromHypertriton" };
226+ TString trackCounterbinLabel [2 ] = {" hasMom" , " FromHypertriton" };
228227 for (int i{0 }; i < 2 ; i++) {
229- registry.get <TH1>(HIST (" hProtonCounter" ))->GetXaxis ()->SetBinLabel (i + 1 , TrackCounterbinLabel [i]);
230- registry.get <TH1>(HIST (" hPionCounter" ))->GetXaxis ()->SetBinLabel (i + 1 , TrackCounterbinLabel [i]);
231- registry.get <TH1>(HIST (" hDeuteronCounter" ))->GetXaxis ()->SetBinLabel (i + 1 , TrackCounterbinLabel [i]);
228+ registry.get <TH1>(HIST (" hProtonCounter" ))->GetXaxis ()->SetBinLabel (i + 1 , trackCounterbinLabel [i]);
229+ registry.get <TH1>(HIST (" hPionCounter" ))->GetXaxis ()->SetBinLabel (i + 1 , trackCounterbinLabel [i]);
230+ registry.get <TH1>(HIST (" hDeuteronCounter" ))->GetXaxis ()->SetBinLabel (i + 1 , trackCounterbinLabel [i]);
232231 }
233232 registry.get <TH1>(HIST (" hDuplicatedH3LDaughers" ))->GetXaxis ()->SetBinLabel (1 , " proton" );
234233 registry.get <TH1>(HIST (" hDuplicatedH3LDaughers" ))->GetXaxis ()->SetBinLabel (2 , " pion" );
@@ -258,8 +257,8 @@ struct hypertriton3bodyTrackMcinfo {
258257 Configurable<float > maxPionPt{" maxPionPt" , 1.2 , " maxPionPt" };
259258 Configurable<float > minDeuteronPt{" minDeuteronPt" , 0.6 , " minDeuteronPt" };
260259 Configurable<float > maxDeuteronPt{" maxDeuteronPt" , 10 , " maxDeuteronPt" };
261- Configurable<bool > event_sel8_selection{ " event_sel8_selection " , false , " event selection count post sel8 cut " };
262- Configurable<bool > event_posZ_selection{" event_posZ_selection" , false , " event selection count post poZ cut" };
260+ Configurable<bool > mc_event_selection{ " mc_event_selection " , true , " mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder " };
261+ Configurable<bool > event_posZ_selection{" event_posZ_selection" , true , " event selection count post poZ cut" };
263262
264263 // CCDB TOF PID paras
265264 Configurable<int64_t > timestamp{" ccdb-timestamp" , -1 , " timestamp of the object" };
@@ -275,6 +274,11 @@ struct hypertriton3bodyTrackMcinfo {
275274
276275 void initCCDB (aod::BCsWithTimestamps::iterator const & bc)
277276 {
277+ if (mRunNumber == bc.runNumber ()) {
278+ return ;
279+ }
280+ mRunNumber = bc.runNumber ();
281+
278282 // Initial TOF PID Paras, copied from PIDTOF.h
279283 timestamp.value = bc.timestamp ();
280284 ccdb->setTimestamp (timestamp.value );
@@ -348,17 +352,17 @@ struct hypertriton3bodyTrackMcinfo {
348352
349353 void process (ColwithEvTimes const & collisions, MCLabeledTracksIU const & tracks, aod::McParticles const & /* particlesMC*/ , aod::McCollisions const & /* mcCollisions*/ , aod::BCsWithTimestamps const &)
350354 {
351- for (auto collision : collisions) {
355+ for (const auto & collision : collisions) {
352356 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
353357 initCCDB (bc);
354358
355359 registry.fill (HIST (" hEventCounter" ), 0.5 );
356- if (event_sel8_selection && !collision.sel8 ( )) {
357- return ;
360+ if (mc_event_selection && ( !collision.selection_bit (aod::evsel:: kIsTriggerTVX ) || !collision. selection_bit (aod::evsel:: kNoTimeFrameBorder ) )) {
361+ continue ;
358362 }
359363 registry.fill (HIST (" hEventCounter" ), 1.5 );
360364 if (event_posZ_selection && abs (collision.posZ ()) > 10 .f ) { // 10cm
361- return ;
365+ continue ;
362366 }
363367 registry.fill (HIST (" hEventCounter" ), 2.5 );
364368
@@ -368,7 +372,7 @@ struct hypertriton3bodyTrackMcinfo {
368372
369373 auto coltracks = tracks.sliceBy (perCollisionTracks, collision.globalIndex ());
370374
371- for (auto & track : coltracks) {
375+ for (const auto & track : coltracks) {
372376
373377 ++itrack;
374378 registry.fill (HIST (" hParticleCounter" ), 0.5 );
@@ -409,7 +413,7 @@ struct hypertriton3bodyTrackMcinfo {
409413
410414 if (mcparticle.has_mothers ()) {
411415 registry.fill (HIST (" hProtonCounter" ), 0.5 );
412- for (auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
416+ for (const auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
413417 bool flag_H3L = is3bodyDecayedH3L<aod::McParticles>(particleMother);
414418 if (!flag_H3L) {
415419 continue ;
@@ -447,7 +451,7 @@ struct hypertriton3bodyTrackMcinfo {
447451
448452 if (mcparticle.has_mothers ()) {
449453 registry.fill (HIST (" hPionCounter" ), 0.5 );
450- for (auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
454+ for (const auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
451455 bool flag_H3L = is3bodyDecayedH3L<aod::McParticles>(particleMother);
452456 if (!flag_H3L) {
453457 continue ;
@@ -513,7 +517,7 @@ struct hypertriton3bodyTrackMcinfo {
513517
514518 if (mcparticle.has_mothers ()) {
515519 registry.fill (HIST (" hDeuteronCounter" ), 0.5 );
516- for (auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
520+ for (const auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
517521 bool flag_H3L = is3bodyDecayedH3L<aod::McParticles>(particleMother);
518522 if (!flag_H3L) {
519523 continue ;
@@ -603,7 +607,7 @@ struct hypertriton3bodyTrackMcinfo {
603607 SelectedEvents[nevts++] = collision.mcCollision_as <aod::McCollisions>().globalIndex ();
604608 }
605609
606- for (auto & track : tracks) {
610+ for (const auto & track : tracks) {
607611 if (!track.has_mcParticle ()) {
608612 continue ;
609613 }
@@ -622,14 +626,14 @@ struct hypertriton3bodyTrackMcinfo {
622626 auto collision = collisions.iteratorAt (evtReconstructed - SelectedEvents.begin ());
623627 auto originalcollision = track.collision_as <ColwithEvTimes>();
624628
625- for (auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
629+ for (const auto & particleMother : mcparticle.mothers_as <aod::McParticles>()) {
626630 bool flag_H3L = is3bodyDecayedH3L<aod::McParticles>(particleMother);
627631 if (!flag_H3L) {
628632 continue ;
629633 }
630634
631- // auto bc = collision.bc_as<aod::BCsWithTimestamps>();
632- // initCCDB(bc);
635+ auto bc = collision.bc_as <aod::BCsWithTimestamps>();
636+ initCCDB (bc);
633637 float tofNsigmaDeAO2D = -999 ;
634638 float tofNsigmaDeEvSel = -999 ;
635639
@@ -690,7 +694,7 @@ struct hypertriton3bodyTrackMcinfo {
690694};
691695
692696// check the performance of mcparticle
693- struct hypertriton3bodyMcParticleCheck {
697+ struct Hypertriton3bodyMcParticleCheck {
694698 // Basic checks
695699 HistogramRegistry registry{
696700 " registry" ,
@@ -733,8 +737,8 @@ struct hypertriton3bodyMcParticleCheck {
733737 }
734738
735739 Configurable<float > rapidityMCcut{" rapidityMCcut" , 1 , " rapidity cut MC count" };
736- Configurable<bool > event_sel8_selection{ " event_sel8_selection " , false , " event selection count post sel8 cut " };
737- Configurable<bool > event_posZ_selection{" event_posZ_selection" , false , " event selection count post poZ cut" };
740+ Configurable<bool > mc_event_selection{ " mc_event_selection " , true , " mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder " };
741+ Configurable<bool > event_posZ_selection{" event_posZ_selection" , true , " event selection count post poZ cut" };
738742
739743 Preslice<aod::McParticles> permcCollision = o2::aod::mcparticle::mcCollisionId;
740744
@@ -745,7 +749,7 @@ struct hypertriton3bodyMcParticleCheck {
745749 mcPartIndices.clear ();
746750 mcPartIndices.resize (particlesMC.size ());
747751 std::fill (mcPartIndices.begin (), mcPartIndices.end (), -1 );
748- for (auto & track : tracks) {
752+ for (const auto & track : tracks) {
749753 if (track.has_mcParticle ()) {
750754 auto mcparticle = track.template mcParticle_as <aod::McParticles>();
751755 if (mcPartIndices[mcparticle.globalIndex ()] == -1 ) {
@@ -772,7 +776,7 @@ struct hypertriton3bodyMcParticleCheck {
772776 std::vector<int64_t > SelectedEvents (collisions.size ());
773777 int nevts = 0 ;
774778 for (const auto & collision : collisions) {
775- if (event_sel8_selection && !collision.sel8 ( )) {
779+ if (mc_event_selection && ( !collision.selection_bit (aod::evsel:: kIsTriggerTVX ) || !collision. selection_bit (aod::evsel:: kNoTimeFrameBorder ) )) {
776780 continue ;
777781 }
778782 if (event_posZ_selection && abs (collision.posZ ()) > 10 .f ) { // 10cm
@@ -782,17 +786,17 @@ struct hypertriton3bodyMcParticleCheck {
782786 }
783787 SelectedEvents.resize (nevts);
784788
785- for (auto mcCollision : mcCollisions) {
789+ for (const auto & mcCollision : mcCollisions) {
786790 registry.fill (HIST (" hMcCollCounter" ), 0.5 );
787791 const auto evtReconstructedAndSelected = std::find (SelectedEvents.begin (), SelectedEvents.end (), mcCollision.globalIndex ()) != SelectedEvents.end ();
788- if (evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection
789- registry.fill (HIST (" hMcCollCounter" ), 1.5 );
790- // return;
792+ if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection
793+ continue ;
791794 }
795+ registry.fill (HIST (" hMcCollCounter" ), 1.5 );
792796
793797 const auto & dparticlesMC = particlesMC.sliceBy (permcCollision, mcCollision.globalIndex ());
794798
795- for (auto & mcparticle : dparticlesMC) {
799+ for (const auto & mcparticle : dparticlesMC) {
796800
797801 if (mcparticle.pdgCode () == 2212 || mcparticle.pdgCode () == -2212 ) {
798802 registry.fill (HIST (" hMcProtonPt" ), mcparticle.pt ());
@@ -822,7 +826,7 @@ struct hypertriton3bodyMcParticleCheck {
822826 if (!flag_H3L) {
823827 continue ;
824828 }
825- for (auto & mcparticleDaughter : mcparticle.daughters_as <aod::McParticles>()) {
829+ for (const auto & mcparticleDaughter : mcparticle.daughters_as <aod::McParticles>()) {
826830 if (std::abs (mcparticleDaughter.pdgCode ()) == 2212 ) {
827831 dauProtonMom[0 ] = mcparticleDaughter.px ();
828832 dauProtonMom[1 ] = mcparticleDaughter.py ();
@@ -880,7 +884,7 @@ struct hypertriton3bodyMcParticleCheck {
880884 // }
881885
882886 // Counter for hypertriton N_gen
883- if (TMath::Abs (mcparticle.y ()) < 1 ) {
887+ if (std::abs (mcparticle.y ()) < 1 ) {
884888 registry.fill (HIST (" hMcHypertritonCounter" ), 6.5 );
885889 if (MClifetime < 40 ) {
886890 registry.fill (HIST (" hMcHypertritonCounter" ), 7.5 );
@@ -899,7 +903,7 @@ struct hypertriton3bodyMcParticleCheck {
899903WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
900904{
901905 return WorkflowSpec{
902- adaptAnalysisTask<hypertriton3bodyTrackMcinfo >(cfgc),
903- adaptAnalysisTask<hypertriton3bodyMcParticleCheck >(cfgc),
906+ adaptAnalysisTask<Hypertriton3bodyMcqa >(cfgc),
907+ adaptAnalysisTask<Hypertriton3bodyMcParticleCheck >(cfgc),
904908 };
905909}
0 commit comments