@@ -654,12 +654,34 @@ struct strangenesstofpid {
654654 // _____________________________________________________________________________________________
655655 // Actual calculation
656656 if (pTof.hasTOF && pTof.hasITS ){
657- float velocityPositivePr = velocity (posTrack.getP (), o2::constants::physics::MassProton);
658- float velocityPositivePi = velocity (posTrack.getP (), o2::constants::physics::MassPionCharged);
659- float lengthPositive = findInterceptLength (posTrack, d_bz);
660- if (lengthPositive>0 .0f ){
657+ float velocityPositivePr, velocityPositivePi, lengthPositive;
658+ velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue ;
659+ // method 0: legacy standalone without use of primary particle TOF
660+ if (calculationMethod.value == 0 ){
661+ velocityPositivePr = velocity (posTrack.getP (), o2::constants::physics::MassProton);
662+ velocityPositivePi = velocity (posTrack.getP (), o2::constants::physics::MassPionCharged);
663+ lengthPositive = findInterceptLength (posTrack, d_bz);
661664 v0tof.timePositivePr = lengthPositive / velocityPositivePr;
662665 v0tof.timePositivePi = lengthPositive / velocityPositivePi;
666+ }
667+ // method 1: correct primary particle TOF information
668+ // length -> revise by removing travel length to primary vertex
669+ // expected momentum -> kept as is for now, could correct at second stage
670+ // use main method from TOF to calculate expected time
671+ if (calculationMethod.value == 1 ){
672+ if (pTof.collisionId >= 0 ){
673+ auto trackCollision = collisions.rawIteratorAt (pTof.collisionId );
674+ const o2::math_utils::Point3D<float > trackVertex{trackCollision.posX (), trackCollision.posY (), trackCollision.posZ ()};
675+ o2::track::TrackLTIntegral ltIntegral;
676+ bool successPropag = o2::base::Propagator::Instance ()->propagateToDCA (trackVertex, posTrack, d_bz, 2 .f , o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr , <Integral);
677+ if (successPropag){
678+ lengthPositive = pTof.length - ltIntegral.getL ();
679+ v0tof.timePositivePr = o2::framework::pid::tof::MassToExpTime (pTof.tofExpMom , lengthPositive, o2::constants::physics::MassProton * o2::constants::physics::MassProton);
680+ v0tof.timePositivePi = o2::framework::pid::tof::MassToExpTime (pTof.tofExpMom , lengthPositive, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged);
681+ }
682+ }
683+ }
684+ if (lengthPositive>0 .0f ){
663685 v0tof.deltaTimePositiveLambdaPr = (pTof.tofSignal - pTof.tofEvTime ) - (timeLambda + v0tof.timePositivePr );
664686 v0tof.deltaTimePositiveLambdaPi = (pTof.tofSignal - pTof.tofEvTime ) - (timeLambda + v0tof.timePositivePi );
665687 v0tof.deltaTimePositiveK0ShortPi = (pTof.tofSignal - pTof.tofEvTime ) - (timeK0Short + v0tof.timePositivePi );
@@ -688,9 +710,33 @@ struct strangenesstofpid {
688710 }
689711 }
690712 if (nTof.hasTOF && nTof.hasITS ){
691- float velocityNegativePr = velocity (negTrack.getP (), o2::constants::physics::MassProton);
692- float velocityNegativePi = velocity (negTrack.getP (), o2::constants::physics::MassPionCharged);
693- float lengthNegative = findInterceptLength (negTrack, d_bz);
713+ float velocityNegativePr, velocityNegativePi, lengthNegative;
714+ velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue ;
715+ // method 0: legacy standalone without use of primary particle TOF
716+ if (calculationMethod.value == 0 ){
717+ velocityNegativePr = velocity (negTrack.getP (), o2::constants::physics::MassProton);
718+ velocityNegativePi = velocity (negTrack.getP (), o2::constants::physics::MassPionCharged);
719+ lengthNegative = findInterceptLength (negTrack, d_bz);
720+ v0tof.timeNegativePr = lengthNegative / velocityNegativePr;
721+ v0tof.timeNegativePi = lengthNegative / velocityNegativePi;
722+ }
723+ // method 1: correct primary particle TOF information
724+ // length -> revise by removing travel length to primary vertex
725+ // expected momentum -> kept as is for now, could correct at second stage
726+ // use main method from TOF to calculate expected time
727+ if (calculationMethod.value == 1 ){
728+ if (nTof.collisionId >= 0 ){
729+ auto trackCollision = collisions.rawIteratorAt (nTof.collisionId );
730+ const o2::math_utils::Point3D<float > trackVertex{trackCollision.posX (), trackCollision.posY (), trackCollision.posZ ()};
731+ o2::track::TrackLTIntegral ltIntegral;
732+ bool successPropag = o2::base::Propagator::Instance ()->propagateToDCA (trackVertex, negTrack, d_bz, 2 .f , o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr , <Integral);
733+ if (successPropag){
734+ lengthNegative = nTof.length - ltIntegral.getL ();
735+ v0tof.timeNegativePr = o2::framework::pid::tof::MassToExpTime (nTof.tofExpMom , nTof.length -ltIntegral.getL (), o2::constants::physics::MassProton * o2::constants::physics::MassProton);
736+ v0tof.timeNegativePi = o2::framework::pid::tof::MassToExpTime (nTof.tofExpMom , nTof.length -ltIntegral.getL (), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged);
737+ }
738+ }
739+ }
694740 if (lengthNegative>0 .0f ){
695741 v0tof.timeNegativePr = lengthNegative / velocityNegativePr;
696742 v0tof.timeNegativePi = lengthNegative / velocityNegativePi;
@@ -803,12 +849,33 @@ struct strangenesstofpid {
803849 // _____________________________________________________________________________________________
804850 // Actual calculation
805851 if (pTof.hasTOF && pTof.hasITS ){
806- float velocityPositivePr = velocity (posTrack.getP (), o2::constants::physics::MassProton);
807- float velocityPositivePi = velocity (posTrack.getP (), o2::constants::physics::MassPionCharged);
808- float lengthPositive = findInterceptLength (posTrack, d_bz);
809- if (lengthPositive>0 .0f ){
852+ float velocityPositivePr, velocityPositivePi, lengthPositive;
853+ velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue ;
854+ if (calculationMethod.value ==0 ){
855+ velocityPositivePr = velocity (posTrack.getP (), o2::constants::physics::MassProton);
856+ velocityPositivePi = velocity (posTrack.getP (), o2::constants::physics::MassPionCharged);
857+ lengthPositive = findInterceptLength (posTrack, d_bz);
810858 casctof.posFlightPr = lengthPositive / velocityPositivePr;
811859 casctof.posFlightPi = lengthPositive / velocityPositivePi;
860+ }
861+ // method 1: correct primary particle TOF information
862+ // length -> revise by removing travel length to primary vertex
863+ // expected momentum -> kept as is for now, could correct at second stage
864+ // use main method from TOF to calculate expected time
865+ if (calculationMethod.value == 1 ){
866+ if (pTof.collisionId >= 0 ){
867+ auto trackCollision = collisions.rawIteratorAt (pTof.collisionId );
868+ const o2::math_utils::Point3D<float > trackVertex{trackCollision.posX (), trackCollision.posY (), trackCollision.posZ ()};
869+ o2::track::TrackLTIntegral ltIntegral;
870+ bool successPropag = o2::base::Propagator::Instance ()->propagateToDCA (trackVertex, posTrack, d_bz, 2 .f , o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr , <Integral);
871+ if (successPropag){
872+ lengthPositive = pTof.length - ltIntegral.getL ();
873+ casctof.posFlightPr = o2::framework::pid::tof::MassToExpTime (pTof.tofExpMom , pTof.length -ltIntegral.getL (), o2::constants::physics::MassProton * o2::constants::physics::MassProton);
874+ casctof.posFlightPi = o2::framework::pid::tof::MassToExpTime (pTof.tofExpMom , pTof.length -ltIntegral.getL (), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged);
875+ }
876+ }
877+ }
878+ if (lengthPositive>0 .0f ){
812879 casctof.posDeltaTimeAsXiPi = (pTof.tofSignal - pTof.tofEvTime ) - (xiFlight + lambdaFlight + casctof.posFlightPi );
813880 casctof.posDeltaTimeAsXiPr = (pTof.tofSignal - pTof.tofEvTime ) - (xiFlight + lambdaFlight + casctof.posFlightPr );
814881 casctof.posDeltaTimeAsOmPi = (pTof.tofSignal - pTof.tofEvTime ) - (omFlight + lambdaFlight + casctof.posFlightPi );
@@ -846,19 +913,39 @@ struct strangenesstofpid {
846913 } // end positive
847914
848915 if (nTof.hasTOF && nTof.hasITS ){
849- float velocityNegativePr = velocity (negTrack.getP (), o2::constants::physics::MassProton);
850- float velocityNegativePi = velocity (negTrack.getP (), o2::constants::physics::MassPionCharged);
851- float lengthNegative = findInterceptLength (negTrack, d_bz);
852- if (lengthNegative>0 .0f ){
916+ float velocityNegativePr, velocityNegativePi, lengthNegative;
917+ velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue ;
918+ // method 0: legacy standalone without use of primary particle TOF
919+ if (calculationMethod.value == 0 ){
920+ velocityNegativePr = velocity (negTrack.getP (), o2::constants::physics::MassProton);
921+ velocityNegativePi = velocity (negTrack.getP (), o2::constants::physics::MassPionCharged);
922+ lengthNegative = findInterceptLength (negTrack, d_bz);
853923 casctof.negFlightPr = lengthNegative / velocityNegativePr;
854924 casctof.negFlightPi = lengthNegative / velocityNegativePi;
925+ }
926+ // method 1: correct primary particle TOF information
927+ // length -> revise by removing travel length to primary vertex
928+ // expected momentum -> kept as is for now, could correct at second stage
929+ // use main method from TOF to calculate expected time
930+ if (calculationMethod.value == 1 ){
931+ if (nTof.collisionId >= 0 ){
932+ auto trackCollision = collisions.rawIteratorAt (nTof.collisionId );
933+ const o2::math_utils::Point3D<float > trackVertex{trackCollision.posX (), trackCollision.posY (), trackCollision.posZ ()};
934+ o2::track::TrackLTIntegral ltIntegral;
935+ bool successPropag = o2::base::Propagator::Instance ()->propagateToDCA (trackVertex, negTrack, d_bz, 2 .f , o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr , <Integral);
936+ if (successPropag){
937+ lengthNegative = nTof.length - ltIntegral.getL ();
938+ casctof.negFlightPr = o2::framework::pid::tof::MassToExpTime (nTof.tofExpMom , nTof.length -ltIntegral.getL (), o2::constants::physics::MassProton * o2::constants::physics::MassProton);
939+ casctof.negFlightPi = o2::framework::pid::tof::MassToExpTime (nTof.tofExpMom , nTof.length -ltIntegral.getL (), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged);
940+ }
941+ }
942+ }
943+ if (lengthNegative>0 .0f ){
855944 casctof.negDeltaTimeAsXiPi = (nTof.tofSignal - nTof.tofEvTime ) - (xiFlight + lambdaFlight + casctof.negFlightPi );
856945 casctof.negDeltaTimeAsXiPr = (nTof.tofSignal - nTof.tofEvTime ) - (xiFlight + lambdaFlight + casctof.negFlightPr );
857946 casctof.negDeltaTimeAsOmPi = (nTof.tofSignal - nTof.tofEvTime ) - (omFlight + lambdaFlight + casctof.negFlightPi );
858947 casctof.negDeltaTimeAsOmPr = (nTof.tofSignal - nTof.tofEvTime ) - (omFlight + lambdaFlight + casctof.negFlightPr );
859948
860- LOGF (info, " cascade %i nTofSignal %.2f negFlightPr %.2f negFlightPi %.2f xiFlight %.2f lambdaFlight %.2f lengthNegative %.2f velocityNegativePr %.2f" , cascade.globalIndex (), nTof.tofSignal , casctof.negFlightPr , casctof.negFlightPi , xiFlight, lambdaFlight, lengthNegative, velocityNegativePr);
861-
862949 // de facto nsigma
863950 if (nSigmaCalibLoaded){
864951 if (cascade.sign ()<0 ){
@@ -891,12 +978,34 @@ struct strangenesstofpid {
891978 } // end negative
892979
893980 if (bTof.hasTOF && bTof.hasITS ){
894- float velocityBachelorPi = velocity (bachTrack.getP (), o2::constants::physics::MassPionCharged);
895- float velocityBachelorKa = velocity (bachTrack.getP (), o2::constants::physics::MassKaonCharged);
896- float lengthBachelor = findInterceptLength (bachTrack, d_bz);
897- if (lengthBachelor>0 .0f ){
981+ float velocityBachelorKa, velocityBachelorPi, lengthBachelor;
982+ velocityBachelorKa = velocityBachelorPi = lengthBachelor = o2::aod::v0data::kNoTOFValue ;
983+ // method 0: legacy standalone without use of primary particle TOF
984+ if (calculationMethod.value == 0 ){
985+ velocityBachelorPi = velocity (bachTrack.getP (), o2::constants::physics::MassPionCharged);
986+ velocityBachelorKa = velocity (bachTrack.getP (), o2::constants::physics::MassKaonCharged);
987+ lengthBachelor = findInterceptLength (bachTrack, d_bz);
898988 casctof.bachFlightPi = lengthBachelor / velocityBachelorPi;
899989 casctof.bachFlightKa = lengthBachelor / velocityBachelorKa;
990+ }
991+ // method 1: correct primary particle TOF information
992+ // length -> revise by removing travel length to primary vertex
993+ // expected momentum -> kept as is for now, could correct at second stage
994+ // use main method from TOF to calculate expected time
995+ if (calculationMethod.value == 1 ){
996+ if (bTof.collisionId >= 0 ){
997+ auto trackCollision = collisions.rawIteratorAt (bTof.collisionId );
998+ const o2::math_utils::Point3D<float > trackVertex{trackCollision.posX (), trackCollision.posY (), trackCollision.posZ ()};
999+ o2::track::TrackLTIntegral ltIntegral;
1000+ bool successPropag = o2::base::Propagator::Instance ()->propagateToDCA (trackVertex, bachTrack, d_bz, 2 .f , o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr , <Integral);
1001+ if (successPropag){
1002+ lengthBachelor = bTof.length - ltIntegral.getL ();
1003+ casctof.bachFlightPi = o2::framework::pid::tof::MassToExpTime (bTof.tofExpMom , bTof.length -ltIntegral.getL (), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged);
1004+ casctof.bachFlightKa = o2::framework::pid::tof::MassToExpTime (bTof.tofExpMom , bTof.length -ltIntegral.getL (), o2::constants::physics::MassKaonCharged * o2::constants::physics::MassKaonCharged);
1005+ }
1006+ }
1007+ }
1008+ if (lengthBachelor>0 .0f ){
9001009 casctof.bachDeltaTimeAsXiPi = (bTof.tofSignal - bTof.tofEvTime ) - (xiFlight + casctof.bachFlightPi );
9011010 casctof.bachDeltaTimeAsOmKa = (bTof.tofSignal - bTof.tofEvTime ) - (omFlight + casctof.bachFlightKa );
9021011
0 commit comments