+ }
+}
+
+
+//______________________________________________________________________________
+void AliAnalysisTaskPIDqa::FillTPCHistogramsSignal(TList *sublist, Int_t scenario, AliVTrack *track, Int_t mult)
+{
+ //
+ // Fill PID qa histograms for the TPC: Fill the histograms for the TPC signal for different settings
+ //
+
+ AliMCEvent *eventMC=MCEvent(); // MC event for MC truth PID
+
+ Double_t mom=0.; // track momentum
+ Double_t eta=0.; // track eta
+ Double_t sig=0.; // TPC dE/dx signal
+ Double_t sigStd=0.; // TPC dE/dx signal (standard = all ROCs)
+ Double_t sigIROC=0.; // TPC dE/dx signal (IROC)
+ Double_t sigOROCmedium=0.; // TPC dE/dx signal (OROCmedium)
+ Double_t sigOROClong=0.; // TPC dE/dx signal (OROClong)
+ Double_t eleLineDist=0.; // difference between TPC signal and electron expectation
+ Int_t trackLabel=0; // label of the AliVTrack to identify the corresponding MCtrack
+ Int_t pdgCode=0; // pdgcode of MC track for MC truth scenario
+ Int_t pdgCodeAbs=0; // absolute value of pdgcode to get both particles and antiparticles
+ Int_t iSigMax=1; // number of TPC signals (std = 1, set automatically higher if available)
+ Int_t nSpecies=0; // number of particle species under study
+ Int_t count=0; // counter for the number of plot sets for all species (i.e. nsigma vs. p, eta and mult)
+
+ mom=track->GetTPCmomentum();
+ eta=track->Eta();
+ sigStd=track->GetTPCsignal();
+
+ eleLineDist=sigStd-fPIDResponse->GetTPCResponse().GetExpectedSignal(track,AliPID::kElectron);
+
+ // Get number of particle species (less for V0 candidates = scenarios 40-44)
+ if (scenario > 39) nSpecies=(Int_t)AliPID::kSPECIES;
+ else nSpecies=(Int_t)AliPID::kSPECIESC;
+
+ // Set number of plot sets for all species
+ // (i.e. only nsigma vs. p => count=1; also vs. eta and mult => count=3)
+ if ( scenario == 1 || scenario > 39) count=3;
+ else count=1;
+
+ // Get MC track ( --> can be deleted if TPC signal is NOT filled for scenario=1 (MC truth)
+ if (eventMC) {
+ trackLabel=TMath::Abs(track->GetLabel());
+ AliVTrack *mcTrack=(AliVTrack*)eventMC->GetTrack(trackLabel);
+ pdgCode=mcTrack->PdgCode();
+ pdgCodeAbs=TMath::Abs(pdgCode);
+ }
+
+ // Get TPC dE/dx info and different TPC signals (IROC, OROCmedium, OROClong)
+ AliTPCdEdxInfo* fTPCdEdxInfo = 0x0;
+ fTPCdEdxInfo = track->GetTPCdEdxInfo();
+
+ if (fTPCdEdxInfo) {
+ sigIROC=fTPCdEdxInfo->GetTPCsignalShortPad();
+ sigOROCmedium=fTPCdEdxInfo->GetTPCsignalMediumPad();
+ sigOROClong=fTPCdEdxInfo->GetTPCsignalLongPad();
+ iSigMax=4;
+
+ //printf("mom = %.3f sigStd = %.3f sigIROC = %.3f sigOROCmedium = %.3f sigOROClong = %.3f \n",mom,sigStd,sigIROC,sigOROCmedium,sigOROClong);
+ }
+
+
+ // TPC signal for all particles vs. momentum (standard, IROC, OROCmedium, OROClong)
+ TH2 *h1std=(TH2*)sublist->At(count*nSpecies+4);
+ if (h1std) {
+ h1std->Fill(mom,sigStd);
+ }
+
+ TH2 *h1iroc=(TH2*)sublist->At(count*nSpecies+5);
+ if ( h1iroc && sigIROC ) {
+ h1iroc->Fill(mom,sigIROC);
+ }
+
+ TH2 *h1orocm=(TH2*)sublist->At(count*nSpecies+6);
+ if (h1orocm && sigOROCmedium ) {
+ h1orocm->Fill(mom,sigOROCmedium);
+ }
+
+ TH2 *h1orocl=(TH2*)sublist->At(count*nSpecies+7);
+ if ( h1orocl && sigOROClong ) {
+ h1orocl->Fill(mom,sigOROClong);
+ }
+
+
+ // - Beginn: MIP pions: TPC signal vs. eta, TPC signal vs. mult -
+ if (mom>0.45 && mom<0.5 && sigStd>40 && sigStd<60) {
+
+ Bool_t isPionMC=kTRUE;
+
+ if (scenario == 1) {
+ if ( pdgCodeAbs != 211 && pdgCodeAbs != 111 ) isPionMC=kFALSE;
+ }
+
+ // MIP pions: TPC signal vs. eta (standard, IROC, OROCmedium, OROClong)
+ for (Int_t iSig=0; iSig<iSigMax; iSig++) {
+ if (iSig==0) sig=sigStd;
+ else if (iSig==1) sig=sigIROC;
+ else if (iSig==2) sig=sigOROCmedium;
+ else if (iSig==3) sig=sigOROClong;
+
+ TH2 *h2=(TH2*)sublist->At(count*nSpecies+8+iSig);
+ if ( h2 && isPionMC ) {
+ h2->Fill(eta,sig);
+ }
+ }
+
+ // MIP pions: TPC signal vs. mult (standard, IROC, OROCmedium, OROClong)
+ for (Int_t iSig=0; iSig<iSigMax; iSig++) {
+ if (iSig==0) sig=sigStd;
+ else if (iSig==1) sig=sigIROC;
+ else if (iSig==2) sig=sigOROCmedium;
+ else if (iSig==3) sig=sigOROClong;
+
+ TH2 *h3=(TH2*)sublist->At(count*nSpecies+12+iSig);
+ if ( h3 && isPionMC && mult > 0 ) {
+ h3->Fill(mult,sig);
+ }
+ }
+ } // - End: MIP pions -
+
+ // - Beginn: Electrons: TPC signal vs. eta, TPC signal vs. mult -
+ if (mom>0.32 && mom<0.38 && eleLineDist>-10. && eleLineDist<15.) {
+
+ Bool_t isElectronMC=kTRUE;
+
+ if (scenario == 1) {
+ if ( pdgCodeAbs != 11 ) isElectronMC=kFALSE;
+ }
+
+ // Electrons: TPC signal vs. eta (standard, IROC, OROCmedium, OROClong)
+ for (Int_t iSig=0; iSig<iSigMax; iSig++) {
+ if (iSig==0) sig=sigStd;
+ else if (iSig==1) sig=sigIROC;
+ else if (iSig==2) sig=sigOROCmedium;
+ else if (iSig==3) sig=sigOROClong;
+
+ TH2 *h4=(TH2*)sublist->At(count*nSpecies+16+iSig);
+ if ( h4 && isElectronMC ) {
+ h4->Fill(eta,sig);
+ }
+ }
+
+ // Electrons: TPC signal vs. mult (standard, IROC, OROCmedium, OROClong)
+ for (Int_t iSig=0; iSig<iSigMax; iSig++) {
+ if (iSig==0) sig=sigStd;
+ else if (iSig==1) sig=sigIROC;
+ else if (iSig==2) sig=sigOROCmedium;
+ else if (iSig==3) sig=sigOROClong;
+
+ TH2 *h5=(TH2*)sublist->At(count*nSpecies+20+iSig);
+ if ( h5 && isElectronMC && mult > 0 ) {
+ h5->Fill(mult,sig);
+ }
+ }
+ } // - End: Electrons -
+
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskPIDqa::FillTPCHistogramsNsigma(TList *sublist, Int_t scenario, AliVTrack *track, Int_t mult)
+{
+ //
+ // Fill PID qa histograms for the TPC: Fill the histograms for TPC Nsigma for different settings
+ //
+
+ AliMCEvent *eventMC=MCEvent(); // MC event for MC truth PID
+
+ Double_t mom=0.; // track momentum
+ Double_t eta=0.; // track eta
+ Double_t nSigma=0.; // number of sigmas wrt. expected signal
+ Double_t sig=0.; // TPC dE/dx signal
+ Double_t eleLineDist=0.; // difference between TPC signal and electron expectation
+ Int_t trackLabel=0; // label of the AliVTrack to identify the corresponding MCtrack
+ Int_t pdgCode=0; // pdgcode of MC track for MC truth scenario
+ Int_t pdgCodeAbs=0; // absolute value of pdgcode to get both particles and antiparticles
+ Int_t nSpecies=0; // number of particle species under study
+ Int_t count=0; // counter for the number of plot sets for all species (i.e. vs. p, eta and mult)
+
+ mom=track->GetTPCmomentum();
+ eta=track->Eta();
+ sig=track->GetTPCsignal();
+
+ eleLineDist=sig-fPIDResponse->GetTPCResponse().GetExpectedSignal(track,AliPID::kElectron);
+
+ // Get number of particle species (less for V0 candidates = scenarios 40-44)
+ if (scenario > 39) nSpecies=(Int_t)AliPID::kSPECIES;
+ else nSpecies=(Int_t)AliPID::kSPECIESC;
+
+ // Set number of plot sets for all species
+ // (i.e. only vs. p => count=1; also vs. eta and mult => count=3)
+ if ( scenario == 1 || scenario > 39 ) count=3;
+ else count=1;
+
+ // Get MC track
+ if (eventMC) {
+ trackLabel=TMath::Abs(track->GetLabel());
+ AliVTrack *mcTrack=(AliVTrack*)eventMC->GetTrack(trackLabel);
+ pdgCode=mcTrack->PdgCode();
+ pdgCodeAbs=TMath::Abs(pdgCode);
+ }
+
+
+ // - Beginn: Nsigma vs. p, vs. eta and vs. multiplicity for different particle species -
+ for (Int_t ispecie=0; ispecie<nSpecies; ++ispecie){
+
+ TH2 *h=(TH2*)sublist->At(ispecie);
+ if (!h) continue;
+
+ if (scenario == 1) {
+ if ( ispecie == 0 && pdgCodeAbs != 11 ) continue; // Electron
+ if ( ispecie == 1 && pdgCodeAbs != 13 ) continue; // Muon
+ if ( ispecie == 2 && pdgCodeAbs != 211 && pdgCodeAbs!=111 ) continue; // Pion
+ if ( ispecie == 3 && pdgCodeAbs != 321 && pdgCodeAbs!=311 ) continue; // Kaon
+ if ( ispecie == 4 && pdgCodeAbs != 2212 ) continue; // Proton
+ if ( ispecie == 5 && pdgCodeAbs != 1000010020 ) continue; // Deuteron
+ if ( ispecie == 6 && pdgCodeAbs != 1000010030 ) continue; // Triton
+ if ( ispecie == 7 && pdgCodeAbs != 1000020030 ) continue; // Helium-3
+ if ( ispecie == 8 && pdgCodeAbs != 1000020040 ) continue; // Alpha
+ }
+ else if (scenario > 39) {
+ if ( ispecie == 0 && scenario != 40 ) continue; // Electron
+ if ( ispecie == 1 ) continue; // Muon
+ if ( ispecie == 2 && scenario != 42 ) continue; // Pion
+ if ( ispecie == 3 && scenario != 43 ) continue; // Kaon
+ if ( ispecie == 4 && scenario != 44 ) continue; // Proton
+ }
+
+ if (scenario == 2) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie, AliTPCPIDResponse::kdEdxHybrid);
+ }
+ else if (scenario == 3) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie, AliTPCPIDResponse::kdEdxOROC);
+ }
+ else {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie);
+ }
+
+ h->Fill(mom,nSigma);
+
+ if (count == 3) {
+ TH2 *hEta=(TH2*)sublist->At(ispecie+nSpecies);
+ TH2 *hMult=(TH2*)sublist->At(ispecie+2*nSpecies);
+
+ if ( hEta ) hEta->Fill(eta,nSigma);
+ if ( hMult && mult > 0 ) hMult->Fill(mult,nSigma);
+ }
+ } // - End: different particle species -
+
+
+ // -- Beginn: Fill histograms for MIP pions and electrons (only for some scenarios) --
+ if ( scenario == 0 || scenario == 2 || scenario == 3 ) {
+
+ // - Beginn: MIP pions: Nsigma vs. eta, Nsigma vs. mult -
+ if (mom>0.45 && mom<0.5 && sig>40 && sig<60) {
+
+ Bool_t isPionMC=kTRUE;
+
+ TH2 *h1=(TH2*)sublist->At(count*nSpecies);
+ if (h1) {
+ if (scenario == 1) {
+ if ( pdgCodeAbs != 211 && pdgCodeAbs != 111 ) isPionMC=kFALSE;
+ if (isPionMC) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion);
+ }
+ }
+ else if (scenario == 2) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion, AliTPCPIDResponse::kdEdxHybrid);
+ }
+ else if (scenario == 3) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion, AliTPCPIDResponse::kdEdxOROC);
+ }
+ else nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion);
+
+ if (isPionMC) h1->Fill(eta,nSigma);
+ }
+
+ TH2 *h2m=(TH2*)sublist->At(count*nSpecies+1);
+ if ( h2m && isPionMC && mult > 0 ) {
+ h2m->Fill(mult,nSigma);
+ }
+
+ } // - End: MIP pions -
+
+ // - Beginn: Electrons: Nsigma vs. eta, Nsigma vs. mult -
+ if (mom>0.32 && mom<0.38 && eleLineDist>-10. && eleLineDist<15.) {
+
+ Bool_t isElectronMC=kTRUE;
+
+ TH2 *h3=(TH2*)sublist->At(count*nSpecies+2);
+ if (h3) {
+ if (scenario == 1) {
+ if ( pdgCodeAbs != 11 ) isElectronMC=kFALSE;
+ if (isElectronMC) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
+ }
+ }
+ if (scenario == 2) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron, AliTPCPIDResponse::kdEdxHybrid);
+ }
+ else if (scenario == 3) {
+ nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron, AliTPCPIDResponse::kdEdxOROC);
+ }
+ else nSigma=fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
+
+ if (isElectronMC) h3->Fill(eta,nSigma);
+ }
+
+ TH2 *h4m=(TH2*)sublist->At(count*nSpecies+3);
+ if ( h4m && isElectronMC && mult > 0 ) {
+ h4m->Fill(mult,nSigma);
+ }
+
+ } // - End: Electrons -
+ } // -- End: Fill histograms for MIP pions and electrons --
+
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskPIDqa::FillTPCqa()
+{
+ //
+ // Fill PID qa histograms for the TPC
+ //
+
+ // switches for the different scenarios
+ Bool_t scBasic=1; // default/basic
+ Bool_t scMCtruth=1; // for MC truth tracks
+ Bool_t scHybrid=1; // for hybrid PID (only LHC11h)
+ Bool_t scOROChigh=1; // only OROC signal (only LHC11h)
+ Bool_t scV0=1; // for V0 candidates (only for ESDs available)
+ Int_t scCounter=0; // counter of scenarios, used for the histograms at the end of FillTPCqa
+
+ // input handler
+ AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+ AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
+ if (!inputHandler) AliFatal("Input handler needed");
+
+ AliVEvent *event=InputEvent();
+
+ // ESD or AOD event needed to get reference multiplicity (not in AliVEvent)
+ AliAODEvent *fAODevent = 0x0; // AOD event
+ AliESDEvent *fESDevent = 0x0; // ESD event
+ AliESDtrackCuts *esdTrackCuts = 0x0; // ESD track Cuts (ref mult is in AliESDtrackCuts)
+
+ Double_t eta=0.; // track eta
+ Int_t mult=0; // event multiplicity (TPConlyRefMult)
+ //Int_t nacc=0; // counter for accepted multiplicity
+
+ // Check for MC
+ scMCtruth=(MCEvent()!=0x0);
+
+ // Check if period is data LHC11h by checking if
+ // the splines for ALLhigh have been set by AliPIDResponse
+ AliTPCPIDResponse &tpcResp=fPIDResponse->GetTPCResponse();
+ if (tpcResp.GetResponseFunction(AliPID::kPion, AliTPCPIDResponse::kALLhigh)==0x0) {
+ scHybrid = kFALSE;
+ scOROChigh = kFALSE;
+ }
+
+ // Check if "ESD" or "AOD" and get the corresponding event and the beam type (or centrality)
+ TString analysisType = inputHandler->GetDataType(); // can be "ESD" or "AOD"
+ if (analysisType == "ESD") {
+ fESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
+ esdTrackCuts = new AliESDtrackCuts("esdTrackCuts");
+ //printf("\n--- New event - event type = ESD \n");
+ }
+ else if (analysisType == "AOD") {
+ fAODevent = dynamic_cast<AliAODEvent*>( InputEvent() );
+ //printf("\n--- New event - event type = AOD \n");
+
+ // disable V0 scenario, because V0s are not available for AODs in this current implementation
+ scV0=0;
+ }
+
+ // Check if Basic list is already created
+ // If not: Go to SetupTPCqa and creat lists and histograms
+ if(!fListQAtpcBasic) {
+ //printf("\n--- No list QA TPC Basic found -> go to SetupTPCqa! ---\n");
+ SetupTPCqa(scMCtruth, scHybrid, scV0);
+ }
+
+ // Get the number of scenarios by counting those, which are switched on
+ if (scBasic) scCounter++;
+ if (scMCtruth) scCounter++;
+ if (scHybrid) scCounter++;
+ if (scOROChigh) scCounter++;
+ if (scV0) scCounter++;
+
+ // Get reference multiplicity for ESDs
+ if ( analysisType == "ESD" && esdTrackCuts ) {
+ mult=esdTrackCuts->GetReferenceMultiplicity(fESDevent,kTRUE);
+ }
+
+ // Get reference multiplicity for AODs
+ if ( analysisType == "AOD" && fAODevent ) {
+ mult=fAODevent->GetHeader()->GetTPConlyRefMultiplicity();
+ }
+
+ /*if (mult < 0) {
+ printf("Reference multiplicity not available \n");
+ //return;
+ }*/
+
+ //printf("The multiplicity is = %i ",mult);
+
+
+ // -- Begin: track loop --
+ Int_t ntracks=event->GetNumberOfTracks();
+ for(Int_t itrack = 0; itrack < ntracks; itrack++){
+ AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // not that nice. status bits not in virtual interface
+ // TPC refit + ITS refit + TPC pid
+ if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;
+
+ // The TPC pid cut removes the light nuclei (>5 sigma from proton line)
+ //|| !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid )
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ eta=track->Eta();
+ if ( TMath::Abs(eta)>0.9 ) continue;
+
+ //nacc++; // counter for accepted multiplicity
+
+ // the default ("basic") scenario
+ if (scBasic == 1) {
+ FillTPCHistogramsNsigma(fListQAtpcBasic,0,track,mult);
+ FillTPCHistogramsSignal(fListQAtpcBasic,0,track,mult);
+ }
+
+ // only MC truth identified particles
+ if (scMCtruth == 1) {
+ FillTPCHistogramsNsigma(fListQAtpcMCtruth,1,track,mult);
+ }
+
+ // the "hybrid" scenario (only for LHC11h)
+ if (scHybrid == 1) {
+ FillTPCHistogramsNsigma(fListQAtpcHybrid,2,track,mult);
+ }
+
+ // the "OROC high" scenario (only for LHC11h)
+ if (scOROChigh == 1) {
+ FillTPCHistogramsNsigma(fListQAtpcOROChigh,3,track,mult);
+ }
+
+ } // -- End: track loop --
+
+
+ // -- Begin: track loops for V0 candidates --
+ if (scV0 == 1) {
+
+ // - Begin: track loop for electrons from V0 -
+ for(Int_t itrack = 0; itrack < fV0electrons->GetEntries(); itrack++){
+ AliVTrack *track=(AliVTrack*)fV0electrons->At(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // not that nice. status bits not in virtual interface
+ // TPC refit + ITS refit + TPC pid
+ if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;
+
+ // The TPC pid cut removes the light nuclei (>5 sigma from proton line)
+ //|| !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid )
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ eta=track->Eta();
+ if ( TMath::Abs(eta)>0.9 ) continue;
+
+ // fill histograms for V0 candidates
+ FillTPCHistogramsNsigma(fListQAtpcV0,40,track,mult);
+
+ } // - End: track loop for electrons from V0 -
+
+
+ // - Begin: track loop for pions from V0 -
+ for(Int_t itrack = 0; itrack < fV0pions->GetEntries(); itrack++){
+ AliVTrack *track=(AliVTrack*)fV0pions->At(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // not that nice. status bits not in virtual interface
+ // TPC refit + ITS refit + TPC pid
+ if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;
+
+ // The TPC pid cut removes the light nuclei (>5 sigma from proton line)
+ //|| !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid )
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ eta=track->Eta();
+ if ( TMath::Abs(eta)>0.9 ) continue;
+
+ // fill histograms for V0 candidates
+ FillTPCHistogramsNsigma(fListQAtpcV0,42,track,mult);
+
+ } // - End: track loop for pions from V0 -
+
+
+ // - Begin: track loop for kaons from V0 -
+ for(Int_t itrack = 0; itrack < fV0kaons->GetEntries(); itrack++){
+ AliVTrack *track=(AliVTrack*)fV0kaons->At(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // not that nice. status bits not in virtual interface
+ // TPC refit + ITS refit + TPC pid
+ if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;
+
+ // The TPC pid cut removes the light nuclei (>5 sigma from proton line)
+ //|| !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid )
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ eta=track->Eta();
+ if ( TMath::Abs(eta)>0.9 ) continue;
+
+ // fill histograms for V0 candidates
+ FillTPCHistogramsNsigma(fListQAtpcV0,43,track,mult);
+
+ } // - End: track loop for kaons from V0 -
+
+
+ // - Begin: track loop for protons from V0 -
+ for(Int_t itrack = 0; itrack < fV0protons->GetEntries(); itrack++){
+ AliVTrack *track=(AliVTrack*)fV0protons->At(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // not that nice. status bits not in virtual interface
+ // TPC refit + ITS refit + TPC pid
+ if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;
+
+ // The TPC pid cut removes the light nuclei (>5 sigma from proton line)
+ //|| !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid )
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ eta=track->Eta();
+ if ( TMath::Abs(eta)>0.9 ) continue;
+
+ // fill histograms for V0 candidates
+ FillTPCHistogramsNsigma(fListQAtpcV0,44,track,mult);
+
+ } // - End: track loop for protons from V0 -
+
+ } // -- End: track loops for V0 candidates --
+
+
+ // Multiplicity distribution
+ TH1 *hm=(TH1*)fListQAtpc->At(scCounter);
+ if (hm) {
+ hm->Fill(mult);
+ }
+
+ //printf("\nAccepted multiplicity = %i \n --- END of event --- \n",nacc);
+
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskPIDqa::FillTRDqa()
+{
+ //
+ // Fill PID qa histograms for the TRD
+ //
+ AliVEvent *event=InputEvent();
+ Int_t ntracks = event->GetNumberOfTracks();
+ for(Int_t itrack = 0; itrack < ntracks; itrack++){
+ AliVTrack *track = (AliVTrack *)event->GetTrack(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // not that nice. status bits not in virtual interface
+ // TPC refit + ITS refit + TPC pid + TRD out
+ if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||
+// !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid ) || //removes light nuclei. So it is out for the moment
+ !( (status & AliVTrack::kTRDout ) == AliVTrack::kTRDout )) continue;
+
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ Double_t likelihoods[AliPID::kSPECIES];
+ if(fPIDResponse->ComputeTRDProbability(track, AliPID::kSPECIES, likelihoods) != AliPIDResponse::kDetPidOk) continue;
+ Int_t ntracklets = 0;
+ Double_t momentum = -1.;
+ for(Int_t itl = 0; itl < 6; itl++) {
+ if(track->GetTRDmomentum(itl) > 0.) {
+ ntracklets++;
+ if(momentum < 0) momentum = track->GetTRDmomentum(itl);
+ }
+ }
+
+ for(Int_t ispecie = 0; ispecie < AliPID::kSPECIES; ispecie++){
+ TH2F *hLike = (TH2F *)fListQAtrd->At(ntracklets*AliPID::kSPECIES+ispecie);
+ if (hLike) hLike->Fill(momentum,likelihoods[ispecie]);
+ }
+
+ //=== nSigma and signal ===
+ for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){
+ TH2 *h=(TH2*)fListQAtrdNsig->At(ispecie);
+ TH2 *hTPCTOF=(TH2*)fListQAtrdNsigTPCTOF->At(ispecie);
+ if (!h || !hTPCTOF) continue;
+ Float_t nSigmaTPC=fPIDResponse->NumberOfSigmas(AliPIDResponse::kTPC, track, (AliPID::EParticleType)ispecie);
+ Float_t nSigmaTRD=fPIDResponse->NumberOfSigmas(AliPIDResponse::kTRD, track, (AliPID::EParticleType)ispecie);
+ Float_t nSigmaTOF=fPIDResponse->NumberOfSigmas(AliPIDResponse::kTOF, track, (AliPID::EParticleType)ispecie);
+ h->Fill(momentum,nSigmaTRD);
+
+ if (TMath::Abs(nSigmaTPC)<3 && TMath::Abs(nSigmaTOF)<3) {
+ hTPCTOF->Fill(momentum,nSigmaTRD);
+ }
+ }
+
+ TH2 *h=(TH2*)fListQAtrdNsig->Last();
+
+ if (h) {
+ Double_t sig=track->GetTRDsignal();
+ h->Fill(momentum,sig);
+ }
+
+ }
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskPIDqa::FillTOFqa()
+{
+ //
+ // Fill TOF information
+ //
+ AliVEvent *event=InputEvent();
+
+ Int_t ntracks=event->GetNumberOfTracks();
+ Int_t tracksAtTof = 0;
+ for(Int_t itrack = 0; itrack < ntracks; itrack++){
+ AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // TPC refit + ITS refit +
+ // TOF out + kTIME
+ // kTIME
+ // (we don't use kTOFmismatch because it depends on TPC and kTOFpid because it prevents light nuclei
+ if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||
+ !((status & AliVTrack::kTOFout ) == AliVTrack::kTOFout ) ||
+ // !((status & AliVTrack::kTOFpid ) == AliVTrack::kTOFpid ) ||
+ !((status & AliVTrack::kTIME ) == AliVTrack::kTIME ) ) continue;
+
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ tracksAtTof++;
+
+ Double_t mom=track->P();
+
+ for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){
+ TH2 *h=(TH2*)fListQAtof->At(ispecie);
+ if (!h) continue;
+ Double_t nSigma=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);
+ h->Fill(mom,nSigma);
+ }
+
+ TH2 *h=(TH2*)fListQAtof->FindObject("hSigP_TOF");
+ if (h) {
+ Double_t sig=track->GetTOFsignal()/1000.;
+ h->Fill(mom,sig);
+ }
+
+ Int_t mask = fPIDResponse->GetTOFResponse().GetStartTimeMask(mom);
+ ((TH1F*)fListQAtof->FindObject("hStartTimeMask_TOF"))->Fill((Double_t)(mask+0.5));
+
+ if (mom >= 0.75 && mom <= 1.25 ) {
+ Double_t nsigma= fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)AliPID::kPion);
+ if (mask == 0) {
+ ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-Fill"))->Fill(nsigma);
+ } else if (mask == 1) {
+ ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-TOF"))->Fill(nsigma);
+ } else if ( (mask == 2) || (mask == 4) || (mask == 6) ) {
+ ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-T0"))->Fill(nsigma);
+ } else {
+ ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-Best"))->Fill(nsigma);
+ }
+ if (mask & 0x1) { //at least TOF-T0 present
+ Double_t delta=0;
+ (void)fPIDResponse->GetSignalDelta((AliPIDResponse::EDetector)AliPIDResponse::kTOF,track,(AliPID::EParticleType)AliPID::kPion,delta);
+ ((TH1F*)fListQAtof->FindObject("hDelta_TOF_Pion"))->Fill(delta);
+ }
+ }
+
+ Double_t res = (Double_t)fPIDResponse->GetTOFResponse().GetStartTimeRes(mom);
+ ((TH1F*)fListQAtof->FindObject("hStartTimeRes_TOF"))->Fill(res);
+
+ Double_t startTimeT0 = event->GetT0TOF(0);
+ if (startTimeT0 < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeAC_T0"))->Fill(startTimeT0);
+ else {
+ startTimeT0 = event->GetT0TOF(1);
+ if (startTimeT0 < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeA_T0"))->Fill(startTimeT0);
+ startTimeT0 = event->GetT0TOF(2);
+ if (startTimeT0 < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeC_T0"))->Fill(startTimeT0);
+ }
+ }
+ if (tracksAtTof > 0) {
+ ((TH1F* )fListQAtof->FindObject("hnTracksAt_TOF"))->Fill(tracksAtTof);
+ Int_t mask = fPIDResponse->GetTOFResponse().GetStartTimeMask(5.);
+ if (mask & 0x1) ((TH1F*)fListQAtof->FindObject("hT0MakerEff"))->Fill(tracksAtTof);
+ }
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskPIDqa::FillT0qa()
+{
+ //
+ // Fill TOF information
+ //
+ AliVEvent *event=InputEvent();
+
+ Int_t ntracks=event->GetNumberOfTracks();
+
+ Int_t tracksAtT0 = 0;
+
+ for(Int_t itrack = 0; itrack < ntracks; itrack++){
+ AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);
+
+ //
+ //basic track cuts
+ //
+ ULong_t status=track->GetStatus();
+ // TPC refit + ITS refit +
+ if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
+ !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ }
+ if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
+
+ tracksAtT0++;
+ }
+
+ Bool_t t0A = kFALSE;
+ Bool_t t0C = kFALSE;
+ Bool_t t0And = kFALSE;
+ Double_t startTimeT0 = event->GetT0TOF(0); // AND
+ if (startTimeT0 < 90000) {
+ t0And = kTRUE;
+ ((TH1F*)fListQAt0->FindObject("hStartTimeAC_T0"))->Fill(startTimeT0);
+ }
+ startTimeT0 = event->GetT0TOF(1); // T0A
+ if (startTimeT0 < 90000) {
+ t0A = kTRUE;
+ ((TH1F*)fListQAt0->FindObject("hStartTimeA_T0"))->Fill(startTimeT0);