updated
authorssakai <Shingo.Sakai@lnf.infn.it>
Fri, 12 Sep 2014 08:54:46 +0000 (10:54 +0200)
committerssakai <Shingo.Sakai@lnf.infn.it>
Fri, 12 Sep 2014 08:55:45 +0000 (10:55 +0200)
PWGHF/hfe/AliAnalysisTaskHFEemcQA.cxx
PWGHF/hfe/AliAnalysisTaskHFEemcQA.h
PWGHF/hfe/macros/AddTaskHFEemcQA.C

index 602fad4..f0d7283 100644 (file)
@@ -2,6 +2,7 @@
 #include "TTree.h"
 #include "TH1F.h"
 #include "TCanvas.h"
+#include "THnSparse.h"
 
 #include "AliAnalysisTask.h"
 #include "AliAnalysisManager.h"
 #include "AliESDEvent.h"
 #include "AliESDInputHandler.h"
 #include "AliESDtrackCuts.h"
-
 #include "AliAODEvent.h"
 #include "AliAODHandler.h"
 
+#include "AliPID.h"
+#include "AliESDpid.h"
+#include "AliAODPid.h"
+#include "AliPIDResponse.h"
+#include "AliHFEcontainer.h"
+#include "AliHFEcuts.h"
+#include "AliHFEpid.h"
+#include "AliHFEpidBase.h"
+#include "AliHFEpidQAmanager.h"
+#include "AliHFEtools.h"
+#include "AliCFContainer.h"
+#include "AliCFManager.h"
+
 #include "AliAnalysisTaskHFEemcQA.h"
 
 //QA task for EMCAL electron analysis 
@@ -24,6 +37,8 @@ ClassImp(AliAnalysisTaskHFEemcQA)
   fVevent(0),
   fESD(0),
   fAOD(0),
+  fpidResponse(0),
+  fFlagSparse(kFALSE),
   fOutputList(0),
   fVtxZ(0),
   fVtxX(0),
@@ -37,6 +52,7 @@ ClassImp(AliAnalysisTaskHFEemcQA)
   fTrkphi(0),
   fdEdx(0),
   fTPCNpts(0),
+  fTPCnsig(0),
   fHistPtMatch(0),
   fEMCTrkMatch(0),
   fEMCTrkPt(0),
@@ -53,10 +69,13 @@ ClassImp(AliAnalysisTaskHFEemcQA)
   fEleCanSPD1(0),
   fEleCanSPD2(0),
   fEleCanSPDBoth(0),
-  fEleCanSPDOr(0)
+  fEleCanSPDOr(0),
+  fSparseElectron(0),
+  fvalueElectron(0)
 {
   // Constructor
 
+  fvalueElectron = new Double_t[6];
   // Define input and output slots here
   // Input slot #0 works with a TChain
   DefineInput(0, TChain::Class());
@@ -64,13 +83,89 @@ ClassImp(AliAnalysisTaskHFEemcQA)
   // Output slot #1 writes into a TH1 container
   DefineOutput(1, TList::Class());
 }
+//________________________________________________________________________
+AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA() 
+  : AliAnalysisTaskSE("DefaultTask_HfeEMCQA"),
+  fVevent(0),
+  fESD(0),
+  fAOD(0),
+  fpidResponse(0),
+  fFlagSparse(kFALSE),
+  fOutputList(0),
+  fVtxZ(0),
+  fVtxX(0),
+  fVtxY(0),
+  fTrigMulti(0),
+  fHistClustE(0),
+  fEMCClsEtaPhi(0),
+  fNegTrkIDPt(0),
+  fTrkPt(0),
+  fTrketa(0),
+  fTrkphi(0),
+  fdEdx(0),
+  fTPCNpts(0),
+  fTPCnsig(0),
+  fHistPtMatch(0),
+  fEMCTrkMatch(0),
+  fEMCTrkPt(0),
+  fEMCTrketa(0),
+  fEMCTrkphi(0),
+  fEMCdEdx(0),
+  fEMCTPCNpts(0),
+  fHistdEdxEop(0),
+  fHistEop(0),
+  fEleCanTPCNpts(0),
+  fEleCanTPCNCls(0),
+  fEleCanITSNCls(0),
+  fEleCanITShit(0),
+  fEleCanSPD1(0),
+  fEleCanSPD2(0),
+  fEleCanSPDBoth(0),
+  fEleCanSPDOr(0),
+  fSparseElectron(0),
+  fvalueElectron(0)
+{
+  //Default constructor
 
+  fvalueElectron = new Double_t[6];
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
+  DefineInput(0, TChain::Class());
+  // Output slot #0 id reserved by the base class for AOD
+  // Output slot #1 writes into a TH1 container
+  // DefineOutput(1, TH1I::Class());
+  DefineOutput(1, TList::Class());
+  //DefineOutput(3, TTree::Class());
+}
+//________________________________________________________________________
+AliAnalysisTaskHFEemcQA::~AliAnalysisTaskHFEemcQA()
+{
+  //Destructor 
+  delete fOutputList;
+  delete fSparseElectron;
+  delete []fvalueElectron;
+}
 //________________________________________________________________________
 void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
 {
   // Create histograms
   // Called once
+  AliDebug(3, "Creating Output Objects");
+
+  /////////////////////////////////////////////////
+  //Automatic determination of the analysis mode//
+  ////////////////////////////////////////////////
+  AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+  if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){
+    SetAODAnalysis();
+  } else {
+    SetESDAnalysis();
+  }
+  printf("Analysis Mode: %s Analysis\n", IsAODanalysis() ? "AOD" : "ESD");
 
+  //////////////// 
+  //Output list//
+  ///////////////
   fOutputList = new TList();
   fOutputList->SetOwner();  
 
@@ -83,7 +178,7 @@ void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
   fVtxX = new TH1F("fVtxX","X vertex position;Vtx_{x};counts",1000,-50,50);
   fOutputList->Add(fVtxX);
 
-  fTrigMulti = new TH2F("fTrigMulti","Multiplicity distribution for different triggers; Trigger type; multiplicity",8,-1,7,2000,0,2000);
+  fTrigMulti = new TH2F("fTrigMulti","Multiplicity distribution for different triggers; Trigger type; multiplicity",11,-1,10,2000,0,2000);
   fOutputList->Add(fTrigMulti);
 
   fHistClustE = new TH1F("fHistClustE", "EMCAL cluster energy distribution; Cluster E;counts", 500, 0.0, 50.0);
@@ -104,12 +199,15 @@ void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
   fTrkphi = new TH1F("fTrkphi","All Track #phi distribution;#phi;counts",100,0,6.3);
   fOutputList->Add(fTrkphi);
 
-  fdEdx = new TH2F("fdEdx","All Track dE/dx distribution;p (GeV/c);dE/dx",200,0,20,500,0,100);
+  fdEdx = new TH2F("fdEdx","All Track dE/dx distribution;p (GeV/c);dE/dx",200,0,20,500,0,160);
   fOutputList->Add(fdEdx);
 
   fTPCNpts = new TH2F("fTPCNpts","All track TPC Npoints used for dE/dx calculation;p (GeV/c);N points",200,0,20,200,0.,200.);
   fOutputList->Add(fTPCNpts);
 
+  fTPCnsig = new TH2F("fTPCnsig","All Track TPC Nsigma distribution;p (GeV/c);#sigma_{TPC-dE/dx}",1000,0,50,200,-10,10);
+  fOutputList->Add(fTPCnsig);
+
   fHistPtMatch = new TH1F("fHistPtMatch", "p_{T} distribution of tracks matched to EMCAL;p_{T} (GeV/c);counts",1000, 0.0, 100.0);
   fOutputList->Add(fHistPtMatch);                                      
 
@@ -125,7 +223,7 @@ void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
   fEMCTrkphi = new TH1F("fEMCTrkphi","#phi distribution of tracks matched to EMCAL;#phi;counts",100,0,6.3);
   fOutputList->Add(fEMCTrkphi);
 
-  fEMCdEdx = new TH2F("fEMCdEdx","dE/dx distribution of tracks matched to EMCAL;p (GeV/c);dE/dx",200,0,20,500,0,100);
+  fEMCdEdx = new TH2F("fEMCdEdx","dE/dx distribution of tracks matched to EMCAL;p (GeV/c);dE/dx",200,0,20,500,0,160);
   fOutputList->Add(fEMCdEdx);
 
   fEMCTPCNpts = new TH2F("fEMCTPCNpts","TPC Npoints used for dE/dx for tracks matched to EMCAL;p (GeV/c);N points",200,0,20,200,0.,200.);
@@ -134,7 +232,7 @@ void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
   fHistEop = new TH2F("fHistEop", "E/p distribution;p_{T} (GeV/c);E/p", 200,0,20,60, 0.0, 3.0);
   fOutputList->Add(fHistEop);
 
-  fHistdEdxEop = new TH2F("fHistdEdxEop", "E/p vs. dE/dx;E/p;dE/dx", 60, 0.0, 3.0, 500,0,100);
+  fHistdEdxEop = new TH2F("fHistdEdxEop", "E/p vs. dE/dx;E/p;dE/dx", 60, 0.0, 3.0, 500,0,160);
   fOutputList->Add(fHistdEdxEop);
 
   fEleCanTPCNpts = new TH2F("fEleCanTPCNpts","TPC Npoints used for dE/dx for electron candidates;p_{T} (GeV/c);N points",200,0,20,200,0,200);
@@ -161,6 +259,12 @@ void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
   fEleCanSPDOr = new TH2F("fEleCanSPDOr","Tracks with hits on both SPD layer;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
   fOutputList->Add(fEleCanSPDOr);
 
+  Int_t bins[6]={6,500,200,100,100,100}; //trigger, pt, TPCnsig, E/p, M20, M02 
+  Double_t xmin[6]={-1.5,0,-10,0,0,0};
+  Double_t xmax[6]={4.5,25,10,2,2,2};
+  fSparseElectron = new THnSparseD ("Electron","Electron",6,bins,xmin,xmax);
+  fOutputList->Add(fSparseElectron);
+
   PostData(1,fOutputList);
 }
 
@@ -181,10 +285,13 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
 
   fESD = dynamic_cast<AliESDEvent*>(InputEvent());
   if (fESD) {
-    printf("fESD available\n");
+    //   printf("fESD available\n");
     //return;
   }
 
+  ////////////////////
+  //cuts initialised//
+  ///////////////////
   AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
   esdTrackCutsH->SetMaxDCAToVertexXY(2.4);
   esdTrackCutsH->SetMaxDCAToVertexZ(3.2);
@@ -192,99 +299,122 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
 
   fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
   if (fAOD) {
-    printf("fAOD available\n");
+    // printf("fAOD available\n");
     //return;
   }
 
-  int ntracks;
+  ///////////////////
+  //PID initialised//
+  //////////////////
+  fpidResponse = fInputHandler->GetPIDResponse();
+
+  ////////////////
+  //Event vertex//
+  ///////////////
+  Int_t ntracks;
   ntracks = fVevent->GetNumberOfTracks();
   printf("There are %d tracks in this event\n",ntracks);
-  //  if(fESD)printf("There are %d tracks in this event\n", fESD->GetNumberOfTracks());
-  //  if(fAOD)printf("There are %d tracks in this event\n", fAOD->GetNumberOfTracks());
 
-  double Zvertex = -100, Xvertex = -100, Yvertex = -100;
+  Double_t Zvertex = -100, Xvertex = -100, Yvertex = -100;
   const AliVVertex *pVtx = fVevent->GetPrimaryVertex();
+  Double_t NcontV = pVtx->GetNContributors();
+  if(NcontV<2)return;
+
   Zvertex = pVtx->GetZ();  
   Yvertex = pVtx->GetY();  
   Xvertex = pVtx->GetX();  
   fVtxZ->Fill(Zvertex);
   fVtxX->Fill(Xvertex);
   fVtxY->Fill(Yvertex);
-  /*
-     if(fESD)
-     {
-     const AliESDVertex *pVtx = fESD->GetPrimaryVertex(); 
-     Zvertex = pVtx->GetZ();
-     }
-     if(fAOD)
-     {
-     const AliAODVertex *pVtx = fAOD->GetPrimaryVertex(); 
-     Zvertex = pVtx->GetZ();
-     }
-   */
-  // trigger check
-  
+
+  /////////////////
+  //trigger check//
+  /////////////////
   TString firedTrigger;
   TString TriggerEG1("EG1");
   TString TriggerEG2("EG2");
   fVevent->GetFiredTriggerClasses();
-  
-  //if(fAOD) firedTrigger = fAOD->GetFiredTriggerClasses();
-  //else if(fESD) firedTrigger = fESD->GetFiredTriggerClasses();
 
   Bool_t EG1tr = kFALSE;
   Bool_t EG2tr = kFALSE;
 
   if(firedTrigger.Contains(TriggerEG1))EG1tr = kTRUE;
   if(firedTrigger.Contains(TriggerEG2))EG2tr = kTRUE;
-  
 
+  Int_t trigger = -1;
   if (fAOD){
     Double_t multiplicity=fAOD->GetHeader()->GetRefMultiplicity();
     fTrigMulti->Fill(-0.5, multiplicity);
     if(evSelMask & AliVEvent::kAny) fTrigMulti->Fill(0.5, multiplicity);
     if(evSelMask & AliVEvent::kMB) fTrigMulti->Fill(1.5, multiplicity);
-    if(evSelMask & AliVEvent::kINT7) fTrigMulti->Fill(1.5, multiplicity);
-    if(evSelMask & AliVEvent::kINT8) fTrigMulti->Fill(1.5, multiplicity);
-    if(evSelMask & AliVEvent::kEMC1) fTrigMulti->Fill(2.5, multiplicity);
-    if(evSelMask & AliVEvent::kEMC8) fTrigMulti->Fill(3.5, multiplicity);
-    if(evSelMask & AliVEvent::kEMCEJE) fTrigMulti->Fill(4.5, multiplicity);
-    if(evSelMask & AliVEvent::kEMCEGA) fTrigMulti->Fill(5.5, multiplicity);
-    if(evSelMask & AliVEvent::kEMCEGA & EG2tr) fTrigMulti->Fill(5.5, multiplicity);
-    if(evSelMask & AliVEvent::kEMCEGA & EG2tr) fTrigMulti->Fill(5.5, multiplicity);
+    if(evSelMask & AliVEvent::kINT7) fTrigMulti->Fill(2.5, multiplicity);
+    if(evSelMask & AliVEvent::kINT8) fTrigMulti->Fill(3.5, multiplicity);
+    if(evSelMask & AliVEvent::kEMC1) fTrigMulti->Fill(4.5, multiplicity);
+    if(evSelMask & AliVEvent::kEMC7) fTrigMulti->Fill(5.5, multiplicity);
+    if(evSelMask & AliVEvent::kEMC8) fTrigMulti->Fill(6.5, multiplicity);
+    if(evSelMask & AliVEvent::kEMCEJE) fTrigMulti->Fill(7.5, multiplicity);
+    if(evSelMask & AliVEvent::kEMCEGA) fTrigMulti->Fill(8.5, multiplicity);
+    if(evSelMask & AliVEvent::kEMCEGA & EG2tr) fTrigMulti->Fill(9.5, multiplicity);
+
+    if((evSelMask & AliVEvent::kMB) || (evSelMask & AliVEvent::kINT7) || (evSelMask & AliVEvent::kINT8)) trigger =0;
+    if(evSelMask & AliVEvent::kEMC1) trigger =1;
+    if(evSelMask & AliVEvent::kEMC8) trigger =2;
+    if(evSelMask & AliVEvent::kEMCEJE) trigger =3;
+    if(evSelMask & AliVEvent::kEMCEGA) trigger =4;
   }
 
-  // event selection
+  ////////////////////
+  //event selection//
+  ///////////////////
   if(fabs(Zvertex>10.0))return; 
-  
-  //EMCAL cluster information
-  int Nclust = 0;
+
+  /////////////////////////////
+  //EMCAL cluster information//
+  ////////////////////////////
+  Int_t Nclust = 0;
   Nclust = fVevent->GetNumberOfCaloClusters();
-  //  if(fESD)Nclust = fESD->GetNumberOfCaloClusters();
-  //  if(fAOD)Nclust = fAOD->GetNumberOfCaloClusters();
   for(Int_t icl=0; icl<Nclust; icl++)
   {
     AliVCluster *clust = 0x0;
     clust = fVevent->GetCaloCluster(icl);
-    //    if(fESD)clust = (AliVCluster*) fESD->GetCaloCluster(icl);
-    //    if(fAOD)clust = (AliVCluster*) fAOD->GetCaloCluster(icl);
     if(clust && clust->IsEMCAL())
     {
-      double clustE = clust->E();
-      float  emcx[3]; // cluster pos
+      Double_t clustE = clust->E();
+      Float_t  emcx[3]; // cluster pos
       clust->GetPosition(emcx);
       TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
-      double emcphi = clustpos.Phi(); 
-      double emceta = clustpos.Eta();
+      Double_t emcphi = clustpos.Phi(); 
+      Double_t emceta = clustpos.Eta();
       fHistClustE->Fill(clustE);
       fEMCClsEtaPhi->Fill(emceta,emcphi);
     }
   }
 
-  // Track loop 
+  /////////////////////////////////
+  //Look for kink mother for AOD//
+  /////////////////////////////////
+  Int_t numberofvertices = fAOD->GetNumberOfVertices();
+  Double_t listofmotherkink[numberofvertices];
+  Int_t numberofmotherkink = 0;
+  if(IsAODanalysis()){
+    for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
+      AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
+      if(!aodvertex) continue;
+      if(aodvertex->GetType()==AliAODVertex::kKink) {
+        AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
+        if(!mother) continue;
+        Int_t idmother = mother->GetID();
+        listofmotherkink[numberofmotherkink] = idmother;
+        numberofmotherkink++;
+      }
+    }
+  }
+
+  ///////////////
+  //Track loop//
+  ///////////////
   for (Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
-    
-    //---------combine both esd and aod tracks -------
+
     AliVParticle* Vtrack = fVevent->GetTrack(iTracks);
     if (!Vtrack) {
       printf("ERROR: Could not receive track %d\n", iTracks);
@@ -294,32 +424,58 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
     AliESDtrack *etrack = dynamic_cast<AliESDtrack*>(Vtrack);
     AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
 
+    ////////////////////
+    //Apply track cuts//
+    ////////////////////
     if(fAOD)
       if(!atrack->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;
 
     if(fESD)
       if(!esdTrackCutsH->AcceptTrack(etrack))continue;
 
-    //track properties
-    double dEdx = track->GetTPCsignal();
+    if(IsAODanalysis()){
+      Bool_t kinkmotherpass = kTRUE;
+      for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
+        if(track->GetID() == listofmotherkink[kinkmother]) {
+          kinkmotherpass = kFALSE;
+          continue;
+        }
+      }
+      if(!kinkmotherpass) continue;
+    }
+    else{
+      if(etrack->GetKinkIndex(0) != 0) continue;
+    }
+
+    ////////////////////
+    //Track properties//
+    ///////////////////
+    Double_t dEdx =-999, fTPCnSigma=-999;
+    dEdx = track->GetTPCsignal();
+    fTPCnSigma = fpidResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
     if(track->GetID()<0) fNegTrkIDPt->Fill(track->Pt());
     fTrkPt->Fill(track->Pt());
     fTrketa->Fill(track->Eta());
     fTrkphi->Fill(track->Phi());
     fdEdx->Fill(track->P(),dEdx);
     fTPCNpts->Fill(track->P(),track->GetTPCsignalN());
+    fTPCnsig->Fill(track->P(),fTPCnSigma);
 
-    //track matching to EMCAL
-    int EMCalIndex = -1;
+    ///////////////////////////
+    //Track matching to EMCAL//
+    //////////////////////////
+    Int_t EMCalIndex = -1;
     EMCalIndex = track->GetEMCALcluster();
     if(EMCalIndex < 0) continue;
     fHistPtMatch->Fill(track->Pt());
 
-    AliVCluster *clustMatch = (AliVCluster*)fAOD->GetCaloCluster(EMCalIndex);
-    if(clustMatch && clustMatch->IsEMCAL()) //isnt clustMatch always EMCal cluster?
+    AliVCluster *clustMatch = (AliVCluster*)fVevent->GetCaloCluster(EMCalIndex);
+    if(clustMatch && clustMatch->IsEMCAL())
     {
+      /////////////////////////////////////////////
+      //Properties of tracks matched to the EMCAL//
+      /////////////////////////////////////////////
       fEMCTrkMatch->Fill(clustMatch->GetTrackDx(),clustMatch->GetTrackDz());
-      //properties of tracks matched to the EMCAL
       fEMCTrkPt->Fill(track->Pt());
       fEMCTrketa->Fill(track->Eta());
       fEMCTrkphi->Fill(track->Phi());
@@ -327,14 +483,30 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
       fEMCTPCNpts->Fill(track->P(),track->GetTPCsignalN());
 
       //E/p distribution
-      double clustMatchE = clustMatch->E();
-      double eop = -1.0;
+      Double_t clustMatchE = clustMatch->E();
+      Double_t eop = -1.0;
       if(track->P()>0)eop = clustMatchE/track->P();
 
-      if(track->Pt()>2.0)fHistdEdxEop->Fill(eop,dEdx);
+      if(track->Pt()>1.0)fHistdEdxEop->Fill(eop,dEdx);
       fHistEop->Fill(track->Pt(),eop);
 
-      //track properties of EMCAL electron cadidates
+      //EID THnsparse
+      fvalueElectron[0] = trigger;
+      fvalueElectron[1] = track->Pt();
+      fvalueElectron[2] = fTPCnSigma;
+      fvalueElectron[3] = eop;
+      fvalueElectron[4] = clustMatch->GetM20();
+      fvalueElectron[5] = clustMatch->GetM02();
+
+      cout << "flag for sparse: " << GetElecIDsparse() <<endl; 
+      if(fFlagSparse){
+        cout << "filling sparse"<<endl;
+        fSparseElectron->Fill(fvalueElectron);
+      }
+
+      ////////////////////////////////////////////////
+      //Track properties of EMCAL electron cadidates//
+      ///////////////////////////////////////////////
       if(eop>0.8 and eop<1.2){
         fEleCanTPCNpts->Fill(track->Pt(),track->GetTPCsignalN());
         fEleCanTPCNCls->Fill(track->Pt(),track->GetTPCNcls());
index d98e186..0eab36c 100644 (file)
@@ -4,25 +4,46 @@
 //QA task for EMCAL electron analysis 
 
 class TH1F;
+class THnSparse;
 class AliESDEvent;
 class AliAODEvent;
+class AliHFEcontainer;
+class AliHFEcuts;
+class AliHFEpid;
+class AliHFEpidQAmanager;
+class AliCFManager;
 
 #include "AliAnalysisTaskSE.h"
 
 class AliAnalysisTaskHFEemcQA : public AliAnalysisTaskSE {
  public:
-  AliAnalysisTaskHFEemcQA() : AliAnalysisTaskSE(), fVevent(0),fESD(0),fAOD(0),fOutputList(0),fVtxZ(0),fVtxX(0),fVtxY(0),fTrigMulti(0),fHistClustE(0),fEMCClsEtaPhi(0),fNegTrkIDPt(0),fTrkPt(0),fTrketa(0),fTrkphi(0),fdEdx(0),fTPCNpts(0),fHistPtMatch(0),fEMCTrkMatch(0),fEMCTrkPt(0),fEMCTrketa(0),fEMCTrkphi(0),fEMCdEdx(0),fEMCTPCNpts(0),fHistdEdxEop(0),fHistEop(0),fEleCanTPCNpts(0),fEleCanTPCNCls(0),fEleCanITSNCls(0),fEleCanITShit(0),fEleCanSPD1(0),fEleCanSPD2(0),fEleCanSPDBoth(0),fEleCanSPDOr(0) {}
+  AliAnalysisTaskHFEemcQA();
   AliAnalysisTaskHFEemcQA(const char *name);
-  virtual ~AliAnalysisTaskHFEemcQA() {}
+  virtual ~AliAnalysisTaskHFEemcQA();
   
   virtual void   UserCreateOutputObjects();
   virtual void   UserExec(Option_t *option);
   virtual void   Terminate(Option_t *);
-  
+
+  void SetAODAnalysis() { SetBit(kAODanalysis, kTRUE); };
+  void SetESDAnalysis() { SetBit(kAODanalysis, kFALSE); };
+  Bool_t IsAODanalysis() const { return TestBit(kAODanalysis); };
+
+  Bool_t GetElecIDsparse() {return fFlagSparse;};
+  void SetElecIDsparse(Bool_t flagelecIDsparse){fFlagSparse = flagelecIDsparse;};
+
  private:
+  enum{
+    kAODanalysis = BIT(20),
+  };
+
   AliVEvent   *fVevent;  //!V event object
   AliESDEvent *fESD;    //!ESD object
   AliAODEvent *fAOD;    //!AOD object
+  AliPIDResponse *fpidResponse; //!pid response
+
+  Bool_t      fFlagSparse;// switch to THnspare
+
   TList       *fOutputList; //!Output list
   TH1F        *fVtxZ;//!Vertex z 
   TH1F        *fVtxX;//!Vertex x 
@@ -36,6 +57,7 @@ class AliAnalysisTaskHFEemcQA : public AliAnalysisTaskSE {
   TH1F        *fTrkphi;//!track phi 
   TH2F        *fdEdx;//!dedx vs pt
   TH2F        *fTPCNpts;//!TPC Npoints used for dedx
+  TH2F        *fTPCnsig;//!TPC Nsigma
   TH1F        *fHistPtMatch;//!tracks matched to EMCAL 
   TH2F        *fEMCTrkMatch;//!Distance of EMC cluster to closest track in phi and z
   TH1F        *fEMCTrkPt;//!tracks with EMCAL cluster
@@ -54,9 +76,12 @@ class AliAnalysisTaskHFEemcQA : public AliAnalysisTaskSE {
   TH2F        *fEleCanSPDBoth;//!ele cand SPD both layer
   TH2F        *fEleCanSPDOr;//!ele cand SPD or
 
+  THnSparse  *fSparseElectron;//!Electron info 
+  Double_t *fvalueElectron;//!Electron info
+
   AliAnalysisTaskHFEemcQA(const AliAnalysisTaskHFEemcQA&); // not implemented
   AliAnalysisTaskHFEemcQA& operator=(const AliAnalysisTaskHFEemcQA&); // not implemented
-  
+
   ClassDef(AliAnalysisTaskHFEemcQA, 1); // example of analysis
 };
 
index dff6e0d..cf01475 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTask *AddTaskHFEemcQA(){
+AliAnalysisTask *AddTaskHFEemcQA(Bool_t FillElecSparse=kFALSE){
   //get the current analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
@@ -23,23 +23,20 @@ AliAnalysisTask *AddTaskHFEemcQA(){
   AliAnalysisTaskHFEemcQA *hfecalqa = new AliAnalysisTaskHFEemcQA("emcqa");
   mgr->AddTask(hfecalqa);
   hfecalqa->SelectCollisionCandidates(AliVEvent::kINT8);
+  hfecalqa->SetElecIDsparse(FillElecSparse);
+
   TString containerName = mgr->GetCommonFileName();
   containerName += ":PWGHF_hfeHFEemcQAINT8";
   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("HFEemcQAINT8", TList::Class(),AliAnalysisManager::kOutputContainer, containerName.Data());
   mgr->ConnectInput(hfecalqa, 0, cinput);
   mgr->ConnectOutput(hfecalqa, 1, coutput1); 
-  /*
-  mgr->ConnectInput  (hfecalqa,0,cinput);
-  hfecalqa->ConnectOutput(1, mgr->CreateContainer("HFE_Results_EMCALINT8", TList::Class(),
-                                                AliAnalysisManager::kOutputContainer, containerName.Data()));
-  hfecalqa->ConnectOutput(2, mgr->CreateContainer("HFE_QA_EMCALINT8", TList::Class(),
-                                             AliAnalysisManager::kOutputContainer, containerName.Data()));
-  */
 
   AliAnalysisTaskHFEemcQA *hfecalqa7 = new AliAnalysisTaskHFEemcQA("emcqa");
   mgr->AddTask(hfecalqa7);
   hfecalqa7->SelectCollisionCandidates(AliVEvent::kINT7);
+  hfecalqa7->SetElecIDsparse(FillElecSparse);
+
   TString containerName7 = mgr->GetCommonFileName();
   containerName7 += ":PWGHF_hfeHFEemcQAINT7";
   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
@@ -51,6 +48,8 @@ AliAnalysisTask *AddTaskHFEemcQA(){
   AliAnalysisTaskHFEemcQA *hfecalqaTrig0 = new AliAnalysisTaskHFEemcQA("emcqa");
   mgr->AddTask(hfecalqaTrig0);
   hfecalqaTrig0->SelectCollisionCandidates(AliVEvent::kEMCEGA);
+  hfecalqaTrig0->SetElecIDsparse(FillElecSparse);
+
   TString containerName1 = mgr->GetCommonFileName();
   containerName1 += ":PWGHF_hfeHFEemcQATrigGA";
   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
@@ -63,6 +62,8 @@ AliAnalysisTask *AddTaskHFEemcQA(){
   AliAnalysisTaskHFEemcQA *hfecalqaTrig1 = new AliAnalysisTaskHFEemcQA("emcqa");
   mgr->AddTask(hfecalqaTrig1);
   hfecalqaTrig1->SelectCollisionCandidates(AliVEvent::kEMCEJE);
+  hfecalqaTrig1->SetElecIDsparse(FillElecSparse);
+
   TString containerName2 = mgr->GetCommonFileName();
   containerName2 += ":PWGHF_hfeHFEemcQATrigJE";
   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();