@@ -95,7 +95,7 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
9595 const float bz = prop -> getNominalBz ();
9696
9797 auto hNTrkCls = new TH1D ("hNTrkCls" , "Number of cluster per track;nCls;entries" , 4 , 3.5 , 7.5 );
98- std ::array < TH1 * , 5 > hTrkTS ;
98+ std ::array < TH1 * , 5 > hTrkTS { nullptr } ;
9999 for (int i {0 }; i < 5 ; ++ i ) {
100100 hTrkTS [i ] = new TH1D (Form ("hTrkTS_%d" , i ), Form ("track time t0 (%s);t0 (BC)" , i == 0 ? "all" : Form ("NCls=%d" , 3 + i )), o2 ::constants ::lhc ::LHCMaxBunches , 0 , o2 ::constants ::lhc ::LHCMaxBunches );
101101 }
@@ -158,12 +158,13 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
158158 int barWidth = 50 ;
159159 int pos = barWidth * progress / 100 ;
160160 for (int j = 0 ; j < barWidth ; ++ j ) {
161- if (j < pos )
161+ if (j < pos ) {
162162 printf ("=" );
163- else if (j == pos )
163+ } else if (j == pos ) {
164164 printf (">" );
165- else
165+ } else {
166166 printf (" " );
167+ }
167168 }
168169 printf ("] %d%%" , progress );
169170 fflush (stdout );
@@ -200,8 +201,8 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
200201
201202 for (const auto& trk : trkArr ) {
202203 hNTrkCls -> Fill (trk .getNClusters ());
203- hTrkTS [0 ]-> Fill (trk .getTimeStamp ().getTimeStamp () % o2 ::constants ::lhc ::LHCMaxBunches );
204- hTrkTS [trk .getNClusters () - 3 ]-> Fill (trk .getTimeStamp ().getTimeStamp () % o2 ::constants ::lhc ::LHCMaxBunches );
204+ hTrkTS [0 ]-> Fill (std :: fmod ( trk .getTimeStamp ().getTimeStamp (), o2 ::constants ::lhc ::LHCMaxBunches ) );
205+ hTrkTS [trk .getNClusters () - 3 ]-> Fill (std :: fmod ( trk .getTimeStamp ().getTimeStamp (), o2 ::constants ::lhc ::LHCMaxBunches ) );
205206 hTrkTSE -> Fill (trk .getTimeStamp ().getTimeStampError ());
206207
207208 if (trk .getPt () > mMinITSPt ) {
@@ -226,14 +227,11 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
226227 std ::vector < PairCandidate > k0Cands ;
227228 for (int iPos {0 }; iPos < (int )posPool .size (); ++ iPos ) {
228229 const auto pos = posPool [iPos ];
229- auto posTS = o2 ::its ::TimeEstBC (pos -> getTimeStamp ().getTimeStamp (), pos -> getTimeStamp ().getTimeStampError ());
230230 for (int iNeg {0 }; iNeg < (int )negPool .size (); ++ iNeg ) {
231231 const auto neg = negPool [iNeg ];
232- auto negTS = o2 :: its :: TimeEstBC ( neg -> getTimeStamp ().getTimeStamp (), neg -> getTimeStamp ().getTimeStampError ());
233- if (!posTS . isCompatible ( negTS ) ) {
232+ bool overlap = std :: abs ( pos -> getTimeStamp (). getTimeStamp () - neg -> getTimeStamp ().getTimeStamp ()) <= ( pos -> getTimeStamp (). getTimeStampError () + neg -> getTimeStamp ().getTimeStampError ());
233+ if (!overlap ) {
234234 continue ;
235- // } else if (posTS.getTimeStamp() + posTS.getTimeStampError() < negTS.getTimeStamp() - negTS.getTimeStampError()) {
236- // break;
237235 }
238236
239237 // phi-meson
@@ -314,7 +312,10 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
314312 bool candFound = false;
315313 for (const auto& vtx : vtxArr ) {
316314 if (vtx .getNContributors () > minVtxWeight ) {
317- if (posTS .isCompatible (vtx .getTimeStamp ()) && negTS .isCompatible (vtx .getTimeStamp ())) {
315+ const auto vtxT = vtx .getTimeStamp ().makeSymmetrical ();
316+ bool overlapPos = std ::abs (pos -> getTimeStamp ().getTimeStamp () - vtxT .getTimeStamp ()) <= (pos -> getTimeStamp ().getTimeStampError () + vtxT .getTimeStampError ());
317+ bool overlapNeg = std ::abs (neg -> getTimeStamp ().getTimeStamp () - vtxT .getTimeStamp ()) <= (neg -> getTimeStamp ().getTimeStampError () + vtxT .getTimeStampError ());
318+ if (overlapPos && overlapNeg ) {
318319 float dx = v0XYZ [0 ] - vtx .getX (), dy = v0XYZ [1 ] - vtx .getY (), dz = v0XYZ [2 ] - vtx .getZ (), prodXYZv0 = dx * pV0 [0 ] + dy * pV0 [1 ] + dz * pV0 [2 ];
319320 float cosPA = prodXYZv0 / std ::sqrt ((dx * dx + dy * dy + dz * dz ) * p2V0 );
320321 if (cosPA > bestCosPA ) {
0 commit comments