new version from L.Milano and F.Prino
authorbhippoly <bhippoly@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Nov 2010 14:59:10 +0000 (14:59 +0000)
committerbhippoly <bhippoly@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Nov 2010 14:59:10 +0000 (14:59 +0000)
PWG2/SPECTRA/AliAnalysisTaskSEITSsaSpectra.cxx
PWG2/SPECTRA/AliAnalysisTaskSEITSsaSpectra.h
PWG2/SPECTRA/macros/AddTaskITSsaSpectra.C

index 1b3474c..37483a6 100644 (file)
@@ -42,6 +42,7 @@
 #include "AliMCEvent.h"
 #include "AliPhysicsSelection.h"
 #include "AliAnalysisTaskSEITSsaSpectra.h"
+#include "AliESDtrackCuts.h"
 
 ClassImp(AliAnalysisTaskSEITSsaSpectra)
 
@@ -51,7 +52,10 @@ AliAnalysisTaskSE("Task CFits"),
   fESD(0),
   fOutput(0),
   fHistNEvents(0),
+  fHistMult(0),
   fHistNTracks(0),
+  fHistNTracksPos(0),
+  fHistNTracksNeg(0),
   fHistDEDX(0),
   fHistDEDXdouble(0),
   fHistBeforeEvSel(0),
@@ -59,11 +63,13 @@ AliAnalysisTaskSE("Task CFits"),
   fMinSPDPts(1),
   fMinNdEdxSamples(3),
   fMindEdx(0.),
-  fMinNSigma(3.),
+  fMinNSigma(1.5),
   fMaxY(0.5),
-  fMaxChi2Clu(1.),
+  fMaxChi2Clu(2.5),
   fNSigmaDCAxy(7.),
   fNSigmaDCAz(7.),
+  fLowMult(0),
+  fUpMult(9999),
   fMC(kFALSE), 
   fSmearMC(kFALSE),
   fSmearP(0.),
@@ -211,16 +217,31 @@ void AliAnalysisTaskSEITSsaSpectra::UserCreateOutputObjects(){
   fOutput->SetOwner();
   fOutput->SetName("Spiderman");
   
-  fHistNEvents = new TH1F("fHistNEvents", "Number of processed events",6,0.5,6.5);
+  fHistNEvents = new TH1F("fHistNEvents", "Number of processed events",7,-0.5,6.5);
   fHistNEvents->Sumw2();
   fHistNEvents->SetMinimum(0);
   fOutput->Add(fHistNEvents);
   
+  fHistMult = new TH1F("fHistMult", "Event Multiplicity",1000,-0.5,999.5);
+  fHistMult->Sumw2();
+  fHistMult->SetMinimum(0);
+  fOutput->Add(fHistMult);
+  
   fHistNTracks = new TH1F("fHistNTracks", "Number of ITSsa tracks",20,0.5,20.5);
   fHistNTracks->Sumw2();
   fHistNTracks->SetMinimum(0);
   fOutput->Add(fHistNTracks);
   
+  fHistNTracksPos = new TH1F("fHistNTracksPos", "Number of positive ITSsa tracks",20,0.5,20.5);
+  fHistNTracksPos->Sumw2();
+  fHistNTracksPos->SetMinimum(0);
+  fOutput->Add(fHistNTracksPos);
+  
+  fHistNTracksNeg = new TH1F("fHistNTracksNeg", "Number of negative ITSsa tracks",20,0.5,20.5);
+  fHistNTracksNeg->Sumw2();
+  fHistNTracksNeg->SetMinimum(0);
+  fOutput->Add(fHistNTracksNeg);
+  
   //binning for the histogram
   const Int_t hnbins=400;
   Double_t hxmin = 0.01;
@@ -419,7 +440,7 @@ void AliAnalysisTaskSEITSsaSpectra::UserCreateOutputObjects(){
 
   }
   
-  fNtupleNSigma = new TNtuple("fNtupleNSigma","fNtupleNSigma","p:pt:dedx:ncls:sign:run:eta:impactXY:impactZ:isph:pdgcode:mfl");
+  fNtupleNSigma = new TNtuple("fNtupleNSigma","fNtupleNSigma","p:pt:dedx:ncls:sign:run:eta:impactXY:impactZ:isph:pdgcode:mfl:chi2ncls");
   fOutput->Add(fNtupleNSigma);
   fNtupleMC = new TNtuple("fNtupleMC","fNtupleMC","ptMC:pdgcode:signMC:etaMC:yMC:isph:evSel:run");
   fOutput->Add(fNtupleMC);
@@ -437,8 +458,31 @@ void AliAnalysisTaskSEITSsaSpectra::UserExec(Option_t *){
     printf("AliAnalysisTaskSDDRP::Exec(): bad ESD\n");
     return;
   } 
+  fHistNEvents->Fill(0);
+
+  //selection on the event multiplicity
+  AliESDtrackCuts* esdTrackCutsMult = new AliESDtrackCuts;
+  // TPC  
+  esdTrackCutsMult->SetMinNClustersTPC(70);
+  esdTrackCutsMult->SetMaxChi2PerClusterTPC(4);
+  esdTrackCutsMult->SetAcceptKinkDaughters(kFALSE);
+  esdTrackCutsMult->SetRequireTPCRefit(kTRUE);
+  // ITS
+  esdTrackCutsMult->SetRequireITSRefit(kTRUE);
+  esdTrackCutsMult->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                            AliESDtrackCuts::kAny);
+  esdTrackCutsMult->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/TMath::Power(pt,0.9)");  
+  esdTrackCutsMult->SetMaxDCAToVertexZ(20);
+  esdTrackCutsMult->SetDCAToVertex2D(kFALSE);
+  esdTrackCutsMult->SetRequireSigmaToVertex(kFALSE);
+  esdTrackCutsMult->SetEtaRange(-0.8,+0.8);
+  esdTrackCutsMult->SetPtRange(0.15, 1e10);
+  
+  Int_t multiplicity = esdTrackCutsMult->CountAcceptedTracks(fESD);
+  if(multiplicity < fLowMult || multiplicity > fUpMult)return;
+  Printf("Multiplicity of the event: %i\n",multiplicity);
   
-  //binning for the dEdx distributions
+  fHistMult->Fill(multiplicity);
 
   //variables
   Float_t pdgmass[4]={0.13957,0.493677,0.938272,1.8756}; //mass for pi, K, P (Gev/c^2)
@@ -598,39 +642,120 @@ void AliAnalysisTaskSEITSsaSpectra::UserExec(Option_t *){
     if (!track) continue;
     
     //track selection
-    fHistNTracks->Fill(1);
+    Int_t countBinTrk=1;
+    TString label;
+    
+    label="no selection";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
+    
     status=track->GetStatus();
     if((status&AliESDtrack::kITSpureSA)==0) continue; //its standalone
-    fHistNTracks->Fill(2);
+  
+    label="ITSsa";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;    
+    
     if((status&AliESDtrack::kITSrefit)==0) continue; //its refit
-    fHistNTracks->Fill(3);
+    
+    label="ITSrefit";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;
+    
     if(TMath::Abs(track->GetSign())<0.0001) continue; //no neutral particles
-    fHistNTracks->Fill(4);
+    
+    label="neutral particle";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
     
     //cluster in ITS
     UInt_t clumap = track->GetITSClusterMap();
     Int_t nSPD=0;
     for(Int_t il=0; il<2; il++) if(TESTBIT(clumap,il)) nSPD++;
     if(nSPD<fMinSPDPts) continue;
-    fHistNTracks->Fill(5);
+    
+    label="SPDcls";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
+    
     Int_t count=0;
     for(Int_t j=2;j<6;j++) if(TESTBIT(clumap,j)) count++;
     if(count<fMinNdEdxSamples) continue; //at least 3 points on SSD/SDD
-    fHistNTracks->Fill(6);
+    
+    label="SDD+SSD cls";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
+    
     //chisquare/nclusters      
     Int_t nclu=nSPD+count;
     if(track->GetITSchi2()/nclu > fMaxChi2Clu) continue; 
-    fHistNTracks->Fill(7);
+    
+    label="chi2/ncls";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
+    
     //pseudorapidity and rapidity
     if(TMath::Abs(track->Eta()) > 0.9) continue;
-    fHistNTracks->Fill(8);
+    
+    label="eta";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
+    
     //truncated mean
     //if(fMC) for(Int_t j=0;j<2;j++) s[j]*=3.34/5.43;//correction for SDD miscalibration of the MCpass4
     track->GetITSdEdxSamples(s);
     Double_t dedx = CookdEdx(s);
     if(dedx<0) continue;
-    fHistNTracks->Fill(9);
 
+    label="de/dx<0";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
+    
     Float_t pt = track->Pt();
     Int_t theBin=-1;
     for(Int_t m=0; m<kNbins; m++){
@@ -701,7 +826,7 @@ void AliAnalysisTaskSEITSsaSpectra::UserExec(Option_t *){
        }
       }
     }
-  Float_t xnt[12];
+  Float_t xnt[13];
     Int_t index=0;
     xnt[index++]=(Float_t)track->GetP();
     xnt[index++]=(Float_t)track->Pt();
@@ -714,7 +839,8 @@ void AliAnalysisTaskSEITSsaSpectra::UserExec(Option_t *){
     xnt[index++]=(Float_t)impactZ;
     xnt[index++]=(Float_t)isph;
     xnt[index++]=(Float_t)code;
-    xnt[index]=(Float_t)mfl;
+    xnt[index++]=(Float_t)mfl;
+    xnt[index]=(Float_t)track->GetITSchi2()/nclu;
          
     if(fFillNtuple) fNtupleNSigma->Fill(xnt);
     
@@ -787,13 +913,17 @@ void AliAnalysisTaskSEITSsaSpectra::UserExec(Option_t *){
       } 
     }
     
-    if(track->GetSign()>0)fHistNTracks->Fill(11);
-    if(track->GetSign()<0)fHistNTracks->Fill(12);
     //DCA cut on xy and z
     if(!DCAcut(impactXY,impactZ,pt,fMC)) continue;
-    fHistNTracks->Fill(10);
-    if(track->GetSign()>0)fHistNTracks->Fill(13);
-    if(track->GetSign()<0)fHistNTracks->Fill(14);
+    
+    label="DCA";
+    fHistNTracks->Fill(countBinTrk);
+    if(track->GetSign()>0)fHistNTracksPos->Fill(countBinTrk);
+    if(track->GetSign()<0)fHistNTracksNeg->Fill(countBinTrk);
+    fHistNTracks->GetXaxis()->SetBinLabel(fHistNTracks->FindBin(countBinTrk),label.Data());
+    fHistNTracksPos->GetXaxis()->SetBinLabel(fHistNTracksPos->FindBin(countBinTrk),label.Data());
+    fHistNTracksNeg->GetXaxis()->SetBinLabel(fHistNTracksNeg->FindBin(countBinTrk),label.Data());
+    countBinTrk++;  
     
     //Filling Histos for Reco Efficiency
     //information from the MC kinematics
@@ -937,7 +1067,10 @@ void AliAnalysisTaskSEITSsaSpectra::Terminate(Option_t *) {
     return;
   } 
   fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
+  fHistMult = dynamic_cast<TH1F*>(fOutput->FindObject("fHistMult"));
   fHistNTracks = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNTracks"));
+  fHistNTracksPos = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNTracksPos"));
+  fHistNTracksNeg = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNTracksNeg"));
   fHistDEDX = dynamic_cast<TH2F*>(fOutput->FindObject("fHistDEDX"));
   fHistDEDXdouble = dynamic_cast<TH2F*>(fOutput->FindObject("fHistDEDXdouble"));
 
index 2f5ed45..79fbbec 100644 (file)
@@ -31,13 +31,13 @@ class AliAnalysisTaskSEITSsaSpectra : public AliAnalysisTaskSE {
   virtual void   UserExec(Option_t *);
   virtual void   Terminate(Option_t *);
 
-  void SetMaxChi2Clu(Double_t chi=1.){
+  void SetMaxChi2Clu(Double_t chi=2.5){
     fMaxChi2Clu=chi;
   }
   void SetRapidityRange(Double_t dy=0.5){
     fMaxY=dy;
   }
-  void SetMinNSigma(Double_t ns=3.){
+  void SetMinNSigma(Double_t ns=1.5){
     fMinNSigma=ns;
   }
   void SetMindEdx(Double_t mind=0.){
@@ -53,6 +53,10 @@ class AliAnalysisTaskSEITSsaSpectra : public AliAnalysisTaskSE {
     fNSigmaDCAxy=nsxy;
     fNSigmaDCAz=nsz; 
   }
+  void SetMultBin(Int_t LowBin=0,Int_t UpBin=9999){
+    fLowMult=LowBin;
+    fUpMult=UpBin;
+  }
 
   void SetReadMC(Bool_t flag = kTRUE) {fMC = flag;}
   void SetFillNtuple(Bool_t fill=kTRUE) {fFillNtuple=fill;}
@@ -75,7 +79,10 @@ class AliAnalysisTaskSEITSsaSpectra : public AliAnalysisTaskSE {
   AliESDEvent *fESD; //ESD object
   TList *fOutput; //! tlist with output
   TH1F *fHistNEvents; //! histo with number of events
+  TH1F *fHistMult; //! histo with multiplicity of the events
   TH1F *fHistNTracks; //! histo with number of tracks
+  TH1F *fHistNTracksPos; //! histo with number of tracks
+  TH1F *fHistNTracksNeg; //! histo with number of tracks
   
   TH2F *fHistDEDX; //! histo with dedx versus momentum
   TH2F *fHistDEDXdouble; //! histo with dedx versus signed momentum
@@ -173,7 +180,9 @@ class AliAnalysisTaskSEITSsaSpectra : public AliAnalysisTaskSE {
   Double_t fMaxChi2Clu;      // maximum cluster
   Double_t fNSigmaDCAxy;     // DCA cut in bend. plane
   Double_t fNSigmaDCAz;      // DCA cut along z
-
+  Int_t fLowMult;      // Multiplicity bin
+  Int_t fUpMult;      // Multiplicity bin
   Bool_t   fMC;        //flag to switch on the MC analysis for the efficiency estimation
   Bool_t   fSmearMC;   // flag to apply extra smearing on MC 
   Double_t fSmearP;    // extra relative smearing on simulated momentum
index 2f33a20..69ddf44 100644 (file)
@@ -1,5 +1,5 @@
-AliAnalysisTaskSEITSsaSpectra *AddTaskITSsaSpectra(Bool_t optNtuple=kFALSE){
-       // Creates, configures and attaches to the train the task for pi, K , spectra
+AliAnalysisTaskSEITSsaSpectra *AddTaskITSsaSpectra(Bool_t optNtuple=kFALSE,Bool_t readMC=kFALSE,Int_t LowMult=0,Int_t UpMult=9999){
+       // Creates, configures and attaches to the train the task for pi, K , p spectra
        // with ITS standalone tracks
        // Get the pointer to the existing analysis manager via the static access method.
        //==============================================================================
@@ -22,14 +22,22 @@ AliAnalysisTaskSEITSsaSpectra *AddTaskITSsaSpectra(Bool_t optNtuple=kFALSE){
                return NULL;
        }
 
-       Bool_t isMC=kFALSE;
-       if (mgr->GetMCtruthEventHandler()) isMC=kTRUE;
+       //Bool_t isMC=kFALSE;
+       //if (mgr->GetMCtruthEventHandler()) isMC=kTRUE;
 
+       // Add MC handler (for kinematics)
+       if(readMC){
+               AliMCEventHandler* handler = new AliMCEventHandler;
+               handler->SetReadTR(kFALSE);
+               mgr->SetMCtruthEventHandler(handler);
+       }
        // Create and configure the task
        AliAnalysisTaskSEITSsaSpectra *taskits = new AliAnalysisTaskSEITSsaSpectra();
        taskits->SelectCollisionCandidates();
-       taskits->SetReadMC(isMC);
+       taskits->SetReadMC(readMC);
        taskits->SetFillNtuple(optNtuple);
+       taskits->SetMultBin(LowMult,UpMult);
+       
        mgr->AddTask(taskits);
 
        // Create ONLY the output containers for the data produced by the task.
@@ -38,7 +46,7 @@ AliAnalysisTaskSEITSsaSpectra *AddTaskITSsaSpectra(Bool_t optNtuple=kFALSE){
        TString outputFileName = AliAnalysisManager::GetCommonFileName();
        outputFileName += ":PWG2SpectraITSsa";
 
-       AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clistITSsa",
+       AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("clistITSsaMult%ito%i",LowMult,UpMult),
                        TList::Class(),
                        AliAnalysisManager::kOutputContainer,
                        outputFileName );