Fixes for complaints from Coverity and refined PID cuts
authorsma <sma@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Sep 2010 14:30:32 +0000 (14:30 +0000)
committersma <sma@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Sep 2010 14:30:32 +0000 (14:30 +0000)
13 files changed:
PWG3/hfe/AliAnalysisTaskDCA.cxx
PWG3/hfe/AliAnalysisTaskDisplacedElectrons.cxx
PWG3/hfe/AliAnalysisTaskHFE.cxx
PWG3/hfe/AliAnalysisTaskHFE.h
PWG3/hfe/AliHFEcollection.cxx
PWG3/hfe/AliHFEcuts.cxx
PWG3/hfe/AliHFEdca.cxx
PWG3/hfe/AliHFEdisplacedElectrons.cxx
PWG3/hfe/AliHFEdisplacedElectrons.h
PWG3/hfe/AliHFEelecbackground.cxx
PWG3/hfe/AliHFEelecbackground.h
PWG3/hfe/AliHFEpid.cxx
PWG3/hfe/AliHFEtools.cxx

index afaf690..2e9c2dd 100644 (file)
@@ -288,7 +288,11 @@ void AliAnalysisTaskDCA::UserCreateOutputObjects(){
   
   // Automatic determination of the analysis mode
   AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-    
+  if(!inputHandler){
+    AliError("NoEvent Handler available");
+    return;
+  }
+
   if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){
     SetAODAnalysis();
   } else {
@@ -426,6 +430,10 @@ void AliAnalysisTaskDCA::UserExec(Option_t *){
   if(IsESDanalysis() && HasMCData()){
     // Protect against missing MC trees
     AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    if(!mcH){
+      AliError("No MC Event Handler available");
+      return;
+    }
     if(!mcH->InitOk()) return;
     if(!mcH->TreeK()) return;
     if(!mcH->TreeTR()) return;
@@ -433,6 +441,10 @@ void AliAnalysisTaskDCA::UserExec(Option_t *){
 
   if(!IsAODanalysis()) {
     AliESDInputHandler *inH = dynamic_cast<AliESDInputHandler *>(fInputHandler);
+    if(!inH){
+      AliError("No ESD Event Handler available");
+      return;
+    }
     AliESDpid *workingPID = inH->GetESDpid();
     if(workingPID){
       AliDebug(1, "Using ESD PID from the input handler");
@@ -456,14 +468,22 @@ void AliAnalysisTaskDCA::ProcessDcaAnalysis(){
   //
   
   AliMCEvent *fMC = 0x0;
-  AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
-  if(HasMCData())fMC = dynamic_cast<AliMCEvent*>(fMCEvent);
 
+  AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
   if(!fESD){
-    AliError("ESD Event required for ESD Analysis")
+    AliError("ESD Event required for ESD Analysis");
+      return;
+  }
+
+  if(HasMCData()){
+    fMC = dynamic_cast<AliMCEvent*>(fMCEvent);
+    if(!fMC){
+      AliError("MC Event required for Analysis");
       return;
+    }
   }
 
+
   fNEvents->Fill(1);  // original event number before cut
   fDCA->ApplyExtraCuts(fESD,fMinNprimVtxContrbutor);  // cut on primVtx contributors
   fNEvents->Fill(3);  // events number after cut
index 7b86e45..6ea0a9b 100644 (file)
@@ -89,7 +89,7 @@ AliAnalysisTaskDisplacedElectrons::AliAnalysisTaskDisplacedElectrons():
   // Initialize pid
   
   fDeDefaultPID = new AliESDpid;
-  fDePID = new AliHFEpid("PIDforDisplacedElectronAnalysis");
+  fDePID = new AliHFEpid;
   
 
 }
@@ -126,7 +126,7 @@ AliAnalysisTaskDisplacedElectrons::AliAnalysisTaskDisplacedElectrons(const char
 
   // Initialize pid
   fDeDefaultPID = new AliESDpid;
-  fDePID = new AliHFEpid("PIDforDisplacedElectronAnalysis");
+  fDePID = new AliHFEpid;
 
 }
 
@@ -311,24 +311,10 @@ void AliAnalysisTaskDisplacedElectrons::UserExec(Option_t *){
   //  
   AliESDInputHandler *inH = dynamic_cast<AliESDInputHandler *>(fInputHandler);
   
-  // pure MC analysis: 
-
-  if(HasMCData()){
-    // Protect against missing MC trees
-    AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
-    if(!mcH->InitOk()) return;
-    if(!mcH->TreeK()) return;
-    if(!mcH->TreeTR()) return;            
-    
-    AliDebug(4, Form("MC Event: %p", fMCEvent));
-    if(!fMCEvent){
-      AliError("No MC Event, but MC Data required");
-      return;
-    }
-    
-    ProcessMC();
+  if(!inH){
+    AliError("AliESDInputHandler dynamic cast failed!");
+    return;
   }
-
   
   // from now on, only ESD are analyzed
   // using HFE pid, using HFE cuts
@@ -348,27 +334,31 @@ void AliAnalysisTaskDisplacedElectrons::UserExec(Option_t *){
     return;
   }
 
-  // ESD case with MC
-  if(HasMCData() && IsESDanalysis()) {
+  // ---- CHOICE OF ANALYSIS ----
+  if(HasMCData()){
     // Protect against missing MC trees
     AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    if(!mcH){
+      AliError("MC handler cuts not available");
+      return;
+    }
+
     if(!mcH->InitOk()) return;
     if(!mcH->TreeK()) return;
-    if(!mcH->TreeTR()) return;
-
+    if(!mcH->TreeTR()) return;            
+    
     AliDebug(4, Form("MC Event: %p", fMCEvent));
     if(!fMCEvent){
       AliError("No MC Event, but MC Data required");
       return;
     }
-
-    ProcessESD();
-  } 
+    
+    ProcessMC(); // PURE MC
+    
+    if(IsESDanalysis()) ProcessESD(); // ESD WITH MC
+    
+  }else if(IsESDanalysis()) ProcessData(); // PURE ESD
   
-  // now only for data ESDs without MC
-  if(!HasMCData() && IsESDanalysis()) {    
-    ProcessData();
-  }
 
   fDeNEvents->Fill(1);  
   PostData(1, fHistDisplacedElectrons);
@@ -380,11 +370,15 @@ void AliAnalysisTaskDisplacedElectrons::UserExec(Option_t *){
 //____________________________________________________________
 void AliAnalysisTaskDisplacedElectrons::ProcessMC(){
   //
-  // handel pure MC analysis
+  // handle pure MC analysis
   //
 
   Int_t nMCelectrons = 0;
   AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
+  if(!fESD){
+    AliError("ESD event not available");
+    return;
+  }
 
   Double_t mcContainer[4];   // container for the output in THnSparse
   memset(mcContainer, 0, sizeof(Double_t) * 4);
@@ -412,8 +406,9 @@ void AliAnalysisTaskDisplacedElectrons::ProcessMC(){
 
   for(Int_t itrack = 0; itrack<nTracks; itrack++){
     if(!(stack->Particle(itrack))) continue;
-    if(mcTrack)mcTrack = 0x0;
-    mcTrack= dynamic_cast<AliMCParticle*>(fMCEvent->GetTrack(itrack));
+    if(mcTrack) mcTrack = 0x0;
+    mcTrack = dynamic_cast<AliMCParticle*>(fMCEvent->GetTrack(itrack));
+    if(!mcTrack) continue;
     //TParticle *mcPart = stack->Particle(itrack);
         
     mcContainer[0] = mcTrack->Pt();
@@ -458,7 +453,7 @@ void AliAnalysisTaskDisplacedElectrons::ProcessMC(){
 //____________________________________________________________
 void AliAnalysisTaskDisplacedElectrons::ProcessESD(){
   
-  // this is to handel ESD tracks with MC information
+  // this is to handle ESD tracks with MC information
   // MC pid is only used when HFE pid is implemented, for comparison
   // corrections are taken into account
   
@@ -467,6 +462,10 @@ void AliAnalysisTaskDisplacedElectrons::ProcessESD(){
   Double_t esdContainer[4];   // container for the output in THnSparse
   memset(esdContainer, 0, sizeof(Double_t) * 4);
   AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
+  if(!fESD){
+    AliError("No ESD event available");
+    return;
+  }
 
   fDeCFM->SetRecEventInfo(fESD);
   Double_t nContrib = fESD->GetPrimaryVertex()->GetNContributors();
@@ -474,11 +473,11 @@ void AliAnalysisTaskDisplacedElectrons::ProcessESD(){
   Bool_t alreadyseen = kFALSE;
   LabelContainer cont(fESD->GetNumberOfTracks());
   
-  Int_t nHFEelectrons=0;  
+  Int_t nHFEelectrons = 0;  
   AliESDtrack *track = 0x0;    
   AliStack *stack = 0x0;
 
-  if(!(stack = fMCEvent->Stack()))return;
+  if(!(stack = fMCEvent->Stack())) return;
   
   //
   // cut at ESD event level
@@ -533,7 +532,6 @@ void AliAnalysisTaskDisplacedElectrons::ProcessESD(){
       //      if(HasMCData())hfetrack.fMCtrack = mctrack;
       
       if(!fDePID->IsSelected(&hfetrack)) continue;
-      
       else if(fDeDebugLevel>=10)
        AliInfo("ESD info: this particle is identified as electron by HFEpid method \n");
       if(GetPlugin(kCorrection)) fDeCFM->GetParticleContainer()->Fill(esdContainer, 1+AliHFEcuts::kStepPID);
@@ -560,6 +558,10 @@ void AliAnalysisTaskDisplacedElectrons::ProcessData(){
   // HFE pid is used
 
   AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
+  if(!fESD){
+    AliError("No ESD event available");
+    return;
+  }
 
   Double_t dataContainer[4];   // container for the output in THnSparse
   memset(dataContainer, 0, sizeof(Double_t) * 4);
index 0a8bad4..ab885fb 100644 (file)
@@ -61,6 +61,7 @@
 #include "AliMCParticle.h"
 #include "AliPID.h"
 #include "AliStack.h"
+#include "AliTriggerAnalysis.h"
 #include "AliVVertex.h"
 
 #include "AliHFEpid.h"
@@ -90,6 +91,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE():
   , fBackGroundFactorsFunction(NULL)
   , fCFM(NULL)
   , fV0CF(NULL)
+  , fTriggerAnalysis(NULL)
   , fHadronicBackground(NULL)
   , fCorrelation(NULL)
   , fPIDperformance(NULL)
@@ -110,7 +112,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE():
   , fHistMCQA(NULL)
   , fHistSECVTX(NULL)
   , fHistELECBACKGROUND(NULL)
-//  , fQAcoll(0x0)
+  , fQACollection(NULL)
 {
   //
   // Dummy constructor
@@ -130,6 +132,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const char * name):
   , fBackGroundFactorsFunction(NULL)
   , fCFM(NULL)
   , fV0CF(NULL)
+  , fTriggerAnalysis(NULL)
   , fHadronicBackground(NULL)
   , fCorrelation(NULL)
   , fPIDperformance(NULL)
@@ -150,7 +153,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const char * name):
   , fHistMCQA(NULL)
   , fHistSECVTX(NULL)
   , fHistELECBACKGROUND(NULL)
-//  , fQAcoll(0x0)
+  , fQACollection(0x0)
 {
   //
   // Default constructor
@@ -158,7 +161,6 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const char * name):
   DefineOutput(1, TH1I::Class());
   DefineOutput(2, TList::Class());
   DefineOutput(3, TList::Class());
-//  DefineOutput(4, TList::Class());
 
   // Initialize cuts
 }
@@ -176,6 +178,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref):
   , fBackGroundFactorsFunction(NULL)
   , fCFM(NULL)
   , fV0CF(NULL)
+  , fTriggerAnalysis(NULL)
   , fHadronicBackground(NULL)
   , fCorrelation(NULL)
   , fPIDperformance(NULL)
@@ -196,7 +199,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref):
   , fHistMCQA(NULL)
   , fHistSECVTX(NULL)
   , fHistELECBACKGROUND(NULL)
-//  , fQAcoll(ref.fQAcoll)
+  , fQACollection(NULL)
 {
   //
   // Copy Constructor
@@ -230,6 +233,7 @@ void AliAnalysisTaskHFE::Copy(TObject &o) const {
   target.fBackGroundFactorsFunction = fBackGroundFactorsFunction;
   target.fCFM = fCFM;
   target.fV0CF = fV0CF;
+  target.fTriggerAnalysis = fTriggerAnalysis;
   target.fHadronicBackground = fHadronicBackground;
   target.fCorrelation = fCorrelation;
   target.fPIDperformance = fPIDperformance;
@@ -249,6 +253,7 @@ void AliAnalysisTaskHFE::Copy(TObject &o) const {
   target.fHistMCQA = fHistMCQA;
   target.fHistSECVTX = fHistSECVTX;
   target.fHistELECBACKGROUND = fHistELECBACKGROUND;
+  target.fQACollection = fQACollection;
 }
 
 //____________________________________________________________
@@ -327,21 +332,30 @@ void AliAnalysisTaskHFE::UserCreateOutputObjects(){
   //fQAcoll->CreateTH1F("fNevents", "Number of Events in the Analysis", 2, 0, 2);
   //fQAcoll->CreateProfile("fNtrdclusters", "Number of TRD clusters as function of momentum; p[GeV/c]", 20, 0, 20);
 
+  // Enable Trigger Analysis
+  fTriggerAnalysis = new AliTriggerAnalysis;
+  fTriggerAnalysis->EnableHistograms();
+  fTriggerAnalysis->SetAnalyzeMC(HasMCData());
+
+  // Make QA histograms
   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);
-  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);
-  fQA->AddAt(new TH1I("mccharge", "MC Charge", 200, -100, 100), 7);
-  fQA->AddAt(new TH2F("radius", "Production Vertex", 100, 0.0, 5.0, 100, 0.0, 5.0), 8);
-  fQA->AddAt(new TH1F("secvtxept", "pT of tagged e", 500, 0, 50), 9); // mj: will move to another place soon
-  fQA->AddAt(new TH2F("secvtxeTPCsig", "TPC signal for tagged e",125, 0, 25, 200, 0, 200 ), 10); // mj: will move to another place soon 
+
+  fQACollection = new AliHFEcollection("TaskQA", "QA histos from the Electron Task");
+  fQACollection->CreateProfile("conr", "Electron PID contamination", 20, 0, 20);
+  fQACollection->CreateTH1F("alpha_rec", "Alpha from reconstructed tracks with TRD hits", 36, -TMath::Pi(), TMath::Pi());
+  fQACollection->CreateTH1F("alpha_sim", "Alpha from simulated electron tracks", 36, -TMath::Pi(), TMath::Pi());
+  fQACollection->CreateTH1F("nElectron", "Number of electrons", 100, 0, 100);
+  fQACollection->CreateProfile("pidquality", "TRD PID quality as function of momentum", 20, 0, 20);
+  fQACollection->CreateProfile("ntrdclusters", "Number of TRD clusters as function of momentum", 20, 0, 20);
+  fQACollection->CreateTH1F("chi2TRD","#chi2 per TRD cluster", 20, 0, 20);
+  fQACollection->CreateTH1F("mccharge", "MC Charge", 200, -100, 100);
+  fQACollection->CreateTH2F("radius", "Production Vertex", 100, 0.0, 5.0, 100, 0.0, 5.0);
+  fQACollection->CreateTH1F("secvtxept", "pT of tagged e", 500, 0, 50); // mj: will move to another place soon
+  fQACollection->CreateTH2F("secvtxeTPCsig", "TPC signal for tagged e",125, 0, 25, 200, 0, 200 ); // mj: will move to another place soon 
+  fQA->Add(fQACollection->GetList());
 
   if(!fOutput) fOutput = new TList;
   // Initialize correction Framework and Cuts
@@ -454,6 +468,10 @@ void AliAnalysisTaskHFE::UserExec(Option_t *){
   if(IsESDanalysis() && HasMCData()){
     // Protect against missing MC trees
     AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    if(!mcH){ 
+      AliError("No MC Event Handler available");
+      return;
+    }
     if(!mcH->InitOk()) return;
     if(!mcH->TreeK()) return;
     if(!mcH->TreeTR()) return;
@@ -465,6 +483,10 @@ void AliAnalysisTaskHFE::UserExec(Option_t *){
   if(IsAODanalysis()) ProcessAOD();
   else{
     AliESDInputHandler *inH = dynamic_cast<AliESDInputHandler *>(fInputHandler);
+    if(!inH){
+      AliError("No ESD Input handler available");
+      return;
+    }
     AliESDpid *workingPID = inH->GetESDpid();
     if(workingPID){
       AliDebug(1, "Using ESD PID from the input handler");
@@ -548,9 +570,10 @@ void AliAnalysisTaskHFE::ProcessMC(){
   // In case MC QA is on also MC QA loop is done
   //
   AliDebug(3, "Processing MC Information");
-  Double_t eventstatus = 1.;
-  if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepGenerated, fMCEvent)) return;
-  fCFM->GetEventContainer()->Fill(&eventstatus,AliHFEcuts::kEventStepGenerated);
+  Double_t eventContainer [2];
+  eventContainer[0] = fMCEvent->GetPrimaryVertex()->GetZ();
+  if(fCFM->CheckEventCuts(AliHFEcuts::kEventStepGenerated, fMCEvent)) 
+    fCFM->GetEventContainer()->Fill(eventContainer,AliHFEcuts::kEventStepGenerated);
   Int_t nElectrons = 0;
   if(IsESDanalysis()){
     if (HasMCData() && IsQAOn(kMCqa)) {
@@ -605,7 +628,7 @@ void AliAnalysisTaskHFE::ProcessMC(){
   }
 
   // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD);
-  (dynamic_cast<TH1F *>(fQA->At(3)))->Fill(nElectrons);
+  fQACollection->Fill("nElectron", nElectrons);
 }
 
 //____________________________________________________________
@@ -615,15 +638,22 @@ void AliAnalysisTaskHFE::ProcessESD(){
   // Loop over Tracks, filter according cut steps defined in AliHFEcuts
   //
   AliDebug(3, "Processing ESD Event");
-  Double_t eventstatus = 1.;
-  fCFM->GetEventContainer()->Fill(&eventstatus, AliHFEcuts::kEventStepRecNoCut);
-  if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fInputEvent)) return;
-  fCFM->GetEventContainer()->Fill(&eventstatus, AliHFEcuts::kEventStepReconstructed);
   AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
   if(!fESD){
     AliError("ESD Event required for ESD Analysis")
     return;
   }
+
+  // Do event Normalization
+  Double_t eventContainer[2];
+  eventContainer[0] = fInputEvent->GetPrimaryVertex()->GetZ();
+  eventContainer[1] = 0.;
+  if(fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0AND))
+    eventContainer[1] = 1.;
+  fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoCut);
+  if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fInputEvent)) return;
+  fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepReconstructed);
+
   if (GetPlugin(kIsElecBackGround)) { 
     fElecBackGround->SetEvent(fESD);
   }
@@ -752,11 +782,10 @@ void AliAnalysisTaskHFE::ProcessESD(){
     
     // 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());
-      //fQAcoll->Fill("fNtrdclusters", container[0], track->GetTRDncls());
+      fQACollection->Fill("chi2TRD", track->GetTRDchi2()/track->GetTRDncls());
+      fQACollection->Fill("alpha_rec", track->GetAlpha());
+      fQACollection->Fill("pidquality", container[0], track->GetTRDpidQuality());
+      fQACollection->Fill("ntrdclusters", container[0], track->GetTRDncls());
     }
 
     
@@ -859,8 +888,8 @@ void AliAnalysisTaskHFE::ProcessESD(){
           // here you apply cuts, then if it doesn't pass the cut, remove it from the fSecVtx->HFEsecvtxs() 
         }
         if(fSecVtx->HFEsecvtxs()->GetEntriesFast()) {
-          (dynamic_cast<TH1F *>(fQA->At(9)))->Fill(track->Pt());
-          (dynamic_cast<TH2F *>(fQA->At(10)))->Fill(track->P(),track->GetTPCsignal());
+          fQACollection->Fill("secvtxpt", track->Pt());
+          fQACollection->Fill("secvtxTPCsig", track->P(),track->GetTPCsignal());
           if (HasMCData() && IsQAOn(kMCqa)) {
             // mc qa for after the reconstruction and pid cuts  
             AliDebug(2, "Running MC QA");
@@ -925,10 +954,12 @@ void AliAnalysisTaskHFE::ProcessAOD(){
   // Function is still in development
   //
   AliDebug(3, "Processing AOD Event");
-  Double_t eventstatus = 1.;
-  fCFM->GetEventContainer()->Fill(&eventstatus,AliHFEcuts::kEventStepRecNoCut);
+  Double_t eventContainer[2];
+  eventContainer[0] = fInputEvent->GetPrimaryVertex()->GetZ();
+  eventContainer[1] = 1.; // No Information available in AOD analysis, assume all events have V0AND
+  fCFM->GetEventContainer()->Fill(eventContainer,AliHFEcuts::kEventStepRecNoCut);
   if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fInputEvent)) return;
-  fCFM->GetEventContainer()->Fill(&eventstatus,AliHFEcuts::kEventStepReconstructed);
+  fCFM->GetEventContainer()->Fill(eventContainer,AliHFEcuts::kEventStepReconstructed);
   AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent);
   if(!fAOD){
     AliError("AOD Event required for AOD Analysis")
@@ -1075,8 +1106,7 @@ Bool_t AliAnalysisTaskHFE::ProcessMCtrack(AliVParticle *track){
   if(fWeighting) weight = FindWeight(container[0],container[1],container[2]);
 
  if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, track)) return kFALSE;
-  TH1 *test = dynamic_cast<TH1I*>(fQA->FindObject("mccharge"));
-  test->Fill(signalContainer[3]);
+ fQACollection->Fill("mccharge", signalContainer[3]);
  fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepMCGenerated,weight);
   if((signalContainer[4] = static_cast<Double_t >(IsSignalElectron(track))) > 1e-3) fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepMCsignal,weight);
   signalContainer[5] = 0;
@@ -1089,7 +1119,7 @@ Bool_t AliAnalysisTaskHFE::ProcessMCtrack(AliVParticle *track){
     signalContainer[5] = 2;
   }
   fSignalToBackgroundMC->Fill(signalContainer);
-  (dynamic_cast<TH1F *>(fQA->At(2)))->Fill(container[2] - TMath::Pi());
+  fQACollection->Fill("alpha_sim", container[2] - TMath::Pi());
   //if(IsESDanalysis()){
     if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCInAcceptance, track)) return kFALSE;
     fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepMCInAcceptance,weight);
@@ -1173,15 +1203,18 @@ void AliAnalysisTaskHFE::MakeEventContainer(){
   //
   // Create the event container for the correction framework and link it
   //
-  const Int_t kNvar = 1;  // number of variables on the grid: number of tracks per event
-  const Double_t kStatBound[2] = {0.5, 1.5};
-  const Int_t kNBins = 1;
+  const Int_t kNvar = 2;  // number of variables on the grid: 
+  Int_t nBins[kNvar] = {120, 2};
+  Double_t binMin[kNvar] = {-30. , 0.};
+  Double_t binMax[kNvar] = {30., 2.};
 
-  AliCFContainer *evCont = new AliCFContainer("eventContainer", "Container for events", AliHFEcuts::kNcutStepsEvent, kNvar, &kNBins);
+  AliCFContainer *evCont = new AliCFContainer("eventContainer", "Container for events", AliHFEcuts::kNcutStepsEvent, kNvar, nBins);
 
-  Double_t *statBins = AliHFEtools::MakeLinearBinning(kNBins, kStatBound[0], kStatBound[1]);
-  evCont->SetBinLimits(0, statBins);
-  delete[] statBins;
+  Double_t *vertexBins = AliHFEtools::MakeLinearBinning(nBins[0], binMin[0], binMax[0]);
+  Double_t *v0andBins = AliHFEtools::MakeLinearBinning(nBins[1], binMin[1], binMax[1]);
+  evCont->SetBinLimits(0, vertexBins);
+  evCont->SetBinLimits(1, v0andBins);
+  delete[] vertexBins; delete[] v0andBins;
 
   fCFM->SetEventContainer(evCont);
 }
@@ -1494,12 +1527,7 @@ Bool_t AliAnalysisTaskHFE::FillProductionVertex(const AliVParticle * const track
   }
 
   //printf("xv %f, yv %f\n",xv,yv);
-  TH2F *test = dynamic_cast<TH2F*>(fQA->FindObject("radius"));
-  if(!test) return kFALSE;
-  else {
-    test->Fill(TMath::Abs(xv),TMath::Abs(yv));
-  }
+  fQACollection->Fill("radius", TMath::Abs(xv),TMath::Abs(yv));
 
   return kTRUE;
 
index 88b713e..cef17b1 100644 (file)
@@ -38,6 +38,7 @@ class AliCFManager;
 class AliVEvent;
 class AliMCEvent;
 class AliVParticle;
+class AliTriggerAnalysis;
 class TH1I; 
 class TList;
 class TH3D;
@@ -146,6 +147,7 @@ class AliAnalysisTaskHFE : public AliAnalysisTaskSE{
     TF1  *fBackGroundFactorsFunction;     // BackGround factors
     AliCFManager *fCFM;                   //! Correction Framework Manager
     AliCFManager *fV0CF;                  //! Correction Framework Manager for V0-tagged tracks
+    AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
     AliCFContainer * fHadronicBackground; //! Container for hadronic Background
     TList *fCorrelation;                  //! response matrix for unfolding  
     THnSparseF *fPIDperformance;          //! info on contamination and yield of electron spectra
@@ -166,7 +168,7 @@ class AliAnalysisTaskHFE : public AliAnalysisTaskSE{
     TList *fHistMCQA;                     //! Output container for MC QA histograms 
     TList *fHistSECVTX;                   //! Output container for sec. vertexing results
     TList *fHistELECBACKGROUND;           //! Output container for electron background analysis
-//    AliHFEcollection *fQAcoll;            //! collection class for basic QA histograms
+    AliHFEcollection *fQACollection;      //! Tasks own QA collection
 
     ClassDef(AliAnalysisTaskHFE, 2)       // The electron Analysis Task
 };
index 9c450e8..ae8c5e4 100644 (file)
@@ -41,7 +41,7 @@ ClassImp(AliHFEcollection)
 //___________________________________________________________________
 AliHFEcollection::AliHFEcollection():
   TNamed()
-  , fList(0x0)
+  , fList(NULL)
 {
 
   //
@@ -63,7 +63,7 @@ AliHFEcollection::AliHFEcollection():
 //___________________________________________________________________
 AliHFEcollection::AliHFEcollection(const char* name, const char* title):
   TNamed(name, title)
-  , fList(0x0)
+  , fList(NULL)
 {
  
   //
@@ -84,7 +84,7 @@ AliHFEcollection::AliHFEcollection(const char* name, const char* title):
 //___________________________________________________________________
 AliHFEcollection::AliHFEcollection(const AliHFEcollection &c) :
   TNamed(c)
-  , fList(0x0)
+  , fList(NULL)
 {
 
   //
@@ -313,10 +313,10 @@ Bool_t AliHFEcollection::Fill(const char* name, Double_t v){
     return kFALSE;
   }
 
-
+  TH1 *htmp = dynamic_cast<TH1F*>(fList->FindObject(name));
   // chack the possible object types
-  if(fList->FindObject(name)->InheritsFrom("TH1")){
-    (dynamic_cast<TH1F*>(fList->FindObject(name)))->Fill(v);
+  if(htmp){
+    htmp->Fill(v);
     return kTRUE;
   }
   
@@ -392,7 +392,8 @@ Bool_t AliHFEcollection::Fill(const char* name, Double_t v1, Double_t v2){
 
   // chack the possible object types
   if(fList->FindObject(name)->InheritsFrom("TH2")){
-    (dynamic_cast<TH2F*>(fList->FindObject(name)))->Fill(v1, v2);
+    TH2 *h2 = dynamic_cast<TH2F*>(fList->FindObject(name));
+    if(h2) h2->Fill(v1, v2);
     return kTRUE;
   }  
   if(fList->FindObject(name)->InheritsFrom("TProfile")){
@@ -414,8 +415,9 @@ Bool_t AliHFEcollection::Fill(const char* name, Double_t* entry, Double_t weight
     return kFALSE;
   }
   
-   if(fList->FindObject(name)->InheritsFrom("THnSparse")){
-     (dynamic_cast<THnSparseF*>(fList->FindObject(name)))->Fill(entry, weight);
+  THnSparseF *htmp = dynamic_cast<THnSparseF*>(fList->FindObject(name));
+   if(htmp){
+     htmp->Fill(entry, weight);
      return kTRUE;
    }
    return kFALSE;
@@ -449,8 +451,9 @@ Bool_t AliHFEcollection::Sumw2(const char* name){
   }
 
   TObject *o = Get(name);
-  if(o->InheritsFrom("THnSparse")){
-    (dynamic_cast<THnSparse*>(o))->Sumw2();
+  THnSparse *htmp = dynamic_cast<THnSparse*>(o);
+  if(htmp){
+    htmp->Sumw2();
   }
   return kTRUE;
 }
@@ -468,23 +471,28 @@ Bool_t AliHFEcollection::BinLogAxis(const char* name, Int_t dim){
   }
 
   TObject *o = Get(name);
-  TAxis *axis = 0x0;
+  TAxis *axis = NULL;
   if(o->InheritsFrom("TH1")){
-    axis = (dynamic_cast<TH1F*>(o))->GetXaxis();
+    TH1 *h1 = dynamic_cast<TH1F*>(o);
+    if(h1) axis = h1->GetXaxis();
   }
   if(o->InheritsFrom("TH2")){
-    if(0 == dim){
-      axis = (dynamic_cast<TH2F*>(o))->GetXaxis();
-    }
-    else if(1 == dim){
-      axis = (dynamic_cast<TH2F*>(o))->GetYaxis();
+    TH2 *h2 = dynamic_cast<TH2F*>(o);
+    if(h2){
+      if(0 == dim){
+        axis = h2->GetXaxis();
+      }
+      else if(1 == dim){
+        axis = h2->GetYaxis();
+      }
+      else{
+         AliError("Only dim = 0 or 1 possible for TH2F");
+      }
     }
-     else{
-       AliError("Only dim = 0 or 1 possible for TH2F");
-     }
   }
   if(o->InheritsFrom("THnSparse")){
-    axis = (dynamic_cast<THnSparse*>(o))->GetAxis(dim);
+    THnSparse *hs = dynamic_cast<THnSparse*>(o);
+    if(hs) axis = hs->GetAxis(dim);
   }
   
   if(!axis){
@@ -507,7 +515,7 @@ Bool_t AliHFEcollection::BinLogAxis(const char* name, Int_t dim){
     newBins[i] = factor * newBins[i-1];
   }
   axis->Set(bins, newBins);
-  delete newBins;
+  delete[] newBins;
 
   return kTRUE;
 
index 96cc250..f9cd83e 100644 (file)
@@ -298,6 +298,7 @@ void AliHFEcuts::SetEventCutList(Int_t istep){
     evGenCuts->SetVertexXCut(-1, 1);
     evGenCuts->SetVertexYCut(-1, 1);
     evGenCuts->SetVertexZCut(-10, 10);
+    if(IsQAOn()) evGenCuts->SetQAOn(fHistQA);
 
     arr->SetName("fEvGenCuts");
     arr->AddLast(evGenCuts);
@@ -308,7 +309,7 @@ void AliHFEcuts::SetEventCutList(Int_t istep){
     evRecCuts->SetVertexXCut(-1, 1);
     evRecCuts->SetVertexYCut(-1, 1);
     evRecCuts->SetVertexZCut(-30, 30);
-
+    if(IsQAOn()) evRecCuts->SetQAOn(fHistQA);
 
     arr->SetName("fEvRecCuts");
     arr->AddLast(evRecCuts);
index 02b38d0..f21ac0f 100644 (file)
@@ -123,6 +123,22 @@ AliHFEdca::AliHFEdca():
 {
  // default constructor
 
+ for(Int_t j=0; j<kNParticles; j++){
+   fHistMcPid[j] = new TH1F();
+   fHistEsdPid[j] = new TH1F();
+   fHistDataEsdPid[j] = new TH1F();
+ }
+
+ for(Int_t i=0; i<3; i++){
+   fHistMCvertex[i] = new TH1F();
+   fHistESDvertex[i] = new TH1F();
+   fHistDatavertex[i] = new TH1F();   
+ }
+ for(Int_t iEle=0; iEle<2; iEle++){
+   fHistDataHfePid[iEle] = new TH1F();
+ }
+
 }
 
 //________________________________________________________________________
@@ -132,6 +148,22 @@ AliHFEdca::AliHFEdca(const AliHFEdca &ref):
 {
  // copy constructor
 
+ for(Int_t j=0; j<kNParticles; j++){
+   fHistMcPid[j] = ref.fHistMcPid[j];
+   fHistEsdPid[j] = ref.fHistEsdPid[j];
+   fHistDataEsdPid[j] = ref.fHistDataEsdPid[j];
+ }
+
+ for(Int_t i=0; i<3; i++){
+   fHistMCvertex[i] = ref.fHistMCvertex[i];
+   fHistESDvertex[i] = ref.fHistESDvertex[i];
+   fHistDatavertex[i] = ref.fHistDatavertex[i];
+ }
+ for(Int_t iEle=0; iEle<2; iEle++){
+   fHistDataHfePid[iEle] = ref.fHistDataHfePid[iEle];
+ }
+
 }
 //_______________________________________________________________________________________________
 AliHFEdca&AliHFEdca::operator=(const AliHFEdca &ref)
@@ -140,10 +172,10 @@ AliHFEdca&AliHFEdca::operator=(const AliHFEdca &ref)
  // Assignment operator
  //
 
-
  if(this == &ref) return *this;
  TObject::operator=(ref);
  return *this;
+
 }
 
 //________________________________________________________________________
@@ -207,9 +239,9 @@ AliHFEdca::~AliHFEdca()
      if(fHistHPDcaZPull[iEle][iPt]) delete fHistHPDcaZPull[iEle][iPt];  
      if(fHistHPDcaXY[iEle][iPt]) delete fHistHPDcaXY[iEle][iPt];     
      if(fHistHPDcaZ[iEle][iPt]) delete fHistHPDcaZ[iEle][iPt];      
-
-
- // Data
+     
+     
+     // Data
      if(fHistHPDataDcaXY[iEle][iPt]) delete fHistHPDataDcaXY[iEle][iPt];   
      if(fHistHPDataDcaZ[iEle][iPt]) delete fHistHPDataDcaZ[iEle][iPt];   
      if(fHistHPDataDcaXYPull[iEle][iPt]) delete fHistHPDataDcaXYPull[iEle][iPt];   
@@ -226,6 +258,7 @@ AliHFEdca::~AliHFEdca()
  if(fStat) delete fStat;
 
  Printf("analysis done\n");
+
 }
 
 //________________________________________________________________________
@@ -251,11 +284,10 @@ void AliHFEdca::CreateHistogramsResidual(TList *residualList){
  // 1. residual
 
  // for residuals
- fHistDcaXYRes[kNParticles][kNPtBins]=0x0;
- fHistDcaZRes[kNParticles][kNPtBins]=0x0;
-
- fHistEPDcaXYRes[kNParticles-2][kNPtBins]=0x0;
- fHistEPDcaZRes[kNParticles-2][kNPtBins]=0x0;
+  // fHistDcaXYRes[kNParticles][kNPtBins]=0x0;
+  // fHistDcaZRes[kNParticles][kNPtBins]=0x0;
+  // fHistEPDcaXYRes[kNParticles-2][kNPtBins]=0x0;
+ // fHistEPDcaZRes[kNParticles-2][kNPtBins]=0x0;
 
  const Int_t nBins = 1000;
  const Float_t maxXYBin = 1000.;
@@ -278,14 +310,14 @@ void AliHFEdca::CreateHistogramsResidual(TList *residualList){
          fHistDcaXYRes[j][i]->SetLineColor((const int)fgkColorPart[j]);
          if(j<(kNParticles-2)){
            fHistEPDcaXYRes[j][i] = new TH1F((const char*)histEPName, (const char*)histTitle, nBins, -maxXYBin, maxXYBin);
-           fHistEPDcaXYRes[j][i]->SetLineColor((const int)fgkColorPart[j]);}
+           fHistEPDcaXYRes[j][i]->SetLineColor((int)fgkColorPart[j]);}
        }           
        if(k==1){
          fHistDcaZRes[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, -maxZBin, maxZBin);
-         fHistDcaZRes[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDcaZRes[j][i]->SetLineColor((int)fgkColorPart[j]);
          if(j<(kNParticles-2)){
            fHistEPDcaZRes[j][i] = new TH1F((const char*)histEPName, (const char*)histTitle, nBins, -maxZBin, maxZBin);
-           fHistEPDcaZRes[j][i]->SetLineColor((const int)fgkColorPart[j]); }
+           fHistEPDcaZRes[j][i]->SetLineColor((int)fgkColorPart[j]); }
        }   
      } // 50 pt bins
    } //12 nparticles
@@ -321,11 +353,10 @@ void AliHFEdca::CreateHistogramsPull(TList *pullList){
 
 
  // for pull -----------------------------------------------------------------------
- fHistDcaXYPull[kNParticles][kNPtBins]=0x0;
- fHistDcaZPull[kNParticles][kNPtBins]=0x0;
-
- fHistEPDcaXYPull[kNParticles-2][kNPtBins]=0x0;
- fHistEPDcaZPull[kNParticles-2][kNPtBins]=0x0;
+ // fHistDcaXYPull[kNParticles][kNPtBins]=0x0;
+ // fHistDcaZPull[kNParticles][kNPtBins]=0x0;
+ // fHistEPDcaXYPull[kNParticles-2][kNPtBins]=0x0;
+ // fHistEPDcaZPull[kNParticles-2][kNPtBins]=0x0;
 
 
  for(Int_t k=0; k<kNDcaVar; k++){
@@ -341,17 +372,17 @@ void AliHFEdca::CreateHistogramsPull(TList *pullList){
        
        if(k==0){
          fHistDcaXYPull[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, 1-maxXYBin, 1+maxXYBin);
-         fHistDcaXYPull[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDcaXYPull[j][i]->SetLineColor((int)fgkColorPart[j]);
          if(j<(kNParticles-2))    {
            fHistEPDcaXYPull[j][i] = new TH1F((const char*)histEPName, (const char*)histTitle, nBins, 1-maxXYBin, 1+maxXYBin);
-           fHistEPDcaXYPull[j][i]->SetLineColor((const int)fgkColorPart[j]);}
+           fHistEPDcaXYPull[j][i]->SetLineColor((int)fgkColorPart[j]);}
        }           
        if(k==1){
          fHistDcaZPull[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, 1-maxZBin, 1+maxZBin);
-         fHistDcaZPull[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDcaZPull[j][i]->SetLineColor((int)fgkColorPart[j]);
          if(j<(kNParticles-2))    {
            fHistEPDcaZPull[j][i] = new TH1F((const char*)histEPName, (const char*)histTitle, nBins, 1-maxZBin, 1+maxZBin);
-           fHistEPDcaZPull[j][i]->SetLineColor((const int)fgkColorPart[j]);}
+           fHistEPDcaZPull[j][i]->SetLineColor((int)fgkColorPart[j]);}
        }   
      } // 50 pt bins
    } //6 nparticles
@@ -387,11 +418,10 @@ void AliHFEdca::CreateHistogramsDca(TList *dcaList){
  fStat->SetMarkerSize(1); 
 
  // for dca
- fHistDcaXY[kNParticles][kNPtBins]=0x0;
- fHistDcaZ[kNParticles][kNPtBins]=0x0;
-
- fHistEPDcaXY[kNParticles-2][kNPtBins]=0x0;
- fHistEPDcaZ[kNParticles-2][kNPtBins]=0x0;
+ // fHistDcaXY[kNParticles][kNPtBins]=0x0;
+ // fHistDcaZ[kNParticles][kNPtBins]=0x0;
+ // fHistEPDcaXY[kNParticles-2][kNPtBins]=0x0;
+ // fHistEPDcaZ[kNParticles-2][kNPtBins]=0x0;
 
  const Int_t nBins = 1000;
  const Float_t maxXYBin = 1000.;
@@ -412,18 +442,18 @@ void AliHFEdca::CreateHistogramsDca(TList *dcaList){
 
        if(k==0){
          fHistDcaXY[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, -maxXYBin, maxXYBin);
-         fHistDcaXY[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDcaXY[j][i]->SetLineColor((int)fgkColorPart[j]);
          
          if(j<(kNParticles-2)){
            fHistEPDcaXY[j][i] = new TH1F((const char*)histNameEP, (const char*)histTitle, nBins, -maxXYBin, maxXYBin);
-           fHistEPDcaXY[j][i]->SetLineColor((const int)fgkColorPart[j]);}
+           fHistEPDcaXY[j][i]->SetLineColor((int)fgkColorPart[j]);}
        }           
        if(k==1){
          fHistDcaZ[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, -maxZBin, maxZBin);
-         fHistDcaZ[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDcaZ[j][i]->SetLineColor((int)fgkColorPart[j]);
          if(j<(kNParticles-2)){
            fHistEPDcaZ[j][i] = new TH1F((const char*)histNameEP, (const char*)histTitle, nBins, -maxZBin, maxZBin);
-           fHistEPDcaZ[j][i]->SetLineColor((const int)fgkColorPart[j]);}
+           fHistEPDcaZ[j][i]->SetLineColor((int)fgkColorPart[j]);}
        }   
      } // 50 pt bins
    } //12 nparticles
@@ -460,8 +490,8 @@ void AliHFEdca::CreateHistogramsKfDca(TList *kfDcaList){
  fStat->SetMarkerSize(1); 
 
  // for kf dca
- fHistKFDcaXY[kNParticles][kNPtBins]=0x0;
- fHistKFDcaZ[kNParticles][kNPtBins]=0x0;
+ // fHistKFDcaXY[kNParticles][kNPtBins]=0x0;
+ // fHistKFDcaZ[kNParticles][kNPtBins]=0x0;
 
  const Int_t nBins = 1000;
  const Float_t maxXYBin = 1000.;
@@ -478,11 +508,11 @@ void AliHFEdca::CreateHistogramsKfDca(TList *kfDcaList){
        
        if(k==0){
          fHistKFDcaXY[j][i] = new TH1F((const char*)histNameKF, (const char*)histTitle, nBins, -maxXYBin, maxXYBin);
-         fHistKFDcaXY[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistKFDcaXY[j][i]->SetLineColor((int)fgkColorPart[j]);
        }           
        if(k==1){
          fHistKFDcaZ[j][i] = new TH1F((const char*)histNameKF, (const char*)histTitle, nBins, -maxZBin, maxZBin);
-         fHistKFDcaZ[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistKFDcaZ[j][i]->SetLineColor((int)fgkColorPart[j]);
        }   
      } // 50 pt bins
    } //12 nparticles
@@ -509,11 +539,10 @@ void AliHFEdca::CreateHistogramsDataDca(TList *dataDcaList){
  //
 
  // for dca
- fHistDataDcaXY[kNParticles][kNPtBins]=0x0;
- fHistDataDcaZ[kNParticles][kNPtBins]=0x0;
-
- fHistDataWoDcaXY[kNParticles][kNPtBins]=0x0;
- fHistDataWoDcaZ[kNParticles][kNPtBins]=0x0;
+//  fHistDataDcaXY[kNParticles][kNPtBins]=0x0;
+//  fHistDataDcaZ[kNParticles][kNPtBins]=0x0;
+//  fHistDataWoDcaXY[kNParticles][kNPtBins]=0x0;
+//  fHistDataWoDcaZ[kNParticles][kNPtBins]=0x0;
 
  const Int_t nBins = 1000;
  const Float_t maxXYBin = 1000.;
@@ -532,17 +561,17 @@ void AliHFEdca::CreateHistogramsDataDca(TList *dataDcaList){
        
        if(k==0){
          fHistDataDcaXY[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, -maxXYBin, maxXYBin);
-         fHistDataDcaXY[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataDcaXY[j][i]->SetLineColor((int)fgkColorPart[j]);
 
          fHistDataWoDcaXY[j][i] = new TH1F((const char*)histNameWo, (const char*)histTitle, nBins, -maxXYBin, maxXYBin);
-         fHistDataWoDcaXY[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataWoDcaXY[j][i]->SetLineColor((int)fgkColorPart[j]);
        }           
        if(k==1){
          fHistDataDcaZ[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, -maxZBin, maxZBin);
-         fHistDataDcaZ[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataDcaZ[j][i]->SetLineColor((int)fgkColorPart[j]);
 
          fHistDataWoDcaZ[j][i] = new TH1F((const char*)histNameWo, (const char*)histTitle, nBins, -maxZBin, maxZBin);
-         fHistDataWoDcaZ[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataWoDcaZ[j][i]->SetLineColor((int)fgkColorPart[j]);
        }   
      } // 50 pt bins
    } //12 nparticles
@@ -575,11 +604,11 @@ void AliHFEdca::CreateHistogramsDataPull(TList *dataPullList){
  const Float_t maxZBin = 20.;
 
  // for pull -----------------------------------------------------------------------
- fHistDataDcaXYPull[kNParticles][kNPtBins]=0x0;
- fHistDataDcaZPull[kNParticles][kNPtBins]=0x0;
+//  fHistDataDcaXYPull[kNParticles][kNPtBins]=0x0;
+//  fHistDataDcaZPull[kNParticles][kNPtBins]=0x0;
 
- fHistDataWoDcaXYPull[kNParticles][kNPtBins]=0x0;
- fHistDataWoDcaZPull[kNParticles][kNPtBins]=0x0;
+//  fHistDataWoDcaXYPull[kNParticles][kNPtBins]=0x0;
+//  fHistDataWoDcaZPull[kNParticles][kNPtBins]=0x0;
 
 
  for(Int_t k=0; k<kNDcaVar; k++){
@@ -596,17 +625,17 @@ void AliHFEdca::CreateHistogramsDataPull(TList *dataPullList){
        
        if(k==0){
          fHistDataDcaXYPull[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, 1-maxXYBin, 1+maxXYBin);
-         fHistDataDcaXYPull[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataDcaXYPull[j][i]->SetLineColor((int)fgkColorPart[j]);
 
          fHistDataWoDcaXYPull[j][i] = new TH1F((const char*)histNameWo, (const char*)histTitle, nBins, 1-maxXYBin, 1+maxXYBin);
-         fHistDataWoDcaXYPull[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataWoDcaXYPull[j][i]->SetLineColor((int)fgkColorPart[j]);
        }           
        if(k==1){
          fHistDataDcaZPull[j][i] = new TH1F((const char*)histName, (const char*)histTitle, nBins, 1-maxZBin, 1+maxZBin);
-         fHistDataDcaZPull[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataDcaZPull[j][i]->SetLineColor((int)fgkColorPart[j]);
 
          fHistDataWoDcaZPull[j][i] = new TH1F((const char*)histNameWo, (const char*)histTitle, nBins, 1-maxZBin, 1+maxZBin);
-         fHistDataWoDcaZPull[j][i]->SetLineColor((const int)fgkColorPart[j]);
+         fHistDataWoDcaZPull[j][i]->SetLineColor((int)fgkColorPart[j]);
        }   
      } // 50 pt bins
    } //6 nparticles
@@ -634,8 +663,8 @@ void AliHFEdca::CreateHistogramsVertex(TList *vertexList){
  //
  // for  vertex
 
- fHistMCvertex[kNVertexVar]=0x0;
- fHistESDvertex[kNVertexVar]=0x0;
+//  fHistMCvertex[kNVertexVar]=0x0;
+//  fHistESDvertex[kNVertexVar]=0x0;
 
  const Int_t nBins = 1000;
  const Float_t minXBin = -0.2e4;
@@ -681,7 +710,7 @@ void AliHFEdca::CreateHistogramsDataVertex(TList *dataVertexList){
  //
  // for data vertex
 
- fHistDatavertex[kNVertexVar]=0x0;
+//  fHistDatavertex[kNVertexVar]=0x0;
 
  const Int_t nBins = 1000;
  const Float_t minXBin = -0.2e4;
@@ -813,7 +842,8 @@ void AliHFEdca::FillHistogramsDca(AliESDEvent * const esdEvent, AliESDtrack * co
  if(!track->PropagateToDCA(primVtx,magneticField, beampiperadius, dz, covardz)) return;  // protection
  track->PropagateToDCA(primVtx,magneticField, beampiperadius, dz, covardz);
 
- AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(track->GetLabel())));  
+ AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(track->GetLabel()))); 
+ if(!mctrack) return;
  TParticle *part = mctrack->Particle();
 
  Float_t vx = part->Vx();  // in cm
@@ -931,6 +961,7 @@ void AliHFEdca::FillHistogramsKfDca(AliESDEvent * const esdEvent, AliESDtrack *
  track->PropagateToDCA(primVtx,magneticField,  beampiperadius, dz, covardz);
 
  AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(track->GetLabel())));  
+ if(!mctrack) return;
  TParticle *part = mctrack->Particle();    
  Int_t pdg = part->GetPdgCode();
 
@@ -1061,6 +1092,7 @@ void AliHFEdca::FillHistogramsPid(AliESDtrack * const track, AliMCEvent * const
  Float_t esdpt = TMath::Sqrt(esdpx*esdpx+esdpy*esdpy);    
 
  AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(track->GetLabel())));  
+ if(!mctrack) return;
  TParticle *part = mctrack->Particle();
 
  Float_t mcpx = part->Px();
@@ -1249,10 +1281,17 @@ void AliHFEdca::ApplyExtraCuts(AliESDEvent * const esdEvent, Int_t nMinPrimVtxCo
 Int_t AliHFEdca::GetCombinedPid(AliESDtrack *const track) 
 {
 
- //combined detector pid             
+ // combined detector pid             
  Double_t prob[AliPID::kSPECIES];
  track->GetESDpid(prob);
- Double_t priors[5] = {0.01, 0.01, 0.85, 0.10, 0.05};
+
+ // setting priors!
+ Double_t priors[AliPID::kSPECIESN];
+ priors[0] = 0.01;
+ priors[1] = 0.01;
+ priors[2] = 0.85;
+ priors[3] = 0.10;
+ priors[4] = 0.05;
 
  Int_t charge = track->Charge();
  Int_t esdPid = -1; 
@@ -1317,12 +1356,12 @@ void AliHFEdca::CreateHistogramsHfeDca(TList *hfeDcaList){
 
  const Char_t *mcOResd[2]={"mcPt", "esdPt"};
 
- fHistHPDcaXY[2][kNPtBins]=0x0;
- fHistHPDcaZ[2][kNPtBins]=0x0;
- fHistHPDcaXYRes[2][kNPtBins]=0x0;
- fHistHPDcaZRes[2][kNPtBins]=0x0;
- fHistHPDcaXYPull[2][kNPtBins]=0x0;
- fHistHPDcaZPull[2][kNPtBins]=0x0;
+//  fHistHPDcaXY[2][kNPtBins]=0x0;
+//  fHistHPDcaZ[2][kNPtBins]=0x0;
+//  fHistHPDcaXYRes[2][kNPtBins]=0x0;
+//  fHistHPDcaZRes[2][kNPtBins]=0x0;
+//  fHistHPDcaXYPull[2][kNPtBins]=0x0;
+//  fHistHPDcaZPull[2][kNPtBins]=0x0;
 
 
  for(Int_t k=0; k<kNDcaVar; k++){
@@ -1342,26 +1381,26 @@ void AliHFEdca::CreateHistogramsHfeDca(TList *hfeDcaList){
        
        if(k==0){
          fHistHPDcaXY[iPart][i] = new TH1F((const char*)histHPName, (const char*)histTitleDca, nBinsDca, 1-maxXYBinDca, 1+maxXYBinDca);
-         fHistHPDcaXY[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDcaXY[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
          fHistHPDcaXYRes[iPart][i] = new TH1F((const char*)histHPNameRes, (const char*)histTitleRes, nBinsDca, 1-maxXYBinDca, 1+maxXYBinDca);
-         fHistHPDcaXYRes[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDcaXYRes[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
          fHistHPDcaXYPull[iPart][i] = new TH1F((const char*)histHPNamePull, (const char*)histTitlePull, nBinsPull, 1-maxXYBinPull, 1+maxXYBinPull);
-         fHistHPDcaXYPull[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDcaXYPull[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
        }
        
        if(k==1){
          fHistHPDcaZ[iPart][i] = new TH1F((const char*)histHPName, (const char*)histTitleDca, nBinsDca, 1-maxZBinDca, 1+maxZBinDca);
-         fHistHPDcaZ[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDcaZ[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
          fHistHPDcaZRes[iPart][i] = new TH1F((const char*)histHPNameRes, (const char*)histTitleRes, nBinsDca, 1-maxZBinDca, 1+maxZBinDca);
-         fHistHPDcaZRes[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDcaZRes[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
          fHistHPDcaZPull[iPart][i] = new TH1F((const char*)histHPNamePull, (const char*)histTitlePull, nBinsPull, 1-maxZBinPull, 1+maxZBinPull);
-         fHistHPDcaZPull[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDcaZPull[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
        }
      } // 50 pt bins
    } //2 nparticles
  } // 2 dca var
 
- fHistHfePid[2][2] = 0x0; //!  HFE pid  
+ // fHistHfePid[2][2] = 0x0; //!  HFE pid  
  for(Int_t id=0; id<2; id++){
    for(Int_t iPart=0; iPart<2; iPart++){
      TString histTitleHfe((const char*)fgkParticles[iPart*5]);
@@ -1405,10 +1444,10 @@ void AliHFEdca::CreateHistogramsHfeDataDca(TList *hfeDataDcaList){
  const Float_t maxZBinPull = 20.;
 
 
- fHistHPDataDcaXY[2][kNPtBins]=0x0;
- fHistHPDataDcaZ[2][kNPtBins]=0x0;
- fHistHPDataDcaXYPull[2][kNPtBins]=0x0;
- fHistHPDataDcaZPull[2][kNPtBins]=0x0;
+//  fHistHPDataDcaXY[2][kNPtBins]=0x0;
+//  fHistHPDataDcaZ[2][kNPtBins]=0x0;
+//  fHistHPDataDcaXYPull[2][kNPtBins]=0x0;
+//  fHistHPDataDcaZPull[2][kNPtBins]=0x0;
 
  for(Int_t k=0; k<kNDcaVar; k++){
    TString histTitleDca((const char*)fgkDcaVarTitle[k]);
@@ -1422,16 +1461,16 @@ void AliHFEdca::CreateHistogramsHfeDataDca(TList *hfeDataDcaList){
        
        if(k==0){
          fHistHPDataDcaXY[iPart][i] = new TH1F((const char*)histHPName, (const char*)histTitleDca, nBinsDca, 1-maxXYBinDca, 1+maxXYBinDca);
-         fHistHPDataDcaXY[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDataDcaXY[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
          fHistHPDataDcaXYPull[iPart][i] = new TH1F((const char*)histHPNamePull, (const char*)histTitlePull, nBinsPull, 1-maxXYBinPull, 1+maxXYBinPull);
-         fHistHPDataDcaXYPull[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDataDcaXYPull[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
        }
        
        if(k==1){
          fHistHPDataDcaZ[iPart][i] = new TH1F((const char*)histHPName, (const char*)histTitleDca, nBinsDca, 1-maxZBinDca, 1+maxZBinDca);
-         fHistHPDataDcaZ[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDataDcaZ[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
          fHistHPDataDcaZPull[iPart][i] = new TH1F((const char*)histHPNamePull, (const char*)histTitlePull, nBinsDca, 1-maxZBinPull, 1+maxZBinPull);
-         fHistHPDataDcaZPull[iPart][i]->SetLineColor((const int)fgkColorPart[iPart*5]);
+         fHistHPDataDcaZPull[iPart][i]->SetLineColor((int)fgkColorPart[iPart*5]);
        }
        
      } // 50 pt bins
@@ -1501,6 +1540,7 @@ void AliHFEdca::FillHistogramsHfeDca(AliESDEvent * const esdEvent, AliESDtrack *
  track->PropagateToDCA(primVtx,magneticField, beampiperadius, dz, covardz);
 
  AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(track->GetLabel())));  
+ if(!mctrack) return;
  TParticle *part = mctrack->Particle();
 
  Float_t vx = part->Vx();  // in cm
index 13174da..5588a66 100644 (file)
@@ -198,7 +198,7 @@ void AliHFEdisplacedElectrons::CreateOutputs(TList* const displacedList){
   // electron source 
   Int_t nBinsEleSource = 10;
   Double_t minEleSource = -1.5; 
-  Double_t maxEleSource = 9.5;  
+  Double_t maxEleSource = 8.5;  
   Double_t *binLimEleSource = new Double_t[nBinsEleSource+1];
   for(Int_t i=0; i<=nBinsEleSource; i++)
     binLimEleSource[i] = minEleSource + i*(maxEleSource-minEleSource)/nBinsEleSource;
@@ -244,33 +244,51 @@ void AliHFEdisplacedElectrons::CreateOutputs(TList* const displacedList){
   for(Int_t i=0; i<=nBinsPhi; i++)
     binLimPhi[i] = minPhi + i*(maxPhi-minPhi)/nBinsPhi;
 
+  // production radii
+  Int_t nBinsR = 30;
+  Double_t minR = 0; 
+  Double_t maxR = 15;
+  Double_t *binLimR = new Double_t[nBinsR+1];
+  for(Int_t i=0; i<=nBinsR; i++)
+    binLimR[i] = minR + i*(maxR-minR)/nBinsR;
+
+  // status
+  Int_t nBinsStat = 11;
+  Double_t minStat = 0; 
+  Double_t maxStat = 11;
+  Double_t *binLimStat = new Double_t[nBinsStat+1];
+  for(Int_t i=0; i<=nBinsStat; i++)
+    binLimStat[i] = minStat + i*(maxStat-minStat)/nBinsStat;
 
   fTHnSparseDcaMcEleInfo = 0x0;
   fTHnSparseDcaEsdEleInfo = 0x0;
   fTHnSparseDcaDataEleInfo = 0x0;
 
   // for MC only: MC electron ID
-  const Int_t nVarMc = 6;
-  Int_t iBinMc[nVarMc] = {nBinsEleSource, nBinsDcaXY, nBinsDcaZ, nBinsPt, nBinsRap, nBinsPhi};
-     
+  const Int_t nVarMc = 8;
+  Int_t iBinMc[nVarMc] = {nBinsEleSource, nBinsDcaXY, nBinsDcaZ, nBinsPt, nBinsRap, nBinsPhi, nBinsR, nBinsStat};
+  
   fTHnSparseDcaMcEleInfo = new THnSparseF("dcaMcElectronInfo", 
-                                          "MC electrons;electron source ID;mc dcaXY [50 #mum];mc dcaZ [100 #mum];mc pT [GeV/c];mc y [rapidity];mc #phi [rad];",        
+                                          "MC electrons;electron source ID;mc dcaXY [50 #mum];mc dcaZ [100 #mum];mc pT [GeV/c];mc y [rapidity];mc #phi [rad];mc R [cm];Status Code",   
                                           nVarMc, iBinMc);
+
   fTHnSparseDcaMcEleInfo->SetBinEdges(0, binLimEleSource); // electron source
   fTHnSparseDcaMcEleInfo->SetBinEdges(1, binLimDcaXY);  // dca xy cut
   fTHnSparseDcaMcEleInfo->SetBinEdges(2, binLimDcaZ);  // dca z cut
   fTHnSparseDcaMcEleInfo->SetBinEdges(3, binLimPt);   // pt
   fTHnSparseDcaMcEleInfo->SetBinEdges(4, binLimRap);  // rapidity
   fTHnSparseDcaMcEleInfo->SetBinEdges(5, binLimPhi);  // phi
-  fTHnSparseDcaMcEleInfo->Sumw2();
-  
+  fTHnSparseDcaMcEleInfo->SetBinEdges(6, binLimR);
+  fTHnSparseDcaMcEleInfo->SetBinEdges(7, binLimStat);
+  fTHnSparseDcaMcEleInfo->Sumw2();  
+
   // for ESD with MC: HFE pid and MC pid
-  const Int_t nVarEsd = 7;
-  Int_t iBin[nVarEsd] = {nBinsEleSource,nBinsDcaXY, nBinsDcaZ, nBinsDcaXY, nBinsPt, nBinsRap, nBinsPhi};
+  const Int_t nVarEsd = 9;
+  Int_t iBin[nVarEsd] = {nBinsEleSource,nBinsDcaXY, nBinsDcaZ, nBinsDcaXY, nBinsPt, nBinsRap, nBinsPhi, nBinsR, nBinsStat};
   
   fTHnSparseDcaEsdEleInfo 
     = new THnSparseF("dcaEsdElectronInfo", 
-                    "ESD electrons;electron source ID;esd dcaXY [50 #mum];esd dcaZ [100 #mum];esd dcaXY KF [50 #mum];pT [GeV/c];y [rapidity];#phi [rad];",             
+                    "ESD electrons;electron source ID;esd dcaXY [50 #mum];esd dcaZ [100 #mum];esd dcaXY KF [50 #mum];pT [GeV/c];y [rapidity];#phi [rad];R [cm];Status Code",           
                     nVarEsd, iBin);
 
   fTHnSparseDcaEsdEleInfo->SetBinEdges(0, binLimEleSource); // electron source
@@ -280,8 +298,12 @@ void AliHFEdisplacedElectrons::CreateOutputs(TList* const displacedList){
   fTHnSparseDcaEsdEleInfo->SetBinEdges(4, binLimPt);   // pt esd
   fTHnSparseDcaEsdEleInfo->SetBinEdges(5, binLimRap);  // rapidity esd
   fTHnSparseDcaEsdEleInfo->SetBinEdges(6, binLimPhi);  // phi esd
+  fTHnSparseDcaEsdEleInfo->SetBinEdges(7, binLimR);
+  fTHnSparseDcaEsdEleInfo->SetBinEdges(8, binLimStat);
   fTHnSparseDcaEsdEleInfo->Sumw2();
   
+  printf(" CCCCCCCCCCCCCCCCCCCCCCCCCC \n");
+
   // for ESD data: HFE pid
   const Int_t nVarData = 6;
   Int_t iBinData[nVarData] = {nBinsDcaXY, nBinsDcaZ, nBinsDcaXY, nBinsPt, nBinsRap, nBinsPhi};  
@@ -328,7 +350,7 @@ void AliHFEdisplacedElectrons::FillMcOutput(AliESDEvent *const fESD, AliMCEvent*
   mcPrimV[1] = mcPrimVtx->GetY();
   mcPrimV[2] = mcPrimVtx->GetZ();
 
- Double_t mcVtxXY = TMath::Abs(mcPrimV[0]*mcPrimV[0] + mcPrimV[1]*mcPrimV[1]);
+  Double_t mcVtxXY = TMath::Abs(mcPrimV[0]*mcPrimV[0] + mcPrimV[1]*mcPrimV[1]);
 
   Float_t vx = part->Vx();  // in cm
   Float_t vy = part->Vy();  // in cm
@@ -342,6 +364,11 @@ void AliHFEdisplacedElectrons::FillMcOutput(AliESDEvent *const fESD, AliMCEvent*
   Float_t mceta = part->Eta();
   Float_t mcphi = part->Phi();
 
+  // begin new stuff
+  Double_t mcR = part->R();
+  Int_t mcStatus = part->GetStatusCode();
+  // end new staff
+
   Int_t pdg = part->GetPdgCode();
   
   Int_t charge = 1;
@@ -365,7 +392,7 @@ void AliHFEdisplacedElectrons::FillMcOutput(AliESDEvent *const fESD, AliMCEvent*
   Double_t mcDcaXY = mcDca[0]*1.0e4;  // conv dca in cm to dca in micron 
   Double_t mcDcaZ = mcDca[1]*1.0e4;
     
-  const Int_t nvarMC=6;
+  const Int_t nvarMC=8;
   Double_t var[nvarMC];
   var[0] = -1;
   
@@ -431,9 +458,12 @@ void AliHFEdisplacedElectrons::FillMcOutput(AliESDEvent *const fESD, AliMCEvent*
   else
     var[2] = ((mcDcaZ>0)?1:-1)*10;
         
-    var[3] = mcpt;  // pt 
-    var[4] = mceta; // eta
-    var[5] = mcphi; // phi    
+    var[3] = mcpt;      // pt 
+    var[4] = mceta;     // eta
+    var[5] = mcphi;     // phi    
+    var[6] = mcR;       // production radius
+    var[7] = mcStatus;  // internal status
+
 
     (dynamic_cast<THnSparseF *>(fDeOutputList->At(kMcElectron)))->Fill(var);
 }
@@ -447,7 +477,7 @@ void AliHFEdisplacedElectrons::FillEsdOutput(AliESDEvent * const fESDEvent, AliE
   // this is the case for ESD tracks, with MC information
 
   AliESDtrack *track = esdTrack;
-  Double_t pt   = track->Pt();
+  Double_t pt  = track->Pt();
   Double_t eta = track->Eta();
   Double_t phi = track->Phi();
   
@@ -457,27 +487,26 @@ void AliHFEdisplacedElectrons::FillEsdOutput(AliESDEvent * const fESDEvent, AliE
   TParticle *particle = stack->Particle(eleLabel);
   if(!particle) return;
 
+  // begin new stuff
+  Double_t mcR = particle->R();
+  Int_t mcStatus = particle->GetStatusCode();
+  // end new staff
+
   // obtain impact parameters in xy and z
-  
   Float_t magneticField = 5;  // initialized as 5kG
   magneticField = fESDEvent->GetMagneticField();  // in kG 
   Double_t beampiperadius=3.;  
   const AliESDVertex *primVtx = fESDEvent->GetPrimaryVertex();      
 
   
-  const Int_t nvarESD = 7;
+  const Int_t nvarESD = 9;
   Double_t var[nvarESD];
   var[0] = -1;
 
   Int_t sourcePdg = -1;
 
-  if(TMath::Abs(particle->GetPdgCode())!=kPDGelectron)
-    if(TMath::Abs(particle->GetPdgCode())!=kPDGpion)
-      var[0] = kEleMissID;
-    else
-      var[0] = kEleMissIDpion;
-  
-  else {
+  if(TMath::Abs(particle->GetPdgCode())==kPDGelectron){
+    
     sourcePdg = ElectronFromSource(stack, eleLabel);     
     
     if(sourcePdg==kPDGgamma){ // check direct photon or not 
@@ -487,42 +516,21 @@ void AliHFEdisplacedElectrons::FillEsdOutput(AliESDEvent * const fESDEvent, AliE
        var[0] = kElePhotonConv;     
       if(fDeDebugLevel>=10) 
        printf("photonconv=====this electron %d is from %d, source id=%.1f\n", eleLabel, sourcePdg, var[0]);   
-    }   // photon or direct photon -> e
-    
-    if(sourcePdg==kPDGpi0){      
+    } else if(sourcePdg==kPDGpi0){ // check dalitz     
       var[0] = kElePi0;   
       if(fDeDebugLevel>=10) printf("pi0======this electron %d is from %d, source id=%.1f\n", eleLabel, sourcePdg, var[0]);    
-    } 
-    
-    if(sourcePdg==kPDGeta){ 
+    } else if(sourcePdg==kPDGeta){ // check eta
       var[0] = kEleEta;     
       if(fDeDebugLevel>=10) 
        printf("eta=====this electron %d is from %d, source id=%.1f\n", eleLabel, sourcePdg, var[0]);    
-    }   // from eta -> e
-    
-    if(TMath::Abs(sourcePdg%10000)/100==kPDGbeauty ||    // for special intermediate meson states: like 100553       
-       TMath::Abs(sourcePdg)/1000==kPDGbeauty ||      
-       TMath::Abs(sourcePdg)/100==kPDGbeauty ||     
-       TMath::Abs(sourcePdg)==kPDGbeauty){     
-      var[0]=kEleB;       
-      if(fDeDebugLevel>=10) 
-       printf("beauty======electron %d is from %d with id %.1f\n", eleLabel, ElectronFromSource(stack, eleLabel), var[0]);   
-    } // direct beauty  -> e      
-    if(TMath::Abs(sourcePdg%10000)/100==kPDGcharm ||    // for special intermediate meson states: like 1004**      
-       TMath::Abs(sourcePdg)/1000==kPDGcharm ||       
-       TMath::Abs(sourcePdg)/100==kPDGcharm ||        
-       TMath::Abs(sourcePdg)==kPDGcharm){           
-      // two cases: 
-      //            electron from b->c->e     
-      //            electron from c->e     
-      if(ElectronFromCharm(stack, eleLabel)!=-1){
-       var[0] = ElectronFromCharm(stack, eleLabel);
-       if(fDeDebugLevel>=10)
-         printf("charm----->electron %d has mother %d is from %.1f\n", eleLabel, ElectronFromSource(stack, eleLabel), var[0]);
-      } 
-    }  // charm electrons: b->c->e or c->e
-  }  // correct pid 
+    } else if(IsB(sourcePdg)) var[0] = kEleB; // check beauty
+      else if(IsC(sourcePdg)) var[0] = CheckCharm(stack,eleLabel); // check charm 
     
+  } else if(TMath::Abs(particle->GetPdgCode())==kPDGpion) var[0] = kEleMissIDpion;
+  else var[0] = kEleMissID;
+  // ---- PID END ---- 
+  
+
   // excluding current track
   // ---- beginning --- method from Andrea D 28.05.2010
   AliVertexerTracks *vertexer = new AliVertexerTracks(magneticField);
@@ -583,6 +591,8 @@ void AliHFEdisplacedElectrons::FillEsdOutput(AliESDEvent * const fESDEvent, AliE
   var[4] = pt;  // pt 
   var[5] = eta; // eta
   var[6] = phi; // phi    
+  var[7] = mcR;
+  var[8] = mcStatus;
   
   (dynamic_cast<THnSparseF *>(fDeOutputList->At(kEsdElectron)))->Fill(var);
   
@@ -742,10 +752,8 @@ Int_t AliHFEdisplacedElectrons::ElectronFromCharm(AliStack * const stack, Int_t
        TMath::Abs(pdgCode)/100==kPDGcharm || 
        TMath::Abs(pdgCode)==kPDGcharm){
       
-      if(CharmFromBeauty(stack, gMotherLabel)!=-1)
-       return kEleBC;
-      else
-       return kEleC;
+      if(CharmFromBeauty(stack, gMotherLabel)!=-1) return kEleBC;
+      else return kEleC;
       
     }
   
@@ -904,3 +912,46 @@ Float_t AliHFEdisplacedElectrons::GetTrackRapidity(AliESDtrack * const track) co
   
   return rapidity;
 }
+
+//__________________________________________________________
+Int_t AliHFEdisplacedElectrons::CheckCharm(AliStack * const stack, Int_t eleLabel)
+{
+  // checks the genealogy of the ele from charm for a beauty
+  // this method needs the stack and the label of the electron
+  // warning: it assumes that the ele comes from a charm
+
+  TParticle *particle = stack->Particle(eleLabel);
+  Int_t label = particle->GetFirstMother();
+
+  while(label>0 && label<(stack->GetNtrack())){
+    particle = stack->Particle(label);
+    if(IsB(TMath::Abs(particle->GetPdgCode()))) return kEleBC;
+    label = particle->GetFirstMother();
+  }
+
+  return kEleC; 
+}
+
+//__________________________________________________________
+Bool_t AliHFEdisplacedElectrons::IsB(Int_t pdg)
+{
+  // check if the pdg is that of a beauty particle
+  if((TMath::Abs(pdg)%10000)/100==kPDGbeauty ||  
+     TMath::Abs(pdg)/1000==kPDGbeauty ||      
+     TMath::Abs(pdg)/100==kPDGbeauty ||     
+     TMath::Abs(pdg)==kPDGbeauty) return kTRUE;
+  else return kFALSE;
+} 
+
+//__________________________________________________________
+Bool_t AliHFEdisplacedElectrons::IsC(Int_t pdg)
+{
+  // check if the pdg is that of a charmed particle
+   
+  if((TMath::Abs(pdg)%10000)/100==kPDGcharm ||   
+     TMath::Abs(pdg)/1000==kPDGcharm ||       
+     TMath::Abs(pdg)/100==kPDGcharm ||        
+     TMath::Abs(pdg)==kPDGcharm) return kTRUE;
+  else return kFALSE; 
+}
index cba6f1e..e681653 100644 (file)
@@ -127,6 +127,10 @@ class AliHFEdisplacedElectrons : public TObject{
     kNKineVar = 3
   };   // several constant to be used
  
+
+  Int_t CheckCharm(AliStack *const stack, Int_t eleLabel);
+  Bool_t IsB(Int_t pdg);
+  Bool_t IsC(Int_t pdg);
  
   Int_t ElectronFromSource(AliStack *stack, Int_t eleLabel) const;
   Int_t ElePhotonDirect(AliStack *stack, Int_t label) const;
index 74211b0..8306241 100644 (file)
@@ -52,6 +52,7 @@
 #include "AliCFContainer.h"
 #include "AliHFEpid.h"
 #include "AliESDpid.h"
+#include "AliLog.h"
 #include "AliITSPIDResponse.h"
 #include "AliTPCPIDResponse.h"
 
@@ -62,7 +63,10 @@ const Double_t    AliHFEelecbackground::fgkMe = 0.00051099892;
 
 //___________________________________________________________________________________________
 AliHFEelecbackground::AliHFEelecbackground():
-  fESD1(0x0)
+  fhtmp(0x0)
+  ,fhtmpf(0x0)
+  ,fhtmpp(0x0)
+  ,fESD1(0x0)
   ,fAOD1(0x0)
   ,fMCEvent(0x0)
   ,fBz(0)
@@ -98,12 +102,18 @@ AliHFEelecbackground::AliHFEelecbackground():
   //
   // Default constructor
   //
+  for(Int_t k =0; k < 10; k++) {
+    fCuts[k] = kFALSE;
+  }
   
 }
 
 //_______________________________________________________________________________________________
 AliHFEelecbackground::AliHFEelecbackground(const AliHFEelecbackground &p):
   TObject(p)
+  ,fhtmp(0x0)
+  ,fhtmpf(0x0)
+  ,fhtmpp(0x0)
   ,fESD1(0x0)
   ,fAOD1(0x0)
   ,fMCEvent(0x0)
@@ -140,6 +150,9 @@ AliHFEelecbackground::AliHFEelecbackground(const AliHFEelecbackground &p):
   //
   // Copy constructor
   //
+  for(Int_t k =0; k < 10; k++) {
+    fCuts[k] = kFALSE;
+  }
 }
 
 //_______________________________________________________________________________________________
@@ -624,8 +637,9 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
       cuteffect[0] = fPtESD;
       cuteffect[1] = 0.0;
       cuteffect[2] = fIsFrom;
-      if(!fCuts[0]) {
-       if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+      if(!fCuts[0]){
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+       //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
        fCuts[0] = kTRUE;
       }
     }
@@ -640,7 +654,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
     if(HasMCData() && fIsPartner) {
       cuteffect[1] = 1.0;
       if(!fCuts[1]) {
-       if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+       //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
        fCuts[1] = kTRUE;
       }
     }
@@ -654,7 +669,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
     if(HasMCData() && fIsPartner && (sign == kOs)) {
       cuteffect[1] = 2.0;
       if(!fCuts[2]) {
-       if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+       //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
        fCuts[2] = kTRUE;
       }
     }
@@ -669,7 +685,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
     if(HasMCData() && fIsPartner && (sign==kOs)) {
       cuteffect[1] = 3.0;
       if(!fCuts[3]) {
-       if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+       //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
        fCuts[3] = kTRUE;
       }
     }
@@ -684,7 +701,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
     if(HasMCData() && fIsPartner && (sign==kOs)) {
       cuteffect[1] = 4.0;
       if(!fCuts[4]) {
-       if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+       //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
        fCuts[4] = kTRUE;
       }
     } 
@@ -699,7 +717,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
     if(HasMCData() && fIsPartner && (sign==kOs)) {
       cuteffect[1] = 5.0;
       if(!fCuts[5]) {
-       if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+       //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
        fCuts[5] = kTRUE;
       }
     }
@@ -712,22 +731,28 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
   
   Double_t xthis,xp;
   Double_t dca = track->GetDCA(trackPart,fBz,xthis,xp);
-  (dynamic_cast<TH1F *>(fList->At(kDatadca)))->Fill(dca);
+  if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatadca)))) fhtmpp->Fill(dca);
   if(HasMCData()) {
     //printf("has MC data for DCA\n");
     //printf("IsPartner %d and isfrom %d\n",fIsPartner,fIsFrom);
-    if((fIsFrom==kElectronFromBackground) && (fList->At(kMCdca))) (dynamic_cast<TH2F *>(fList->At(kMCdca)))->Fill(dca,fIsFrom);
+    if(fIsFrom==kElectronFromBackground) {
+      if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
+    }
     else {
-      if(fIsPartner && (fList->At(kMCdca))) (dynamic_cast<TH2F *>(fList->At(kMCdca)))->Fill(dca,fIsFrom);
+      if(fIsPartner){
+       if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
+      }
     }
   }
+   
   if(TMath::Abs(dca) > 3.0) return;
-
+  
   if(fDebugLevel > 0) {  
     if(HasMCData() && fIsPartner && (sign==kOs)) {
       cuteffect[1] = 6.0;
       if(!fCuts[6]) {
-       if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+       //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
        fCuts[6] = kTRUE;
       }
     }
@@ -772,7 +797,8 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
       if(HasMCData() && fIsPartner && (sign==kOs)) {
        cuteffect[1] = 7.0;
        if(!fCuts[7]) {
-         if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+         if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+         //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
          fCuts[7] = kTRUE;
        }
       }
@@ -793,13 +819,15 @@ void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* c
        
        cuteffect[1] = 8.0;
        if(!fCuts[8]) {
-        if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+         if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+         //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
          fCuts[8] = kTRUE;
        }
        if(TMath::Abs(results[1]) < fInvMassCut) {
          cuteffect[1] = 9.0;
          if(!fCuts[9]) {
-           if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
+           if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
+           //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
            fCuts[9] = kTRUE;
          }
        }
@@ -906,20 +934,31 @@ Bool_t AliHFEelecbackground::CalculateMotherVariable(AliESDtrack* const track, A
     results[4] = openingangle;
 
     // chi2Ndf cut
-    if(fList->At(kDatachi2Ndf)) (dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))->Fill(chi2ndf);
+    if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))) fhtmpp->Fill(chi2ndf);
+    //if(fList->At(kDatachi2Ndf)) (dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))->Fill(chi2ndf);
     if(HasMCData()){
-      if((fIsFrom==kElectronFromBackground) && (fList->At(kMCchi2Ndf))) (dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))->Fill(chi2ndf,fIsFrom);
+      if(fIsFrom==kElectronFromBackground) {
+       if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom); 
+      }
       else {
-       if(fIsPartner && (fList->At(kMCchi2Ndf))) (dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))->Fill(chi2ndf,fIsFrom);
+       if(fIsPartner){
+         if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom); 
+       }
       }
     }
     if(chi2ndf > fChi2NdfCut) return kFALSE;
     else {
-      if(fList->At(kDatar)) (dynamic_cast<TH1F *>(fList->At(kDatar)))->Fill(radius);
+      if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatar)))) fhtmpp->Fill(radius); 
+      //if(fList->At(kDatar)) (dynamic_cast<TH1F *>(fList->At(kDatar)))->Fill(radius);
       if(HasMCData()) {
-       if((fIsFrom==kElectronFromBackground) && (fList->At(kMCr))) (dynamic_cast<TH2F *>(fList->At(kMCr)))->Fill(radius,fIsFrom);
+       if(fIsFrom==kElectronFromBackground) {
+         if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom); 
+         //if(fList->At(kMCr))) (dynamic_cast<TH2F *>(fList->At(kMCr)))->Fill(radius,fIsFrom);
+       }
        else {
-         if(fIsPartner && (fList->At(kMCr))) (dynamic_cast<TH2F *>(fList->At(kMCr)))->Fill(radius,fIsFrom);
+         if(fIsPartner) {
+           if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom); 
+         }
        }
       }
       return kTRUE;
@@ -1004,7 +1043,8 @@ void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int
   co[4] = sign;
   co[5] = 0.0;
 
-  if(fList->At(kDatai))(dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
+  if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
+  //if(fList->At(kDatai))(dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
 
   if((sign==kOs) && (!fUseAliKFCode)) {
     
@@ -1014,7 +1054,8 @@ void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int
     co[4] = kR;
     co[5] = 0.0;
 
-    if(fList->At(kDatai)) (dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
+    if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
+    //if(fList->At(kDatai)) (dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
     
   }
   
@@ -1040,7 +1081,8 @@ void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int
       }
     }
 
-    if(fList->At(kMCo)) (dynamic_cast<THnSparseF *>(fList->At(kMCo)))->Fill(co);
+    if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCo)))) fhtmp->Fill(co);
+    //if(fList->At(kMCo)) (dynamic_cast<THnSparseF *>(fList->At(kMCo)))->Fill(co);
 
   }
  
@@ -1122,8 +1164,9 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
     Double_t itsSignal = trackPart->GetITSsignal();
     Double_t p = trackPart->P();
     
-    if(fDebugLevel > 1) {        
-      if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,itsSignal);
+    if(fDebugLevel > 1) {    
+      if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,itsSignal);     
+      //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,itsSignal);
     }
 
     ///////////
@@ -1150,8 +1193,10 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
        entries[3] = dEdxSamplesPart[2];
        entries[4] = dEdxSamplesPart[3];
 
-       if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,itsSignal);
-       if(fList->At(kMCcutPart2)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))->Fill(entries);
+       //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,itsSignal);
+       if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,itsSignal); 
+       if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))) fhtmp->Fill(entries);
+       //if(fList->At(kMCcutPart2)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))->Fill(entries);
        
       }
       
@@ -1169,7 +1214,8 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
 
     if(fDebugLevel > 1) {        
       //printf("tpcSignal %f\n",tpcSignal);
-      if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,tpcSignal);
+      //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,tpcSignal);
+      if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,tpcSignal); 
     }
 
     // PID
@@ -1182,7 +1228,8 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
       if(!fPIDMethodPartner->IsSelected(&hfetrack)) return kFALSE;
       
       if(fDebugLevel > 1) {  
-       if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,tpcSignal);
+       if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,tpcSignal); 
+       //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,tpcSignal);
       }
     }   
     
@@ -1192,7 +1239,7 @@ Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
 
 }
 //__________________________________________________________________________________________
-Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2) const
+Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2) 
 {
   //
   // Look if the two tracks shared clusters in the TPC or in the ITS depending on the method
@@ -1289,7 +1336,8 @@ Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack
        }
        else entriesSplit[layer+1] = -100.0;
       }
-      if(fList->At(kMCcutPart3)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))->Fill(entriesSplit);
+      if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))) fhtmp->Fill(entriesSplit);
+      //if(fList->At(kMCcutPart3)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))->Fill(entriesSplit);
     }
 
     // Return
@@ -1537,6 +1585,7 @@ void AliHFEelecbackground::PostProcess()
   /////////////////////////////////
   // Cuts on the opening angle
   ////////////////////////////////
+  if(!hsSparseData) return;
   TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
   Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
   hsSparseData->GetAxis(2)->SetRange(1,binCutData);
@@ -1663,10 +1712,10 @@ void AliHFEelecbackground::PostProcess()
     Double_t yieldf = invmassdiffptproj[k-1]->Integral();
     if(invmassetaptproj[k-1] && invmasspi0ptproj[k-1] && invmassgammaptproj[k-1] && invmassCptproj[k-1] && invmassBptproj[k-1]) {
       Double_t yieldg = invmassetaptproj[k-1]->Integral() + invmasspi0ptproj[k-1]->Integral() + invmassgammaptproj[k-1]->Integral();
-      yieldPtSourcesMC->SetBinContent(k,yieldg);
+      if(yieldPtSourcesMC) yieldPtSourcesMC->SetBinContent(k,yieldg);
       
       Double_t yieldsignal = invmassCptproj[k-1]->Integral() + invmassBptproj[k-1]->Integral();
-      yieldPtSignalCutMC->SetBinContent(k,yieldsignal);
+      if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetBinContent(k,yieldsignal);
     }
 
     yieldPtFound->SetBinContent(k,yieldf);
@@ -1782,6 +1831,7 @@ void AliHFEelecbackground::Plot() const
   /////////////////////////
   THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData")); 
   THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC")); 
+  if(!hsSparseData) return;
   
   ////////////////////
   // Opening angle
index 1e32f42..7d6ac95 100644 (file)
@@ -59,127 +59,131 @@ class AliHFEelecbackground : public TObject {
     void SetEvent(AliESDEvent* const ESD); 
     void SetEventAOD(AliAODEvent* const AOD){fAOD1=AOD;}; 
     void SetMCEvent(AliMCEvent* const mcEvent){fMCEvent=mcEvent;};  
-
+    
     void SetOpeningAngleCut(Double_t openingAngleCut){fOpeningAngleCut = openingAngleCut;};
-               void SetInvMassCut(Double_t invMassCut){fInvMassCut = invMassCut;};
-               void SetChi2NdfCut(Double_t chi2NdfCut){fChi2NdfCut = chi2NdfCut;};
-               void SetUseAliKFCode(Bool_t useAliKFCode){fUseAliKFCode = useAliKFCode;};    
-               void SetSharedClusterCut(Bool_t sharedClusterCut){fSharedClusterCut = sharedClusterCut;};
-               void SetRequireITSStandalone(Short_t requireITSStandalone){fRequireITSStandalone = requireITSStandalone;};
-               void SetMinITSChi2(Double_t minITSChi2) {fMinITSChi2 = minITSChi2;};
-               void SetMinNbCls(Int_t minNbCls){fMinNbCls = minNbCls;};
-               void SetMinNbClsSDDSPD(Int_t minNbClsSDDSPD){fMinNbClsSDDSPD = minNbClsSDDSPD;};
-               void SetPIDPartner();
-               void SetPIDMethodPartner(AliHFEpid * const pid) {fPIDMethodPartner = pid;};
-               void SetPIDMethodPartnerITS(AliESDpid * const pid) {fPIDMethodPartnerITS = pid;};
-               void SetDebugLevel(Short_t debugLevel) { fDebugLevel = debugLevel;};
-       
-               Double_t GetOpeningAngleCut() const { return fOpeningAngleCut; };
-               Double_t GetInvMassCut() const { return fInvMassCut; };
-               Double_t GetChi2NdfCut() const { return fChi2NdfCut; };
-               Bool_t GetUseAliKFCode() const { return fUseAliKFCode; };
-               Bool_t GetSharedClusterCut() const { return fSharedClusterCut; };
-               Short_t GetRequireITSStandalone() const { return fRequireITSStandalone; };
-               Int_t GetMinNbCls() const { return fMinNbCls;};
-               Double_t GetMinITSChi2() const { return fMinITSChi2; };
-               Int_t GetMinNbClsSDDSPD() const { return fMinNbClsSDDSPD;};
-               Bool_t GetPIDPartner() const { return fPIDPartner;};
-
-               TList *GetList()  const           { return fList; };
-               TList *GetListPostProcess() const { return fListPostProcess; };
-
-               Bool_t SingleTrackCut(AliESDtrack* const trackPart) const;
-               Bool_t ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2) const; 
-               Bool_t PIDTrackCut(AliESDtrack* const trackPart);
-               void PairAnalysis(AliESDtrack* const track, AliESDtrack* const trackpart); 
-               void FillOutput(Double_t *results, Double_t *resultsr, Int_t sign); 
+    void SetInvMassCut(Double_t invMassCut){fInvMassCut = invMassCut;};
+    void SetChi2NdfCut(Double_t chi2NdfCut){fChi2NdfCut = chi2NdfCut;};
+    void SetUseAliKFCode(Bool_t useAliKFCode){fUseAliKFCode = useAliKFCode;};    
+    void SetSharedClusterCut(Bool_t sharedClusterCut){fSharedClusterCut = sharedClusterCut;};
+    void SetRequireITSStandalone(Short_t requireITSStandalone){fRequireITSStandalone = requireITSStandalone;};
+    void SetMinITSChi2(Double_t minITSChi2) {fMinITSChi2 = minITSChi2;};
+    void SetMinNbCls(Int_t minNbCls){fMinNbCls = minNbCls;};
+    void SetMinNbClsSDDSPD(Int_t minNbClsSDDSPD){fMinNbClsSDDSPD = minNbClsSDDSPD;};
+    void SetPIDPartner();
+    void SetPIDMethodPartner(AliHFEpid * const pid) {fPIDMethodPartner = pid;};
+    void SetPIDMethodPartnerITS(AliESDpid * const pid) {fPIDMethodPartnerITS = pid;};
+    void SetDebugLevel(Short_t debugLevel) { fDebugLevel = debugLevel;};
+    
+    Double_t GetOpeningAngleCut() const { return fOpeningAngleCut; };
+    Double_t GetInvMassCut() const { return fInvMassCut; };
+    Double_t GetChi2NdfCut() const { return fChi2NdfCut; };
+    Bool_t GetUseAliKFCode() const { return fUseAliKFCode; };
+    Bool_t GetSharedClusterCut() const { return fSharedClusterCut; };
+    Short_t GetRequireITSStandalone() const { return fRequireITSStandalone; };
+    Int_t GetMinNbCls() const { return fMinNbCls;};
+    Double_t GetMinITSChi2() const { return fMinITSChi2; };
+    Int_t GetMinNbClsSDDSPD() const { return fMinNbClsSDDSPD;};
+    Bool_t GetPIDPartner() const { return fPIDPartner;};
+    
+    TList *GetList()  const           { return fList; };
+    TList *GetListPostProcess() const { return fListPostProcess; };
+    
+    Bool_t SingleTrackCut(AliESDtrack* const trackPart) const;
+    Bool_t ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2); 
+    Bool_t PIDTrackCut(AliESDtrack* const trackPart);
+    void PairAnalysis(AliESDtrack* const track, AliESDtrack* const trackpart); 
+    void FillOutput(Double_t *results, Double_t *resultsr, Int_t sign); 
     void PostProcess();
-               void Plot() const;
-
+    void Plot() const;
+    
  private:
     enum{
       kHasMCData = BIT(15),             // bitset for mc data usage
-                 kAODanalysis = BIT(16)            // bitset for aod analysis
-               };
-               enum {kDatai=0, kDatar=1, kDatadca=2, kDatachi2Ndf=3, kMCo=4, kMCr=5, kMCdca=6, kMCchi2Ndf=7, kMCe=8, kMCcutPart0=9, kMCcutPart1=10, kMCcutPart2=11, kMCcutPart3=12};   // In the fList Data/MC
-               enum {kOs=0, kPp=1, kNn=2, kR=3};            // In the last dimension Charge
-               enum {kOos=0, kOss=1, kOr=2, kOdiff=3};      // outputs 
-               enum {kNOutput=4,kNMCInfo=5};                // Nb of outputs
-               enum{
-                 kElectronFromBackground = 0,
-                 kElectronFromGamma = 1,
-                 kElectronFromPi0 = 2,
-                 kElectronFromEta = 3,
-                 kElectronFromC = 4,
-                 kElectronFromB = 5              
-               };                                // MC: Origin 
-               enum {kNotSplitted=0, kSplittedOs=1, kSplittedSs=2}; // MC: splitted 
-               
-               Bool_t CalculateMotherVariable(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results);
-               void CalculateMotherVariableR(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results);
-               Int_t IsMotherGamma(Int_t tr);
-               Int_t IsMotherPi0(Int_t tr);
-               Int_t IsMotherEta(Int_t tr);
-               Int_t IsMotherC(Int_t tr);
-               Int_t IsMotherB(Int_t tr);
-               Int_t GetPdg(Int_t tr);
-               Int_t GetLabMother(Int_t tr);
-               
-         static Double_t BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochMuonITS(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochPionITS(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochKaonITS(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochProtonITS(const Double_t *x, const Double_t * /*par*/); 
-
-               static Double_t BetheBlochElectronTPC(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochMuonTPC(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochPionTPC(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochKaonTPC(const Double_t *x, const Double_t * /*par*/);
-               static Double_t BetheBlochProtonTPC(const Double_t *x, const Double_t * /*par*/); 
-
+       kAODanalysis = BIT(16)            // bitset for aod analysis
+       };
+    enum {kDatai=0, kDatar=1, kDatadca=2, kDatachi2Ndf=3, kMCo=4, kMCr=5, kMCdca=6, kMCchi2Ndf=7, kMCe=8, kMCcutPart0=9, kMCcutPart1=10, kMCcutPart2=11, kMCcutPart3=12};   // In the fList Data/MC
+    enum {kOs=0, kPp=1, kNn=2, kR=3};            // In the last dimension Charge
+    enum {kOos=0, kOss=1, kOr=2, kOdiff=3};      // outputs 
+    enum {kNOutput=4,kNMCInfo=5};                // Nb of outputs
+    enum{
+      kElectronFromBackground = 0,
+       kElectronFromGamma = 1,
+       kElectronFromPi0 = 2,
+       kElectronFromEta = 3,
+       kElectronFromC = 4,
+       kElectronFromB = 5                
+       };                                // MC: Origin 
+    enum {kNotSplitted=0, kSplittedOs=1, kSplittedSs=2}; // MC: splitted 
+    
+    Bool_t CalculateMotherVariable(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results);
+    void CalculateMotherVariableR(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results);
+    Int_t IsMotherGamma(Int_t tr);
+    Int_t IsMotherPi0(Int_t tr);
+    Int_t IsMotherEta(Int_t tr);
+    Int_t IsMotherC(Int_t tr);
+    Int_t IsMotherB(Int_t tr);
+    Int_t GetPdg(Int_t tr);
+    Int_t GetLabMother(Int_t tr);
+    
+    static Double_t BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochMuonITS(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochPionITS(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochKaonITS(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochProtonITS(const Double_t *x, const Double_t * /*par*/); 
+    
+    static Double_t BetheBlochElectronTPC(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochMuonTPC(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochPionTPC(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochKaonTPC(const Double_t *x, const Double_t * /*par*/);
+    static Double_t BetheBlochProtonTPC(const Double_t *x, const Double_t * /*par*/); 
+    
+    THnSparseF *fhtmp;     // Only to avoid coverity problem
+    TH2F *fhtmpf;          // Only to avoid coverity problem
+    TH1F *fhtmpp;          // Only to avoid coverity problem
+    
     AliESDEvent* fESD1;              //! ESD pointer             
     AliAODEvent* fAOD1;              //! AOD pointer             
     AliMCEvent*  fMCEvent;           //! MC event             
-               Double_t fBz;                    // Magnetic field 
-               const AliESDVertex *fkVertex;    //! Primary vertex
-               static const Double_t fgkMe;     //!  Mass of the electron
-               
-               Double_t fPtESD;                 //! pt of tagged electron
-               Int_t fIndexTrack;               //! index track
-               Int_t fPdg;                      //! pdg code track 
-               Int_t fLabMother;                //! label first mother track 
-               Int_t fIsFrom;                   //! is track from
-               Int_t fMotherGamma;              //! Gamma, mother of track
-               Int_t fMotherPi0;                //! Pi0, mother of track
-               Int_t fMotherC;                  //! C, mother of track
-               Int_t fMotherB;                  //! B, mother of track
-               Int_t fMotherEta;                //! eta, mother of track
-               Bool_t fIsPartner;               //! Are partners
-               Bool_t fIsSplittedTrack;         //! Are splitted track
-   
-               Double_t fOpeningAngleCut;       //! Opening angle cut
-               Double_t fInvMassCut;            //! Inv mass cut
-               Double_t fChi2NdfCut;            //! chi2ndf cut for KF code
-
-               Bool_t   fUseAliKFCode;          //! Use AliKF code to calculate the pair properties
-
-               Bool_t  fSharedClusterCut;       //! Shared Cluster Cut
-               Short_t fRequireITSStandalone;   //! ITS standalone: 1 and 2 (pureITSStandalone)
-               Int_t  fMinNbCls;                //! Min Nb of clusters ITS or TPC
-               Double_t fMinITSChi2;            //! ITS chi2 min
-               Int_t  fMinNbClsSDDSPD;          //! Min Nb of clusters ITS SDD&SPD
-               Bool_t fPIDPartner;              //! PID partner
-               AliHFEpid *fPIDMethodPartner;    //! PID cuts
-               AliESDpid *fPIDMethodPartnerITS; //! PID cuts ITS
-
-               Short_t fDebugLevel;             //! Debug Level
-
-               Bool_t   fCuts[10];               //! Cut passed already
-               
+    Double_t fBz;                    // Magnetic field 
+    const AliESDVertex *fkVertex;    //! Primary vertex
+    static const Double_t fgkMe;     //!  Mass of the electron
+    
+    Double_t fPtESD;                 //! pt of tagged electron
+    Int_t fIndexTrack;               //! index track
+    Int_t fPdg;                      //! pdg code track 
+    Int_t fLabMother;                //! label first mother track 
+    Int_t fIsFrom;                   //! is track from
+    Int_t fMotherGamma;              //! Gamma, mother of track
+    Int_t fMotherPi0;                //! Pi0, mother of track
+    Int_t fMotherC;                  //! C, mother of track
+    Int_t fMotherB;                  //! B, mother of track
+    Int_t fMotherEta;                //! eta, mother of track
+    Bool_t fIsPartner;               //! Are partners
+    Bool_t fIsSplittedTrack;         //! Are splitted track
+    
+    Double_t fOpeningAngleCut;       //! Opening angle cut
+    Double_t fInvMassCut;            //! Inv mass cut
+    Double_t fChi2NdfCut;            //! chi2ndf cut for KF code
+    
+    Bool_t   fUseAliKFCode;          //! Use AliKF code to calculate the pair properties
+    
+    Bool_t  fSharedClusterCut;       //! Shared Cluster Cut
+    Short_t fRequireITSStandalone;   //! ITS standalone: 1 and 2 (pureITSStandalone)
+    Int_t  fMinNbCls;                //! Min Nb of clusters ITS or TPC
+    Double_t fMinITSChi2;            //! ITS chi2 min
+    Int_t  fMinNbClsSDDSPD;          //! Min Nb of clusters ITS SDD&SPD
+    Bool_t fPIDPartner;              //! PID partner
+    AliHFEpid *fPIDMethodPartner;    //! PID cuts
+    AliESDpid *fPIDMethodPartnerITS; //! PID cuts ITS
+    
+    Short_t fDebugLevel;             //! Debug Level
+    
+    Bool_t   fCuts[10];               //! Cut passed already
+    
     TList *fList;                    //! list for outputs
-               TList *fListPostProcess;         //! list for postprocess
-
-               static Bool_t  fgUseMCPID;       // flag to use MC PID for tagged electron
+    TList *fListPostProcess;         //! list for postprocess
+    
+    static Bool_t  fgUseMCPID;       // flag to use MC PID for tagged electron
     
     ClassDef(AliHFEelecbackground,0);
 };
index 321da6e..31257d5 100644 (file)
@@ -534,7 +534,7 @@ void AliHFEpid::InitStrategy6(){
   lowerCut->SetParameter(0, -2.65);
   lowerCut->SetParameter(1, -0.8757);
 //  lowerCut->SetParameter(2, -1);
-  if(HasMCData()) lowerCut->SetParameter(2, -1);
+  if(HasMCData()) lowerCut->SetParameter(2, -0.997);
   else lowerCut->SetParameter(2, -0.9);
   tpcpid->SetUpperSigmaCut(upperCut);
   tpcpid->SetLowerSigmaCut(lowerCut);
index 7546e93..01afd2c 100644 (file)
@@ -37,7 +37,7 @@
 ClassImp(AliHFEtools)
 
 AliESDpid *AliHFEtools::fgDefaultPID = NULL;
-Int_t AliHFEtools::fgLogLevel = 1;
+Int_t AliHFEtools::fgLogLevel = 0;
 
 //__________________________________________
 AliHFEtools::AliHFEtools():