* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-// $Id: AliAnalysisTaskLongRangeCorrelations.cxx 229 2012-11-15 12:16:37Z cmayer $
+// $Id: AliAnalysisTaskLongRangeCorrelations.cxx 232 2012-11-28 17:27:59Z cmayer $
#include <numeric>
#include <functional>
fOutputList->Add(new TH3D("histQAPhiEta", ";charge;#phi (rad);#eta",
2, -0.5, 1.5, 200, 0.0, TMath::TwoPi(), 300, -1.5, 1.5));
+ // N(eta) distributions with different binnings
+ fOutputList->Add(new TH2D("histNEta_300", ";#eta;N", 300, -1.5, 1.5, 1000, 0., 1000.)); // 0.01
+ fOutputList->Add(new TH2D("histNEta_120", ";#eta;N", 120, -1.5, 1.5, 1000, 0., 1000.)); // 0.025
+ fOutputList->Add(new TH2D("histNEta__30", ";#eta;N", 30, -1.5, 1.5, 1000, 0., 1000.)); // 0.1
+ fOutputList->Add(new TH2D("histNEta__15", ";#eta;N", 15, -1.5, 1.5, 1000, 0., 1000.)); // 0.2
+
// Moments
fOutputList->Add(MakeHistSparsePhiEta("histMoment1PhiEta_1"));
fOutputList->Add(MakeHistSparsePhiEta("histMoment1PhiEta_2"));
Double_t centralityBins[] = { // centrality bins
0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,15.,20.,25.,30.,35.,40.,45.,50.,55.,60.,65.,70.,75.,80.,90.,100.
-// 0.,20.,100.
+// 0.,20.,100.
};
const Int_t nCentralityBins(sizeof(centralityBins)/sizeof(Double_t) - 1);
AliDebug(5, Form("#tracks= %6lld %f", N, centrality));
for (Long64_t i(0); i<N; ++i) {
AliAODTrack* pAODTrack(dynamic_cast<AliAODTrack*>(pAOD->GetTrack(i)));
- if (NULL == pAODTrack) continue;
+ if (NULL == pAODTrack) continue;
// track filter selection
if (!pAODTrack->TestFilterBit(fTrackFilter)) continue;
THnSparse* hN2(dynamic_cast<THnSparse*>(fOutputList->FindObject(prefix+"histMoment1PhiEta_2")));
hN2->Add(hN2ForThisEvent, weight);
- TObjArray* hNs=new TObjArray;
+ // n(eta) distributions
+ FillNEtaHist(prefix+"histNEta_300", hN1ForThisEvent, weight);
+ FillNEtaHist(prefix+"histNEta_120", hN1ForThisEvent, weight);
+ FillNEtaHist(prefix+"histNEta__30", hN1ForThisEvent, weight);
+ FillNEtaHist(prefix+"histNEta__15", hN1ForThisEvent, weight);
+
+ TObjArray* hNs(new TObjArray);
// <n_1 n_1>
hNs->AddAt(hN1ForThisEvent, 0);
delete hN2ForThisEvent;
}
+void AliAnalysisTaskLongRangeCorrelations::FillNEtaHist(TString name,
+ THnSparse* hs,
+ Double_t weight) {
+
+ TH2* hSum(dynamic_cast<TH2*>(fOutputList->FindObject(name)));
+ if (NULL == hSum) return;
+
+ TH2* hPerEvent(dynamic_cast<TH2*>(hSum->Clone("hPerEvent")));
+ if (NULL == hPerEvent) return;
+ hPerEvent->Reset();
+
+ // fill hPerEvent
+ const Long64_t N(hs->GetNbins());
+ for (Long64_t i(0); i<N; ++i) {
+ Int_t coord[2] = { 0, 0 };
+ const Double_t n(hs->GetBinContent(i, coord));
+ const Double_t eta(hs->GetAxis(1)->GetBinCenter(coord[1]));
+ hPerEvent->Fill(eta, n);
+ }
+
+ // add zero counts for those eta bins with zero tracks
+ TH1* h(hPerEvent->ProjectionX());
+ for (Int_t i(1); i<=h->GetNbinsX(); ++i)
+ hPerEvent->SetBinContent(i,1, Double_t(h->GetBinContent(i) == 0));
+
+ hSum->Add(hPerEvent, weight);
+
+ delete h;
+ delete hPerEvent;
+}
+
THnSparse* AliAnalysisTaskLongRangeCorrelations::ComputeNForThisEvent(TObjArray* tracks, const char* histName) const {
THnSparse* hN(MakeHistSparsePhiEta(histName));
const Long64_t nTracks(tracks->GetEntriesFast());
return hN;
}
-class MultiDimInterator {
+class MultiDimIterator {
public:
- MultiDimInterator(TObjArray* _fHs)
+ MultiDimIterator(TObjArray* _fHs)
: fHs(_fHs)
, fN(fHs->GetEntriesFast())
, fDims(fN, 0)
}
Bool_t end() const { return fj == fN; }
- MultiDimInterator& operator++() {
+ MultiDimIterator& operator++() {
Long64_t j(0);
for (; j<fN; ++j) {
++fIdxs[j];
fX[2*j+k] = hs->GetAxis(k)->GetBinCenter(coord[k]);
}
private:
- MultiDimInterator(const MultiDimInterator&);
- MultiDimInterator& operator=(const MultiDimInterator&);
+ MultiDimIterator(const MultiDimIterator&);
+ MultiDimIterator& operator=(const MultiDimIterator&);
TObjArray* fHs;
const Long64_t fN;
THnSparse* hs(dynamic_cast<THnSparse*>(fOutputList->FindObject(histName)));
if (hs == NULL) return;
- for (MultiDimInterator mdi(hNs); !mdi.end(); ++mdi)
+ for (MultiDimIterator mdi(hNs); !mdi.end(); ++mdi)
hs->Fill(mdi.GetX(), mdi.GetN()*weight);
}