updated histos for monte carlo info
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Jan 2009 16:27:25 +0000 (16:27 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Jan 2009 16:27:25 +0000 (16:27 +0000)
PWG2/FLOW/AliAnalysisTaskMCEventPlane.cxx
PWG2/FLOW/AliFlowAnalysisWithMCEventPlane.cxx
PWG2/FLOW/AliFlowAnalysisWithMCEventPlane.h

index 39e3447..417eb92 100644 (file)
@@ -322,7 +322,7 @@ void AliAnalysisTaskMCEventPlane::Terminate(Option_t *)
 
   //Get output data
   fListHistos = (TList*)GetOutputData(0);
-  cout << "histgram list in Terminate" << endl;
+  cout << "histogram list in Terminate" << endl;
   if (fListHistos) {
     //Get the common histograms from the output list
     AliFlowCommonHist *pCommonHists = dynamic_cast<AliFlowCommonHist*> 
@@ -334,10 +334,30 @@ void AliAnalysisTaskMCEventPlane::Terminate(Option_t *)
     TProfile *pHistProFlow = dynamic_cast<TProfile*> 
       (fListHistos->FindObject("FlowPro_VPt_MCEP"));
 
-    if (pCommonHists && pCommonHistResults && pHistProFlow) {
+    TProfile *pHistProIntFlowRP = dynamic_cast<TProfile*> 
+      (fListHistos->FindObject("fHistProIntFlowRP")); 
+                               
+    TProfile *pHistProDiffFlowPtRP = dynamic_cast<TProfile*> 
+      (fListHistos->FindObject("fHistProDiffFlowPtRP")); 
+     
+    TProfile *pHistProDiffFlowEtaRP = dynamic_cast<TProfile*> 
+      (fListHistos->FindObject("fHistProDiffFlowEtaRP"));
+      
+    TProfile *pHistProDiffFlowPtPOI = dynamic_cast<TProfile*> 
+      (fListHistos->FindObject("fHistProDiffFlowPtPOI")); 
+     
+    TProfile *pHistProDiffFlowEtaPOI = dynamic_cast<TProfile*> 
+      (fListHistos->FindObject("fHistProDiffFlowEtaPOI"));                             
+
+    if (pCommonHists && pCommonHistResults && pHistProFlow && pHistProIntFlowRP && pHistProDiffFlowPtRP && pHistProDiffFlowEtaRP && pHistProDiffFlowPtPOI && pHistProDiffFlowEtaPOI) {
       fMcTerm->SetCommonHists(pCommonHists);
       fMcTerm->SetCommonHistsRes(pCommonHistResults);
       fMcTerm->SetHistProFlow(pHistProFlow);
+      fMcTerm->SetHistProIntFlowRP(pHistProIntFlowRP);
+      fMcTerm->SetHistProDiffFlowPtRP(pHistProDiffFlowPtRP);      
+      fMcTerm->SetHistProDiffFlowEtaRP(pHistProDiffFlowEtaRP);  
+      fMcTerm->SetHistProDiffFlowPtPOI(pHistProDiffFlowPtPOI);      
+      fMcTerm->SetHistProDiffFlowEtaPOI(pHistProDiffFlowEtaPOI);          
       fMcTerm->Finish();
       PostData(0,fListHistos);
     } else {
index 06cdfc3..351d6b5 100644 (file)
@@ -51,8 +51,12 @@ ClassImp(AliFlowAnalysisWithMCEventPlane)
    fCommonHists(NULL),
    fCommonHistsRes(NULL),
    fHistProFlow(NULL),
-   fHistRP(NULL)
-
+   fHistRP(NULL),
+   fHistProIntFlowRP(NULL),
+   fHistProDiffFlowPtRP(NULL),
+   fHistProDiffFlowEtaRP(NULL),
+   fHistProDiffFlowPtPOI(NULL),
+   fHistProDiffFlowEtaPOI(NULL)
 {
 
   // Constructor.
@@ -89,8 +93,12 @@ void AliFlowAnalysisWithMCEventPlane::Init() {
   cout<<"---Analysis with the real MC Event Plane---"<<endl;
 
   Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
-  Double_t  dPtMin = AliFlowCommonConstants::GetPtMin();            
-  Double_t  dPtMax = AliFlowCommonConstants::GetPtMax();
+  Double_t dPtMin = AliFlowCommonConstants::GetPtMin();             
+  Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
+  
+  Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta();
+  Double_t dEtaMin = AliFlowCommonConstants::GetEtaMin();           
+  Double_t dEtaMax = AliFlowCommonConstants::GetEtaMax();  
 
   fCommonHists = new AliFlowCommonHist("AliFlowCommonHistMCEP");
   fHistList->Add(fCommonHists);
@@ -98,15 +106,40 @@ void AliFlowAnalysisWithMCEventPlane::Init() {
   fHistList->Add(fCommonHistsRes);
   
   fHistProFlow = new TProfile("FlowPro_VPt_MCEP","FlowPro_VPt_MCEP",iNbinsPt,dPtMin,dPtMax);
-  fHistProFlow->SetXTitle("Pt");
-  fHistProFlow->SetYTitle("v2 (%)");
+  fHistProFlow->SetXTitle("P_{t}");
+  fHistProFlow->SetYTitle("v_{2}");
   fHistList->Add(fHistProFlow);
 
   fHistRP = new TH1F("Flow_RP_MCEP","Flow_RP_MCEP",100,0.,3.14);
   fHistRP->SetXTitle("Reaction Plane Angle");
   fHistRP->SetYTitle("Counts");
   fHistList->Add(fHistRP);
-
+  
+  fHistProIntFlowRP = new TProfile("fHistProIntFlowRP","fHistProIntFlowRP",1,0.,1.);
+  fHistProIntFlowRP->SetLabelSize(0.06);
+  (fHistProIntFlowRP->GetXaxis())->SetBinLabel(1,"v_{n}{2}");
+  fHistProIntFlowRP->SetYTitle("");
+  fHistList->Add(fHistProIntFlowRP);
+  fHistProDiffFlowPtRP = new TProfile("fHistProDiffFlowPtRP","fHistProDiffFlowPtRP",iNbinsPt,dPtMin,dPtMax);
+  fHistProDiffFlowPtRP->SetXTitle("P_{t}");
+  fHistProDiffFlowPtRP->SetYTitle("");
+  fHistList->Add(fHistProDiffFlowPtRP);  
+  
+  fHistProDiffFlowEtaRP = new TProfile("fHistProDiffFlowEtaRP","fHistProDiffFlowEtaRP",iNbinsEta,dEtaMin,dEtaMax);
+  fHistProDiffFlowEtaRP->SetXTitle("#eta");
+  fHistProDiffFlowEtaRP->SetYTitle("");
+  fHistList->Add(fHistProDiffFlowEtaRP);
+  
+  fHistProDiffFlowPtPOI = new TProfile("fHistProDiffFlowPtPOI","fHistProDiffFlowPtPOI",iNbinsPt,dPtMin,dPtMax);
+  fHistProDiffFlowPtPOI->SetXTitle("P_{t}");
+  fHistProDiffFlowPtPOI->SetYTitle("");
+  fHistList->Add(fHistProDiffFlowPtPOI);  
+  
+  fHistProDiffFlowEtaPOI = new TProfile("fHistProDiffFlowEtaPOI","fHistProDiffFlowEtaPOI",iNbinsEta,dEtaMin,dEtaMax);
+  fHistProDiffFlowEtaPOI->SetXTitle("#eta");
+  fHistProDiffFlowEtaPOI->SetYTitle("");
+  fHistList->Add(fHistProDiffFlowEtaPOI);          
  
   fEventNumber = 0;  //set number of events to zero
       
@@ -132,7 +165,13 @@ void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent, Double_t
     //cout<<"fQ2sum = "<<fQ2sum<<endl;
         
     fHistRP->Fill(aRP);   
-              
+    
+    Double_t dPhi = 0.;
+    Double_t dv2  = 0.;
+    Double_t dPt  = 0.;
+    Double_t dEta = 0.;
+    //Double_t dPi = TMath::Pi();                   
+                                                             
     //calculate flow
     //loop over the tracks of the event
     Int_t iNumberOfTracks = anEvent->NumberOfTracks(); 
@@ -140,15 +179,32 @@ void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent, Double_t
       {
        AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ; 
        if (pTrack){
+         if (pTrack->UseForIntegratedFlow()){
+            dPhi = pTrack->Phi();
+            dv2 = TMath::Cos(2*(dPhi-aRP));
+           dPt = pTrack->Pt();
+           dEta = pTrack->Eta();
+            //integrated flow (RP):
+            fHistProIntFlowRP->Fill(0.,dv2);
+            //differential flow (Pt, RP):
+            fHistProDiffFlowPtRP->Fill(dPt,dv2,1.);
+            //differential flow (Eta, RP):
+            fHistProDiffFlowEtaRP->Fill(dEta,dv2,1.);
+          }
          if (pTrack->UseForDifferentialFlow()) {
-           Double_t dPhi = pTrack->Phi();
+           dPhi = pTrack->Phi();
            //if (dPhi<0.) dPhi+=2*TMath::Pi();
            //calculate flow v2:
-           Double_t dv2 = TMath::Cos(2*(dPhi-aRP));
-           Double_t dPt = pTrack->Pt();
+           dv2 = TMath::Cos(2*(dPhi-aRP));
+           dPt = pTrack->Pt();
+           dEta = pTrack->Eta();
            //fill histogram
-           fHistProFlow->Fill(dPt,dv2);  
-         }  
+           fHistProFlow->Fill(dPt,dv2);//to be removed 
+           //differential flow (Pt, POI):
+            fHistProDiffFlowPtPOI->Fill(dPt,dv2,1.);
+            //differential flow (Eta, POI):
+            fHistProDiffFlowEtaPOI->Fill(dEta,dv2,1.); 
+         }           
        }//track selected
       }//loop over tracks
          
@@ -162,39 +218,84 @@ void AliFlowAnalysisWithMCEventPlane::Finish() {
    
   //*************make histograms etc. 
   if (fDebug) cout<<"AliFlowAnalysisWithMCEventPlane::Terminate()"<<endl;
-     
-  Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
    
-  
+  Int_t iNbinsPt  = AliFlowCommonConstants::GetNbinsPt();  
+  Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta(); 
+         
+  //RP:
+  //integrated flow:
+  Double_t dVRP = fHistProIntFlowRP->GetBinContent(1);  
+  Double_t dErrVRP = fHistProIntFlowRP->GetBinError(1);  
+  fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrVRP);
+  //differential flow (Pt): 
+  Double_t dvPtRP = 0.;           
+  Double_t dErrvPtRP = 0.;
+  for(Int_t b=0;b<iNbinsPt;b++)
+  {
+   dvPtRP    = fHistProDiffFlowPtRP->GetBinContent(b+1);
+   dErrvPtRP = fHistProDiffFlowPtRP->GetBinError(b+1);
+   fCommonHistsRes->FillDifferentialFlowPtRP(b, dvPtRP , dErrvPtRP);
+  }
+  //differential flow (Eta): 
+  Double_t dvEtaRP = 0.;           
+  Double_t dErrvEtaRP = 0.;
+  for(Int_t b=0;b<iNbinsEta;b++)
+  {
+   dvEtaRP    = fHistProDiffFlowEtaRP->GetBinContent(b+1);
+   dErrvEtaRP = fHistProDiffFlowEtaRP->GetBinError(b+1);
+   fCommonHistsRes->FillDifferentialFlowEtaRP(b, dvEtaRP , dErrvEtaRP);
+  }
+                                                                                                                                   
+  //POI:
   TH1F* fHistPtDiff = fCommonHists->GetHistPtDiff();
   Double_t dV = 0.;
   Double_t dErrV = 0.;
   Double_t dSum = 0.;
-  for(Int_t b=0;b<iNbinsPt;b++){
-    Double_t dv2pro = 0.;
-    Double_t dErrdifcomb = 0.; 
-    if(fHistProFlow) {
-      dv2pro = fHistProFlow->GetBinContent(b);
-      dErrdifcomb = fHistProFlow->GetBinError(b); //in case error from profile is correct
+  Double_t dv2proPt = 0.;
+  Double_t dErrdifcombPt = 0.; 
+  Double_t dv2proEta = 0.;
+  Double_t dErrdifcombEta = 0.;   
+  //Pt:
+  if(fHistProFlow && fHistProDiffFlowPtPOI) {//to be removed (fHistProFlow)
+    for(Int_t b=0;b<iNbinsPt;b++){
+      //dv2pro = fHistProFlow->GetBinContent(b);//to be removed
+      //dErrdifcomb = fHistProFlow->GetBinError(b);//to be removed
+      dv2proPt = fHistProDiffFlowPtPOI->GetBinContent(b);
+      dErrdifcombPt = fHistProDiffFlowPtPOI->GetBinError(b); //in case error from profile is correct
       //fill TH1D
-      fCommonHistsRes->FillDifferentialFlow(b, dv2pro, dErrdifcomb); 
+      fCommonHistsRes->FillDifferentialFlow(b, dv2proPt, dErrdifcombPt);//to be removed
+      fCommonHistsRes->FillDifferentialFlowPtPOI(b, dv2proPt, dErrdifcombPt); 
       if (fHistPtDiff){
        //integrated flow
        Double_t dYield = fHistPtDiff->GetBinContent(b);
-       dV += dv2pro*dYield ;
+       dV += dv2proPt*dYield ;
        dSum += dYield;
        //error on integrated flow
-       dErrV += dYield*dYield*dErrdifcomb*dErrdifcomb;
+       dErrV += dYield*dYield*dErrdifcombPt*dErrdifcombPt;
       }
-    } else { cout<<"fHistProFlow is NULL"<<endl; }
-  }
+    }  
+  } else { cout<<"fHistProFlow is NULL"<<endl; }
   if (dSum != 0. ) {
     dV /= dSum;  //because pt distribution should be normalised
     dErrV /= dSum*dSum;
     dErrV = TMath::Sqrt(dErrV); }
   cout<<"dV is "<<dV<<" +- "<<dErrV<<endl;
-  fCommonHistsRes->FillIntegratedFlow(dV,dErrV); 
-         
+  fCommonHistsRes->FillIntegratedFlow(dV,dErrV);//to be removed 
+  fCommonHistsRes->FillIntegratedFlowPOI(dV,dErrV);
+  
+  
+  //Eta:
+  if(fHistProDiffFlowEtaPOI)
+  {
+   for(Int_t b=0;b<iNbinsEta;b++)
+   {
+    dv2proEta = fHistProDiffFlowEtaPOI->GetBinContent(b);
+    dErrdifcombEta = fHistProDiffFlowEtaPOI->GetBinError(b); //in case error from profile is correct
+    //fill common hist results:
+    fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dv2proEta, dErrdifcombEta); 
+   }
+  }
+                         
   cout<<".....finished"<<endl;
 }
 
index f541e85..8f3c957 100644 (file)
@@ -4,8 +4,8 @@
 /* $Id$ */
 
 
-#ifndef AliFlowAnalysisWithMCEventPlane_H
-#define AliFlowAnalysisWithMCEventPlane_H
+#ifndef ALIFLOWANALYSISWITHMCEVENTPLANE_H
+#define ALIFLOWANALYSISWITHMCEVENTPLANE_H
 
 #include "TVector2.h"          //called explicitly
 #include "AliFlowVector.h"
@@ -66,6 +66,21 @@ class AliFlowAnalysisWithMCEventPlane {
      {this->fHistProFlow = aHistProFlow; }
    TH1F*     GetHistRP()                  {return this->fHistRP; } 
    void      SetHistRP(TH1F* aHistRP)     {this->fHistRP = aHistRP; }
+   
+   TProfile* GetHistProIntFlowRP()                            {return this->fHistProIntFlowRP; } 
+   void      SetHistProIntFlowRP(TProfile* aHistProIntFlowRP) {this->fHistProIntFlowRP = aHistProIntFlowRP; }
+   
+   TProfile* GetHistProDiffFlowPtRP()                               {return this->fHistProDiffFlowPtRP; } 
+   void      SetHistProDiffFlowPtRP(TProfile* aHistProDiffFlowPtRP) {this->fHistProDiffFlowPtRP = aHistProDiffFlowPtRP; } 
+   
+   TProfile* GetHistProDiffFlowEtaRP()                                {return this->fHistProDiffFlowEtaRP; } 
+   void      SetHistProDiffFlowEtaRP(TProfile* aHistProDiffFlowEtaRP) {this->fHistProDiffFlowEtaRP = aHistProDiffFlowEtaRP; } 
+   
+   TProfile* GetHistProDiffFlowPtPOI()                               {return this->fHistProDiffFlowPtPOI; } 
+   void      SetHistProDiffFlowPtPOI(TProfile* aHistProDiffFlowPtPOI) {this->fHistProDiffFlowPtPOI = aHistProDiffFlowPtPOI; } 
+   
+   TProfile* GetHistProDiffFlowEtaPOI()                                {return this->fHistProDiffFlowEtaPOI; } 
+   void      SetHistProDiffFlowEtaPOI(TProfile* aHistProDiffFlowEtaPOI) {this->fHistProDiffFlowEtaPOI = aHistProDiffFlowEtaPOI; }    
 
  private:
  
@@ -88,7 +103,14 @@ class AliFlowAnalysisWithMCEventPlane {
 
    TProfile*    fHistProFlow;       //
    TH1F*        fHistRP;            //
-
+   
+   TProfile*    fHistProIntFlowRP;     //profile used to calculate the integrated flow of RP particles
+   TProfile*    fHistProDiffFlowPtRP;  //profile used to calculate the differential flow (Pt) of RP particles 
+   TProfile*    fHistProDiffFlowEtaRP; //profile used to calculate the differential flow (Eta) of RP particles 
+   
+   TProfile*    fHistProDiffFlowPtPOI;  //profile used to calculate the differential flow (Pt) of POI particles 
+   TProfile*    fHistProDiffFlowEtaPOI; //profile used to calculate the differential flow (Eta) of POI particles    
+   
    ClassDef(AliFlowAnalysisWithMCEventPlane,1)  // macro for rootcint
      };