1 /**************************************************************************
2 * Authors : Massimo Venaruzzo (massimo.venaruzzo@ts.infn.it) *
3 * Enrico Fragiacomo (enrico.fragiacomo@ts.infn.it) *
4 * Contributors are mentioned in the code where appropriate. *
6 * Permission to use, copy, modify and distribute this software and its *
7 * documentation strictly for non-commercial purposes is hereby granted *
8 * without fee, provided that the above copyright notice appears in all *
9 * copies and that both the copyright notice and this permission notice *
10 * appear in the supporting documentation. The authors make no claims *
11 * about the suitability of this software for any purpose. It is *
12 * provided "as is" without express or implied warranty. *
13 **************************************************************************/
15 //-----------------------------------------------------------------
16 // AliAnalysisTaskSigma1385 class
17 //-----------------------------------------------------------------
23 #include "AliAnalysisManager.h"
24 #include <AliMCEventHandler.h>
25 #include <AliMCEvent.h>
42 #include "AliESDEvent.h"
43 #include "AliAODEvent.h"
44 #include "AliCascadeVertexer.h"
45 #include "AliESDcascade.h"
46 #include "AliAODcascade.h"
47 #include "AliAnalysisTaskSigma1385.h"
48 #include "AliESDtrackCuts.h"
49 #include "AliESDpid.h"
50 #include "AliTOFT0maker.h"
51 #include "AliTOFcalib.h"
52 #include "AliCDBManager.h"
53 #include "AliESDtrackCuts.h"
55 ClassImp(AliAnalysisTaskSigma1385)
57 //________________________________________________________________________
58 AliAnalysisTaskSigma1385::AliAnalysisTaskSigma1385()
59 : AliAnalysisTaskSE(),
61 //-------------------------------- For PID
77 fTOFcalibrateESD(!fisMC),
78 fTOFcorrectTExp(kTRUE),
81 fTOFresolution(100.0),
85 fAnalysisType("ESD"), fCollidingSystems(0), fDataType("REAL"), fListHistCascade(0),
86 fHistEventMultiplicity(0), fHistEventMultiplicityRAVS(0),
87 fNtuple1(0), fNtuple2(0), fNtuple3(0), fNtuple4(0)
91 //--------------------------------
96 for (i = 0; i < 5; i++) fOkTrack[i] = kFALSE;
99 //________________________________________________________________________
100 AliAnalysisTaskSigma1385::AliAnalysisTaskSigma1385(const char *name)
101 : AliAnalysisTaskSE(name),
104 //-------------------------------- For PID
120 fTOFcalibrateESD(!fisMC),
121 fTOFcorrectTExp(kTRUE),
124 fTOFresolution(100.0),
128 fAnalysisType("ESD"), fCollidingSystems(0), fDataType("REAL"), fListHistCascade(0),
129 fHistEventMultiplicity(0), fHistEventMultiplicityRAVS(0),
130 fNtuple1(0), fNtuple2(0), fNtuple3(0), fNtuple4(0)
132 //--------------------------------
135 // Output slot #0 writes into a TList container (Cascade)
136 DefineOutput(1, TList::Class());
139 for (i = 0; i < 5; i++) fOkTrack[i] = kFALSE;
142 //________________________________________________________________________
143 void AliAnalysisTaskSigma1385::UserCreateOutputObjects()
145 fListHistCascade = new TList();
147 if (! fHistEventMultiplicity) {
148 fHistEventMultiplicity = new TH1F("fHistEventMultiplicity" , "Nb of Events" , 4, -1.0, 3.0);
149 fListHistCascade->Add(fHistEventMultiplicity);
152 if (! fHistEventMultiplicityRAVS) {
153 fHistEventMultiplicityRAVS = new TH1F("fHistEventMultiplicityRAVS" , "Nb of Events Rejected After Vertex selection" , 4, -1.0, 3.0);
154 fListHistCascade->Add(fHistEventMultiplicityRAVS);
158 fNtuple1 = new TNtuple("fNtuple1", "Ntuple1", "TrkNmb");
159 fNtuple1->SetDirectory(0);
160 fListHistCascade->Add(fNtuple1);
164 fNtuple2 = new TNtuple("fNtuple2", "Ntuple2", "s:dcal:lCosPoinAn:lDaugDCA:lambdap:lambdapt:lambdamass");
165 fNtuple2->SetDirectory(0);
166 fListHistCascade->Add(fNtuple2);
170 fNtuple3 = new TNtuple("fNtuple3", "Ntuple3", "c:dcapi:ppi:ptpi:bachphi:bachtheta:okPiTPC:okPiTOF");
171 fNtuple3->SetDirectory(0);
172 fListHistCascade->Add(fNtuple3);
176 fNtuple4 = new TNtuple("fNtuple4", "Ntuple4", "dca:mc:phi:theta:eta:y:pt:p:opang:invmass");
177 fListHistCascade->Add(fNtuple4);
181 }// end UserCreateOutputObjects
184 //________________________________________________________________________
185 void AliAnalysisTaskSigma1385::UserExec(Option_t *)
189 // Called for each event
192 Info("AliAnalysisTaskSigma1385", "Starting UserExec");
194 AliMCEventHandler* eventHandler;
195 AliMCEvent* mcEvent = 0;
197 if (fDataType == "SIM") {
199 eventHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
201 Printf("ERROR: Could not retrieve MC event handler");
205 mcEvent = eventHandler->MCEvent();
207 Printf("ERROR: Could not retrieve MC event");
214 if (fDataType == "SIM") {stack = mcEvent->Stack(); fIsMC = 1; fisMC = 1;}
216 AliESDEvent *lESDevent = 0x0;
217 AliAODEvent *lAODevent = 0x0;
220 // Connect to the InputEvent
221 Int_t ncascades = -1;
222 if (fAnalysisType == "ESD") {
223 lESDevent = dynamic_cast<AliESDEvent*>(InputEvent());
225 ncascades = lESDevent->GetNumberOfCascades();
227 Printf("ERROR: lESDevent not available \n");
230 } else if (fAnalysisType == "AOD") {
231 lAODevent = dynamic_cast<AliAODEvent*>(InputEvent());
233 ncascades = lAODevent->GetNumberOfCascades();
235 Printf("ERROR: lAODevent not available \n");
239 Printf("Input type undefined \n");
244 //------------------------------for PID
250 // ----> set TPC range for PID and calibration
251 SetTPCrange(5.0, 3.0);
254 // ----> set ITS range for PID
257 // ----> set TPC calibration
258 if (fDataType == "SIM") SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
259 else SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
261 // ----> set the TOF calibration depending on type of input (sim/data)
262 SetTOFcorrectTExp(kTRUE);
264 SetTOFresolution(100.0);
265 if (fDataType == "SIM") {
266 SetTOFcalibrateESD(kFALSE);
270 SetTOFcalibrateESD(kTRUE);
271 SetTOFtuneMC(kFALSE);
276 fESDpid = new AliESDpid;
277 fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0], fTPCpar[1], fTPCpar[2], fTPCpar[3], fTPCpar[4]);
280 // initialize DB to current run
282 Printf("ERROR: lESDevent not available \n");
285 Int_t run = lESDevent->GetRunNumber();
286 if (run != fLastRun) {
287 //cout << "Run = " << run << " -- LAST = " << fLastRun << endl;
290 // setup TOF maker & calibration
291 if (!fTOFcalib) fTOFcalib = new AliTOFcalib;
292 fTOFcalib->SetCorrectTExp(fTOFcorrectTExp);
293 if (!fTOFmaker) fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib);
294 fTOFmaker->SetTimeResolution(fTOFresolution);
296 AliCDBManager *cdb = AliCDBManager::Instance();
297 cdb->ClearCache(); // suggestion by Annalisa
298 cdb->Clear(); // suggestion by Annalisa
299 cdb->SetDefaultStorage("raw://");
301 fTOFcalib->SetCorrectTExp(fTOFcorrectTExp);
305 // if required, calibrate the TOF t0 maker with current event
306 if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(lESDevent);
307 if (fTOFtuneMC) fTOFmaker->TuneForMC(lESDevent);
309 fTOFmaker->ComputeT0TOF(lESDevent);
310 fTOFmaker->ApplyT0TOF(lESDevent);
311 fESDpid->MakePID(lESDevent, kFALSE, 0.);
315 //--------------------------------------------------------
318 fHistEventMultiplicity->Fill(1);
320 //Some Quantities to characterize the event
322 Double_t b = lESDevent->GetMagneticField();
323 Int_t trackNumber = lESDevent->GetNumberOfTracks();
326 //---------------------------
327 // new part from AliCascadeVertexer (use vertexer for reconstructing Sigma(1385)
329 //const AliESDVertex *vtxT3D=lESDevent->GetPrimaryVertex();
330 const AliESDVertex *vtxT3D = lESDevent->GetPrimaryVertexTracks();
331 if (vtxT3D->GetNContributors() < 1) {
333 vtxT3D = lESDevent->GetPrimaryVertexSPD();
334 if (vtxT3D->GetNContributors() < 1) {
337 fHistEventMultiplicityRAVS->Fill(1);
344 Double_t xPrimaryVertex = vtxT3D->GetXv();
345 Double_t yPrimaryVertex = vtxT3D->GetYv();
346 Double_t zPrimaryVertex = vtxT3D->GetZv();
348 if (zPrimaryVertex > 10 || zPrimaryVertex < -10) return;
350 //-------------------------------------------------------
351 // New Part about tracks global selection criteria
352 //-------------------------------------------------------
354 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
356 esdTrackCuts->SetAcceptKinkDaughters(0); // 0 = kFalse
357 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
358 esdTrackCuts->SetMaxChi2PerClusterTPC(4);
359 esdTrackCuts->SetMinNClustersTPC(70);
362 //-------------------------------------------------------
364 //stores relevant V0s in an array
365 Int_t nV0 = (Int_t)lESDevent->GetNumberOfV0s();
368 for (Int_t i = 0; i < nV0; i++) {
369 AliESDv0 *v = lESDevent->GetV0(i);
370 if (v->GetOnFlyStatus()) continue; // if kTRUE, then this V0 is recontructed
374 nV0 = vtcs.GetEntriesFast();
376 //-------------------------------------------------------
377 // loops over bachelor tracks
378 // stores relevant tracks in another array
380 Int_t nentr = (Int_t)lESDevent->GetNumberOfTracks();
381 TArrayI trk(nentr); Int_t ntr = 0;
383 for (Int_t i = 0; i < nentr; i++) {
384 AliESDtrack *esdtr = lESDevent->GetTrack(i);
386 if (!(esdtr->GetStatus() & AliESDtrack::kITSrefit)) continue;
387 if (!(esdtr->GetStatus() & AliESDtrack::kTPCrefit)) continue;
390 if (!(esdTrackCuts->AcceptTrack(esdtr))) continue;
397 //-----------------------------------------------------
398 // nested loops over V0s and bachelors
399 Float_t massLambda = 1.11568;
401 AliCascadeVertexer *cascvert = new AliCascadeVertexer();
402 for (Int_t i = 0; i < nV0; i++) { //loop on V0s
405 AliESDv0 *v = (AliESDv0*)vtcs.UncheckedAt(i);
407 Double_t lambdaMass = 0;
409 Float_t lambdaPt = 0;
410 Float_t lambdaDCA = 0; // DCA between Lambda and Primary Vertex
411 Double_t v0cospointangle = 0;
412 Float_t v0daughtersDCA = 0;
415 // Lambda quality cuts
416 UInt_t lIdxPosXi = (UInt_t) TMath::Abs(v->GetPindex());
417 UInt_t lIdxNegXi = (UInt_t) TMath::Abs(v->GetNindex());
419 AliESDtrack *pTrackXi = lESDevent->GetTrack(lIdxPosXi);
420 AliESDtrack *nTrackXi = lESDevent->GetTrack(lIdxNegXi);
422 // Filter like-sign V0
423 if ( (TMath::Abs(pTrackXi->GetSign()) - TMath::Abs(nTrackXi->GetSign()) ) < 0.1) continue;
425 // WARNING: the following selections cannot be done for AOD yet...
428 v->ChangeMassHypothesis(kLambda0); // the v0 must be Lambda
431 if ((TMath::Abs(v->GetEffMass() - massLambda)) < 0.2) {
433 if (!(pTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue;
434 if (!(nTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue;
437 if ((pTrackXi->GetTPCNcls()) < 70) continue;
438 if ((nTrackXi->GetTPCNcls()) < 70) continue;
440 strness = 1; lambdaMass = v->GetEffMass(); lambdaP = v->P(); lambdaPt = v->Pt(); lambdaDCA = v->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex); v0cospointangle = v->GetV0CosineOfPointingAngle(); v0daughtersDCA = v->GetDcaV0Daughters();
447 v->ChangeMassHypothesis(kLambda0Bar); // the v0 must be Anti Lambda
451 if ((TMath::Abs(v->GetEffMass() - massLambda)) < 0.2) {
453 if (!(pTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue;
454 if (!(nTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue;
457 if ((pTrackXi->GetTPCNcls()) < 70) continue;
458 if ((nTrackXi->GetTPCNcls()) < 70) continue;
460 Int_t temp = strness + 1; strness = -1 * temp; lambdaMass = v->GetEffMass(); lambdaP = v->P(); lambdaPt = v->Pt(); lambdaDCA = v->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex); v0cospointangle = v->GetV0CosineOfPointingAngle(); v0daughtersDCA = v->GetDcaV0Daughters();
465 if (strness == 0) continue;
468 for (Int_t j = 0; j < ntr; j++) { //loop on tracks
472 Int_t bachTPCcls = 0;
475 if ((bidx == v->GetIndex(0)) || (bidx == v->GetIndex(1))) continue; // bach and V0's daughter's must be different!
477 AliESDtrack *btrk = lESDevent->GetTrack(bidx);
479 if (!(btrk->GetStatus() & AliESDtrack::kTPCrefit)) continue;
481 if ((bachTPCcls = btrk->GetTPCNcls()) < 70) continue;
483 //Bool_t *IsOkTrack = IsSelected(btrk); //for Alberto's PID
485 //Bool_t *okTrack = new Bool_t[5];
487 //for (Int_t k = 0; k < 5; k++) okTrack[k] = IsOkTrack[k];
492 Int_t bachCharge = btrk->Charge();
493 Float_t pionDCA = TMath::Abs(btrk->GetD(xPrimaryVertex, yPrimaryVertex, b)); // DCA between Bachelor and Primary Vertex
495 Double_t bachphi = btrk->Phi();
496 Double_t bachtheta = btrk->Theta();
497 Double_t bachmass = 0.13957;
498 Double_t bachp = btrk->GetP();
499 Double_t bachpt = btrk->Pt();
502 // Distance between Lambda and Pion bachelor
503 AliESDv0 v0(*v), *pv0 = &v0;
504 AliExternalTrackParam bt(*btrk), *pbt = &bt;
505 Double_t dca = cascvert->PropagateToDCA(pv0, pbt, b); // distance bwn V0 and bach (in cm)
506 if (dca > 10.0) continue; // Note: was 0.1! Enlarged->further filter in second pass analysis
509 AliESDcascade cascade(*pv0, *pbt, bidx); //constucts a sigma1385 candidate
510 AliESDcascade *xi = &cascade;
513 UInt_t lBachIdx = (UInt_t) TMath::Abs(xi->GetBindex());
514 AliESDtrack *bachTrackXi = lESDevent->GetTrack(lBachIdx);
519 if (fDataType == "SIM") {
521 Int_t pLabel = TMath::Abs(pTrackXi->GetLabel());
522 Int_t nLabel = TMath::Abs(nTrackXi->GetLabel());
523 Int_t bachLabel = TMath::Abs(bachTrackXi->GetLabel());
525 Int_t motherpLabel = stack->Particle(pLabel)->GetFirstMother();
526 Int_t mothernLabel = stack->Particle(nLabel)->GetFirstMother();
527 Int_t motherbachLabel = stack->Particle(bachLabel)->GetFirstMother();
530 //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
531 //cout<< "plabel " << pLabel << " nlabel " << nLabel << " mother p " << motherpLabel << " mother n " << mothernLabel << " bachlabel " << bachLabel << " mother bach " << motherbachLabel << endl;
532 //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
534 if (motherpLabel > -1 && mothernLabel > -1) {
535 TParticle *plambda = stack->Particle(motherpLabel);
536 Int_t grandmother = plambda->GetFirstMother();
538 motherpLabel = TMath::Abs(motherpLabel);
539 mothernLabel = TMath::Abs(mothernLabel);
540 //motherbachLabel = TMath::Abs(motherbachLabel);
542 //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
543 //cout<< "plabel " << pLabel << " nlabel " << nLabel << " mother p " << motherpLabel << " mother n " << mothernLabel << " mother lambda " << grandmother << " bachlabel " << bachLabel << " mother bach " << motherbachLabel << endl;
544 //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
546 if (motherbachLabel > -1) {
549 //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
550 //cout<< "mother lambda " << grandmother << " mother bach " << motherbachLabel << " PDG Code "<< stack->Particle(grandmother)->GetPdgCode() << endl;
551 //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
553 if ((motherpLabel == mothernLabel) && (grandmother == motherbachLabel) &&
554 ((TMath::Abs(stack->Particle(grandmother)->GetPdgCode()) == 3114) ||
555 (TMath::Abs(stack->Particle(grandmother)->GetPdgCode()) == 3224))) mcTrue = 1;
557 if( (motherpLabel == mothernLabel) && (grandmother == motherbachLabel) &&
558 (TMath::Abs(stack->Particle(grandmother)->GetPdgCode())==3312) ) mcTrue = 2;
566 Double_t lBachMomX = 0., lBachMomY = 0., lBachMomZ = 0.;
567 Double_t lPMom[3] = {0., 0., 0.,};
568 Double_t lNMom[3] = {0., 0., 0.,};
569 Float_t lLambdaMomX = 0., lLambdaMomY = 0., lLambdaMomZ = 0.;
570 xi->GetBPxPyPz(lBachMomX, lBachMomY, lBachMomZ);
571 xi->GetPPxPyPz(lPMom[0], lPMom[1], lPMom[2]);
572 xi->GetNPxPyPz(lNMom[0], lNMom[1], lNMom[2]);
573 lLambdaMomX = lPMom[0] + lNMom[0];
574 lLambdaMomY = lPMom[1] + lNMom[1];
575 lLambdaMomZ = lPMom[2] + lNMom[2];
577 Float_t lRapXi = xi->RapXi();
578 Float_t lEta = xi->Eta();
579 Float_t lTheta = xi->Theta();
580 Float_t lPhi = xi->Phi();
581 Float_t lPt = xi->Pt();
582 Float_t lP = xi->P();
584 // Support variables for invariant mass calculation
585 TLorentzVector lambda, pion, sigma;
586 Double_t eLambda = TMath::Sqrt(lLambdaMomX * lLambdaMomX + lLambdaMomY * lLambdaMomY + lLambdaMomZ * lLambdaMomZ + lambdaMass * lambdaMass);
587 Double_t ePion = TMath::Sqrt(lBachMomX * lBachMomX + lBachMomY * lBachMomY + lBachMomZ * lBachMomZ + bachmass * bachmass) ;
589 lambda.SetPxPyPzE(lLambdaMomX, lLambdaMomY, lLambdaMomZ, eLambda);
590 pion.SetPxPyPzE(lBachMomX, lBachMomY, lBachMomZ, ePion);
592 sigma = lambda + pion;
594 Double_t openingangle, invmass = 0;
596 openingangle = TMath::ACos((lBachMomX * lLambdaMomX + lBachMomY * lLambdaMomY + lBachMomZ * lLambdaMomZ) / ((TMath::Sqrt(lBachMomX * lBachMomX + lBachMomY * lBachMomY + lBachMomZ * lBachMomZ)) * (TMath::Sqrt(lLambdaMomX * lLambdaMomX + lLambdaMomY * lLambdaMomY +
597 lLambdaMomZ * lLambdaMomZ))));
602 fNtuple1->Fill(trackNumber);
603 fNtuple2->Fill((1.*strness), lambdaDCA, v0cospointangle, v0daughtersDCA , lambdaP, lambdaPt, lambdaMass);
604 //fNtuple3->Fill((1.*bachCharge), pionDCA, bachp, bachpt, bachphi, bachtheta, okTrack[1], okTrack[2]);
605 fNtuple3->Fill((1.*bachCharge), pionDCA, bachp, bachpt, bachphi, bachtheta, fOkTrack[1], fOkTrack[2]);
606 fNtuple4->Fill(dca, (1.*mcTrue), lPhi, lTheta, lEta, lRapXi, lPt, lP, openingangle, invmass);
617 Info("AliAnalysisTaskSigma1385", "Number of reconstructed Sigma(1385): %d", ncasc);
621 PostData(1, fListHistCascade);
625 //________________________________________________________________________
627 //Bool_t *AliAnalysisTaskSigma1385::IsSelected(AliESDtrack *track)
628 void AliAnalysisTaskSigma1385::IsSelected(AliESDtrack *track)
634 //for (Int_t i = 0; i < 5; i++) okTrack[i] = kFALSE;
635 for (Int_t i = 0; i < 5; i++) fOkTrack[i] = kFALSE;
638 AliITSPIDResponse itsrsp(fIsMC);
643 Double_t times[10], tpcNSigma, tpcMaxNSigma, itsSignal, itsNSigma, mom, tofTime, tofSigma, tofRef, tofRel;
644 Bool_t okTOF = kFALSE;
645 Bool_t okTPC = kFALSE;
646 Bool_t okITS = kFALSE;
647 Bool_t isTPC = kFALSE;
648 Bool_t isITSSA = kFALSE;
649 Bool_t isTOF = kFALSE;
652 // get commonly used variables
653 status = (ULong_t)track->GetStatus();
655 isTPC = ((status & AliESDtrack::kTPCin) != 0);
656 isITSSA = ((!isTPC) && (track->IsOn(AliESDtrack::kITSrefit)) && (!track->IsOn(AliESDtrack::kITSpureSA))); //(!isTPC && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
657 isTOF = (((status & AliESDtrack::kTOFout) != 0) && ((status & AliESDtrack::kTIME) != 0) /* && mom > TMath::Max(b1, b2)*/);
660 // check if the track type matches what is required
661 if (!isTPC && !isITSSA) {
662 AliDebug(AliLog::kDebug + 2, "Track is not either a TPC track or a ITS standalone. Rejected");
666 } else if (isTPC && !fUseGlobal) {
667 AliDebug(AliLog::kDebug + 2, "Global tracks not used. Rejected");
671 } else if (isITSSA && !fUseITSSA) {
672 AliDebug(AliLog::kDebug + 2, "ITS standalone not used. Rejected");
677 // does a preliminary check on TOF values, if necessary
678 // then, if the reference time or TOF signal are meaningless
679 // even if the 'isTOF' flag is true, switch it to false
681 track->GetIntegratedTimes(times);
682 tofTime = (Double_t)track->GetTOFsignal();
683 tofSigma = fTOFmaker->GetExpectedSigma(mom, times[AliPID::kPion], AliPID::ParticleMass(AliPID::kPion));
684 tofRef = times[AliPID::kPion];
685 if (tofRef <= 0.0 && tofSigma <= 0.0) isTOF = kFALSE;
691 if (isTPC) { // this branch is entered by all global tracks
694 tpcNSigma = TMath::Abs(fESDpid->NumberOfSigmasTPC(track, AliPID::kPion));
695 if (track->GetInnerParam()->P() > fTPCpLimit) tpcMaxNSigma = fMinTPCband; else tpcMaxNSigma = fMaxTPCband;
696 okTPC = (tpcNSigma <= tpcMaxNSigma);
697 AliDebug(AliLog::kDebug + 2, Form("TPC nsigma = %f -- max = %f -- cut %s", tpcNSigma, tpcMaxNSigma, (okTPC ? "passed" : "failed")));
699 // if TPC is not checked, it is as if all tracks do pass the cut
701 AliDebug(AliLog::kDebug + 2, "TPC not checked, track accepted");
704 // check TOF (only if flags are OK)
707 // TOF can be checked only when track is matched there
708 track->GetIntegratedTimes(times);
709 tofTime = (Double_t)track->GetTOFsignal();
710 tofSigma = fTOFmaker->GetExpectedSigma(mom, times[AliPID::kPion], AliPID::ParticleMass(AliPID::kPion));
711 tofRef = times[AliPID::kPion];
713 tofRel = (tofTime - tofRef) / tofSigma;
714 okTOF = ((tofRel >= fMinTOF) && (tofRel <= fMaxTOF));
715 AliDebug(AliLog::kDebug + 2, Form("TOF nsigma = %f -- range = %f %f -- cut %s", tofRel, fMinTOF, fMaxTOF, (okTOF ? "passed" : "failed")));
717 // if TOF is not matched, the answer depends on TPC:
718 // - if TPC is required, track is checked only there and TOF simply ignored
719 // - if TPC is not required, track is rejected when TOF does not match it, if TOF check is required
720 if (fCheckTPC) okTOF = kTRUE; else okTOF = kFALSE;
726 } else if (isITSSA) { // this branch is entered by all ITS standalone tracks
727 // check dE/dx only if this is required, otherwise ITS standalone are just added but not checked for PID
729 itsSignal = track->GetITSsignal();
730 itsCluMap = track->GetITSClusterMap();
732 for (k = 2; k < 6; k++) if (itsCluMap & (1 << k)) ++nITS;
733 //if (nITS < 3) return kFALSE;
734 //itsNSigma = itsrsp.GetNumberOfSigmas(mom, itsSignal, AliPID::kPion, nITS, kTRUE);
735 //okITS = ((TMath::Abs(itsNSigma)) <= fMaxITSband);
739 itsNSigma = itsrsp.GetNumberOfSigmas(mom, itsSignal, AliPID::kPion, nITS, kTRUE);
740 okITS = ((TMath::Abs(itsNSigma)) <= fMaxITSband);
741 AliDebug(AliLog::kDebug + 2, Form("ITS nsigma = %f -- max = %f -- cut %s", itsNSigma, fMaxITSband, (okITS ? "passed" : "failed")));
747 // if we are here, the track is surely bad
754 //okTrack[0] = okITS;
755 //okTrack[1] = okTPC;
756 //okTrack[2] = okTOF;
757 //okTrack[3] = isTPC;
758 //okTrack[4] = isITSSA;
764 fOkTrack[4] = isITSSA;
766 //cout<<"##########################################"<<endl;
767 //cout<<"isITSSA "<<isITSSA<< " isTPC "<<isTPC<<endl;
768 //cout<<"##########################################"<<endl;
784 //________________________________________________________________________
785 void AliAnalysisTaskSigma1385::Terminate(Option_t *)
787 // Draw result to the screen
788 // Called once at the end of the query