]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding the flag not to make QA PID histograms. Adding possibility to select on WD...
authormchojnac <Marek.Chojnacki@cern.ch>
Wed, 12 Feb 2014 14:51:49 +0000 (15:51 +0100)
committermchojnac <Marek.Chojnacki@cern.ch>
Wed, 12 Feb 2014 14:56:49 +0000 (15:56 +0100)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraBoth.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraBoth.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothHistoManager.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothHistoManager.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothPID.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/QAPlotsBoth.C

index 80cc688785da9053060e1981ca359187d0a9fd6d..78a7879f193cb4724f47546a412eb49ecfc856ee 100644 (file)
@@ -59,7 +59,9 @@ using namespace std;
 ClassImp(AliAnalysisTaskSpectraBoth)
 
 //________________________________________________________________________
-AliAnalysisTaskSpectraBoth::AliAnalysisTaskSpectraBoth(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0),  fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0)
+AliAnalysisTaskSpectraBoth::AliAnalysisTaskSpectraBoth(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0),  fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0),
+fmakePIDQAhisto(1),fMotherWDPDGcode(-1)
+
 {
   // Default constructor
   
@@ -76,7 +78,7 @@ AliAnalysisTaskSpectraBoth::AliAnalysisTaskSpectraBoth(const char *name) : AliAn
 void AliAnalysisTaskSpectraBoth::UserCreateOutputObjects()
 {
   // create output objects
-  fHistMan = new AliSpectraBothHistoManager("SpectraHistos",fNRebin);
+  fHistMan = new AliSpectraBothHistoManager("SpectraHistos",fNRebin,fmakePIDQAhisto);
 
   if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");
   if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");
@@ -246,7 +248,8 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                if (!fTrackCuts->IsSelected(track,kTRUE)) 
                        continue;
                ntracks++;
-               fPID->FillQAHistos(fHistMan, track, fTrackCuts);
+               if(fmakePIDQAhisto)
+                       fPID->FillQAHistos(fHistMan, track, fTrackCuts);
                
                //calculate DCA for AOD track
                if(dca==-999.)
@@ -301,6 +304,7 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                                Bool_t isSecondaryWeak     = kFALSE; 
                                Int_t idGen     =kSpUndefined;
                                Int_t pdgcode=0;
+                               Int_t motherpdg=-1;
                                if (ifAODEvent==AliSpectraBothTrackCuts::kAODobject)
                                {
                                        AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));
@@ -315,7 +319,7 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                                        isSecondaryMaterial      = partMC->IsSecondaryFromMaterial();
                                        //cout<<"AOD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;
 
-                                       if(!isPrimary&&!isSecondaryWeak&&!isSecondaryMaterial) 
+                                       if(!isPrimary&&!isSecondaryWeak&&!isSecondaryMaterial)//old tagging for old AODs 
                                        {
                                                AliError("old tagging");
                                                Int_t mfl=-999,codemoth=-999;
@@ -336,7 +340,16 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                                                        isSecondaryMaterial = kTRUE;
                                        }
                                        //cout<<"AOD 2 tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;
-
+                                       if(isSecondaryWeak)
+                                       {       
+                                               Int_t indexMoth=partMC->GetMother(); // FIXME ignore fakes? TO BE CHECKED, on ESD is GetFirstMother()
+                                               if(indexMoth>=0)
+                                               {
+                                                       AliAODMCParticle* moth = (AliAODMCParticle*) arrayMC->At(indexMoth);
+                                                       if(!moth)
+                                                               motherpdg=TMath::Abs(moth->GetPdgCode());
+                                               }
+                                       }
 
                                        idGen     = fPID->GetParticleSpecie(partMC);
                                        pdgcode=partMC->GetPdgCode(); 
@@ -354,6 +367,16 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                                        isSecondaryMaterial      = stack->IsSecondaryFromMaterial(TMath::Abs(track->GetLabel()));
                                        //cout<<"ESD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<endl;
                                        
+                                       if(isSecondaryWeak)     
+                                       {
+
+                                               TParticle* moth=stack->Particle(TMath::Abs(partMC->GetFirstMother()));
+                                               if(moth)
+                                                        motherpdg = TMath::Abs(moth->GetPdgCode());
+
+                                       }
+                                       
+
                                        idGen     = fPID->GetParticleSpecie(partMC);
                                        pdgcode=partMC->GetPdgCode(); 
                                }
@@ -407,8 +430,16 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                                 ///..... END FIXME
                  
                                // Fill secondaries
-                               if(isSecondaryWeak    )  
-                                       fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+                               if(isSecondaryWeak)
+                               {  
+                                       if(fMotherWDPDGcode>0)
+                                       {
+                                               if(motherpdg==fMotherWDPDGcode)
+                                                       fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+                                       }       
+                                       else    
+                                               fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+                               }
                                if(isSecondaryMaterial)  
                                        fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryMaterial , idRec, charge)->Fill(track->Pt(),dca);
                  
index 817c2aee19617e526a324fee1a3e8eca2dd1a59a..2af596d1de2fddd9dd996bc8a11dc27b67b3ce94 100644 (file)
@@ -31,7 +31,7 @@ class AliAnalysisTaskSpectraBoth : public AliAnalysisTaskSE
 public:
 
    // constructors
-  AliAnalysisTaskSpectraBoth() : AliAnalysisTaskSE(), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0)
+  AliAnalysisTaskSpectraBoth() : AliAnalysisTaskSE(), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0),fmakePIDQAhisto(1),fMotherWDPDGcode(-1)
  {}
   AliAnalysisTaskSpectraBoth(const char *name);
    virtual ~AliAnalysisTaskSpectraBoth() {}
@@ -57,6 +57,8 @@ public:
    void SetAliESDtrackCuts(AliESDtrackCuts*  cuts ){fCuts=cuts;}
    void SetdotheMCLoopAfterEventCuts (Bool_t flag) {fdotheMCLoopAfterEventCuts=flag;}
    Bool_t GetdotheMCLoopAfterEventCuts () const {return fdotheMCLoopAfterEventCuts;}
+   void SetMakePIDQAHisto(Bool_t flag){fmakePIDQAhisto=flag;}
+   void SetMotherWDPDGCode(Int_t value){fMotherWDPDGcode=value;}               
 private:
 
    AliVEvent           * fAOD;         //! AOD object
@@ -67,13 +69,15 @@ private:
    Bool_t          fIsMC;// true if processing MC
    Int_t      fNRebin; //rebin of histos
    Bool_t fUseMinSigma; // if true use min sigma 
-     AliESDtrackCuts *fCuts; // ESD track cuts 
-    Bool_t fdotheMCLoopAfterEventCuts; // if true first check the ESD event cuts than loop over MC info , if flase other approach     
+   AliESDtrackCuts *fCuts; // ESD track cuts 
+   Bool_t fdotheMCLoopAfterEventCuts; // if true first check the ESD event cuts than loop over MC info , if flase other approach     
+   Bool_t fmakePIDQAhisto; // if true makes PIDQA histos
+   Int_t fMotherWDPDGcode; //the abs of pdg code of the mother for WD decays , used during systematic studies          
 
    AliAnalysisTaskSpectraBoth(const AliAnalysisTaskSpectraBoth&);
    AliAnalysisTaskSpectraBoth& operator=(const AliAnalysisTaskSpectraBoth&);
 
-   ClassDef(AliAnalysisTaskSpectraBoth, 2);
+   ClassDef(AliAnalysisTaskSpectraBoth, 3);
 };
 
 #endif
index b38113a02f8e1f325d01c84b4f00beb62ce74666..ad47e0c08d26d3c33e91e11e25e7bdc0efae32fa 100644 (file)
@@ -56,7 +56,7 @@ using namespace AliSpectraNameSpaceBoth;
  // };
 
 
-AliSpectraBothHistoManager::AliSpectraBothHistoManager(const char *name,Int_t nrebin): TNamed(name, "AOD Spectra Histo Manager"), fOutputList(0), fNRebin(0)
+AliSpectraBothHistoManager::AliSpectraBothHistoManager(const char *name,Int_t nrebin,Bool_t pidqa): TNamed(name, "AOD Spectra Histo Manager"), fOutputList(0), fNRebin(0)
 {
   // ctor
   fNRebin=nrebin;
@@ -70,8 +70,8 @@ AliSpectraBothHistoManager::AliSpectraBothHistoManager(const char *name,Int_t nr
       if (ihist > kNPtGenHist && ihist <= kNPtGenAllChHist) BookPtGenAllChHistogram(kHistNameBoth[ihist]);  // PT histos
       if (ihist > kNPtGenAllChHist && ihist <= kNPtRecHist) BookPtRecHistogram(kHistNameBoth[ihist]);  // PT histos
       if (ihist > kNPtRecHist && ihist <= kNPtRecAllChHist) BookPtRecAllChHistogram(kHistNameBoth[ihist]);  // PT histos
-      if (ihist > kNPtRecAllChHist && ihist <= kNHistPID) BookPIDHistogram(kHistNameBoth[ihist]);  // PID histos
-      if (ihist > kNHistPID && ihist <= kNHistNSig) BookNSigHistogram(kHistNameBoth[ihist]);  // NSigmaSep histos
+      if (ihist > kNPtRecAllChHist && ihist <= kNHistPID && pidqa) BookPIDHistogram(kHistNameBoth[ihist]);  // PID histos
+      if (ihist > kNHistPID && ihist <= kNHistNSig && pidqa) BookNSigHistogram(kHistNameBoth[ihist]);  // NSigmaSep histos
       if(ihist==kHistGenMulvsRawMul) BookGenMulvsRawMulHistogram(kHistNameBoth[ihist]); 
     }
    
index e0012efb1c861b7ebd983c1a51119d29013be09f..25e44e9632c067aa859219a2982f9752c80b0dc8 100644 (file)
@@ -70,7 +70,7 @@ class AliSpectraBothHistoManager : public TNamed
 {
 public:
    AliSpectraBothHistoManager() :  TNamed(), fOutputList(0), fNRebin(0) {}
-  AliSpectraBothHistoManager(const char *name,Int_t nrebin);
+  AliSpectraBothHistoManager(const char *name,Int_t nrebin,Bool_t pidqa=kTRUE);
    virtual  ~AliSpectraBothHistoManager() ;
 
 
index 58c2ab825cd5cbd92963fbc8b7c83adb461c3617..291205195f2b13cc4bc5f268126ff4fda4469b01 100644 (file)
@@ -277,17 +277,20 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
                return kSpUndefined;//if is the default value for the three
        if( ( nsigmaKaon   < nsigmaPion ) && ( nsigmaKaon < nsigmaProton ) && (nsigmaKaon   < fNSigmaPID))
        {
-               hman->GetPIDHistogram(kHistPIDTPCKaonRec)->Fill(trk->GetTPCmomentum(), trk->GetTPCsignal()*trk->Charge()); // Reconstructed PIDKaon histo
+               if(hman->GetPIDHistogram(kHistPIDTPCKaonRec))
+                       hman->GetPIDHistogram(kHistPIDTPCKaonRec)->Fill(trk->GetTPCmomentum(), trk->GetTPCsignal()*trk->Charge()); // Reconstructed PIDKaon histo
                return kSpKaon;
        }
        if( ( nsigmaPion   < nsigmaKaon ) && ( nsigmaPion < nsigmaProton ) && (nsigmaPion   < fNSigmaPID))
        {
-               hman->GetPIDHistogram(kHistPIDTPCPionRec)->Fill(trk->GetTPCmomentum(), trk->GetTPCsignal()*trk->Charge()); // Reconstructed PIDPion histo
+               if(hman->GetPIDHistogram(kHistPIDTPCPionRec))
+                       hman->GetPIDHistogram(kHistPIDTPCPionRec)->Fill(trk->GetTPCmomentum(), trk->GetTPCsignal()*trk->Charge()); // Reconstructed PIDPion histo
                return kSpPion;
        }
        if( ( nsigmaProton < nsigmaKaon ) && ( nsigmaProton < nsigmaPion ) && (nsigmaProton < fNSigmaPID))
        {
-               hman->GetPIDHistogram(kHistPIDTPCProtonRec)->Fill(trk->GetTPCmomentum(), trk->GetTPCsignal()*trk->Charge()); // Reconstructed PIDProton histo
+               if(hman->GetPIDHistogram(kHistPIDTPCProtonRec))
+                       hman->GetPIDHistogram(kHistPIDTPCProtonRec)->Fill(trk->GetTPCmomentum(), trk->GetTPCsignal()*trk->Charge()); // Reconstructed PIDProton histo
                return kSpProton;
        }
        // else, return undefined
index fe77a64e5ab658746fa190ce417f0f31cde08a3b..1af1f5aaeca3d7abbf318101ed262c7d6d111033 100644 (file)
@@ -18,12 +18,17 @@ TString pidmethods[3]={"TPC","TOF","TPCTOF"};
                                // nsig_data->RebinX(20);                        
                                // nsig_data->RebinY(4);
                                // nsig_data->Sumw2();
+                               if(!nsig_data)
+                                       continue;
 
                                 TH2F *nsig_mc = (TH2F*)((TH2F*)hman_mc->GetNSigHistogram(Form("hHistNSig%sPt%s",Particle[ipart].Data(),pidmethods[imethod].Data())))->Clone();
                                 //nsig_mc->RebinX(20);                  
                                // nsig_mc->RebinY(4);
                                // nsig_mc->Sumw2();
+                               if(!nsig_mc)
+                                       continue;
                                 
+
                                Int_t ibin=1;
                                Float_t binsize=nsig_mc->GetXaxis()->GetBinWidth(1);