added trigger selections and more variables in the output (Marta)
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 22 Jan 2010 14:57:36 +0000 (14:57 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 22 Jan 2010 14:57:36 +0000 (14:57 +0000)
PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
PWG4/JetTasks/AliPWG4HighPtSpectra.cxx
PWG4/JetTasks/AliPWG4HighPtSpectra.h
PWG4/macros/AddTaskPWG4HighPtQATPConly.C
PWG4/macros/AddTaskPWG4HighPtSpectra.C

index c0916d4..c3c82e1 100644 (file)
@@ -22,8 +22,8 @@
 // Author : Marta Verweij - UU
 //-----------------------------------------------------------------------
 
-#ifndef ALIPWG4HighPtQATPCONLY_CXX
-#define ALIPWG4HighPtQATPCONLY_CXX
+#ifndef ALIPWG4HIGHPTQATPCONLY_CXX
+#define ALIPWG4HIGHPTQATPCONLY_CXX
 
 #include "AliPWG4HighPtQATPConly.h"
 
@@ -42,7 +42,7 @@
 #include "AliESDtrackCuts.h"
 #include "AliExternalTrackParam.h"
 #include "AliLog.h"
-#include "AliAnalysisHelperJetTasks.h"
+//#include "AliAnalysisHelperJetTasks.h"
 
 using namespace std; //required for resolving the 'cout' symbol
 
@@ -201,13 +201,13 @@ void AliPWG4HighPtQATPConly::CreateOutputObjects() {
   fPtAllminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
   fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPC);
 
-  fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
+  fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
   fPtAllminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{All}");
   fPtAllminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
   fPtAllminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
   fHistList->Add(fPtAllminPtTPCvsPtAllDCAR);
 
-  fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
+  fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
   fPtAllminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{All}");
   fPtAllminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
   fPtAllminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
@@ -258,13 +258,13 @@ void AliPWG4HighPtQATPConly::CreateOutputObjects() {
   fPtITSminPtTPCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPC);
     
-  fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
+  fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
   fPtITSminPtTPCvsPtITSDCAR->SetXTitle("p_{t}^{ITSrefit}");
   fPtITSminPtTPCvsPtITSDCAR->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
   fPtITSminPtTPCvsPtITSDCAR->SetZTitle("DCA_{R}");
   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAR);
   
-  fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
+  fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
   fPtITSminPtTPCvsPtITSDCAZ->SetXTitle("p_{t}^{ITSrefit}");
   fPtITSminPtTPCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
   fPtITSminPtTPCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
@@ -321,35 +321,38 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
 
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
+    // Post output data
+     PostData(0, fHistList);
+     PostData(1, fHistListTPC);
+     PostData(2, fHistListITS);
     return;
   }
 
-  //Trigger selection
-  AliAnalysisHelperJetTasks::Trigger trig;
-  trig = (AliAnalysisHelperJetTasks::Trigger)fTrigger;
-  if (AliAnalysisHelperJetTasks::IsTriggerFired(fESD,trig)){
-    AliDebug(2,Form(" Trigger Selection: event ACCEPTED ... "));
-  }else{
+  Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+  if(!isSelected) { //Select collison candidates
     AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
     // Post output data
-    PostData(0, fHistList);
-    PostData(1, fHistListTPC);
-    PostData(2, fHistListITS);
+     PostData(0, fHistList);
+     PostData(1, fHistListTPC);
+     PostData(2, fHistListITS);
     return;
-  } 
+  }
 
-//  if(!fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL") || !fESD->IsTriggerClassFired("CSMBB-ABCE-NOPF-ALL")) return;
-  
   const AliESDVertex *vtx = fESD->GetPrimaryVertexTracks();
   // Need vertex cut
-  if (vtx->GetNContributors() < 2)
+  if (vtx->GetNContributors() < 2) {
+    // Post output data
+    PostData(0, fHistList);
+    PostData(1, fHistListTPC);
+    PostData(2, fHistListITS);
     return;
+  }
 
   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
   double primVtx[3];
   vtx->GetXYZ(primVtx);
   //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
-  if(TMath::Abs(primVtx[0]>1.) || TMath::Abs(primVtx[1]>1.) || TMath::Abs(primVtx[2])>10.){
+  if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
     // Post output data
     PostData(0, fHistList);
     PostData(1, fHistListTPC);
@@ -375,10 +378,7 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
     
     AliESDtrack *track = fESD->GetTrack(iTrack);
     AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
-    //    AliESDtrack *trackTPConly = fTrackCuts->GetTPCOnlyTrack(fESD,iTrack); 
-    if(!track) continue;
-    if(!trackTPC) continue;
-//     if(!trackTPConly) continue;
+    if(!track || !trackTPC) continue;
     Float_t pt = track->Pt();
     Float_t ptTPC = trackTPC->Pt();
     Float_t phi = track->Phi();
@@ -404,7 +404,6 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
     if (fTrackCuts->AcceptTrack(track)) {
 
       fPtSel->Fill(pt);
-      
       fPtSelTPC->Fill(ptTPC);
       fPtAllminPtTPCvsPtAll->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
       fPtAllminPtTPCvsPtAllNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCNcls());
@@ -434,7 +433,7 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
       fPtITSminPtTPCvsPtITSRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
     }//fTrackCutsITS loop
       
-  }//ESD track loop
+}//ESD track loop
    
   // Post output data
   PostData(0, fHistList);
index f81bdde..3d837bc 100644 (file)
 //-----------------------------------------------------------------------
 
 
-#ifndef ALIPWG4HighPtSpectra_CXX
-#define ALIPWG4HighPtSpectra_CXX
+#ifndef ALIPWG4HIGHPTSPECTRA_CXX
+#define ALIPWG4HIGHPTSPECTRA_CXX
 
 #include "AliPWG4HighPtSpectra.h"
 
+#include "TVector3.h"
+#include <iostream>
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+#include "TList.h"
+#include "TChain.h"
+#include "TH3F.h"
+
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliExternalTrackParam.h"
+#include "AliLog.h"
+
 #include "AliStack.h"
 #include "TParticle.h"
 #include "TH1I.h"
 #include "AliMCEvent.h"
 #include "AliMCEventHandler.h"
-#include "AliAnalysisManager.h"
 #include "AliCFContainer.h"
-#include "TChain.h"
-#include "AliESDtrack.h"
-#include "AliESDtrackCuts.h"
-#include "AliExternalTrackParam.h"
-#include "AliESDInputHandler.h"
-#include "AliAnalysisHelperJetTasks.h"
 
+//#include "$ALICE_ROOT/PWG4/JetTasks/AliAnalysisHelperJetTasks.h"
+
+//#include <iostream>
 using namespace std; //required for resolving the 'cout' symbol
 
 ClassImp(AliPWG4HighPtSpectra)
@@ -50,14 +62,14 @@ ClassImp(AliPWG4HighPtSpectra)
 //__________________________________________________________________________
 AliPWG4HighPtSpectra::AliPWG4HighPtSpectra() : AliAnalysisTask("AliPWG4HighPtSpectra", ""), 
   fReadAODData(0),
-  fCFManager(0x0),
+  fCFManagerPos(0x0),
+  fCFManagerNeg(0x0),
   fESD(0),
   fTrackCuts(0),
   fTrigger(0),
   fHistList(0),
   fNEventAll(0),
   fNEventSel(0)
-  //  fHistEventsProcessed(0x0)
 {
   //
   //Default ctor
@@ -67,78 +79,81 @@ AliPWG4HighPtSpectra::AliPWG4HighPtSpectra() : AliAnalysisTask("AliPWG4HighPtSpe
 AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const Char_t* name) :
   AliAnalysisTask(name,""),
   fReadAODData(0),
-  fCFManager(0x0),
+  fCFManagerPos(0x0),
+  fCFManagerNeg(0x0),
   fESD(0),
-  fTrackCuts(),//new AliESDtrackCuts),
+  fTrackCuts(),
   fTrigger(0),
   fHistList(0),
   fNEventAll(0),
   fNEventSel(0)
-  //  fHistEventsProcessed(0x0)
 {
   //
   // Constructor. Initialization of Inputs and Outputs
   //
-  AliDebug(2,Form("AliPWG4HighPtQAMC","Calling Constructor"));
+  AliDebug(2,Form("AliPWG4HighPtSpectra","Calling Constructor"));
   // Input slot #0 works with a TChain ESD
   DefineInput(0, TChain::Class());
   DefineOutput(0,TList::Class());
   DefineOutput(1,AliCFContainer::Class());
+  DefineOutput(2,AliCFContainer::Class());
 }
 
-//___________________________________________________________________________
-AliPWG4HighPtSpectra& AliPWG4HighPtSpectra::operator=(const AliPWG4HighPtSpectra& c) 
-{
-  //
-  // Assignment operator
-  //
-  if (this!=&c) {
-    AliAnalysisTask::operator=(c) ;
-    fReadAODData = c.fReadAODData ;
-    fCFManager  = c.fCFManager;
-    fHistList = c.fHistList;
-    fNEventAll = c.fNEventAll;
-    fNEventSel = c.fNEventSel;
-    //    fHistEventsProcessed = c.fHistEventsProcessed;
-  }
-  return *this;
-}
-
-//___________________________________________________________________________
-AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c) :
-  AliAnalysisTask(c),
-  fReadAODData(c.fReadAODData),
-  fCFManager(c.fCFManager),
-  fESD(c.fESD),
-  fTrackCuts(c.fTrackCuts),
-  fTrigger(c.fTrigger),
-  fHistList(c.fHistList),
-  fNEventAll(c.fNEventAll),
-  fNEventSel(c.fNEventSel)
-  //  fHistEventsProcessed(c.fHistEventsProcessed)
-{
-  //
-  // Copy Constructor
-  //
-}
-
-//___________________________________________________________________________
-AliPWG4HighPtSpectra::~AliPWG4HighPtSpectra() {
-  //
-  //destructor
-  //
-  Info("~AliPWG4HighPtSpectra","Calling Destructor");
-  if (fCFManager)           delete fCFManager ;
-  if (fNEventAll) delete fNEventAll ;
-  if (fNEventSel) delete fNEventSel ;
-}
+// //___________________________________________________________________________
+// AliPWG4HighPtSpectra& AliPWG4HighPtSpectra::operator=(const AliPWG4HighPtSpectra& c) 
+// {
+//   //
+//   // Assignment operator
+//   //
+//   if (this!=&c) {
+//     AliAnalysisTask::operator=(c) ;
+//     fReadAODData = c.fReadAODData ;
+//     fCFManagerPos  = c.fCFManagerPos;
+//     fCFManagerNeg  = c.fCFManagerNeg;
+//     fHistList = c.fHistList;
+//     fNEventAll = c.fNEventAll;
+//     fNEventSel = c.fNEventSel;
+//   }
+//   return *this;
+// }
+
+// //___________________________________________________________________________
+// AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c) :
+//   AliAnalysisTask(c),
+//   fReadAODData(c.fReadAODData),
+//   fCFManagerPos(c.fCFManagerPos),
+//   fCFManagerNeg(c.fCFManagerNeg),
+//   fESD(c.fESD),
+//   fTrackCuts(c.fTrackCuts),
+//   fTrigger(c.fTrigger),
+//   fHistList(c.fHistList),
+//   fNEventAll(c.fNEventAll),
+//   fNEventSel(c.fNEventSel)
+// {
+//   //
+//   // Copy Constructor
+//   //
+// }
+
+// //___________________________________________________________________________
+// AliPWG4HighPtSpectra::~AliPWG4HighPtSpectra() {
+//   //
+//   //destructor
+//   //
+//   Info("~AliPWG4HighPtSpectra","Calling Destructor");
+//   if (fCFManagerPos)           delete fCFManagerPos ;
+//   if (fCFManagerNeg)           delete fCFManagerNeg ;
+//   if (fNEventAll)              delete fNEventAll ;
+//   if (fNEventSel)              delete fNEventSel ;
+// }
 //________________________________________________________________________
 void AliPWG4HighPtSpectra::ConnectInputData(Option_t *) 
 {
   // Connect ESD here
   // Called once
   AliDebug(2,Form(">> AliPWG4HighPtSpectra::ConnectInputData \n"));
-  //  printf(">> AliPWG4HighPtSpectra::ConnectInputData \n");
+  //  cout << "cout >> AliPWG4HighPtSpectra::ConnectInputData" << endl;
+  printf(">> AliPWG4HighPtSpectra::ConnectInputData \n");
 
   TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
   if (!tree) {
@@ -149,13 +164,14 @@ void AliPWG4HighPtSpectra::ConnectInputData(Option_t *)
     
     if (!esdH) {
       AliDebug(2,Form("ERROR: Could not get ESDInputHandler"));
-    } else
+    } else {
       fESD = esdH->GetEvent();
+    }
   }
+  
 }
 //_________________________________________________
-void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
+void AliPWG4HighPtSpectra::Exec(Option_t *)
 {
   //
   // Main loop function
@@ -167,33 +183,38 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
 
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
+    PostData(0,fHistList);
+    PostData(1,fCFManagerPos->GetParticleContainer());
+    PostData(2,fCFManagerNeg->GetParticleContainer());
     return;
   }
 
-  //Trigger selection
-  AliAnalysisHelperJetTasks::Trigger trig;
-  trig = (AliAnalysisHelperJetTasks::Trigger)fTrigger;
-  if (AliAnalysisHelperJetTasks::IsTriggerFired(fESD,trig)){
-    AliDebug(2,Form(" Trigger Selection: event ACCEPTED ... "));
-  }else{
+  Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+  if(!isSelected) { //Select collison candidates
     AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
     PostData(0,fHistList);
-    PostData(1,fCFManager->GetParticleContainer());
+    PostData(1,fCFManagerPos->GetParticleContainer());
+    PostData(2,fCFManagerNeg->GetParticleContainer());
     return;
-  } 
-  //  if(!fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL") || !fESD->IsTriggerClassFired("CSMBB-ABCE-NOPF-ALL")) return;
+  }
 
   // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
   // This handler can return the current MC event
-  AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  
+  AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  //  AliMCEventHandler* eventHandler = (AliMCEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  
   AliStack* stack = 0x0;
   AliMCEvent* mcEvent = 0x0;
-
+  
   if(eventHandler) {
     mcEvent = eventHandler->MCEvent();
     if (!mcEvent) {
       AliDebug(2,Form("ERROR: Could not retrieve MC event"));
-      return;
+      PostData(0,fHistList);
+      PostData(1,fCFManagerPos->GetParticleContainer());
+    PostData(2,fCFManagerNeg->GetParticleContainer());
+    return;
     }
     
     AliDebug(2,Form("MC particles: %d", mcEvent->GetNumberOfTracks()));
@@ -204,30 +225,49 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
   }
   
   const AliESDVertex *vtx = fESD->GetPrimaryVertex();
+  AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
   // Need vertex cut
-  if (vtx->GetNContributors() < 2){
+  if (vtx->GetNContributors() < 2) {
     PostData(0,fHistList);
-    PostData(1,fCFManager->GetParticleContainer());
+    PostData(1,fCFManagerPos->GetParticleContainer());
+    PostData(2,fCFManagerNeg->GetParticleContainer());
     return;
   }
+  
   double primVtx[3];
   vtx->GetXYZ(primVtx);
-  if(TMath::Abs(primVtx[0]>1. )|| TMath::Abs(primVtx[1]>1.) || TMath::Abs(primVtx[2]>10.)){
+  if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
     PostData(0,fHistList);
-    PostData(1,fCFManager->GetParticleContainer());
+    PostData(1,fCFManagerPos->GetParticleContainer());
+    PostData(2,fCFManagerNeg->GetParticleContainer());
+    return;
+  }
+  
+  if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2){ 
+    // Post output data
+    PostData(0,fHistList);
+    PostData(1,fCFManagerPos->GetParticleContainer());
+    PostData(2,fCFManagerNeg->GetParticleContainer());
     return;
   }
-  AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
-
   Int_t nTracks = fESD->GetNumberOfTracks();
   AliDebug(2,Form("nTracks %d", nTracks));
 
+  if(!fTrackCuts) { 
+    // Post output data
+    PostData(0,fHistList);
+    PostData(1,fCFManagerPos->GetParticleContainer());
+    PostData(2,fCFManagerNeg->GetParticleContainer());
+    return;
+  }
+
   // Selected events for analysis
   fNEventSel->Fill(0.);
-
-  Double_t containerInputRec[1] ;
-  Double_t containerInputTPConly[1] ;
-  Double_t containerInputMC[1] ;
+  
+  
+  Double_t containerInputRec[5] ;
+  Double_t containerInputTPConly[5];
+  Double_t containerInputMC[5];
   //Now go to rec level
   for (Int_t iTrack = 0; iTrack<nTracks; iTrack++) 
     {   
@@ -237,30 +277,72 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
       AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
       if(!track || !trackTPC) continue;
 
-    
+      Float_t dca2D, dcaZ;
+      track->GetImpactParameters(dca2D,dcaZ);
+      Float_t dca2DTPC, dcaZTPC;
+      track->GetImpactParametersTPC(dca2DTPC,dcaZTPC); 
+      Float_t chi2PerClusterTPC = -1.;
+      Float_t nClustersTPC = track->GetTPCNcls();//track->GetTPCclusters(0);
+      if(nClustersTPC!=0.) chi2PerClusterTPC = track->GetTPCchi2()/nClustersTPC;
+
       //fill the container
       containerInputRec[0] = track->Pt();
+      containerInputRec[1] = track->Phi();
+      containerInputRec[2] = track->Eta();
+      containerInputRec[3] = dca2D;
+      containerInputRec[4] = chi2PerClusterTPC;
+
       containerInputTPConly[0] = trackTPC->Pt();
+      containerInputTPConly[1] = trackTPC->Phi();
+      containerInputTPConly[2] = trackTPC->Eta();
+      containerInputTPConly[3] = dca2DTPC/10.; //Divide by 10 in order to store in same containter. Should be corrected back when looking at output.
+      containerInputTPConly[4] = chi2PerClusterTPC;//TPC;
 
       if (fTrackCuts->AcceptTrack(track)) {
-       fCFManager->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
-       fCFManager->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
+       if(track->GetSign()>0.) {
+         fCFManagerPos->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
+         fCFManagerPos->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
+       }
+       if(track->GetSign()<0.) {
+         fCFManagerNeg->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
+         fCFManagerNeg->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
+       }
        
+       
        //Only fill the secondary particle container if MC information is available
        if(eventHandler) {
          Int_t label = TMath::Abs(track->GetLabel());
          TParticle *particle = stack->Particle(label) ;
          if(!particle) continue;
          containerInputMC[0] = particle->Pt();      
-         fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepReconstructedMC);
+         containerInputMC[1] = particle->Phi();      
+         containerInputMC[2] = particle->Eta();  
+         containerInputMC[3] = 0.0;      
+         containerInputMC[4] = 0.0;  
+
+         if(particle->GetPDG()->Charge()>0.) {
+           fCFManagerPos->GetParticleContainer()->Fill(containerInputMC,kStepReconstructedMC);
+         }
+         if(particle->GetPDG()->Charge()<0.) {
+           fCFManagerNeg->GetParticleContainer()->Fill(containerInputMC,kStepReconstructedMC);
+         }
+
          if (!stack->IsPhysicalPrimary(label) ) {
-           fCFManager->GetParticleContainer()->Fill(containerInputRec,kStepSecondaries);
+           if(particle->GetPDG()->Charge()>0.) {
+             fCFManagerPos->GetParticleContainer()->Fill(containerInputRec,kStepSecondaries);
+           }
+           if(particle->GetPDG()->Charge()<0.) {
+             fCFManagerNeg->GetParticleContainer()->Fill(containerInputRec,kStepSecondaries);
+           }
          }
        }
+       
       }
       
     }
+  
 
+  
   if(eventHandler) {
     for(int iPart = 1; iPart<(mcEvent->GetNumberOfTracks()); iPart++)//stack->GetNprimary();
       {
@@ -269,21 +351,29 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
        
        //fill the container
        containerInputMC[0] = mcPart->Pt();
-       
-       if (!fCFManager->CheckParticleCuts(3,mcPart)) continue ;
-       
+       containerInputMC[1] = mcPart->Phi();      
+       containerInputMC[2] = mcPart->Eta();  
+       containerInputMC[3] = 0.0;
+       containerInputMC[4] = 0.0;
+
        int counter;
-       
-       Float_t trackLengthTPC = mcPart->GetTPCTrackLength(fESD->GetMagneticField(),0.1,counter,3.0);
-       
-       if(trackLengthTPC>80.) fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepMCtrackable) ;
-       
+
+       if(mcPart->Charge()>0. && fCFManagerPos->CheckParticleCuts(3,mcPart)) {
+         Float_t trackLengthTPC = mcPart->GetTPCTrackLength(fESD->GetMagneticField(),0.1,counter,3.0);
+         if(trackLengthTPC>80.) fCFManagerPos->GetParticleContainer()->Fill(containerInputMC,kStepMCtrackable) ;
+       }
+       if(mcPart->Charge()<0. && fCFManagerNeg->CheckParticleCuts(3,mcPart)) {
+         Float_t trackLengthTPC = mcPart->GetTPCTrackLength(fESD->GetMagneticField(),0.1,counter,3.0);
+         if(trackLengthTPC>80.) fCFManagerNeg->GetParticleContainer()->Fill(containerInputMC,kStepMCtrackable) ;
+       }
       }
   }
-
-   PostData(0,fHistList);
-   PostData(1,fCFManager->GetParticleContainer());
-
+  
+   
+  PostData(0,fHistList);
+  PostData(1,fCFManagerPos->GetParticleContainer());
+  PostData(2,fCFManagerNeg->GetParticleContainer());
+  
 }
 
 
@@ -293,8 +383,6 @@ void AliPWG4HighPtSpectra::Terminate(Option_t*)
   // The Terminate() function is the last function to be called during
   // a query. It always runs on the client, it can be used to present
   // the results graphically or save the results to file.
-
-
 }
 
 //___________________________________________________________________________
@@ -304,6 +392,9 @@ void AliPWG4HighPtSpectra::CreateOutputObjects() {
   //
   AliDebug(2,Form("CreateOutputObjects","CreateOutputObjects of task %s", GetName()));
 
+  Bool_t oldStatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE); 
+
   //slot #1
   OpenFile(0);
   fHistList = new TList();
@@ -312,6 +403,8 @@ void AliPWG4HighPtSpectra::CreateOutputObjects() {
   fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
   fHistList->Add(fNEventSel);
 
+  TH1::AddDirectory(oldStatus);   
+
 }
 
 #endif
index e966157..36cd12f 100644 (file)
@@ -27,7 +27,7 @@ class TH1I;
 class TH1F;
 class TH1D;
 class TFile ;
-class AliCFManager;
+//class AliCFManager;
 class AliESDtrackCuts;
 class AliESDEvent;
 
@@ -35,18 +35,18 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
  public:
 
   enum {
-    kStepReconstructed    = 0,
+    kStepReconstructed        = 0,
     kStepReconstructedTPCOnly = 1,
-    kStepSecondaries      = 2,
-    kStepMCtrackable      = 3,
-    kStepReconstructedMC    = 4
+    kStepSecondaries          = 2,
+    kStepMCtrackable          = 3,
+    kStepReconstructedMC      = 4
   };
 
   AliPWG4HighPtSpectra();
   AliPWG4HighPtSpectra(const Char_t* name);
-  AliPWG4HighPtSpectra& operator= (const AliPWG4HighPtSpectra& c);
-  AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c);
-  virtual ~AliPWG4HighPtSpectra();
+  // AliPWG4HighPtSpectra& operator= (const AliPWG4HighPtSpectra& c);
+  //  AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c);
+  ~AliPWG4HighPtSpectra() {;};
 
   // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
   virtual void   ConnectInputData(Option_t *);
@@ -55,9 +55,11 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
   virtual void   Terminate(Option_t *);
 
   // CORRECTION FRAMEWORK RELATED FUNCTIONS
-  void     SetCFManager(const AliCFManager* io) {fCFManager = io;}   // global correction manager
-  const AliCFManager * GetCFManager() const {return fCFManager;}           // get corr manager
-
+  void     SetCFManagerPos(const AliCFManager* io1) {fCFManagerPos = io1;}   // global correction manager 
+  const AliCFManager * GetCFManagerPos() const {return fCFManagerPos;}           // get corr manager 
+  void     SetCFManagerNeg(const AliCFManager* io2) {fCFManagerNeg = io2;}   // global correction manager 
+  const AliCFManager * GetCFManagerNeg() const {return fCFManagerNeg;}            // get corr manager
+  
   //AliESDtrackCuts setters
   void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
   //Select the trigger
@@ -68,20 +70,23 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
   void   SetReadAODData(Bool_t flag=kTRUE) {fReadAODData=flag;}
   
  protected:
-  Bool_t              fReadAODData ;    // flag for AOD/ESD input files
-  const AliCFManager  *fCFManager    ;  // pointer to the CF manager
-
+  Bool_t              fReadAODData ;       // flag for AOD/ESD input files
+  const AliCFManager  *fCFManagerPos    ;  // pointer to the CF manager for positive charged particles
+  const AliCFManager  *fCFManagerNeg    ;  // pointer to the CF manager for negative charged particles
   AliESDEvent *fESD;              //! ESD object
   //AliESDtrackCuts options. Must be setted in AddTaskPWG4HighPtQAMC.C. They correspond with different steps in container.
   AliESDtrackCuts *fTrackCuts;    // trackCuts applied
   Int_t fTrigger;                 //Trigger flag as defined in AliAnalysisHelperJetTasks.h 
 
  private:
+ AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra&);
+ AliPWG4HighPtSpectra& operator=(const AliPWG4HighPtSpectra&);
+
 
   // Histograms
   //Number of events
-  TList *fHistList;            // List of output histograms
-  //  TH1I  *fHistEventsProcessed; // simple histo for monitoring the number of events processed
+  TList *fHistList;            //! List of output histograms
   TH1F *fNEventAll;            //! Event counter
   TH1F *fNEventSel;            //! Event counter: Selected events for analysis
 
index 420c57d..1279164 100644 (file)
@@ -2,13 +2,13 @@
 
 AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//<some_parameters>)
 {
-  // Creates a proton analysis task and adds it to the analysis manager.
+  // Creates HighPtQATPConly analysis task and adds it to the analysis manager.
   
   // A. Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-    Error("AddTaskPWG4HighPtSpectra", "No analysis manager to connect to.");
+    Error("AddTaskPWG4HighPtQATPConly", "No analysis manager to connect to.");
     return NULL;
   }  
 
@@ -16,7 +16,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//<some_parameters>)
   //    manager. The availability of MC handler can also be checked here.
   //==============================================================================
   if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskPWG4HighPtTPConly", "This task requires an input event handler");
+    ::Error("AddTaskPWG4HighPtQATPConly", "This task requires an input event handler");
     return NULL;
   }  
   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
@@ -34,7 +34,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//<some_parameters>)
   trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCuts->SetPtRange(0.15, 1e10);//
-  trackCuts->SetMinNClustersTPC(50);//
+  trackCuts->SetMinNClustersTPC(70);//
   trackCuts->SetMaxChi2PerClusterTPC(3.5);//
   //trackCuts->SetRequireITSRefit(kTRUE);
   trackCuts->SetMaxDCAToVertexXY(2.4);
@@ -47,7 +47,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//<some_parameters>)
   trackCutsITS->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCutsITS->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCutsITS->SetPtRange(0.15, 1e10);//
-  trackCutsITS->SetMinNClustersTPC(50);//
+  trackCutsITS->SetMinNClustersTPC(70);//
   trackCutsITS->SetMaxChi2PerClusterTPC(3.5);//
   trackCutsITS->SetRequireITSRefit(kTRUE);
   trackCutsITS->SetMaxDCAToVertexXY(2.4);
@@ -58,8 +58,8 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//<some_parameters>)
   AliPWG4HighPtQATPConly *taskPWG4QA = new AliPWG4HighPtQATPConly("AliPWG4HighPtQATPConly");
   taskPWG4QA->SetCuts(trackCuts);
   taskPWG4QA->SetCutsITS(trackCutsITS);
-  taskPWG4QA->SelectTrigger(AliAnalysisHelperJetTasks::kMB1); 
   
   // E. Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
   //==============================================================================
@@ -73,7 +73,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//<some_parameters>)
   AliAnalysisDataContainer *cout_hist1 = mgr->CreateContainer("qa_histsTPC", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
   AliAnalysisDataContainer *cout_hist2 = mgr->CreateContainer("qa_histsITS", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);  
 
-
   mgr->AddTask(taskPWG4QA);
 
   mgr->ConnectInput(taskPWG4QA,0,mgr->GetCommonInputContainer());
index f598231..dbd38f1 100644 (file)
@@ -1,14 +1,29 @@
 //DEFINITION OF A FEW CONSTANTS
-const Double_t ptmin =  2.0 ;
-const Double_t ptmax =  100.0 ;
-
-const Int_t    mintrackrefsTPC = 1;
-const Int_t    mintrackrefsITS = 1;
-const Int_t    charge  = 1 ;
+const Float_t ptmin =  2.0 ;
+const Float_t ptmax =  50.0 ;
+const Float_t phimin = 0.;
+const Float_t phimax = 2.*TMath::Pi();
+const Float_t etamin = -0.9;
+const Float_t etamax = 0.9;
+const Float_t dcarmin = -0.2;
+const Float_t dcarmax = 0.2;
+const Float_t chi2TPCmin = 0.0;
+const Float_t chi2TPCmax = 3.5;
+
+const Float_t ptmin1 =  ptmin ;
+const Float_t ptmax1 =  10.0 ;
+const Float_t ptmin2 =  ptmax1 ;
+const Float_t ptmax2 =  20.0 ;
+const Float_t ptmin3 =  ptmax2 ;
+const Float_t ptmax3 =  ptmax ;
+
+const Int_t   mintrackrefsTPC = 1;
+const Int_t   mintrackrefsITS = 1;
+const Int_t   charge  = 1;
 
 AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//<some_parameters>)
 {
-  // Creates a HighPtSpectra analysis task and adds it to the analysis manager.
+  // Creates HighPtSpectra analysis task and adds it to the analysis manager.
   
   // A. Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
@@ -22,7 +37,7 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//<some_parameters>)
   //    manager. The availability of MC handler can also be checked here.
   //==============================================================================
   if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskHighPtSpectra", "This task requires an input event handler");
+    ::Error("AddTaskPWG4HighPtSpectra", "This task requires an input event handler");
     return NULL;
   }  
   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
@@ -30,36 +45,77 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//<some_parameters>)
 
   // C. Create the task, add it to manager.
   //===========================================================================
-  //CONTAINER DEFINITION
+ //CONTAINER DEFINITION
   Info("AliPWG4HighPtSpectra","SETUP CONTAINER");
   //the sensitive variables, their indices
-  UInt_t ipt = 0;
+  UInt_t ipt   = 0;
+  UInt_t iphi  = 1;
+  UInt_t ieta  = 2;
+  UInt_t idcar = 3;
+  UInt_t ichi2TPC = 4;
+
   //Setting up the container grid... 
-  UInt_t nstep = 5 ; //Steps/Modes for containers
+  UInt_t nstep = 5; //Steps/Modes for containers
   Int_t kStepReconstructed = 0;
   Int_t kStepReconstructedTPCOnly = 1;
   Int_t kStepSecondaries = 2;
   Int_t kStepMCtrackable = 3;
   Int_t kStepReconstructedMC = 4;
+  
+  const Int_t nvar   = 5; //number of variables on the grid:pt
+  const Int_t nbin11 = (int)(ptmax1-ptmin1);
+  const Int_t nbin12 = (int)((ptmax2-ptmin2)/2.)+nbin11;
+  const Int_t nbin13 = (int)((ptmax3-ptmin3)/5.)+nbin12;
+  const Int_t nbin1  = nbin13; //bins in pt 98 
+  const Int_t nbin2  =  18;//36; //bins in phi
+  const Int_t nbin3  =  9; //bins in eta
+  const Int_t nbin4  =  80; //bins in DCAR
+  const Int_t nbin5  =  35; //bins in Chi2/#NclusTPC
 
-  const Int_t nvar   = 1; //number of variables on the grid:pt
-  const Int_t nbin1  = 98; //bins in pt 98 
   //arrays for the number of bins in each dimension
   Int_t iBin[nvar];
   iBin[0]=nbin1;
-
+  iBin[1]=nbin2;
+  iBin[2]=nbin3;
+  iBin[3]=nbin4;
+  iBin[4]=nbin5;
+  
   //arrays for lower bounds :
   Double_t *binLim1=new Double_t[nbin1+1];
+  Double_t *binLim2=new Double_t[nbin2+1];
+  Double_t *binLim3=new Double_t[nbin3+1];
+  Double_t *binLim4=new Double_t[nbin4+1];
+  Double_t *binLim5=new Double_t[nbin5+1];
+
+  //values for bin lower bounds 
+  for(Int_t i=0; i<=nbin1; i++) {
+    if(i<=nbin11) binLim1[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;  
+    if(i<=nbin12 && i>nbin11) binLim1[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;  
+    if(i<=nbin13 && i>nbin12) binLim1[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;  
+  }
+  //  for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ;  
+  for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)phimin + (phimax-phimin)/nbin2*(Double_t)i ;
+  for(Int_t i=0; i<=nbin3; i++) binLim3[i]=(Double_t)etamin + (etamax-etamin)/nbin3*(Double_t)i ;  
+  for(Int_t i=0; i<=nbin4; i++) binLim4[i]=(Double_t)dcarmin + (dcarmax-dcarmin)/nbin4*(Double_t)i ;
+  for(Int_t i=0; i<=nbin5; i++) binLim5[i]=(Double_t)chi2TPCmin + (chi2TPCmax-chi2TPCmin)/nbin5*(Double_t)i ;
+  
+
+  AliCFContainer* containerPos = new AliCFContainer("containerPos","container for positive tracks",nstep,nvar,iBin);
+  //setting the bin limits
+  containerPos -> SetBinLimits(ipt,binLim1);
+  containerPos -> SetBinLimits(iphi,binLim2);
+  containerPos -> SetBinLimits(ieta,binLim3);
+  containerPos -> SetBinLimits(idcar,binLim4);
+  containerPos -> SetBinLimits(ichi2TPC,binLim5);
 
-  //values for bin lower bounds
-  for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ; 
-  //one "container" for MC
-  AliCFContainer* container = new AliCFContainer("container","container for tracks",nstep,nvar,iBin);
+  AliCFContainer* containerNeg = new AliCFContainer("containerNeg","container for negative tracks",nstep,nvar,iBin);
   //setting the bin limits
-  container -> SetBinLimits(ipt,binLim1);
+  containerNeg -> SetBinLimits(ipt,binLim1);
+  containerNeg -> SetBinLimits(iphi,binLim2);
+  containerNeg -> SetBinLimits(ieta,binLim3);
+  containerNeg -> SetBinLimits(idcar,binLim4);
+  containerNeg -> SetBinLimits(ichi2TPC,binLim5);
+  
   //CREATE THE  CUTS -----------------------------------------------
   //Use AliESDtrackCuts
   AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
@@ -69,16 +125,16 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//<some_parameters>)
   trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCuts->SetPtRange(0.15, 1e10);//
-  trackCuts->SetMinNClustersTPC(50);//
+  trackCuts->SetMinNClustersTPC(70);//
   trackCuts->SetMaxChi2PerClusterTPC(3.5);//
   trackCuts->SetRequireITSRefit(kTRUE);
   trackCuts->SetMaxDCAToVertexXY(2.4);
   trackCuts->SetMaxDCAToVertexZ(3.2);
   trackCuts->SetDCAToVertex2D(kTRUE);
-  // Gen-Level kinematic cuts
+
+ // Gen-Level kinematic cuts
   AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
-  mcKineCuts->SetPtRange(0.15,1e10); 
+  mcKineCuts->SetPtRange(0.15,1e10);
   mcKineCuts->SetRapidityRange(-0.9,0.9);//-0.5,0.5);
   mcKineCuts->SetRequireIsCharged(kTRUE);
 
@@ -99,19 +155,29 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//<some_parameters>)
 
   //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
   printf("CREATE INTERFACE AND CUTS\n");
-  AliCFManager* man = new AliCFManager() ;
-  man->SetParticleContainer(container);
-  man->SetParticleCutsList(0,recList);
-  man->SetParticleCutsList(1,recTPConlyList);
-  man->SetParticleCutsList(2,secList);
-  man->SetParticleCutsList(3,mcList);
-  man->SetParticleCutsList(4,recMCList);
-
-
+  AliCFManager* manPos = new AliCFManager("manPos","Manager for Positive tracks") ;
+  manPos->SetParticleContainer(containerPos);
+  manPos->SetParticleCutsList(0,recList);
+  manPos->SetParticleCutsList(1,recTPConlyList);
+  manPos->SetParticleCutsList(2,secList);
+  manPos->SetParticleCutsList(3,mcList);
+  manPos->SetParticleCutsList(4,recMCList);
+
+  AliCFManager* manNeg = new AliCFManager("manNeg","Manager for Negative tracks") ;
+  manNeg->SetParticleContainer(containerNeg);
+  manNeg->SetParticleCutsList(0,recList);
+  manNeg->SetParticleCutsList(1,recTPConlyList);
+  manNeg->SetParticleCutsList(2,secList);
+  manNeg->SetParticleCutsList(3,mcList);
+  manNeg->SetParticleCutsList(4,recMCList);
+
+
+  printf("Create task AliPWG4HighPtSpectra\n");
   AliPWG4HighPtSpectra *taskPWG4HighPtSpectra = new AliPWG4HighPtSpectra("taskPWG4HighPtSpectra");
   taskPWG4HighPtSpectra->SetCuts(trackCuts);
-  taskPWG4HighPtSpectra->SetCFManager(man); //here is set the CF manager
-  taskPWG4HighPtSpectra->SelectTrigger(AliAnalysisHelperJetTasks::kMB1); 
+  taskPWG4HighPtSpectra->SetCFManagerPos(manPos); //here is set the CF manager
+  taskPWG4HighPtSpectra->SetCFManagerNeg(manNeg); //here is set the CF manager
+
 
   // E. Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
@@ -122,14 +188,18 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//<some_parameters>)
 //  char *outputfile = "outputAliPWG4HighPtSpectraTestTrain.root";
   TString outputfile = AliAnalysisManager::GetCommonFileName();
   outputfile += ":PWG4_HighPtSpectra"; 
-  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0", TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0HighPtSpectra", TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0HighPtSpectra", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("ccontainer1HighPtSpectra", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+
+
   mgr->AddTask(taskPWG4HighPtSpectra);
 
   mgr->ConnectInput(taskPWG4HighPtSpectra,0,mgr->GetCommonInputContainer());
   mgr->ConnectOutput(taskPWG4HighPtSpectra,0,coutput0);
   mgr->ConnectOutput(taskPWG4HighPtSpectra,1,coutput1);
+  mgr->ConnectOutput(taskPWG4HighPtSpectra,2,coutput2);
+
 
   // Return task pointer at the end
   return taskPWG4HighPtSpectra;