Update of the hfe package from gsi svn
authorrbailhac <Raphaelle.Bailhache@cern.ch>
Wed, 12 Mar 2014 13:36:15 +0000 (14:36 +0100)
committerrbailhac <Raphaelle.Bailhache@cern.ch>
Wed, 12 Mar 2014 14:42:16 +0000 (15:42 +0100)
34 files changed:
PWGHF/hfe/AliAnalysisTaskHFE.cxx
PWGHF/hfe/AliAnalysisTaskHFE.h
PWGHF/hfe/AliHFEBeautySpectrum.cxx
PWGHF/hfe/AliHFECorrectSpectrumBase.cxx
PWGHF/hfe/AliHFECorrectSpectrumBase.h
PWGHF/hfe/AliHFEInclusiveSpectrum.cxx
PWGHF/hfe/AliHFEInclusiveSpectrum.h
PWGHF/hfe/AliHFEInclusiveSpectrumQA.cxx
PWGHF/hfe/AliHFEInclusiveSpectrumQA.h
PWGHF/hfe/AliHFENonPhotonicElectron.cxx
PWGHF/hfe/AliHFENonPhotonicElectron.h
PWGHF/hfe/AliHFEV0taginfo.cxx
PWGHF/hfe/AliHFEV0taginfo.h
PWGHF/hfe/AliHFEcuts.h
PWGHF/hfe/AliHFEmcQA.cxx
PWGHF/hfe/AliHFEmcQA.h
PWGHF/hfe/AliHFEpidTOF.cxx
PWGHF/hfe/AliHFEpidTOF.h
PWGHF/hfe/AliHFEreducedEvent.cxx
PWGHF/hfe/AliHFEreducedEvent.h
PWGHF/hfe/AliHFEreducedEventCreatorAOD.cxx
PWGHF/hfe/AliHFEreducedEventCreatorAOD.h
PWGHF/hfe/AliHFEreducedEventCreatorESD.cxx
PWGHF/hfe/AliHFEreducedEventCreatorESD.h
PWGHF/hfe/AliHFEreducedMCParticle.cxx
PWGHF/hfe/AliHFEreducedMCParticle.h
PWGHF/hfe/AliHFEreducedTrack.cxx
PWGHF/hfe/AliHFEreducedTrack.h
PWGHF/hfe/AliHFEsignalCuts.cxx
PWGHF/hfe/AliHFEsignalCuts.h
PWGHF/hfe/AliHFEspectrum.cxx
PWGHF/hfe/AliHFEtaggedTrackAnalysis.cxx
PWGHF/hfe/AliHFEtaggedTrackAnalysis.h
PWGHF/hfe/AliHFEtofPIDqa.cxx

index 0c801e0..fcb99e2 100644 (file)
@@ -126,7 +126,8 @@ AliAnalysisTaskSE("PID efficiency Analysis")
   , fTriggerAnalysis(NULL)
   , fPID(NULL)
   , fPIDqa(NULL)
-  , fTRDTriggerAnalysis(NULL)
+  , fTRDTriggerAnalysismb(NULL)
+  , fTRDTriggerAnalysistrg(NULL)
   , fPIDpreselect(NULL)
   , fCuts(NULL)
   , fTaggedTrackCuts(NULL)
@@ -197,7 +198,8 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const char * name):
   , fTriggerAnalysis(NULL)
   , fPID(NULL)
   , fPIDqa(NULL)
-  , fTRDTriggerAnalysis(NULL)
+  , fTRDTriggerAnalysismb(NULL)
+  , fTRDTriggerAnalysistrg(NULL)
   , fPIDpreselect(NULL)
   , fCuts(NULL)
   , fTaggedTrackCuts(NULL)
@@ -232,7 +234,9 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const char * name):
   fPIDqa = new AliHFEpidQAmanager;
   fVarManager = new AliHFEvarManager("hfeVarManager");
   fAnalysisUtils = new AliAnalysisUtils;
-  fTRDTriggerAnalysis = new AliTRDTriggerAnalysis();
+  fTRDTriggerAnalysismb = new AliTRDTriggerAnalysis();
+  fTRDTriggerAnalysistrg = new AliTRDTriggerAnalysis();
+  fTRDTriggerAnalysistrg->SetRequireMatchElectron(kTRUE);
 
   memset(fElecBackgroundFactor, 0, sizeof(Double_t) * kElecBgSpecies * kBgPtBins * kCentBins * kBgLevels);
   memset(fkBackGroundFactorArray, 0, sizeof(TF1 *) * 12);
@@ -278,7 +282,8 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref):
   , fTriggerAnalysis(NULL)
   , fPID(NULL)
   , fPIDqa(NULL)
-  , fTRDTriggerAnalysis(NULL)
+  , fTRDTriggerAnalysismb(NULL)
+  , fTRDTriggerAnalysistrg(NULL)
   , fPIDpreselect(NULL)
   , fCuts(NULL)
   , fTaggedTrackCuts(NULL)
@@ -356,7 +361,8 @@ void AliAnalysisTaskHFE::Copy(TObject &o) const {
   target.fTriggerAnalysis = fTriggerAnalysis;
   target.fPID = fPID;
   target.fPIDqa = fPIDqa;
-  target.fTRDTriggerAnalysis = fTRDTriggerAnalysis;
+  target.fTRDTriggerAnalysismb = fTRDTriggerAnalysismb;
+  target.fTRDTriggerAnalysistrg = fTRDTriggerAnalysistrg;
   target.fPIDpreselect = fPIDpreselect;
   target.fCuts = fCuts;
   target.fTaggedTrackCuts = fTaggedTrackCuts;
@@ -389,7 +395,8 @@ AliAnalysisTaskHFE::~AliAnalysisTaskHFE(){
   if(fPID) delete fPID;
   if(fPIDpreselect) delete fPIDpreselect;
   if(fVarManager) delete fVarManager;
-  if(fTRDTriggerAnalysis) delete fTRDTriggerAnalysis;
+  if(fTRDTriggerAnalysismb) delete fTRDTriggerAnalysismb;
+  if(fTRDTriggerAnalysistrg) delete fTRDTriggerAnalysistrg;
   if(fCFM) delete fCFM;
   if(fTriggerAnalysis) delete fTriggerAnalysis;
   if(fSignalCuts) delete fSignalCuts;
@@ -452,6 +459,7 @@ void AliAnalysisTaskHFE::UserCreateOutputObjects(){
   fQACollection->CreateTH1F("nElectron", "Number of electrons", 100, 0, 100);
   fQACollection->CreateTH2F("radius", "Production Vertex", 100, 0.0, 5.0, 100, 0.0, 5.0);
   fQACollection->CreateTH1F("nTriggerBit", "Histo Trigger Bit", 22, 0, 22);
+  fQACollection->CreateTH2F("TriggerAnalysis","TRD Trigger Analysis",10,0.,10.,10,0.,10.);
   fQACollection->CreateTH1F("Filterbegin", "AOD filter of tracks after all cuts", 21, -1, 20);
   fQACollection->CreateTH1F("Filterend", "AOD filter of tracks after all cuts", 21, -1, 20);
   fQACollection->CreateTH2F("Kinkbefore", "Kink status before filter; p_{T} (GeV/c); kink status", 100, 0., 20., 3, -0.5, 2.5);
@@ -473,7 +481,7 @@ void AliAnalysisTaskHFE::UserCreateOutputObjects(){
   fPID->SortDetectors();
 
   // Background subtraction-------------------------------------------------------------------
-  if (GetPlugin(kNonPhotonicElectron)) {
+  if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) {
     if(!fBackgroundSubtraction) fBackgroundSubtraction = new AliHFENonPhotonicElectron();
     if(IsAODanalysis()) fBackgroundSubtraction->SetAOD(kTRUE);
     fBackgroundSubtraction->Init();
@@ -556,7 +564,7 @@ void AliAnalysisTaskHFE::UserCreateOutputObjects(){
     fTaggedTrackAnalysis = new AliHFEtaggedTrackAnalysis(Form("taggedTrackAnalysis%s", GetName()));
     fTaggedTrackAnalysis->SetCuts(fTaggedTrackCuts);
     fTaggedTrackAnalysis->SetClean(fCleanTaggedTrack);
-    if(IsAODanalysis()) fTaggedTrackAnalysis->SetAOD(); 
+    if(IsAODanalysis()) fTaggedTrackAnalysis->SetAOD();
     AliHFEvarManager *varManager = fTaggedTrackAnalysis->GetVarManager();
     TObjArray *array = fVarManager->GetVariables();
     Int_t nvars = array->GetEntriesFast();
@@ -677,7 +685,7 @@ void AliAnalysisTaskHFE::UserExec(Option_t *){
     }
     fSignalCuts->SetMCAODInfo(fAODArrayMCInfo);
     // Background subtraction-------------------------------------------------------------------
-    if (GetPlugin(kNonPhotonicElectron)) fBackgroundSubtraction->SetAODArrayMCInfo(fAODArrayMCInfo);
+    if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->SetAODArrayMCInfo(fAODArrayMCInfo);
     //------------------------------------------------------------------------------------------
   }
 
@@ -710,7 +718,7 @@ void AliAnalysisTaskHFE::UserExec(Option_t *){
   if(fPIDpreselect) fPIDpreselect->SetPIDResponse(pidResponse);
 
   // Background subtraction-------------------------------------------------------------------
-  if(GetPlugin(kNonPhotonicElectron)) fBackgroundSubtraction->InitRun(fInputEvent,pidResponse);
+  if(GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->InitRun(fInputEvent,pidResponse);
   //------------------------------------------------------------------------------------------
 
   // Event loop
@@ -827,6 +835,37 @@ void AliAnalysisTaskHFE::ProcessMC(){
    // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD);
   } else {
     fMCQA->SetMCArray(fAODArrayMCInfo);
+
+    if(!((fIdentifiedAsPileUp) || (TMath::Abs(fVz) > fCuts->GetVertexRange()) || (fCentralityF < 0))){ //kStepMCGeneratedZOutNoPileUpCentralityFine
+      if (HasMCData() && IsQAOn(kMCqa)) {
+        AliDebug(2, "Running MC QA");
+
+        fMCQA->SetCentrality(fCentralityF);
+        fMCQA->SetPercentrality(static_cast<Int_t>(fCentralityPercent));
+
+        if(IsPbPb()) { fMCQA->SetPbPb();}
+        else
+        {
+            if(fisppMultiBin) fMCQA->SetPPMultiBin();
+            else fMCQA->SetPP();
+        }
+        fMCQA->Init();
+
+        //fMCQA->GetMesonKine();
+
+        // loop over all tracks for decayed electrons
+        AliAODMCParticle * mcpart;
+        for (Int_t igen = 0; igen < fAODArrayMCInfo->GetEntriesFast(); igen++){
+          mcpart = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(igen));
+          if(!mcpart) continue;
+          fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kCharm,  AliHFEmcQA::kElectronPDG); // no accept cut
+          fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kBeauty, AliHFEmcQA::kElectronPDG); // no accept cut
+          fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kOthers, AliHFEmcQA::kElectronPDG); // no accept cut
+        }
+
+      } // end of MC QA loop
+    }
+
     fCFM->SetMCEventInfo(fInputEvent);
   }
   // Run MC loop
@@ -1197,10 +1236,18 @@ void AliAnalysisTaskHFE::ProcessESD(){
     if (GetPlugin(kNonPhotonicElectron)) {
       Int_t indexmother = -1;
       Int_t mcsource = -1;
+      Int_t mcQAsource = -1;
+      Double_t weightNonPhotonicFactor = 1.; 
       if(HasMCData()){
        mcsource = fBackgroundSubtraction->FindMother(mctrack->GetLabel(),indexmother);
+       if(fBackgroundSubtraction->GetLevelBack()>=0) {
+         if(fMCQA) {
+           mcQAsource = fMCQA->GetElecSource(mctrack);
+           weightNonPhotonicFactor = TMath::Abs(fMCQA->GetWeightFactor(mctrack, fBackgroundSubtraction->GetLevelBack())); // positive:conversion e, negative: nonHFE 
+         }
+       }
       }
-      fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, 1, fCentralityF, -1, mcsource, indexmother);
+      fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, weightNonPhotonicFactor, fCentralityF, -1, mcsource, indexmother,mcQAsource);
     }
     //-----------------------------------------------------------------------------------------------------------------
 
@@ -1511,7 +1558,7 @@ void AliAnalysisTaskHFE::ProcessAOD(){
   //printf("Number of kink mother in the events %d\n",numberofmotherkink);
 
   // Background subtraction-------------------------------------------------------------------
-  if (GetPlugin(kNonPhotonicElectron)) fBackgroundSubtraction->FillPoolAssociatedTracks(fInputEvent, fCentralityF);
+  if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->FillPoolAssociatedTracks(fInputEvent, fCentralityF);
   //------------------------------------------------------------------------------------------
 
   // Loop over tracks
@@ -1617,6 +1664,25 @@ void AliAnalysisTaskHFE::ProcessAOD(){
     }
 
     if(HasMCData()){
+
+      if(fMCQA && signal){
+        fMCQA->SetCentrality(fCentralityF);
+        if(mctrack && (TMath::Abs(mctrack->GetPdgCode()) == 11)){
+         Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.};
+         for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){
+           weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE 
+         }
+         if(weightElecBgV0[0]>0) {
+             fVarManager->FillContainer(fContainer, "conversionElecs", 3, kFALSE, weightElecBgV0[0]);
+             fVarManager->FillContainer(fContainer, "conversionElecs", 4, kTRUE, weightElecBgV0[0]);
+         }
+         else if(weightElecBgV0[0]<0) {
+             fVarManager->FillContainer(fContainer, "mesonElecs", 3, kFALSE, -1*weightElecBgV0[0]);
+             fVarManager->FillContainer(fContainer, "mesonElecs", 4, kTRUE, -1*weightElecBgV0[0]);
+         }
+        }
+      }
+
       Double_t hfeimpactR4all=0., hfeimpactnsigmaR4all=0.;
       Int_t sourceDca =-1;
       if(mctrack && (TMath::Abs(mctrack->GetPdgCode()) == 211)){
@@ -1682,27 +1748,22 @@ void AliAnalysisTaskHFE::ProcessAOD(){
     // we will do PID here as soon as possible
 
     // Background subtraction----------------------------------------------------------------------------------------------
-    if (GetPlugin(kNonPhotonicElectron)) {
+    if (GetPlugin(kNonPhotonicElectron)&&!GetPlugin(kNonPhotonicElectronBeauty)) {
       Int_t indexmother = -1;
-      Int_t mcsource = -1;
+      Int_t mcsource = -1;  
+      Int_t mcQAsource = -1;
+      Double_t weightNonPhotonicFactor = 1.; 
+      //printf("weight %f \n",weightNonPhotonicFactor);
       if(HasMCData() && mctrack){  
         mcsource = fBackgroundSubtraction->FindMother(TMath::Abs(track->GetLabel()),indexmother);
-        if(mcsource == AliHFENonPhotonicElectron::kElectronfromC || mcsource == AliHFENonPhotonicElectron::kElectronfromB){
-          int svalue = 0;
-          if(fSignalCuts){
-            if(fSignalCuts->IsCharmElectron(track)) svalue = 0;
-               else if(fSignalCuts->IsBeautyElectron(track)) svalue = 1;
-               else if(fSignalCuts->IsGammaElectron(track)) svalue = 2;
-            else if(fSignalCuts->IsNonHFElectron(track)) svalue = 3;
-            else if(fSignalCuts->IsJpsiElectron(track)) svalue = 4;
-            else if(fSignalCuts->IsB2JpsiElectron(track)) svalue = 5;
-            else if(fSignalCuts->IsKe3Electron(track)) svalue = 6;
-               else svalue = 7;
-            fQACollection->Fill("HFPuzzle",svalue);
-          }
-        }
+       if(fBackgroundSubtraction->GetLevelBack()>=0) {
+         if(fMCQA) {
+           mcQAsource = fMCQA->GetElecSource(mctrack);
+           weightNonPhotonicFactor = TMath::Abs(fMCQA->GetWeightFactor(mctrack, fBackgroundSubtraction->GetLevelBack())); // positive:conversion e, negative: nonHFE 
+         }
+       }
       }
-      fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, 1, fCentralityF, -1,mcsource, indexmother);
+       fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, weightNonPhotonicFactor, fCentralityF, -1,mcsource, indexmother,mcQAsource);
     }
     //---------------------------------------------------------------------------------------------------------------------
 
@@ -1757,12 +1818,37 @@ void AliAnalysisTaskHFE::ProcessAOD(){
               // weightBackGround as special weight
               fVarManager->FillContainer(fContainer, "hadronicBackground", 2, kFALSE, fWeightBackGround);
         }
+
+        fVarManager->FillContainer(fContainer, "recTrackContDEReco", AliHFEcuts::kStepHFEcutsDca, kFALSE);
+        fVarManager->FillContainer(fContainer, "recTrackContDEMC", AliHFEcuts::kStepHFEcutsDca, kTRUE);
+        fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterDE"));
+      }
+    }
+
+    // Background subtraction----------------------------------------------------------------------------------------------
+    if (!GetPlugin(kNonPhotonicElectron)&&GetPlugin(kNonPhotonicElectronBeauty)) {
+      Int_t indexmother = -1;
+      Int_t mcsource = -1;  
+      Int_t mcQAsource = -1;
+      Double_t weightNonPhotonicFactor = 1.; 
+      //printf("weight %f \n",weightNonPhotonicFactor);
+      if(HasMCData() && mctrack){  
+        mcsource = fBackgroundSubtraction->FindMother(TMath::Abs(track->GetLabel()),indexmother);
+       if(fBackgroundSubtraction->GetLevelBack()>=0) {
+         if(fMCQA) {
+           mcQAsource = fMCQA->GetElecSource(mctrack);
+           weightNonPhotonicFactor = TMath::Abs(fMCQA->GetWeightFactor(mctrack, fBackgroundSubtraction->GetLevelBack())); // positive:conversion e, negative: nonHFE 
+         }
+       }
       }
+      fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, weightNonPhotonicFactor, fCentralityF, -1,mcsource, indexmother,mcQAsource);
     }
+    //---------------------------------------------------------------------------------------------------------------------
+
   }
 
   // Background subtraction-------------------------------------------------------------------
-  if (GetPlugin(kNonPhotonicElectron)) fBackgroundSubtraction->CountPoolAssociated(fInputEvent, fCentralityF);
+  if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->CountPoolAssociated(fInputEvent, fCentralityF);
   //------------------------------------------------------------------------------------------
 
   fQACollection->Fill("nElectronTracksEvent", nElectronCandidates);
@@ -2109,6 +2195,7 @@ void AliAnalysisTaskHFE::SwitchOnPlugin(Int_t plug){
     case kDEstep: SETBIT(fPlugins, plug); break;
     case kTaggedTrackAnalysis: SETBIT(fPlugins, plug); break;
     case kNonPhotonicElectron: SETBIT(fPlugins, plug); break; 
+    case kNonPhotonicElectronBeauty: SETBIT(fPlugins, plug); break; 
     default: AliError("Unknown Plugin");
   };
 }
@@ -2301,12 +2388,16 @@ Bool_t AliAnalysisTaskHFE::CheckTRDTriggerESD(AliESDEvent *ev) {
 
   //  printf("TRIGGERS %s \n",ev->GetFiredTriggerClasses().Data());
 
+    fTRDTriggerAnalysismb->CalcTriggers(ev);
+
     // mb selection of WU events
     if(fWhichTRDTrigger==1)
     {
-       if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))
+//     if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))
+       if((ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))||(ev->IsTriggerClassFired("CINT7WU-S-NOPF-ALL"))||(ev->IsTriggerClassFired("CINT8WU-S-NOPF-ALL")))
        {
            DrawTRDTrigger(ev);
+           DrawTRDTriggerAnalysis(ev);
            return kTRUE;
        }
         else return kFALSE;
@@ -2328,6 +2419,7 @@ Bool_t AliAnalysisTaskHFE::CheckTRDTriggerESD(AliESDEvent *ev) {
        else
        {
            DrawTRDTrigger(ev);
+           DrawTRDTriggerAnalysis(ev);
            return kTRUE;
        }
     }
@@ -2349,6 +2441,7 @@ Bool_t AliAnalysisTaskHFE::CheckTRDTriggerESD(AliESDEvent *ev) {
        else
        {
            DrawTRDTrigger(ev);
+           DrawTRDTriggerAnalysis(ev);
            return kTRUE;
        }
     }
@@ -2357,33 +2450,41 @@ Bool_t AliAnalysisTaskHFE::CheckTRDTriggerESD(AliESDEvent *ev) {
     {
 //     printf("trigger %i %i \n", ev->GetHeader()->IsTriggerInputFired("1HSE"),(ev->GetHeader()->GetL1TriggerInputs() & (1 << 10))); // bug in IsTriggerInputFired; reported in savannah
 
-       if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))
-       {
-           Int_t trginput=0;
-           trginput=ev->GetHeader()->GetL1TriggerInputs() & (1 << 10);  // HSE
-           if(trginput==1024)
+//     if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))
+//     {
+//         Int_t trginput=0;
+//         trginput=ev->GetHeader()->GetL1TriggerInputs() & (1 << 10);  // HSE
+           //      if(trginput==1024)
+//         if(fTRDTriggerAnalysismb->CheckCondition(AliTRDTriggerAnalysis::kHSE))
+//         if(fTRDTriggerAnalysismb->HasFired(AliTRDTriggerAnalysis::kHSE))
+           if(fTRDTriggerAnalysismb->HasTriggered(AliTRDTriggerAnalysis::kHSE))
            {
                DrawTRDTrigger(ev);
+               DrawTRDTriggerAnalysis(ev);
                return kTRUE;
            } else return kFALSE;
-       } else return kFALSE;
-    }
+    }// else return kFALSE;
+//    }
     if(fWhichTRDTrigger==5)
     {
 //     printf("trigger %i %i \n", ev->GetHeader()->IsTriggerInputFired("1HQU"),(ev->GetHeader()->GetL1TriggerInputs() & (1 << 12))); // bug in IsTriggerInputFired; reported in savannah
-       if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))
-       {
+//     if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))
+//     {
 
-           Int_t trginput=0;
-           trginput=ev->GetHeader()->GetL1TriggerInputs() & (1 << 12);  //HQU
+//         Int_t trginput=0;
+//         trginput=ev->GetHeader()->GetL1TriggerInputs() & (1 << 12);  //HQU
            //        printf("triggerinput %i \n",trginput);
-           if(trginput==4096)
+           //      if(trginput==4096)
+//         if(fTRDTriggerAnalysismb->CheckCondition(AliTRDTriggerAnalysis::kHQU))
+//          if(fTRDTriggerAnalysismb->HasFired(AliTRDTriggerAnalysis::kHQU))
+          if(fTRDTriggerAnalysismb->HasTriggered(AliTRDTriggerAnalysis::kHQU))
            {
                DrawTRDTrigger(ev);
+               DrawTRDTriggerAnalysis(ev);
                return kTRUE;
            } else return kFALSE;
-       } else return kFALSE;
-    }
+    } //else return kFALSE;
+//    }
    
 
     return trdtrgevent;
@@ -2397,18 +2498,19 @@ Bool_t AliAnalysisTaskHFE::CheckTRDTrigger(AliVEvent *ev) {
 // Check TRD trigger; pPb settings
 //
 
-    fTRDTriggerAnalysis->CalcTriggers(ev);
+    fTRDTriggerAnalysistrg->CalcTriggers(ev);
 
     // HSE cleanup
     if(fWhichTRDTrigger==6)
     {
-       if(!fTRDTriggerAnalysis->IsFired(AliTRDTriggerAnalysis::kHSE))
+       if(!fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHSE))
        {
            return kFALSE;
        }
        else
        {
-        //   DrawTRDTrigger(ev);
+           //   DrawTRDTrigger(ev);
+           DrawTRDTriggerAnalysis(ev);
            return kTRUE;
        }
     }
@@ -2419,13 +2521,14 @@ Bool_t AliAnalysisTaskHFE::CheckTRDTrigger(AliVEvent *ev) {
     if(fWhichTRDTrigger==7)
     {
 
-       if(!fTRDTriggerAnalysis->IsFired(AliTRDTriggerAnalysis::kHQU))
+       if(!fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHQU))
        {
            return kFALSE;
        }
        else
        {
-       //     DrawTRDTrigger(ev);
+           //     DrawTRDTrigger(ev);
+           DrawTRDTriggerAnalysis(ev);
            return kTRUE;
        }
     }
@@ -2433,9 +2536,10 @@ Bool_t AliAnalysisTaskHFE::CheckTRDTrigger(AliVEvent *ev) {
     // HSE or HQU cleanup
     if(fWhichTRDTrigger==8)
     {
-       if((fTRDTriggerAnalysis->IsFired(AliTRDTriggerAnalysis::kHSE))||(fTRDTriggerAnalysis->IsFired(AliTRDTriggerAnalysis::kHQU)))
+       if((fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHSE))||(fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHQU)))
        {
-       //    DrawTRDTrigger(ev);
+           //    DrawTRDTrigger(ev);
+           DrawTRDTriggerAnalysis(ev);
            return kTRUE;
        }
        else
@@ -2563,6 +2667,22 @@ void AliAnalysisTaskHFE::DrawTRDTrigger(AliESDEvent *ev) {
 
 }
 
+
+//___________________________________________________
+void AliAnalysisTaskHFE::DrawTRDTriggerAnalysis(AliVEvent *ev) {
+
+    fTRDTriggerAnalysistrg->CalcTriggers(ev);
+    for(Int_t itrg=0;itrg<AliTRDTriggerAnalysis::kHlast;itrg++)
+    {
+        Int_t trdtrgstatus=0;
+       if(fTRDTriggerAnalysistrg->CheckCondition((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=1;
+       if(fTRDTriggerAnalysistrg->HasFired((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=2;
+       if(fTRDTriggerAnalysistrg->HasTriggered((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=3;
+       if(fTRDTriggerAnalysistrg->HasTriggeredConfirmed((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=4;
+        fQACollection->Fill("TriggerAnalysis",(Float_t)itrg,(Float_t)trdtrgstatus);
+    }
+}
+
 //___________________________________________________
 Bool_t AliAnalysisTaskHFE::IsMCFakeTrack(const AliVTrack *const trk) const {
   //
index e7c25ae..f2da37c 100644 (file)
@@ -73,7 +73,8 @@ class AliAnalysisTaskHFE : public AliAnalysisTaskSE{
       kPostProcess = 3,
       kDEstep = 4,
       kTaggedTrackAnalysis = 5,
-      kNonPhotonicElectron = 6
+      kNonPhotonicElectron = 6,
+      kNonPhotonicElectronBeauty = 7
     };
     enum CreationProcess_t{
       kSignalCharm = 0,
@@ -182,6 +183,7 @@ class AliAnalysisTaskHFE : public AliAnalysisTaskSE{
     Bool_t CheckTRDTriggerESD(AliESDEvent *ev);
     Bool_t CheckTRDTrigger(AliVEvent *ev);
     void DrawTRDTrigger(AliESDEvent *ev);
+    void DrawTRDTriggerAnalysis(AliVEvent *ev);
 
   private:
     enum{
@@ -241,7 +243,8 @@ class AliAnalysisTaskHFE : public AliAnalysisTaskSE{
     AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
     AliHFEpid *fPID;                      // PID
     AliHFEpidQAmanager *fPIDqa;           // PID QA
-    AliTRDTriggerAnalysis *fTRDTriggerAnalysis; //! TRD Trigger Analysis
+    AliTRDTriggerAnalysis *fTRDTriggerAnalysismb; //! TRD Trigger Analysis for mb analysis
+    AliTRDTriggerAnalysis *fTRDTriggerAnalysistrg; //! TRD Trigger Analysis for trg sample analysis
     AliHFEpid *fPIDpreselect;             // PID oject for pre-selected tracks (without QA)
     AliHFEcuts *fCuts;                    // Cut Collection
     AliHFEcuts *fTaggedTrackCuts;         // Cut Collection for V0 tagged tracks
index b6265b5..882c577 100644 (file)
@@ -589,7 +589,7 @@ AliCFDataGrid* AliHFEBeautySpectrum::SubtractBackground(Bool_t setBackground){
   
   THnSparseF* sparseIncElec = (THnSparseF *) dataspectrumbeforesubstraction->GetGrid();  
   incElec = (TH1D *) sparseIncElec->Projection(0);
-  CorrectFromTheWidth(incElec);
+  AliHFEtools::NormaliseBinWidth(incElec);
 
   TH1D* htemp;
   Int_t* bins=new Int_t[2];
@@ -608,7 +608,7 @@ AliCFDataGrid* AliHFEBeautySpectrum::SubtractBackground(Bool_t setBackground){
     // draw raw hadron bg spectra     
     THnSparseF* sparseHbg = (THnSparseF *) hbgContainer->GetGrid();
     hadron = (TH1D *) sparseHbg->Projection(0);
-    CorrectFromTheWidth(hadron);
+    AliHFEtools::NormaliseBinWidth(hadron);
   }
 
   if(fIPanaCharmBgSubtract){
@@ -618,7 +618,7 @@ AliCFDataGrid* AliHFEBeautySpectrum::SubtractBackground(Bool_t setBackground){
     spectrumSubtracted->Add(charmbgContainer,-1.0);
     THnSparseF *sparseCharmElec = (THnSparseF *) charmbgContainer->GetGrid();  
     charm = (TH1D *) sparseCharmElec->Projection(0);
-    CorrectFromTheWidth(charm); 
+    AliHFEtools::NormaliseBinWidth(charm); 
   }
 
   const Char_t *sourceName[bgPlots]={"Conversion","Dalitz","K0s secondary pion Dalitz","K0s secondary pion conversions","Other secondary pion Dalitz","Other secondary pion Dalitz conversions","Other Dalitz", "Other conversions"};
@@ -634,7 +634,7 @@ AliCFDataGrid* AliHFEBeautySpectrum::SubtractBackground(Bool_t setBackground){
           spectrumSubtracted->Add(nonHFEbgContainer,-1.0);
         THnSparseF* sparseNonHFEelecs = (THnSparseF *) nonHFEbgContainer->GetGrid();
         nonHFE[iPlot] = (TH1D *) sparseNonHFEelecs->Projection(0);
-        CorrectFromTheWidth(nonHFE[iPlot]);
+        AliHFEtools::NormaliseBinWidth(nonHFE[iPlot]);
         iPlot++;
       }
       if(!(fNonHFEsyst && (fBeamType == 1)))break;
@@ -687,7 +687,7 @@ AliCFDataGrid* AliHFEBeautySpectrum::SubtractBackground(Bool_t setBackground){
 
   THnSparseF* sparseSubtracted = (THnSparseF *) spectrumSubtracted->GetGrid();
   subtracted = (TH1D *) sparseSubtracted->Projection(0);
-  CorrectFromTheWidth(subtracted);
+  AliHFEtools::NormaliseBinWidth(subtracted);
   subtracted->Draw("samep");
   subtracted->SetMarkerStyle(24);
   lRaw->AddEntry(subtracted,"subtracted electron spectrum");
@@ -696,7 +696,7 @@ AliCFDataGrid* AliHFEBeautySpectrum::SubtractBackground(Bool_t setBackground){
   delete[] bins; 
 
   TH1D *measuredTH1background = (TH1D *) backgroundGrid->Project(0);
-  CorrectFromTheWidth(measuredTH1background);
+  AliHFEtools::NormaliseBinWidth(measuredTH1background);
 
   if(setBackground){
     if(fBackground) delete fBackground;
@@ -738,7 +738,10 @@ AliCFDataGrid* AliHFEBeautySpectrum::GetNonHFEBackground(Int_t decay, Int_t sour
       backgroundContainer = (AliCFContainer*)fNonHFESourceContainer[source][0]->Clone();
       if(source == 0)
         for(Int_t iSource = 1; iSource < kElecBgSources-3; iSource++){
-          backgroundContainer->Add(fNonHFESourceContainer[iSource][0]);   
+          if(iSource == 1)
+            backgroundContainer->Add(fNonHFESourceContainer[iSource][0],1.41);//correction for the eta Dalitz decay branching ratio in PYTHIA
+          else
+            backgroundContainer->Add(fNonHFESourceContainer[iSource][0]);   
         }
     }   
   }
@@ -767,7 +770,7 @@ AliCFDataGrid* AliHFEBeautySpectrum::GetNonHFEBackground(Int_t decay, Int_t sour
   fNonHFEbg = 0x0;
   TH1D *h1 = (TH1D*)backgroundGrid->Project(0);
   TAxis *axis = h1->GetXaxis();
-  CorrectFromTheWidth(h1);
+  AliHFEtools::NormaliseBinWidth(h1);
   if(source == 0){
     fitHagedorn->SetParameter(0, 0.15);
     fitHagedorn->SetParameter(1, 0.09);
@@ -894,23 +897,23 @@ AliCFDataGrid* AliHFEBeautySpectrum::GetCharmBackground(){
   
   if(fBeamType==0)charmbgaftertofpid->Scale(evtnorm);
     
-  CorrectFromTheWidth(charmbgaftertofpid);
+  AliHFEtools::NormaliseBinWidth(charmbgaftertofpid);
   charmbgaftertofpid->SetMarkerStyle(25);
   charmbgaftertofpid->Draw("p");
   charmbgaftertofpid->GetYaxis()->SetTitle("yield normalized by # of data events");
   charmbgaftertofpid->GetXaxis()->SetTitle("p_{T} (GeV/c)");
   gPad->SetLogy();
   
-  CorrectFromTheWidth(charmbgafteripcut);
+  AliHFEtools::NormaliseBinWidth(charmbgafteripcut);
   charmbgafteripcut->SetMarkerStyle(24);
   charmbgafteripcut->Draw("samep");
   
-  CorrectFromTheWidth(charmbgafterweight);
+  AliHFEtools::NormaliseBinWidth(charmbgafterweight);
   charmbgafterweight->SetMarkerStyle(24);
   charmbgafterweight->SetMarkerColor(4);
   charmbgafterweight->Draw("samep");
   
-  CorrectFromTheWidth(charmbgafterfolding);
+  AliHFEtools::NormaliseBinWidth(charmbgafterfolding);
   charmbgafterfolding->SetMarkerStyle(24);
   charmbgafterfolding->SetMarkerColor(2);
   charmbgafterfolding->Draw("samep");
@@ -1021,9 +1024,9 @@ AliCFDataGrid *AliHFEBeautySpectrum::CorrectParametrizedEfficiency(AliCFDataGrid
 
 // QA
   TH1D *afterE = (TH1D *) resultt->Project(0);
-  CorrectFromTheWidth(afterE);
+  AliHFEtools::NormaliseBinWidth(afterE);
   TH1D *beforeE = (TH1D *) dataGrid->Project(0);
-  CorrectFromTheWidth(beforeE);
+  AliHFEtools::NormaliseBinWidth(beforeE);
   fQA->AddResultAt(afterE,AliHFEBeautySpectrumQA::kAfterPE);
   fQA->AddResultAt(beforeE,AliHFEBeautySpectrumQA::kBeforePE);
   fQA->AddResultAt(fEfficiencyFunction,AliHFEBeautySpectrumQA::kPEfficiency);
@@ -1103,9 +1106,9 @@ THnSparse *AliHFEBeautySpectrum::Unfold(AliCFDataGrid* const bgsubpectrum){
   TH1D* efficiencyDproj = (TH1D *) efficiencyD->Project(0);
   TH1D *afterE = (TH1D *) result->Projection(0);
 
-  CorrectFromTheWidth(residualh);
-  CorrectFromTheWidth(beforeE);
-  CorrectFromTheWidth(afterE);
+  AliHFEtools::NormaliseBinWidth(residualh);
+  AliHFEtools::NormaliseBinWidth(beforeE);
+  AliHFEtools::NormaliseBinWidth(afterE);
   fQA->AddResultAt(residualh,AliHFEBeautySpectrumQA::kResidualU);
   fQA->AddResultAt(afterE,AliHFEBeautySpectrumQA::kAfterU);
   fQA->AddResultAt(beforeE,AliHFEBeautySpectrumQA::kBeforeU);
@@ -1166,9 +1169,9 @@ AliCFDataGrid *AliHFEBeautySpectrum::CorrectForEfficiency(AliCFDataGrid* const b
 
   // QA
   TH1D *afterE = (TH1D *) result->Project(0);
-  CorrectFromTheWidth(afterE);
+  AliHFEtools::NormaliseBinWidth(afterE);
   TH1D *beforeE = (TH1D *) dataGrid->Project(0);
-  CorrectFromTheWidth(beforeE);
+  AliHFEtools::NormaliseBinWidth(beforeE);
   TH1D* efficiencyDproj = (TH1D *) efficiencyD->Project(0);
   fQA->AddResultAt(afterE,AliHFEBeautySpectrumQA::kAfterMCE);
   fQA->AddResultAt(beforeE,AliHFEBeautySpectrumQA::kBeforeMCE);
@@ -2104,8 +2107,8 @@ void AliHFEBeautySpectrum::CalculateNonHFEsyst(){
   TH1D *hNormAllSystErrUp = (TH1D*)hUpSystScaled->Clone();
   TH1D *hNormAllSystErrLow = (TH1D*)hLowSystScaled->Clone();
   //histograms to be normalized to TGraphErrors
-  CorrectFromTheWidth(hNormAllSystErrUp);
-  CorrectFromTheWidth(hNormAllSystErrLow);
+  AliHFEtools::NormaliseBinWidth(hNormAllSystErrUp);
+  AliHFEtools::NormaliseBinWidth(hNormAllSystErrLow);
 
   TCanvas *cNormOvErrs = new TCanvas("cNormOvErrs","cNormOvErrs");
   cNormOvErrs->cd();
@@ -2152,7 +2155,7 @@ void AliHFEBeautySpectrum::CalculateNonHFEsyst(){
   lRel->AddEntry(hRelErrLow, "lower");
   lRel->Draw("SAME");
 
-  //CorrectFromTheWidth(hBgYield);
+  //AliHFEtools::NormaliseBinWidth(hBgYield);
   //hBgYield->Scale(evtnorm[0]);
  
  
index 6e26455..319051d 100644 (file)
@@ -86,6 +86,8 @@ AliHFECorrectSpectrumBase::AliHFECorrectSpectrumBase(const char *name):
 
   memset(fEtaRange, 0, sizeof(Double_t) * 2);
   memset(fEtaRangeNorm, 0, sizeof(Double_t) * 2);
+  memset(fDims, 0, sizeof(Double_t) * 3);
+  SetNbDimensions(1);
  
 }
 //____________________________________________________________
@@ -147,6 +149,9 @@ void AliHFECorrectSpectrumBase::Copy(TObject &o) const {
   target.fChargeChoosen = fChargeChoosen;
   target.fTestCentralityLow = fTestCentralityLow;
   target.fTestCentralityHigh = fTestCentralityHigh;
+  target.fDims[0] = fDims[0];
+  target.fDims[1] = fDims[1];
+  target.fDims[2] = fDims[2];
   target.fEtaRange[0] = fEtaRange[0];
   target.fEtaRange[1] = fEtaRange[1];
   target.fEtaRangeNorm[0] = fEtaRangeNorm[0];
@@ -172,7 +177,7 @@ TGraphErrors *AliHFECorrectSpectrumBase::Normalize(THnSparse * const spectrum) c
   if(fNEvents > 0) {
 
     TH1D* projection = spectrum->Projection(0);
-    CorrectFromTheWidth(projection);
+    AliHFEtools::NormaliseBinWidth(projection);
     TGraphErrors *graphError = NormalizeTH1(projection);
     return graphError;
   
@@ -191,7 +196,7 @@ TGraphErrors *AliHFECorrectSpectrumBase::Normalize(AliCFDataGrid * const spectru
   if(fNEvents > 0) {
 
     TH1D* projection = (TH1D *) spectrum->Project(0);
-    CorrectFromTheWidth(projection);
+    AliHFEtools::NormaliseBinWidth(projection);
     TGraphErrors *graphError = NormalizeTH1(projection);
 
     return graphError;
@@ -226,7 +231,7 @@ TGraphErrors *AliHFECorrectSpectrumBase::NormalizeTH1(TH1 *input) const {
     for(Int_t ibin = input->GetXaxis()->GetFirst(); ibin <= input->GetXaxis()->GetLast(); ibin++){
       point = ibin - input->GetXaxis()->GetFirst();
       p = input->GetXaxis()->GetBinCenter(ibin);
-      //dp = input->GetXaxis()->GetBinWidth(ibin)/2.;
+      dp = input->GetXaxis()->GetBinWidth(ibin)/2.;
       n = input->GetBinContent(ibin);
       AliDebug(6, Form("p: %f, n: %e\n", p, n));
       dN = input->GetBinError(ibin);
@@ -296,13 +301,16 @@ AliCFContainer *AliHFECorrectSpectrumBase::GetSlicedContainer(AliCFContainer *co
     // source
     if(ivar == 4){
       if((source>= 0) && (source<container->GetNBins(ivar))) {
-             varMin[ivar] = binLimits[source];
-             varMax[ivar] = binLimits[source];
+              varMin[ivar] = container->GetAxis(4,0)->GetBinLowEdge(container->GetAxis(4,0)->FindBin(binLimits[source]));
+              varMax[ivar] = container->GetAxis(4,0)->GetBinUpEdge(container->GetAxis(4,0)->FindBin(binLimits[source]));
       }     
     }
     // charge
     if(ivar == 3) {
-      if(charge != kAllCharge) varMin[ivar] = varMax[ivar] = charge;
+      if(charge != kAllCharge){
+        varMin[ivar] = container->GetAxis(3,0)->GetBinLowEdge(container->GetAxis(3,0)->FindBin(charge));
+        varMax[ivar] = container->GetAxis(3,0)->GetBinUpEdge(container->GetAxis(3,0)->FindBin(charge));
+      }
     }
     // eta
     if(ivar == 1){
@@ -482,26 +490,6 @@ THnSparseF *AliHFECorrectSpectrumBase::GetSlicedCorrelation(THnSparseF *correlat
   
 }
 //___________________________________________________________________________
-void AliHFECorrectSpectrumBase::CorrectFromTheWidth(TH1D *h1) const {
-  //
-  // Correct from the width of the bins --> dN/dp_{T} (GeV/c)^{-1}
-  //
-
-  TAxis *axis = h1->GetXaxis();
-  Int_t nbinX = h1->GetNbinsX();
-
-  for(Int_t i = 1; i <= nbinX; i++) {
-
-    Double_t width = axis->GetBinWidth(i);
-    Double_t content = h1->GetBinContent(i);
-    Double_t error = h1->GetBinError(i); 
-    h1->SetBinContent(i,content/width); 
-    h1->SetBinError(i,error/width);
-  }
-
-}
-
-//___________________________________________________________________________
 void AliHFECorrectSpectrumBase::CorrectStatErr(AliCFDataGrid *backgroundGrid) const { 
   //
   // Correct statistical error
@@ -537,3 +525,22 @@ TObject* AliHFECorrectSpectrumBase::GetEfficiency(const AliCFContainer * const c
   eff->CalculateEfficiency(step,step0);
   return eff;
 }
+//____________________________________________________________________________
+void AliHFECorrectSpectrumBase::SetNbDimensions(Int_t nbDimensions) {
+  //
+  // Set the dimensions
+  //
+  fNbDimensions = nbDimensions;
+  switch(fNbDimensions){
+  case 1:   fDims[0] = 0;
+    break;
+  case 2:   for(Int_t i = 0; i < 2; i++) fDims[i] = i;
+    break;
+  case 3:   for(Int_t i = 0; i < 3; i++) fDims[i] = i;
+    break;
+  default:
+    AliError("Container with this number of dimensions not foreseen (yet)");
+    return ;
+  };
+
+}
index 0b4b129..b63f64c 100644 (file)
@@ -69,7 +69,6 @@ class AliHFECorrectSpectrumBase : public TNamed{
     TGraphErrors *Normalize(THnSparse * const spectrum) const;
     TGraphErrors *Normalize(AliCFDataGrid * const spectrum) const;
     TGraphErrors *NormalizeTH1(TH1 *input) const;
-    void CorrectFromTheWidth(TH1D *h1) const;
     void CorrectStatErr(AliCFDataGrid *backgroundGrid) const;
     
     void SetCorrelation(THnSparseF * const correlation) {fCorrelation = correlation; };
@@ -82,9 +81,10 @@ class AliHFECorrectSpectrumBase : public TNamed{
     void SetStepToCorrect(Int_t step) { fStepData = step; };
     void SetStepBeforeCutsV0(Int_t step) { fStepBeforeCutsV0 = step; };
     void SetStepAfterCutsV0(Int_t step) { fStepAfterCutsV0 = step; };
-    void SetNbDimensions(Int_t nbDimensions) { fNbDimensions = nbDimensions; };
+    void SetNbDimensions(Int_t nbDimensions);
     void SetChargeChoosen(Chargetype_t chargechoosen) {fChargeChoosen = chargechoosen; };
     void SetEtaRange(Double_t etamin, Double_t etamax) { fEtaRange[0] = etamin; fEtaRange[1] = etamax; fEtaSelected = kTRUE; }
+    void SetDim(Int_t dim0, Int_t dim1=0, Int_t dim2=0) { fDims[0] = dim0; fDims[1] = dim1; fDims[2] = dim2; };
     void SetSmoothing(Bool_t setSmoothing) {fSetSmoothing = setSmoothing;};
     void SetTestOneBinCentrality(Double_t centralitymin, Double_t centralitymax) { fTestCentralityLow = centralitymin; fTestCentralityHigh = centralitymax;}
     void SetStepGuessedUnfolding(Int_t stepGuessedUnfolding) { fStepGuessedUnfolding = stepGuessedUnfolding; };
@@ -120,6 +120,8 @@ class AliHFECorrectSpectrumBase : public TNamed{
     Int_t fNumberOfIterations;    // Number of iterations
     Chargetype_t fChargeChoosen;         // Select positive or negative electrons
 
+    Int_t  fDims[3];               // For 2D corrections
+
     Double_t fEtaRange[2];        // Eta range 
     Double_t fEtaRangeNorm[2];    // Eta range used in the normalization
 
index 5c40065..3203113 100644 (file)
@@ -63,7 +63,8 @@ ClassImp(AliHFEInclusiveSpectrum)
 //____________________________________________________________
 AliHFEInclusiveSpectrum::AliHFEInclusiveSpectrum(const char *name):
   AliHFECorrectSpectrumBase(name),
-  fQA(NULL)
+  fQA(NULL),
+  fNoCentralitySelectionMC(kFALSE)
 {
   //
   // Default constructor
@@ -75,7 +76,8 @@ AliHFEInclusiveSpectrum::AliHFEInclusiveSpectrum(const char *name):
 //____________________________________________________________
 AliHFEInclusiveSpectrum::AliHFEInclusiveSpectrum(const AliHFEInclusiveSpectrum &ref):
   AliHFECorrectSpectrumBase(ref),
-  fQA(ref.fQA)
+  fQA(ref.fQA),
+  fNoCentralitySelectionMC(ref.fNoCentralitySelectionMC)
 {
   //
   // Copy constructor
@@ -99,6 +101,7 @@ void AliHFEInclusiveSpectrum::Copy(TObject &o) const {
   //
   AliHFEInclusiveSpectrum &target = dynamic_cast<AliHFEInclusiveSpectrum &>(o);
   target.fQA = fQA;
+  target.fNoCentralitySelectionMC = fNoCentralitySelectionMC;
 
 
 }
@@ -123,20 +126,8 @@ Bool_t AliHFEInclusiveSpectrum::Init(const AliHFEcontainer *datahfecontainer, co
   //
   //
 
-  Int_t kNdim = 3;
-
-  Int_t dims[kNdim];
-  switch(fNbDimensions){
-  case 1:   dims[0] = 0;
-    break;
-  case 2:   for(Int_t i = 0; i < 2; i++) dims[i] = i;
-    break;
-  case 3:   for(Int_t i = 0; i < 3; i++) dims[i] = i;
-    break;
-  default:
-    AliError("Container with this number of dimensions not foreseen (yet)");
-    return kFALSE;
-  };
+  Bool_t centralitySelectionData = kTRUE, centralitySelectionMC = !fNoCentralitySelectionMC; 
 
   //
   // Data container: raw spectrum + hadron contamination
@@ -144,8 +135,8 @@ Bool_t AliHFEInclusiveSpectrum::Init(const AliHFEcontainer *datahfecontainer, co
   AliCFContainer *datacontainer = datahfecontainer->GetCFContainer("recTrackContReco");
   AliCFContainer *contaminationcontainer = datahfecontainer->GetCFContainer("hadronicBackground");
   if((!datacontainer) || (!contaminationcontainer)) return kFALSE;
-  AliCFContainer *datacontainerD = GetSlicedContainer(datacontainer, fNbDimensions, dims, -1, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
-  AliCFContainer *contaminationcontainerD = GetSlicedContainer(contaminationcontainer, fNbDimensions, dims, -1, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
+  AliCFContainer *datacontainerD = GetSlicedContainer(datacontainer, fNbDimensions, fDims, -1, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh, centralitySelectionData);
+  AliCFContainer *contaminationcontainerD = GetSlicedContainer(contaminationcontainer, fNbDimensions, fDims, -1, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh, centralitySelectionData);
   if((!datacontainerD) || (!contaminationcontainerD)) return kFALSE;
   SetContainer(datacontainerD,AliHFECorrectSpectrumBase::kDataContainer);
   SetContainer(contaminationcontainerD,AliHFECorrectSpectrumBase::kBackgroundData);
@@ -157,7 +148,7 @@ Bool_t AliHFEInclusiveSpectrum::Init(const AliHFEcontainer *datahfecontainer, co
   Int_t dimqa = datacontainer->GetNVar();
   Int_t dimsqa[dimqa];
   for(Int_t i = 0; i < dimqa; i++) dimsqa[i] = i;
-  AliCFContainer *datacontainerDQA = GetSlicedContainer(datacontainer, dimqa, dimsqa, -1, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
+  AliCFContainer *datacontainerDQA = GetSlicedContainer(datacontainer, dimqa, dimsqa, -1, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh, centralitySelectionData);
   fQA->AddResultAt(datacontainerDQA,AliHFEInclusiveSpectrumQA::kDataProjection);
 
   //
@@ -169,8 +160,8 @@ Bool_t AliHFEInclusiveSpectrum::Init(const AliHFEcontainer *datahfecontainer, co
   mccontainermc = mchfecontainer->MakeMergedCFContainer("summc","summc","MCTrackCont:recTrackContMC");
   if((!mccontaineresd) || (!mccontainermc)) return kFALSE;  
   Int_t source = -1;
-  AliCFContainer *mccontaineresdD = GetSlicedContainer(mccontaineresd, fNbDimensions, dims, source, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
-  AliCFContainer *mccontainermcD = GetSlicedContainer(mccontainermc, fNbDimensions, dims, source, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
+  AliCFContainer *mccontaineresdD = GetSlicedContainer(mccontaineresd, fNbDimensions, fDims, source, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh, centralitySelectionMC);
+  AliCFContainer *mccontainermcD = GetSlicedContainer(mccontainermc, fNbDimensions, fDims, source, fChargeChoosen,fTestCentralityLow,fTestCentralityHigh, centralitySelectionMC);
   if((!mccontaineresdD) || (!mccontainermcD)) return kFALSE;
   SetContainer(mccontainermcD,AliHFECorrectSpectrumBase::kMCContainerMC);
   SetContainer(mccontaineresdD,AliHFECorrectSpectrumBase::kMCContainerESD);
@@ -181,7 +172,7 @@ Bool_t AliHFEInclusiveSpectrum::Init(const AliHFEcontainer *datahfecontainer, co
   THnSparseF *mccorrelation = mchfecontainer->GetCorrelationMatrix("correlationstepbeforePID");
   if(!mccorrelation) mccorrelation = mchfecontainer->GetCorrelationMatrix("correlationstepafterPID");
   if(!mccorrelation) return kFALSE;
-  THnSparseF *mccorrelationD = GetSlicedCorrelation(mccorrelation, fNbDimensions, dims,fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
+  THnSparseF *mccorrelationD = GetSlicedCorrelation(mccorrelation, fNbDimensions, fDims,fChargeChoosen,fTestCentralityLow,fTestCentralityHigh, centralitySelectionMC);
   if(!mccorrelationD) {
     printf("No correlation\n");
     return kFALSE;
@@ -196,7 +187,7 @@ Bool_t AliHFEInclusiveSpectrum::Init(const AliHFEcontainer *datahfecontainer, co
   if(v0hfecontainer) {
     AliCFContainer *containerV0 = v0hfecontainer->GetCFContainer("taggedTrackContainerReco");
     if(!containerV0) return kFALSE;
-    AliCFContainer *containerV0Electron = GetSlicedContainer(containerV0, fNbDimensions, dims, AliPID::kElectron,fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
+    AliCFContainer *containerV0Electron = GetSlicedContainer(containerV0, fNbDimensions, fDims, AliPID::kElectron,fChargeChoosen,fTestCentralityLow,fTestCentralityHigh);
     if(!containerV0Electron) return kFALSE;
     SetContainer(containerV0Electron,AliHFECorrectSpectrumBase::kDataContainerV0);
   }
@@ -278,23 +269,40 @@ Bool_t AliHFEInclusiveSpectrum::Correct(Bool_t subtractcontamination, Bool_t sub
     dataGridAfterFirstSteps = dataspectrumafterefficiencyparametrizedcorrection;  
   }
     
-  ///////////////
-  // Unfold
-  //////////////
-  THnSparse *correctedspectrum = Unfold(dataGridAfterFirstSteps);
-  if(!correctedspectrum){
-    AliError("No corrected spectrum\n");
-    return kFALSE;
+  TGraphErrors* correctedspectrumD = 0x0;
+  TGraphErrors* alltogetherspectrumD = 0x0;
+  if(fStepMC>fStepTrue) {
+    ///////////////
+    // Unfold
+    //////////////
+    THnSparse *correctedspectrum = Unfold(dataGridAfterFirstSteps);
+    if(!correctedspectrum){
+      AliError("No corrected spectrum\n");
+      return kFALSE;
+    }
+    
+    /////////////////////
+    // Simply correct
+    ////////////////////
+    AliCFDataGrid *alltogetherCorrection = CorrectForEfficiency(dataGridAfterFirstSteps);
+
+    ////////////////////
+    // Normalization
+    ////////////////////
+    correctedspectrumD = Normalize(correctedspectrum);
+    alltogetherspectrumD = Normalize(alltogetherCorrection);
   }
-  
-  /////////////////////
-  // Simply correct
-  ////////////////////
-  AliCFDataGrid *alltogetherCorrection = CorrectForEfficiency(dataGridAfterFirstSteps);
+  else {
 
+    ////////////////////
+    // Normalization
+    ////////////////////
+    correctedspectrumD = Normalize(dataGridAfterFirstSteps);
+    alltogetherspectrumD = Normalize(dataGridAfterFirstSteps);
+  }
+  
   // QA final results
-  TGraphErrors* correctedspectrumD = Normalize(correctedspectrum);
-  TGraphErrors* alltogetherspectrumD = Normalize(alltogetherCorrection);
+
   fQA->AddResultAt(correctedspectrumD,AliHFEInclusiveSpectrumQA::kFinalResultUnfolded);
   fQA->AddResultAt(alltogetherspectrumD,AliHFEInclusiveSpectrumQA::kFinalResultDirectEfficiency);
   fQA->DrawResult();
@@ -336,13 +344,21 @@ AliCFDataGrid* AliHFEInclusiveSpectrum::SubtractBackground(){
 
   // QA
   TH1D *subtractedspectrum = (TH1D *) spectrumSubtracted->Project(0);
-  CorrectFromTheWidth(subtractedspectrum);
+  AliHFEtools::NormaliseBinWidth(subtractedspectrum);
   TH1D *rawspectrum = (TH1D *) dataspectrumbeforesubstraction->Project(0);
-  CorrectFromTheWidth(rawspectrum);
+  AliHFEtools::NormaliseBinWidth(rawspectrum);
   fQA->AddResultAt(subtractedspectrum,AliHFEInclusiveSpectrumQA::kAfterSC);
   fQA->AddResultAt(rawspectrum,AliHFEInclusiveSpectrumQA::kBeforeSC);
   fQA->DrawSubtractContamination();
 
+  if(fNbDimensions>=2) {
+    fQA->AddResultAt((TObject *) spectrumSubtracted,AliHFEInclusiveSpectrumQA::kAfterSCND);
+    fQA->AddResultAt((TObject *) dataspectrumbeforesubstraction,AliHFEInclusiveSpectrumQA::kBeforeSCND);
+    fQA->AddResultAt((TObject *) backgroundGrid,AliHFEInclusiveSpectrumQA::kHadronContaminationND);
+    fQA->DrawSubtractContaminationND();
+  }
+  
+
   return spectrumSubtracted;
 }
 
@@ -382,9 +398,9 @@ AliCFDataGrid* AliHFEInclusiveSpectrum::SubtractPhotonicBackground(){
 
   // QA
   TH1D *photonicsubtractedspectrum = (TH1D *) spectrumPhotonicSubtracted->Project(0);
-  CorrectFromTheWidth(photonicsubtractedspectrum);
+  AliHFEtools::NormaliseBinWidth(photonicsubtractedspectrum);
   TH1D *newrawspectrum = (TH1D *) dataSpectrumBeforePhotonicSubstraction->Project(0);
-  CorrectFromTheWidth(newrawspectrum);
+  AliHFEtools::NormaliseBinWidth(newrawspectrum);
   fQA->AddResultAt(photonicsubtractedspectrum,AliHFEInclusiveSpectrumQA::kAfterSPB);
   fQA->AddResultAt(newrawspectrum,AliHFEInclusiveSpectrumQA::kBeforeSPB);
   fQA->DrawSubtractPhotonicBackground();
@@ -454,11 +470,10 @@ AliCFDataGrid *AliHFEInclusiveSpectrum::CorrectParametrizedEfficiency(AliCFDataG
     if(valueEfficiency > 0.0) {
       h->SetBinContent(coord,value/valueEfficiency);
       dataContainerbis->SetBinContent(coord,fStepData,value/valueEfficiency);
+      Double_t error = h->GetBinError(i);
+      h->SetBinError(coord,error/valueEfficiency);
+      dataContainerbis->SetBinError(coord,fStepData,error/valueEfficiency);
     }
-    Double_t error = h->GetBinError(i);
-    h->SetBinError(coord,error/valueEfficiency);
-    dataContainerbis->SetBinError(coord,fStepData,error/valueEfficiency);
-
    
   } 
 
@@ -469,13 +484,20 @@ AliCFDataGrid *AliHFEInclusiveSpectrum::CorrectParametrizedEfficiency(AliCFDataG
 
  // QA
   TH1D *afterE = (TH1D *) resultt->Project(0);
-  CorrectFromTheWidth(afterE);
+  AliHFEtools::NormaliseBinWidth(afterE);
   TH1D *beforeE = (TH1D *) dataGrid->Project(0);
-  CorrectFromTheWidth(beforeE);
+  AliHFEtools::NormaliseBinWidth(beforeE);
   fQA->AddResultAt(afterE,AliHFEInclusiveSpectrumQA::kAfterPE);
   fQA->AddResultAt(beforeE,AliHFEInclusiveSpectrumQA::kBeforePE);
   fQA->AddResultAt(fEfficiencyFunction,AliHFEInclusiveSpectrumQA::kPEfficiency);
   fQA->DrawCorrectWithEfficiency(AliHFEInclusiveSpectrumQA::kParametrized);
+
+  if(fNbDimensions>=2) {
+    fQA->AddResultAt((TObject *) resultt,AliHFEInclusiveSpectrumQA::kAfterPEND);
+    fQA->AddResultAt((TObject *) dataGrid,AliHFEInclusiveSpectrumQA::kBeforePEND);
+    fQA->AddResultAt((TObject *) fEfficiencyFunction,AliHFEInclusiveSpectrumQA::kPEfficiencyND);
+    fQA->DrawCorrectWithEfficiencyND(AliHFEInclusiveSpectrumQA::kParametrized);
+  }
   
   return resultt;
 
@@ -517,14 +539,21 @@ AliCFDataGrid *AliHFEInclusiveSpectrum::CorrectV0Efficiency(AliCFDataGrid* const
 
   // QA
   TH1D *afterE = (TH1D *) result->Project(0);
-  CorrectFromTheWidth(afterE);
+  AliHFEtools::NormaliseBinWidth(afterE);
   TH1D *beforeE = (TH1D *) dataGrid->Project(0);
-  CorrectFromTheWidth(beforeE);
+  AliHFEtools::NormaliseBinWidth(beforeE);
   TH1D* efficiencyDproj = (TH1D *) efficiencyD->Project(0);
   fQA->AddResultAt(afterE,AliHFEInclusiveSpectrumQA::kAfterV0);
   fQA->AddResultAt(beforeE,AliHFEInclusiveSpectrumQA::kBeforeV0);
   fQA->AddResultAt(efficiencyDproj,AliHFEInclusiveSpectrumQA::kV0Efficiency);
   fQA->DrawCorrectWithEfficiency(AliHFEInclusiveSpectrumQA::kV0);
+
+  if(fNbDimensions>=2) {
+    fQA->AddResultAt((TObject *) result,AliHFEInclusiveSpectrumQA::kAfterV0ND);
+    fQA->AddResultAt((TObject *) dataGrid,AliHFEInclusiveSpectrumQA::kBeforeV0ND);
+    fQA->AddResultAt((TObject *) efficiencyD,AliHFEInclusiveSpectrumQA::kV0EfficiencyND);
+    fQA->DrawCorrectWithEfficiencyND(AliHFEInclusiveSpectrumQA::kV0);
+  }
  
 
   return result;
@@ -587,9 +616,9 @@ THnSparse *AliHFEInclusiveSpectrum::Unfold(AliCFDataGrid* const bgsubpectrum){
   TH1D *beforeE = (TH1D *) dataGrid->Project(0);
   TH1D* efficiencyDproj = (TH1D *) efficiencyD->Project(0);
   TH1D *afterE = (TH1D *) result->Projection(0);
-  CorrectFromTheWidth(residualh);
-  CorrectFromTheWidth(beforeE);
-  CorrectFromTheWidth(afterE);
+  AliHFEtools::NormaliseBinWidth(residualh);
+  AliHFEtools::NormaliseBinWidth(beforeE);
+  AliHFEtools::NormaliseBinWidth(afterE);
   fQA->AddResultAt(residualh,AliHFEInclusiveSpectrumQA::kResidualU);
   fQA->AddResultAt(afterE,AliHFEInclusiveSpectrumQA::kAfterU);
   fQA->AddResultAt(beforeE,AliHFEInclusiveSpectrumQA::kBeforeU);
@@ -638,15 +667,22 @@ AliCFDataGrid *AliHFEInclusiveSpectrum::CorrectForEfficiency(AliCFDataGrid* cons
 
   // QA
   TH1D *afterE = (TH1D *) result->Project(0);
-  CorrectFromTheWidth(afterE);
-  TH1D *beforeE = (TH1D *) dataGrid->Project(0);
-  CorrectFromTheWidth(beforeE);
+  AliHFEtools::NormaliseBinWidth(afterE);
+  TH1D *beforeE = (TH1D *) dataGrid->Project(0); 
+  AliHFEtools::NormaliseBinWidth(beforeE);
   TH1D* efficiencyDproj = (TH1D *) efficiencyD->Project(0);
   fQA->AddResultAt(afterE,AliHFEInclusiveSpectrumQA::kAfterMCE);
   fQA->AddResultAt(beforeE,AliHFEInclusiveSpectrumQA::kBeforeMCE);
   fQA->AddResultAt(efficiencyDproj,AliHFEInclusiveSpectrumQA::kMCEfficiency);
   fQA->DrawCorrectWithEfficiency(AliHFEInclusiveSpectrumQA::kMC);
 
+  if(fNbDimensions>=2) {
+    fQA->AddResultAt((TObject *) result,AliHFEInclusiveSpectrumQA::kAfterMCEND);
+    fQA->AddResultAt((TObject *) dataGrid,AliHFEInclusiveSpectrumQA::kBeforeMCEND);
+    fQA->AddResultAt((TObject *) efficiencyD,AliHFEInclusiveSpectrumQA::kMCEfficiencyND);
+    fQA->DrawCorrectWithEfficiencyND(AliHFEInclusiveSpectrumQA::kMC);
+  }
+
   return result;
 
 }
index 8a2beed..5d4d6bd 100644 (file)
@@ -53,6 +53,8 @@ class AliHFEInclusiveSpectrum : public AliHFECorrectSpectrumBase{
     THnSparse *Unfold(AliCFDataGrid* const bgsubpectrum = 0x0);
     AliCFDataGrid *CorrectForEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
 
+    void SetMCNoCentrality() { fNoCentralitySelectionMC = kTRUE; };
+
     void WriteResults(const char *filename);
    
  private:
@@ -61,6 +63,8 @@ class AliHFEInclusiveSpectrum : public AliHFECorrectSpectrumBase{
     virtual void Copy(TObject &o) const;
  
     AliHFEInclusiveSpectrumQA *fQA; // QA
+
+    Bool_t fNoCentralitySelectionMC;  // Explicitly switch off centrality selection
    
     ClassDef(AliHFEInclusiveSpectrum, 1) 
 };
index 56a5dec..28a7644 100644 (file)
@@ -66,10 +66,16 @@ const Char_t *AliHFEInclusiveSpectrumQA::fgkNameCanvas[AliHFEInclusiveSpectrumQA
   "ParametrizedEfficiency"
 };
 
+const Char_t *AliHFEInclusiveSpectrumQA::fgkNameCanvasND[AliHFEInclusiveSpectrumQA::kNTypeEfficiency] = {
+  "V0EfficiencyND",
+  "MCEfficiencyND",
+  "ParametrizedEfficiencyND"
+};
+
 //____________________________________________________________
 AliHFEInclusiveSpectrumQA::AliHFEInclusiveSpectrumQA():
   TNamed(),
-  fPtMax(7.0),
+  fPtMax(10.0),
   fListOfResult(),
   fWriteToFile(kTRUE)
 {
@@ -85,7 +91,7 @@ AliHFEInclusiveSpectrumQA::AliHFEInclusiveSpectrumQA():
 //____________________________________________________________
 AliHFEInclusiveSpectrumQA::AliHFEInclusiveSpectrumQA(const char *name):
   TNamed(name, ""),
-  fPtMax(7.0),
+  fPtMax(10.0),
   fListOfResult(),
   fWriteToFile(kTRUE)
 {
@@ -186,6 +192,9 @@ void AliHFEInclusiveSpectrumQA::DrawProjections() const
     TH2D* projectioneta = (TH2D *) correlation->Projection(eta,eta+((Int_t)(ndimcor/2.)));
     projectioneta->Draw("colz");
   }
+  
+ if(fWriteToFile) canvas->SaveAs("Projections.png");
+  
 
 
 }
@@ -260,6 +269,63 @@ void AliHFEInclusiveSpectrumQA::DrawSubtractContamination() const
 }
 
 //____________________________________________________________
+void AliHFEInclusiveSpectrumQA::DrawSubtractContaminationND() const
+{
+  //
+  // subtract the hadron contamination
+  //
+  //
+  AliCFDataGrid *afterE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kAfterSCND);
+  AliCFDataGrid *beforeE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kBeforeSCND);
+  AliCFDataGrid *contamination = (AliCFDataGrid *) fListOfResult->UncheckedAt(kHadronContaminationND);
+  if(!afterE || !beforeE || !contamination) return;
+
+  SetStyle();
+
+  TCanvas * cbackgroundsubtractionND = new TCanvas("backgroundsubtractionND","backgroundsubtractionND",1000,700);
+  cbackgroundsubtractionND->Divide(3,1);
+  cbackgroundsubtractionND->cd(1);
+  gPad->SetLogz();
+  gPad->SetTicks();
+  TH2D *measuredTH2Dbeforesubstraction = (TH2D *) beforeE->Project(0,1); 
+  measuredTH2Dbeforesubstraction->SetStats(0);
+  measuredTH2Dbeforesubstraction->SetTitle("Before contamination");
+  measuredTH2Dbeforesubstraction->GetZaxis()->SetTitleOffset(1.5);
+  measuredTH2Dbeforesubstraction->GetZaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
+  measuredTH2Dbeforesubstraction->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+  measuredTH2Dbeforesubstraction->GetXaxis()->SetRangeUser(0.0,fPtMax);
+  measuredTH2Dbeforesubstraction->Draw("lego");
+  cbackgroundsubtractionND->cd(2);
+  gPad->SetLogz();
+  gPad->SetTicks();
+  TH2D *measuredTH2Daftersubstraction = (TH2D *) afterE->Project(0,1); 
+  measuredTH2Daftersubstraction->SetStats(0);
+  measuredTH2Daftersubstraction->SetTitle("After contamination");
+  measuredTH2Daftersubstraction->GetZaxis()->SetTitleOffset(1.5);
+  measuredTH2Daftersubstraction->GetZaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
+  measuredTH2Daftersubstraction->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+  measuredTH2Daftersubstraction->GetXaxis()->SetRangeUser(0.0,fPtMax);
+  measuredTH2Daftersubstraction->Draw("lego");
+  cbackgroundsubtractionND->cd(3);
+  gPad->SetLogz();
+  gPad->SetTicks();
+  TH2D *measuredsubstraction = (TH2D *) contamination->Project(0,1); 
+  measuredsubstraction->SetStats(0);
+  measuredsubstraction->SetTitle("Contamination");
+  measuredsubstraction->GetZaxis()->SetTitleOffset(1.5);
+  measuredsubstraction->GetZaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
+  measuredsubstraction->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+  measuredsubstraction->GetXaxis()->SetRangeUser(0.0,fPtMax);
+  measuredsubstraction->SetMarkerStyle(25);
+  measuredsubstraction->SetMarkerColor(kBlack);
+  measuredsubstraction->SetLineColor(kBlack);
+  measuredsubstraction->Draw("colz");
+  if(fWriteToFile) cbackgroundsubtractionND->SaveAs("BackgroundSubtractedND.png");
+
+}
+
+//____________________________________________________________
 void AliHFEInclusiveSpectrumQA::DrawSubtractPhotonicBackground() const
 {
   //
@@ -360,8 +426,8 @@ void AliHFEInclusiveSpectrumQA::DrawCorrectWithEfficiency(Int_t typeeff) const
 
  if(!afterE || !beforeE) return;
 
- if((typeeff==kV0 || typeeff==kMC) && !efficiencyDproj) return;
- if(typeeff==kParametrized && !efficiencyparametrized) return;
+ if((typeeff==kV0 || typeeff==kMC) && (!efficiencyDproj)) return;
+ if(typeeff==kParametrized && (!efficiencyparametrized)) return;
 
   SetStyle();
 
@@ -412,7 +478,14 @@ void AliHFEInclusiveSpectrumQA::DrawCorrectWithEfficiency(Int_t typeeff) const
     }
   }
   if(typeeff==kParametrized) {
-    if(efficiencyparametrized) efficiencyparametrized->Draw();
+    if(efficiencyparametrized) {
+      efficiencyparametrized->GetYaxis()->SetTitleOffset(1.5);
+      efficiencyparametrized->GetYaxis()->SetRangeUser(0.0,1.0);
+      efficiencyparametrized->GetYaxis()->SetTitle("Efficiency");
+      efficiencyparametrized->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+      efficiencyparametrized->GetXaxis()->SetRangeUser(0.0,fPtMax);
+      efficiencyparametrized->Draw();
+    }
   }
   
   if(fWriteToFile) {
@@ -422,6 +495,101 @@ void AliHFEInclusiveSpectrumQA::DrawCorrectWithEfficiency(Int_t typeeff) const
   }
 
 }
+//____________________________________________________________
+void AliHFEInclusiveSpectrumQA::DrawCorrectWithEfficiencyND(Int_t typeeff) const
+{
+  //
+  // Correct the spectrum for efficiency and unfolding
+  // with both method and compare
+  //
+  
+  AliCFDataGrid *afterE = 0x0;
+  AliCFDataGrid *beforeE = 0x0;
+  AliCFEffGrid *efficiencyND = 0x0;
+  TF1 *efficiencyparametrized = 0x0;
+
+  if(typeeff== kV0) {
+    afterE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kAfterV0ND);
+    beforeE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kBeforeV0ND);
+    efficiencyND = (AliCFEffGrid *) fListOfResult->UncheckedAt(kV0EfficiencyND);
+  }
+  if(typeeff== kMC) {
+    afterE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kAfterMCEND);
+    beforeE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kBeforeMCEND);
+    efficiencyND = (AliCFEffGrid *) fListOfResult->UncheckedAt(kMCEfficiencyND);
+  }
+ if(typeeff== kParametrized) {
+    afterE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kAfterPEND);
+    beforeE = (AliCFDataGrid *) fListOfResult->UncheckedAt(kBeforePEND);
+    efficiencyparametrized = (TF1 *) fListOfResult->UncheckedAt(kPEfficiencyND);
+  }
+
+ if(!afterE || !beforeE) return;
+
+ if((typeeff==kV0 || typeeff==kMC) && (!efficiencyND)) return;
+ if(typeeff==kParametrized && (!efficiencyparametrized)) return;
+
+  SetStyle();
+
+  TCanvas * cEfficiency = new TCanvas(AliHFEInclusiveSpectrumQA::fgkNameCanvasND[typeeff],AliHFEInclusiveSpectrumQA::fgkNameCanvasND[typeeff],1000,700);
+  cEfficiency->Divide(3,1);
+  cEfficiency->cd(1);
+  gPad->SetLogz();
+  gPad->SetTicks();
+  TH2D *b2D = (TH2D *) beforeE->Project(0,1); 
+  b2D->SetStats(0);
+  b2D->SetTitle("Before efficiency correction");
+  b2D->GetZaxis()->SetTitleOffset(1.5);
+  b2D->GetZaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
+  b2D->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+  b2D->GetXaxis()->SetRangeUser(0.0,fPtMax);
+  b2D->Draw("lego");
+  cEfficiency->cd(2);
+  gPad->SetLogz();
+  gPad->SetTicks();
+  TH2D *a2D = (TH2D *) afterE->Project(0,1); 
+  a2D->SetStats(0);
+  a2D->SetTitle("After efficiency correction");
+  a2D->GetZaxis()->SetTitleOffset(1.5);
+  a2D->GetZaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
+  a2D->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+  a2D->GetXaxis()->SetRangeUser(0.0,fPtMax);
+  a2D->Draw("lego");
+  cEfficiency->cd(3);
+  gPad->SetTicks();
+  if((typeeff==kV0 || typeeff==kMC)) {
+    if(efficiencyND) {
+      THnSparseF *gride = (THnSparseF *) efficiencyND->GetGrid();
+      TH2D *e2D = (TH2D *) gride->Projection(1,0); 
+      e2D->SetStats(0);
+      e2D->SetTitle("");
+      e2D->SetStats(0);
+      e2D->GetZaxis()->SetTitleOffset(1.5);
+      e2D->GetZaxis()->SetRangeUser(0.0,1.0);
+      e2D->GetZaxis()->SetTitle("Efficiency");
+      e2D->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+      e2D->GetXaxis()->SetRangeUser(0.0,fPtMax);
+      e2D->Draw("lego");
+    }
+  }
+  if(typeeff==kParametrized) {
+    if(efficiencyparametrized) {
+      efficiencyparametrized->GetYaxis()->SetTitleOffset(1.5);
+      efficiencyparametrized->GetYaxis()->SetRangeUser(0.0,1.0);
+      efficiencyparametrized->GetYaxis()->SetTitle("Efficiency");
+      efficiencyparametrized->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
+      efficiencyparametrized->GetXaxis()->SetRangeUser(0.0,fPtMax);
+      efficiencyparametrized->Draw();
+    }
+  }
+  
+  if(fWriteToFile) {
+    if(typeeff==kV0) cEfficiency->SaveAs("EfficiencyV0ND.png");
+    if(typeeff==kMC) cEfficiency->SaveAs("EfficiencyMCND.png");
+    if(typeeff==kParametrized) cEfficiency->SaveAs("EfficiencyParametrizedND.png");
+  }
+
+}
 
 //____________________________________________________________
 void AliHFEInclusiveSpectrumQA::DrawUnfolding() const
@@ -520,13 +688,7 @@ void AliHFEInclusiveSpectrumQA::DrawResult()
   TGraphErrors* alltogetherspectrumD = (TGraphErrors *) fListOfResult->UncheckedAt( kFinalResultDirectEfficiency);
   if(!correctedspectrumD || !alltogetherspectrumD) return;
   
-  SetStyle();
-
-  TCanvas * ccorrected = new TCanvas("corrected","corrected",1000,700);
-  ccorrected->Divide(2,1);
-  ccorrected->cd(1);
-  gPad->SetLogy();
-  gPad->SetTicks();
   correctedspectrumD->SetTitle("");
   correctedspectrumD->GetYaxis()->SetTitleOffset(1.5);
   correctedspectrumD->GetYaxis()->SetRangeUser(0.000001,100.0);
@@ -534,33 +696,47 @@ void AliHFEInclusiveSpectrumQA::DrawResult()
   correctedspectrumD->SetMarkerStyle(26);
   correctedspectrumD->SetMarkerColor(kBlue);
   correctedspectrumD->SetLineColor(kBlue);
-  correctedspectrumD->Draw("AP");
   alltogetherspectrumD->SetTitle("");
   alltogetherspectrumD->GetYaxis()->SetTitleOffset(1.5);
   alltogetherspectrumD->GetYaxis()->SetRangeUser(0.000000001,1.0);
   alltogetherspectrumD->SetMarkerStyle(25);
   alltogetherspectrumD->SetMarkerColor(kBlack);
   alltogetherspectrumD->SetLineColor(kBlack);
-  alltogetherspectrumD->Draw("P");
   TLegend *legcorrected = new TLegend(0.4,0.6,0.89,0.89);
   legcorrected->AddEntry(correctedspectrumD,"Unfolded","p");
   legcorrected->AddEntry(alltogetherspectrumD,"Direct corrected","p");
   legcorrected->SetFillStyle(0);
   legcorrected->SetLineStyle(0);
   legcorrected->SetLineColor(0);
-  legcorrected->Draw("same");
-  ccorrected->cd(2);
-  gPad->SetTicks();
+
   TH1D* ratiocorrected = DivideSpectra(correctedspectrumD,alltogetherspectrumD);
-  ratiocorrected->SetName("ratiocorrected");
-  ratiocorrected->SetTitle("");
-  ratiocorrected->GetYaxis()->SetTitleOffset(1.5);
-  ratiocorrected->GetYaxis()->SetTitle("Unfolded/DirectCorrected");
-  ratiocorrected->GetXaxis()->SetTitle("p_{T} [GeV/c]");
-  ratiocorrected->GetXaxis()->SetRangeUser(0.0,fPtMax);
-  ratiocorrected->GetYaxis()->SetRangeUser(0.4,1.4);
-  ratiocorrected->SetStats(0);
-  ratiocorrected->Draw();
+  if(ratiocorrected) {
+    ratiocorrected->SetName("ratiocorrected");
+    ratiocorrected->SetTitle("");
+    ratiocorrected->GetYaxis()->SetTitleOffset(1.5);
+    ratiocorrected->GetYaxis()->SetTitle("Unfolded/DirectCorrected");
+    ratiocorrected->GetXaxis()->SetTitle("p_{T} [GeV/c]");
+    ratiocorrected->GetXaxis()->SetRangeUser(0.0,fPtMax);
+    ratiocorrected->GetYaxis()->SetRangeUser(0.4,1.4);
+    ratiocorrected->SetStats(0);
+  }
+
+  TCanvas * ccorrected = new TCanvas("corrected","corrected",1000,700);
+  if(ratiocorrected) ccorrected->Divide(2,1);
+  SetStyle();
+  ccorrected->cd(1);
+  gPad->SetLogy();
+  gPad->SetTicks();
+  correctedspectrumD->Draw("AP");
+  alltogetherspectrumD->Draw("P");
+  legcorrected->Draw("same");
+  if(ratiocorrected) {
+    ccorrected->cd(2);
+    gPad->SetTicks();
+    ratiocorrected->Draw();
+  }
   if(fWriteToFile)ccorrected->SaveAs("CorrectedResults.png");
 
 }
index 13adb1b..208cdfa 100644 (file)
@@ -56,7 +56,19 @@ class AliHFEInclusiveSpectrumQA : public TNamed{
     kFinalResultDirectEfficiency = 18,
     kBeforeSPB = 19,
     kAfterSPB = 20,
-    kNResults = 21
+    kBeforeSCND = 21,
+    kAfterSCND = 22,
+    kHadronContaminationND = 23,
+    kBeforeV0ND = 24,
+    kAfterV0ND = 25,
+    kV0EfficiencyND = 26,
+    kBeforePEND = 27,
+    kAfterPEND = 28,
+    kPEfficiencyND = 29,
+    kBeforeMCEND = 30,
+    kAfterMCEND = 31,
+    kMCEfficiencyND = 32,
+    kNResults = 33
   };
 
 
@@ -72,8 +84,10 @@ class AliHFEInclusiveSpectrumQA : public TNamed{
   
   void DrawProjections() const;
   void DrawSubtractContamination() const;
+  void DrawSubtractContaminationND() const;
   void DrawSubtractPhotonicBackground() const;
   void DrawCorrectWithEfficiency(Int_t typeeff) const;
+  void DrawCorrectWithEfficiencyND(Int_t typeeff) const;
   void DrawUnfolding() const;
   void DrawResult();
   
@@ -94,6 +108,7 @@ class AliHFEInclusiveSpectrumQA : public TNamed{
   private:
 
   static const Char_t* fgkNameCanvas[kNTypeEfficiency];     // Name of canvas
+  static const Char_t* fgkNameCanvasND[kNTypeEfficiency];     // Name of canvas
 
     AliHFEInclusiveSpectrumQA(const AliHFEInclusiveSpectrumQA &);
     AliHFEInclusiveSpectrumQA &operator=(const AliHFEInclusiveSpectrumQA &);
index 8a08cc4..5e711e7 100644 (file)
@@ -6,6 +6,7 @@
  *                                                                                     *
  *     Permission to use, copy, modify and distribute this software and its            *
  *     documentation strictly for non-commercial purposes is hereby granted            *
+
  *     without fee, provided that the above copyright notice appears in all            *
  *     copies and that both the copyright notice and this permission notice            *
  *     appear in the supporting documentation. The authors make no claims              *
@@ -54,6 +55,7 @@
 #include "AliHFEpid.h"
 #include "AliHFEpidQAmanager.h"
 #include "AliHFEtools.h"
+#include "AliHFEmcQA.h"
 
 #include "AliHFENonPhotonicElectron.h"
 
@@ -64,6 +66,7 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const char *name, const Cha
   ,fIsAOD              (kFALSE)
   ,fMCEvent            (NULL)
   ,fAODArrayMCInfo     (NULL)
+  ,fLevelBack(-1)
   ,fHFEBackgroundCuts  (NULL)
   ,fPIDBackground      (0x0)
   ,fPIDBackgroundQA    (0)
@@ -92,6 +95,7 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const char *name, const Cha
   ,fUSmatches(NULL)
   ,fLSmatches(NULL)
   ,fHnsigmaITS(NULL)
+  ,fWeightsSource(NULL)
 //  ,fUSignAngle       (NULL)
 //  ,fLSignAngle       (NULL)
 {
@@ -108,6 +112,7 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron()
   ,fIsAOD              (kFALSE)
   ,fMCEvent            (NULL)
   ,fAODArrayMCInfo     (NULL)
+  ,fLevelBack(-1)
   ,fHFEBackgroundCuts  (NULL)
   ,fPIDBackground      (0x0)
   ,fPIDBackgroundQA    (0)
@@ -136,6 +141,9 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron()
   ,fUSmatches(NULL)
   ,fLSmatches(NULL)
   ,fHnsigmaITS(NULL)
+  ,fWeightsSource(NULL)
+  ,fIncElectronRadius(NULL)
+  ,fRecElectronRadius(NULL)
 //  ,fUSignAngle       (NULL)
 //  ,fLSignAngle       (NULL)
 {
@@ -152,6 +160,7 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const AliHFENonPhotonicElec
   ,fIsAOD              (ref.fIsAOD)
   ,fMCEvent            (NULL)
   ,fAODArrayMCInfo     (NULL)
+  ,fLevelBack           (ref.fLevelBack)
   ,fHFEBackgroundCuts  (ref.fHFEBackgroundCuts)
   ,fPIDBackground      (ref.fPIDBackground)
   ,fPIDBackgroundQA    (ref.fPIDBackgroundQA)
@@ -180,6 +189,9 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const AliHFENonPhotonicElec
   ,fUSmatches(ref.fUSmatches)
   ,fLSmatches(ref.fLSmatches)
   ,fHnsigmaITS(ref.fHnsigmaITS)
+  ,fWeightsSource(ref.fWeightsSource)
+  ,fIncElectronRadius(ref.fIncElectronRadius)
+  ,fRecElectronRadius(ref.fRecElectronRadius)
 //  ,fUSignAngle       (ref.fUSignAngle)
 //  ,fLSignAngle       (ref.fLSignAngle)
 {
@@ -247,8 +259,8 @@ void AliHFENonPhotonicElectron::Init()
   Double_t binLimPtDefault[kBinsPtDefault+1] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
   const Int_t kBinsEtaInclusiveDefault = 8;
   Double_t binLimEtaInclusiveDefault[kBinsEtaInclusiveDefault+1] = {-0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8};
-  const Int_t kBinsEtaAssociated = 30;
-  Double_t binLimEtaAssociat[kBinsEtaAssociated+1] = {-1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5};
+  const Int_t kBinsEtaAssociated = 15;
+  Double_t binLimEtaAssociat[kBinsEtaAssociated+1] = {-1.5,-1.3,-1.1,-0.9,-0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5};
 
   if(!fPtBinning.GetSize()) fPtBinning.Set(kBinsPtDefault+1, binLimPtDefault);
   if(!fEtaBinning.GetSize()) fEtaBinning.Set(kBinsEtaInclusiveDefault+1, binLimEtaInclusiveDefault);
@@ -271,13 +283,13 @@ void AliHFENonPhotonicElectron::Init()
   Double_t binLimSource[nBinsSource+1];
   for(Int_t i=0; i<=nBinsSource; i++) binLimSource[i]=(Double_t)minSource + (maxSource-minSource)/nBinsSource*(Double_t)i ;
 
-  Int_t nBinsInvMass = 100;
+  Int_t nBinsInvMass = 30;
   Double_t minInvMass = 0.;
-  Double_t maxInvMass = 1.;
+  Double_t maxInvMass = 0.3;
   Double_t binLimInvMass[nBinsInvMass+1];
   for(Int_t i=0; i<=nBinsInvMass; i++) binLimInvMass[i]=(Double_t)minInvMass + (maxInvMass-minInvMass)/nBinsInvMass*(Double_t)i ;
 
-  Int_t nBinsPhi = 180;
+  Int_t nBinsPhi = 8;
   Double_t minPhi = 0.0;
   Double_t maxPhi = TMath::Pi();
   Double_t binLimPhi[nBinsPhi+1];
@@ -287,9 +299,9 @@ void AliHFENonPhotonicElectron::Init()
     AliDebug(2,Form("bin phi is %f for %d",binLimPhi[i],i));
   }
 
-  Int_t nBinsAngle = 180;
+  Int_t nBinsAngle = 72;
   Double_t minAngle = 0.0;
-  Double_t maxAngle = TMath::Pi();
+  Double_t maxAngle = 0.4;
   Double_t binLimAngle[nBinsAngle+1];
   for(Int_t i=0; i<=nBinsAngle; i++)
   {
@@ -366,6 +378,24 @@ void AliHFENonPhotonicElectron::Init()
   fLSmatches->SetBinEdges(1,fPtBinning.GetArray());
   fLSmatches->SetBinEdges(2,binLimMatches);
 
+  // Histograms for radius studies
+  Int_t nBinsradius = 50;
+  Double_t minradius = 0.0;
+  Double_t maxradius = 100.0;
+  Double_t binLimradius[nBinsradius+1];
+  for(Int_t i=0; i<=nBinsradius; i++) binLimradius[i]=(Double_t)minradius + (maxradius-minradius)/nBinsradius*(Double_t)i ;
+  const Int_t nDimIncElectronRadius = 3;  // centrality, pt_inc, radius 
+  const Int_t nBinsIncElectronRadius[nDimIncElectronRadius] = {nBinsC, fPtBinning.GetSize()-1, nBinsradius};
+  fIncElectronRadius = new THnSparseF("fIncElectronRadius", "fIncElectronRadius", nDimIncElectronRadius, nBinsIncElectronRadius);
+  fIncElectronRadius->SetBinEdges(0,binLimC);
+  fIncElectronRadius->SetBinEdges(1,fPtBinning.GetArray());
+  fIncElectronRadius->SetBinEdges(2,binLimradius);
+
+  fRecElectronRadius = new THnSparseF("fRecElectronRadius", "fRecElectronRadius", nDimIncElectronRadius, nBinsIncElectronRadius);
+  fRecElectronRadius->SetBinEdges(0,binLimC);
+  fRecElectronRadius->SetBinEdges(1,fPtBinning.GetArray());
+  fRecElectronRadius->SetBinEdges(2,binLimradius);
+
 /*
   // ee angle Unlike Sign
   const Int_t nDimUSignAngle=3;
@@ -391,6 +421,9 @@ void AliHFENonPhotonicElectron::Init()
   // control histogram for ITS PID
   fHnsigmaITS = new TH2F("fHnsigmaITS", "Number of sigmas in the ITS", 30, 0., 0.3, 1200, -10., 10.);
 
+  // control histogram for weights sources
+  fWeightsSource = new TH2F("fWeightsSource", "Source code for weights", 11, -1.5, 9.5, 29, -1.5, 27.5);
+
   fListOutput->Add(fAssElectron);
   fListOutput->Add(fIncElectron);
   fListOutput->Add(fUSign);
@@ -398,12 +431,47 @@ void AliHFENonPhotonicElectron::Init()
   fListOutput->Add(fUSmatches);
   fListOutput->Add(fLSmatches);
   fListOutput->Add(fHnsigmaITS);
+  fListOutput->Add(fWeightsSource);
+  fListOutput->Add(fIncElectronRadius);
+  fListOutput->Add(fRecElectronRadius);
 //  fListOutput->Add(fUSignAngle);
 //  fListOutput->Add(fLSignAngle);
 
 }
 
 //_____________________________________________________________________________________________
+void AliHFENonPhotonicElectron::SetWithWeights(Int_t levelBack)
+{
+  //
+  // Init the HFE level
+  //
+  if(levelBack >= 0) fLevelBack = levelBack;
+
+}
+
+//_____________________________________________________________________________________________
+void AliHFENonPhotonicElectron::SetMCEvent(AliMCEvent *mcEvent)
+{
+  //
+  // Pass the mcEvent
+  //
+  
+  fMCEvent = mcEvent;
+  
+}
+
+//_____________________________________________________________________________________________
+void AliHFENonPhotonicElectron::SetAODArrayMCInfo(TClonesArray *aodArrayMCInfo)
+{
+  //
+  // Pass the mcEvent info
+  //
+
+  fAODArrayMCInfo = aodArrayMCInfo;
+  
+}
+
+//_____________________________________________________________________________________________
 void AliHFENonPhotonicElectron::InitRun(const AliVEvent *inputEvent,const AliPIDResponse *pidResponse)
 {
   //
@@ -517,7 +585,7 @@ Int_t AliHFENonPhotonicElectron::CountPoolAssociated(AliVEvent *inputEvent, Int_
 }
 
 //_____________________________________________________________________________________________
-Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1, AliVEvent *vEvent, Double_t weight, Int_t binct, Double_t deltaphi, Int_t source, Int_t indexmother)
+Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1, AliVEvent *vEvent, Double_t weight, Int_t binct, Double_t deltaphi, Int_t source, Int_t indexmother,Int_t mcQAsource)
 {
   //
   // Look At Non HFE
@@ -542,6 +610,9 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
    *                                                                                   *
    ***********************************************************************************/
 
+  //printf("weight %f and source %d\n",weight,source);
+
+  
   AliAODEvent *aodeventu = dynamic_cast<AliAODEvent*>(vEvent);
   Int_t taggedphotonic = -1;
 
@@ -555,11 +626,14 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
   //Set Fill-Arrays for THnSparse
   Double_t valueIncElectron[4] = { binct, track1->Pt(), source, track1->Eta()};        //Centrality    Pt      Source  P       
   Double_t valueSign[9]                = { deltaphi, binct, track1->Pt(), -1, source, -1, -1, track1->Eta(), -1};                      //DeltaPhi      Centrality      Pt      InvariantMass   Source  Angle   Pt
-  //Double_t valueAngle[3]     = { -1, binct, source};                                                         //Angle         Centrality      Source
+  //Double_t valueAngle[3]     = { -1, binct, source}; 
+  Double_t valueradius[3]      = { binct, track1->Pt(), 0.};                                                   //Angle         Centrality      Source
 
   Int_t pdg1 = CheckPdg(TMath::Abs(track1->GetLabel()));
+  Double_t radius = Radius(TMath::Abs(track1->GetLabel()));
   AliKFParticle::SetField(vEvent->GetMagneticField());
   AliKFVertex primV(*(vEvent->GetPrimaryVertex()));
+  valueradius[2] = radius;
 
   AliVTrack *track2(NULL);
   Int_t iTrack2 = 0;
@@ -582,8 +656,13 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
   Bool_t kLSignPhotonic = kFALSE;
 
   //! FILL Inclusive Electron
+  fWeightsSource->Fill(source,mcQAsource);
   fIncElectron->Fill(valueIncElectron,weight);
   fnumberfound++;
+  if(source == kElectronfromconversion) {
+    fIncElectronRadius->Fill(valueradius,weight);
+    //printf("radius %f\n",radius);
+  }
   //printf(Form("Inclusive Pool: TrackNr. %d, fnumberfound %d \n", iTrack1, fnumberfound));
 
   for(Int_t idex = 0; idex < fCounterPoolBackground; idex++){
@@ -666,7 +745,10 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
     } else {
       if(invmass < 1.0)fUSign->Fill( valueSign, weight);
       // count unlike-sign matched pairs per inclusive based on mass cut
-      if(invmass < 0.14) countsMatchUnlikesign++;
+      if(invmass < 0.14) {
+       countsMatchUnlikesign++;
+       if(source == kElectronfromconversionboth) fRecElectronRadius->Fill(valueradius,weight);
+      }
       AliDebug(1, "Selected Unike sign");
     }
 
@@ -693,7 +775,7 @@ Int_t AliHFENonPhotonicElectron::FindMother(Int_t tr, Int_t &indexmother) const
   // Find the mother if MC
   //
 
-  if(!fMCEvent && !fAODArrayMCInfo) return 0;
+  if(!fMCEvent && !fAODArrayMCInfo) return -1;
 
   Int_t pdg = CheckPdg(tr);
   if(TMath::Abs(pdg)!= 11)
@@ -743,6 +825,33 @@ Int_t AliHFENonPhotonicElectron::CheckPdg(Int_t tr) const {
   return pdgcode;
 }
 
+//________________________________________________________________________________________________
+Double_t AliHFENonPhotonicElectron::Radius(Int_t tr) const {
+
+  //
+  // Return the production vertex radius
+  //
+
+  Double_t radius = 0.;
+  if(tr < 0) return radius;
+
+  AliMCParticle *mctrackesd = NULL; AliAODMCParticle *mctrackaod = NULL;
+  if(fMCEvent){
+    AliVParticle *mctrack = fMCEvent->GetTrack(tr);
+    if(mctrack){
+      if((mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) radius = TMath::Sqrt(mctrackesd->Xv()*mctrackesd->Xv()+mctrackesd->Yv()*mctrackesd->Yv());
+      else if((mctrackaod = dynamic_cast<AliAODMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) radius = TMath::Sqrt(mctrackaod->Xv()*mctrackaod->Xv()+mctrackaod->Yv()*mctrackaod->Yv());
+    }
+  } else if(fAODArrayMCInfo) {
+    if(tr < fAODArrayMCInfo->GetEntriesFast()){
+      mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
+      if(mctrackaod) return radius = TMath::Sqrt(mctrackaod->Xv()*mctrackaod->Xv()+mctrackaod->Yv()*mctrackaod->Yv());
+    }
+  }
+
+  return radius;
+}
+
 //_______________________________________________________________________________________________
 Int_t AliHFENonPhotonicElectron::GetMotherPDG(Int_t tr, Int_t &motherIndex) const {
   //
@@ -1070,16 +1179,20 @@ Bool_t AliHFENonPhotonicElectron::FilterCategory2Track(const AliVTrack * const t
   // electron candidates by the ITS
   //
   if(TMath::Abs(track->Pt()) > 0.3) return kFALSE;
+  if(TMath::Abs(track->Pt()) < 0.1) return kFALSE;
   Int_t nclustersITS(0), nclustersOuter(0);
   if(isAOD){
     const AliAODTrack *aodtrack = static_cast<const AliAODTrack *>(track);
     if(!(aodtrack->TestFilterBit(AliAODTrack::kTrkGlobalNoDCA) || aodtrack->TestFilterBit(AliAODTrack::kTrkITSsa))) return kFALSE;
+    if(!aodtrack->IsOn(AliAODTrack::kITSrefit)) return kFALSE;
     nclustersITS = aodtrack->GetITSNcls();
     for(int ily = 2; ily < 5; ily++)
       if(aodtrack->HasPointOnITSLayer(ily)) nclustersOuter++;
   } else {
     const AliESDtrack *esdtrack = static_cast<const AliESDtrack *>(track);
     if(esdtrack->GetStatus() & AliESDtrack::kITSpureSA) return kFALSE;
+    if(esdtrack->GetStatus() & AliESDtrack::kTPCin) return kFALSE;
+    if(esdtrack->GetStatus() & !AliESDtrack::kITSrefit) return kFALSE;
     nclustersITS = esdtrack->GetITSclusters(NULL);
     for(int ily = 2; ily < 5; ily++)
       if(esdtrack->HasPointOnITSLayer(ily)) nclustersOuter++;
index cdab7d4..af6c73c 100644 (file)
@@ -61,12 +61,14 @@ class AliHFENonPhotonicElectron : public TNamed {
   virtual ~AliHFENonPhotonicElectron();
 
   void SetAOD                  (Bool_t isAOD)                  { fIsAOD = isAOD; };
-  void SetMCEvent              (AliMCEvent *mcEvent)           { fMCEvent = mcEvent; };
-  void SetAODArrayMCInfo       (TClonesArray *aodArrayMCInfo) { fAODArrayMCInfo = aodArrayMCInfo; };
+  void SetMCEvent              (AliMCEvent *mcEvent);
+  void SetAODArrayMCInfo       (TClonesArray *aodArrayMCInfo);
   void SetHFEBackgroundCuts    (AliHFEcuts * const cuts)       { fHFEBackgroundCuts = cuts; };
+  void SetWithWeights(Int_t levelBack);
 
   AliHFEpid            *GetPIDBackground()             const   { return fPIDBackground; };
   AliHFEpidQAmanager   *GetPIDBackgroundQAManager()    const   { return fPIDBackgroundQA; };
+  Int_t GetLevelBack()                                  const   { return fLevelBack; };
 
   void  SetMaxInvMass          (Double_t MaxInvMass)           { fMaxInvMass           = MaxInvMass; };
   void  SetMaxOpening3D                (Double_t MaxOpening3D)         { fMaxOpening3D         = MaxOpening3D; };
@@ -91,7 +93,7 @@ class AliHFENonPhotonicElectron : public TNamed {
   void     InitRun                     (const AliVEvent *inputEvent, const AliPIDResponse *pidResponse);
   Int_t    FillPoolAssociatedTracks    (AliVEvent *inputEvent, Int_t binct=-1);
   Int_t    CountPoolAssociated         (AliVEvent *inputEvent, Int_t binct=-1);
-  Int_t    LookAtNonHFE                        (Int_t iTrack1, AliVTrack *track1, AliVEvent *vEvent, Double_t weight=1., Int_t binct=-1, Double_t deltaphi=-1, Int_t source=-1, Int_t indexmother=-1);
+  Int_t    LookAtNonHFE                        (Int_t iTrack1, AliVTrack *track1, AliVEvent *vEvent, Double_t weight=1., Int_t binct=-1, Double_t deltaphi=-1, Int_t source=-1, Int_t indexmother=-1,Int_t mcQAsource=-1);
 
   Int_t    FindMother          (Int_t tr, Int_t &indexmother) const;
 
@@ -104,6 +106,7 @@ class AliHFENonPhotonicElectron : public TNamed {
  private:
   Int_t    GetMotherPDG(Int_t tr, Int_t &motherIndex) const;
   Int_t    CheckPdg            (Int_t tr) const;
+  Double_t Radius               (Int_t tr) const;
   Int_t    IsMotherGamma       (Int_t tr) const;
   Int_t    IsMotherPi0         (Int_t tr) const;
   Int_t    IsMotherC           (Int_t tr) const;
@@ -117,8 +120,9 @@ class AliHFENonPhotonicElectron : public TNamed {
   Bool_t                    fIsAOD;                         // Is AOD
   AliMCEvent                *fMCEvent;                      //! MC event ESD
   TClonesArray              *fAODArrayMCInfo;               //! MC info particle AOD
+  Int_t                     fLevelBack;                     // Level Background
   AliHFEcuts                *fHFEBackgroundCuts;            // HFE background cuts
-  AliHFEpid                    *fPIDBackground;                // PID background cuts
+  AliHFEpid                 *fPIDBackground;                // PID background cuts
   AliHFEpidQAmanager        *fPIDBackgroundQA;              // QA Manager Background
   const AliPIDResponse      *fkPIDRespons;                  // PID response
   TArrayD                   fPtBinning;                     // pt binning
@@ -144,14 +148,18 @@ class AliHFENonPhotonicElectron : public TNamed {
   THnSparseF                *fLSign;                        //! delta phi, c, pt, inv, source
   THnSparseF                *fUSmatches;                    //! number of matched tracks with oposite sign per inclusive track after inv mass cut
   THnSparseF                *fLSmatches;                    //! number of matched tracks with same sign per inclusive track after inv mass cut
-  TH2F*                     fHnsigmaITS;                    //! Control histogram for ITS pid of category 2 tracks
+  TH2F                      *fHnsigmaITS;                    //! Control histogram for ITS pid of category 2 tracks
+  TH2F                      *fWeightsSource;                 //! Control histo for sources for weights  
+
+  THnSparseF                *fIncElectronRadius;            //! For fakes
+  THnSparseF                *fRecElectronRadius;            //! For fakes                    
 //  THnSparseF              *fUSignAngle;                   //! angle, c, source
 //  THnSparseF              *fLSignAngle;                   //! angle, c, source
 
 
   AliHFENonPhotonicElectron(const AliHFENonPhotonicElectron &ref); 
 
-  ClassDef(AliHFENonPhotonicElectron, 2); //!example of analysis
+  ClassDef(AliHFENonPhotonicElectron, 4); //!example of analysis
 };
 
 #endif
index d2a7f3d..8cdd84d 100644 (file)
@@ -94,7 +94,7 @@ AliHFEV0taginfo::AliHFEV0taginfo(const AliHFEV0taginfo &ref):
     AliHFEV0tag *tmp = NULL;
     for(Int_t ien = 0; ien < ref.fTaggedTracks->GetEntries(); ien++){
         tmp = static_cast<AliHFEV0tag *>(ref.fTaggedTracks->At(ien));
-        fTaggedTracks->Add(new AliHFEV0tag(tmp->GetTrackID(),tmp->GetPinfo()));
+        fTaggedTracks->Add(new AliHFEV0tag(tmp->GetTrackID(),tmp->GetPinfo(),tmp->GetProdR()));
     }
 }
 
@@ -112,7 +112,7 @@ AliHFEV0taginfo &AliHFEV0taginfo::operator=(const AliHFEV0taginfo &ref){
     AliHFEV0tag *tmp = NULL;
     for(Int_t ien = 0; ien < ref.fTaggedTracks->GetEntries(); ien++){
         tmp = static_cast<AliHFEV0tag *>(ref.fTaggedTracks->At(ien));
-        fTaggedTracks->Add(new AliHFEV0tag(tmp->GetTrackID(),tmp->GetPinfo()));
+        fTaggedTracks->Add(new AliHFEV0tag(tmp->GetTrackID(),tmp->GetPinfo(),tmp->GetProdR()));
     }
     fV0finder=ref.fV0finder;
     fAODV0finder=ref.fAODV0finder;
@@ -126,6 +126,7 @@ AliHFEV0taginfo::~AliHFEV0taginfo(){
     //
     delete fTaggedTracks;
     delete fV0finder;
+    delete fAODV0finder;
     AliDebug(6, "DESTRUCTOR");
 }
 
@@ -154,8 +155,8 @@ void AliHFEV0taginfo::TagV0Tracks(AliVEvent *fEvent){
             if(!fV0) continue;
             if(fV0finder->ProcessV0(fV0,pdgP,pdgN)){
                 AliDebug(5,Form("V0 has: pos pdg: %d, neg pdg: %d",pdgP,pdgN));
-                AddTrack(fV0->GetPindex(),pdgP);
-                AddTrack(fV0->GetNindex(),pdgN);
+                AddTrack(fV0->GetPindex(),pdgP,TMath::Sqrt(fV0->Xv()*fV0->Xv()+fV0->Yv()*fV0->Yv()));
+                AddTrack(fV0->GetNindex(),pdgN,TMath::Sqrt(fV0->Xv()*fV0->Xv()+fV0->Yv()*fV0->Yv()));
             }
         }
     } else if(fEvent->IsA() == AliAODEvent::Class()){
@@ -170,8 +171,8 @@ void AliHFEV0taginfo::TagV0Tracks(AliVEvent *fEvent){
             if(!fV0) continue;
             if(fAODV0finder->ProcessV0(fV0,pdgP,pdgN)){
                 AliDebug(5,Form("V0 has: pos pdg: %d, neg pdg: %d",pdgP,pdgN));
-                AddTrack(fV0->GetPosID(),pdgP);
-                AddTrack(fV0->GetNegID(),pdgN);
+                AddTrack(fV0->GetPosID(),pdgP,fV0->RadiusV0());
+                AddTrack(fV0->GetNegID(),pdgN,fV0->RadiusV0());
             }
         }
     }
@@ -179,7 +180,7 @@ void AliHFEV0taginfo::TagV0Tracks(AliVEvent *fEvent){
 
 //________________________________________________________________________________
 //Translates the pdg code to AliPID enum and adds track to tagged list
-void AliHFEV0taginfo::AddTrack(Int_t TrackID, Int_t pdgCode){
+void AliHFEV0taginfo::AddTrack(Int_t TrackID, Int_t pdgCode, Double_t prodR){
 
     if(TrackID<0) return;
     AliPID::EParticleType Pinfo;
@@ -196,7 +197,7 @@ void AliHFEV0taginfo::AddTrack(Int_t TrackID, Int_t pdgCode){
         default:
             return;
     }
-    fTaggedTracks->Add(new AliHFEV0tag(TrackID, Pinfo));
+    fTaggedTracks->Add(new AliHFEV0tag(TrackID, Pinfo, prodR));
     AliDebug(4,Form("Added new Track ID: %d with PID: %d, #entry: %d",TrackID, Pinfo, fTaggedTracks->GetEntries()));
 }
 
@@ -206,7 +207,7 @@ void AliHFEV0taginfo::AddTrack(Int_t TrackID, Int_t pdgCode){
 //returns AliPID::kUnknown if track ID not found
 AliPID::EParticleType AliHFEV0taginfo::GetV0Info(Int_t trackID){
 
-    AliHFEV0tag test(trackID, AliPID::kUnknown);
+    AliHFEV0tag test(trackID, AliPID::kUnknown,0);
     AliHFEV0tag *result = dynamic_cast<AliHFEV0tag *>(fTaggedTracks->FindObject(&test));
     if(!result){ 
         AliDebug(6, Form("Could not find track ID %d", trackID));
@@ -216,6 +217,20 @@ AliPID::EParticleType AliHFEV0taginfo::GetV0Info(Int_t trackID){
 }
 
 //________________________________________________________________________________
+//check for V0 daughter production vertex from track ID
+//returns -0.1 if track ID not found
+Float_t AliHFEV0taginfo::GetV0ProdR(Int_t trackID){
+
+    AliHFEV0tag test(trackID, AliPID::kUnknown, 0);
+    AliHFEV0tag *result = dynamic_cast<AliHFEV0tag *>(fTaggedTracks->FindObject(&test));
+    if(!result){
+        AliDebug(6, Form("Could not find track ID %d", trackID));
+        return -0.1;
+    }
+    return result->GetProdR();
+}
+
+//________________________________________________________________________________
 //resets the fTaggedTracks TList
 void AliHFEV0taginfo::Reset(){
     fTaggedTracks->Delete();
@@ -226,15 +241,17 @@ void AliHFEV0taginfo::Reset(){
 AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag():
     TObject(), 
     fTrackID(0),
-    fPinfo(AliPID::kUnknown)
+    fPinfo(AliPID::kUnknown),
+    fProdR(0)
 {
     // default constructor
 }
 //___________________________________________________________________
-AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag(Int_t TrackID, AliPID::EParticleType Pinfo):
+AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag(Int_t TrackID, AliPID::EParticleType Pinfo, Double_t fProdR):
     TObject(), 
     fTrackID(TrackID),
-    fPinfo(Pinfo)
+    fPinfo(Pinfo),
+    fProdR(fProdR)
 {
 }
 
@@ -242,7 +259,8 @@ AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag(Int_t TrackID, AliPID::EParticleType P
 AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag(const AliHFEV0tag &ref):
     TObject(ref),
     fTrackID(ref.fTrackID),
-    fPinfo(ref.fPinfo)
+    fPinfo(ref.fPinfo),
+    fProdR(ref.fProdR)
 {
     // Copy constructor
 }
@@ -255,6 +273,7 @@ AliHFEV0taginfo::AliHFEV0tag &AliHFEV0taginfo::AliHFEV0tag::operator=(const AliH
 
         fTrackID = ref.fTrackID;
         fPinfo = ref.fPinfo;
+        fProdR = ref.fProdR;
     }
     return *this;
 }
@@ -273,6 +292,14 @@ void AliHFEV0taginfo::AliHFEV0tag::SetTrack(const Int_t trackID, const AliPID::E
     fTrackID = trackID;
     fPinfo = Pinfo;
 }
+
+//Set track ID and production verxtex
+//___________________________________________________________________
+void AliHFEV0taginfo::AliHFEV0tag::SetProdR(const Int_t trackID, const Double_t prodR){
+    fTrackID = trackID;
+    fProdR = prodR;
+}
+
 //____________________________________________________________
 Bool_t AliHFEV0taginfo::AliHFEV0tag::IsEqual(const TObject *ref) const {
     //
index bfa5b97..a28e5e7 100644 (file)
@@ -40,14 +40,15 @@ class AliHFEV0taginfo: public TNamed{
         void Reset(); //resets the fTaggedTracks TList
         void TagV0Tracks(AliVEvent *event); // loops over V0s in event and fills fTaggedTracks with V0 tracks
         AliPID::EParticleType GetV0Info(Int_t trackID); //check for V0 information from track ID 
+        Float_t GetV0ProdR(Int_t trackID); //check for V0 information from track ID 
         void SetIsAODana() { fIsAODana = kTRUE; } // Setter AOD analysis
         void SetIsESDana() { fIsAODana = kFALSE; } // Setter ESD analysis
-        void AddTrack(Int_t TrackID, Int_t pdgCode); //Translates the pdg code to AliPID enum and adds track to tagged list (currently only e, pion and proton tracks)
+        void AddTrack(Int_t TrackID, Int_t pdgCode, Double_t prodR); //Translates the pdg code to AliPID enum and adds track to tagged list (currently only e, pion and proton tracks)
 
         class AliHFEV0tag: public TObject{
             public:
                 AliHFEV0tag();
-                AliHFEV0tag(Int_t TrackID, AliPID::EParticleType Pinfo);
+                AliHFEV0tag(Int_t TrackID, AliPID::EParticleType Pinfo, Double_t prodR);
                 AliHFEV0tag(const AliHFEV0tag &ref);
                 AliHFEV0tag &operator=(const AliHFEV0tag &ref);
                 virtual ~AliHFEV0tag();
@@ -59,12 +60,15 @@ class AliHFEV0taginfo: public TNamed{
 
                 //Setter
                 void SetTrack(const Int_t trackID, const AliPID::EParticleType Pinfo); //Set track ID
+                void SetProdR(const Int_t trackID, const Double_t prodR); //Set V0 daughter production vertex radius
                 //Getter
                 Int_t GetTrackID() const { return fTrackID; };
                 AliPID::EParticleType GetPinfo() const { return fPinfo; };
+                Double_t GetProdR() const { return fProdR; };
             private:
                 Int_t fTrackID;
                 AliPID::EParticleType fPinfo;  
+                Double_t fProdR; // V0 daughter production vertex radius in x-y plane
 
                 ClassDef(AliHFEV0taginfo::AliHFEV0tag,1);
         };
index 78e577b..9415869 100644 (file)
@@ -147,7 +147,7 @@ class AliHFEcuts : public TNamed{
     void SetMaxChi2perClusterITS(Double_t chi2) { fMaxChi2clusterITS = chi2; };
     void SetMaxChi2perClusterTPC(Double_t chi2) { fMaxChi2clusterTPC = chi2; };
     inline void SetMaxImpactParam(Double_t radial, Double_t z);
-    inline void SetIPcutParam(Float_t p0, Float_t p1, Float_t p2, Float_t p3, Bool_t isIPcharge, Bool_t isipsigma, Bool_t isopp);
+    inline void SetIPcutParam(Float_t p0, Float_t p1, Float_t p2, Float_t p3, Bool_t isipsigma, Bool_t isIPcharge , Bool_t isopp);
     void SetMinRatioTPCclusters(Double_t minRatioTPC) { fMinClusterRatioTPC = minRatioTPC; };
     void SetPtRange(Double_t ptmin, Double_t ptmax){fPtRange[0] = ptmin; fPtRange[1] = ptmax;};
     void SetTOFsignaldxz(Double_t tofsignaldx, Double_t tofsignaldz){fTOFsignaldx = tofsignaldx; fTOFsignaldz = tofsignaldz;};
index 0e085ed..449624b 100644 (file)
@@ -224,6 +224,15 @@ void AliHFEmcQA::CreatDefaultHistograms(TList * const qaList)
       fMCQACollection->CreateTH1Farray(Form("etapspectra_centrbin%i",centbin), "etap yields: MC p_{t} ", iBin[1],kPtRange);
       fMCQACollection->CreateTH1Farray(Form("rhospectra_centrbin%i",centbin), "rho yields: MC p_{t} ", iBin[1],kPtRange);
 
+      fMCQACollection->CreateTH1Farray(Form("pionspectrapri_centrbin%i",centbin), "pion yields: MC p_{t} ", iBin[1],kPtRange);
+      fMCQACollection->CreateTH1Farray(Form("etaspectrapri_centrbin%i",centbin), "eta yields: MC p_{t} ", iBin[1],kPtRange);
+      fMCQACollection->CreateTH1Farray(Form("pionspectrasec_centrbin%i",centbin), "pion yields: MC p_{t} ", iBin[1],kPtRange);
+      fMCQACollection->CreateTH1Farray(Form("etaspectrasec_centrbin%i",centbin), "eta yields: MC p_{t} ", iBin[1],kPtRange);
+      fMCQACollection->CreateTH1Farray(Form("pionspectraLogpri_centrbin%i",centbin), "pion yields: MC p_{t} ", iBin[1],kPtRange);
+      fMCQACollection->CreateTH1Farray(Form("etaspectraLogpri_centrbin%i",centbin), "eta yields: MC p_{t} ", iBin[1],kPtRange);
+      fMCQACollection->CreateTH1Farray(Form("pionspectraLogsec_centrbin%i",centbin), "pion yields: MC p_{t} ", iBin[1],kPtRange);
+      fMCQACollection->CreateTH1Farray(Form("etaspectraLogsec_centrbin%i",centbin), "eta yields: MC p_{t} ", iBin[1],kPtRange);
+
       fMCQACollection->CreateTH1F(Form("pionspectraLog_centrbin%i",centbin), "pion yields: MC p_{t} ", iBin[0],kPtbound[0], kPtbound[1], 1);
       fMCQACollection->CreateTH1F(Form("etaspectraLog_centrbin%i",centbin), "eta yields: MC p_{t} ", iBin[0],kPtbound[0], kPtbound[1], 1);
       fMCQACollection->CreateTH1F(Form("omegaspectraLog_centrbin%i",centbin), "omega yields: MC p_{t} ", iBin[0],kPtbound[0], kPtbound[1], 1);
@@ -490,7 +499,10 @@ void AliHFEmcQA::GetMesonKine()
   Int_t id1=0, id2=0;
 
 
-  if(fCentrality>11) printf("warning centrality out of histogram array limits \n");
+  if(fCentrality>=11) {
+      AliWarning(Form("Centrality out of histogram array limits: %d", fCentrality));
+      return;
+  }
   if(!fIsPbPb&&!fIsppMultiBin) fCentrality=0;
 
   for(Int_t imc = 0; imc <fMCEvent->GetNumberOfPrimaries(); imc++){
@@ -507,6 +519,14 @@ void AliHFEmcQA::GetMesonKine()
           if(TMath::Abs(AliHFEtools::GetRapidity(mcpart0))<0.8) {
             fMCQACollection->Fill(Form("pionspectra_centrbin%i",fCentrality),mctrack0->Pt());
             fMCQACollection->Fill(Form("pionspectraLog_centrbin%i",fCentrality),mctrack0->Pt());
+            if(imc>fMCEvent->GetNumberOfPrimaries()) {
+              fMCQACollection->Fill(Form("pionspectrasec_centrbin%i",fCentrality),mctrack0->Pt());
+              fMCQACollection->Fill(Form("pionspectraLogsec_centrbin%i",fCentrality),mctrack0->Pt());
+            }
+            else {
+              fMCQACollection->Fill(Form("pionspectrapri_centrbin%i",fCentrality),mctrack0->Pt());
+              fMCQACollection->Fill(Form("pionspectraLogpri_centrbin%i",fCentrality),mctrack0->Pt());
+            }
           }
           id1=mctrack0->GetFirstDaughter();
           id2=mctrack0->GetLastDaughter();
@@ -523,6 +543,14 @@ void AliHFEmcQA::GetMesonKine()
           if(TMath::Abs(AliHFEtools::GetRapidity(mcpart0))<0.8) {
             fMCQACollection->Fill(Form("etaspectra_centrbin%i",fCentrality),mctrack0->Pt());
             fMCQACollection->Fill(Form("etaspectraLog_centrbin%i",fCentrality),mctrack0->Pt());
+            if(imc>fMCEvent->GetNumberOfPrimaries()) {
+              fMCQACollection->Fill(Form("etaspectrasec_centrbin%i",fCentrality),mctrack0->Pt());
+              fMCQACollection->Fill(Form("etaspectraLogsec_centrbin%i",fCentrality),mctrack0->Pt());
+            }
+            else {
+              fMCQACollection->Fill(Form("etaspectrapri_centrbin%i",fCentrality),mctrack0->Pt());
+              fMCQACollection->Fill(Form("etaspectraLogpri_centrbin%i",fCentrality),mctrack0->Pt());
+            }
           } 
           id1=mctrack0->GetFirstDaughter();
           id2=mctrack0->GetLastDaughter();
@@ -1521,7 +1549,7 @@ void AliHFEmcQA::ReportStrangeness(Int_t &motherID, Int_t &mothertype, Int_t &mo
 }
 
 //__________________________________________
-Int_t AliHFEmcQA::GetSource(const AliVParticle* const mcpart)
+Int_t AliHFEmcQA::GetSource(const AliVParticle* const mcpart) const
 {        
   // decay particle's origin 
 
@@ -1604,7 +1632,7 @@ Int_t AliHFEmcQA::GetSource(const AliVParticle* const mcpart)
 }
 
 //__________________________________________
-Int_t AliHFEmcQA::GetSource(const TParticle * const mcpart)
+Int_t AliHFEmcQA::GetSource(const TParticle * const mcpart) const
 {
   // decay particle's origin 
 
@@ -1689,7 +1717,7 @@ Int_t AliHFEmcQA::GetSource(const TParticle * const mcpart)
 }
 
 //__________________________________________
-Int_t AliHFEmcQA::GetElecSource(TParticle * const mcpart)
+Int_t AliHFEmcQA::GetElecSource(TParticle * const mcpart) const
 {
   // decay particle's origin 
 
@@ -1786,7 +1814,8 @@ Int_t AliHFEmcQA::GetElecSource(TParticle * const mcpart)
 
       if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kBeauty || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kBeauty ) return kGammaB2M;
       if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kCharm || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kCharm ) return kGammaD2M;
-      if ( TMath::Abs(grmaPdgcode) == 221 ) return kElse; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
+      if ( TMath::Abs(grmaPdgcode) == 221 ) return kGammaEta2Pi0; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
+      //if ( TMath::Abs(grmaPdgcode) == 221 ) return kElse; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
 
       tmpMomLabel = partMother->GetFirstMother();
       if((mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tmpMomLabel))))) {
@@ -1828,17 +1857,17 @@ Int_t AliHFEmcQA::GetElecSource(TParticle * const mcpart)
       partMother = mctrack->Particle();
       grmaPdgcode = partMother->GetPdgCode();
 
-      if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kBeauty || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kBeauty ) return kGammaB2M;
-      if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kCharm || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kCharm ) return kGammaD2M;
-      if ( TMath::Abs(grmaPdgcode) == 221 ) return kElse; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
+      if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kBeauty || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kBeauty ) return kB2M;
+      if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kCharm || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kCharm ) return kD2M;
+      if ( TMath::Abs(grmaPdgcode) == 221 ) return kEta2Pi0; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
 
       tmpMomLabel = partMother->GetFirstMother();
       if((mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tmpMomLabel))))) {
        partMother = mctrack->Particle();
        ggrmaPdgcode = partMother->GetPdgCode();
 
-       if ( (int(TMath::Abs(ggrmaPdgcode)/100.)%10) == kBeauty || (int(TMath::Abs(ggrmaPdgcode)/1000.)%10) == kBeauty ) return kGammaB2M;
-       if ( (int(TMath::Abs(ggrmaPdgcode)/100.)%10) == kCharm || (int(TMath::Abs(ggrmaPdgcode)/1000.)%10) == kCharm ) return kGammaD2M;
+       if ( (int(TMath::Abs(ggrmaPdgcode)/100.)%10) == kBeauty || (int(TMath::Abs(ggrmaPdgcode)/1000.)%10) == kBeauty ) return kB2M;
+       if ( (int(TMath::Abs(ggrmaPdgcode)/100.)%10) == kCharm || (int(TMath::Abs(ggrmaPdgcode)/1000.)%10) == kCharm ) return kD2M;
       }
      }
 
@@ -1872,7 +1901,7 @@ Int_t AliHFEmcQA::GetElecSource(TParticle * const mcpart)
 }
 
 //__________________________________________
-Int_t AliHFEmcQA::GetElecSource(const AliVParticle * const mctrack)
+Int_t AliHFEmcQA::GetElecSource(const AliVParticle * const mctrack) const
 {
   //
   // decay particle's origin 
@@ -1903,7 +1932,7 @@ Int_t AliHFEmcQA::GetElecSource(const AliVParticle * const mctrack)
   return -1;
 }
 //__________________________________________
-Int_t AliHFEmcQA::GetElecSource(const AliAODMCParticle * const mcpart)
+Int_t AliHFEmcQA::GetElecSource(const AliAODMCParticle * const mcpart) const
 {
   //
   // Function for AliAODMCParticle
@@ -2026,7 +2055,8 @@ Int_t AliHFEmcQA::GetElecSource(const AliAODMCParticle * const mcpart)
          return kGammaD2M;
        }
        if ( TMath::Abs(grmaPdgcode) == 221 ) {  
-         return kElse; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
+         return kGammaEta2Pi0; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
+         //return kElse; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
        }
        
        tmpMomLabel = partMother->GetMother();
@@ -2080,13 +2110,13 @@ Int_t AliHFEmcQA::GetElecSource(const AliAODMCParticle * const mcpart)
         grmaPdgcode = partMother->GetPdgCode();
         
         if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kBeauty || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kBeauty ) {
-          return kGammaB2M;
+          return kB2M;
         }
         if ( (int(TMath::Abs(grmaPdgcode)/100.)%10) == kCharm || (int(TMath::Abs(grmaPdgcode)/1000.)%10) == kCharm ) {
-          return kGammaD2M;
+          return kD2M;
         }
         if ( TMath::Abs(grmaPdgcode) == 221 ) {
-          return kElse; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
+          return kEta2Pi0; //mj to remove secondary pi0 decay electrons from eta decays, mainly to eta signal enhance samples
         }
         
         tmpMomLabel = partMother->GetMother();
@@ -2096,10 +2126,10 @@ Int_t AliHFEmcQA::GetElecSource(const AliAODMCParticle * const mcpart)
             ggrmaPdgcode = partMother->GetPdgCode();
             
             if ( (int(TMath::Abs(ggrmaPdgcode)/100.)%10) == kBeauty || (int(TMath::Abs(ggrmaPdgcode)/1000.)%10) == kBeauty ) {
-              return kGammaB2M;
+              return kB2M;
             }
             if ( (int(TMath::Abs(ggrmaPdgcode)/100.)%10) == kCharm || (int(TMath::Abs(ggrmaPdgcode)/1000.)%10) == kCharm ) {
-              return kGammaD2M;
+              return kD2M;
             }
           }
         }
@@ -2212,7 +2242,8 @@ Double_t AliHFEmcQA::GetWeightFactor(AliMCParticle *mctrack, const Int_t iBgLeve
         Int_t glabel=TMath::Abs(mctrack->GetMother()); 
         if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
           mesonPt=mctrackmother->Pt(); //meson pt
-          bgcategory = -1.;
+          if(mesonID==kEta) bgcategory = -1.41; // to consider new branching ratio for the eta Dalitz decay
+          else bgcategory = -1.;
           datamc[1] = bgcategory;
           datamc[2] = mesonPt;
           mctrackmother->XvYvZv(xr);
@@ -2224,7 +2255,8 @@ Double_t AliHFEmcQA::GetWeightFactor(AliMCParticle *mctrack, const Int_t iBgLeve
             datamc[15] = mcpart->GetUniqueID();
           }
           if(glabel>fMCEvent->GetNumberOfPrimaries()) {
-            bgcategory = -2.;
+            if(mesonID==kEta) bgcategory = -2.82; // to consider new branching ratio for the eta Dalitz decay (1.41)
+            else bgcategory = -2.;
             datamc[1] = bgcategory;
             glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
             if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
@@ -2321,7 +2353,80 @@ Double_t AliHFEmcQA::GetWeightFactor(AliMCParticle *mctrack, const Int_t iBgLeve
 }
 
 //__________________________________________
-Int_t AliHFEmcQA::GetMother(const AliVParticle * const mcpart){
+Double_t AliHFEmcQA::GetWeightFactor(const AliAODMCParticle * const mcpart, const Int_t iBgLevel){
+  //
+  // Get weighting factor for the realistic background estimation, for three possible background yield levels, indicated by the argument "iLevel": the best estimate (0), the lower uncertainty level (1), and the upper uncertainty level (2)
+  //
+
+  if (!mcpart) return 0;
+  if (!fMCArray) return 0;
+
+  Double_t weightElecBg = 0.;
+  Double_t mesonPt = 0.;
+  Double_t bgcategory = 0.;
+  Int_t mArr = -1;
+  Int_t mesonID = GetElecSource(mcpart);
+  if(mesonID==kGammaPi0 || mesonID==kPi0) mArr=0;                //pion
+  else if(mesonID==kGammaEta || mesonID==kEta) mArr=1;           //eta
+  else if(mesonID==kGammaOmega || mesonID==kOmega) mArr=2;       //omega
+  else if(mesonID==kGammaPhi || mesonID==kPhi) mArr=3;           //phi
+  else if(mesonID==kGammaEtaPrime || mesonID==kEtaPrime) mArr=4; //etaprime
+  else if(mesonID==kGammaRho0 || mesonID==kRho0) mArr=5;         //rho
+
+  if(!(mArr<0)){
+
+     AliAODMCParticle *mctrackmother = NULL; // will change all the time
+
+     if(mesonID>=kGammaPi0) {  // conversion electron, be careful with the enum odering
+        Int_t iLabel = mcpart->GetMother(); //gamma label
+        if(!(mctrackmother = dynamic_cast<AliAODMCParticle *>(fMCArray->At(TMath::Abs(iLabel))))) return 0;
+        iLabel = mctrackmother->GetMother(); //gamma's mother's label
+        if(!(mctrackmother= dynamic_cast<AliAODMCParticle *>(fMCArray->At(TMath::Abs(iLabel))))) return 0;
+        mesonPt = mctrackmother->Pt(); //meson pt
+        bgcategory = 1.;
+
+        //if(glabel>fMCEvent->GetNumberOfPrimaries()) bgcategory = 2.;
+     }
+     else{ // nonHFE except for the conversion electron
+        Int_t iLabel = mcpart->GetMother(); //meson label
+        if(!(mctrackmother = dynamic_cast<AliAODMCParticle *>(fMCArray->At(TMath::Abs(iLabel))))) return 0;
+        mesonPt = mctrackmother->Pt(); //meson pt
+        if(mesonID==kEta) bgcategory = -1.41; // to consider new branching ratio for the eta Dalitz decay
+        else bgcategory = -1.;
+
+        //if(glabel>fMCEvent->GetNumberOfPrimaries()) bgcategory = -2.;
+     }
+
+     if(fIsPbPb){
+       Int_t centBin = GetWeightCentralityBin(fPerCentrality);
+       if(centBin < 0)return 0.;
+       weightElecBg=fElecBackgroundFactor[iBgLevel][centBin][mArr][kBgPtBins-1];
+       for(int ii=0; ii<kBgPtBins; ii++){
+         if((mesonPt > fBinLimit[ii]) && (mesonPt < fBinLimit[ii+1])){
+           weightElecBg = fElecBackgroundFactor[iBgLevel][centBin][mArr][ii];
+           break;
+         }
+       }
+     }
+     else{
+       weightElecBg=fElecBackgroundFactor[iBgLevel][0][mArr][kBgPtBins-1];
+       for(int ii=0; ii<kBgPtBins; ii++){
+         if((mesonPt > fBinLimit[ii]) && (mesonPt < fBinLimit[ii+1])){
+           weightElecBg = fElecBackgroundFactor[iBgLevel][0][mArr][ii];
+           break;
+         }
+       }
+     }
+  }
+
+  Double_t returnval = bgcategory*weightElecBg;
+  if(TMath::Abs(bgcategory)>1) returnval = bgcategory/2.;
+
+  return returnval;
+}
+
+//__________________________________________
+Int_t AliHFEmcQA::GetMother(const AliVParticle * const mcpart) const {
   //
   // Wrapper to get the mother label
   //
index cdefb51..c492791 100644 (file)
@@ -48,7 +48,7 @@ class AliHFEmcQA: public TObject {
   public: 
     enum heavyType {kCharm=4, kBeauty=5, kOthers=6, kElectronPDG=11};
     enum qType {kQuark, kantiQuark, kHadron, keHadron, kDeHadron, kElectron, kElectron2nd};
-    enum SourceType {kDirectCharm=1, kDirectBeauty=2, kBeautyCharm=3, kGamma=4, kPi0=5, kElse=6, kMisID=7, kEta=8, kOmega=9, kPhi=10, kEtaPrime=11, kRho0=12, kGammaPi0=13, kGammaEta=14, kGammaOmega=15, kGammaPhi=16, kGammaEtaPrime=17, kGammaRho0=18, kJpsi=19, kB2Jpsi=20, kKe3=21, kGammaB2M=22, kGammaD2M=23};
+    enum SourceType {kDirectCharm=1, kDirectBeauty=2, kBeautyCharm=3, kGamma=4, kPi0=5, kElse=6, kMisID=7, kEta=8, kOmega=9, kPhi=10, kEtaPrime=11, kRho0=12, kGammaPi0=13, kGammaEta=14, kGammaOmega=15, kGammaPhi=16, kGammaEtaPrime=17, kGammaRho0=18, kJpsi=19, kB2Jpsi=20, kKe3=21, kGammaB2M=22, kGammaD2M=23, kGammaEta2Pi0=24, kB2M=25, kD2M=26, kEta2Pi0=27, kScdryM=28};
     enum ProcessType {
       kPairCreationFromq,  kPairCreationFromg,  kFlavourExitation,  kGluonSplitting, kInitialPartonShower, kLightQuarkShower
     };
@@ -81,12 +81,13 @@ class AliHFEmcQA: public TObject {
     void GetDecayedKine(AliAODMCParticle *mcpart, const Int_t kquark, Int_t kdecayed); // get decay electron kinematics for AOD 
     void GetMesonKine(); // get meson and its decay electron pt spectra
     void EndOfEventAna(const Int_t kquark); // run analysis which should be done at the end of the event loop
-    Int_t GetSource(const TParticle * const mcpart); // return source id 
-    Int_t GetElecSource(const AliVParticle * const mctrack);
-    Int_t GetElecSource(TParticle * const mcpart); // return electron source id 
-    Int_t GetElecSource(const AliAODMCParticle * const mcpart);
-    Int_t GetSource(const AliVParticle * const mcpart); // return electron source id for AOD
+    Int_t GetSource(const TParticle * const mcpart) const; // return source id 
+    Int_t GetElecSource(const AliVParticle * const mctrack) const;
+    Int_t GetElecSource(TParticle * const mcpart) const; // return electron source id 
+    Int_t GetElecSource(const AliAODMCParticle * const mcpart) const;
+    Int_t GetSource(const AliVParticle * const mcpart) const; // return electron source id for AOD
     Double_t GetWeightFactor(AliMCParticle *mctrack, const Int_t iBgLevel); // return best/lower/upper weighting factor for electron's mother meson
+    Double_t GetWeightFactor(const AliAODMCParticle * const mcpart, const Int_t iBgLevel);
     Int_t GetWeightCentralityBin(const Float_t percentile) const; //translate the centrality percentile into the centrality bin of the reference weighting histograms for electron background
     void EnableDebugStreamer() { fIsDebugStreamerON = kTRUE;};
 
@@ -106,7 +107,7 @@ class AliHFEmcQA: public TObject {
     Bool_t IsPPMultiBin() const { return fIsppMultiBin; };
 
   protected:
-    Int_t GetMother(const AliVParticle * const track);
+    Int_t GetMother(const AliVParticle * const track) const;
     void IdentifyMother(Int_t motherlabel, Int_t &motherpdg, Int_t &grandmotherlabel); // 
     void HardScattering(const Int_t kquark, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // check if the quark is produced from hard scattering
     void ReportStrangeness(Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // report if the quark production process is unknown
index d0d4e11..96ef3a9 100644 (file)
@@ -28,6 +28,7 @@
 #include "AliESDtrack.h"
 #include "AliPID.h"
 #include "AliPIDResponse.h"
+#include "AliTOFPIDResponse.h"
 
 #include "AliHFEdetPIDqa.h"
 #include "AliHFEpidTOF.h"
@@ -42,6 +43,8 @@ AliHFEpidTOF::AliHFEpidTOF():
   , fNsigmaTOF(3)
   , fUseOnlyIfAvailable(kFALSE)
   , fRejectMismatch(kFALSE)
+  , fGenerateTOFmismatch(kFALSE)
+  , fNmismatchTracks(0)
 {
   //
   // Constructor
@@ -57,6 +60,8 @@ AliHFEpidTOF::AliHFEpidTOF(const Char_t *name):
   , fNsigmaTOF(3)
   , fUseOnlyIfAvailable(kFALSE)
   , fRejectMismatch(kFALSE)
+  , fGenerateTOFmismatch(kFALSE)
+  , fNmismatchTracks(0)
 {
   //
   // Constructor
@@ -72,6 +77,8 @@ AliHFEpidTOF::AliHFEpidTOF(const AliHFEpidTOF &c):
   , fNsigmaTOF(3)
   , fUseOnlyIfAvailable(kFALSE)
   , fRejectMismatch(kFALSE)
+  , fGenerateTOFmismatch(c.fGenerateTOFmismatch)
+  , fNmismatchTracks(c.fNmismatchTracks)
 {  
   // 
   // Copy operator
@@ -107,6 +114,8 @@ void AliHFEpidTOF::Copy(TObject &ref) const {
   target.fNsigmaTOF = fNsigmaTOF;
   target.fUseOnlyIfAvailable = fUseOnlyIfAvailable;
   target.fRejectMismatch = fRejectMismatch;
+  target.fGenerateTOFmismatch = fGenerateTOFmismatch;
+  target.fNmismatchTracks = fNmismatchTracks;
   memcpy(target.fSigmaBordersTOFLower, fSigmaBordersTOFLower, sizeof(Float_t) * 12);
   memcpy(target.fSigmaBordersTOFUpper, fSigmaBordersTOFUpper, sizeof(Float_t) * 12);
 
@@ -208,3 +217,41 @@ Bool_t AliHFEpidTOF::IsMismatch(const AliVTrack * const track) const {
   AliPIDResponse::EDetPidStatus status = fkPIDResponse->ComputeTOFProbability(track, AliPID::kSPECIESC, probs);
   return status == AliPIDResponse::kDetMismatch;
 }
+
+//___________________________________________________________________
+void AliHFEpidTOF::GenerateTOFmismatch(const AliVTrack * const trk, int ntrk, TArrayD &sigmaEl){
+  //
+  // Function generate randomised TOF mismatch hits for a given input track. The number of generated
+  // mismatch tracks is steered by the parameter ntrk. For all mismatch tracks the number of sigmas
+  // to the electron time-of-flight hypothesis is calculated, and the resulting numbers of sigmas
+  // are stored in the array sigmaEl for further processing
+  //
+  if(sigmaEl.GetSize() < ntrk) sigmaEl.Set(ntrk);
+  sigmaEl.Reset();
+
+  // work on copy
+  AliVTrack *copytrk(NULL);
+  Bool_t isAOD = kFALSE;
+  if(dynamic_cast<const AliESDtrack *>(trk)){
+    copytrk = new AliESDtrack(*(static_cast<const AliESDtrack *>(trk)));
+  } else {
+    copytrk = new AliAODTrack(*(static_cast<const AliAODTrack *>(trk)));
+    isAOD = kTRUE;
+  }
+
+  // Generate mismatch values for number of sigmas to the electron hypothesis and store then in the 
+  // output array
+  for(int itrk = 0; itrk < ntrk; itrk++){
+    Double_t tofsignal = AliTOFPIDResponse::GetMismatchRandomValue(copytrk->Eta());
+    if(isAOD){
+      AliAODTrack *aodtrk = static_cast<AliAODTrack *>(copytrk);
+      AliAODPid *aodpid = aodtrk->GetDetPid();
+      if(aodpid) aodpid->SetTOFsignal(tofsignal);
+    } else {
+      AliESDtrack *esdtrk = static_cast<AliESDtrack *>(copytrk);
+      esdtrk->SetTOFsignal(tofsignal);
+    }
+    sigmaEl[itrk] = fkPIDResponse->NumberOfSigmasTOF(copytrk, AliPID::kElectron);
+  }
+  delete copytrk;
+}
index a093b82..c965dee 100644 (file)
 #include "AliHFEpidBase.h"
 #endif
 
+#ifndef ROOT_TARRAY
+#include <TArrayD.h>
+#endif
+
 class AliVParticle;
 class AliVTrack;
 class AliPID;
@@ -33,8 +37,12 @@ class AliHFEpidTOF : public AliHFEpidBase{
     void SetTOFnSigma(Float_t nSigma) { fNsigmaTOF = nSigma; };
     void SetTOFnSigmaBand(Float_t lower, Float_t upper);
     void SetTOFnSigmaBandCentrality(Float_t lower, Float_t upper, Int_t centralityBin); 
+    void SetGenerateTOFmismatch(Bool_t gen = kTRUE, Int_t ntrk = 10) { fGenerateTOFmismatch = gen; fNmismatchTracks = ntrk; }
+    Bool_t IsGenerateTOFmismatch() const { return fGenerateTOFmismatch; }
+    Int_t GetNmismatchTracks() const { return fNmismatchTracks; }
     void UseTOFonlyIfAvailable() { fUseOnlyIfAvailable = kTRUE; }
     void SetRejectTOFmismatch() { fRejectMismatch = kTRUE; }
+    void GenerateTOFmismatch(const AliVTrack * const trk, int ntrk, TArrayD &sigmaEl);
 
   protected:
     void Copy(TObject &ref) const;
@@ -49,6 +57,8 @@ class AliHFEpidTOF : public AliHFEpidBase{
     Float_t    fSigmaBordersTOFUpper[12]; // Max.  sigma cut
     Bool_t     fUseOnlyIfAvailable;       // Use TOF obly if available
     Bool_t     fRejectMismatch;           // Reject TOF mismatch
+    Bool_t     fGenerateTOFmismatch;      // Generate TOF mismatch
+    Int_t      fNmismatchTracks;          // Number of mismatch tracks to generate
 
     ClassDef(AliHFEpidTOF, 1)
 };
index af6b5ad..2aa50f6 100644 (file)
@@ -36,7 +36,8 @@ TObject(),
   fNmcparticles(0),
   fRunNumber(0),
   fTrigger(0),
-  fSPDMultiplicity(0)
+  fSPDMultiplicity(0),
+  fPileupFlag(kFALSE)
 {
   //
   // Default constructor
@@ -51,8 +52,10 @@ TObject(),
   memset(fVX, 0, sizeof(Float_t)*2);
   memset(fVY, 0, sizeof(Float_t)*2);
   memset(fVZ, 0, sizeof(Float_t)*2);
+  memset(fVMC, 0, sizeof(Double_t)*3);
   memset(fNContrib, 0, sizeof(Int_t) * 2);
-  memset(fVertexResolution, 0, sizeof(Float_t)*2);
+  fVertexResolution[0] = fVertexResolution[1] = 999.;
+  fVertexDispersion[0] = fVertexDispersion[0] = 999.;
 }
 
 //_______________________________________
@@ -64,7 +67,8 @@ AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref):
   fNmcparticles(ref.fNmcparticles),
   fRunNumber(ref.fRunNumber),
   fTrigger(ref.fTrigger),
-  fSPDMultiplicity(ref.fSPDMultiplicity)
+  fSPDMultiplicity(ref.fSPDMultiplicity),
+  fPileupFlag(ref.fPileupFlag)
 {
   //
   // Copy constructor
@@ -83,7 +87,9 @@ AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref):
   memcpy(fVX, ref.fVX, sizeof(Float_t)*2);
   memcpy(fVY, ref.fVY, sizeof(Float_t)*2);
   memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2);
+  memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
   memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
+  memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
   memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
 }
 
@@ -109,9 +115,12 @@ AliHFEreducedEvent &AliHFEreducedEvent::operator=(const AliHFEreducedEvent &ref)
     memcpy(fVX, ref.fVX, sizeof(Float_t)*2);
     memcpy(fVY, ref.fVY, sizeof(Float_t)*2);
     memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2);
+    memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
     memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
     memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
+    memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
     fSPDMultiplicity = ref.fSPDMultiplicity;
+    fPileupFlag = ref.fPileupFlag;
     memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
     memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
     memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
index 7aab9f8..8f8c3b1 100644 (file)
@@ -45,12 +45,17 @@ class AliHFEreducedEvent : public TObject{
   Float_t GetVXSPD() const { return fVX[1]; }
   Float_t GetVYSPD() const { return fVY[1]; }
   Float_t GetVZSPD() const { return fVZ[1]; }
+  Double_t GetVXMC() const { return fVMC[0]; }
+  Double_t GetVYMC() const { return fVMC[1]; }
+  Double_t GetVZMC() const { return fVMC[2]; }
   Int_t GetNContribVertex() const { return fNContrib[0]; }
   Int_t GetNContribVertexSPD() const { return fNContrib[1]; }
   Bool_t HasPrimaryVertex() const { return fNContrib[0] > 0; }
   Bool_t HasPrimaryVertexSPD() const { return fNContrib[1] > 0; }
   Float_t GetVertexZResolution() const { return fVertexResolution[0]; };
   Float_t GetVertexZResolutionSPD() const { return fVertexResolution[1]; };
+  Float_t GetVertexDispersion()  const { return fVertexDispersion[0]; };
+  Float_t GetVertexDispersionSPD()  const { return fVertexDispersion[1]; };
   Int_t GetRunNumber() const { return fRunNumber; }
   Double_t GetCentrality() const { return fCentrality[0]; }
   Double_t GetCentralityV0M() const { return fCentrality[0]; }
@@ -84,7 +89,13 @@ class AliHFEreducedEvent : public TObject{
   void SetVXSPD(Float_t vx) { fVX[1] = vx; }
   void SetVYSPD(Float_t vy) { fVY[1] = vy; }
   void SetVZSPD(Float_t vz) { fVZ[1] = vz; }
+  void SetVMC(Double_t vx, Double_t vy, Double_t vz){
+      fVMC[0] = vx;
+      fVMC[1] = vy;
+      fVMC[2] = vz;
+  }
   void SetRunNumber(Int_t runnumber) { fRunNumber = runnumber; }
+  void SetPileupFlag() { fPileupFlag = kTRUE; }
   inline void SetCentrality(
         Float_t centV0M, 
         Float_t centV0A, 
@@ -101,6 +112,8 @@ class AliHFEreducedEvent : public TObject{
   void SetNContribVertexSPD(Int_t ncontrib) { fNContrib[1] = ncontrib; }
   void SetVertexResolution(Float_t res) { fVertexResolution[0] = res; }
   void SetVertexResolutionSPD(Float_t res) { fVertexResolution[1] = res; }
+  void SetVertexDispersion(Float_t dis) { fVertexDispersion[0] = dis; }
+  void SetVertexDispersionSPD(Float_t dis) { fVertexDispersion[1] = dis; }
   
   Bool_t IsMBTrigger() const { return TESTBIT(fTrigger, kMB); }
   Bool_t IsSemiCentralTrigger() const { return TESTBIT(fTrigger, kSemiCentral); }
@@ -109,7 +122,8 @@ class AliHFEreducedEvent : public TObject{
   Bool_t IsTRDSETrigger() const { return TESTBIT(fTrigger, kTRDSE); }
   Bool_t IsTRDDQTrigger() const { return TESTBIT(fTrigger, kTRDDQ); }
   Bool_t IsINTTrigger() const { return TESTBIT(fTrigger, kINTTRG); }
-
+  Bool_t HasPileupFlag() const { return fPileupFlag; }
+  
   void SetMBTrigger() { SETBIT(fTrigger, kMB); }
   void SetSemiCentralTrigger() { SETBIT(fTrigger, kSemiCentral); }
   void SetCentralTrigger() { SETBIT(fTrigger, kCentral); }
@@ -133,7 +147,7 @@ class AliHFEreducedEvent : public TObject{
     kEMCAL = 3,
     kTRDSE = 4,
     kTRDDQ = 5,
-    kINTTRG = 6 
+    kINTTRG = 6
   } Trigger_t;
   enum{
     kCentBuff = 15
@@ -148,13 +162,16 @@ class AliHFEreducedEvent : public TObject{
   Float_t fVX[2];               // Vertex X
   Float_t fVY[2];               // Vertex Y
   Float_t fVZ[2];               // Vertex Z
+  Double_t fVMC[3];              // Position of the MC Vertex
   Int_t    fNContrib[2];        // Number of vertex contributors
   Float_t  fVertexResolution[2];// z-Vertex resolution 
+  Float_t  fVertexDispersion[2];// z-Vertex dispersion
   Float_t  fV0Multiplicity[2];  // V0 multiplicity
   Float_t  fZDCEnergy[4];       // ZDC Energy (n,p)
   Int_t    fSPDMultiplicity;    // SPD tracklet multiplicity
+  Bool_t   fPileupFlag;         // Flag for Pileup event
   
-  ClassDef(AliHFEreducedEvent, 4)
+  ClassDef(AliHFEreducedEvent, 5)
 };
 
 //____________________________________________________________
index 1e0e18d..88cca57 100644 (file)
 #include "AliInputEventHandler.h"
 #include "AliHFEcuts.h"
 #include "AliHFEextraCuts.h"
+#include "AliHFEmcQA.h"
 #include "AliHFEpidTPC.h"
 #include "AliHFEreducedEvent.h"
 #include "AliHFEreducedTrack.h"
 #include "AliHFEreducedMCParticle.h"
 #include "AliHFEsignalCuts.h"
+#include "AliHFEV0taginfo.h"
 #include "AliLog.h"
 #include "AliMCEvent.h"
 #include "AliPIDResponse.h"
@@ -69,12 +71,15 @@ AliHFEreducedEventCreatorAOD::AliHFEreducedEventCreatorAOD():
   fExtraCuts(NULL),
   fSignalCuts(NULL),
   fTPCpid(NULL),
+  fV0Tagger(NULL),
   fEventNumber(0),
   fNclustersTPC(70),
   fNclustersTPCPID(0),
   fNclustersITS(2),
   fNbOfTOFSigma(-1.0),
-  fRemoveFirstEvent(kFALSE)
+  fRemoveFirstEvent(kFALSE),
+  fFlagPileupEvents(kFALSE),
+  fSelectSignalOnly(kFALSE)
 {
   //
   // Default constructor
@@ -92,18 +97,22 @@ AliHFEreducedEventCreatorAOD::AliHFEreducedEventCreatorAOD(const char *name):
   fExtraCuts(NULL),
   fSignalCuts(NULL),
   fTPCpid(NULL),
+  fV0Tagger(NULL),
   fEventNumber(0),
   fNclustersTPC(70),
   fNclustersTPCPID(0),
   fNclustersITS(2),
   fNbOfTOFSigma(-1.0),
-  fRemoveFirstEvent(kFALSE)
+  fRemoveFirstEvent(kFALSE),
+  fFlagPileupEvents(kFALSE),
+  fSelectSignalOnly(kFALSE)
 {
   //
   // Default constructor
   //
   fTPCpid = new AliHFEpidTPC("QAtpcPID");
   fAnalysisUtils = new AliAnalysisUtils;
+  fV0Tagger = new AliHFEV0taginfo("Tagger");
   DefineOutput(1, TTree::Class());
 }
 
@@ -113,6 +122,7 @@ AliHFEreducedEventCreatorAOD::~AliHFEreducedEventCreatorAOD(){
   //
     if(fTPCpid) delete fTPCpid;
     if(fAnalysisUtils) delete fAnalysisUtils;
+    if(fV0Tagger) delete fV0Tagger;
     if(fHFEevent) delete fHFEevent;
 }
 
@@ -224,6 +234,11 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
   }
   fExtraCuts->SetRecEventInfo(fInputEvent);
 
+  // Tag all v0s in current event
+  if(fV0Tagger){
+    fV0Tagger->Reset();
+    fV0Tagger->TagV0Tracks(fInputEvent);
+  }
  
   // Make Reduced Event 
   //AliHFEreducedEvent hfeevent;
@@ -258,6 +273,7 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
   fHFEevent->SetVZ(vtx[2]);
   fHFEevent->SetNContribVertex(ncontrib);
   fHFEevent->SetVertexResolution(TMath::Sqrt(TMath::Abs(vcov[5])));
+  //fHFEevent->SetVertexDispersion(vertex->GetDispersion());
   // Get Primary Vertex from SPD
   const AliVVertex *vertexSPD = aodE->GetPrimaryVertexSPD();
   if(vertexSPD){
@@ -272,6 +288,7 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
     vertexSPD->GetCovarianceMatrix(vcov);
     AliDebug(1, Form("Covariance Matrix vcov[5] %f\n",vcov[5]));
     fHFEevent->SetVertexResolutionSPD(TMath::Sqrt(TMath::Abs(vcov[5])));
+    //fHFEevent->SetVertexDispersionSPD(vertex->GetDispersion());
   }
 
   // Get centrality
@@ -305,6 +322,11 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
   AliAODTracklets *tls = aodE->GetTracklets();
   if(tls) fHFEevent->SetSPDMultiplicity(tls->GetNumberOfTracklets());
 
+  // Flag Pileup
+  if(fFlagPileupEvents){
+    if(fAnalysisUtils->IsPileUpEvent(fInputEvent)) fHFEevent->SetPileupFlag();
+  }
+
   // Look for kink mother
   AliDebug(1, "Vertices\n");
   Int_t numberofvertices = aodE->GetNumberOfVertices();
@@ -332,14 +354,16 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
   //
   AliAODMCParticle *mctrack(NULL);
   // Monte-Carlo info
-  Int_t source(5);
+  //Int_t source(5);
   if(mcthere){
+    fHFEevent->SetVMC(fAODMCHeader->GetVtxX(),fAODMCHeader->GetVtxY(),fAODMCHeader->GetVtxZ());
     AliDebug(1, "Loop MC tracks\n");
     for(Int_t itrack = 0; itrack < fAODArrayMCInfo->GetEntriesFast(); itrack++) {
       mctrack = (AliAODMCParticle *)(fAODArrayMCInfo->At(itrack));
       if(!mctrack) continue;
+      if(TMath::Abs(mctrack->PdgCode()) != 11) continue;  // in MC truth list store only electrons
+      if(fSelectSignalOnly && !fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mctrack)) continue;        
       AliHFEreducedMCParticle hfemcpart;
-      if(fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mctrack)) continue;        
       hfemcpart.SetSignal();
       // Kinematics
       hfemcpart.SetSignedPt(mctrack->Pt(), mctrack->Charge() > 0.);
@@ -355,18 +379,27 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
       Int_t motherlabel = TMath::Abs(mctrack->GetMother());
       if(motherlabel >= 0 && motherlabel < fAODArrayMCInfo->GetEntriesFast()){
         AliAODMCParticle *mother = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(motherlabel));
-        if(mother) hfemcpart.SetMotherPdg(mother->GetPdgCode());
+        if(mother){ 
+          hfemcpart.SetMotherPdg(mother->GetPdgCode());
+          hfemcpart.SetMotherProductionVertex(mother->Xv(),mother->Yv(),mother->Zv());
+        }
       }
       
       // derive source
-      source = 5;
+      /*
+      source = 7;
       if(fSignalCuts->IsCharmElectron(mctrack)) source = 0;
-      else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1;
-      else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2;
+           else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1;
+           else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2;
       else if(fSignalCuts->IsNonHFElectron(mctrack)) source = 3;
-      else if(TMath::Abs(mctrack->GetPdgCode()) == 11) source = 4;
-      else source = 5;
+      else if(fSignalCuts->IsJpsiElectron(mctrack)) source = 4;
+      else if(fSignalCuts->IsB2JpsiElectron(mctrack)) source = 5;
+      else if(fSignalCuts->IsKe3Electron(mctrack)) source = 6;
+      else source = 7;
       hfemcpart.SetSource(source);
+      */
+      hfemcpart.SetSource(static_cast<Int_t>(fSignalCuts->GetSignalSource(mctrack)));
+      hfemcpart.SetElectronSource(fSignalCuts->GetMCQAObject()->GetElecSource(mctrack));
 
       fHFEevent->AddMCParticle(&hfemcpart);
     }
@@ -409,6 +442,18 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
     //if((status & AliVTrack::kTOFmismatch) == AliVTrack::kTOFmismatch) hfetrack.SetTOFmismatch();
     if(IsTOFmismatch(track, pid)) hfetrack.SetTOFmismatch(); // New version suggested by Pietro Antonioli
     if(track->IsEMCAL()) hfetrack.SetEMCALpid();
+
+    // fill counts of v0-identified particles
+    AliPID::EParticleType myv0pid = fV0Tagger->GetV0Info(track->GetID());
+    AliHFEreducedTrack::EV0PID_t v0pid = AliHFEreducedTrack::kV0undef;
+    if(myv0pid == AliPID::kElectron) v0pid = AliHFEreducedTrack::kV0electron;
+    else if(myv0pid == AliPID::kPion) v0pid = AliHFEreducedTrack::kV0pion;
+    else if(myv0pid == AliPID::kProton) v0pid = AliHFEreducedTrack::kV0proton;
+    hfetrack.SetV0PID(v0pid);
+
+    Double_t v0prodR = fV0Tagger->GetV0ProdR(track->GetID());
+    hfetrack.SetV0prodR(v0prodR);
+
     // Filter
     for(Int_t k=0; k<20; k++) {
       Int_t u = 1<<k;     
@@ -439,18 +484,27 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
         Int_t motherlabel = TMath::Abs(mctrack->GetMother());
         if(motherlabel >= 0 && motherlabel < fAODArrayMCInfo->GetEntriesFast()){
           AliAODMCParticle *mother = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(motherlabel));
-          if(mother) hfetrack.SetMCMotherPdg(mother->GetPdgCode());
+          if(mother){
+            hfetrack.SetMCMotherPdg(mother->GetPdgCode());
+            hfetrack.SetMCMotherProdVtx(mother->Xv(),mother->Yv(),mother->Zv());
+          }
         }
       
         // derive source
-        source = 5;
-        if(fSignalCuts->IsCharmElectron(mctrack)) source = 0;
-        else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1;
-        else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2;
-        else if(fSignalCuts->IsNonHFElectron(mctrack)) source = 3;
-        else if(TMath::Abs(mctrack->GetPdgCode()) == 11) source = 4;
-        else source = 5;
+        /*
+        source = 7;
+        if(fSignalCuts->IsCharmElectron(track)) source = 0;
+             else if(fSignalCuts->IsBeautyElectron(track)) source = 1;
+             else if(fSignalCuts->IsGammaElectron(track)) source = 2;
+        else if(fSignalCuts->IsNonHFElectron(track)) source = 3;
+        else if(fSignalCuts->IsJpsiElectron(track)) source = 4;
+        else if(fSignalCuts->IsB2JpsiElectron(track)) source = 5;
+        else if(fSignalCuts->IsKe3Electron(track)) source = 6;
+        else source = 7;
         hfetrack.SetMCSource(source); 
+        */
+        hfetrack.SetMCSource(static_cast<Int_t>(fSignalCuts->GetSignalSource(track))); 
+        hfetrack.SetMCElectronSource(fSignalCuts->GetMCQAObject()->GetElecSource(mctrack));
       } else {
         AliDebug(2, "Associated MC particle not found\n");
       }
@@ -488,11 +542,12 @@ void AliHFEreducedEventCreatorAOD::UserExec(Option_t *){
    
     // TRD related quantities (Yvonne)
     hfetrack.SetTRDntrackletsPID(track->GetTRDntrackletsPID());
-    hfetrack.SetTRDnslices(track->GetDetPid()->GetTRDnSlices());
-    hfetrack.SetTRDchi2(track->GetTRDchi2());
     AliAODPid* aodpid= track->GetDetPid();
-    Double_t* arraytrdsignals;
-    arraytrdsignals=aodpid->GetTRDslices();
+    if(aodpid) hfetrack.SetTRDnslices(aodpid->GetTRDnSlices());
+    hfetrack.SetTRDchi2(track->GetTRDchi2());
+
+    Double_t* arraytrdsignals = 0x0;
+    if(aodpid) arraytrdsignals=aodpid->GetTRDslices();
     Int_t nslicetemp=0;
     for(Int_t iplane = 0; iplane < 6; iplane++){
            nslicetemp=0;
index e90833a..235caa3 100644 (file)
@@ -32,6 +32,7 @@ class AliHFEextraCuts;
 class AliHFEpidTPC;
 class AliHFEsignalCuts;
 class AliHFEreducedEvent;
+class AliHFEV0taginfo;
 
 class AliHFEreducedEventCreatorAOD : public AliAnalysisTaskSE{
   public:
@@ -48,6 +49,8 @@ class AliHFEreducedEventCreatorAOD : public AliAnalysisTaskSE{
     void SetMinNclustersTPCPID(Int_t mincl) { fNclustersTPCPID = mincl; };
     void SetMinNclustersITS(Int_t mincl) { fNclustersITS = mincl; };
     void SetNbOfTOFSigma(Float_t nbOfTOFSigma) { fNbOfTOFSigma = nbOfTOFSigma; };
+    void SetFlagPileupEvents() { fFlagPileupEvents = kTRUE; }
+    void SetSelectSignalOnly(Bool_t select = kTRUE) { fSelectSignalOnly = select; } 
     AliHFEpidTPC *GetTPCResponse() { return fTPCpid; }
 
     Bool_t IsTOFmismatch(const AliVTrack *const track, const AliPIDResponse *const pid) const;
@@ -65,12 +68,15 @@ class AliHFEreducedEventCreatorAOD : public AliAnalysisTaskSE{
     AliHFEextraCuts *fExtraCuts;      // HFE IP info
     AliHFEsignalCuts *fSignalCuts;    // Signal Cuts
     AliHFEpidTPC *fTPCpid;            // TPC PID
+    AliHFEV0taginfo *fV0Tagger;       // Tags v0 tracks per Event
     Int_t fEventNumber;               // Event Number
     Int_t fNclustersTPC;              // Min Number of clusters in TPC
     Int_t fNclustersTPCPID;           // Min Number of clusters for TPC PID
     Int_t fNclustersITS;              // Min Number of clusters in ITS
     Float_t fNbOfTOFSigma;            // Nb of TOF Sigma
     Bool_t fRemoveFirstEvent;         // Remove first event from chunk
+    Bool_t fFlagPileupEvents;         // Flag pileup events
+    Bool_t fSelectSignalOnly;         // Select signal-only tracks
   
     ClassDef(AliHFEreducedEventCreatorAOD, 2)
 };
index fe0d388..a3e4d95 100644 (file)
 #include "AliInputEventHandler.h"
 #include "AliHFEcuts.h"
 #include "AliHFEextraCuts.h"
+#include "AliHFEmcQA.h"
 #include "AliHFEpidTPC.h"
 #include "AliHFEreducedEvent.h"
 #include "AliHFEreducedTrack.h"
 #include "AliHFEreducedMCParticle.h"
 #include "AliHFEsignalCuts.h"
+#include "AliHFEV0taginfo.h"
 #include "AliLog.h"
 #include "AliMCEvent.h"
 #include "AliMCParticle.h"
@@ -69,12 +71,15 @@ AliHFEreducedEventCreatorESD::AliHFEreducedEventCreatorESD():
   fExtraCuts(NULL),
   fSignalCuts(NULL),
   fTPCpid(NULL),
+  fV0Tagger(NULL),
   fTRDTriggerAnalysis(NULL),
   fEventNumber(0),
   fNclustersTPC(70),
   fNclustersTPCPID(0),
   fNclustersITS(2),
-  fRemoveFirstEvent(kFALSE)
+  fRemoveFirstEvent(kFALSE),
+  fFlagPileupEvents(kFALSE),
+  fSelectSignalOnly(kFALSE)
 {
   //
   // Default constructor
@@ -90,12 +95,15 @@ AliHFEreducedEventCreatorESD::AliHFEreducedEventCreatorESD(const char *name):
   fExtraCuts(NULL),
   fSignalCuts(NULL),
   fTPCpid(NULL),
+  fV0Tagger(NULL),
   fTRDTriggerAnalysis(NULL),
   fEventNumber(0),
   fNclustersTPC(70),
   fNclustersTPCPID(0),
   fNclustersITS(2),
-  fRemoveFirstEvent(kFALSE)
+  fRemoveFirstEvent(kFALSE),
+  fFlagPileupEvents(kFALSE),
+  fSelectSignalOnly(kFALSE)
 {
   //
   // Default constructor
@@ -103,7 +111,8 @@ AliHFEreducedEventCreatorESD::AliHFEreducedEventCreatorESD(const char *name):
   fTPCpid = new AliHFEpidTPC("QAtpcPID");
   fAnalysisUtils = new AliAnalysisUtils;
   fTRDTriggerAnalysis = new AliTRDTriggerAnalysis();
-  fTRDTriggerAnalysis->SetRequireMatchElectron(kTRUE); 
+  fTRDTriggerAnalysis->SetRequireMatchElectron(kTRUE);
+  fV0Tagger = new AliHFEV0taginfo("Tagger");
   DefineOutput(1, TTree::Class());
 }
 
@@ -113,6 +122,7 @@ AliHFEreducedEventCreatorESD::~AliHFEreducedEventCreatorESD(){
   //
   if(fAnalysisUtils) delete fAnalysisUtils;
   if(fTPCpid) delete fTPCpid;
+  if(fV0Tagger) delete fV0Tagger;
   if(fTRDTriggerAnalysis) delete fTRDTriggerAnalysis;
   if(fHFEevent) delete fHFEevent;
   if(fSignalCuts) delete fSignalCuts;
@@ -221,6 +231,11 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
   }
   fExtraCuts->SetRecEventInfo(fInputEvent);
 
+  // Tag all v0s in current event
+  if(fV0Tagger){
+    fV0Tagger->Reset();
+    fV0Tagger->TagV0Tracks(fInputEvent);
+  }
 
   // Make Reduced Event 
   //AliHFEreducedEvent hfeevent;
@@ -254,6 +269,7 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
   Double_t vcov[6];
   vertex->GetCovarianceMatrix(vcov);
   fHFEevent->SetVertexResolution(TMath::Sqrt(vcov[5]));
+  fHFEevent->SetVertexDispersion(static_cast<const AliESDVertex *>(vertex)->GetDispersion());
   // Get Primary Vertex from SPD
   const AliVVertex *vertexSPD = event->GetPrimaryVertexSPD();
   if(vertexSPD){
@@ -266,6 +282,7 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
     memset(vcov, 0, sizeof(Double_t)*6);
     vertex->GetCovarianceMatrix(vcov);
     fHFEevent->SetVertexResolutionSPD(TMath::Sqrt(vcov[5]));
+    fHFEevent->SetVertexDispersionSPD(static_cast<const AliESDVertex *>(vertex)->GetDispersion());
   }
 
   // Get centrality
@@ -295,19 +312,27 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
   const AliMultiplicity *mult = event->GetMultiplicity();
   if(mult) fHFEevent->SetSPDMultiplicity(mult->GetNumberOfTracklets());
 
+  // Flag Pileup
+  if(fFlagPileupEvents){
+    if(fAnalysisUtils->IsPileUpEvent(fInputEvent)) fHFEevent->SetPileupFlag();
+  }
+
   //
   // Loop on MC tracks only
   //
   AliMCParticle *mctrack(NULL);
   // Monte-Carlo info
-  Int_t source(5);
+  //Int_t source(5);
   if(mcthere){
+    const AliVVertex *mcvtx = fMCEvent->GetPrimaryVertex();
+    fHFEevent->SetVMC(mcvtx->GetX(), mcvtx->GetY(), mcvtx->GetX());
     for(Int_t itrack = 0; itrack < fMCEvent->GetNumberOfTracks(); itrack++) {
       mctrack = (AliMCParticle *)(fMCEvent->GetTrack(itrack));
       if(!mctrack) continue;
+      if(TMath::Abs(mctrack->PdgCode()) != 11) continue;  // in MC truth list store only electrons
+      if(fSelectSignalOnly && !fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mctrack))  continue;        
       AliHFEreducedMCParticle hfemcpart;
-      if(!fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mctrack))  continue;        
-      hfemcpart.SetSignal();
+      if(fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mctrack)) hfemcpart.SetSignal();
       // Kinematics
       hfemcpart.SetSignedPt(mctrack->Pt(), mctrack->Charge() > 0.);
       hfemcpart.SetP(mctrack->P());
@@ -322,19 +347,27 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
       Int_t motherlabel = TMath::Abs(mctrack->GetMother());
       if(motherlabel >= 0 && motherlabel < fMCEvent->GetNumberOfTracks()){
         AliMCParticle *mother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(motherlabel));
-        if(mother) hfemcpart.SetMotherPdg(mother->PdgCode());
+        if(mother){
+          hfemcpart.SetMotherPdg(mother->PdgCode());
+          hfemcpart.SetMotherProductionVertex(mother->Xv(),mother->Yv(),mother->Zv());
+        }
       }
       
       // derive source
-      source = 5;
+      /*
+      source = 7;            
       if(fSignalCuts->IsCharmElectron(mctrack)) source = 0;
-      else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1;
-      else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2;
+           else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1;
+           else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2;
       else if(fSignalCuts->IsNonHFElectron(mctrack)) source = 3;
-      else if(TMath::Abs(mctrack->PdgCode()) == 11) source = 4;
-      else source = 5;
+      else if(fSignalCuts->IsJpsiElectron(mctrack)) source = 4;
+      else if(fSignalCuts->IsB2JpsiElectron(mctrack)) source = 5;
+      else if(fSignalCuts->IsKe3Electron(mctrack)) source = 6;
+           else source = 7;
       hfemcpart.SetSource(source);
-
+      */
+      hfemcpart.SetSource(static_cast<Int_t>(fSignalCuts->GetSignalSource(mctrack)));
+      hfemcpart.SetElectronSource(fSignalCuts->GetMCQAObject()->GetElecSource(mctrack));
       fHFEevent->AddMCParticle(&hfemcpart);
     }
   }
@@ -381,13 +414,17 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
     if(isEMCAL) hfetrack.SetEMCALpid();
     // no filter bits available for ESDs
 
-    // V0 information
+    // fill counts of v0-identified particles
+    AliPID::EParticleType myv0pid = fV0Tagger->GetV0Info(track->GetID());
     AliHFEreducedTrack::EV0PID_t v0pid = AliHFEreducedTrack::kV0undef;
-    if(track->TestBit(BIT(14))) v0pid = AliHFEreducedTrack::kV0electron;
-    else if(track->TestBit(BIT(15))) v0pid = AliHFEreducedTrack::kV0pion;
-    else if(track->TestBit(BIT(16))) v0pid = AliHFEreducedTrack::kV0proton;
+    if(myv0pid == AliPID::kElectron) v0pid = AliHFEreducedTrack::kV0electron;
+    else if(myv0pid == AliPID::kPion) v0pid = AliHFEreducedTrack::kV0pion;
+    else if(myv0pid == AliPID::kProton) v0pid = AliHFEreducedTrack::kV0proton;
     hfetrack.SetV0PID(v0pid);
 
+    Double_t v0prodR = fV0Tagger->GetV0ProdR(track->GetID());
+    hfetrack.SetV0prodR(v0prodR);
+
     if(mcthere){
       // Fill Monte-Carlo Information
       Int_t label = TMath::Abs(track->GetLabel());
@@ -410,18 +447,27 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
         Int_t motherlabel = TMath::Abs(mctrack->GetMother());
         if(motherlabel >= 0 && motherlabel < fMCEvent->GetNumberOfTracks()){
           AliMCParticle *mother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(motherlabel));
-          if(mother) hfetrack.SetMCMotherPdg(mother->PdgCode());
+          if(mother){ 
+            hfetrack.SetMCMotherPdg(mother->PdgCode());
+            hfetrack.SetMCMotherProdVtx(mother->Xv(),mother->Yv(),mother->Zv());
+          }
         }
         
         // derive source
-        source = 5;
-        if(fSignalCuts->IsCharmElectron(mctrack)) source = 0;
-        else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1;
-        else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2;
-        else if(fSignalCuts->IsNonHFElectron(mctrack)) source = 3;
-        else if(TMath::Abs(mctrack->PdgCode()) == 11) source = 4;
-        else source = 5;
+        /*
+        source = 7;
+        if(fSignalCuts->IsCharmElectron(track)) source = 0;
+             else if(fSignalCuts->IsBeautyElectron(track)) source = 1;
+             else if(fSignalCuts->IsGammaElectron(track)) source = 2;
+        else if(fSignalCuts->IsNonHFElectron(track)) source = 3;
+        else if(fSignalCuts->IsJpsiElectron(track)) source = 4;
+        else if(fSignalCuts->IsB2JpsiElectron(track)) source = 5;
+        else if(fSignalCuts->IsKe3Electron(track)) source = 6;
+        else source = 7;
         hfetrack.SetMCSource(source); 
+        */
+        hfetrack.SetMCSource(static_cast<Int_t>(fSignalCuts->GetSignalSource(track))); 
+        hfetrack.SetMCElectronSource(fSignalCuts->GetMCQAObject()->GetElecSource(mctrack));
       } else {
         AliDebug(2, "Associated MC particle not found");
       }
@@ -430,8 +476,11 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
     // HFE DCA
     Float_t dcaxy = -999.,
             dcaz = -999.;
+    Double_t dcaErr, dcaxyD;
     fExtraCuts->GetImpactParameters((AliVTrack *)track,dcaxy,dcaz);
-    hfetrack.SetDCA(dcaxy, dcaz);
+    fExtraCuts->GetHFEImpactParameters((AliVTrack *)track,dcaxyD,dcaErr);
+    hfetrack.SetDCA(dcaxyD, dcaz);
+    hfetrack.SetDCAerr(dcaErr);
     Double_t hfeImpactParam(-999.), hfeImpactParamResol(-999.);
     fExtraCuts->GetHFEImpactParameters((AliVTrack *)track,hfeImpactParam,hfeImpactParamResol);
     hfetrack.SetHFEImpactParam(hfeImpactParam,hfeImpactParamResol);
@@ -496,6 +545,7 @@ void AliHFEreducedEventCreatorESD::UserExec(Option_t *){
     hfetrack.SetTPCdEdx(track->GetTPCsignal());
     hfetrack.SetTPCsigmaEl(pid->NumberOfSigmasTPC(track, AliPID::kElectron));
     hfetrack.SetTOFsigmaEl(pid->NumberOfSigmasTOF(track, AliPID::kElectron));
+    if(TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kDeuteron)) < 40.) hfetrack.SetTOFsigmaDeuteron(pid->NumberOfSigmasTOF(track, AliPID::kDeuteron));   else hfetrack.SetTOFsigmaDeuteron(100);
     hfetrack.SetTOFmismatchProbability(pid->GetTOFMismatchProbability(track));
     hfetrack.SetITSsigmaEl(pid->NumberOfSigmasITS(track, AliPID::kElectron));
     // Eta correction
index e13de53..5f9347a 100644 (file)
@@ -31,6 +31,7 @@ class AliHFEpidTPC;
 class AliTRDTriggerAnalysis;
 class AliHFEsignalCuts;
 class AliHFEreducedEvent;
+class AliHFEV0taginfo;
 
 class AliHFEreducedEventCreatorESD : public AliAnalysisTaskSE{
   public:
@@ -47,6 +48,8 @@ class AliHFEreducedEventCreatorESD : public AliAnalysisTaskSE{
     void SetMinNclustersTPCPID(Int_t mincl) { fNclustersTPCPID = mincl; };
     void SetMinNclustersITS(Int_t mincl) { fNclustersITS = mincl; };
     void SetRemoveFirstEventFromChunk() { fRemoveFirstEvent = kTRUE; }
+    void SetFlagPileupEvents() { fFlagPileupEvents = kTRUE; }
+    void SetSelectSignalOnly(Bool_t select = kTRUE) { fSelectSignalOnly = select; } 
     AliHFEpidTPC *GetTPCResponse() { return fTPCpid; }
 
     Bool_t IsTOFmismatch(const AliVTrack *const track, const AliPIDResponse *const pid) const;
@@ -62,15 +65,18 @@ class AliHFEreducedEventCreatorESD : public AliAnalysisTaskSE{
     AliHFEextraCuts *fExtraCuts;      // HFE IP info
     AliHFEsignalCuts *fSignalCuts;    // Signal Cuts
     AliHFEpidTPC *fTPCpid;            // TPC PID
+    AliHFEV0taginfo *fV0Tagger;       // Tags v0 tracks per Event
     AliTRDTriggerAnalysis *fTRDTriggerAnalysis; //! TRD Trigger Analysis
     Int_t fEventNumber;               // Event Number
     Int_t fNclustersTPC;              // Min Number of clusters in TPC
     Int_t fNclustersTPCPID;           // Min Number of clusters for TPC PID
     Int_t fNclustersITS;              // Min Number of clusters in ITS
     Bool_t fRemoveFirstEvent;         // Remove first event from chunk
+    Bool_t fFlagPileupEvents;         // Flag pileup events
+    Bool_t fSelectSignalOnly;         // Select signal-only tracks
     
     ClassDef(AliHFEreducedEventCreatorESD, 1)
-      };
+};
 #endif
 
 
index 85ec63f..eb99484 100644 (file)
@@ -36,12 +36,14 @@ TObject(),
   fPdg(0),
   fMotherPdg(0),
   fSource(5),
-  fSignal(kFALSE)
+  fSignal(kFALSE),
+  fEleSource(0)
 {
   //
   // Default constructor
   //
-        memset(fProductionVertex, 0, sizeof(Double_t) *3);      // Initialise production vertex array
+  memset(fProductionVertex, 0, sizeof(Double_t) *3);      // Initialise production vertex array
+  memset(fMotherProductionVertex, 0, sizeof(Double_t) *3);      // Initialise mother production vertex array
 }
 
 //_______________________________________
@@ -54,12 +56,14 @@ AliHFEreducedMCParticle::AliHFEreducedMCParticle(const AliHFEreducedMCParticle &
   fPdg(ref.fPdg),
   fMotherPdg(ref.fMotherPdg),
   fSource(ref.fSource),
-  fSignal(ref.fSignal)
+  fSignal(ref.fSignal),
+  fEleSource(ref.fEleSource)
 {
   //
   // Copy constructor
   //
   memcpy(fProductionVertex, ref.fProductionVertex, sizeof(Double_t) *3);      // Port production vertex array
+  memcpy(fMotherProductionVertex, ref.fMotherProductionVertex, sizeof(Double_t) *3);      // Port mother production vertex array
 }
 
 //_______________________________________
@@ -77,7 +81,9 @@ AliHFEreducedMCParticle &AliHFEreducedMCParticle::operator=(const AliHFEreducedM
     fMotherPdg = ref.fMotherPdg;
     fSource = ref.fSource;
     fSignal = ref.fSignal;
+    fEleSource = ref.fEleSource;
     memcpy(fProductionVertex, ref.fProductionVertex, sizeof(Double_t) *3); 
+    memcpy(fMotherProductionVertex, ref.fMotherProductionVertex, sizeof(Double_t) *3); 
   }
   return *this;
 }
index 3cbe323..8da7af1 100644 (file)
@@ -40,11 +40,15 @@ class AliHFEreducedMCParticle : public TObject{
   Int_t Pdg() const { return fPdg; }
   Int_t MotherPdg() const { return fMotherPdg; }
   Int_t Source() const { return static_cast<Int_t>(fSource); }
+  Int_t GetElectronSource() const { return static_cast<Int_t>(fEleSource); }
   Bool_t IsSignal() const { return fSignal; }
   Double_t RadialProductionVertex() const { return TMath::Abs(fProductionVertex[0]*fProductionVertex[0]+fProductionVertex[1]*fProductionVertex[1]); }
   Double_t VX() const { return fProductionVertex[0]; }
   Double_t VY() const { return fProductionVertex[1]; }
   Double_t VZ() const { return fProductionVertex[2]; }
+  Double_t GetMotherVX() const { return fMotherProductionVertex[0]; }
+  Double_t GetMotherVY() const { return fMotherProductionVertex[1]; }
+  Double_t GetMotherVZ() const { return fMotherProductionVertex[2]; }
   
   void SetSignedPt(Double_t pt, Bool_t positiveCharge){
     double chargesign = positiveCharge ? 1. : -1.;
@@ -56,12 +60,18 @@ class AliHFEreducedMCParticle : public TObject{
   void SetPdg(Int_t pdg) { fPdg = pdg; }
   void SetMotherPdg(Int_t pdg) { fMotherPdg = pdg; }
   void SetSource(Int_t source) { fSource = static_cast<Char_t>(source); }
+  void SetElectronSource(Int_t source) { fEleSource = static_cast<UChar_t>(source); }
   void SetSignal() { fSignal = kTRUE; }
   void SetProductionVertex(Double_t vx, Double_t vy, Double_t vz) {
     fProductionVertex[0] = vx;
     fProductionVertex[1] = vy;
     fProductionVertex[2] = vz;
   }
+  void SetMotherProductionVertex(Double_t vx, Double_t vy, Double_t vz) {
+    fMotherProductionVertex[0] = vx;
+    fMotherProductionVertex[1] = vy;
+    fMotherProductionVertex[2] = vz;
+  }
   
  private:
   Double_t  fSignedPt;              // signed pt
@@ -73,8 +83,10 @@ class AliHFEreducedMCParticle : public TObject{
   Char_t    fSource;                // source
   Bool_t    fSignal;                // signal
   Double_t  fProductionVertex[3];   // production vertex
+  Double_t  fMotherProductionVertex[3];   // production vertex
+  UChar_t   fEleSource;             // Electron source (AliHFEmcQA)
   
-  ClassDef(AliHFEreducedMCParticle, 1)
+  ClassDef(AliHFEreducedMCParticle, 2)
   
 };
 #endif
index ee8acbc..a4cff26 100644 (file)
@@ -45,6 +45,7 @@ TObject(),
   fMCMotherPdg(0),
   fMCSignal(kFALSE),
   fMCSource(5),
+  fMCEleSource(0),
   fTrackStatus(8),
   fNclustersITS(0),
   fNclustersTPC(0),
@@ -67,16 +68,20 @@ TObject(),
   fTPCsigmaEl(-1000.),
   fTPCsigmaElCorrected(-1000.),
   fTOFsigmaEl(-1000.),
+  fTOFsigmaDeuteron(-1000.),
   fTOFmismatchProb(0.),
   fITSsigmaEl(-1000.),
   fEoverP(-1.),
   fEMCALsigmaEl(-1000.),
-  fV0PID(kV0undef)
+  fV0PID(kV0undef),
+  fV0ProdR(-0.1),
+  fDCAerr(0.)
 {
   // 
   // Default Constuctor
   //
   memset(fMCProdVtx, 0, sizeof(Double_t)*3);
+  memset(fMCMotherProdVtx, 0, sizeof(Double_t)*3);
   memset(fShowerShape, 0, sizeof(Double_t)*4);
   memset(fDCA, 0, sizeof(Float_t)*2);
   fHFEImpactParam[0] = -999.;
@@ -101,6 +106,7 @@ AliHFEreducedTrack::AliHFEreducedTrack(const AliHFEreducedTrack &ref):
   fMCMotherPdg(ref.fMCMotherPdg),
   fMCSignal(ref.fMCSignal),
   fMCSource(ref.fMCSource),
+  fMCEleSource(ref.fMCEleSource),
   fTrackStatus(ref.fTrackStatus),
   fNclustersITS(ref.fNclustersITS),
   fNclustersTPC(ref.fNclustersTPC),
@@ -123,16 +129,20 @@ AliHFEreducedTrack::AliHFEreducedTrack(const AliHFEreducedTrack &ref):
   fTPCsigmaEl(ref.fTPCsigmaEl),
   fTPCsigmaElCorrected(ref.fTPCsigmaElCorrected),
   fTOFsigmaEl(ref.fTOFsigmaEl),
+  fTOFsigmaDeuteron(ref.fTOFsigmaDeuteron),
   fTOFmismatchProb(ref.fTOFmismatchProb),
   fITSsigmaEl(ref.fITSsigmaEl),
   fEoverP(ref.fEoverP),
   fEMCALsigmaEl(ref.fEMCALsigmaEl),
-  fV0PID(ref.fV0PID)
+  fV0PID(ref.fV0PID),
+  fV0ProdR(ref.fV0ProdR),
+  fDCAerr(ref.fDCAerr)
 {
   // 
   // Copy Constuctor
   //
   memcpy(fMCProdVtx, ref.fMCProdVtx, sizeof(Double_t) *3);
+  memcpy(fMCMotherProdVtx, ref.fMCMotherProdVtx, sizeof(Double_t) *3);
   memcpy(fShowerShape, ref.fShowerShape, sizeof(Double_t)*4);
   memcpy(fDCA, ref.fDCA, sizeof(Float_t)*2);
   memcpy(fHFEImpactParam, ref.fHFEImpactParam, sizeof(Double_t) * 2);
@@ -160,7 +170,9 @@ AliHFEreducedTrack &AliHFEreducedTrack::operator=(const AliHFEreducedTrack &ref)
     fMCMotherPdg = ref.fMCMotherPdg;
     fMCSignal = ref.fMCSignal;
     fMCSource = ref.fMCSource;
+    fMCEleSource = ref.fMCEleSource;
     memcpy(fMCProdVtx, ref.fMCProdVtx, sizeof(Double_t) *3);
+    memcpy(fMCMotherProdVtx, ref.fMCMotherProdVtx, sizeof(Double_t) *3);
     fTrackStatus =ref.fTrackStatus;
     fNclustersITS = ref.fNclustersITS;
     fNclustersTPC = ref.fNclustersTPC;
@@ -188,6 +200,7 @@ AliHFEreducedTrack &AliHFEreducedTrack::operator=(const AliHFEreducedTrack &ref)
     fEoverP = ref.fEoverP;
     fEMCALsigmaEl = ref.fEMCALsigmaEl;
     fV0PID = ref.fV0PID;
+    fV0ProdR = ref.fV0ProdR;
     memcpy(fShowerShape, ref.fShowerShape, sizeof(Double_t)*4);
     memcpy(fDCA, ref.fDCA, sizeof(Float_t)*2);
     memcpy(fHFEImpactParam, ref.fHFEImpactParam, sizeof(Double_t) * 2);
index 273f714..2a6e5a1 100644 (file)
@@ -59,9 +59,13 @@ class AliHFEreducedTrack : public TObject{
   Int_t MCMotherPdg() const { return fMCMotherPdg; }
   Bool_t MCSignal() const { return fMCSignal; }
   Int_t MCSource() const { return fMCSource; }
+  Int_t MCElectronSource() const { return static_cast<Int_t>(fMCEleSource); }
   Double_t MCProdVtxX() const { return fMCProdVtx[0]; }
   Double_t MCProdVtxY() const { return fMCProdVtx[1]; }
   Double_t MCProdVtxZ() const { return fMCProdVtx[2]; }
+  Double_t MCMotherProdVtxX() const { return fMCMotherProdVtx[0]; }
+  Double_t MCMotherProdVtxY() const { return fMCMotherProdVtx[1]; }
+  Double_t MCMotherProdVtxZ() const { return fMCMotherProdVtx[2]; }
   Double_t MCProdRadius() const { return TMath::Sqrt(fMCProdVtx[0]*fMCProdVtx[0]+fMCProdVtx[1]*fMCProdVtx[1]); }
   
   Double_t DCAr() const { return fDCA[0]; }
@@ -111,6 +115,7 @@ class AliHFEreducedTrack : public TObject{
   Double_t GetTPCsigmaEl() const { return fTPCsigmaEl; }
   Double_t GetTPCsigmaElCorrected() const { return fTPCsigmaElCorrected; }
   Double_t GetTOFsigmaEl() const { return fTOFsigmaEl; }
+  Double_t GetTOFsigmaDeuteron() const { return fTOFsigmaDeuteron; }
   Float_t GetTOFmismatchProb() const { return fTOFmismatchProb; }
   Double_t GetITSsigmaEl() const { return fITSsigmaEl; }
   Double_t GetEMCALEoverP() const { return fEoverP; }
@@ -123,6 +128,8 @@ class AliHFEreducedTrack : public TObject{
   Bool_t IsV0pion() const { return fV0PID == kV0pion; }
   Bool_t IsV0proton() const { return fV0PID == kV0proton; }
   
+  Float_t GetV0prodR() const { return fV0ProdR; }
+  Double_t GetDCAerr() const { return fDCAerr; }
   
   // -------------- Setters ------------------------
   void SetSignedPt(Double_t abspt, Bool_t positivecharge) { 
@@ -157,11 +164,17 @@ class AliHFEreducedTrack : public TObject{
   void SetMCMotherPdg(Int_t pdg) { fMCMotherPdg = pdg; }
   void SetMCSignal() { fMCSignal = kTRUE; }
   void SetMCSource(Int_t mcsource) { fMCSource = mcsource; }
+  void SetMCElectronSource(Int_t source) { fMCEleSource = static_cast<UChar_t>(source); }
   void SetMCProdVtx(Double_t vx, Double_t vy, Double_t vz){
     fMCProdVtx[0] = vx;
     fMCProdVtx[1] = vy;
     fMCProdVtx[2] = vz;
   }
+  void SetMCMotherProdVtx(Double_t vx, Double_t vy, Double_t vz){
+    fMCMotherProdVtx[0] = vx;
+    fMCMotherProdVtx[1] = vy;
+    fMCMotherProdVtx[2] = vz;
+  }
   
   void SetDCA(Float_t dcaR, Float_t dcaZ){
     fDCA[0] = dcaR;
@@ -203,6 +216,7 @@ class AliHFEreducedTrack : public TObject{
   void SetTPCsigmaEl(Double_t sigma) { fTPCsigmaEl = sigma; }
   void SetTPCsigmaElCorrected(Double_t sigma) { fTPCsigmaElCorrected = sigma; }
   void SetTOFsigmaEl(Double_t sigma) { fTOFsigmaEl = sigma; }
+  void SetTOFsigmaDeuteron(Double_t sigma) { fTOFsigmaDeuteron = sigma; }
   void SetTOFmismatchProbability(Float_t mismatchProb) { fTOFmismatchProb = mismatchProb; }
   void SetITSsigmaEl(Double_t sigma) { fITSsigmaEl = sigma; }
   void SetEMCALEoverP(Double_t eop) { fEoverP = eop; }
@@ -211,6 +225,8 @@ class AliHFEreducedTrack : public TObject{
     for(Int_t is = 0; is < 4; is++) fShowerShape[is] = showershape[is]; 
   }
   void SetV0PID(AliHFEreducedTrack::EV0PID_t v0pid) { fV0PID = v0pid; }
+  void SetV0prodR(Double_t v0prodR) { fV0ProdR = v0prodR; }
+  void SetDCAerr(Double_t InDCAerr) { fDCAerr = InDCAerr;}
   
  private:
   typedef enum{
@@ -238,7 +254,9 @@ class AliHFEreducedTrack : public TObject{
   Int_t    fMCMotherPdg;                  // MCMP
   Bool_t   fMCSignal;                     // MCSignal
   Int_t    fMCSource;                     // MCSource
+  UChar_t  fMCEleSource;                  // MC Electron Source (AliHFEmcQA)
   Double_t fMCProdVtx[3];                 // MC prod Vtx
+  Double_t fMCMotherProdVtx[3];           // MC prod Vtx of the mother
   TBits    fTrackStatus;                  // Track Status
   UChar_t  fNclustersITS;                 // ITS nb cls
   UChar_t  fNclustersTPC;                 // TPC nb cls
@@ -261,6 +279,7 @@ class AliHFEreducedTrack : public TObject{
   Double_t fTPCsigmaEl;                   // TPC sigma el
   Double_t fTPCsigmaElCorrected;          // TPC sigma el corrected
   Double_t fTOFsigmaEl;                   // TOF sigma el
+  Double_t fTOFsigmaDeuteron;             // TOF sigma deuteron
   Float_t  fTOFmismatchProb;              // TOF mismatch prob
   Double_t fITSsigmaEl;                   // ITS sigma el
   Double_t fEoverP;                       // Eoverp
@@ -269,7 +288,9 @@ class AliHFEreducedTrack : public TObject{
   Float_t fDCA[2];                        // dca
   Double_t fHFEImpactParam[2];            // HFE impact paramter (value, resolution) for beauty analysis
   EV0PID_t fV0PID;                        // V0pid
+  Double_t  fV0ProdR;                      // V0 doughter production vertex R in x-y plane 
+  Double_t fDCAerr;                       // New: Error on Track DCA
   
-  ClassDef(AliHFEreducedTrack, 1)
+  ClassDef(AliHFEreducedTrack, 3)
 };
 #endif
index c60bcbb..d631e78 100644 (file)
@@ -138,7 +138,30 @@ Bool_t AliHFEsignalCuts::IsSelected(TObject *o){
 }
 
 //____________________________________________________________
-Bool_t AliHFEsignalCuts::IsCharmElectron(const TObject * const o) const {
+AliHFEsignalCuts::ESignalSource_t AliHFEsignalCuts::GetSignalSource(const TObject *const o) const{
+  //
+  // Get source type of the electron
+  //
+  ESignalSource_t source = kOther;
+  const AliVParticle *v = dynamic_cast<const AliVParticle *>(o);
+  if(!v) return source;
+  Int_t esources = GetElecSource(v);
+  if(esources == AliHFEmcQA::kDirectCharm) source = kEleCharm;
+  else if(esources == AliHFEmcQA::kDirectBeauty || esources == AliHFEmcQA::kBeautyCharm) source = kEleBeauty;
+  else if(esources >= AliHFEmcQA::kGammaPi0 && esources <= AliHFEmcQA::kGammaRho0) source = kEleGamma;
+  else if(esources == AliHFEmcQA:: kPi0 || esources == AliHFEmcQA::kEta || esources == AliHFEmcQA::kOmega || esources == AliHFEmcQA::kPhi || esources == AliHFEmcQA::kEtaPrime || esources == AliHFEmcQA::kRho0) source = kEleNonHFE;
+  else if(esources == AliHFEmcQA::kJpsi) source = kEleJPsi;
+  else if(esources == AliHFEmcQA::kB2Jpsi) source = kEleBtoJPsi;
+  else if(esources == AliHFEmcQA::kKe3) source = kEleKe3;
+  return source;
+}
+
+/*****************************************
+ *        Old legacy code                *
+ *****************************************/
+
+//____________________________________________________________
+Bool_t AliHFEsignalCuts::IsCharmElectronOld(const TObject * const o) const {
   //
   // Check if mother is coming from Charm
   //
@@ -152,7 +175,7 @@ Bool_t AliHFEsignalCuts::IsCharmElectron(const TObject * const o) const {
 }
 
 //____________________________________________________________
-Bool_t AliHFEsignalCuts::IsBeautyElectron(const TObject * const o) const {
+Bool_t AliHFEsignalCuts::IsBeautyElectronOld(const TObject * const o) const {
   //
   // Check if mother is coming from Beauty
   //
@@ -166,7 +189,7 @@ Bool_t AliHFEsignalCuts::IsBeautyElectron(const TObject * const o) const {
 }
 
 //____________________________________________________________
-Bool_t AliHFEsignalCuts::IsGammaElectron(const TObject * const o) const {
+Bool_t AliHFEsignalCuts::IsGammaElectronOld(const TObject * const o) const {
   //
   // Check for MC if the electron is coming from Gamma  
   //
@@ -181,7 +204,7 @@ Bool_t AliHFEsignalCuts::IsGammaElectron(const TObject * const o) const {
 }
 
 //____________________________________________________________
-Bool_t AliHFEsignalCuts::IsNonHFElectron(const TObject * const o) const {
+Bool_t AliHFEsignalCuts::IsNonHFElectronOld(const TObject * const o) const {
   //
   // Check for MC if the electron is coming from NonHFE except for conversion
   //
@@ -195,7 +218,7 @@ Bool_t AliHFEsignalCuts::IsNonHFElectron(const TObject * const o) const {
 }
 
 //____________________________________________________________
-Bool_t AliHFEsignalCuts::IsJpsiElectron(const TObject * const o) const {
+Bool_t AliHFEsignalCuts::IsJpsiElectronOld(const TObject * const o) const {
   //
   // Check if mother is coming from Charm
   //
@@ -209,7 +232,7 @@ Bool_t AliHFEsignalCuts::IsJpsiElectron(const TObject * const o) const {
 }
 
 //____________________________________________________________
-Bool_t AliHFEsignalCuts::IsB2JpsiElectron(const TObject * const o) const {
+Bool_t AliHFEsignalCuts::IsB2JpsiElectronOld(const TObject * const o) const {
   //
   // Check if mother is coming from Charm
   //
@@ -223,7 +246,7 @@ Bool_t AliHFEsignalCuts::IsB2JpsiElectron(const TObject * const o) const {
 }
 
 //____________________________________________________________
-Bool_t AliHFEsignalCuts::IsKe3Electron(const TObject * const o) const {
+Bool_t AliHFEsignalCuts::IsKe3ElectronOld(const TObject * const o) const {
   //
   // Check if mother is coming from Charm
   //
@@ -295,26 +318,26 @@ Int_t AliHFEsignalCuts::GetMotherPDG(const AliVParticle * const track) const {
   //if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){
   //  AliDebug(1, "No MC Event Available\n");
   //  return 0;
-  // }
-
-
+  //}
   const AliVParticle *motherParticle = NULL, *mctrack = NULL;
   Int_t label = TMath::Abs(track->GetLabel());
   if(type == AliESDtrack::Class()){
-    // Reconstructed track
+    //
     if(!fMC) {
       AliDebug(1, "No MC Event Available\n");
       return 0;
     }
+    // Reconstructed track
     if(label) mctrack = fMC->GetTrack(TMath::Abs(label));
     
   } 
   else if(type == AliAODTrack::Class()) {
-    // MCParticle
+    //
     if(!fAODArrayMCInfo) {
       AliDebug(1, "No MC Event Available\n");
       return 0;
     }
+    // MCParticle
     if(label && label < fAODArrayMCInfo->GetEntriesFast())
       mctrack = (AliVParticle *) fAODArrayMCInfo->At(label);
   }
@@ -332,23 +355,24 @@ Int_t AliHFEsignalCuts::GetMotherPDG(const AliVParticle * const track) const {
       if(!fMC) {
        AliDebug(1, "No MC Event Available\n");
        return 0;
-      }
+      }    
       motherParticle = fMC->GetTrack(esdmctrack->Particle()->GetFirstMother());
     }
     if(motherParticle){
       const AliMCParticle *esdmcmother = dynamic_cast<const AliMCParticle *>(motherParticle);
       if(esdmcmother) motherPDG = TMath::Abs(esdmcmother->Particle()->GetPdgCode());
     }
+    
   } else {
     // case AODMCParticle
     const AliAODMCParticle *aodmctrack = dynamic_cast<const AliAODMCParticle *>(mctrack);
     if(aodmctrack) {
       if(!fAODArrayMCInfo) {
-       AliDebug(1, "No MC Event Available\n");
-       return 0;
+       AliDebug(1, "No MC Event Available\n");
+       return 0;
       }  
       if(aodmctrack->GetMother() && aodmctrack->GetMother() < fAODArrayMCInfo->GetEntriesFast())
-       motherParticle =  (AliVParticle *) fAODArrayMCInfo->At(aodmctrack->GetMother());
+      motherParticle =  (AliVParticle *) fAODArrayMCInfo->At(aodmctrack->GetMother());
     }
     if(motherParticle){
       const AliAODMCParticle *aodmcmother = dynamic_cast<const AliAODMCParticle *>(motherParticle);
@@ -363,28 +387,40 @@ Int_t AliHFEsignalCuts::GetTrackPDG(const AliVParticle * const track) const {
   //
   // Return PDG code of a particle itself
   //
+
   TClass *type = track->IsA();  
-  if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){
-    AliDebug(1, "No MC Event Available\n");
-    return 0;
-  }
+  //if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){
+  //  AliDebug(1, "No MC Event Available\n");
+  //  return 0;
+  //}
   const AliVParticle *mctrack = NULL;
   Int_t label = TMath::Abs(track->GetLabel());
   if(type == AliESDtrack::Class()){
+    //
+    if(!fMC) {
+      AliDebug(1, "No MC Event Available\n");
+      return 0;
+    }
     // Reconstructed track
     if(label) mctrack = fMC->GetTrack(TMath::Abs(label));
     
   } 
   else if(type == AliAODTrack::Class()) {
+    //
+    if(!fAODArrayMCInfo) {
+      AliDebug(1, "No MC Event Available\n");
+      return 0;
+    }
     // MCParticle
     if(label && label < fAODArrayMCInfo->GetEntriesFast())
       mctrack =  (AliVParticle *) fAODArrayMCInfo->At(label);
   }
   else {
     mctrack=track;
-  }
-
-  if(!mctrack) return 0;
+  }  
+  
+ if(!mctrack) return 0;
   
   TString mctype = mctrack->IsA()->GetName();
   Int_t trackPdg = 0;
@@ -403,13 +439,13 @@ Int_t AliHFEsignalCuts::GetElecSource(const AliVParticle * const track) const {
   //
   // Return PDG code of a particle itself
   //
-  
   if(!track){
     AliDebug(1, "Track not Available\n");
     return 0;
-  }
+  }  
+
   TClass *type = track->IsA();  
-  // if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){
+  //if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){
   //  AliDebug(1, "No MC Event Available\n");
   //  return 0;
   //}
@@ -422,22 +458,24 @@ Int_t AliHFEsignalCuts::GetElecSource(const AliVParticle * const track) const {
   const AliVParticle *mctrack = NULL;
   TParticle *mcpart = NULL;
   Int_t label = TMath::Abs(track->GetLabel());
-  //AliMCParticle *esdmcmother = NULL;
+  AliMCParticle *esdmcmother = NULL;
   if(type == AliESDtrack::Class()){
-    // Reconstructed track
+    //
     if(!fMC) {
       AliDebug(1, "No MC Event Available\n");
       return 0;
     }
+    // Reconstructed track
     if(label) mctrack = fMC->GetTrack(TMath::Abs(label));
     
   } 
   else if(type == AliAODTrack::Class()) {
-    // MCParticle
+    //
     if(!fAODArrayMCInfo) {
       AliDebug(1, "No MC Event Available\n");
       return 0;
     }
+    // MCParticle
     if(label && label < fAODArrayMCInfo->GetEntriesFast())
       mctrack = (AliVParticle *) fAODArrayMCInfo->At(label);
   }
@@ -452,23 +490,24 @@ Int_t AliHFEsignalCuts::GetElecSource(const AliVParticle * const track) const {
     if(esdmc){
       mcpart = esdmc->Particle();
       eSource=fMCQA->GetElecSource(mcpart);
-/* // considering secondary pions
-      if(eSource>=AliHFEmcQA::kGammaPi0) {  // conversion electron, be careful with the enum odering 
+      // considering secondary pions
+      if(type == AliESDtrack::Class()){
+       if(eSource>=AliHFEmcQA::kGammaPi0 && eSource<=AliHFEmcQA::kGammaRho0) {  // conversion electron, be careful with the enum odering
         Int_t glabel=TMath::Abs(esdmc->GetMother()); // gamma label
         if((esdmcmother= dynamic_cast<AliMCParticle *>(fMC->GetTrack(glabel)))){
           glabel=TMath::Abs(esdmcmother->GetMother()); // gamma's mother's label
           if((esdmcmother= dynamic_cast<AliMCParticle *>(fMC->GetTrack(glabel)))){
-            if(glabel>fMC->GetNumberOfPrimaries()) eSource=AliHFEmcQA::kElse;
+            if(glabel>fMC->GetNumberOfPrimaries()) eSource=AliHFEmcQA::kScdryM;
           }
         }
-      }
-      else if(eSource==AliHFEmcQA::kPi0 || (eSource>=AliHFEmcQA::kEta && eSource<=AliHFEmcQA::kRho0) ){ // nonHFE except for the conversion electron
+       }
+       else if(eSource==AliHFEmcQA::kPi0 || (eSource>=AliHFEmcQA::kEta && eSource<=AliHFEmcQA::kRho0) ){ // nonHFE except for the conversion electron
         Int_t glabel=TMath::Abs(esdmc->GetMother());
         if((esdmcmother= dynamic_cast<AliMCParticle *>(fMC->GetTrack(glabel)))){
-          if(glabel>fMC->GetNumberOfPrimaries()) eSource=AliHFEmcQA::kElse;
+          if(glabel>fMC->GetNumberOfPrimaries()) eSource=AliHFEmcQA::kScdryM;
         }
+       }
       }
-*/
     }
   } else {
     eSource=fMCQA->GetElecSource(mctrack);
index ba04e5e..45b962c 100644 (file)
@@ -32,6 +32,16 @@ class TClonesArray;
 
 class AliHFEsignalCuts : public AliAnalysisCuts{
   public: 
+    enum ESignalSource_t{
+       kEleCharm = 0,
+       kEleBeauty = 1,
+       kEleGamma = 2,
+       kEleNonHFE = 3,
+       kEleJPsi = 4,
+       kEleBtoJPsi = 5,
+       kEleKe3 =6,
+       kOther = 7
+    };
     AliHFEsignalCuts();
     AliHFEsignalCuts(const Char_t *name, const Char_t *title);
     AliHFEsignalCuts(const AliHFEsignalCuts &ref);
@@ -41,17 +51,31 @@ class AliHFEsignalCuts : public AliAnalysisCuts{
     virtual Bool_t IsSelected(TObject *o);
     virtual Bool_t IsSelected(TList * /*l*/) { return kTRUE; };
 
-    Bool_t IsCharmElectron(const TObject * const o) const;
-    Bool_t IsBeautyElectron(const TObject * const o) const;
-    Bool_t IsGammaElectron(const TObject * const o) const;
-    Bool_t IsNonHFElectron(const TObject * const o) const;
-    Bool_t IsJpsiElectron(const TObject * const o) const;
-    Bool_t IsB2JpsiElectron(const TObject * const o) const;
-    Bool_t IsKe3Electron(const TObject * const o) const;
+    ESignalSource_t GetSignalSource(const TObject *const o) const;
+
+    Bool_t IsCharmElectron(const TObject * const o) const { return GetSignalSource(o) == kEleCharm; }
+    Bool_t IsBeautyElectron(const TObject * const o) const { return GetSignalSource(o) == kEleBeauty; }
+    Bool_t IsGammaElectron(const TObject * const o) const { return GetSignalSource(o) == kEleGamma; }
+    Bool_t IsNonHFElectron(const TObject * const o) const { return GetSignalSource(o) == kEleNonHFE; }
+    Bool_t IsJpsiElectron(const TObject * const o) const { return GetSignalSource(o) == kEleJPsi; }
+    Bool_t IsB2JpsiElectron(const TObject * const o) const { return GetSignalSource(o) == kEleBtoJPsi; }
+    Bool_t IsKe3Electron(const TObject * const o) const { return GetSignalSource(o) == kEleKe3; }
+
+    /*********************************************
+     *           Old legacy code                 *
+     *********************************************/
+    Bool_t IsCharmElectronOld(const TObject * const o) const;
+    Bool_t IsBeautyElectronOld(const TObject * const o) const;
+    Bool_t IsGammaElectronOld(const TObject * const o) const;
+    Bool_t IsNonHFElectronOld(const TObject * const o) const;
+    Bool_t IsJpsiElectronOld(const TObject * const o) const;
+    Bool_t IsB2JpsiElectronOld(const TObject * const o) const;
+    Bool_t IsKe3ElectronOld(const TObject * const o) const;
 
     //void SetMCEvent(AliMCEvent *mc) { fMC = mc; }
     void SetMCEvent(AliMCEvent *mc);
     void SetMCAODInfo(TClonesArray *mcarray);
+    const AliHFEmcQA *GetMCQAObject() const { return fMCQA; }
   
   protected:
     Int_t GetMotherPDG(const AliVParticle * const track) const;
index 13b069c..b896941 100644 (file)
@@ -1685,7 +1685,10 @@ AliCFDataGrid* AliHFEspectrum::GetNonHFEBackground(){
   if(fNonHFEsyst){
     backgroundContainer = (AliCFContainer*)fNonHFESourceContainer[0][0][0]->Clone();
     for(Int_t iSource = 1; iSource < kElecBgSources; iSource++){
-      backgroundContainer->Add(fNonHFESourceContainer[iSource][0][0]);
+      if(iSource == 1)
+        backgroundContainer->Add(fNonHFESourceContainer[iSource][0][0],1.41);//correction for the eta Dalitz decay branching ratio in PYTHIA
+      else
+        backgroundContainer->Add(fNonHFESourceContainer[iSource][0][0]);
     } 
   }
   else{    
@@ -2514,13 +2517,16 @@ AliCFContainer *AliHFEspectrum::GetSlicedContainer(AliCFContainer *container, In
     // source
     if(ivar == 4){
       if((source>= 0) && (source<container->GetNBins(ivar))) {
-             varMin[ivar] = binLimits[source];
-             varMax[ivar] = binLimits[source];
+              varMin[ivar] = container->GetAxis(4,0)->GetBinLowEdge(container->GetAxis(4,0)->FindBin(binLimits[source]));
+              varMax[ivar] = container->GetAxis(4,0)->GetBinUpEdge(container->GetAxis(4,0)->FindBin(binLimits[source]));
       }     
     }
     // charge
     if(ivar == 3) {
-      if(charge != kAllCharge) varMin[ivar] = varMax[ivar] = charge;
+      if(charge != kAllCharge){
+        varMin[ivar] = container->GetAxis(3,0)->GetBinLowEdge(container->GetAxis(3,0)->FindBin(charge));
+        varMax[ivar] = container->GetAxis(3,0)->GetBinUpEdge(container->GetAxis(3,0)->FindBin(charge));
+      }
     }
     // eta
     if(ivar == 1){
index fb9fe35..5ac7cb2 100644 (file)
@@ -58,7 +58,7 @@ AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis():
   , fVariablesTRD(kFALSE)
   , fIsPbPb(kFALSE)
   , fIspPb(kFALSE)
-  , fIsAOD(kFALSE) 
+  , fIsAOD(kFALSE)
 {
   //
   // Dummy constructor
@@ -219,8 +219,8 @@ void AliHFEtaggedTrackAnalysis::ProcessTrack(AliVTrack *track, Int_t abinitioPID
       
       const AliExternalTrackParam *trueparam = NULL;
       if(esdtrackc->GetOuterParam()) {
-             trueparam = esdtrackc->GetOuterParam();
-             fVarManager->NewTrack((AliVParticle *)trueparam, NULL, fCentralityF, abinitioPID, kTRUE);
+       trueparam = esdtrackc->GetOuterParam();
+       fVarManager->NewTrack((AliVParticle *)trueparam, NULL, fCentralityF, abinitioPID, kTRUE);
       }
       else return;
     }
@@ -287,9 +287,10 @@ void AliHFEtaggedTrackAnalysis::ProcessTrack(AliVTrack *track, Int_t abinitioPID
      hfetrack.SetAbInitioPID(abinitioPID);
      hfetrack.SetCentrality(fCentralityF);
      if(fIsPbPb) hfetrack.SetPbPb();
-     else{
-      if(fIspPb) hfetrack.SetpPb();
-           else hfetrack.SetPP();
+     else
+     {
+        if(fIspPb) hfetrack.SetpPb();
+        else hfetrack.SetPP();
      }
      fPID->SetVarManager(fVarManager);
      fPID->IsSelected(&hfetrack, fContainer, "taggedTrackContainer", fPIDqa);
index a6c2730..64d6211 100644 (file)
@@ -85,7 +85,7 @@ class AliHFEtaggedTrackAnalysis : public TNamed{
     Bool_t               fIsPbPb;        // Analysis Type: PbPb or no PbPb
     Bool_t               fIspPb;        // Analysis Type: pPb or no pPb
     Bool_t               fIsAOD;        // Analysis Type: AOD
-
+    
   ClassDef(AliHFEtaggedTrackAnalysis, 0)
 };
 #endif
index 6217a12..44b3799 100644 (file)
@@ -29,6 +29,7 @@
 //
 //   Markus Fasel <M.Fasel@gsi.de>
 #include <TClass.h>
+#include <TArrayD.h>
 #include <TH2.h>
 #include <THnSparse.h>
 #include <TString.h>
@@ -164,6 +165,14 @@ void AliHFEtofPIDqa::Initialize(){
 
   // 3rd histogram: TPC sigmas to the electron line: (species, p nsigma, step - only filled if apriori PID information available)
   fHistos->CreateTHnSparse("tofMonitorTPC", "TPC signal; species; p [GeV/c]; TPC signal [a.u.]; Selection Step; Centrality", 5, nBinsSigma, minSigma, maxSigma);
+
+  // 4th histogram: TOF mismatch template
+  AliHFEpidTOF *tofpid = dynamic_cast<AliHFEpidTOF *>(fQAmanager->GetDetectorPID(AliHFEpid::kTOFpid));
+  if(!tofpid) AliDebug(1, "TOF PID not available");
+  if(tofpid && tofpid->IsGenerateTOFmismatch()){
+    AliDebug(1, "Prepare histogram for TOF mismatch tracks");
+    fHistos->CreateTHnSparse("tofMismatch", "TOF signal; species; p [GeV/c]; TOF signal [a.u.]; Selection Step; Centrality", 5, nBinsSigma, minSigma, maxSigma);
+  }
 }
 
 //_________________________________________________________
@@ -172,7 +181,7 @@ void AliHFEtofPIDqa::ProcessTrack(const AliHFEpidObject *track, AliHFEdetPIDqa::
   // Fill TPC histograms
   //
   //AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis;
-  AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis;
+  //AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis;
 
   Float_t centrality = track->GetCentrality();
   Int_t species = track->GetAbInitioPID();
@@ -180,7 +189,6 @@ void AliHFEtofPIDqa::ProcessTrack(const AliHFEpidObject *track, AliHFEdetPIDqa::
 
   AliDebug(1, Form("Monitoring particle of type %d for step %d", species, step));
   AliHFEpidTOF *tofpid= dynamic_cast<AliHFEpidTOF *>(fQAmanager->GetDetectorPID(AliHFEpid::kTOFpid));
-  AliHFEpidTRD *trdpid= dynamic_cast<AliHFEpidTRD *>(fQAmanager->GetDetectorPID(AliHFEpid::kTRDpid));
   
   const AliPIDResponse *pidResponse = tofpid ? tofpid->GetPIDResponse() : NULL;
   Double_t contentSignal[5];
@@ -190,11 +198,18 @@ void AliHFEtofPIDqa::ProcessTrack(const AliHFEpidObject *track, AliHFEdetPIDqa::
   contentSignal[3] = step;
   contentSignal[4] = centrality;
   fHistos->Fill("tofnSigma", contentSignal);
-  //if(species > -1){
-  contentSignal[1] =trdpid ? trdpid->GetP(track->GetRecTrack(), anatype) : 0.;
   contentSignal[2] = pidResponse ? pidResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron) : 0.;
-    fHistos->Fill("tofMonitorTPC", contentSignal);
-  //}
+  fHistos->Fill("tofMonitorTPC", contentSignal);
+
+  if(tofpid->IsGenerateTOFmismatch()){
+    AliDebug(1,"Filling TOF mismatch histos");
+    TArrayD nsigmismatch(tofpid->GetNmismatchTracks());
+    tofpid->GenerateTOFmismatch(track->GetRecTrack(),tofpid->GetNmismatchTracks(), nsigmismatch);
+    for(int itrk = 0; itrk < tofpid->GetNmismatchTracks(); itrk++){
+      contentSignal[2] = nsigmismatch[itrk];
+      fHistos->Fill("tofMismatch",contentSignal);
+    }
+  }
 }
 
 //_________________________________________________________