@@ -60,6 +60,50 @@ class TrackAlice3 : public o2::track::TrackParCov
6060 timeEst mTimeMUS ; ///< time estimate in ns
6161};
6262
63+ template < typename T >
64+ bool IsSecondary (const T & particleTree , const int & index )
65+ {
66+ auto particle = (GenParticle * )particleTree -> At (index );
67+ if (particle -> M1 < 0 ) {
68+ return false;
69+ }
70+
71+ auto mother = (GenParticle * )particleTree -> At (particle -> M1 );
72+ if (!mother ) {
73+ return false;
74+ }
75+ // Ancore di salvezza :)
76+ if ((particle -> M1 == particle -> M2 ) && (particle -> M1 == 0 )) {
77+ return false;
78+ }
79+ if (abs (mother -> PID ) <= 8 ) {
80+ return false;
81+ }
82+ // 100% secondaries if true here
83+ switch (abs (mother -> PID )) {
84+ // K0S
85+ case 310 :
86+ // Lambda
87+ case 3122 :
88+ // Sigma0
89+ case 3212 :
90+ // Sigma-
91+ case 3112 :
92+ // Sigma+
93+ case 3222 :
94+ // Xi-
95+ case 3312 :
96+ // Xi0
97+ case 3322 :
98+ // Omega-
99+ case 3334 :
100+ return true;
101+ break ;
102+ }
103+
104+ return IsSecondary (particleTree , particle -> M1 );
105+ }
106+
63107void createO2tables (const char * inputFile = "delphes.root" ,
64108 const char * outputFile = "AODRun5.root" ,
65109 int eventOffset = 0 )
@@ -154,6 +198,9 @@ void createO2tables(const char* inputFile = "delphes.root",
154198 mcparticle .fPdgCode = particle -> PID ;
155199 mcparticle .fStatusCode = particle -> Status ;
156200 mcparticle .fFlags = 0 ;
201+ if (IsSecondary (particles , iparticle )) {
202+ mcparticle .fFlags |= 1 ;
203+ }
157204 mcparticle .fMother0 = particle -> M1 ;
158205 if (mcparticle .fMother0 > -1 )
159206 mcparticle .fMother0 += fOffsetLabel ;
0 commit comments