new class Salvatore
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Sep 2012 18:11:24 +0000 (18:11 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Sep 2012 18:11:24 +0000 (18:11 +0000)
PWGJE/EMCALJetTasks/AliAnalysisTaskRhoFlow.cxx [new file with mode: 0644]
PWGJE/EMCALJetTasks/AliAnalysisTaskRhoFlow.h [new file with mode: 0644]

diff --git a/PWGJE/EMCALJetTasks/AliAnalysisTaskRhoFlow.cxx b/PWGJE/EMCALJetTasks/AliAnalysisTaskRhoFlow.cxx
new file mode 100644 (file)
index 0000000..8de4aa3
--- /dev/null
@@ -0,0 +1,183 @@
+// $Id: AliAnalysisTaskRhoFlow.cxx  $
+//
+// Calculation of rho for flow bias studies
+//
+// Author: S.Aiola
+
+#include "AliAnalysisTaskRhoFlow.h"
+
+#include <TClonesArray.h>
+#include <TMath.h>
+#include <TH2F.h>
+
+#include "AliVTrack.h"
+#include "AliLog.h"
+#include "AliRhoParameter.h"
+
+ClassImp(AliAnalysisTaskRhoFlow)
+
+//________________________________________________________________________
+AliAnalysisTaskRhoFlow::AliAnalysisTaskRhoFlow() : 
+  AliAnalysisTaskRho("AliAnalysisTaskRhoFlow",kTRUE),
+  fRhoNearSide(0),
+  fRhoAwaySide(0),
+  fRhoPerpSide1(0),
+  fRhoPerpSide2(0),
+  fHistRhoNearVsCent(0),
+  fHistDeltaRhoNearVsCent(0),
+  fHistRhoAwayVsCent(0),
+  fHistDeltaRhoAwayVsCent(0),
+  fHistRhoPerp1VsCent(0),
+  fHistDeltaRhoPerp1VsCent(0),
+  fHistRhoPerp2VsCent(0),
+  fHistDeltaRhoPerp2VsCent(0)
+{
+  // Constructor.
+  SetAttachToEvent(kFALSE);
+}
+
+//________________________________________________________________________
+AliAnalysisTaskRhoFlow::AliAnalysisTaskRhoFlow(const char *name) :
+  AliAnalysisTaskRho(name, kTRUE),
+  fRhoNearSide(0),
+  fRhoAwaySide(0),
+  fRhoPerpSide1(0),
+  fRhoPerpSide2(0),
+  fHistRhoNearVsCent(0),
+  fHistDeltaRhoNearVsCent(0),
+  fHistRhoAwayVsCent(0),
+  fHistDeltaRhoAwayVsCent(0),
+  fHistRhoPerp1VsCent(0),
+  fHistDeltaRhoPerp1VsCent(0),
+  fHistRhoPerp2VsCent(0),
+  fHistDeltaRhoPerp2VsCent(0)
+{
+  // Constructor.
+  SetAttachToEvent(kFALSE);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskRhoFlow::UserCreateOutputObjects()
+{
+  // User create output objects, called at the beginning of the analysis.
+
+  AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
+
+  fHistRhoNearVsCent = new TH2F("RhoNearVsCent", "RhoNearVsCent", 101, -1,  100, fNbins, fMinBinPt, fMaxBinPt*2);
+  fOutput->Add(fHistRhoNearVsCent);
+
+  fHistRhoAwayVsCent = new TH2F("RhoAwayVsCent", "RhoAwayVsCent", 101, -1,  100, fNbins, fMinBinPt, fMaxBinPt*2);
+  fOutput->Add(fHistRhoAwayVsCent);
+
+  fHistRhoPerp1VsCent = new TH2F("RhoPerp1VsCent", "RhoPerp1VsCent", 101, -1,  100, fNbins, fMinBinPt, fMaxBinPt*2);
+  fOutput->Add(fHistRhoPerp1VsCent);
+
+  fHistRhoPerp2VsCent = new TH2F("RhoPerp2VsCent", "RhoPerp2VsCent", 101, -1,  100, fNbins, fMinBinPt, fMaxBinPt*2);
+  fOutput->Add(fHistRhoPerp2VsCent);
+
+  if (!fCompareRhoName.IsNull()) {
+    fHistDeltaRhoNearVsCent = new TH2F("DeltaRhoNearVsCent", "DeltaRhoNearVsCent", 101, -1, 100, fNbins, -fMaxBinPt, fMaxBinPt);
+    fOutput->Add(fHistDeltaRhoNearVsCent);
+
+    fHistDeltaRhoAwayVsCent = new TH2F("DeltaRhoAwayVsCent", "DeltaRhoAwayVsCent", 101, -1, 100, fNbins, -fMaxBinPt, fMaxBinPt);
+    fOutput->Add(fHistDeltaRhoAwayVsCent);
+    
+    fHistDeltaRhoPerp1VsCent = new TH2F("DeltaRhoPerp1VsCent", "DeltaRhoPerp1VsCent", 101, -1, 100, fNbins, -fMaxBinPt, fMaxBinPt);
+    fOutput->Add(fHistDeltaRhoPerp1VsCent);
+
+    fHistDeltaRhoPerp2VsCent = new TH2F("DeltaRhoPerp2VsCent", "DeltaRhoPerp2VsCent", 101, -1, 100, fNbins, -fMaxBinPt, fMaxBinPt);
+    fOutput->Add(fHistDeltaRhoPerp2VsCent);
+  }
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskRhoFlow::Run() 
+{
+  if (!fTracks)
+    return kFALSE;
+  
+  Double_t maxTrackPhi = -1;
+  Double_t maxTrackPt  = 0;
+
+  for (Int_t i = 0; i < fTracks->GetEntriesFast(); i++) {
+    AliVTrack *track = static_cast<AliVTrack*>(fTracks->At(i));
+    if (!track)
+      continue;
+    if (!AcceptTrack(track))
+      continue;
+
+    if (track->Pt() > maxTrackPt) {
+      maxTrackPt  = track->Pt();
+      maxTrackPhi = track->Phi();
+    }
+  }
+
+  Double_t minPhi = -1;
+  Double_t maxPhi = -1;
+
+  // away side
+  minPhi = maxTrackPhi + TMath::Pi() - TMath::Pi()/4 + fJetRadius;
+  maxPhi = maxTrackPhi + TMath::Pi() + TMath::Pi()/4 + fJetRadius;
+  if (maxPhi > TMath::Pi() * 2) {
+    minPhi -= TMath::Pi() * 2;
+    maxPhi -= TMath::Pi() * 2;
+  }
+  SetJetPhiLimits(minPhi, maxPhi);  
+  AliAnalysisTaskRho::Run();
+  fRhoAwaySide = fRho->GetVal();
+
+  // perp 1 side
+  minPhi = maxTrackPhi + TMath::Pi()/2 - TMath::Pi()/4 + fJetRadius;
+  maxPhi = maxTrackPhi + TMath::Pi()/2 + TMath::Pi()/4 + fJetRadius;
+  if (maxPhi > TMath::Pi() * 2) {
+    minPhi -= TMath::Pi() * 2;
+    maxPhi -= TMath::Pi() * 2;
+  }
+  SetJetPhiLimits(minPhi, maxPhi);  
+  AliAnalysisTaskRho::Run();
+  fRhoPerpSide1 = fRho->GetVal();
+
+  // perp 2 side
+  minPhi = maxTrackPhi - TMath::Pi()/2 - TMath::Pi()/4 + fJetRadius;
+  maxPhi = maxTrackPhi - TMath::Pi()/2 + TMath::Pi()/4 + fJetRadius;
+  if (maxPhi > TMath::Pi() * 2) {
+    minPhi -= TMath::Pi() * 2;
+    maxPhi -= TMath::Pi() * 2;
+  }
+  SetJetPhiLimits(minPhi, maxPhi);
+  AliAnalysisTaskRho::Run();
+  fRhoPerpSide2 = fRho->GetVal();
+
+  // near side
+  minPhi = maxTrackPhi - TMath::Pi()/4 + fJetRadius;
+  maxPhi = maxTrackPhi + TMath::Pi()/4 + fJetRadius;
+  if (maxPhi > TMath::Pi() * 2) {
+    minPhi -= TMath::Pi() * 2;
+    maxPhi -= TMath::Pi() * 2;
+  }
+  SetJetPhiLimits(minPhi, maxPhi);  
+  AliAnalysisTaskRho::Run();
+  fRhoNearSide = fRho->GetVal();
+  
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskRhoFlow::FillHistograms() 
+{
+  // Fill histograms.
+
+  fHistRhoNearVsCent->Fill(fCent, fRhoNearSide);  
+  fHistRhoAwayVsCent->Fill(fCent, fRhoAwaySide);
+  fHistRhoPerp1VsCent->Fill(fCent, fRhoPerpSide1);
+  fHistRhoPerp2VsCent->Fill(fCent, fRhoPerpSide2);
+
+  if (fCompareRho) {
+    fHistDeltaRhoNearVsCent->Fill(fCent, fRhoNearSide - fCompareRho->GetVal());
+    fHistDeltaRhoAwayVsCent->Fill(fCent, fRhoAwaySide - fCompareRho->GetVal());
+    fHistDeltaRhoPerp1VsCent->Fill(fCent, fRhoPerpSide1 - fCompareRho->GetVal());
+    fHistDeltaRhoPerp2VsCent->Fill(fCent, fRhoPerpSide2 - fCompareRho->GetVal());
+  }
+
+  return kTRUE;
+}      
diff --git a/PWGJE/EMCALJetTasks/AliAnalysisTaskRhoFlow.h b/PWGJE/EMCALJetTasks/AliAnalysisTaskRhoFlow.h
new file mode 100644 (file)
index 0000000..56a7c1c
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef ALIANALYSISTASKRHOFLOW_H
+#define ALIANALYSISTASKRHOFLOW_H
+
+// $Id: AliAnalysisTaskRhoFlow.h  $
+
+#include "AliAnalysisTaskRho.h"
+
+class AliAnalysisTaskRhoFlow : public AliAnalysisTaskRho {
+
+ public:
+  AliAnalysisTaskRhoFlow();
+  AliAnalysisTaskRhoFlow(const char *name);
+  virtual ~AliAnalysisTaskRhoFlow() {}
+
+  void             UserCreateOutputObjects();
+
+ protected:
+  Bool_t           Run();
+  Bool_t           FillHistograms();
+
+  AliAnalysisTaskRhoFlow(const AliAnalysisTaskRhoFlow&);             // not implemented
+  AliAnalysisTaskRhoFlow& operator=(const AliAnalysisTaskRhoFlow&);  // not implemented
+
+  Double_t               fRhoNearSide;                   //!Rho in the near side
+  Double_t               fRhoAwaySide;                   //!Rho in the away side
+  Double_t               fRhoPerpSide1;                  //!Rho in the perpendicular side 1
+  Double_t               fRhoPerpSide2;                  //!Rho in the perpendicular side 2
+  TH2F                  *fHistRhoNearVsCent;             //!Near side rho vs. centrality
+  TH2F                  *fHistDeltaRhoNearVsCent;        //!Rho - rho_near vs. centrality
+  TH2F                  *fHistRhoAwayVsCent;             //!Away side rho vs. centrality
+  TH2F                  *fHistDeltaRhoAwayVsCent;        //!Rho - rho_away vs. centrality
+  TH2F                  *fHistRhoPerp1VsCent;            //!Perpendicualr side 1 rho vs. centrality
+  TH2F                  *fHistDeltaRhoPerp1VsCent;       //!Rho - rho_perp1 vs. centrality
+  TH2F                  *fHistRhoPerp2VsCent;            //!Perpendicualr side 2 rho vs. centrality
+  TH2F                  *fHistDeltaRhoPerp2VsCent;       //!Rho - rho_perp2 vs. centrality
+  
+  ClassDef(AliAnalysisTaskRhoFlow, 1); // Rho task for flow bias study
+};
+#endif