Since it contains fixes of coding rule violations, all classes are involved. Further...
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Aug 2009 12:27:34 +0000 (12:27 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Aug 2009 12:27:34 +0000 (12:27 +0000)
28 files changed:
PWG3/hfe/AliAnalysisElectronTask.cxx [deleted file]
PWG3/hfe/AliAnalysisElectronTask.h [deleted file]
PWG3/hfe/AliAnalysisTaskHFE.cxx
PWG3/hfe/AliAnalysisTaskHFE.h
PWG3/hfe/AliHFEcollection.cxx
PWG3/hfe/AliHFEcollection.h
PWG3/hfe/AliHFEcuts.cxx
PWG3/hfe/AliHFEcuts.h
PWG3/hfe/AliHFEextraCuts.cxx
PWG3/hfe/AliHFEextraCuts.h
PWG3/hfe/AliHFEmcQA.cxx
PWG3/hfe/AliHFEmcQA.h
PWG3/hfe/AliHFEpid.cxx
PWG3/hfe/AliHFEpid.h
PWG3/hfe/AliHFEpidBase.cxx
PWG3/hfe/AliHFEpidBase.h
PWG3/hfe/AliHFEpidMC.h
PWG3/hfe/AliHFEpidTOF.cxx
PWG3/hfe/AliHFEpidTOF.h
PWG3/hfe/AliHFEpidTPC.cxx
PWG3/hfe/AliHFEpidTPC.h
PWG3/hfe/AliHFEpidTRD.cxx
PWG3/hfe/AliHFEpidTRD.h
PWG3/hfe/AliHFEpriVtx.cxx
PWG3/hfe/AliHFEpriVtx.h
PWG3/hfe/AliHFEsecVtx.cxx
PWG3/hfe/AliHFEsecVtx.h
PWG3/hfe/TRD.PIDthresholds.root [deleted file]

diff --git a/PWG3/hfe/AliAnalysisElectronTask.cxx b/PWG3/hfe/AliAnalysisElectronTask.cxx
deleted file mode 100644 (file)
index af91dbd..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-/**************************************************************************
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
-*                                                                        *
-* Author: The ALICE Off-line Project.                                    *
-* Contributors are mentioned in the code where appropriate.              *
-*                                                                        *
-* 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     *
-* about the suitability of this software for any purpose. It is          *
-* provided "as is" without express or implied warranty.                  *
-**************************************************************************/
-/*
- * The analysis task:
- * Filling an AliCFContainer with the quantities pt, eta and phi
- * for tracks which survivied the particle cuts (MC resp. ESD tracks)
- * Track selection is done using the AliHFE package
- * 
- * Author:
- *  Markus Fasel <M.Fasel@gsi.de>
- */
-#include <TAxis.h>
-#include <TCanvas.h>
-#include <TChain.h>
-#include <TH1F.h>
-#include <TH1I.h>
-#include <TH2F.h>
-#include <TIterator.h>
-#include <TList.h>
-#include <TLegend.h>
-#include <TMath.h>
-#include <TObjArray.h>
-#include <TParticle.h>
-#include <TProfile.h>
-#include <TTree.h>
-
-#include "AliCFContainer.h"
-#include "AliCFManager.h"
-#include "AliESDEvent.h"
-#include "AliESDInputHandler.h"
-#include "AliESDtrack.h"
-#include "AliESDtrackCuts.h"
-#include "AliLog.h"
-#include "AliAnalysisManager.h"
-#include "AliMCEvent.h"
-#include "AliMCEventHandler.h"
-#include "AliMCParticle.h"
-#include "AliPID.h"
-
-#include "AliHFEpid.h"
-#include "AliHFEcuts.h"
-#include "AliAnalysisElectronTask.h"
-
-//____________________________________________________________
-AliAnalysisElectronTask::AliAnalysisElectronTask():
-       AliAnalysisTask("PID efficiency Analysis", "")
-       , fESD(0x0)
-       , fMC(0x0)
-       , fCFM(0x0)
-       , fPID(0x0)
-  , fCuts(0x0)
-       , fNEvents(0x0)
-       , fQA(0x0)
-{
-       DefineInput(0, TChain::Class());
-       DefineOutput(0, TH1I::Class());
-       DefineOutput(1, AliCFContainer::Class());
-       DefineOutput(2, TList::Class());
-
-  // Initialize cuts
-  fCuts = new AliHFEcuts;
-  fPID = new AliHFEpid;
-}
-
-//____________________________________________________________
-AliAnalysisElectronTask::~AliAnalysisElectronTask(){
-       if(fESD) delete fESD;
-       if(fMC) delete fMC;
-       if(fPID) delete fPID;
-       if(fQA) delete fQA;
-  if(fCuts) delete fCuts;
-       if(fNEvents) delete fNEvents;
-       fQA = 0x0; fMC = 0x0; fESD = 0x0; fCFM = 0x0; fPID = 0x0; fCuts = 0x0;
-}
-
-//____________________________________________________________
-void AliAnalysisElectronTask::ConnectInputData(Option_t *){
-       TTree *esdchain = dynamic_cast<TChain *>(GetInputData(0));
-       if(!esdchain){
-               AliError("ESD chain empty");
-               return;
-       } else {
-               esdchain->SetBranchStatus("Tracks", 1);
-       }
-       AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-       if(!esdH){      
-               AliError("No ESD input handler");
-               return;
-       } else {
-               fESD = esdH->GetEvent();
-       }
-       AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
-       if(!mcH){       
-               AliError("No MC truth handler");
-               return;
-       } else {
-               fMC = mcH->MCEvent();
-       }
-}
-
-//____________________________________________________________
-void AliAnalysisElectronTask::CreateOutputObjects(){
-       fNEvents = new TH1I("nEvents", "Number of Events in the Analysis", 2, 0, 2); // Number of Events neccessary for the analysis and not a QA histogram
-       // First Step: TRD alone
-       if(!fQA) fQA = new TList;
-       fQA->AddAt(new TProfile("conr", "Electron PID contamination", 20, 0, 20), 0);
-       fQA->AddAt(new TH1F("alpha_rec", "Alpha from reconstructed tracks with TRD hits", 36, -TMath::Pi(), TMath::Pi()), 1);
-       fQA->AddAt(new TH1F("alpha_sim", "Alpha from simulated electron tracks", 36, -TMath::Pi(), TMath::Pi()), 2);
-       fQA->AddAt(new TH1F("nElectron", "Number of electrons", 100, 0, 100), 3);
-       fQA->AddAt(new TProfile("pidquality", "TRD PID quality as function of momentum", 20, 0, 20), 4);
-       fQA->AddAt(new TProfile("ntrdclusters", "Number of TRD clusters as function of momentum", 20, 0, 20), 5);
-       fQA->AddAt(new TH1F("chi2TRD","#chi2 per TRD cluster", 20, 0, 20), 6);
-
-  // Initialize correction Framework and Cuts
-  fCFM = new AliCFManager;
-  MakeParticleContainer();
-  // Temporary fix: Initialize particle cuts with 0x0
-  for(Int_t istep = 0; istep < fCFM->GetParticleContainer()->GetNStep(); istep++)
-    fCFM->SetParticleCutsList(istep, 0x0);
-  if(IsQAOn()){
-    fCuts->SetDebugMode();
-    fQA->AddAt(fCuts->GetQAhistograms(), 7);
-  }
-  fCuts->CreateStandardCuts();
-  fCuts->Initialize(fCFM);
-
-  // Initialize PID
-  if(IsQAOn()){
-    fPID->SetQAOn();
-    fQA->AddAt(fPID->GetQAhistograms(), 8);
-  }
-  fPID->SetHasMCData(kTRUE);
-  fPID->InitializePID("TRD");
-}
-
-//____________________________________________________________
-void AliAnalysisElectronTask::Exec(Option_t *){
-       //
-       // Run the analysis
-       //
-       if(!fESD){
-               AliError("No ESD Event");
-               return;
-       }
-       if(!fMC){
-               AliError("No MC Event");
-               return;
-       }
-       fCFM->SetEventInfo(fMC);
-  fPID->SetMCEvent(fMC);
-
-       //fCFM->CheckEventCuts(AliCFManager::kEvtGenCuts, fMC);
-
-       Double_t pt = 0;
-       Double_t container[3];
-
-       // Loop over the Monte Carlo tracks to see whether we have overlooked any track
-       AliMCParticle *mctrack = 0x0;
-       Int_t nElectrons = 0;
-       for(Int_t imc = fMC->GetNumberOfTracks(); imc--;){
-               mctrack = fMC->GetTrack(imc);
-               container[0] = mctrack->Pt();
-               container[1] = mctrack->Eta();
-    container[2] = mctrack->Phi();
-
-               if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) continue;
-               fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepMCGenerated);
-               (dynamic_cast<TH1F *>(fQA->At(2)))->Fill(mctrack->Phi() - TMath::Pi());
-               if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCInAcceptance, mctrack)) continue;
-               // find the label in the vector
-               fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepMCInAcceptance);
-               nElectrons++;
-       }
-       (dynamic_cast<TH1F *>(fQA->At(3)))->Fill(nElectrons);
-
-       // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD);
-       AliESDtrack *track = 0x0;
-       for(Int_t itrack = 0; itrack < fESD->GetNumberOfTracks(); itrack++){
-               track = fESD->GetTrack(itrack);
-               container[0] = track->Pt();
-               container[1] = track->Eta();
-    container[2] = track->Phi();
-               if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecKine, track)) continue;
-               fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecKine);
-
-               // Check TRD criterions (outside the correction framework)
-               if(track->GetTRDncls()){
-                       (dynamic_cast<TH1F *>(fQA->At(6)))->Fill(track->GetTRDchi2()/track->GetTRDncls());
-                       (dynamic_cast<TH1F *>(fQA->At(1)))->Fill(track->GetAlpha());    // Check the acceptance without tight cuts
-                       (dynamic_cast<TProfile *>(fQA->At(4)))->Fill(container[0], track->GetTRDpidQuality());
-                       (dynamic_cast<TProfile *>(fQA->At(5)))->Fill(container[0], track->GetTRDncls());
-               }
-               if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecPrim, track)) continue;
-    fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecPrim);
-    if(fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcuts, track)) continue;
-    fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcuts);
-    // track accepted, do PID
-               if(!fPID->IsSelected(track)) continue;
-       fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcuts + 1);
-       }
-       fNEvents->Fill(1);
-
-       // Done!!!
-       PostData(0, fNEvents);
-       PostData(1, fCFM->GetParticleContainer());
-       PostData(2, fQA);
-}
-
-//____________________________________________________________
-void AliAnalysisElectronTask::Terminate(Option_t *){
-       //
-       // Terminate not implemented at the moment
-       //
-}
-
-//____________________________________________________________
-void AliAnalysisElectronTask::MakeParticleContainer(){
-  //
-  // Create the particle container for the correction framework manager and 
-  // link it
-  //
-  const Int_t nvar   = 3 ; //number of variables on the grid:pt,eta, phi
-  const Double_t ptmin = 0., ptmax = 10.;
-  const Double_t etamin = -0.9, etamax = 0.9;
-  const Double_t phimin = 0., phimax = 2. * TMath::Pi();
-  
-
-  //arrays for the number of bins in each dimension
-  Int_t iBin[nvar];
-  iBin[0] = 20; //bins in pt
-  iBin[1] =  8; //bins in eta 
-  iBin[2] = 18; // bins in phi
-
-  //arrays for lower bounds :
-  Double_t *binLim1 = new Double_t[iBin[0] + 1];
-  Double_t *binLim2 = new Double_t[iBin[1] + 1];
-  Double_t *binLim3 = new Double_t[iBin[2] + 1];
-
-  //values for bin lower bounds
-  for(Int_t i=0; i<=iBin[0]; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/iBin[0]*(Double_t)i; 
-  for(Int_t i=0; i<=iBin[1]; i++) binLim2[i]=(Double_t)etamin  + (etamax-etamin)/iBin[1]*(Double_t)i;
-  for(Int_t i=0; i<=iBin[2]; i++) binLim3[i]=(Double_t)phimin  + (phimax-phimin)/iBin[2]*(Double_t)i;
-
-  //one "container" for MC
-  AliCFContainer* container = new AliCFContainer("container","container for tracks", AliHFEcuts::kNcutSteps + 1, nvar, iBin);
-  //setting the bin limits
-  container -> SetBinLimits(0,binLim1);
-  container -> SetBinLimits(1,binLim2);
-  container -> SetBinLimits(2,binLim3);
-  fCFM->SetParticleContainer(container);
-}
diff --git a/PWG3/hfe/AliAnalysisElectronTask.h b/PWG3/hfe/AliAnalysisElectronTask.h
deleted file mode 100644 (file)
index e861d49..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/**************************************************************************
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
-*                                                                        *
-* Author: The ALICE Off-line Project.                                    *
-* Contributors are mentioned in the code where appropriate.              *
-*                                                                        *
-* 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     *
-* about the suitability of this software for any purpose. It is          *
-* provided "as is" without express or implied warranty.                  *
-**************************************************************************/
-#ifndef ALIANALYSEPIDEFFICIENCY_H
-#define ALIANALYSEPIDEFFICIENCY_H
-
-#include "AliAnalysisTask.h"
-
-class AliHFEpid;
-class AliHFEcuts;
-class AliCFManager;
-class AliESDEvent;
-class AliESDtrackCuts;
-class AliMCEvent;
-class TH1I; 
-class TList;
-
-class AliAnalysisElectronTask : public AliAnalysisTask{
-  enum{
-    kIsQAOn = BIT(14)
-  };
-       public:
-               AliAnalysisElectronTask();
-               ~AliAnalysisElectronTask();
-
-               virtual void ConnectInputData(Option_t *);
-               virtual void CreateOutputObjects();
-               virtual void Exec(Option_t *);
-               virtual void Terminate(Option_t *);
-
-    void SetQAOn() { SetBit(kIsQAOn, kTRUE); };
-    Bool_t IsQAOn() const { return TestBit(kIsQAOn); };
-
-       private:
-    void MakeParticleContainer();
-
-               AliESDEvent *fESD;                              //! The ESD Event
-               AliMCEvent *fMC;                                  //! The MC Event
-               AliCFManager *fCFM;                             //! Correction Framework Manager
-               AliHFEpid *fPID;         //! PID
-    AliHFEcuts *fCuts;     //! Cut Collection
-               TH1I *fNEvents;                                   //! counter for the number of Events
-               TList *fQA;                                           //! QA histos for the cuts
-
-       ClassDef(AliAnalysisElectronTask, 1)    // The electron Analysis Task
-};
-#endif
index c8cd573..6007840 100644 (file)
@@ -37,6 +37,7 @@
 #include <TObjArray.h>
 #include <TParticle.h>
 #include <TProfile.h>
+#include <TString.h>
 #include <TTree.h>
 
 #include "AliCFContainer.h"
@@ -62,6 +63,8 @@
 //____________________________________________________________
 AliAnalysisTaskHFE::AliAnalysisTaskHFE():
   AliAnalysisTask("PID efficiency Analysis", "")
+  , fQAlevel(0)
+  , fPIDdetectors("")
   , fESD(0x0)
   , fMC(0x0)
   , fCFM(0x0)
@@ -72,6 +75,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE():
   , fSecVtx(0x0)
   , fMCQA(0x0)
   , fNEvents(0x0)
+  , fNElectronTracksEvent(0x0)
   , fQA(0x0)
   , fOutput(0x0)
   , fHistMCQA(0x0)
@@ -92,31 +96,28 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE():
 
 //____________________________________________________________
 AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref):
-  AliAnalysisTask("PID efficiency Analysis COPY", "")
-  , fESD(0x0)
-  , fMC(0x0)
-  , fCFM(0x0)
-  , fCorrelation(0x0)
-  , fFakeElectrons(0x0)
-  , fPID(0x0)
-  , fCuts(0x0)
-  , fSecVtx(0x0)
-  , fMCQA(0x0)
-  , fNEvents(0x0)
-  , fQA(0x0)
-  , fOutput(0x0)
-  , fHistMCQA(0x0)
-  , fHistSECVTX(0x0)
+  AliAnalysisTask(ref)
+  , fQAlevel(ref.fQAlevel)
+  , fPIDdetectors(ref.fPIDdetectors)
+  , fESD(ref.fESD)
+  , fMC(ref.fMC)
+  , fCFM(ref.fCFM)
+  , fCorrelation(ref.fCorrelation)
+  , fFakeElectrons(ref.fFakeElectrons)
+  , fPID(ref.fPID)
+  , fCuts(ref.fCuts)
+  , fSecVtx(ref.fSecVtx)
+  , fMCQA(ref.fMCQA)
+  , fNEvents(ref.fNEvents)
+  , fNElectronTracksEvent(ref.fNElectronTracksEvent)
+  , fQA(ref.fQA)
+  , fOutput(ref.fOutput)
+  , fHistMCQA(ref.fHistMCQA)
+  , fHistSECVTX(ref.fHistSECVTX)
 {
   //
   // Copy Constructor
   //
-  DefineInput(0, TChain::Class());
-  DefineOutput(0, TH1I::Class());
-  DefineOutput(1, TList::Class());
-  DefineOutput(2, TList::Class());
-
-  ref.Copy(*this);
 }
 
 //____________________________________________________________
@@ -124,9 +125,25 @@ AliAnalysisTaskHFE &AliAnalysisTaskHFE::operator=(const AliAnalysisTaskHFE &ref)
   //
   // Assignment operator
   //
-  if(this != &ref)
-    ref.Copy(*this);
-
+  if(this == &ref) return *this;
+  AliAnalysisTask::operator=(ref);
+  fQAlevel = ref.fQAlevel;
+  fPIDdetectors = ref.fPIDdetectors;
+  fESD = ref.fESD;
+  fMC = ref.fMC;
+  fCFM = ref.fCFM;
+  fCorrelation = ref.fCorrelation;
+  fFakeElectrons = ref.fFakeElectrons;
+  fPID = ref.fPID;
+  fCuts = ref.fCuts;
+  fSecVtx = ref.fSecVtx;
+  fMCQA = ref.fMCQA;
+  fNEvents = ref.fNEvents;
+  fNElectronTracksEvent = ref.fNElectronTracksEvent;
+  fQA = ref.fQA;
+  fOutput = ref.fOutput;
+  fHistMCQA = ref.fHistMCQA;
+  fHistSECVTX = ref.fHistSECVTX;
   return *this;
 }
 
@@ -163,30 +180,15 @@ AliAnalysisTaskHFE::~AliAnalysisTaskHFE(){
 }
 
 //____________________________________________________________
-void AliAnalysisTaskHFE::Copy(TObject &o) const {
-  //
-  // Make a copy of the task objecy
-  //
-  
-  AliAnalysisTaskHFE &target = dynamic_cast<AliAnalysisTaskHFE &>(o);
-
-  // copy objects
-  if(fPID) target.fPID = new AliHFEpid(*fPID);
-  if(fCuts) target.fCuts = new AliHFEcuts(*fCuts);
-
-  if(fESD || fMC) target.ConnectInputData(0x0);
-  if(fOutput || fQA) target.CreateOutputObjects();
-}
-
-//____________________________________________________________
 void AliAnalysisTaskHFE::ConnectInputData(Option_t *){
-  TTree *esdchain = dynamic_cast<TChain *>(GetInputData(0));
+/*  TTree *esdchain = dynamic_cast<TChain *>(GetInputData(0));
   if(!esdchain){
     AliError("ESD chain empty");
     return;
   } else {
     esdchain->SetBranchStatus("Tracks", 1);
   }
+*/
   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
   if(!esdH){      
     AliError("No ESD input handler");
@@ -206,6 +208,7 @@ void AliAnalysisTaskHFE::ConnectInputData(Option_t *){
 //____________________________________________________________
 void AliAnalysisTaskHFE::CreateOutputObjects(){
   fNEvents = new TH1I("nEvents", "Number of Events in the Analysis", 2, 0, 2); // Number of Events neccessary for the analysis and not a QA histogram
+  fNElectronTracksEvent = new TH1I("nElectronTracksEvent", "Number of Electron Candidates", 100, 0, 100);
   // First Step: TRD alone
   if(!fQA) fQA = new TList;
   fQA->AddAt(new TProfile("conr", "Electron PID contamination", 20, 0, 20), 0);
@@ -223,45 +226,50 @@ void AliAnalysisTaskHFE::CreateOutputObjects(){
   // Temporary fix: Initialize particle cuts with 0x0
   for(Int_t istep = 0; istep < fCFM->GetParticleContainer()->GetNStep(); istep++)
     fCFM->SetParticleCutsList(istep, 0x0);
-  if(IsQAOn()){
+  if(IsQAOn(kCUTqa)){
+    AliInfo("QA on for Cuts");
     fCuts->SetDebugMode();
     fQA->Add(fCuts->GetQAhistograms());
   }
   fCuts->CreateStandardCuts();
+  fCuts->SetMinNTrackletsTRD(0);  // Minimal requirement to get a minimum biased electron sample (only TPC and ITS requirements allowed)
   fCuts->Initialize(fCFM);
   // add output objects to the List
   fOutput->AddAt(fCFM->GetParticleContainer(), 0);
   fOutput->AddAt(fCorrelation, 1);
   fOutput->AddAt(fFakeElectrons, 2);
+  fOutput->AddAt(fNElectronTracksEvent, 3);
 
   // Initialize PID
-  if(IsQAOn()){
-    AliInfo("QA on for Cuts and PID");
+  if(IsQAOn(kPIDqa)){
+    AliInfo("PID QA switched on");
     fPID->SetQAOn();
     fQA->Add(fPID->GetQAhistograms());
   }
   fPID->SetHasMCData(kTRUE);
-  fPID->InitializePID("TRD");
+  if(!fPIDdetectors.Length()) AddPIDdetector("TPC");
+  fPID->InitializePID(fPIDdetectors.Data());     // Only restrictions to TPC allowed 
 
   // mcQA----------------------------------
-  if (IsMCQAOn()) {
+  if (IsQAOn(kMCqa)) {
     AliInfo("MC QA on");
     if(!fMCQA) fMCQA = new AliHFEmcQA;
     if(!fHistMCQA) fHistMCQA = new TList();
+    fHistMCQA->SetName("MCqa");
     fMCQA->CreateHistograms(AliHFEmcQA::kCharm,0,"mcqa_");               // create histograms for charm
     fMCQA->CreateHistograms(AliHFEmcQA::kBeauty,0,"mcqa_");              // create histograms for beauty
     fMCQA->CreateHistograms(AliHFEmcQA::kCharm,1,"mcqa_barrel_");        // create histograms for charm 
     fMCQA->CreateHistograms(AliHFEmcQA::kBeauty,1,"mcqa_barrel_");       // create histograms for beauty
-    TIter next_(gDirectory->GetList());
-    TObject *obj_;
-    int counter_ = 0;
+    TIter next(gDirectory->GetList());
+    TObject *obj;
+    int counter = 0;
     TString objname;
-    while ((obj_ = next_.Next())) {
-      objname = obj_->GetName();
+    while ((obj = next.Next())) {
+      objname = obj->GetName();
       TObjArray *toks = objname.Tokenize("_");
       if (toks->GetEntriesFast()){
         TObjString *fpart = (TObjString *)(toks->UncheckedAt(0));
-        if ((fpart->String()).CompareTo("mcqa") == 0) fHistMCQA->AddAt(obj_, counter_++);
+        if ((fpart->String()).CompareTo("mcqa") == 0) fHistMCQA->AddAt(obj, counter++);
       }
     }
     fQA->Add(fHistMCQA);
@@ -273,20 +281,21 @@ void AliAnalysisTaskHFE::CreateOutputObjects(){
     fSecVtx = new AliHFEsecVtx;
 
     if(!fHistSECVTX) fHistSECVTX = new TList();
+    fHistSECVTX->SetName("SecVtx");
     fSecVtx->CreateHistograms("secvtx_");
-    TIter next__(gDirectory->GetList());
-    TObject *obj__;
-    int counter__ = 0;
+    TIter next(gDirectory->GetList());
+    TObject *obj;
+    int counter = 0;
     TString objname;
-    while ((obj__ = next__.Next())) {
-      objname = obj__->GetName();
+    while ((obj = next.Next())) {
+      objname = obj->GetName();
       TObjArray *toks = objname.Tokenize("_");
       if (toks->GetEntriesFast()){
         TObjString *fpart = (TObjString *)(toks->UncheckedAt(0));
-        if ((fpart->String()).CompareTo("secvtx") == 0) fHistSECVTX->AddAt(obj__, counter__++);
+        if ((fpart->String()).CompareTo("secvtx") == 0) fHistSECVTX->AddAt(obj, counter++);
       }
     }
-  fOutput->Add(fHistSECVTX);
+    fOutput->Add(fHistSECVTX);
   } 
 }
 
@@ -319,7 +328,7 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
   }
 
   // run mc QA ------------------------------------------------
-  if (IsMCQAOn()) {
+  if (IsQAOn(kMCqa)) {
     AliDebug(2, "Running MC QA");
 
     fMCQA->SetStack(fMC->Stack());
@@ -377,6 +386,7 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
   //
 
   Int_t nbtrackrec = fESD->GetNumberOfTracks();
+  Int_t nElectronCandidates = 0;
   AliESDtrack *track = 0x0, *htrack = 0x0;
   Int_t pid = 0;
   // For double counted tracks
@@ -551,6 +561,7 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
 
     // track accepted, do PID
     if(!fPID->IsSelected(track)) continue;
+    nElectronCandidates++;
 
 
     // Fill Containers
@@ -602,7 +613,8 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     }
   }
   fNEvents->Fill(1);
-  
+  fNElectronTracksEvent->Fill(nElectronCandidates);
+
   // release memory
   delete[] indexRecKineTPC;
   delete[] indexRecKineITS;
@@ -683,3 +695,27 @@ void AliAnalysisTaskHFE::MakeParticleContainer(){
     fFakeElectrons->SetBinEdges(idim, binEdges[idim]);
 }
 
+void AliAnalysisTaskHFE::AddPIDdetector(Char_t *detector){
+  if(!fPIDdetectors.Length()) 
+    fPIDdetectors = detector;
+  else
+    fPIDdetectors += Form(":%s", detector);
+}
+
+//____________________________________________________________
+void AliAnalysisTaskHFE::PrintStatus(){
+  printf("\n\tAnalysis Settings\n\t========================================\n\n");
+  printf("\tSecondary Vertex finding: %s\n", IsSecVtxOn() ? "YES" : "NO");
+  printf("\tPrimary Vertex resolution: %s\n", IsPriVtxOn() ? "YES" : "NO");
+  printf("\n");
+  printf("\tParticle Identification Detectors:\n");
+  TObjArray *detectors = fPIDdetectors.Tokenize(":");
+  for(Int_t idet = 0; idet < detectors->GetEntries(); idet++)
+    printf("\t\t%s\n", (dynamic_cast<TObjString *>(detectors->At(idet)))->String().Data());
+  printf("\n");
+  printf("\tQA: \n");
+  printf("\t\tPID: %s\n", IsQAOn(kPIDqa) ? "YES" :  "NO");
+  printf("\t\tCUTS: %s\n", IsQAOn(kCUTqa) ? "YES" : "NO");
+  printf("\t\tMC: %s\n", IsQAOn(kMCqa) ? "YES" : "NO");
+  printf("\n");
+}
index 56af78a..837d85b 100644 (file)
@@ -36,37 +36,40 @@ class TList;
 
 class AliAnalysisTaskHFE : public AliAnalysisTask{
   enum{
-    kIsQAOn = BIT(18),
-    kIsMCQAOn = BIT(19),
-    kIsSecVtxOn = BIT(20),
-    kIsPriVtxOn = BIT(21)
+    kIsSecVtxOn = BIT(19),
+    kIsPriVtxOn = BIT(20)
   };
   public:
+  enum{
+    kPIDqa = 0,
+    kCUTqa = 1,
+    kMCqa = 2
+  };
     AliAnalysisTaskHFE();
     AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref);
     AliAnalysisTaskHFE& operator=(const AliAnalysisTaskHFE &ref);
-    ~AliAnalysisTaskHFE();
+    virtual ~AliAnalysisTaskHFE();
 
     virtual void ConnectInputData(Option_t *);
     virtual void CreateOutputObjects();
     virtual void Exec(Option_t *);
     virtual void Terminate(Option_t *);
 
-    Bool_t IsQAOn() const     { return TestBit(kIsQAOn); };
-    Bool_t IsMCQAOn() const   { return TestBit(kIsMCQAOn); };
+    Bool_t IsQAOn(Int_t qaLevel) const { return TESTBIT(fQAlevel, qaLevel); };
     Bool_t IsSecVtxOn() const { return TestBit(kIsSecVtxOn); };
     Bool_t IsPriVtxOn() const { return TestBit(kIsPriVtxOn); };
-    void SetQAOn()            { SetBit(kIsQAOn, kTRUE); };
-    void SetMCQAOn()          { SetBit(kIsMCQAOn, kTRUE); };
+    void SetQAOn(Int_t qaLevel) { SETBIT(fQAlevel, qaLevel); };
     void SetPriVtxOn()        { SetBit(kIsPriVtxOn, kTRUE); };
     void SetSecVtxOn()        { SetBit(kIsSecVtxOn, kTRUE); };
+    void SetPIDdetectors(Char_t *detectors){ fPIDdetectors = detectors; }
+    void AddPIDdetector(Char_t *detector);
+    void PrintStatus();
  
-  protected:
-    void Copy(TObject &o) const;
-
   private:
     void MakeParticleContainer();
-
+    
+    ULong_t fQAlevel;                     // QA level
+    TString fPIDdetectors;                // Detectors for Particle Identification
     AliESDEvent *fESD;                    //! The ESD Event
     AliMCEvent *fMC;                      //! The MC Event
     AliCFManager *fCFM;                   //! Correction Framework Manager
@@ -77,6 +80,7 @@ class AliAnalysisTaskHFE : public AliAnalysisTask{
     AliHFEsecVtx *fSecVtx;                //! Secondary Vertex Analysis
     AliHFEmcQA *fMCQA;                    //! MC QA
     TH1I *fNEvents;                       //! counter for the number of Events
+    TH1I *fNElectronTracksEvent;          //! Number of Electron candidates after PID decision per Event
     TList *fQA;                           //! QA histos for the cuts
     TList *fOutput;                       //! Container for Task Output
     TList *fHistMCQA;                     //! Output container for MC QA histograms 
index 91a0261..f86726c 100644 (file)
@@ -109,102 +109,102 @@ AliHFEcollection::~AliHFEcollection(){
   AliInfo("DESTRUCTOR");
 }
 //___________________________________________________________________
-Bool_t AliHFEcollection::CreateTH1F(const char* _name, const char* _title, Int_t _nBin, Float_t _nMin, Float_t _nMax){
+Bool_t AliHFEcollection::CreateTH1F(const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax){
   
   if(!fListE){
     AliError("No TList pointer ! ");
     return kFALSE;
   }
   else{
-    fListE->Add(new TH1F(_name, _title, _nBin, _nMin, _nMax));
-     return CheckObject(_name);
+    fListE->Add(new TH1F(name, title, nBin, nMin, nMax));
+    return CheckObject(name);
   }
 }
 //___________________________________________________________________
-Bool_t AliHFEcollection::CreateTH2F(const char* _name, const char* _title, Int_t _nBinX, Float_t _nMinX, Float_t _nMaxX, Int_t _nBinY, Float_t _nMinY, Float_t _nMaxY){
+Bool_t AliHFEcollection::CreateTH2F(const char* name, const char* title, Int_t nBinX, Float_t nMinX, Float_t nMaxX, Int_t nBinY, Float_t nMinY, Float_t nMaxY){
   
   if(!fListE){
     AliError("No TList pointer ! ");
     return kFALSE;
   }
-  fListE->Add(new TH2F(_name, _title, _nBinX, _nMinX, _nMaxX, _nBinY, _nMinY, _nMaxY));
-  return CheckObject(_name); 
+  fListE->Add(new TH2F(name, title, nBinX, nMinX, nMaxX, nBinY, nMinY, nMaxY));
+  return CheckObject(name); 
 }
 //___________________________________________________________________
-Bool_t AliHFEcollection::CreateTH1Fvector1(Int_t _X, const char* _name, const char* _title, Int_t _nBin, Float_t _nMin, Float_t _nMax){
+Bool_t AliHFEcollection::CreateTH1Fvector1(Int_t X, const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax){
 
-  // create a 1 dimensional array of size [_X]
+  // create a 1 dimensional array of size [X]
   
   if(!fListE){
     AliError("No TList pointer ! ");
     return kFALSE;
   }
-  if(_X <=0){
+  if(X <=0){
     AliError("can not create array with negative or zero size ");
     return kFALSE;
   }
-  TString name;
-  for(Int_t i=0; i<_X; ++i){
-    name = "";
-    name.Append(Form("%s_[%d]", _name, i));
+  TString hname;
+  for(Int_t i=0; i<X; ++i){
+    hname = "";
+    hname.Append(Form("%s_[%d]", name, i));
     //cout<<" -D: name: "<<name.str().c_str()<<endl;
     //cout<<" -D: nBin: "<<_nBin<<" ,Min: "<<_nMin<<" , Max: "<<_nMax<<endl;
-    CreateTH1F(name.Data(), _title, _nBin, _nMin, _nMax);
-    if(!CheckObject(name.Data())){
-      AliError(Form("Not possible to create object: ", name.Data()));
+    CreateTH1F(hname.Data(), title, nBin, nMin, nMax);
+    if(!CheckObject(hname.Data())){
+      AliError(Form("Not possible to create object: ", hname.Data()));
       return kFALSE;
     }    
   }
   return kTRUE;  
 }
 //___________________________________________________________________
-Bool_t AliHFEcollection::CreateTH2Fvector1(Int_t _X, const char* _name, const char* _title, Int_t _nBinX, Float_t _nMinX, Float_t _nMaxX, Int_t _nBinY, Float_t _nMinY, Float_t _nMaxY){
+Bool_t AliHFEcollection::CreateTH2Fvector1(Int_t X, const char* name, const char* title, Int_t nBinX, Float_t nMinX, Float_t nMaxX, Int_t nBinY, Float_t nMinY, Float_t nMaxY){
 
-  // create a 1 dimensinal array of TH2F histograms with size [_X]
+  // create a 1 dimensinal array of TH2F histograms with size [X]
   if(!fListE){
     AliError("No TList pointer !");
     return kFALSE;
   }
-  if(_X <=0){
+  if(X <=0){
     AliError("can not create array with negative or zero size ");
     return kFALSE;
   }
-  TString name;
-  for(Int_t i=0; i<_X; ++i){
-    name = "";
-    name.Append(Form("%s_[%d]", _name, i));
+  TString hname;
+  for(Int_t i=0; i<X; ++i){
+    hname = "";
+    hname.Append(Form("%s_[%d]", name, i));
     //cout<<" -D: name: "<<name<<endl;
     //cout<<" -D: nBin: "<<_nBin<<" ,Min: "<<_nMin<<" , Max: "<<_nMax<<endl;
-    CreateTH2F(name.Data(), _title, _nBinX, _nMinX, _nMaxX, _nBinY, _nMinY, _nMaxY);
-    if(!CheckObject(name.Data())){
-      AliError(Form("Not possible to create object: %s", name.Data()));
+    CreateTH2F(hname.Data(), title, nBinX, nMinX, nMaxX, nBinY, nMinY, nMaxY);
+    if(!CheckObject(hname.Data())){
+      AliError(Form("Not possible to create object: %s", hname.Data()));
       return kFALSE;
     }    
   }
   return kTRUE;  
 }
 //___________________________________________________________________
-Bool_t AliHFEcollection::CreateTH1Fvector2(Int_t _X, Int_t _Y, const char* _name, const char* _title, Int_t _nBin, Float_t _nMin, Float_t _nMax){
+Bool_t AliHFEcollection::CreateTH1Fvector2(Int_t X, Int_t Y, const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax){
 
-  // create a 2 dimensional array of histograms of size [_X, _Y]
+  // create a 2 dimensional array of histograms of size [X, Y]
   if(!fListE){
     AliError("No TList pointer ! ");
     return kFALSE;
   }
-  if(_X <=0 || _Y <=0){
+  if(X <=0 || Y <=0){
     AliError("can not create array with negative or zero size ");
     return kFALSE;
   }
-  TString name;
-  for(Int_t i=0; i<_X; ++i){
-    for(Int_t j=0; j<_Y; ++j){
-      name = "";
-      name.Append(Form("%s_[%d][%d]", _name, i, j));
+  TString hname;
+  for(Int_t i=0; i<X; ++i){
+    for(Int_t j=0; j<Y; ++j){
+      hname = "";
+      hname.Append(Form("%s_[%d][%d]", name, i, j));
       //cout<<" -D: name: "<<name.str().c_str()<<endl;
       //cout<<" -D: nBin: "<<_nBin<<" ,Min: "<<_nMin<<" , Max: "<<_nMax<<endl;
-      CreateTH1F(name.Data(), _title, _nBin, _nMin, _nMax);
-      if(!CheckObject(name.Data())){
-             AliError(Form("Not possible to create object: %s", name.Data()));
+      CreateTH1F(hname.Data(), title, nBin, nMin, nMax);
+      if(!CheckObject(hname.Data())){
+             AliError(Form("Not possible to create object: %s", hname.Data()));
              return kFALSE;
       }
     }
@@ -214,34 +214,34 @@ Bool_t AliHFEcollection::CreateTH1Fvector2(Int_t _X, Int_t _Y, const char* _name
   
 }
 //___________________________________________________________________
-TObject* AliHFEcollection::Get(const char* _name, Int_t _X){
+TObject* AliHFEcollection::Get(const char* name, Int_t X){
   
-  TString name = _name;
-  name.Append(Form("_[%d]", _X));
-  if(!CheckObject(name.Data())){
+  TString hname = name;
+  hname.Append(Form("_[%d]", X));
+  if(!CheckObject(hname.Data())){
     AliError("No such object found in the list");
     return 0x0;
   }
   else{
-    return Get(name.Data());
+    return Get(hname.Data());
   }
 }
 //___________________________________________________________________
-TObject* AliHFEcollection::Get(const char* _name, Int_t _X, Int_t _Y){
+TObject* AliHFEcollection::Get(const char* name, Int_t X, Int_t Y){
   
-  TString name = _name;
-  name.Append(Form("_[%d][%d]", _X, _Y));
-  if(!CheckObject(name.Data())){
+  TString hname = name;
+  hname.Append(Form("_[%d][%d]", X, Y));
+  if(!CheckObject(hname.Data())){
     AliError("No such object found in the list");
-    AliError(Form("name: %s", name.Data()));
+    AliError(Form("name: %s", hname.Data()));
     return 0x0;
   }
   else{
-    return Get(name.Data());
+    return Get(hname.Data());
   }
 }
 //___________________________________________________________________
-Bool_t AliHFEcollection::CheckObject(const char* _name){
+Bool_t AliHFEcollection::CheckObject(const char* name){
 
   // check wheter the creation of the histogram was succesfull
   
@@ -250,15 +250,15 @@ Bool_t AliHFEcollection::CheckObject(const char* _name){
     return kFALSE;
   }
   
-  if(!fListE->FindObject(_name)){
+  if(!fListE->FindObject(name)){
     AliError("Creating or Finding the object failed");
     return kFALSE;
   }
   return kTRUE;
 }
 //___________________________________________________________________
-TObject* AliHFEcollection::Get(const char* _name){ 
-  return fListE->FindObject(_name); 
+TObject* AliHFEcollection::Get(const char* name){ 
+  return fListE->FindObject(name); 
 }
 //___________________________________________________________________
 Long64_t AliHFEcollection::Merge(TCollection *list){
index cbe4874..0dfc92c 100644 (file)
@@ -23,8 +23,8 @@
  */
 
 
-#ifndef __ALIHFECOLLECTION_H__
-#define __ALIHFECOLLECTION_H__
+#ifndef ALIHFECOLLECTION_H
+#define ALIHFECOLLECTION_H
 
 #ifndef ROOT_TNamed
 #include "TNamed.h"
@@ -44,17 +44,17 @@ class AliHFEcollection : public TNamed{
   virtual ~AliHFEcollection();
   
 
-  virtual void Browse(TBrowser*);
+  virtual void Browse(TBrowser *b);
 
   // Set & Create functions
   Bool_t CreateTH1F(const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax);
 
   Bool_t CreateTH2F(const char* name, const char* title, Int_t nBinX, Float_t nMinX, Float_t nMaxX, Int_t nBinY, Float_t nMinY, Float_t nMaxY);
 
-  Bool_t CreateTH1Fvector1(Int_t _X, const char* _name, const char* _title, Int_t _nBin, Float_t _nMin, Float_t _nMax);
-  Bool_t CreateTH2Fvector1(Int_t _X, const char* name, const char* title, Int_t nBinX, Float_t nMinX, Float_t nMaxX, Int_t nBinY, Float_t nMinY, Float_t nMaxY);
+  Bool_t CreateTH1Fvector1(Int_t X, const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax);
+  Bool_t CreateTH2Fvector1(Int_t X, const char* name, const char* title, Int_t nBinX, Float_t nMinX, Float_t nMaxX, Int_t nBinY, Float_t nMinY, Float_t nMaxY);
 
-  Bool_t CreateTH1Fvector2(Int_t _X, Int_t _Y, const char* _name, const char* _title, Int_t _nBin, Float_t _nMin, Float_t _nMax);
+  Bool_t CreateTH1Fvector2(Int_t X, Int_t Y, const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax);
   
 
   Long64_t Merge(TCollection *list);
@@ -62,15 +62,15 @@ class AliHFEcollection : public TNamed{
   // Get functions
   TList* GetList()  const  { return fListE; }
   TObject* Get(const char* name); 
-  TObject* Get(const char* name, Int_t _X);
-  TObject* Get(const char* name, Int_t _X, Int_t _Y);
+  TObject* Get(const char* name, Int_t X);
+  TObject* Get(const char* name, Int_t X, Int_t Y);
 
  private:
-  Bool_t CheckObject(const char*);
+  Bool_t CheckObject(const char* name);
    void Copy(TObject &ref) const;
 
  private:
-  TList*                           fListE;
+  TList*                           fListE;      //! Object container
 
   ClassDef(AliHFEcollection, 1)
 
index 608c05b..c8bcb2c 100644 (file)
@@ -43,8 +43,6 @@
 
 ClassImp(AliHFEcuts)
 
-const Int_t AliHFEcuts::kNcutSteps = 8;
-const Int_t AliHFEcuts::kNcutESDSteps = 6;
 //__________________________________________________________________
 AliHFEcuts::AliHFEcuts():
   fRequirements(0),
@@ -195,10 +193,10 @@ void AliHFEcuts::SetAcceptanceCutList(){
   accCuts->SetMinNHitTRD(12);
   if(IsInDebugMode()) accCuts->SetQAOn(fHistQA);
   
-  TObjArray *PartAccCuts = new TObjArray();
-  PartAccCuts->SetName("fPartAccCuts");
-  PartAccCuts->AddLast(accCuts);
-  fCutList->AddLast(PartAccCuts);
+  TObjArray *partAccCuts = new TObjArray();
+  partAccCuts->SetName("fPartAccCuts");
+  partAccCuts->AddLast(accCuts);
+  fCutList->AddLast(partAccCuts);
 }
 
 //__________________________________________________________________
@@ -275,13 +273,11 @@ void AliHFEcuts::SetRecPrimaryCutList(){
   //  No Kink daughters
   //
   AliCFTrackIsPrimaryCuts *primaryCut = new AliCFTrackIsPrimaryCuts("fCutsPrimaryCuts", "REC Primary Cuts");
-#ifdef V4_17_00
   if(IsRequireDCAToVertex()){
     primaryCut->SetDCAToVertex2D(kTRUE);
     primaryCut->SetMaxDCAToVertexXY(fDCAtoVtx[0]);
     primaryCut->SetMaxDCAToVertexZ(fDCAtoVtx[1]);
   }
-#endif
   if(IsRequireSigmaToVertex()){
     primaryCut->SetRequireSigmaToVertex(kTRUE);
     primaryCut->SetMaxNSigmaToVertex(fSigmaToVtx);
@@ -304,12 +300,10 @@ void AliHFEcuts::SetHFElectronITSCuts(){
   if(IsRequireITSpixel()){
     hfecuts->SetRequireITSpixel(AliHFEextraCuts::ITSPixel_t(fCutITSPixel));
   }
-#ifndef V4_17_00
   if(IsRequireDCAToVertex()){
     hfecuts->SetMaxImpactParamR(fDCAtoVtx[0]);
     hfecuts->SetMaxImpactParamZ(fDCAtoVtx[1]);
   }
-#endif
   
   if(IsInDebugMode()) hfecuts->SetQAOn(fHistQA);
   
index 9bf43f5..e527f0f 100644 (file)
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
-#ifndef __ALIHFECUTS_H__
-#define __ALIHFECUTS_H__
+#ifndef ALIHFECUTS_H
+#define ALIHFECUTS_H
 
 #ifndef ROOT_TObject
 #include <TObject.h>
 #endif
 
-#ifndef __ALIHFELECTRONEXTRACUTS_H__
+#ifndef ALIHFEEXTRACUTS_H
 #include "AliHFEextraCuts.h"
 #endif
 
@@ -42,107 +42,108 @@ class AliHFEcuts : public TObject{
     kITSPixel = 4,
     kMaxImpactParam = 5
   } Require_t;
- public:
 
-  typedef enum{
-    kStepMCGenerated = 0,
-    kStepMCInAcceptance = 1,
-    kStepRecKineTPC = 2,
-    kStepRecKineITS = 3,
-    kStepRecPrim = 4,
-    kStepHFEcutsITS = 5,
-    kStepHFEcutsTPC = 6,
-    kStepHFEcutsTRD = 7
-   } CutStep_t;
-
-  static const Int_t kNcutSteps;
-  static const Int_t kNcutESDSteps;
-
-  AliHFEcuts();
-  AliHFEcuts(const AliHFEcuts &c);
-  AliHFEcuts &operator=(const AliHFEcuts &c);
-  ~AliHFEcuts();
+  public:
+    typedef enum{
+      kStepMCGenerated = 0,
+      kStepMCInAcceptance = 1,
+      kStepRecKineTPC = 2,
+      kStepRecKineITS = 3,
+      kStepRecPrim = 4,
+      kStepHFEcutsITS = 5,
+      kStepHFEcutsTPC = 6,
+      kStepHFEcutsTRD = 7
+    } CutStep_t;
+    enum{
+      kNcutSteps = 8,
+      kNcutESDSteps = 6
+    };    // Additional constants
+
+    AliHFEcuts();
+    AliHFEcuts(const AliHFEcuts &c);
+    AliHFEcuts &operator=(const AliHFEcuts &c);
+    ~AliHFEcuts();
     
-  void Initialize(AliCFManager *cfm);
-  void Initialize();
-
-  Bool_t CheckParticleCuts(CutStep_t step, TObject *o);
+    void Initialize(AliCFManager *cfm);
+    void Initialize();
 
-  TList *GetQAhistograms() const { return fHistQA; }
-    
-  void SetDebugMode();
-  void UnsetDebugMode() { SetBit(kDebugMode, kFALSE); }
-  Bool_t IsInDebugMode() const { return TestBit(kDebugMode); };
+    Bool_t CheckParticleCuts(CutStep_t step, TObject *o);
+  
+    TList *GetQAhistograms() const { return fHistQA; }
     
-  // Getters
-  Bool_t IsRequireITSpixel() const { return TESTBIT(fRequirements, kITSPixel); };
-  Bool_t IsRequireMaxImpactParam() const { return TESTBIT(fRequirements, kMaxImpactParam); };
-  Bool_t IsRequirePrimary() const { return TESTBIT(fRequirements, kPrimary); };
-  Bool_t IsRequireProdVertex() const { return TESTBIT(fRequirements, kProductionVertex); };
-  Bool_t IsRequireSigmaToVertex() const { return TESTBIT(fRequirements, kSigmaToVertex); };
-  Bool_t IsRequireDCAToVertex() const {return TESTBIT(fRequirements, kDCAToVertex); };
+    void SetDebugMode();
+    void UnsetDebugMode() { SetBit(kDebugMode, kFALSE); }
+    Bool_t IsInDebugMode() const { return TestBit(kDebugMode); };
     
-  // Setters
-  inline void SetCutITSpixel(UChar_t cut);
-  void SetMinNClustersTPC(UChar_t minClustersTPC) { fMinClustersTPC = minClustersTPC; }
-  void SetMinNTrackletsTRD(UChar_t minNtrackletsTRD) { fMinTrackletsTRD = minNtrackletsTRD; }
-  void SetMaxChi2perClusterTPC(Double_t chi2) { fMaxChi2clusterTPC = chi2; };
-  inline void SetMaxImpactParam(Double_t radial, Double_t z);
-  void SetMinRatioTPCclusters(Double_t minRatioTPC) { fMinClusterRatioTPC = minRatioTPC; };
-  void SetPtRange(Double_t ptmin, Double_t ptmax){fPtRange[0] = ptmin; fPtRange[1] = ptmax;};
-  inline void SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax);
-  inline void SetSigmaToVertex(Double_t sig);
+    // Getters
+    Bool_t IsRequireITSpixel() const { return TESTBIT(fRequirements, kITSPixel); };
+    Bool_t IsRequireMaxImpactParam() const { return TESTBIT(fRequirements, kMaxImpactParam); };
+    Bool_t IsRequirePrimary() const { return TESTBIT(fRequirements, kPrimary); };
+    Bool_t IsRequireProdVertex() const { return TESTBIT(fRequirements, kProductionVertex); };
+    Bool_t IsRequireSigmaToVertex() const { return TESTBIT(fRequirements, kSigmaToVertex); };
+    Bool_t IsRequireDCAToVertex() const {return TESTBIT(fRequirements, kDCAToVertex); };
     
-  inline void CreateStandardCuts();
+    // Setters
+    inline void SetCutITSpixel(UChar_t cut);
+    void SetMinNClustersTPC(UChar_t minClustersTPC) { fMinClustersTPC = minClustersTPC; }
+    void SetMinNTrackletsTRD(UChar_t minNtrackletsTRD) { fMinTrackletsTRD = minNtrackletsTRD; }
+    void SetMaxChi2perClusterTPC(Double_t chi2) { fMaxChi2clusterTPC = chi2; };
+    inline void SetMaxImpactParam(Double_t radial, Double_t z);
+    void SetMinRatioTPCclusters(Double_t minRatioTPC) { fMinClusterRatioTPC = minRatioTPC; };
+    void SetPtRange(Double_t ptmin, Double_t ptmax){fPtRange[0] = ptmin; fPtRange[1] = ptmax;};
+    inline void SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax);
+    inline void SetSigmaToVertex(Double_t sig);
     
-  // Requirements
-  void SetRequireDCAToVertex() { SETBIT(fRequirements, kDCAToVertex); };
-  void SetRequireIsPrimary() { SETBIT(fRequirements, kPrimary); };
-  void SetRequireITSPixel() { SETBIT(fRequirements, kITSPixel); }
-  void SetRequireProdVertex() { SETBIT(fRequirements, kProductionVertex); };
-  void SetRequireSigmaToVertex() { SETBIT(fRequirements, kSigmaToVertex); };
-
-  void SetDebugLevel(Int_t level) { fDebugLevel = level; };
-  Int_t GetDebugLevel() const { return fDebugLevel; };
+    inline void CreateStandardCuts();
     
- private:
-  void SetParticleGenCutList();
-  void SetAcceptanceCutList();
-  void SetRecKineTPCCutList();
-  void SetRecKineITSCutList();
-  void SetRecPrimaryCutList();
-  void SetHFElectronITSCuts();
-  void SetHFElectronTPCCuts();
-  void SetHFElectronTRDCuts();
+    // Requirements
+    void SetRequireDCAToVertex() { SETBIT(fRequirements, kDCAToVertex); };
+    void SetRequireIsPrimary() { SETBIT(fRequirements, kPrimary); };
+    void SetRequireITSPixel() { SETBIT(fRequirements, kITSPixel); }
+    void SetRequireProdVertex() { SETBIT(fRequirements, kProductionVertex); };
+    void SetRequireSigmaToVertex() { SETBIT(fRequirements, kSigmaToVertex); };
+
+    void SetDebugLevel(Int_t level) { fDebugLevel = level; };
+    Int_t GetDebugLevel() const { return fDebugLevel; };
+
+  private:
+    void SetParticleGenCutList();
+    void SetAcceptanceCutList();
+    void SetRecKineTPCCutList();
+    void SetRecKineITSCutList();
+    void SetRecPrimaryCutList();
+    void SetHFElectronITSCuts();
+    void SetHFElectronTPCCuts();
+    void SetHFElectronTRDCuts();
   
-  ULong64_t fRequirements;     // Bitmap for requirements
-  Double_t fDCAtoVtx[2];       // DCA to Vertex
-  Double_t fProdVtx[4];        // Production Vertex
-  Double_t fPtRange[2];        // pt range
-  UChar_t fMinClustersTPC;     // Min.Number of TPC clusters
-  UChar_t fMinTrackletsTRD;    // Min. Number of TRD tracklets
-  UChar_t fCutITSPixel;        // Cut on ITS pixel
-  Double_t fMaxChi2clusterTPC; // Max Chi2 per TPC cluster
-  Double_t fMinClusterRatioTPC;        // Min. Ratio findable / found TPC clusters
-  Double_t fSigmaToVtx;        // Sigma To Vertex
+    ULong64_t fRequirements;     // Bitmap for requirements
+    Double_t fDCAtoVtx[2];           // DCA to Vertex
+    Double_t fProdVtx[4];              // Production Vertex
+    Double_t fPtRange[2];              // pt range
+    UChar_t fMinClustersTPC;       // Min.Number of TPC clusters
+    UChar_t fMinTrackletsTRD;      // Min. Number of TRD tracklets
+    UChar_t fCutITSPixel;              // Cut on ITS pixel
+    Double_t fMaxChi2clusterTPC;       // Max Chi2 per TPC cluster
+    Double_t fMinClusterRatioTPC;      // Min. Ratio findable / found TPC clusters
+    Double_t fSigmaToVtx;              // Sigma To Vertex
     
-  TList *fHistQA;              //! QA Histograms
-  TObjArray *fCutList; //! List of cut objects(Correction Framework Manager)
+    TList *fHistQA;                        //! QA Histograms
+    TObjArray *fCutList;               //! List of cut objects(Correction Framework Manager)
 
-  Int_t fDebugLevel;    // Debug Level
+    Int_t fDebugLevel;            // Debug Level
     
-  ClassDef(AliHFEcuts, 1)   // Container for HFE cuts
-    };
-
-    //__________________________________________________________________
-    void AliHFEcuts::SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax){
-      // Set the production vertex constraint
-      SetRequireProdVertex();
-      fProdVtx[0] = xmin;
-      fProdVtx[1] = xmax;
-      fProdVtx[2] = ymin;
-      fProdVtx[3] = ymax;
-    }
+  ClassDef(AliHFEcuts, 1)         // Container for HFE cuts
+};
+
+//__________________________________________________________________
+void AliHFEcuts::SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax){
+  // Set the production vertex constraint
+  SetRequireProdVertex();
+  fProdVtx[0] = xmin;
+  fProdVtx[1] = xmax;
+  fProdVtx[2] = ymin;
+  fProdVtx[3] = ymax;
+}
 
 //__________________________________________________________________
 void AliHFEcuts::SetSigmaToVertex(Double_t sig){
index dedbd79..8f62090 100644 (file)
@@ -30,6 +30,7 @@
 #include <TH2F.h>
 #include <TList.h>
 #include <TString.h>
+#include <TMath.h>
 
 #include "AliESDtrack.h"
 #include "AliLog.h"
@@ -47,6 +48,7 @@ AliHFEextraCuts::AliHFEextraCuts(const Char_t *name, const Char_t *title):
   fClusterRatioTPC(0.),
   fMinTrackletsTRD(0),
   fPixelITS(0),
+  fCheck(kTRUE),
   fQAlist(0x0),
   fDebugLevel(0)
 {
@@ -64,6 +66,7 @@ AliHFEextraCuts::AliHFEextraCuts(const AliHFEextraCuts &c):
   fClusterRatioTPC(c.fClusterRatioTPC),
   fMinTrackletsTRD(c.fMinTrackletsTRD),
   fPixelITS(c.fPixelITS),
+  fCheck(c.fCheck),
   fQAlist(0x0),
   fDebugLevel(c.fDebugLevel)
 {
@@ -91,6 +94,7 @@ AliHFEextraCuts &AliHFEextraCuts::operator=(const AliHFEextraCuts &c){
     fClusterRatioTPC = c.fClusterRatioTPC;
     fMinTrackletsTRD = c.fMinTrackletsTRD;
     fPixelITS = c.fPixelITS;
+    fCheck = c.fCheck;
     fDebugLevel = c.fDebugLevel;
 
     memcpy(fImpactParamCut, c.fImpactParamCut, sizeof(Float_t) * 4);
@@ -136,16 +140,12 @@ Bool_t AliHFEextraCuts::CheckESDCuts(AliESDtrack *track){
   ULong64_t survivedCut = 0;   // Bitmap for cuts which are passed by the track, later to be compared with fRequirements
   if(IsQAOn()) FillQAhistosESD(track, kBeforeCuts);
   // Apply cuts
-  Float_t impact_r, impact_z, ratioTPC;
-  track->GetImpactParameters(impact_r, impact_z);
+  Float_t impactR, impactZ, ratioTPC;
+  track->GetImpactParameters(impactR, impactZ);
   // printf("Check TPC findable clusters: %d, found Clusters: %d\n", track->GetTPCNclsF(), track->GetTPCNcls());
   ratioTPC = track->GetTPCNclsF() > 0. ? static_cast<Float_t>(track->GetTPCNcls())/static_cast<Float_t>(track->GetTPCNclsF()) : 1.;
   UChar_t trdTracklets;
-  #ifdef TRUNK
   trdTracklets = track->GetTRDntrackletsPID();
-  #else
-  trdTracklets = track->GetTRDpidQuality();
-  #endif  
   UChar_t itsPixel = track->GetITSClusterMap();
   Int_t det, status1, status2;
   Float_t xloc, zloc;
@@ -153,19 +153,19 @@ Bool_t AliHFEextraCuts::CheckESDCuts(AliESDtrack *track){
   track->GetITSModuleIndexInfo(1, det, status2, xloc, zloc);
   if(TESTBIT(fRequirements, kMinImpactParamR)){
     // cut on min. Impact Parameter in Radial direction
-    if(impact_r >= fImpactParamCut[0]) SETBIT(survivedCut, kMinImpactParamR);
+    if(TMath::Abs(impactR) >= fImpactParamCut[0]) SETBIT(survivedCut, kMinImpactParamR);
   }
   if(TESTBIT(fRequirements, kMinImpactParamZ)){
     // cut on min. Impact Parameter in Z direction
-    if(impact_z >= fImpactParamCut[1]) SETBIT(survivedCut, kMinImpactParamZ);
+    if(TMath::Abs(impactZ) >= fImpactParamCut[1]) SETBIT(survivedCut, kMinImpactParamZ);
   }
   if(TESTBIT(fRequirements, kMaxImpactParamR)){
     // cut on max. Impact Parameter in Radial direction
-    if(impact_r <= fImpactParamCut[2]) SETBIT(survivedCut, kMaxImpactParamR);
+    if(TMath::Abs(impactR) <= fImpactParamCut[2]) SETBIT(survivedCut, kMaxImpactParamR);
   }
   if(TESTBIT(fRequirements, kMaxImpactParamZ)){
     // cut on max. Impact Parameter in Z direction
-    if(impact_z <= fImpactParamCut[3]) SETBIT(survivedCut, kMaxImpactParamZ);
+    if(TMath::Abs(impactZ) <= fImpactParamCut[3]) SETBIT(survivedCut, kMaxImpactParamZ);
   }
   if(TESTBIT(fRequirements, kClusterRatioTPC)){
     // cut on min ratio of found TPC clusters vs findable TPC clusters
@@ -183,28 +183,66 @@ Bool_t AliHFEextraCuts::CheckESDCuts(AliESDtrack *track){
     }
     switch(fPixelITS){
       case kFirst: 
-          if(itsPixel & BIT(0)) 
-            SETBIT(survivedCut, kPixelITS);
-          else if(!CheckITSstatus(status1))
-            SETBIT(survivedCut, kPixelITS);
+       if(!TESTBIT(itsPixel, 0)) {
+         if(fCheck){
+           if(!CheckITSstatus(status1)) {
+             SETBIT(survivedCut, kPixelITS);
+           }
+         }
+       }
+       else {
+         SETBIT(survivedCut, kPixelITS);
+       }
                    break;
       case kSecond: 
-          if(itsPixel & BIT(1)) 
-            SETBIT(survivedCut, kPixelITS);
-          else if(!CheckITSstatus(status2))
-            SETBIT(survivedCut, kPixelITS);
+       if(!TESTBIT(itsPixel, 1)) {
+         if(fCheck) {
+           if(!CheckITSstatus(status2)) {
+             SETBIT(survivedCut, kPixelITS);
+           }
+         }
+       }
+       else { 
+         SETBIT(survivedCut, kPixelITS);
+       }
                    break;
       case kBoth: 
-          if((itsPixel & BIT(0)) && (itsPixel & BIT(1))) 
-            SETBIT(survivedCut, kPixelITS);
-          else if(!CheckITSstatus(status1) && !CheckITSstatus(status2))
-            SETBIT(survivedCut, kPixelITS);
-                   break;
+       if(!(TESTBIT(track->GetITSClusterMap(),0))) {
+         if(fCheck) {  
+           if(!CheckITSstatus(status1)) {
+             if(!(TESTBIT(track->GetITSClusterMap(),1))) {
+               if(!CheckITSstatus(status2)) {
+                 SETBIT(survivedCut, kPixelITS);
+               }
+             }
+             else SETBIT(survivedCut, kPixelITS);
+           }
+         }
+       }
+       else {
+         
+         if(!(TESTBIT(track->GetITSClusterMap(),1))) {
+           if(fCheck) {
+             if(!CheckITSstatus(status2)) {
+               SETBIT(survivedCut, kPixelITS);
+             }
+           }
+         }
+         else SETBIT(survivedCut, kPixelITS);
+       
+       }
+                  break;
       case kAny: 
-          if((itsPixel & BIT(0)) || (itsPixel & BIT(1))) 
-            SETBIT(survivedCut, kPixelITS);
-          else if(!CheckITSstatus(status1) || !CheckITSstatus(status2))
-            SETBIT(survivedCut, kPixelITS);
+       if((!TESTBIT(itsPixel, 0)) && (!TESTBIT(itsPixel, 1))){
+         if(fCheck){
+           if(!CheckITSstatus(status1) || (!CheckITSstatus(status2))) {
+             SETBIT(survivedCut, kPixelITS);
+           }
+         }
+       }
+       else { 
+         SETBIT(survivedCut, kPixelITS);
+       }
                    break;
       default: break;
     }
@@ -222,7 +260,7 @@ Bool_t AliHFEextraCuts::CheckESDCuts(AliESDtrack *track){
 }
 
 //______________________________________________________
-Bool_t AliHFEextraCuts::CheckMCCuts(AliMCParticle */*track*/){
+Bool_t AliHFEextraCuts::CheckMCCuts(AliMCParticle */*track*/) const {
   //
   // Checks cuts on Monte Carlo tracks
   // returns true if track is selected
@@ -239,17 +277,13 @@ void AliHFEextraCuts::FillQAhistosESD(AliESDtrack *track, UInt_t when){
   // Function can be called before cuts or after cut application (second argument)
   //
   TList *container = dynamic_cast<TList *>(fQAlist->At(when));
-  Float_t impact_r, impact_z;
-  track->GetImpactParameters(impact_r, impact_z);
-  (dynamic_cast<TH1F *>(container->At(0)))->Fill(impact_r);
-  (dynamic_cast<TH1F *>(container->At(1)))->Fill(impact_z);
+  Float_t impactR, impactZ;
+  track->GetImpactParameters(impactR, impactZ);
+  (dynamic_cast<TH1F *>(container->At(0)))->Fill(impactR);
+  (dynamic_cast<TH1F *>(container->At(1)))->Fill(impactZ);
   // printf("TPC findable clusters: %d, found Clusters: %d\n", track->GetTPCNclsF(), track->GetTPCNcls());
   (dynamic_cast<TH1F *>(container->At(2)))->Fill(track->GetTPCNclsF() > 0. ? static_cast<Float_t>(track->GetTPCNcls())/static_cast<Float_t>(track->GetTPCNclsF()) : 1.);
-  #ifdef TRUNK
   (dynamic_cast<TH1F *>(container->At(3)))->Fill(track->GetTRDntrackletsPID());
-  #else
-  (dynamic_cast<TH1F *>(container->At(3)))->Fill(track->GetTRDpidQuality());
-  #endif
   UChar_t itsPixel = track->GetITSClusterMap();
   TH1 *pixelHist = dynamic_cast<TH1F *>(container->At(4));
   Int_t firstEntry = pixelHist->GetXaxis()->GetFirst();
@@ -357,7 +391,7 @@ void AliHFEextraCuts::PrintBitMap(Int_t bitmap){
 }
 
 //______________________________________________________
-Bool_t AliHFEextraCuts::CheckITSstatus(Int_t itsStatus){
+Bool_t AliHFEextraCuts::CheckITSstatus(Int_t itsStatus) const {
   //
   // Check whether ITS area is dead
   //
index 6aadae9..6978a4e 100644 (file)
@@ -12,8 +12,8 @@
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
-#ifndef __ALIHFEEXTRACUTS_H__
-#define __ALIHFEEXTRACUTS_H__
+#ifndef ALIHFEEXTRACUTS_H
+#define ALIHFEEXTRACUTS_H
 
 // #ifndef ALICFCUTBASE_H
 #include "AliCFCutBase.h"
@@ -36,7 +36,7 @@ class AliHFEextraCuts : public AliCFCutBase{
     AliHFEextraCuts(const Char_t *name, const Char_t *title);
     AliHFEextraCuts(const AliHFEextraCuts &c);
     AliHFEextraCuts &operator=(const AliHFEextraCuts &c);
-    ~AliHFEextraCuts();
+    virtual ~AliHFEextraCuts();
     
     virtual Bool_t IsSelected(TObject *o);
     virtual Bool_t IsSelected(TList *) { return kTRUE; };
@@ -49,14 +49,17 @@ class AliHFEextraCuts : public AliCFCutBase{
     inline void SetMaxImpactParamZ(Double_t impactParam);
     inline void SetMinTrackletsTRD(Int_t minTracklets);
 
+    void SetCheckITSstatus(Bool_t check) { fCheck = check; };
+    Bool_t GetCheckITSstatus() const { return fCheck; };
+
     void SetDebugLevel(Int_t level) { fDebugLevel = level; };
     Int_t GetDebugLevel() const { return fDebugLevel; };
     
   protected:
     virtual void AddQAHistograms(TList *qaList);
     Bool_t CheckESDCuts(AliESDtrack *track);
-    Bool_t CheckMCCuts(AliMCParticle */*track*/);
-    Bool_t CheckITSstatus(Int_t itsStatus);
+    Bool_t CheckMCCuts(AliMCParticle * /*track*/) const;
+    Bool_t CheckITSstatus(Int_t itsStatus) const;
     void FillQAhistosESD(AliESDtrack *track, UInt_t when);
 //     void FillQAhistosMC(AliMCParticle *track, UInt_t when);
     void FillCutCorrelation(ULong64_t survivedCut);
@@ -86,6 +89,8 @@ class AliHFEextraCuts : public AliCFCutBase{
     Float_t fClusterRatioTPC;          // Ratio of findable vs. found clusters in TPC
     UChar_t fMinTrackletsTRD;          // Min. Number of Tracklets inside TRD
     UChar_t fPixelITS;                 // Cut on ITS Pixels
+
+    Bool_t  fCheck;                     // check
     
     TList *fQAlist;                    //! Directory for QA histograms
   
@@ -115,13 +120,13 @@ void AliHFEextraCuts::SetMinImpactParamR(Double_t impactParam){
 //__________________________________________________________
 void AliHFEextraCuts::SetMaxImpactParamR(Double_t impactParam){
   SETBIT(fRequirements, kMaxImpactParamR);
-  fImpactParamCut[1] = impactParam;
+  fImpactParamCut[2] = impactParam;
 }
 
 //__________________________________________________________
 void AliHFEextraCuts::SetMinImpactParamZ(Double_t impactParam){
   SETBIT(fRequirements, kMinImpactParamZ);
-  fImpactParamCut[2] = impactParam;
+  fImpactParamCut[1] = impactParam;
 }
 
 //__________________________________________________________
index 95a360e..863f634 100644 (file)
@@ -412,7 +412,7 @@ void AliHFEmcQA::GetHadronKine(Int_t iTrack, const Int_t kquark)
     Int_t pdgcodeCopy = pdgcode;
 
     // if the mother is charmed hadron  
-    Bool_t IsDirectCharm = kFALSE;
+    Bool_t isDirectCharm = kFALSE;
     if ( int(abs(pdgcode)/100.) == kCharm || int(abs(pdgcode)/1000.) == kCharm ) {
 
           // iterate until you find B hadron as a mother or become top ancester 
@@ -420,7 +420,7 @@ void AliHFEmcQA::GetHadronKine(Int_t iTrack, const Int_t kquark)
 
              Int_t jLabel = mcpart->GetFirstMother();
              if (jLabel == -1){
-               IsDirectCharm = kTRUE;
+               isDirectCharm = kTRUE;
                break; // if there is no ancester
              }
              if (jLabel < 0){ // safety protection
@@ -438,7 +438,7 @@ void AliHFEmcQA::GetHadronKine(Int_t iTrack, const Int_t kquark)
              mcpart = mother;
           } // end of iteration 
     } // end of if
-    if((IsDirectCharm == kTRUE && kquark == kCharm) || kquark == kBeauty) {
+    if((isDirectCharm == kTRUE && kquark == kCharm) || kquark == kBeauty) {
          for (Int_t i=0; i<fNparents; i++){
             if (abs(pdgcodeCopy)==fParentSelect[iq][i]){
 
@@ -572,18 +572,18 @@ void AliHFEmcQA::GetDecayedKine(Int_t iTrack, const Int_t kquark, Int_t kdecayed
 
 
 //__________________________________________
-void AliHFEmcQA::IdentifyMother(Int_t mother_label, Int_t &mother_pdg, Int_t &grandmother_label)
+void AliHFEmcQA::IdentifyMother(Int_t motherlabel, Int_t &motherpdg, Int_t &grandmotherlabel)
 {
        // find mother pdg code and label 
 
-       if (mother_label < 0) { 
+       if (motherlabel < 0) { 
          AliDebug(1, "Stack label is negative, return\n");
          return; 
        }
-       TParticle *heavysMother = fStack->Particle(mother_label);
-       mother_pdg = heavysMother->GetPdgCode();
-       grandmother_label = heavysMother->GetFirstMother();
-       AliDebug(1,Form("ancestor pdg code= %d\n",mother_pdg));
+       TParticle *heavysMother = fStack->Particle(motherlabel);
+       motherpdg = heavysMother->GetPdgCode();
+       grandmotherlabel = heavysMother->GetFirstMother();
+       AliDebug(1,Form("ancestor pdg code= %d\n",motherpdg));
 }
 
 //__________________________________________
@@ -675,4 +675,3 @@ Float_t AliHFEmcQA::GetRapidity(TParticle *part)
        else rapidity = 0.5*(TMath::Log((part->Energy()+part->Pz()) / (part->Energy()-part->Pz()))); 
        return rapidity;
 }
-
index 9c2191d..b0206f2 100644 (file)
@@ -29,7 +29,7 @@
 #define ALIHFEMCQA_H
 
 #ifndef ROOT_TObject
-#include <TObject.h>
+//#include <TObject.h>
 #endif
 
 class TH1F;
@@ -61,7 +61,7 @@ class AliHFEmcQA: public TObject {
                 void EndOfEventAna(const Int_t kquark); // run analysis which should be done at the end of the event loop
 
         protected:
-                void IdentifyMother(Int_t mother_label, Int_t &mother_pdg, Int_t &grandmother_label); // 
+                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
                 Bool_t IsFromInitialShower(Int_t inputmotherlabel, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // check if the quark is produced from initial parton shower 
@@ -76,28 +76,76 @@ class AliHFEmcQA: public TObject {
                 static const Int_t fgkqType; // number of particle type to be checked
 
 
-                enum ProcessType_t
+                enum ProcessType
                         {
                         kPairCreationFromq,  kPairCreationFromg,  kFlavourExitation,  kGluonSplitting, kInitialPartonShower, kLightQuarkShower
                         };
 
-                struct hists{
+                struct AliHists{
                         TH1F *fPdgCode; // histogram to store particle pdg code
                         TH1F *fPt; // histogram to store pt
                         TH1F *fY; // histogram to store rapidity
                         TH1F *fEta; // histogram to store eta
+
+                       AliHists()
+                         : fPdgCode()
+                         , fPt()
+                         , fY()
+                         , fEta()
+                        {
+                         // default constructor
+                       };
+                       AliHists(const AliHists & p)
+                         : fPdgCode(p.fPdgCode)
+                         , fPt(p.fPt)
+                         , fY(p.fY)
+                         , fEta(p.fEta)
+                        {
+                         // copy constructor
+                       };
+                       AliHists &operator=(const AliHists &)
+                       {
+                         // assignment operator, not yet implemented 
+                         return *this;
+                       }
                 };
-                struct histsComm {
+                struct AliHistsComm {
                         TH1F *fNq; // histogram to store number of quark
                         TH1F *fProcessID; // histogram to store process id 
                         TH2F *fePtRatio; // fraction of electron pT from D or B hadron
                         TH2F *fDePtRatio; // fraction of D electron pT from B hadron 
                         TH2F *feDistance; // distance between electron production point to mother particle 
                         TH2F *fDeDistance; // distance between D electron production point to mother particle
+
+                       AliHistsComm()
+                         : fNq()
+                         , fProcessID()
+                         , fePtRatio()
+                         , fDePtRatio()
+                         , feDistance()
+                         , fDeDistance()
+                        {
+                         // default constructor
+                       };
+                       AliHistsComm(const AliHistsComm & p)
+                         : fNq(p.fNq)
+                         , fProcessID(p.fProcessID)
+                         , fePtRatio(p.fePtRatio)
+                         , fDePtRatio(p.fDePtRatio)
+                         , feDistance(p.feDistance)
+                         , fDeDistance(p.fDeDistance)
+                        {
+                         // copy constructor
+                       };
+                       AliHistsComm &operator=(const AliHistsComm &)
+                       {
+                         // assignment operator, not yet implemented 
+                         return *this;
+                       }
                 };
 
-                hists fHist[2][7][5]; // struct of histograms to store kinematics of given particles
-                histsComm fHistComm[2][5]; // struct of additional histograms of given particles
+                AliHists fHist[2][7][5]; // struct of histograms to store kinematics of given particles
+                AliHistsComm fHistComm[2][5]; // struct of additional histograms of given particles
 
                 TParticle *fHeavyQuark[50]; // store pointer of heavy flavour quark 
                 Int_t fIsHeavy[2]; // count of heavy flavour
@@ -105,8 +153,7 @@ class AliHFEmcQA: public TObject {
                 Int_t fParentSelect[2][7]; // heavy hadron species
 
 
-        ClassDef(AliHFEmcQA,0);  // QA for MC electrons
+        ClassDef(AliHFEmcQA,0);
 };
 
 #endif
-
index ef26747..380d3c3 100644 (file)
@@ -22,6 +22,8 @@
  *                                                                      *
  ************************************************************************/
 #include <TClass.h>
+#include <THnSparse.h>
+#include <TH3F.h>
 #include <TIterator.h>
 #include <TList.h>
 #include <TObjArray.h>
 #include <TString.h>
 
 #include "AliESDtrack.h"
+#include "AliLog.h"
+#include "AliPID.h"
 
 #include "AliHFEpid.h"
 #include "AliHFEpidBase.h"
+#include "AliHFEpidITS.h"
 #include "AliHFEpidTPC.h"
 #include "AliHFEpidTRD.h"
 #include "AliHFEpidTOF.h"
@@ -111,10 +116,11 @@ AliHFEpid::~AliHFEpid(){
   //
   // Destructor
   //
-  if(fQAlist) delete fQAlist; fQAlist = 0x0;  // Each detector has to care about its Histograms
   for(Int_t idet = 0; idet < kNdetectorPID; idet++){
-    if(fDetectorPID[idet]) delete fDetectorPID[idet];
-  }
+    if(fDetectorPID[idet])
+      delete fDetectorPID[idet];
+  } 
+  if(fQAlist) delete fQAlist; fQAlist = 0x0;  // Each detector has to care about its Histograms
 }
 
 //____________________________________________________________
@@ -125,8 +131,11 @@ Bool_t AliHFEpid::InitializePID(TString detectors){
   // + Initializes Detector PID objects
   // + Handles QA
   //
+  AliInfo(Form("Doing InitializePID for Detectors %s", detectors.Data()));
   fDetectorPID[kMCpid] = new AliHFEpidMC("Monte Carlo PID"); // Always there
+  fDetectorPID[kITSpid] = new AliHFEpidITS("ITS development PID");  // Development version of the ITS pid, for the moment always there
   SETBIT(fEnabledDetectors, kMCpid);
+  SETBIT(fEnabledDetectors, kITSpid);
   
   TObjArray *detsEnabled = detectors.Tokenize(":");
   TIterator *detIterator = detsEnabled->MakeIterator();
@@ -162,16 +171,21 @@ Bool_t AliHFEpid::IsSelected(AliVParticle *track){
   // Steers PID decision for single detectors respectively combined
   // PID decision
   //
-  
   if(TString(track->IsA()->GetName()).CompareTo("AliMCparticle") == 0){
     return (TMath::Abs(fDetectorPID[kMCpid]->IsSelected(track)) == 11);
   }
   if(TString(track->IsA()->GetName()).CompareTo("AliESDtrack") == 0){
-    if(TESTBIT(fEnabledDetectors, kTPCpid) && TESTBIT(fEnabledDetectors, kTOFpid)){
-      // case TPC-TOF
-      return MakePID_TPC_TOF(dynamic_cast<AliESDtrack *>(track));
-    } else if(TESTBIT(fEnabledDetectors, kTPCpid)){
-      return (TMath::Abs(fDetectorPID[kTPCpid]->IsSelected(track)) ==11);
+    if(TESTBIT(fEnabledDetectors, kTPCpid)){
+      if(IsQAOn()) 
+        MakePlotsItsTpc(dynamic_cast<AliESDtrack *>(track));  // First fill the QA histograms
+      if(TESTBIT(fEnabledDetectors, kTOFpid)){
+        // case TPC-TOF
+        return MakePidTpcTof(dynamic_cast<AliESDtrack *>(track));
+      } else if(TESTBIT(fEnabledDetectors, kTRDpid)){
+        // case TPC-TRD with low level detector Signals
+        return MakePidTpcTrd(dynamic_cast<AliESDtrack *>(track));
+      } else
+        return (TMath::Abs(fDetectorPID[kTPCpid]->IsSelected(track)) ==11);
     } else if(TESTBIT(fEnabledDetectors, kTRDpid)){
       return (TMath::Abs(fDetectorPID[kTRDpid]->IsSelected(track)) ==11);
     } else if(TESTBIT(fEnabledDetectors, kTOFpid)){
@@ -183,7 +197,7 @@ Bool_t AliHFEpid::IsSelected(AliVParticle *track){
 }
 
 //____________________________________________________________
-Bool_t AliHFEpid::MakePID_TPC_TOF(AliESDtrack *track){
+Bool_t AliHFEpid::MakePidTpcTof(AliESDtrack *track){
   //
   // Combines TPC and TOF PID decision
   //
@@ -192,16 +206,119 @@ Bool_t AliHFEpid::MakePID_TPC_TOF(AliESDtrack *track){
 }
 
 //____________________________________________________________
+Bool_t AliHFEpid::MakePidTpcTrd(AliESDtrack *track){
+  //
+  // Combination of TPC and TRD PID
+  // Fills Histograms TPC Signal vs. TRD signal for different
+  // momentum slices
+  //
+  Double_t content[10];
+  content[0] = -1;
+  content[1] = track->P();
+  content[2] = track->GetTPCsignal();
+  AliHFEpidTRD *trdPid = dynamic_cast<AliHFEpidTRD *>(fDetectorPID[kTRDpid]);
+  content[3] = trdPid->GetTRDSignalV1(track);
+  content[4] = trdPid->GetTRDSignalV2(track);
+  AliDebug(1, Form("Momentum: %f, TRD Signal: Method 1[%f], Method 2[%f]", content[1], content[3], content[4]));
+  if(IsQAOn()){
+    if(HasMCData()){
+      // Fill My Histograms for MC PID
+      Int_t pdg = TMath::Abs(fDetectorPID[kMCpid]->IsSelected(track));
+      Int_t pid = -1;
+      switch(pdg){
+        case 11:    pid = AliPID::kElectron; break;
+        case 13:    pid = AliPID::kMuon; break;
+        case 211:   pid = AliPID::kPion; break;
+        case 321:   pid = AliPID::kKaon; break;
+        case 2212:  pid = AliPID::kProton; break;
+        default:    pid = -1;
+      };
+      content[0] = pid;
+    }
+    (dynamic_cast<THnSparse *>(fQAlist->At(kTRDSignal)))->Fill(content);
+  }
+  return trdPid->IsSelected(track);
+}
+
+//____________________________________________________________
+void AliHFEpid::MakePlotsItsTpc(AliESDtrack *track){
+  //
+  // Make a plot ITS signal - TPC signal for several momentum bins
+  //
+  Double_t content[10];
+  content[0] = -1;
+  content[1] = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->P() : track->P();
+  content[2] = (dynamic_cast<AliHFEpidITS *>(fDetectorPID[kITSpid]))->GetITSSignalV1(track);
+  content[3] = track->GetTPCsignal();
+  AliDebug(1, Form("Momentum %f, TPC Signal %f, ITS Signal %f", content[1], content[2], content[3]));
+  if(HasMCData()){
+    // Fill My Histograms for MC PID
+    Int_t pdg = TMath::Abs(fDetectorPID[kMCpid]->IsSelected(track));
+    Int_t pid = -1;
+    switch(pdg){
+      case 11:    pid = AliPID::kElectron; break;
+      case 13:    pid = AliPID::kMuon; break;
+      case 211:   pid = AliPID::kPion; break;
+      case 321:   pid = AliPID::kKaon; break;
+      case 2212:  pid = AliPID::kProton; break;
+      default:    pid = -1;
+    };
+    content[0] = pid;
+  }
+  (dynamic_cast<THnSparse *>(fQAlist->At(kITSSignal)))->Fill(content);
+}
+
+//____________________________________________________________
 void AliHFEpid::SetQAOn(){
   //
   // Switch on QA
   //
-  SetBit(kIsQAOn);
+  SetBit(kIsQAOn, kTRUE);
+  if(fQAlist) return;
   fQAlist = new TList;
   fQAlist->SetName("PIDqa");
+  THnSparseF *histo = NULL;
+
+  // Prepare axis for QA histograms
+  const Int_t kMomentumBins = 41;
+  const Double_t kPtMin = 0.1;
+  const Double_t kPtMax = 10.;
+  Double_t momentumBins[kMomentumBins];
+  for(Int_t ibin = 0; ibin < kMomentumBins; ibin++)
+    momentumBins[ibin] = static_cast<Double_t>(TMath::Power(10,TMath::Log10(kPtMin) + (TMath::Log10(kPtMax)-TMath::Log10(kPtMin))/(kMomentumBins-1)*static_cast<Double_t>(ibin)));
+
+  // Add Histogram for combined TPC-TRD PID
+  const Int_t kDimensionsTRDsig = 5;
+  Int_t kNbinsTRDsig[kDimensionsTRDsig] = {AliPID::kSPECIES + 1, kMomentumBins - 1, 200, 3000, 3000};
+  Double_t binMinTRDsig[kDimensionsTRDsig] = {-1., 0.1, 0, 0, 0};
+  Double_t binMaxTRDsig[kDimensionsTRDsig] = {AliPID::kSPECIES, 10., 200., 3000., 3000.};
+  fQAlist->AddAt((histo = new THnSparseF("fCombTPCTRDpid", "Combined TPC-TRD PID", kDimensionsTRDsig, kNbinsTRDsig, binMinTRDsig, binMaxTRDsig)), kTRDSignal);
+  histo->GetAxis(1)->Set(kMomentumBins - 1, momentumBins);
+  histo->GetAxis(0)->SetTitle("Particle Species");
+  histo->GetAxis(1)->SetTitle("p / GeV/c");
+  histo->GetAxis(2)->SetTitle("TPC Signal / a.u.");
+  histo->GetAxis(3)->SetTitle("TRD Signal / a.u.");
+  histo->GetAxis(4)->SetTitle("TRD Signal / a.u.");
+
+  // Add Histogram for combined TPC-ITS PID
+  const Int_t kDimensionsITSsig = 4;
+  Int_t kNbinsITSsig[kDimensionsITSsig] = {AliPID::kSPECIES + 1, kMomentumBins - 1, 200, 1000};
+  Double_t binMinITSsig[kDimensionsITSsig] = {-1., 0.1, 0., 0.};
+  Double_t binMaxITSsig[kDimensionsITSsig] = {AliPID::kSPECIES, 10., 200., 300.};
+  fQAlist->AddAt((histo = new THnSparseF("fCombTPCITSpid", "Combined TPC-ITS PID", kDimensionsITSsig, kNbinsITSsig, binMinITSsig, binMaxITSsig)), kITSSignal);
+  histo->GetAxis(0)->Set(kMomentumBins - 1, momentumBins);
+  histo->GetAxis(0)->SetTitle("Particle Species");
+  histo->GetAxis(1)->SetTitle("p / GeV/c");
+  histo->GetAxis(2)->SetTitle("TPC Signal / a.u.");
+  histo->GetAxis(3)->SetTitle("ITS Signal / a.u.");
 }
 
+//____________________________________________________________
 void AliHFEpid::SetMCEvent(AliMCEvent *event){
+  //
+  // Set MC Event for the detector PID classes
+  //
   for(Int_t idet = 0; idet < kNdetectorPID; idet++)
     if(fDetectorPID[idet]) fDetectorPID[idet]->SetMCEvent(event);
 }
+
index 90a57b9..b805662 100644 (file)
@@ -12,8 +12,8 @@
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
-#ifndef __ALIHFEPID_H__
-#define __ALIHFEPID_H__
+#ifndef ALIHFEPID_H
+#define ALIHFEPID_H
 
 #ifndef ROOT_TObject
 #include <TObject.h>
@@ -34,10 +34,18 @@ class AliHFEpid : public TObject{
   enum{
     kMCpid = 0,
     kESDpid = 1,
-    kTPCpid = 2,
-    kTRDpid = 3,
-    kTOFpid = 4,
-    kNdetectorPID = 5
+    kITSpid = 2,
+    kTPCpid = 3,
+    kTRDpid = 4,
+    kTOFpid = 5,
+    kNdetectorPID = 6
+  };
+  enum{
+    kCombinedTPCTRD=0
+  };
+  enum{
+    kTRDSignal = 0,
+    kITSSignal = 1
   };
   public:
     AliHFEpid();
@@ -56,7 +64,9 @@ class AliHFEpid : public TObject{
     TList *GetQAhistograms() const { return fQAlist; };
 
   protected:
-    Bool_t MakePID_TPC_TOF(AliESDtrack *track);
+    Bool_t MakePidTpcTof(AliESDtrack *track);
+    Bool_t MakePidTpcTrd(AliESDtrack *track);
+    void MakePlotsItsTpc(AliESDtrack *track);
   private:
     AliHFEpidBase *fDetectorPID[kNdetectorPID];    //! Detector PID classes
     UInt_t fEnabledDetectors;             // Enabled Detectors
index 6118013..87f2fe1 100644 (file)
@@ -65,7 +65,7 @@ AliHFEpidBase &AliHFEpidBase::operator=(const AliHFEpidBase &ref){
   }
 
   return *this;
-  }
+}
 
 //___________________________________________________________________
 void AliHFEpidBase::Copy(TObject &ref) const {
@@ -86,7 +86,7 @@ Int_t AliHFEpidBase::GetPdgCode(AliVParticle *track){
   AliMCParticle *mctrack = 0x0;
   if(TString(track->IsA()->GetName()).CompareTo("AliESDtrack") == 0)
     mctrack = fMCEvent->GetTrack(TMath::Abs((dynamic_cast<AliESDtrack *>(track))->GetLabel()));
-  else if(TString(track->IsA()->GetName()).CompareTo("AliESDtrack") == 0)
+  else if(TString(track->IsA()->GetName()).CompareTo("AliMCParticle") == 0)
     mctrack = dynamic_cast<AliMCParticle *>(track);
   if(!mctrack) return 0;
   return mctrack->Particle()->GetPdgCode();
index 4f070e1..46f65b1 100644 (file)
@@ -12,8 +12,8 @@
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
-#ifndef __ALIHFEPIDBASE_H__
-#define __ALIHFEPIDBASE_H__
+#ifndef ALIHFEPIDBASE_H
+#define ALIHFEPIDBASE_H
  
  #ifndef ROOT_TNamed
  #include <TNamed.h>
index b231847..d88105d 100644 (file)
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
-#ifndef __ALIHFEPIDMC_H__
-#define __ALIHFEPIDMC_H__
+#ifndef ALIHFEPIDMC_H
+#define ALIHFEPIDMC_H
 
- #ifndef __ALIHFEPIDBASE_H__
+ #ifndef ALIHFEPIDBASE_H
  #include "AliHFEpidBase.h"
  #endif
 
index a27579c..967ee7f 100644 (file)
@@ -93,7 +93,7 @@ Bool_t AliHFEpidTOF::InitializePID(){
 }
 
 //___________________________________________________________________
-Int_t AliHFEpidTOF::IsSelected(AliVParticle *_track)
+Int_t AliHFEpidTOF::IsSelected(AliVParticle *vtrack)
 {
 
   //
@@ -105,7 +105,7 @@ Int_t AliHFEpidTOF::IsSelected(AliVParticle *_track)
   // returns 10 (== kUnknown)if PID can not be assigned
   //
 
-  AliESDtrack *track = dynamic_cast<AliESDtrack*>(_track);
+  AliESDtrack *track = dynamic_cast<AliESDtrack*>(vtrack);
   Long_t status = 0;
   status = track->GetStatus(); 
 
@@ -130,13 +130,13 @@ Int_t AliHFEpidTOF::IsSelected(AliVParticle *_track)
   (dynamic_cast<TH1F *>(fQAList->At(kHistTOFlength)))->Fill(tItrackL);
   // get the TOF pid probabilities
   Double_t tESDpid[5] = {0., 0., 0., 0., 0.};
-  Float_t tTOFpid_sum = 0.;
+  Float_t tTOFpidSum = 0.;
   // find the largest PID probability
   track->GetTOFpid(tESDpid);
   Double_t tMAXpid = 0.;
   Int_t tMAXindex = -1;
   for(Int_t i=0; i<5; ++i){
-    tTOFpid_sum += tESDpid[i];
+    tTOFpidSum += tESDpid[i];
     if(tESDpid[i] > tMAXpid){
       tMAXpid = tESDpid[i];
       tMAXindex = i;
@@ -146,12 +146,12 @@ Int_t AliHFEpidTOF::IsSelected(AliVParticle *_track)
   Double_t p = track->GetOuterParam()->P();
   Double_t beta = (tItrackL/100.)/(TMath::C()*(tTOFsignal/1e12));
   
-  if(TMath::Abs(tTOFpid_sum - 1) > 0.01) return AliPID::kUnknown;
+  if(TMath::Abs(tTOFpidSum - 1) > 0.01) return AliPID::kUnknown;
   else{
     // should be the same as AliPID flags
     
-    (dynamic_cast<TH2F *>(fQAList->At(kHistTOFpid_0+tMAXindex)))->Fill(beta, p);
-    (dynamic_cast<TH2F *>(fQAList->At(kHistTOFpid_beta_v_P)))->Fill(beta, p);
+    (dynamic_cast<TH2F *>(fQAList->At(kHistTOFpid0+tMAXindex)))->Fill(beta, p);
+    (dynamic_cast<TH2F *>(fQAList->At(kHistTOFpidBetavP)))->Fill(beta, p);
     return tMAXindex;
   }
 }
@@ -165,14 +165,14 @@ void AliHFEpidTOF::AddQAhistograms(TList *qaList){
   fQAList = new TList;
   fQAList->SetName("fTOFqaHistos");
   fQAList->AddAt(new TH1F("hTOF_flags", "TOF flags;flags (see code for info);counts", 10, -0.25, 4.75), kHistTOFpidFlags);
-  fQAList->AddAt(new TH2F("fTOFbeta_v_P_no","beta -v- P; beta;momentum [GeV/c]", 120, 0, 1.2, 200, 0, 20), kHistTOFpid_beta_v_P);
+  fQAList->AddAt(new TH2F("fTOFbeta_v_P_no","beta -v- P; beta;momentum [GeV/c]", 120, 0, 1.2, 200, 0, 20), kHistTOFpidBetavP);
   fQAList->AddAt(new TH1F("hTOF_signal", "TOF signal; TOF signal [ns];counts", 1000, 12, 50), kHistTOFsignal);
   fQAList->AddAt(new TH1F("hTOF_length", "TOF track length; length [cm];counts", 400, 300, 700), kHistTOFlength);
-  fQAList->AddAt(new TH2F("hTOFpid_electron", "TOF reco electron; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid_0);
-  fQAList->AddAt(new TH2F("hTOFpid_muon", "TOF reco muon; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid_1);
-  fQAList->AddAt(new TH2F("hTOFpid_pion", "TOF reco pion; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid_2);
-  fQAList->AddAt(new TH2F("hTOFpid_kaon", "TOF reco kaon; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid_3);
-  fQAList->AddAt(new TH2F("hTOFpid_proton", "TOF reco proton; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid_4);
+  fQAList->AddAt(new TH2F("hTOFpid_electron", "TOF reco electron; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid0);
+  fQAList->AddAt(new TH2F("hTOFpid_muon", "TOF reco muon; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid1);
+  fQAList->AddAt(new TH2F("hTOFpid_pion", "TOF reco pion; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid2);
+  fQAList->AddAt(new TH2F("hTOFpid_kaon", "TOF reco kaon; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid3);
+  fQAList->AddAt(new TH2F("hTOFpid_proton", "TOF reco proton; beta ; momentum [GeV/c]", 120, 0, 1.2, 200, 0, 5), kHistTOFpid4);
 
   qaList->AddLast(fQAList);
 }
index 0ddf15a..8795a60 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ALIHFEPIDTOF_H__
-#define __ALIHFEPIDTOF_H__
+#ifndef ALIHFEPIDTOF_H
+#define ALIHFEPIDTOF_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice   */   
@@ -15,7 +15,7 @@
  *   Matus Kalisky <matus.kalisky@cern.ch>  (contact)                   *
  ************************************************************************/
  
-#ifndef __ALIHFEPIDBASE_H__
+#ifndef ALIHFEPIDBASE_H
 #include "AliHFEpidBase.h"
 #endif
 
@@ -27,14 +27,14 @@ class AliVParticle;
 class AliHFEpidTOF : public AliHFEpidBase{
   typedef enum{
     kHistTOFpidFlags = 0,
-      kHistTOFpid_beta_v_P = 1,
+      kHistTOFpidBetavP = 1,
       kHistTOFsignal = 2,
       kHistTOFlength =3,
-      kHistTOFpid_0 = 4,
-      kHistTOFpid_1 = 5,
-      kHistTOFpid_2 = 6,
-      kHistTOFpid_3 = 7,
-      kHistTOFpid_4 = 8
+      kHistTOFpid0 = 4,
+      kHistTOFpid1 = 5,
+      kHistTOFpid2 = 6,
+      kHistTOFpid3 = 7,
+      kHistTOFpid4 = 8
       
       } QAHist_t;
  public:
index 6ef479b..bbae770 100644 (file)
@@ -48,15 +48,14 @@ AliHFEpidTPC::AliHFEpidTPC(const char* name) :
   // add a list here
     AliHFEpidBase(name)
   , fLineCrossingsEnabled(0)
-  , fNsigmaTPC(2)
-  , fPID(0x0)
-  , fPIDtpcESD(0x0)
-  , fQAList(0x0)
+  , fNsigmaTPC(3)
+  , fPID(NULL)
+  , fPIDtpcESD(NULL)
+  , fQAList(NULL)
 {
   //
   // default  constructor
   // 
-  memset(fLineCrossingCenter, 0, sizeof(Double_t) * AliPID::kSPECIES);
   memset(fLineCrossingSigma, 0, sizeof(Double_t) * AliPID::kSPECIES);
   fPID = new AliPID;
   fPIDtpcESD = new AliTPCpidESD;
@@ -67,9 +66,9 @@ AliHFEpidTPC::AliHFEpidTPC(const AliHFEpidTPC &ref) :
     AliHFEpidBase("")
   , fLineCrossingsEnabled(0)
   , fNsigmaTPC(2)
-  , fPID(0x0)
-  , fPIDtpcESD(0x0)
-  , fQAList(0x0)
+  , fPID(NULL)
+  , fPIDtpcESD(NULL)
+  , fQAList(NULL)
 {
   //
   // Copy constructor
@@ -88,6 +87,7 @@ AliHFEpidTPC &AliHFEpidTPC::operator=(const AliHFEpidTPC &ref){
   return *this;
 }
 
+//___________________________________________________________________
 void AliHFEpidTPC::Copy(TObject &o) const{
   //
   // Copy function 
@@ -100,6 +100,7 @@ void AliHFEpidTPC::Copy(TObject &o) const{
   target.fPID = new AliPID(*fPID);
   target.fPIDtpcESD = new AliTPCpidESD(*fPIDtpcESD);
   target.fQAList = dynamic_cast<TList *>(fQAList->Clone());
+  memcpy(target.fLineCrossingSigma, fLineCrossingSigma, sizeof(Double_t) * AliPID::kSPECIES);
 
   AliHFEpidBase::Copy(target);
 }
@@ -122,8 +123,8 @@ Bool_t AliHFEpidTPC::InitializePID(){
   //
   // Add TPC dE/dx Line crossings
   //
-  AddTPCdEdxLineCrossing(AliPID::kKaon, 0.3, 0.018);
-  AddTPCdEdxLineCrossing(AliPID::kProton, 0.9, 0.054);
+  //AddTPCdEdxLineCrossing(AliPID::kKaon, 0.3, 0.018);
+  //AddTPCdEdxLineCrossing(AliPID::kProton, 0.9, 0.054);
   return kTRUE;
 }
 
@@ -135,17 +136,16 @@ Int_t AliHFEpidTPC::IsSelected(AliVParticle *track)
   // for electrons
   // exclusion of the crossing points
   //
-  AliESDtrack *esdTrack = 0x0;
+  AliESDtrack *esdTrack = NULL;
   if(!(esdTrack = dynamic_cast<AliESDtrack *>(track))) return kFALSE;
   if(IsQAon()) FillTPChistograms(esdTrack);
-  Double_t TPCsignal = esdTrack->GetTPCsignal();
   // exclude crossing points:
   // Determine the bethe values for each particle species
-  Double_t p = esdTrack->GetInnerParam()->P();
   Bool_t isLineCrossing = kFALSE;
   for(Int_t ispecies = 0; ispecies < AliPID::kSPECIES; ispecies++){
+    if(ispecies == AliPID::kElectron) continue;
     if(!(fLineCrossingsEnabled & 1 << ispecies)) continue;
-    if(TMath::Abs(p - fLineCrossingCenter[ispecies]) < fLineCrossingSigma[ispecies]){
+    if(fPIDtpcESD->GetNumberOfSigmas(esdTrack, (AliPID::EParticleType)ispecies) < fLineCrossingSigma[ispecies]){
       // Point in a line crossing region, no PID possible
       isLineCrossing = kTRUE;
       break;
@@ -153,13 +153,12 @@ Int_t AliHFEpidTPC::IsSelected(AliVParticle *track)
   }
   if(isLineCrossing) return 0;
   // Check whether distance from the electron line is smaller than n-sigma
-  Double_t beta = p/fPID->ParticleMass(AliPID::kElectron);
-  if(TMath::Abs(TPCsignal - 50*fPIDtpcESD->Bethe(beta)) < GetTPCsigma(p,0)) return 11;
+  if(fPIDtpcESD->GetNumberOfSigmas(esdTrack, AliPID::kElectron) < fNsigmaTPC ) return 11;
   return 0;
 }
 
 //___________________________________________________________________
-void AliHFEpidTPC::AddTPCdEdxLineCrossing(Int_t species, Double_t p, Double_t sigma_p){
+void AliHFEpidTPC::AddTPCdEdxLineCrossing(Int_t species, Double_t sigma){
   //
   // Add exclusion point for the TPC PID where a dEdx line crosses the electron line
   // Stores line center and line sigma
@@ -169,20 +168,7 @@ void AliHFEpidTPC::AddTPCdEdxLineCrossing(Int_t species, Double_t p, Double_t si
     return;
   }
   fLineCrossingsEnabled |= 1 << species;
-  fLineCrossingCenter[species] = p;
-  fLineCrossingSigma[species] = sigma_p;
-}
-
-//___________________________________________________________________
-Double_t AliHFEpidTPC::GetTPCsigma(Double_t p, Int_t species){
-  //
-  // return the TPC sigma, momentum dependent
-  //
-  if(p < 0.1 || p > 20.) return 0.;
-  Double_t beta = p/fPID->ParticleMass(species);
-  
-  return 50*fPIDtpcESD->Bethe(beta) * 0.06;
+  fLineCrossingSigma[species] = sigma;
 }
 
 //___________________________________________________________________
@@ -195,66 +181,26 @@ Double_t AliHFEpidTPC::Likelihood(const AliESDtrack *track, Int_t species, Float
   //IMPORTANT: Tracks which are judged to be outliers get negative likelihoods -> unusable for combination with further detectors!
   
   if(!track) return -1.;
-  Int_t hypo; //marks particle hypotheses for 2-sigma bands
-  Double_t beta;//well o.k., it corresponds to gamma * beta
-  Double_t p = track->GetInnerParam()->P();
-  Double_t TPCsignal = track->GetTPCsignal();
   Bool_t outlier = kTRUE;
   // Check whether distance from the respective particle line is smaller than r sigma
-  for(hypo = 0; hypo < 5; hypo++)
-    {
-      beta = p/fPID->ParticleMass(hypo);
-      if(TMath::Abs(TPCsignal - (GetTPCsigma(p, hypo))/0.06) > (rsig * GetTPCsigma(p,hypo)))
-       outlier = kTRUE;
-      else 
-       {
-         outlier = kFALSE;
-         break;
-       }
-    }
+  for(Int_t hypo = 0; hypo < AliPID::kSPECIES; hypo++){
+    if(fPIDtpcESD->GetNumberOfSigmas(track, (AliPID::EParticleType)hypo) > rsig)
+      outlier = kTRUE;
+    else {
+           outlier = kFALSE;
+           break;
+         }
+  }
   if(outlier)
     return -2.;
 
-  Double_t TPCprob[5];
+  Double_t tpcProb[5];
 
-  track->GetTPCpid(TPCprob);
+  track->GetTPCpid(tpcProb);
 
-  return TPCprob[species];
+  return tpcProb[species];
 }
-//___________________________________________________________________
-Double_t AliHFEpidTPC::Likelihood(const AliESDtrack *track, Int_t species)
-{
-  //default: rsig = 2.
-  // for everything else, see above!
 
-  if(!track) return -1.;
-  Int_t hypo; //marks particle hypotheses for 2-sigma bands
-  Double_t beta;
-  Double_t p = track->GetInnerParam()->P();
-  Double_t TPCsignal = track->GetTPCsignal();
-  Bool_t outlier = kTRUE;
-  // Check whether distance from the respective particle line is smaller than 2 sigma
-  for(hypo = 0; hypo < 5; hypo++)
-    {
-      beta = p/fPID->ParticleMass(hypo);
-     
-      if(TMath::Abs(TPCsignal - (GetTPCsigma(p, hypo))/0.06) > (2. * GetTPCsigma(p,hypo)))
-       outlier = kTRUE;
-      else 
-       {
-         outlier = kFALSE;
-         break;
-       }
-    }
-  if(outlier == kTRUE)
-    return -2.;
-
-  Double_t TPCprob[5];
-
-  track->GetTPCpid(TPCprob);
-
-  return TPCprob[species];
-}
 //___________________________________________________________________
 Double_t  AliHFEpidTPC::Suppression(const AliESDtrack *track, Int_t species)
 {
@@ -272,17 +218,18 @@ Double_t  AliHFEpidTPC::Suppression(const AliESDtrack *track, Int_t species)
 
 
 }
+
 //___________________________________________________________________
 void AliHFEpidTPC::FillTPChistograms(const AliESDtrack *track){
   //
   if(!track)
     return;
  
-  Double_t tpc_signal = track->GetTPCsignal();
+  Double_t tpcSignal = track->GetTPCsignal();
   Double_t p = track->GetInnerParam() ? track->GetInnerParam()->P() : track->P();
   if(HasMCData()){
     switch(TMath::Abs(GetPdgCode(const_cast<AliESDtrack *>(track)))){
-      case 11:   (dynamic_cast<TH2I *>(fQAList->At(kHistTPCelectron)))->Fill(p, tpc_signal);
+      case 11:   (dynamic_cast<TH2I *>(fQAList->At(kHistTPCelectron)))->Fill(p, tpcSignal);
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCprobEl)))->Fill(p, Likelihood(track, 0));
        //histograms with ratio of likelihood to be electron/to be other species (a check for quality of likelihood PID);
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCenhanceElPi)))->Fill(p, -Suppression(track, 2));
@@ -297,37 +244,34 @@ void AliHFEpidTPC::FillTPChistograms(const AliESDtrack *track){
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCElprobPro)))->Fill(p, Likelihood(track, 4));
        break;
        //___________________________________________________________________________________________
-    case 13: (dynamic_cast<TH2I *>(fQAList->At(kHistTPCmuon)))->Fill(p, tpc_signal);
+    case 13: (dynamic_cast<TH2I *>(fQAList->At(kHistTPCmuon)))->Fill(p, tpcSignal);
       //Likelihood of muon to be an electron
       (dynamic_cast<TH2F *>(fQAList->At(kHistTPCprobMu)))->Fill(p, Likelihood(track, 0));
       //ratio of likelihood for muon to be a muon/an electron -> indicator for quality of muon suppression
       //below functions are the same for other species
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCsuppressMu)))->Fill(p, Suppression(track, 1));
       break;
-      case 211:  (dynamic_cast<TH2I *>(fQAList->At(kHistTPCpion)))->Fill(p, tpc_signal);
+      case 211:  (dynamic_cast<TH2I *>(fQAList->At(kHistTPCpion)))->Fill(p, tpcSignal);
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCprobPi)))->Fill(p, Likelihood(track, 0));
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCsuppressPi)))->Fill(p, Suppression(track, 2));
           break;
-      case 321:  (dynamic_cast<TH2I *>(fQAList->At(kHistTPCkaon)))->Fill(p, tpc_signal);
+      case 321:  (dynamic_cast<TH2I *>(fQAList->At(kHistTPCkaon)))->Fill(p, tpcSignal);
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCprobKa)))->Fill(p, Likelihood(track, 0));
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCsuppressKa)))->Fill(p, Suppression(track, 3));
           break;
-      case 2212: (dynamic_cast<TH2I *>(fQAList->At(kHistTPCproton)))->Fill(p, tpc_signal);
+      case 2212: (dynamic_cast<TH2I *>(fQAList->At(kHistTPCproton)))->Fill(p, tpcSignal);
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCprobPro)))->Fill(p, Likelihood(track, 0));
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCsuppressPro)))->Fill(p, Suppression(track, 4));
           break;
-      default: (dynamic_cast<TH2I *>(fQAList->At(kHistTPCothers)))->Fill(p, tpc_signal);
+      default: (dynamic_cast<TH2I *>(fQAList->At(kHistTPCothers)))->Fill(p, tpcSignal);
        (dynamic_cast<TH2F *>(fQAList->At(kHistTPCprobOth)))->Fill(p, Likelihood(track, 0));
 
        break;
     }
   }
   //TPC signal and Likelihood to be electron for all tracks (independent of MC information)
-  (dynamic_cast<TH2I *>(fQAList->At(kHistTPCall)))->Fill(p, tpc_signal);
+  (dynamic_cast<TH2I *>(fQAList->At(kHistTPCall)))->Fill(p, tpcSignal);
  (dynamic_cast<TH2F *>(fQAList->At(kHistTPCprobAll)))->Fill(p, Likelihood(track, 0));
-
-  
 }
 
 //___________________________________________________________________
index ddd0f04..4799751 100644 (file)
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
-#ifndef __ALIHFEPIDTPC_H__
-#define __ALIHFEPIDTPC_H__
+#ifndef ALIHFEPIDTPC_H
+#define ALIHFEPIDTPC_H
 
-#ifndef __ALIHFEPIDBASE_H__
+#ifndef ALIHFEPIDBASE_H
 #include "AliHFEpidBase.h"
 #endif
 
@@ -67,10 +67,9 @@ class AliHFEpidTPC : public AliHFEpidBase{
     virtual Int_t IsSelected(AliVParticle *track);
     virtual Bool_t HasQAhistos() const { return kTRUE; };
 
-    void AddTPCdEdxLineCrossing(Int_t species, Double_t p, Double_t sigma_p);
+    void AddTPCdEdxLineCrossing(Int_t species, Double_t sigma);
     void SetTPCnSigma(Short_t nSigma) { fNsigmaTPC = nSigma; };
-    Double_t Likelihood(const AliESDtrack *track, Int_t species);
-    Double_t Likelihood(const AliESDtrack *track, Int_t species, Float_t rsig);
+    Double_t Likelihood(const AliESDtrack *track, Int_t species, Float_t rsig = 2.);
 
     Double_t Suppression(const AliESDtrack *track, Int_t species);
 
@@ -78,10 +77,8 @@ class AliHFEpidTPC : public AliHFEpidBase{
     void Copy(TObject &o) const;
     void AddQAhistograms(TList *qaList);
     void FillTPChistograms(const AliESDtrack *track);
-    Double_t GetTPCsigma(Double_t p, Int_t species);
  
   private:
-    Double_t fLineCrossingCenter[AliPID::kSPECIES];         // Line crossing ExclusionPoints
     Double_t fLineCrossingSigma[AliPID::kSPECIES];          // with of the exclusion point
     UChar_t fLineCrossingsEnabled;                          // Bitmap showing which line crossing is set
     Short_t fNsigmaTPC;                                     // TPC sigma band
index 68e9d29..ff67071 100644 (file)
@@ -15,7 +15,7 @@
 /************************************************************************
  *                                                                      *
  * Class for TRD PID                                                    *
- * Implements the abstract base class AliHFEpidbase        *
+ * Implements the abstract base class AliHFEpidbase                     *
  * Make PID does the PID decision                                       *
  * Class further contains TRD specific cuts and QA histograms           *
  *                                                                      *
@@ -26,6 +26,7 @@
 #include <TAxis.h>
 #include <TFile.h>
 #include <TH1F.h>
+#include <TH2F.h>
 #include <TIterator.h>
 #include <TKey.h>
 #include <TMap.h>
 #include <TROOT.h>
 
 #include "AliESDtrack.h"
+#include "AliLog.h"
 #include "AliPID.h"
 
 #include "AliHFEpidTRD.h"
 
 ClassImp(AliHFEpidTRD)
 
+const Double_t AliHFEpidTRD::fgkVerySmall = 1e-12;
+
 //___________________________________________________________________
 AliHFEpidTRD::AliHFEpidTRD(const char* name) :
     AliHFEpidBase(name)
   , fPIDMethod(kNN)
+  , fContainer(0x0)
 {
   //
   // default  constructor
@@ -56,6 +61,7 @@ AliHFEpidTRD::AliHFEpidTRD(const char* name) :
 AliHFEpidTRD::AliHFEpidTRD(const AliHFEpidTRD &ref):
     AliHFEpidBase("")
   , fPIDMethod(kLQ)
+  , fContainer(0x0)
 {
   //
   // Copy constructor
@@ -84,6 +90,7 @@ void AliHFEpidTRD::Copy(TObject &ref) const {
 
   target.fPIDMethod = fPIDMethod;
   memcpy(target.fThreshParams, fThreshParams, sizeof(Double_t) * kThreshParams);
+  if(fContainer) target.fContainer = dynamic_cast<TList *>(fContainer->Clone());
   AliHFEpidBase::Copy(ref);
 }
 
@@ -92,6 +99,10 @@ AliHFEpidTRD::~AliHFEpidTRD(){
   //
   // Destructor
   //
+  if(fContainer){
+    fContainer->Clear();
+    delete fContainer;
+  }
 }
 
 //______________________________________________________
@@ -173,3 +184,146 @@ void AliHFEpidTRD::GetParameters(Double_t electronEff, Double_t *parameters){
   Int_t effbin = static_cast<Int_t>((electronEff - 0.7)/0.3 * 6.);
   memcpy(parameters, fThreshParams + effbin * 4, sizeof(Double_t) * 4);
 }
+
+//___________________________________________________________________
+Double_t AliHFEpidTRD::GetTRDSignalV1(AliESDtrack *track){
+  //
+  // Calculation of the TRD Signal via truncated mean
+  // Method 1: Take all Slices available
+  // cut out 0s
+  // Order them in increasing order
+  // Cut out the upper third
+  // Calculate mean over the last 2/3 slices
+  //
+  const Int_t kNSlices = 48;
+  AliDebug(2, Form("Number of Tracklets: %d\n", track->GetTRDpidQuality()));
+  Double_t trdSlices[kNSlices], tmp[kNSlices];
+  Int_t indices[48];
+  Int_t icnt = 0;
+  for(Int_t idet = 0; idet < 6; idet++)
+    for(Int_t islice = 0; islice < 8; islice++){
+      AliDebug(2, Form("Chamber[%d], Slice[%d]: TRDSlice = %f", idet, islice, track->GetTRDslice(idet, islice)));
+      if(TMath::Abs(track->GetTRDslice(idet, islice)) < fgkVerySmall) continue;;
+      trdSlices[icnt++] = track->GetTRDslice(idet, islice);
+    }
+  AliDebug(1, Form("Number of Slices: %d\n", icnt));
+  if(icnt < 6) return 0.;   // We need at least 6 Slices for the truncated mean
+  TMath::Sort(icnt, trdSlices, indices, kFALSE);
+  memcpy(tmp, trdSlices, sizeof(Double_t) * icnt);
+  for(Int_t ien = 0; ien < icnt; ien++)
+    trdSlices[ien] = tmp[indices[ien]];
+  Double_t trdSignal = TMath::Mean(static_cast<Int_t>(static_cast<Double_t>(icnt) * 2./3.), trdSlices);
+  Double_t mom = track->GetOuterParam() ? track->GetOuterParam()->P() : -1;
+  AliDebug(1, Form("PID Meth. 1: p[%f], TRDSignal[%f]", mom, trdSignal));
+  if(IsQAon() && mom > 0.) FillHistogramsTRDSignalV1(trdSignal, mom, GetMCpid(track));
+  return trdSignal;
+}
+
+//___________________________________________________________________
+Double_t AliHFEpidTRD::GetTRDSignalV2(AliESDtrack *track){
+  //
+  // Calculation of the TRD Signal via truncated mean
+  // Method 2: Take only first 5 slices per chamber
+  // Order them in increasing order
+  // Cut out upper half 
+  // Now do mean with the reamining 3 slices per chamber
+  //
+  Double_t trdSlicesLowTime[30], trdSlicesRemaining[32];
+  Int_t indices[30];
+  Int_t cntLowTime=0, cntRemaining = 0;
+  for(Int_t idet = 0; idet < 6; idet++)
+    for(Int_t islice = 0; islice < 8; islice++){
+      if(TMath::Abs(track->GetTRDslice(idet, islice)) < fgkVerySmall) continue;;
+      if(islice < 5){
+        AliDebug(2, Form("Part 1, Det[%d], Slice[%d], TRDSlice: %f", idet, islice, track->GetTRDslice(idet, islice)));
+        trdSlicesLowTime[cntLowTime++] = track->GetTRDslice(idet, islice);
+      } else{
+        AliDebug(2, Form("Part 1, Det[%d], Slice[%d], TRDSlice: %f", idet, islice, track->GetTRDslice(idet, islice)));
+        trdSlicesRemaining[cntRemaining++] = track->GetTRDslice(idet, islice);
+      }
+    }
+  if(cntLowTime < 4 || cntRemaining < 2) return 0.; // Min. Number of Slices at high time is 2 (matches with 1 layer), for the truncated mean we need at least 4 Slices
+  TMath::Sort(cntLowTime, trdSlicesLowTime, indices, kFALSE);
+  // Fill the second array with the lower half of the first time bins
+  for(Int_t ien = 0; ien < static_cast<Int_t>(static_cast<Double_t>(cntLowTime) * 0.5); ien++)
+    trdSlicesRemaining[cntRemaining++] = trdSlicesLowTime[indices[ien]];
+  Double_t trdSignal = TMath::Mean(cntRemaining, trdSlicesRemaining);
+  Double_t mom = track->GetOuterParam() ? track->GetOuterParam()->P() : -1;
+  AliDebug(1, Form("PID Meth. 2: p[%f], TRDSignal[%f]", mom, trdSignal));
+  if(IsQAon() && mom > 0.) FillHistogramsTRDSignalV2(trdSignal, mom, GetMCpid(track));
+  return trdSignal;
+}
+
+//___________________________________________________________________
+void AliHFEpidTRD::FillHistogramsTRDSignalV1(Double_t signal, Double_t mom, Int_t species){
+  //
+  // Fill histograms for TRD Signal from Method 1 vs. p for different particle species
+  //
+  (dynamic_cast<TH2F *>(fContainer->At(kHistTRDSigV1)))->Fill(mom, signal);
+  if(species < 0 || species >= AliPID::kSPECIES) return;
+  (dynamic_cast<TH2F *>(fContainer->At(kHistOverallSpecies + species)))->Fill(mom, signal);
+}
+
+//___________________________________________________________________
+void AliHFEpidTRD::FillHistogramsTRDSignalV2(Double_t signal, Double_t mom, Int_t species){
+  //
+  // Fill histograms for TRD Signal from Method 2 vs. p for different particle species
+  //
+  (dynamic_cast<TH2F *>(fContainer->At(kHistTRDSigV2)))->Fill(mom, signal);  
+  if(species < 0 || species >= AliPID::kSPECIES) return;
+  (dynamic_cast<TH2F *>(fContainer->At(kHistOverallSpecies + AliPID::kSPECIES + species)))->Fill(mom, signal);
+}
+
+//___________________________________________________________________
+Int_t AliHFEpidTRD::GetMCpid(AliESDtrack *track){
+  //
+  // Return species of the track according to MC information
+  //
+  Int_t pdg = TMath::Abs(AliHFEpidBase::GetPdgCode(track));
+  Int_t pid = -1;
+  switch(pdg){
+    case 11:    pid = AliPID::kElectron; break;
+    case 13:    pid = AliPID::kMuon; break;
+    case 211:   pid = AliPID::kPion; break;
+    case 321:   pid = AliPID::kKaon; break;
+    case 2212:  pid = AliPID::kProton; break;
+    default:    pid = -1; break;
+  };
+  return pid;
+}
+
+//___________________________________________________________________
+void AliHFEpidTRD::AddQAhistograms(TList *l){
+  //
+  // Adding QA histograms for the TRD PID
+  // QA histograms are:
+  // + TRD Signal from Meth. 1 vs p for all species
+  // + TRD Signal from Meth. 2 vs p for all species
+  // + For each species
+  //    - TRD Signal from Meth. 1 vs p
+  //    - TRD Signal from Meth. 2 vs p
+  //
+  const Int_t kMomentumBins = 41;
+  const Double_t kPtMin = 0.1;
+  const Double_t kPtMax = 10.;
+  const Int_t kSigBinsMeth1 = 100; 
+  const Int_t kSigBinsMeth2 = 100;
+  const Double_t kMinSig = 0.;
+  const Double_t kMaxSigMeth1 = 10000.;
+  const Double_t kMaxSigMeth2 = 10000.;
+  
+  if(!fContainer) fContainer = new TList;
+  fContainer->SetName("fTRDqaHistograms");
+
+  Double_t momentumBins[kMomentumBins];
+  for(Int_t ibin = 0; ibin < kMomentumBins; ibin++)
+    momentumBins[ibin] = static_cast<Double_t>(TMath::Power(10,TMath::Log10(kPtMin) + (TMath::Log10(kPtMax)-TMath::Log10(kPtMin))/(kMomentumBins-1)*static_cast<Double_t>(ibin)));
+  fContainer->AddAt(new TH2F("fTRDSigV1all", "TRD Signal (all particles, Method 1)", kMomentumBins - 1, momentumBins, kSigBinsMeth1, kMinSig, kMaxSigMeth1), kHistTRDSigV1);
+  fContainer->AddAt(new TH2F("fTRDSigV2all", "TRD Signal (all particles, Method 2)", kMomentumBins - 1, momentumBins, kSigBinsMeth2, kMinSig, kMaxSigMeth2), kHistTRDSigV2);
+  for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){
+    fContainer->AddAt(new TH2F(Form("fTRDSigV1%s", AliPID::ParticleName(ispec)), Form("TRD Signal (%s, Method 1)", AliPID::ParticleName(ispec)), kMomentumBins - 1, momentumBins, kSigBinsMeth1, kMinSig, kMaxSigMeth1), kHistOverallSpecies + ispec);
+    fContainer->AddAt(new TH2F(Form("fTRDSigV2%s", AliPID::ParticleName(ispec)), Form("TRD Signal (%s, Method 2)", AliPID::ParticleName(ispec)), kMomentumBins - 1, momentumBins, kSigBinsMeth1, kMinSig, kMaxSigMeth2), kHistOverallSpecies + AliPID::kSPECIES + ispec);
+  }
+  l->AddLast(fContainer);
+}
+
index b2e4ee4..1e9ac5d 100644 (file)
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
-#ifndef __ALIHFEPIDTRD_H__
-#define __ALIHFEPIDTRD_H__
+#ifndef ALIHFEPIDTRD_H
+#define ALIHFEPIDTRD_H
 
- #ifndef __ALIHFEPIDBASE_H__
+ #ifndef ALIHFEPIDBASE_H
  #include "AliHFEpidBase.h"
  #endif
 
+class AliESDtrack;
 class AliVParticle;
+class TList;
+class TH2F;
 
 class AliHFEpidTRD : public AliHFEpidBase{
   public:
@@ -30,6 +33,11 @@ class AliHFEpidTRD : public AliHFEpidBase{
     enum{
       kThreshParams = 24
     };
+    enum{
+      kHistTRDSigV1 = 0,
+      kHistTRDSigV2 = 1,
+      kHistOverallSpecies = 2
+    };
     AliHFEpidTRD(const Char_t *name);
     AliHFEpidTRD(const AliHFEpidTRD &ref);
     AliHFEpidTRD& operator=(const AliHFEpidTRD &ref);
@@ -37,17 +45,27 @@ class AliHFEpidTRD : public AliHFEpidBase{
     
     virtual Bool_t InitializePID();
     virtual Int_t IsSelected(AliVParticle *track);
-    virtual Bool_t HasQAhistos() const { return kFALSE; };
+    virtual Bool_t HasQAhistos() const { return kTRUE; };
+
+    Double_t GetTRDSignalV1(AliESDtrack *track);
+    Double_t GetTRDSignalV2(AliESDtrack *track);
 
     void SetPIDMethod(PIDMethodTRD_t method) { fPIDMethod = method; };
   protected:
     void Copy(TObject &ref) const;
     Double_t GetTRDthresholds(Double_t electronEff, Double_t p);
+    Int_t GetMCpid(AliESDtrack *track);
     void InitParameters();
+    virtual void AddQAhistograms(TList *l);
     void GetParameters(Double_t electronEff, Double_t *parameters);
+
+    void FillHistogramsTRDSignalV1(Double_t signal, Double_t p, Int_t species);
+    void FillHistogramsTRDSignalV2(Double_t signal, Double_t p, Int_t species);
   private:
+    static const Double_t fgkVerySmall;                       // Check for 0
     PIDMethodTRD_t fPIDMethod;                              // PID Method: 2D Likelihood or Neural Network
     Double_t fThreshParams[kThreshParams];                  // Threshold parametrisation
+    TList *fContainer;                                      // QA  Histogram Container
   ClassDef(AliHFEpidTRD, 1)     // TRD electron ID class
 };
 
index ebff889..286881e 100644 (file)
@@ -275,7 +275,7 @@ void AliHFEpriVtx::CountPriVxtElecContributor(AliESDtrack *ESDelectron, Int_t so
 }
 
 //_______________________________________________________________________________________________
-void AliHFEpriVtx::FillNprimVtxContributor()
+void AliHFEpriVtx::FillNprimVtxContributor() const
 {
         //
         // Fill histogram with number of electrons contributing to the primary vertex
index ef255c4..1eb493b 100644 (file)
  *                                                                        *
  **************************************************************************/
 
-#ifndef _ALIHFEPRIVTX_H_
-#define _ALIHFEPRIVTX_H_
+#ifndef ALIHFEPRIVTX_H
+#define ALIHFEPRIVTX_H
 
 #ifndef ROOT_TObject
-#include <TObject.h>
+//#include <TObject.h>
 #endif
 
 class TH1F;
@@ -51,7 +51,7 @@ class AliHFEpriVtx : public TObject {
                 void FillNtracks(); // fill counted number of tracks
                 void CountPriVxtElecContributor(AliESDtrack *ESDelectron, Int_t sourcePart, Int_t recpid, Double_t recprob); 
                 void GetNPriVxtContributor();
-                void FillNprimVtxContributor();
+                void FillNprimVtxContributor() const;
 
                 Int_t GetMCPID(AliESDtrack *track); // return mc pid
 
@@ -64,16 +64,42 @@ class AliHFEpriVtx : public TObject {
 
                 enum kSources {kAll, kDirectCharm, kDirectBeauty, kBeautyCharm, kGamma, kPi0, kElse, kBeautyGamma, kBeautyPi0, kBeautyElse};
 
-                struct hists{
+                struct AliHists{
                         TH1F *fNtracks; // histogram to fill number of counted tracks for different sources
                         TH1F *fNprimVtxContributor; // histogram to fill number of tracks contributing primary vertex 
                         TH1F *fPtElec; // histogram to fill pt of electron tracks
                         TH1F *fPtElecContributor; // histogram to fill pt of electron tracks contributing primary vertex
                         Int_t fNtrackCount; // number of counted track
                         Int_t fNprimVtxContributorCount; // number of tracks contributing primary vertex
-                };
 
-                hists fPrimVtx[10]; //
+                       AliHists()
+                       : fNtracks()
+                       , fNprimVtxContributor()
+                       , fPtElec()
+                       , fPtElecContributor()
+                       , fNtrackCount(0)
+                       , fNprimVtxContributorCount(0)
+                       {
+                         // default constructor
+                       }
+
+                       AliHists(const AliHists & p)
+                       : fNtracks(p.fNtracks)
+                       , fNprimVtxContributor(p.fNprimVtxContributor)
+                       , fPtElec(p.fPtElec)
+                       , fPtElecContributor(p.fPtElecContributor)
+                       , fNtrackCount(p.fNtrackCount)
+                       , fNprimVtxContributorCount(p.fNprimVtxContributorCount)
+                       {
+                         // copy constructor
+                       }
+                       AliHists &operator=(const AliHists &)
+                       {
+                         // assignment operator, not yet implemented
+                         return *this;
+                       }
+                };
+                AliHists fPrimVtx[10]; // define structure of histograms
 
                 Int_t fNtrackswoPid; //  number of track counted
                 TH1F *fHNtrackswoPid; // histogram to fill number of track counted
index 3683b43..a3e7c80 100644 (file)
@@ -351,6 +351,7 @@ void AliHFEsecVtx::AnaPair(AliESDtrack* track1, AliESDtrack* track2, Int_t index
         AliKFParticle::SetField(fESD1->GetMagneticField());
         AliKFParticle kfTrack1(*track1, pdg1);
         AliKFParticle kfTrack2(*track2, pdg2);
+
         AliKFParticle kfSecondary(kfTrack1,kfTrack2);
 
         // copy primary vertex from ESD
@@ -1284,7 +1285,7 @@ Int_t AliHFEsecVtx::GetElectronSource(Int_t iTrackLabel)
 */
 
 //_______________________________________________________________________________________________
-Bool_t AliHFEsecVtx::SingleTrackCut(AliESDtrack* track)
+Bool_t AliHFEsecVtx::SingleTrackCut(AliESDtrack* track) const
 {
         // test cuts 
 
@@ -1305,4 +1306,3 @@ Bool_t AliHFEsecVtx::SingleTrackCut(AliESDtrack* track)
 */
         return kTRUE;
 }
-
index 484f311..c68a4d5 100644 (file)
@@ -25,7 +25,7 @@
 #define ALIHFESECVTX_H
 
 #ifndef ROOT_TObject
-#include <TObject.h>
+//#include <TObject.h>
 #endif
 
 class TH1F;
@@ -57,7 +57,7 @@ class AliHFEsecVtx : public TObject {
                 Int_t PairCode(AliESDtrack* track1,AliESDtrack* track2); // return corresponding pair code to pdg code
                 Int_t GetElectronSource(Int_t mclabel); // return origin of the electron
 
-                Bool_t SingleTrackCut(AliESDtrack* track1); // single track cut
+                Bool_t SingleTrackCut(AliESDtrack* track1) const; // single track cut
 
         protected:
 
@@ -92,7 +92,7 @@ class AliHFEsecVtx : public TObject {
                 enum {kAll, kDirectCharm, kDirectBeauty, kBeautyCharm, kGamma, kPi0, kElse, kBeautyGamma, kBeautyPi0, kBeautyElse};
                 enum {kCharm=4, kBeauty=5};
 
-                struct histspair{
+                struct AliHistspair{
                         TH2F *fInvMass; // histogram to store pair invariant mass
                         TH2F *fInvMassCut1; // histogram to store pair invariant mass after cut1
                         TH2F *fInvMassCut2; // histogram to store pair invariant mass after cut2
@@ -102,9 +102,41 @@ class AliHFEsecVtx : public TObject {
                         TH2F *fSignedLxy; // histogram to store signed Lxy
                         TH1F *fKFIP; // histogram to store pair impact parameter
                         TH1F *fIPMax; // histogram to store larger impact parameter among pair tracks
+
+                       AliHistspair()
+                       : fInvMass()
+                       , fInvMassCut1()
+                       , fInvMassCut2()
+                       , fKFChi2()
+                       , fOpenAngle()
+                       , fCosOpenAngle()
+                       , fSignedLxy()
+                       , fKFIP()
+                       , fIPMax()
+                       {
+                         // define constructor
+                       }
+                       AliHistspair(const AliHistspair & p)
+                       : fInvMass(p.fInvMass)
+                       , fInvMassCut1(p.fInvMassCut1)
+                       , fInvMassCut2(p.fInvMassCut2)
+                       , fKFChi2(p.fKFChi2)
+                       , fOpenAngle(p.fOpenAngle)
+                       , fCosOpenAngle(p.fCosOpenAngle)
+                       , fSignedLxy(p.fSignedLxy)
+                       , fKFIP(p.fKFIP)
+                       , fIPMax(p.fIPMax)
+                       {
+                         // copy constructor
+                       }
+                       AliHistspair &operator=(const AliHistspair &)
+                       {
+                         // assignment operator, not yet implemented
+                         return *this;
+                       }
                 };
 
-                struct histstag{
+                struct AliHiststag{
                         TH1F *fPtBeautyElec; // histogram for electrons of single track cut passed 
                         TH1F *fPtTaggedElec; // histogram for total b tagged electrons
                         TH1F *fPtRightTaggedElec; // histogram for right b tagged electrons
@@ -125,10 +157,64 @@ class AliHFEsecVtx : public TObject {
                         TH1F *fSignedLxyNotBeautyElec2trkVtx; // histogram for mis-tagged b signed Lxy of two track vertex
                         TH1F *fChi2BeautyElec2trkVtx; // histogram for right-tagged b chi2 of two track vertex
                         TH1F *fChi2NotBeautyElec2trkVtx; // histogram for mis-tagged b chi2 of two track vertex
+
+                       AliHiststag()
+                       : fPtBeautyElec()
+                       , fPtTaggedElec()
+                       , fPtRightTaggedElec()
+                       , fPtWrongTaggedElec()
+                       , fInvmassBeautyElecSecVtx()
+                       , fInvmassNotBeautyElecSecVtx()
+                       , fSignedLxyBeautyElecSecVtx()
+                       , fSignedLxyNotBeautyElecSecVtx()
+                       , fDistTwoVtxBeautyElecSecVtx()
+                       , fDistTwoVtxNotBeautyElecSecVtx()
+                       , fCosPhiBeautyElecSecVtx()
+                       , fCosPhiNotBeautyElecSecVtx()
+                       , fChi2BeautyElecSecVtx()
+                       , fChi2NotBeautyElecSecVtx()
+                       , fInvmassBeautyElec2trkVtx()
+                       , fInvmassNotBeautyElec2trkVtx()
+                       , fSignedLxyBeautyElec2trkVtx()
+                       , fSignedLxyNotBeautyElec2trkVtx()
+                       , fChi2BeautyElec2trkVtx()
+                       , fChi2NotBeautyElec2trkVtx()
+                       {
+                         // define constructor
+                       }
+                       AliHiststag(const AliHiststag & p)
+                       : fPtBeautyElec(p.fPtBeautyElec)
+                       , fPtTaggedElec(p.fPtTaggedElec)
+                       , fPtRightTaggedElec(p.fPtRightTaggedElec)
+                       , fPtWrongTaggedElec(p.fPtWrongTaggedElec)
+                       , fInvmassBeautyElecSecVtx(p.fInvmassBeautyElecSecVtx)
+                       , fInvmassNotBeautyElecSecVtx(p.fInvmassNotBeautyElecSecVtx)
+                       , fSignedLxyBeautyElecSecVtx(p.fSignedLxyBeautyElecSecVtx)
+                       , fSignedLxyNotBeautyElecSecVtx(p.fSignedLxyNotBeautyElecSecVtx)
+                       , fDistTwoVtxBeautyElecSecVtx(p.fDistTwoVtxBeautyElecSecVtx)
+                       , fDistTwoVtxNotBeautyElecSecVtx(p.fDistTwoVtxNotBeautyElecSecVtx)
+                       , fCosPhiBeautyElecSecVtx(p.fCosPhiBeautyElecSecVtx)
+                       , fCosPhiNotBeautyElecSecVtx(p.fCosPhiNotBeautyElecSecVtx)
+                       , fChi2BeautyElecSecVtx(p.fChi2BeautyElecSecVtx)
+                       , fChi2NotBeautyElecSecVtx(p.fChi2NotBeautyElecSecVtx)
+                       , fInvmassBeautyElec2trkVtx(p.fInvmassBeautyElec2trkVtx)
+                       , fInvmassNotBeautyElec2trkVtx(p.fInvmassNotBeautyElec2trkVtx)
+                       , fSignedLxyBeautyElec2trkVtx(p.fSignedLxyBeautyElec2trkVtx)
+                       , fSignedLxyNotBeautyElec2trkVtx(p.fSignedLxyNotBeautyElec2trkVtx)
+                       , fChi2BeautyElec2trkVtx(p.fChi2BeautyElec2trkVtx)
+                       , fChi2NotBeautyElec2trkVtx(p.fChi2NotBeautyElec2trkVtx)
+                       {
+                         // copy constructor
+                       }
+                       AliHiststag &operator=(const AliHiststag &)
+                       {
+                         // assignment operator, not yet implemented
+                         return *this;
+                       }
                 };
 
-                histspair fHistPair[10]; // struct of above given histogram for different electron sources
-                histstag fHistTagged; // struct of above given histogram
+                AliHistspair fHistPair[10]; // struct of above given histogram for different electron sources
+                AliHiststag fHistTagged; // struct of above given histogram
 
                 Int_t fPairTagged; // number of tagged e-h pairs
                 Int_t fpairedTrackID[20]; // paird hadron track track 
diff --git a/PWG3/hfe/TRD.PIDthresholds.root b/PWG3/hfe/TRD.PIDthresholds.root
deleted file mode 100644 (file)
index 19250b6..0000000
Binary files a/PWG3/hfe/TRD.PIDthresholds.root and /dev/null differ