coverity fix and some clean up
authormchojnac <Marek.Chojnacki@cern.ch>
Tue, 13 Jan 2015 20:23:09 +0000 (21:23 +0100)
committermchojnac <Marek.Chojnacki@cern.ch>
Tue, 13 Jan 2015 20:23:09 +0000 (21:23 +0100)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothPID.cxx

index 82588ca..a408e0c 100644 (file)
@@ -356,7 +356,6 @@ Bool_t AliSpectraBothEventCuts::CheckCentralityCut()
        
        TString par1name("cent");
        par1name+=fCentEstimator;
-       cout<<par1name.Data()<<endl;
        TParameter<Double_t>* par= dynamic_cast<TParameter<Double_t>*>(fAOD->FindListObject(par1name.Data()));
        if(par)
        {
@@ -414,6 +413,12 @@ Bool_t AliSpectraBothEventCuts::CheckMultiplicityCut()
                else
                {
                        AliESDEvent* esdevent=dynamic_cast<AliESDEvent*>(fAOD);
+                       if(!esdevent)
+                       {
+                               AliFatal("Not a standard ESD");
+                               return kFALSE;
+
+                       }
                        AliESDtrackCuts::MultEstTrackType estType = esdevent->GetPrimaryVertexTracks()->GetStatus() ? AliESDtrackCuts::kTrackletsITSTPC : AliESDtrackCuts::kTracklets;
                        Ncharged=AliESDtrackCuts::GetReferenceMultiplicity(esdevent,estType,fetarangeofmultiplicitycut);
                }
@@ -422,8 +427,17 @@ Bool_t AliSpectraBothEventCuts::CheckMultiplicityCut()
        {
                AliAODEvent* aodevent=0x0;
                aodevent=dynamic_cast<AliAODEvent*>(fAOD);
+               if(!aodevent)
+               {
+                       AliFatal("Not a standard AOD");
+                       return kFALSE;
+               }
                 AliAODHeader * header = dynamic_cast<AliAODHeader*>(aodevent->GetHeader());
-                if(!header) AliFatal("Not a standard AOD");
+                if(!header)
+               { 
+                       AliFatal("Not a standard AOD");
+                       return kFALSE;
+               }
 
                if(TMath::Abs(0.8-fetarangeofmultiplicitycut)<0.1)
                        Ncharged=header->GetRefMultiplicityComb08();
index 7349de2..5974b1e 100644 (file)
@@ -69,7 +69,7 @@ void AliSpectraBothPID::FillQAHistos(AliSpectraBothHistoManager * hman, AliVTrac
 
        }
        Float_t tmppt=TMath::Min(trackCuts->GetPtTOFMatchingPion(),TMath::Min(trackCuts->GetPtTOFMatchingKaon(),trackCuts->GetPtTOFMatchingProton()));
-       if(track->Pt()>tmppt&&trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trackCuts->CheckTOFMatchingParticleType(kSpPion))
+       if(track->Pt()>=tmppt&&trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trackCuts->CheckTOFMatchingParticleType(kSpPion))
        {
     
                 hman->GetPIDHistogram(kHistPIDTOF)->Fill(track->P(),(track->GetTOFsignal()/100)*track->Charge()); // PID histo
@@ -222,36 +222,36 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
 
        if(trackCuts->GetUseTypeDependedTOFCut())
        {
-               if(trackCuts->CheckTOFMatchingParticleType(kSpPion)&&trk->Pt()>trackCuts->GetPtTOFMatchingPion())
+               if(trackCuts->CheckTOFMatchingParticleType(kSpPion)&&trk->Pt()>=trackCuts->GetPtTOFMatchingPion())
                {       
                        nsigmaTOFkPion   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kPion)+fshiftTOF); 
                        nsigmaTPCTOFkPion   = TMath::Sqrt((nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion)/2.);
                }
-               else if (trk->Pt()>trackCuts->GetPtTOFMatchingPion()) // tracks without proper flags
+               else if (trk->Pt()>=trackCuts->GetPtTOFMatchingPion()) // tracks without proper flags
                {
                        nsigmaTOFkPion   = 10000.0; 
                        nsigmaTPCTOFkPion   =10000.0;
 
                }       
                        
-               if(trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trk->Pt()>trackCuts->GetPtTOFMatchingKaon())
+               if(trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trk->Pt()>=trackCuts->GetPtTOFMatchingKaon())
                {       
                        nsigmaTOFkKaon   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kKaon)+fshiftTOF); 
                        nsigmaTPCTOFkKaon   = TMath::Sqrt((nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon)/2.);
                }
-               else if (trk->Pt()>trackCuts->GetPtTOFMatchingKaon()) // tracks without proper flags
+               else if (trk->Pt()>=trackCuts->GetPtTOFMatchingKaon()) // tracks without proper flags
                {
                        nsigmaTOFkKaon   = 10000.0; 
                        nsigmaTPCTOFkKaon   =10000.0;
 
                }       
 
-               if(trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trk->Pt()>trackCuts->GetPtTOFMatchingProton())
+               if(trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trk->Pt()>=trackCuts->GetPtTOFMatchingProton())
                {       
                        nsigmaTOFkProton   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kProton)+fshiftTOF); 
                        nsigmaTPCTOFkProton   = TMath::Sqrt((nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton)/2.);
                }
-               else if (trk->Pt()>trackCuts->GetPtTOFMatchingProton()) // tracks without proper flags
+               else if (trk->Pt()>=trackCuts->GetPtTOFMatchingProton()) // tracks without proper flags
                {
                        nsigmaTOFkProton   = 10000.0; 
                        nsigmaTPCTOFkProton   =10000.0;
@@ -260,7 +260,7 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
 
 
        }
-       else if(trk->Pt()>trackCuts->GetPtTOFMatching())
+       else if(trk->Pt()>=trackCuts->GetPtTOFMatching())
        {
                nsigmaTOFkProton = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kProton)+fshiftTOF);
                nsigmaTOFkKaon   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kKaon)+fshiftTOF);