207 for (
int iTr = 0; iTr < nTracks; iTr++) {
214 Float_t bestWeight = 0.f;
215 Float_t totalWeight = 0.f;
216 Int_t mcTrackId = -1;
220 for (
int iLink = 0; iLink < stsTrackMatch->
GetNofLinks(); iLink++) {
229 if (bestWeight / totalWeight < 0.7) {
237 || TMath::Abs(cbmMCTrack->
GetPdgCode()) == 2212 || TMath::Abs(cbmMCTrack->
GetPdgCode()) == 1000010020
238 || TMath::Abs(cbmMCTrack->
GetPdgCode()) == 1000010030 || TMath::Abs(cbmMCTrack->
GetPdgCode()) == 1000020030
239 || TMath::Abs(cbmMCTrack->
GetPdgCode()) == 1000020040)) {
252 std::string prefix = std::string(GetName()) +
"::SetRecoPID: ";
254 const Double_t m2TOF[7] = {0.885, 0.245, 0.019479835, 0., 3.49, 7.83, 1.95};
256 const Int_t PdgHypo[9] = {2212, 321, 211, -11, 1000010029, 1000010030, 1000020030, -13, -19};
259 LOG(fatal) << GetName() <<
" no reco events! ";
265 for (
int iEvent = 0; iEvent < nRecoEvents; iEvent++) {
269 double eventTime =
event->
GetTzero();
271 if (eventTime < 0.) {
272 LOG(error) << prefix <<
"T0 of the event " << iEvent
273 <<
" is undefined. Ensure that the CbmRecoT0 task is run before this task.";
279 for (Int_t iTrack = 0; iTrack < nTracksEvent; iTrack++) {
285 if (stsTrackIndex < 0) {
288 assert(stsTrackIndex < (
int)
fPID.size());
290 Bool_t isElectronTRD = 0;
291 Bool_t isElectronRICH = 0;
292 Bool_t isElectron = 0;
298 stsPar->Momentum(mom);
300 Double_t p = mom.Mag();
301 Double_t pt = mom.Perp();
302 Double_t pz =
sqrt(p * p - pt * pt);
303 Int_t q = stsPar->GetQp() > 0 ? 1 : -1;
307 Int_t richIndex = globalTrack->GetRichRingIndex();
308 if (richIndex > -1) {
311 Double_t axisA = richRing->
GetAaxis();
312 Double_t axisB = richRing->
GetBaxis();
315 Double_t fMeanA = 4.95;
316 Double_t fMeanB = 4.54;
317 Double_t fRmsA = 0.30;
318 Double_t fRmsB = 0.22;
319 Double_t fRmsCoeff = 3.5;
320 Double_t fDistCut = 1.;
325 if (fabs(axisA - fMeanA) < fRmsCoeff * fRmsA && fabs(axisB - fMeanB) < fRmsCoeff * fRmsB
326 && dist < fDistCut) {
336 Double_t polAaxis = 5.64791 - 4.24077 / (p - 3.65494);
337 Double_t polBaxis = 5.41106 - 4.49902 / (p - 3.52450);
339 if (axisA < (fMeanA + fRmsCoeff * fRmsA) && axisA > polAaxis && axisB < (fMeanB + fRmsCoeff * fRmsB)
340 && axisB > polBaxis && dist < fDistCut) {
351 Int_t trdIndex = globalTrack->GetTrdTrackIndex();
365 Int_t trdIndex = globalTrack->GetTrdTrackIndex();
378 double dEdXTRD = 1e6;
380 Int_t trdIndex = globalTrack->GetTrdTrackIndex();
385 for (Int_t iTRD = 0; iTRD < trdTrack->
GetNofHits(); iTRD++) {
391 dEdXTRD = 1e6 * pz / p * eloss / trdTrack->
GetNofHits();
398 vector<double> dEdxAllveto;
401 for (
int iHit = 0; iHit < cbmStsTrack->
GetNofStsHits(); ++iHit) {
402 bool frontVeto = kFALSE, backVeto = kFALSE;
405 double x,
y, z, xNext, yNext, zNext;
412 xNext = stsHitNext->
GetX();
413 yNext = stsHitNext->
GetY();
414 zNext = stsHitNext->
GetZ();
415 dr =
sqrt((xNext -
x) * (xNext -
x) + (yNext -
y) * (yNext -
y) + (zNext - z) * (zNext - z))
422 if (!frontCluster || !backCluster) {
423 LOG(info) <<
"CbmKFParticleFinderPID: no front or back cluster";
428 for (
int iDigi = 0; iDigi < frontCluster->
GetNofDigis(); ++iDigi) {
433 for (
int iDigi = 0; iDigi < backCluster->
GetNofDigis(); ++iDigi) {
440 dEdxAllveto.push_back((frontCluster->
GetCharge()) / dr);
444 dEdxAllveto.push_back((backCluster->
GetCharge()) / dr);
448 float dEdXSTS = 1.e6;
449 if (dEdxAllveto.size() != 0) {
456 Int_t muchIndex = globalTrack->GetMuchTrackIndex();
457 if (muchIndex > -1) {
475 if (isElectronRICH && isElectronTRD) {
485 else if (isElectronRICH) {
490 Double_t l = globalTrack->GetLength();
495 Int_t tofHitIndex = globalTrack->GetTofHitIndex();
496 if (tofHitIndex < 0) {
502 LOG(error) <<
"null Tof hit pointer";
506 Double_t time = tofHit->
GetTime() - eventTime;
512 Double_t m2 = p * p * (1. / ((l / time / 29.9792458) * (l / time / 29.9792458)) - 1.);
517 for (
int iSigma = 0; iSigma < 7; iSigma++) {
520 dm2[iSigma] = fabs(m2 - m2TOF[iSigma]) / sigma[iSigma];
530 Double_t dm2min = dm2[2];
532 if (!isElectron && isMuon == 0) {
535 for (
int jPDG = 0; jPDG < 7; jPDG++) {
539 if (dm2[jPDG] < dm2min) {
549 Double_t dEdXTRDthresholdProton = 10.;
551 if (
fUseTRDdEdX && (dEdXTRD < dEdXTRDthresholdProton)) {
560 fPID[stsTrackIndex] = q * PdgHypo[iPdg];
566 fPID[stsTrackIndex] = q * PdgHypo[3];
570 fPID[stsTrackIndex] = q * PdgHypo[7];
573 fPID[stsTrackIndex] = q * PdgHypo[8];
double vecMedian(const vector< double > &vec)
ClassImp(CbmKFParticleFinderPID)
CbmKFParticleFinderPID(const char *name="CbmKFParticleFinderPID", Int_t iVerbose=0)