]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New class for normalization studies (Giacomo)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Oct 2010 23:22:14 +0000 (23:22 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Oct 2010 23:22:14 +0000 (23:22 +0000)
PWG3/PWG3vertexingHFLinkDef.h
PWG3/libPWG3vertexingHF.pkg
PWG3/vertexingHF/AliAnalysisTaskSED0Mass.cxx
PWG3/vertexingHF/AliAnalysisTaskSED0Mass.h
PWG3/vertexingHF/AliAnalysisTaskSEDplus.cxx
PWG3/vertexingHF/AliAnalysisTaskSEDplus.h
PWG3/vertexingHF/AliNormalizationCounter.cxx [new file with mode: 0644]
PWG3/vertexingHF/AliNormalizationCounter.h [new file with mode: 0644]
PWG3/vertexingHF/macros/AddTaskD0Mass.C
PWG3/vertexingHF/macros/AddTaskDplus.C

index bb5bdd229203e241b55df1c63bb332887f2569b1..285197df831850b99f9aa55df37c6ada764240bc 100644 (file)
@@ -43,6 +43,7 @@
 #pragma link C++ class AliSignificanceCalculator+;
 #pragma link C++ class AliHFMassFitter+;
 #pragma link C++ class AliHFPtSpectrum+;
+#pragma link C++ class AliNormalizationCounter+;
 #pragma link C++ class AliAnalysisTaskSEBkgLikeSignJPSI+;
 #pragma link C++ class AliAnalysisTaskSEBkgLikeSignD0+;
 #pragma link C++ class AliAnalysisTaskSEJPSItoEle+;
index 00f4caeef6480a3aae865b8075317548cadbe051..37b4379973f2f0569291f0981f3ea958203389bd 100644 (file)
@@ -36,6 +36,7 @@ SRCS:=   vertexingHF/AliAODRecoDecayHF.cxx \
        vertexingHF/AliMultiDimVector.cxx vertexingHF/AliSignificanceCalculator.cxx \
        vertexingHF/AliHFMassFitter.cxx \
        vertexingHF/AliHFPtSpectrum.cxx \
+       vertexingHF/AliNormalizationCounter.cxx \
        vertexingHF/AliAnalysisTaskSEBkgLikeSignJPSI.cxx \
        vertexingHF/AliAnalysisTaskSEBkgLikeSignD0.cxx \
        vertexingHF/AliAnalysisTaskSEJPSItoEle.cxx \
index 2aed4dfda31fad35e1c0652413589f6d76612a39..cc2b6aa99c43c2ac4bcb241362f629e9ff15ef65 100644 (file)
@@ -48,7 +48,7 @@
 #include "AliAnalysisVertexingHF.h"
 #include "AliAnalysisTaskSE.h"
 #include "AliAnalysisTaskSED0Mass.h"
-
+#include "AliNormalizationCounter.h"
 
 ClassImp(AliAnalysisTaskSED0Mass)
 
@@ -65,6 +65,7 @@ fArray(0),
 fReadMC(0),
 fCutOnDistr(0),
 fUsePid4Distr(0),
+fCounter(0),
 fNPtBins(1),
 fTotPosPairs(0),
 fTotNegPairs(0),
@@ -88,6 +89,7 @@ fArray(0),
 fReadMC(0),
 fCutOnDistr(0),
 fUsePid4Distr(0),
+fCounter(0),
 fNPtBins(1),
 fTotPosPairs(0),
 fTotNegPairs(0),
@@ -114,7 +116,8 @@ fFillOnlyD0D0bar(0)
   DefineOutput(4,TList::Class());  //My private output
   // Output slot #5 writes into a TList container (cuts)
   DefineOutput(5,AliRDHFCutsD0toKpi::Class());  //My private output
-
+  // Output slot #6 writes Normalization Counter 
+  DefineOutput(6,AliNormalizationCounter::Class());
 }
 
 //________________________________________________________________________
@@ -140,7 +143,10 @@ AliAnalysisTaskSED0Mass::~AliAnalysisTaskSED0Mass()
     delete fNentries;
     fNentries = 0;
   }
+  if(fCounter){
+    delete fCounter;
+    fCounter=0;
+  }
  
 }  
 
@@ -559,13 +565,14 @@ void AliAnalysisTaskSED0Mass::UserCreateOutputObjects()
   fNentries->GetXaxis()->SetBinLabel(14,"Lambda");
   fNentries->GetXaxis()->SetNdivisions(1,kFALSE);
 
+  fCounter = new AliNormalizationCounter("NormalizationCounter");
+
   // Post the data
   PostData(1,fOutputMass);
   PostData(2,fDistr);
   PostData(3,fNentries);
   PostData(4,fChecks);
-  
+  PostData(6,fCounter);  
   return;
 }
 
@@ -656,7 +663,7 @@ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/)
   
   //histogram filled with 1 for every AOD
   fNentries->Fill(0);
-    
+  fCounter->StoreEvent(aod,fReadMC);   
   if(!fCuts->IsEventSelected(aod)) return;
   
   // AOD primary vertex
@@ -728,14 +735,14 @@ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/)
   }
   //number of events with good vertex and at least 2 good tracks
   if (isGoodTrack>=2 && isGoodVtx) fNentries->Fill(4);
-  
+
   // loop over candidates
   Int_t nInD0toKpi = inputArray->GetEntriesFast();
   if(fDebug>2) printf("Number of D0->Kpi: %d\n",nInD0toKpi);
 
   // FILE *f=fopen("4display.txt","a");
   // fprintf(f,"Number of D0->Kpi: %d\n",nInD0toKpi);
-
+  Int_t nSelectedloose=0,nSelectedtight=0;  
   for (Int_t iD0toKpi = 0; iD0toKpi < nInD0toKpi; iD0toKpi++) {
     //Int_t nPosPairs=0, nNegPairs=0;
     //cout<<"inside the loop"<<endl;
@@ -745,7 +752,7 @@ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/)
     if(!(d->GetDaughter(0) || d->GetDaughter(1))) {
       AliDebug(1,"at least one daughter not found!");
       fNentries->Fill(6);
-      return;
+      continue;
     }
 
     // Bool_t unsetvtx=kFALSE;
@@ -763,29 +770,30 @@ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/)
     if ( fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(421)) ) {
       //if( TMath::Abs(eta0)<0.9 && TMath::Abs(eta1)<0.9 ){
        //apply cuts on tracks
+      nSelectedloose++;
       Int_t isSelected = fCuts->IsSelected(d,AliRDHFCuts::kTracks);
-
       if(((AliAODTrack*)d->GetDaughter(0))->GetTPCNcls() < 70 || ((AliAODTrack*)d->GetDaughter(1))->GetTPCNcls() < 70) isSelected=kFALSE;
-      if (!isSelected) return;
+      if (!isSelected) continue;
+      nSelectedtight++;
       fNentries->Fill(7);       
       if(fDebug>2) cout<<"tracks selected"<<endl;
 
       Int_t ptbin=fCuts->PtBin(d->Pt());
-      if(ptbin==-1) {fNentries->Fill(5); return;} //out of bounds
+      if(ptbin==-1) {fNentries->Fill(5); continue;} //out of bounds
       FillVarHists(aod,d,mcArray,fCuts,fDistr);
       FillMassHists(aod,d,mcArray,fCuts,fOutputMass);
     }
   
     //if(unsetvtx) d->UnsetOwnPrimaryVtx();
   } //end for prongs
-
-
+  fCounter->StoreCandidates(aod,nSelectedloose,kTRUE);  
+  fCounter->StoreCandidates(aod,nSelectedtight,kFALSE);  
   // Post the data
   PostData(1,fOutputMass);
   PostData(2,fDistr);
   PostData(3,fNentries);
   PostData(4,fChecks);
-
+  PostData(6,fCounter);
   return;
 }
 
@@ -1428,8 +1436,11 @@ void AliAnalysisTaskSED0Mass::Terminate(Option_t */*option*/)
     printf("ERROR: fChecks not available\n");
     return;
   }
-  
+  fCounter = dynamic_cast<AliNormalizationCounter*>(GetOutputData(6));    
+  if (!fCounter) {
+    printf("ERROR: fCounter not available\n");
+    return;
+  }
   for(Int_t ipt=0;ipt<5;ipt++){ //change 5 in GetNPtBins when sure it is written and check
 
 
index 156c67cd9bee6a1789705991270d5e87b799f015..ee681b5f2b7024772e929cc2f805b855fb31ed92 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "AliAnalysisTaskSE.h"
 #include "AliRDHFCutsD0toKpi.h"
+#include "AliNormalizationCounter.h"
 
 class AliAODEvent;
 
@@ -68,13 +69,14 @@ class AliAnalysisTaskSED0Mass : public AliAnalysisTaskSE
   Bool_t    fReadMC;              //  flag for MC array: kTRUE = read it, kFALSE = do not read it
   Bool_t    fCutOnDistr;          //  flag to decide if apply cut also on distributions: 0 no cuts, 1 looser cuts, 2 tighter cuts 
   Bool_t    fUsePid4Distr;        //  flag to use the particle identification to fill the signal histograms of distributions. It has effect only with fReadMC=kFALSE
+  AliNormalizationCounter *fCounter;//!AliNormalizationCounter on output slot 6
   Int_t     fNPtBins;             //  number of pt bins
   Int_t*    fTotPosPairs;         //[fNPtBins]
   Int_t*    fTotNegPairs;         //[fNPtBins] 
   Double_t  fLsNormalization;     //  normalization
   Int_t     fFillOnlyD0D0bar;     // flag to fill mass histogram with D0/D0bar only (0 = fill with both, 1 = fill with D0 only, 2 = fill with D0bar only)
 
-  ClassDef(AliAnalysisTaskSED0Mass,9); // AliAnalysisTaskSE for the MC association of heavy-flavour decay candidates
+  ClassDef(AliAnalysisTaskSED0Mass,10); // AliAnalysisTaskSE for the MC association of heavy-flavour decay candidates
 };
 
 #endif
index a1bb70a53e47c186f91d5f95ea8c99b0e03ca390..7fabe861a6fd0b291a072a32c38dc72d2c12a09c 100644 (file)
@@ -43,6 +43,7 @@
 #include "AliAnalysisVertexingHF.h"
 #include "AliAnalysisTaskSE.h"
 #include "AliAnalysisTaskSEDplus.h"
+#include "AliNormalizationCounter.h"
 
 ClassImp(AliAnalysisTaskSEDplus)
 
@@ -66,8 +67,10 @@ AliAnalysisTaskSE(),
   fListCuts(0),
   fRDCutsProduction(0),
   fRDCutsAnalysis(0),
+  fCounter(0),
   fFillNtuple(kFALSE),
   fReadMC(kFALSE),
+  fUseStrangeness(kFALSE),
   fDoLS(kFALSE)
 {
    // Default constructor
@@ -92,8 +95,10 @@ fBinWidth(0.002),
 fListCuts(0),
 fRDCutsProduction(dpluscutsprod),
 fRDCutsAnalysis(dpluscutsana),
+fCounter(0),
 fFillNtuple(fillNtuple),
 fReadMC(kFALSE),
+fUseStrangeness(kFALSE),
 fDoLS(kFALSE)
 {
   // 
@@ -108,9 +113,12 @@ fDoLS(kFALSE)
  // Output slot #2 writes cut to private output
   //  DefineOutput(2,AliRDHFCutsDplustoKpipi::Class());
   DefineOutput(2,TList::Class());
+// Output slot #3 writes cut to private output
+  DefineOutput(3,AliNormalizationCounter::Class());
+
   if(fFillNtuple){
-    // Output slot #3 writes into a TNtuple container
-    DefineOutput(3,TNtuple::Class());  //My private output
+    // Output slot #4 writes into a TNtuple container
+    DefineOutput(4,TNtuple::Class());  //My private output
   }
 }
 
@@ -190,6 +198,10 @@ AliAnalysisTaskSEDplus::~AliAnalysisTaskSEDplus()
     fRDCutsAnalysis = 0;
   }
 
+  if(fCounter){
+    delete fCounter;
+    fCounter = 0;
+  }
 
 
 }  
@@ -704,6 +716,10 @@ void AliAnalysisTaskSEDplus::UserCreateOutputObjects()
   fOutput->Add(fYVsPtSig);
   fOutput->Add(fYVsPtSigTC);
 
+
+  //Counter for Normalization
+  fCounter = new AliNormalizationCounter("NormalizationCounter");//new line
+
   if(fFillNtuple){
     OpenFile(2); // 2 is the slot number of the ntuple
    
@@ -722,6 +738,8 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
 
   AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
   
+
   TClonesArray *array3Prong = 0;
   TClonesArray *arrayLikeSign =0;
   if(!aod && AODEvent() && IsStandardAOD()) {
@@ -755,8 +773,8 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
 
   // fix for temporary bug in ESDfilter 
   // the AODs with null vertex pointer didn't pass the PhysSel
-  if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return;
-
+  if(!aod->GetPrimaryVertex()||TMath::Abs(aod->GetMagneticField())<0.001) return;
+  fCounter->StoreEvent(aod,fReadMC);
   fHistNEvents->Fill(0); // count event
   // Post the data already here
   PostData(1,fOutput);
@@ -794,6 +812,7 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
   Int_t pdgDgDplustoKpipi[3]={321,211,211};
   // Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};//TO REMOVE
   //Double_t *cutsDplus = new (Double_t*)fRDCuts->GetCuts();
+  Int_t nSelectedloose=0,nSelectedtight=0;
   for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
     AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
     
@@ -805,6 +824,9 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
     }
 
     if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate)) {
+
+  
+
       Int_t iPtBin = -1;
       Double_t ptCand = d->Pt();
 
@@ -813,6 +835,7 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
       }
       
       Int_t passTightCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate);
+     
 
       Int_t labDp=-1;
       Float_t deltaPx=0.;
@@ -891,6 +914,7 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
       
        index=GetHistoIndex(iPtBin);
        if(isFidAcc){
+         nSelectedloose++;
          fMassHist[index]->Fill(invMass);
          fCosPHist[index]->Fill(cosp);
          fDLenHist[index]->Fill(dlen);
@@ -900,6 +924,7 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
          fDCAHist[index]->Fill(dca);
          
          if(passTightCuts){
+           nSelectedtight++;
            fMassHistTC[index]->Fill(invMass);
            if(d->GetCharge()>0) fMassHistTCPlus[index]->Fill(invMass);
            else if(d->GetCharge()<0) fMassHistTCMinus[index]->Fill(invMass);
@@ -910,13 +935,42 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
          if(labDp>=0) {
            index=GetSignalHistoIndex(iPtBin);
            if(isFidAcc){
+             Float_t factor[3]={1.,1.,1.};
+             if(fUseStrangeness){
+               for(Int_t iprong=0;iprong<3;iprong++){
+                 AliAODTrack *trad = (AliAODTrack*)d->GetDaughter(iprong);
+                 Int_t labd= trad->GetLabel();
+                 if(labd>=0){
+                   AliAODMCParticle *dau = (AliAODMCParticle*)arrayMC->At(labd);
+                   if(dau){
+                     Int_t labm = dau->GetMother();
+                     if(labm>=0){
+                       AliAODMCParticle *mot = (AliAODMCParticle*)arrayMC->At(labm);
+                       if(mot){
+                         if(TMath::Abs(mot->GetPdgCode())==310 || TMath::Abs(mot->GetPdgCode())==130 || TMath::Abs(mot->GetPdgCode())==321){ //K0_S, K0_L, K^+-
+                           if(d->PtProng(iprong)<=1)factor[iprong]=1./.7;
+                           else factor[iprong]=1./.6;
+                           //          fNentries->Fill(12);
+                         }
+                         if(TMath::Abs(mot->GetPdgCode())==3122) { //Lambda
+                           factor[iprong]=1./0.25;
+                           //            fNentries->Fill(13);
+                         }//if 3122
+                       }//if(mot)
+                     }//if labm>0
+                   }//if(dau)
+                 }//if labd>=0
+               }//prong loop
+             }
+             Float_t fact=1.;for(Int_t k=0;k<3;k++)fact=fact*factor[k];
              fMassHist[index]->Fill(invMass);
-             fCosPHist[index]->Fill(cosp);
-             fDLenHist[index]->Fill(dlen);
-             fSumd02Hist[index]->Fill(sumD02);
-             fSigVertHist[index]->Fill(sigvert);
-             fPtMaxHist[index]->Fill(ptmax);
-             fDCAHist[index]->Fill(dca);
+             fCosPHist[index]->Fill(cosp,fact);
+             fDLenHist[index]->Fill(dlen,fact);
+             Float_t sumd02s=d->Getd0Prong(0)*d->Getd0Prong(0)*factor[0]*factor[0]+d->Getd0Prong(1)*d->Getd0Prong(1)*factor[1]*factor[1]+d->Getd0Prong(2)*d->Getd0Prong(2)*factor[2]*factor[2];
+             fSumd02Hist[index]->Fill(sumd02s);
+             fSigVertHist[index]->Fill(sigvert,fact);
+             fPtMaxHist[index]->Fill(ptmax,fact);
+             fDCAHist[index]->Fill(dca,fact);
              if(passTightCuts){
                fMassHistTC[index]->Fill(invMass);            
                if(d->GetCharge()>0) fMassHistTCPlus[index]->Fill(invMass);
@@ -928,13 +982,42 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
          }else{
            index=GetBackgroundHistoIndex(iPtBin);
            if(isFidAcc){
+             Float_t factor[3]={1.,1.,1.};
+             if(fUseStrangeness){
+               for(Int_t iprong=0;iprong<3;iprong++){
+                 AliAODTrack *trad = (AliAODTrack*)d->GetDaughter(iprong);
+                 Int_t labd= trad->GetLabel();
+                 if(labd>=0){
+                   AliAODMCParticle *dau = (AliAODMCParticle*)arrayMC->At(labd);
+                   if(dau){
+                     Int_t labm = dau->GetMother();
+                     if(labm>=0){
+                       AliAODMCParticle *mot = (AliAODMCParticle*)arrayMC->At(labm);
+                       if(mot){
+                         if(TMath::Abs(mot->GetPdgCode())==310 || TMath::Abs(mot->GetPdgCode())==130 || TMath::Abs(mot->GetPdgCode())==321){ //K0_S, K0_L, K^+-
+                           if(d->PtProng(iprong)<=1)factor[iprong]=1./.7;
+                           else factor[iprong]=1./.6;
+                           //          fNentries->Fill(12);
+                         }
+                         if(TMath::Abs(mot->GetPdgCode())==3122) { //Lambda
+                           factor[iprong]=1./0.25;
+                           //            fNentries->Fill(13);
+                         }//if 3122
+                       }//if(mot)
+                     }//if labm>0
+                   }//if(dau)
+                 }//if labd>=0
+               }//prong loop
+             }
+             Float_t fact=1.;for(Int_t k=0;k<3;k++)fact=fact*factor[k];
              fMassHist[index]->Fill(invMass);
-             fCosPHist[index]->Fill(cosp);
-             fDLenHist[index]->Fill(dlen);
-             fSumd02Hist[index]->Fill(sumD02);
-             fSigVertHist[index]->Fill(sigvert);
-             fPtMaxHist[index]->Fill(ptmax);
-             fDCAHist[index]->Fill(dca);
+             fCosPHist[index]->Fill(cosp,fact);
+             fDLenHist[index]->Fill(dlen,fact);
+             Float_t sumd02s=d->Getd0Prong(0)*d->Getd0Prong(0)*factor[0]*factor[0]+d->Getd0Prong(1)*d->Getd0Prong(1)*factor[1]*factor[1]+d->Getd0Prong(2)*d->Getd0Prong(2)*factor[2]*factor[2];
+             fSumd02Hist[index]->Fill(sumd02s);
+             fSigVertHist[index]->Fill(sigvert,fact);
+             fPtMaxHist[index]->Fill(ptmax,fact);
+             fDCAHist[index]->Fill(dca,fact);
              if(passTightCuts){
                fMassHistTC[index]->Fill(invMass);
                if(d->GetCharge()>0) fMassHistTCPlus[index]->Fill(invMass);
@@ -943,15 +1026,18 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
            }   
          }
        }
-      }    
+      }  
     }
     if(unsetvtx) d->UnsetOwnPrimaryVtx();
   }
+  fCounter->StoreCandidates(aod,nSelectedloose,kTRUE);
+  fCounter->StoreCandidates(aod,nSelectedtight,kFALSE);
   
   //start LS analysis
   if(fDoLS && arrayLikeSign) LSAnalysis(array3Prong,arrayLikeSign,aod,vtx1,nOS);
   
   PostData(1,fOutput);    
+  PostData(3,fCounter);    
   return;
 }
 
@@ -1130,9 +1216,10 @@ void AliAnalysisTaskSEDplus::Terminate(Option_t */*option*/)
     }
  
   }
+  fCounter = dynamic_cast<AliNormalizationCounter*>(GetOutputData(3)); 
 
   if(fFillNtuple){
-    fNtupleDplus = dynamic_cast<TNtuple*>(GetOutputData(3));
+    fNtupleDplus = dynamic_cast<TNtuple*>(GetOutputData(4));
   }
 
   TCanvas *c1=new TCanvas("c1","D+ invariant mass distribution",500,500);
index ddddc55aec78cf236687169a59910a2e0c252fb7..53ac3bea79a5e722b67381f8c7797c20abe0d1a4 100644 (file)
@@ -24,6 +24,7 @@
 #include "AliRDHFCutsDplustoKpipi.h"
 #include "AliAnalysisTaskSE.h"
 #include "AliAnalysisVertexingHF.h"
+#include "AliNormalizationCounter.h"
 
 class AliAnalysisTaskSEDplus : public AliAnalysisTaskSE
 {
@@ -35,6 +36,7 @@ class AliAnalysisTaskSEDplus : public AliAnalysisTaskSE
 
   void SetReadMC(Bool_t readMC=kTRUE){fReadMC=readMC;}
   void SetDoLikeSign(Bool_t dols=kTRUE){fDoLS=dols;}
+  void SetUseStrangeness(Bool_t uses=kTRUE){fUseStrangeness=uses;}
   void SetMassLimits(Float_t range);
   void SetMassLimits(Float_t lowlimit, Float_t uplimit);
   void SetPtBinLimit(Int_t n, Float_t *limitarray);
@@ -101,12 +103,14 @@ class AliAnalysisTaskSEDplus : public AliAnalysisTaskSE
   TList *fListCuts; //list of cuts
   AliRDHFCutsDplustoKpipi *fRDCutsProduction; //Production D+ Cuts
   AliRDHFCutsDplustoKpipi *fRDCutsAnalysis; //Cuts for Analysis
+  AliNormalizationCounter *fCounter;//!Counter for normalization
   Double_t fArrayBinLimits[kMaxPtBins+1]; //limits for the Pt bins
   Bool_t fFillNtuple;   // flag for filling ntuple
   Bool_t fReadMC;    //flag for access to MC
+  Bool_t fUseStrangeness;//flag to enhance strangeness in MC to fit to data
   Bool_t fDoLS;      //flag to do LS analysis
   
-  ClassDef(AliAnalysisTaskSEDplus,8); // AliAnalysisTaskSE for the MC association of heavy-flavour decay candidates
+  ClassDef(AliAnalysisTaskSEDplus,9); // AliAnalysisTaskSE for the MC association of heavy-flavour decay candidates
 };
 
 #endif
diff --git a/PWG3/vertexingHF/AliNormalizationCounter.cxx b/PWG3/vertexingHF/AliNormalizationCounter.cxx
new file mode 100644 (file)
index 0000000..35aebfe
--- /dev/null
@@ -0,0 +1,164 @@
+#include "AliNormalizationCounter.h"
+#include <AliESDEvent.h>
+#include <AliESDtrack.h>
+#include <AliAODEvent.h>
+#include <AliVParticle.h>
+#include <AliTriggerAnalysis.h>
+#include <TH1F.h>
+#include <TH2D.h>
+#include <TList.h>
+#include <TString.h>
+#include <TCanvas.h>
+#include <AliPhysicsSelection.h>
+
+ClassImp(AliNormalizationCounter)
+
+//____________________________________________
+AliNormalizationCounter::AliNormalizationCounter(): 
+AliCounterCollection(),
+fESD(kFALSE)
+{
+  // empty constructor
+}
+
+//__________________________________________________                           
+AliNormalizationCounter::AliNormalizationCounter(const char *name): 
+AliCounterCollection(name),
+fESD(kFALSE)
+{
+  //default constructor
+  AddRubric("Event","triggered/V0AND/Candles0.2/Candles0.25/Candles0.3/2xCandles0.2/PrimaryVTracks/PrimaryV/!V0A&Candle02/!V0A&Candle025/!V0A&Candle03/!V0A&PrimaryVTracks/!V0A&PrimaryV/!V0A&2xCandles02/Candid(Filter)/Candid(Analysis)/NCandid(Filter)/NCandid(Analysis)");//new line
+  AddRubric("Run", 10000000);//new line
+  Init();//new line
+}
+//______________________________________________
+AliNormalizationCounter::~AliNormalizationCounter()
+{
+  //destructor
+}
+
+
+//_______________________________________
+void AliNormalizationCounter::StoreEvent(AliVEvent *event,Bool_t mc){
+  //
+
+  Bool_t v0A=kFALSE; 
+  Bool_t v0B=kFALSE;
+  Bool_t flag02=kFALSE;
+  Bool_t flag025=kFALSE;
+  Bool_t flag03=kFALSE;
+  Int_t flag0202=0;
+  Bool_t flagPV=kFALSE;
+  Bool_t flagPVT=kFALSE; 
+
+  //Run Number
+  Int_t runNumber = event->GetRunNumber();
+  //Find CINT1B
+  
+  AliESDEvent *eventESD = (AliESDEvent*)event;
+  if(!eventESD){AliError("ESD event not available");return;}
+  if(mc&&event->GetEventType() != 0)return;
+  //event must be either physics or MC
+  if(!(event->GetEventType() == 7||event->GetEventType() == 0))return;
+  
+  Count(Form("Event:triggered/Run:%d",runNumber));
+      
+  //Find V0AND
+  AliTriggerAnalysis trAn; /// Trigger Analysis
+  v0B = trAn.IsOfflineTriggerFired(eventESD , AliTriggerAnalysis::kV0C);
+  v0A = trAn.IsOfflineTriggerFired(eventESD , AliTriggerAnalysis::kV0A);
+  if(v0A&&v0B){Count(Form("Event:V0AND/Run:%d",runNumber));}
+  
+  //Find Candle
+  Int_t trkEntries = (Int_t)event->GetNumberOfTracks();
+  
+  for(Int_t i=0;i<trkEntries;i++){
+    AliAODTrack *track=(AliAODTrack*)event->GetTrack(i);
+    UShort_t nClusTPC=track->GetTPCNcls();
+    if((nClusTPC>=70)&&(track->GetStatus()&AliESDtrack::kITSrefit)&&(track->GetStatus()&AliESDtrack::kTPCrefit)){
+      
+      if((track->Pt()>0.2)&&flag0202<2){
+       if(!flag02)Count(Form("Event:Candles0.2/Run:%d",runNumber));
+       flag02=kTRUE;
+       flag0202++;
+      }
+      if((track->Pt()>0.25)&&(!flag025)){
+       Count(Form("Event:Candles0.25/Run:%d",runNumber));
+       flag025=kTRUE;
+      }
+      if((track->Pt()>0.3)&&(!flag03)){
+       Count(Form("Event:Candles0.3/Run:%d",runNumber));
+       flag03=kTRUE;
+      }
+    }
+    if((flag02)&&(flag025)&&(flag03)&&flag0202>=2) break; //i=trkEntries+1;
+  }
+  
+  //FindPrimary vertex  
+  AliVVertex *vtrc =  (AliVVertex*)event->GetPrimaryVertex();
+  if(vtrc && vtrc->GetNContributors()>0){
+    Count(Form("Event:PrimaryV/Run:%d",runNumber));
+    flagPV=kTRUE;
+  }
+  
+  if(fESD){
+    const AliESDVertex *vtrc1 =  eventESD->GetPrimaryVertexTracks();
+    if(vtrc1 && vtrc1->GetNContributors()>0){
+      Count(Form("Event:PrimaryVTracks/Run:%d",runNumber));
+      flagPVT=kTRUE;
+    }
+  }
+  
+  if(!(v0A&&v0B)&&(flag02))Count(Form("Event:!V0A&Candle02/Run:%d",runNumber));
+  if(!(v0A&&v0B)&&(flag025))Count(Form("Event:!V0A&Candle025/Run:%d",runNumber));
+  if(!(v0A&&v0B)&&(flag03))Count(Form("Event:!V0A&Candle03/Run:%d",runNumber));
+  if(!(v0A&&v0B)&&flagPVT)Count(Form("Event:!V0A&PrimaryVTracks/Run:%d",runNumber));
+  if(!(v0A&&v0B)&&flagPV)Count(Form("Event:!V0A&PrimaryV/Run:%d",runNumber));
+  if(flag0202>1)Count(Form("Event:2xCandles0.2/Run:%d",runNumber));
+  if(!(v0A&&v0B)&&flag0202>1)Count(Form("Event:!V0A&2xCandles02/Run:%d",runNumber));
+  
+  //delete eventESD;
+
+  return;
+}
+//_____________________________________________________________________
+void AliNormalizationCounter::StoreCandidates(AliVEvent *event,Int_t nCand,Bool_t flagFilter){
+  //
+
+  Int_t runNumber = event->GetRunNumber();
+  if(nCand==0)return;
+  if(flagFilter){
+    Count(Form("Event:Candid(Filter)/Run:%d",runNumber));
+    for(Int_t i=0;i<nCand;i++)Count(Form("Event:NCandid(Filter)/Run:%d",runNumber));
+  }else{
+    Count(Form("Event:Candid(Analysis)/Run:%d",runNumber));
+    for(Int_t i=0;i<nCand;i++)Count(Form("Event:NCandid(Analysis)/Run:%d",runNumber));
+  }
+  return;
+}
+//_______________________________________________________________________
+TH1D* AliNormalizationCounter::DrawAgainstRuns(TString candle="candid(filter)"){
+  //
+  TString selection;
+  selection.Form("event:%s",candle.Data());
+  TH2D* hist = Draw("event","run",selection.Data());
+  TH1D* histoneD =(TH1D*)(hist->ProjectionX()->Clone());
+  histoneD->DrawClone();
+  return histoneD;
+}
+//___________________________________________________________________________
+TH1D* AliNormalizationCounter::DrawRatio(TString candle1="candid(filter)",TString candle2="triggered"){
+  //
+  TString name;
+  name.Form("%s/%s",candle1.Data(),candle2.Data());
+  TH1D* num=(TH1D*)(DrawAgainstRuns(candle1.Data())->Clone(name.Data()));
+  TH1D* den=DrawAgainstRuns(candle2.Data());
+  den->SetTitle(candle2.Data());
+  den->SetName(candle2.Data());
+  printf("%f %f",num->GetEntries(),den->GetEntries());
+  num->Divide(num,den,1,1,"B");
+  num->DrawClone();
+  return num;
+}
+
diff --git a/PWG3/vertexingHF/AliNormalizationCounter.h b/PWG3/vertexingHF/AliNormalizationCounter.h
new file mode 100644 (file)
index 0000000..1c0f9d6
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef ALINORMALIZATIONCOUNTER_H
+#define ALINORMALIZATIONCOUNTER_H
+
+#include <TROOT.h>
+#include <TSystem.h>
+#include <TNtuple.h>
+#include <TH1F.h>
+#include <TH1D.h>
+#include <AliESDEvent.h>
+#include <AliESDtrack.h>
+#include <AliAODTrack.h>
+#include <AliAODEvent.h>
+#include <AliVParticle.h>
+#include "AliAnalysisTaskSE.h"
+#include "AliCounterCollection.h"
+//#include "AliAnalysisVertexingHF.h"
+
+class AliNormalizationCounter : public AliCounterCollection
+{
+ public:
+
+  AliNormalizationCounter();
+  AliNormalizationCounter(const char *name);
+  virtual ~AliNormalizationCounter();
+
+  void SetESD(Bool_t flag){fESD=flag;}
+  void StoreEvent(AliVEvent*,Bool_t mc=kFALSE);
+  void StoreCandidates(AliVEvent*, Int_t nCand=0,Bool_t flagFilter=kTRUE);
+  TH1D* DrawAgainstRuns(TString candle);
+  TH1D* DrawRatio(TString candle1,TString candle2);
+ private:
+  AliNormalizationCounter(const AliNormalizationCounter &source);
+  AliNormalizationCounter& operator=(const AliNormalizationCounter& source);
+  Bool_t fESD; //flag for ESD vs AOD
+
+  ClassDef(AliNormalizationCounter,1);
+
+};
+#endif
index 9e7634bd8a2165f64685941fcf3b35877166b3d6..18a135e91fe42d9ba2ce14c69594703b4907d804 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCutsNew.root",Int_t flag=0/*0 = D0,1 = LS*/,Bool_t readMC=kFALSE,Bool_t cutOnDistr=kFALSE,Int_t flagD0D0bar=0)
+AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCuts.root",Int_t flag=0/*0 = D0,1 = LS*/,Bool_t readMC=kFALSE,Bool_t cutOnDistr=kFALSE,Int_t flagD0D0bar=0)
 {
   //
   // AddTask for the AliAnalysisTaskSE for D0 candidates
@@ -16,7 +16,7 @@ AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCutsNew.root",Int
     return NULL;
   }   
 
-  TString filename="",out1name="",out2name="",out3name="",out4name="",out5name="",inname="";
+  TString filename="",out1name="",out2name="",out3name="",out4name="",out5name="",out6name="",inname="";
   filename = AliAnalysisManager::GetCommonFileName();
   filename += ":PWG3_D2H_";
   if(flag==0){
@@ -50,6 +50,12 @@ AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCutsNew.root",Int
     if(flagD0D0bar==1)out5name+="D0";
     if(flagD0D0bar==2)out5name+="D0bar";
 
+    //AliNormalizationCounter
+    out6name="normalizationCounter";
+    if(cutOnDistr) out6name+="C"; 
+    if(flagD0D0bar==1)out6name+="D0";
+    if(flagD0D0bar==2)out6name+="D0bar";
+
     inname="cinputmassD0_0";
     if(cutOnDistr) inname+="C"; 
     if(flagD0D0bar==1)inname+="D0";
@@ -145,6 +151,7 @@ AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCutsNew.root",Int
   AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //nev
   AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //check
   AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
+  AliAnalysisDataContainer *coutputmassD06 = mgr->CreateContainer(out6name,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
   
   mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
 
@@ -153,6 +160,7 @@ AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCutsNew.root",Int
   mgr->ConnectOutput(massD0Task,3,coutputmassD03);
   mgr->ConnectOutput(massD0Task,4,coutputmassD04);
   mgr->ConnectOutput(massD0Task,5,coutputmassD05);
+  mgr->ConnectOutput(massD0Task,6,coutputmassD06);
 
 
   return massD0Task;
index 0918daedad3a43bd78250b3c25e8d6d49fdfd98f..32f734d51a0a6b792a40a0cdda37a897ec7ca248 100644 (file)
@@ -58,6 +58,9 @@ AliAnalysisTaskSEDplus *AddTaskDplus(TString filename="./DplustoKpipiCuts.root",
   AliAnalysisDataContainer *coutputDplus = mgr->CreateContainer("coutputDplus",TList::Class(),
                                                                AliAnalysisManager::kOutputContainer,
                                                                outputfile.Data());
+  AliAnalysisDataContainer *coutputDplusNorm = mgr->CreateContainer("coutputDplusNorm",AliNormalizationCounter::Class(),
+                                                               AliAnalysisManager::kOutputContainer,
+                                                               outputfile.Data());
   
   if(storeNtuple){
     AliAnalysisDataContainer *coutputDplus2 = mgr->CreateContainer("coutputDplus2",TNtuple::Class(),
@@ -71,9 +74,10 @@ AliAnalysisTaskSEDplus *AddTaskDplus(TString filename="./DplustoKpipiCuts.root",
   mgr->ConnectOutput(dplusTask,1,coutputDplus);
   
   mgr->ConnectOutput(dplusTask,2,coutputDplusCuts);
-  
+
+  mgr->ConnectOutput(dplusTask,3,coutputDplusNorm);  
   if(storeNtuple){
-    mgr->ConnectOutput(dplusTask,3,coutputDplus2);
+    mgr->ConnectOutput(dplusTask,4,coutputDplus2);
   }
   return dplusTask;
 }