]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added EMCal QA task
authorssakai <Shingo.Sakai@lnf.infn.it>
Wed, 13 Aug 2014 10:01:39 +0000 (12:01 +0200)
committerssakai <Shingo.Sakai@lnf.infn.it>
Wed, 13 Aug 2014 10:03:49 +0000 (12:03 +0200)
PWGHF/CMakelibPWGHFhfe.pkg
PWGHF/PWGHFhfeLinkDef.h
PWGHF/hfe/AliAnalysisTaskHFEemcQA.cxx [new file with mode: 0644]
PWGHF/hfe/AliAnalysisTaskHFEemcQA.h [new file with mode: 0644]
PWGHF/hfe/macros/AddTaskHFEemcQA.C [new file with mode: 0644]

index 8c21db4dd9c6a3499ea1bbcbcf56d5971cc044a8..dbef13a5025a6686b2b36a231759473ea9929134 100644 (file)
@@ -98,6 +98,7 @@ set (SRCS
     hfe/AliHFEreducedTrack.cxx
     hfe/AliHFEreducedMCParticle.cxx
     hfe/AliAnalysisTaskHFEQA.cxx
+    hfe/AliAnalysisTaskHFEemcQA.cxx
     hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.cxx
     )
 
index 3ce455431e1afbaf76a580cb5249aa542c18bc73..74e46fca501931cd126edf373a4b9798422ede0d 100644 (file)
@@ -96,6 +96,7 @@
 #pragma link C++ class  AliHFEreducedTrack+;
 #pragma link C++ class  AliHFEreducedMCParticle+;
 #pragma link C++ class  AliAnalysisTaskHFEQA+;
+#pragma link C++ class  AliAnalysisTaskHFEemcQA+;
 #pragma link C++ class  AliAnalysisTaskFlowITSTPCTOFQCSP+;
 
 #endif
diff --git a/PWGHF/hfe/AliAnalysisTaskHFEemcQA.cxx b/PWGHF/hfe/AliAnalysisTaskHFEemcQA.cxx
new file mode 100644 (file)
index 0000000..a0d4b80
--- /dev/null
@@ -0,0 +1,371 @@
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TCanvas.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliESDtrackCuts.h"
+
+#include "AliAODEvent.h"
+#include "AliAODHandler.h"
+
+#include "AliAnalysisTaskHFEemcQA.h"
+
+//QA task for EMCAL electron analysis 
+
+ClassImp(AliAnalysisTaskHFEemcQA)
+  //________________________________________________________________________
+  AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA(const char *name) 
+: AliAnalysisTaskSE(name),
+  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)
+{
+  // Constructor
+
+  // 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, TList::Class());
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
+{
+  // Create histograms
+  // Called once
+
+  fOutputList = new TList();
+
+  fVtxZ = new TH1F("fVtxZ","Z vertex position;Vtx_{z};counts",1000,-50,50);
+  fOutputList->Add(fVtxZ);
+
+  fVtxY = new TH1F("fVtxY","Y vertex position;Vtx_{y};counts",1000,-50,50);
+  fOutputList->Add(fVtxY);
+
+  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);
+  fOutputList->Add(fTrigMulti);
+
+  fHistClustE = new TH1F("fHistClustE", "EMCAL cluster energy distribution; Cluster E;counts", 500, 0.0, 50.0);
+  fOutputList->Add(fHistClustE);
+
+  fEMCClsEtaPhi = new TH2F("fEMCClsEtaPhi","EMCAL cluster #eta and #phi distribution;#eta;#phi",100,-0.9,0.9,200,0,6.3);
+  fOutputList->Add(fEMCClsEtaPhi);
+
+  fNegTrkIDPt = new TH1F("fNegTrkIDPt", "p_{T} distribution of tracks with negative track id;p_{T} (GeV/c);counts", 500, 0.0, 50.0); 
+  fOutputList->Add(fNegTrkIDPt);
+
+  fTrkPt = new TH1F("fTrkPt","p_{T} distribution of all tracks;p_{T} (GeV/c);counts",1000,0,100);
+  fOutputList->Add(fTrkPt);
+
+  fTrketa = new TH1F("fTrketa","All Track #eta distribution;#eta;counts",100,-1.5,1.5);
+  fOutputList->Add(fTrketa);
+
+  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);
+  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);
+
+  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);                                      
+
+  fEMCTrkMatch = new TH2F("fEMCTrkMatch","Distance of EMCAL cluster to its closest track;#phi;z",100,-0.3,0.3,100,-0.3,0.3);
+  fOutputList->Add(fEMCTrkMatch);
+
+  fEMCTrkPt = new TH1F("fEMCTrkPt","p_{T} distribution of tracks with EMCAL cluster;p_{T} (GeV/c);counts",1000,0,100);
+  fOutputList->Add(fEMCTrkPt);
+
+  fEMCTrketa = new TH1F("fEMCTrketa","#eta distribution of tracks matched to EMCAL;#eta;counts",100,-1.5,1.5);
+  fOutputList->Add(fEMCTrketa);
+
+  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);
+  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.);
+  fOutputList->Add(fEMCTPCNpts);
+
+  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);
+  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);
+  fOutputList->Add(fEleCanTPCNpts);
+
+  fEleCanTPCNCls = new TH2F("fEleCanTPCNCls","TPC N clusters for electron candidates;p_{T} (GeV/c);N TPC clusters",200,0,20,171,-0.5,170.5);
+  fOutputList->Add(fEleCanTPCNCls);
+
+  fEleCanITSNCls = new TH2F("fEleCanITSNCls","ITS N clusters for electron candidates;p_{T} (GeV/c);N ITS clusters",200,0,20,8,-0.5,7.5);
+  fOutputList->Add(fEleCanITSNCls);
+
+  fEleCanITShit = new TH1F("fEleCanITShit","ITS hit map;ITS layer;counts",7,-0.5,6.5);
+  fOutputList->Add(fEleCanITShit);
+
+  fEleCanSPD1 = new TH2F("fEleCanSPD1","Hit on SPD layer 1;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
+  fOutputList->Add(fEleCanSPD1);
+
+  fEleCanSPD2 = new TH2F("fEleCanSPD2","Hit on SPD layer 2;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
+  fOutputList->Add(fEleCanSPD2);
+
+  fEleCanSPDBoth = new TH2F("fEleCanSPDBoth","Tracks with hits on both SPD layer;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
+  fOutputList->Add(fEleCanSPDBoth);
+
+  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);
+
+  PostData(1,fOutputList);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHFEemcQA::UserExec(Option_t *) 
+{
+  // Main loop
+  // Called for each event
+  // Post output data.
+
+  UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+
+  fVevent = dynamic_cast<AliVEvent*>(InputEvent());
+  if (!fVevent) {
+    printf("ERROR: fVEvent not available\n");
+    return;
+  }
+
+  fESD = dynamic_cast<AliESDEvent*>(InputEvent());
+  if (fESD) {
+    printf("fESD available\n");
+    //return;
+  }
+
+  AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
+  esdTrackCutsH->SetMaxDCAToVertexXY(2.4);
+  esdTrackCutsH->SetMaxDCAToVertexZ(3.2);
+  esdTrackCutsH->SetDCAToVertex2D(kTRUE);
+
+  fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
+  if (fAOD) {
+    printf("fAOD available\n");
+    //return;
+  }
+
+  int 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;
+  const AliVVertex *pVtx = fVevent->GetPrimaryVertex();
+  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
+  
+  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;
+  
+
+  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);
+  }
+
+  // event selection
+  if(fabs(Zvertex>10.0))return; 
+  
+  //EMCAL cluster information
+  int 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
+      clust->GetPosition(emcx);
+      TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
+      double emcphi = clustpos.Phi(); 
+      double emceta = clustpos.Eta();
+      fHistClustE->Fill(clustE);
+      fEMCClsEtaPhi->Fill(emceta,emcphi);
+    }
+  }
+
+  // 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);
+      continue;
+    }
+    AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack);
+    AliESDtrack *etrack = dynamic_cast<AliESDtrack*>(Vtrack);
+    AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
+
+    if(fAOD)
+      if(!atrack->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;
+
+    if(fESD)
+      if(!esdTrackCutsH->AcceptTrack(etrack))continue;
+
+    //track properties
+    double dEdx = track->GetTPCsignal();
+    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());
+
+    //track matching to EMCAL
+    int 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?
+    {
+      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());
+      fEMCdEdx->Fill(track->P(),dEdx);
+      fEMCTPCNpts->Fill(track->P(),track->GetTPCsignalN());
+
+      //E/p distribution
+      double clustMatchE = clustMatch->E();
+      double eop = -1.0;
+      if(track->P()>0)eop = clustMatchE/track->P();
+
+      if(track->Pt()>2.0)fHistdEdxEop->Fill(eop,dEdx);
+      fHistEop->Fill(track->Pt(),eop);
+
+      //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());
+
+        Int_t fITSncls=0;
+        for(Int_t l=0;l<6;l++) {
+          if(TESTBIT(track->GetITSClusterMap(),l)) {
+            fEleCanITShit->Fill(l);
+            if(l==0) fEleCanSPD1->Fill(track->Pt(),0.5);
+            if(l==1) fEleCanSPD2->Fill(track->Pt(),0.5);
+            if(l==0 && l==1) fEleCanSPDBoth->Fill(track->Pt(),0.5);
+            if(l==0 || l==1) fEleCanSPDOr->Fill(track->Pt(),0.5);
+            fITSncls++;
+          }
+        }
+        fEleCanITSNCls->Fill(track->Pt(),fITSncls++);
+      }
+    }
+  } //track loop 
+
+  PostData(1, fOutputList);
+}      
+//________________________________________________________________________
+void AliAnalysisTaskHFEemcQA::Terminate(Option_t *) 
+{
+  // Draw result to the screen
+  // Called once at the end of the query
+
+  fOutputList = dynamic_cast<TList*> (GetOutputData(1));
+  if (!fOutputList) {
+    printf("ERROR: Output list not available\n");
+    return;
+  }
+
+}
diff --git a/PWGHF/hfe/AliAnalysisTaskHFEemcQA.h b/PWGHF/hfe/AliAnalysisTaskHFEemcQA.h
new file mode 100644 (file)
index 0000000..d98e186
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef AliAnalysisTaskHFEemcQA_cxx
+#define AliAnalysisTaskHFEemcQA_cxx
+
+//QA task for EMCAL electron analysis 
+
+class TH1F;
+class AliESDEvent;
+class AliAODEvent;
+
+#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(const char *name);
+  virtual ~AliAnalysisTaskHFEemcQA() {}
+  
+  virtual void   UserCreateOutputObjects();
+  virtual void   UserExec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+  
+ private:
+  AliVEvent   *fVevent;  //!V event object
+  AliESDEvent *fESD;    //!ESD object
+  AliAODEvent *fAOD;    //!AOD object
+  TList       *fOutputList; //!Output list
+  TH1F        *fVtxZ;//!Vertex z 
+  TH1F        *fVtxX;//!Vertex x 
+  TH1F        *fVtxY;//!Vertex y 
+  TH2F        *fTrigMulti;//!trigger multiplicity 
+  TH1F        *fHistClustE;//!cluster energy
+  TH2F        *fEMCClsEtaPhi;//! EMC cluster eta and phi 
+  TH1F        *fNegTrkIDPt;//!neg track ID
+  TH1F        *fTrkPt;//!track pt
+  TH1F        *fTrketa;//!track eta
+  TH1F        *fTrkphi;//!track phi 
+  TH2F        *fdEdx;//!dedx vs pt
+  TH2F        *fTPCNpts;//!TPC Npoints used for dedx
+  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
+  TH1F        *fEMCTrketa;//!EMC trk eta
+  TH1F        *fEMCTrkphi;//!EMC trk phi
+  TH2F        *fEMCdEdx;//!EMC trk dedx
+  TH2F        *fEMCTPCNpts;//!EMC Npoints used for dedx
+  TH2F        *fHistdEdxEop;//!E/p vs dedx
+  TH2F        *fHistEop;//!pt vs E/p
+  TH2F        *fEleCanTPCNpts;//!ele cand TPC Npoints used for dedx
+  TH2F        *fEleCanTPCNCls;//!ele cand TPC N clusters
+  TH2F        *fEleCanITSNCls;//!ele cand ITS N clusters
+  TH1F        *fEleCanITShit;//!ele cand ITS hit map
+  TH2F        *fEleCanSPD1;//!ele cand hit SPD layer 1
+  TH2F        *fEleCanSPD2;//!ele cand hit SPD layer 2
+  TH2F        *fEleCanSPDBoth;//!ele cand SPD both layer
+  TH2F        *fEleCanSPDOr;//!ele cand SPD or
+
+  AliAnalysisTaskHFEemcQA(const AliAnalysisTaskHFEemcQA&); // not implemented
+  AliAnalysisTaskHFEemcQA& operator=(const AliAnalysisTaskHFEemcQA&); // not implemented
+  
+  ClassDef(AliAnalysisTaskHFEemcQA, 1); // example of analysis
+};
+
+#endif
+
+
diff --git a/PWGHF/hfe/macros/AddTaskHFEemcQA.C b/PWGHF/hfe/macros/AddTaskHFEemcQA.C
new file mode 100644 (file)
index 0000000..1a3b8cb
--- /dev/null
@@ -0,0 +1,68 @@
+AliAnalysisTask *AddTaskHFEemcQA(){
+  //get the current analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTaskHFE", "No analysis manager found.");
+    return NULL;
+  }
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskHFE", "This task requires an input event handler");
+    return NULL;
+  }  
+  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  
+ Bool_t MCthere=kFALSE;
+  AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
+  if(!mcH){
+    MCthere=kFALSE;
+  }else{
+    MCthere=kTRUE;
+  }
+
+
+  gROOT->LoadMacro("AliAnalysisTaskHFEemcQA.cxx++g");
+  
+  // +++ EMCal MB
+  AliAnalysisTaskHFEemcQA *hfecalqa = new AliAnalysisTaskHFEemcQA("emcqa");
+  mgr->AddTask(hfecalqa);
+  hfecalqa->SelectCollisionCandidates(AliVEvent::kINT8);
+  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()));
+  */
+
+  // EMCal EGA
+  AliAnalysisTaskHFEemcQA *hfecalqaTrig0 = new AliAnalysisTaskHFEemcQA("emcqa");
+  mgr->AddTask(hfecalqaTrig0);
+  hfecalqaTrig0->SelectCollisionCandidates(AliVEvent::kEMCEGA);
+  TString containerName1 = mgr->GetCommonFileName();
+  containerName1 += ":PWGHF_hfeHFEemcQATrigGA";
+  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("HFEemcQATrigGA", TList::Class(),AliAnalysisManager::kOutputContainer, containerName1.Data());
+  mgr->ConnectInput(hfecalqaTrig0, 0, cinput);
+  mgr->ConnectOutput(hfecalqaTrig0, 1, coutput1); 
+
+  // EMCal EJE
+  AliAnalysisTaskHFEemcQA *hfecalqaTrig1 = new AliAnalysisTaskHFEemcQA("emcqa");
+  mgr->AddTask(hfecalqaTrig1);
+  hfecalqaTrig1->SelectCollisionCandidates(AliVEvent::kEMCEJE);
+  TString containerName2 = mgr->GetCommonFileName();
+  containerName1 += ":PWGHF_hfeHFEemcQATrigJE";
+  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("HFEemcQATrigJE", TList::Class(),AliAnalysisManager::kOutputContainer, containerName2.Data());
+  mgr->ConnectInput(hfecalqaTrig1, 0, cinput);
+  mgr->ConnectOutput(hfecalqaTrig1, 1, coutput1); 
+
+  //return hfecalqa;
+  return NULL;
+}