-
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
fDebug(0),
fMode(0),
fReduceMemoryFootprint(kFALSE),
+fFillMixed(kTRUE),
+fCompareCentralities(kFALSE),
// pointers to UE classes
fAnalyseUE(0x0),
fHistos(0x0),
fHistosMixed(0),
fkTrackingEfficiency(0x0),
// handlers and events
-fAOD(0x0),
+fAOD(0x0),
+fESD(0x0),
fArrayMC(0x0),
fInputHandler(0x0),
fMcEvent(0x0),
fListOfHistos(0x0),
// event QA
fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default)
-fZVertex(10.),
+fZVertex(7.),
fCentralityMethod("V0M"),
// track cuts
fTrackEtaCut(0.8),
DefineInput(0, TChain::Class());
// Output slot #0 writes into a TList container
DefineOutput(0, TList::Class());
-
}
AliAnalysisTaskPhiCorrelations::~AliAnalysisTaskPhiCorrelations()
TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
- if( handler && handler->InheritsFrom("AliAODInputHandler") ) { // input AOD
- fAOD = ((AliAODInputHandler*)handler)->GetEvent();
- if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODInputHandler");
- } else { //output AOD
- handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
- if( handler && handler->InheritsFrom("AliAODHandler") ) {
- fAOD = ((AliAODHandler*)handler)->GetAOD();
- if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODHandler");
- } else { // no AOD
- AliWarning("I can't get any AOD Event Handler");
- }
- }
+ if( handler && handler->InheritsFrom("AliAODInputHandler") )
+ { // input AOD
+ fAOD = ((AliAODInputHandler*)handler)->GetEvent();
+ if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODInputHandler");
+ }
+ else
+ { //output AOD
+ handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
+ if (handler && handler->InheritsFrom("AliAODHandler") )
+ {
+ fAOD = ((AliAODHandler*)handler)->GetAOD();
+ if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODHandler");
+ }
+ else
+ { // no AOD
+ AliWarning("I can't get any AOD Event Handler");
+ }
+ }
+
+ if (handler && handler->InheritsFrom("AliESDInputHandler") )
+ { // input ESD
+ // pointer received per event in ::Exec
+ if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliESDInputHandler");
+ }
// Initialize common pointers
Initialize();
-
}
//____________________________________________________________________
fAnalyseUE = new AliAnalyseLeadingTrackUE();
fAnalyseUE->SetParticleSelectionCriteria(fFilterBit, fUseChargeHadrons, fTrackEtaCut, fPtMin);
fAnalyseUE->SetDebug(fDebug);
- fAnalyseUE->DefineESDCuts(0);
+ fAnalyseUE->DefineESDCuts(fFilterBit);
// Initialize output list of containers
if (fListOfHistos != NULL){
fListOfHistos->Add(new TH2F("trackletsVsV0Cent", ";L1 clusters;v0 centrality", 100, -0.5, 9999.5, 101, 0, 101));
fListOfHistos->Add(new TH2F("processIDs", ";#Delta#phi;process id", 100, -0.5 * TMath::Pi(), 1.5 * TMath::Pi(), kPNoProcess + 1, -0.5, kPNoProcess + 0.5));
+ PostData(0,fListOfHistos);
+
// Add task configuration to output list
AddSettingsTree();
// event mixing
// Int_t trackDepth = 100; // Require e.g. 20 5-track events, or 2 50-track events
- Int_t trackDepth = 1000; // Require e.g. 20 5-track events, or 2 50-track events
+ Int_t trackDepth = 5000;
Int_t poolsize = 100; // Maximum number of events
Int_t nCentralityBins = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(1);
Double_t* centralityBins = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray();
- Int_t nZvtxBins = 5;
- Double_t zMin = -10.0;
- Double_t zMax = 10.0;
- Double_t zVtxBinWidth = (zMax - zMin) / nZvtxBins;
- Double_t* zvtxbin = new Double_t[nZvtxBins+1];
- for (int iz=0; iz<nZvtxBins+1; iz++)
- zvtxbin[iz] = zMin + iz*zVtxBinWidth;
+ Int_t nZvtxBins = 7;
+ Double_t vertexBins[] = { -7, -5, -3, -1, 1, 3, 5, 7 };
+ Double_t* zvtxbin = vertexBins;
+ if (fHistos->GetUEHist(2)->GetEventHist()->GetNVar() > 2)
+ {
+ nZvtxBins = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(2);
+ zvtxbin = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(2, 0)->GetXbins()->GetArray();
+ }
+
fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centralityBins, nZvtxBins, zvtxbin);
}
void AliAnalysisTaskPhiCorrelations::Exec(Option_t */*option*/)
{
// array of MC particles
- if (fMcHandler){
- fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));
- if (!fArrayMC)
- AliFatal("No array of MC particles found !!!");
+ if (fMcHandler) {
+ if (fAOD)
+ {
+ fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));
+ if (!fArrayMC)
+ AliFatal("No array of MC particles found !!!");
+ }
fMcEvent = fMcHandler->MCEvent();
}
+ // receive ESD pointer if we are not running AOD analysis
+ if (!fAOD)
+ {
+ AliVEventHandler* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ if (handler && handler->InheritsFrom("AliESDInputHandler"))
+ fESD = ((AliESDInputHandler*)handler)->GetEvent();
+ }
+
// Analyse the event
if (fMode) AnalyseCorrectionMode();
else AnalyseDataMode();
-
- PostData(0,fListOfHistos);
}
/******************** ANALYSIS METHODS *****************************/
if (fCentralityMethod.Length() > 0)
{
- AliCentrality *centralityObj = fAOD->GetHeader()->GetCentralityP();
+ AliCentrality *centralityObj = 0;
+ if (fAOD)
+ centralityObj = fAOD->GetHeader()->GetCentralityP();
+ else if (fESD)
+ centralityObj = fESD->GetCentrality();
+
if (centralityObj)
{
centrality = centralityObj->GetCentralityPercentileUnchecked(fCentralityMethod);
- Printf("Centrality is %f", centrality);
+ AliInfo(Form("Centrality is %f", centrality));
}
else
{
}
}
+ // Support for ESD and AOD based analysis
+ AliVEvent* inputEvent = fAOD;
+ if (!inputEvent)
+ inputEvent = fESD;
+
+ TObject* mc = fArrayMC;
+ if (!mc)
+ mc = fMcEvent;
+
// count all events
fHistos->FillEvent(centrality, -1);
// Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex
if (!fAnalyseUE->VertexSelection(fMcEvent, 0, fZVertex))
return;
+
+ Float_t zVtx = fMcEvent->GetPrimaryVertex()->GetZ();
// Get MC primaries
- TObjArray* tracksMC = fAnalyseUE->GetAcceptedParticles(fArrayMC, 0, kTRUE, -1, kTRUE);
+ TObjArray* tracksMC = fAnalyseUE->GetAcceptedParticles(mc, 0, kTRUE, -1, kTRUE);
// (MC-true all particles)
// STEP 0
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepAll, tracksMC);
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepAll, tracksMC);
// Trigger selection ************************************************
if (fAnalyseUE->TriggerSelection(fInputHandler))
{
- fHistos->FillEvent(centrality, AliUEHist::kCFStepTriggered);
+ // (MC-true all particles)
+ // STEP 1
+ if (!fReduceMemoryFootprint)
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTriggered, tracksMC);
+ else
+ fHistos->FillEvent(centrality, AliUEHist::kCFStepTriggered);
+
+ if (!inputEvent) {
+ AliFatal("UNEXPECTED: inputEvent is 0. Trigger selection should have failed");
+ return;
+ }
// Vertex selection *************************************************
- if (fAnalyseUE->VertexSelection(fAOD, fnTracksVertex, fZVertex))
+ if (fAnalyseUE->VertexSelection(inputEvent, fnTracksVertex, fZVertex))
{
// fill here for tracking efficiency
// loop over particle species
for (Int_t particleSpecies = 0; particleSpecies < 4; particleSpecies++)
{
- TObjArray* primMCParticles = fAnalyseUE->GetAcceptedParticles(fArrayMC, 0x0, kTRUE, particleSpecies, kTRUE);
- TObjArray* primRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(fAOD, fArrayMC, kTRUE, particleSpecies, kTRUE);
- TObjArray* allRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(fAOD, fArrayMC, kFALSE, particleSpecies, kTRUE);
+ TObjArray* primMCParticles = fAnalyseUE->GetAcceptedParticles(mc, 0x0, kTRUE, particleSpecies, kTRUE);
+ TObjArray* primRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, particleSpecies, kTRUE);
+ TObjArray* allRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, particleSpecies, kTRUE);
fHistos->FillTrackingEfficiency(primMCParticles, primRecoTracksMatched, allRecoTracksMatched, particleSpecies, centrality);
- delete primMCParticles;
+// Printf("%d --> %d %d %d", particleSpecies, primMCParticles->GetEntries(), primRecoTracksMatched->GetEntries(), allRecoTracksMatched->GetEntries());
+
+ delete primMCParticles;
delete primRecoTracksMatched;
delete allRecoTracksMatched;
}
// (MC-true all particles)
// STEP 2
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepVertex, tracksMC);
+ if (!fReduceMemoryFootprint)
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepVertex, tracksMC);
+ else
+ fHistos->FillEvent(centrality, AliUEHist::kCFStepVertex);
// Get MC primaries that match reconstructed track
- TObjArray* tracksRecoMatchedPrim = fAnalyseUE->GetAcceptedParticles(fAOD, fArrayMC, kTRUE, -1, kTRUE);
+ TObjArray* tracksRecoMatchedPrim = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, -1, kTRUE);
// (RECO-matched (quantities from MC particle) primary particles)
// STEP 4
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepTrackedOnlyPrim, tracksRecoMatchedPrim);
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTrackedOnlyPrim, tracksRecoMatchedPrim);
// Get MC primaries + secondaries that match reconstructed track
- TObjArray* tracksRecoMatchedAll = fAnalyseUE->GetAcceptedParticles(fAOD, fArrayMC, kFALSE, -1, kTRUE);
+ TObjArray* tracksRecoMatchedAll = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, -1, kTRUE);
// (RECO-matched (quantities from MC particle) all particles)
// STEP 5
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepTracked, tracksRecoMatchedAll);
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTracked, tracksRecoMatchedAll);
// Get RECO tracks
- TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(fAOD, 0, kTRUE, -1, kTRUE);
+ TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, -1, kTRUE);
// (RECO all tracks)
// STEP 6
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepReconstructed, tracks);
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks);
- if (1)
+ if (0 && !fReduceMemoryFootprint)
{
// make list of secondaries (matched with MC)
TObjArray* tracksRecoMatchedSecondaries = new TObjArray;
tracksRecoMatchedSecondaries->Add(tracksRecoMatchedAll->At(i));
// Study: Use only secondaries as trigger particles and plot the correlation vs. all particles; store in step 9
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepBiasStudy2, tracksRecoMatchedSecondaries, tracksRecoMatchedAll);
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy2, tracksRecoMatchedSecondaries, tracksRecoMatchedAll);
// Study: Use only primaries as trigger particles and plot the correlation vs. secondaries; store in step 8
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepBiasStudy, tracksRecoMatchedPrim, tracksRecoMatchedSecondaries);
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracksRecoMatchedPrim, tracksRecoMatchedSecondaries);
// plot delta phi vs process id of secondaries
// trigger particles: primaries in 4 < pT < 10
if (!fInputHandler)
return;
- if (!(fInputHandler->IsEventSelected()&AliVEvent::kMB))
+ if (!(fInputHandler->IsEventSelected() & (AliVEvent::kMB | AliVEvent::kUserDefined)))
return;
Double_t centrality = 0;
+ AliCentrality *centralityObj = 0;
if (fCentralityMethod.Length() > 0)
{
- //AliCentrality *centralityObj = esd->GetCentrality();
- AliCentrality *centralityObj = fAOD->GetHeader()->GetCentralityP();
+ if (fAOD)
+ centralityObj = fAOD->GetHeader()->GetCentralityP();
+ else if (fESD)
+ centralityObj = fESD->GetCentrality();
+
if (centralityObj)
centrality = centralityObj->GetCentralityPercentile(fCentralityMethod);
//centrality = centralityObj->GetCentralityPercentileUnchecked(fCentralityMethod);
else
centrality = -1;
- Printf("Centrality is %f", centrality);
+ AliInfo(Form("Centrality is %f", centrality));
}
+ // Support for ESD and AOD based analysis
+ AliVEvent* inputEvent = fAOD;
+ if (!inputEvent)
+ inputEvent = fESD;
+
+ fHistos->SetRunNumber(inputEvent->GetRunNumber());
+
// Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut
fHistos->FillEvent(centrality, AliUEHist::kCFStepAll);
fHistos->FillEvent(centrality, AliUEHist::kCFStepTriggered);
// Vertex selection *************************************************
- if(!fAnalyseUE->VertexSelection(fAOD, fnTracksVertex, fZVertex)) return;
+ if(!fAnalyseUE->VertexSelection(inputEvent, fnTracksVertex, fZVertex)) return;
// Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut
fHistos->FillEvent(centrality, AliUEHist::kCFStepVertex);
- if (centrality < 0)
+ // optimization
+ if (centrality < 0 && !fCompareCentralities)
return;
- TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(fAOD, 0, kTRUE, -1, kTRUE);
+ TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, -1, kTRUE);
//Printf("Accepted %d tracks", tracks->GetEntries());
- // event mixing
-
- // 1. First get an event pool corresponding in mult (cent) and
- // zvertex to the current event. Once initialized, the pool
- // should contain nMix (reduced) events. This routine does not
- // pre-scan the chain. The first several events of every chain
- // will be skipped until the needed pools are filled to the
- // specified depth. If the pool categories are not too rare, this
- // should not be a problem. If they are rare, you could lose
- // statistics.
-
- // 2. Collect the whole pool's content of tracks into one TObjArray
- // (bgTracks), which is effectively a single background super-event.
-
- // 3. The reduced and bgTracks arrays must both be passed into
- // FillCorrelations(). Also nMix should be passed in, so a weight
- // of 1./nMix can be applied.
-
- AliAODVertex* vertex = fAOD->GetPrimaryVertex();
+ const AliVVertex* vertex = inputEvent->GetPrimaryVertex();
Double_t zVtx = vertex->GetZ();
- AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx);
-
- if (!pool)
- AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centrality, zVtx));
+ // fill two different centralities (syst study)
+ // the zvtx axis is used to distinguish the results of both centralities: configured centrality in zvtx = 0, SPD in zvtx = 2
+ if (fCompareCentralities)
+ zVtx = 0;
- //pool->SetDebug(1);
-
// Fill containers at STEP 6 (reconstructed)
- fHistos->FillCorrelations(centrality, AliUEHist::kCFStepReconstructed, tracks);
-
- if (pool->IsReady())
+ if (centrality >= 0)
+ fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks);
+
+ // fill second time with SPD centrality
+ if (fCompareCentralities && centralityObj)
{
+ centrality = centralityObj->GetCentralityPercentile("CL1");
+ if (centrality >= 0)
+ fHistos->FillCorrelations(centrality, 2, AliUEHist::kCFStepReconstructed, tracks);
+ }
- Int_t nMix = pool->GetCurrentNEvents();
- //cout << "nMix = " << nMix << endl;
-
- // Fill mixed-event histos here
- for (Int_t jMix=0; jMix<nMix; jMix++) {
- TObjArray* bgTracks = pool->GetEvent(jMix);
- fHistosMixed->FillCorrelations(centrality, AliUEHist::kCFStepReconstructed, tracks, bgTracks, 1.0 / nMix, (jMix == 0));
+ if (fFillMixed)
+ {
+ // event mixing
+
+ // 1. First get an event pool corresponding in mult (cent) and
+ // zvertex to the current event. Once initialized, the pool
+ // should contain nMix (reduced) events. This routine does not
+ // pre-scan the chain. The first several events of every chain
+ // will be skipped until the needed pools are filled to the
+ // specified depth. If the pool categories are not too rare, this
+ // should not be a problem. If they are rare, you could lose
+ // statistics.
+
+ // 2. Collect the whole pool's content of tracks into one TObjArray
+ // (bgTracks), which is effectively a single background super-event.
+
+ // 3. The reduced and bgTracks arrays must both be passed into
+ // FillCorrelations(). Also nMix should be passed in, so a weight
+ // of 1./nMix can be applied.
+
+ AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx);
+
+ if (!pool)
+ AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centrality, zVtx));
+
+ //pool->SetDebug(1);
+
+ if (pool->IsReady())
+ {
+
+ Int_t nMix = pool->GetCurrentNEvents();
+ //cout << "nMix = " << nMix << endl;
+
+ // Fill mixed-event histos here
+ for (Int_t jMix=0; jMix<nMix; jMix++) {
+ TObjArray* bgTracks = pool->GetEvent(jMix);
+ fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks, bgTracks, 1.0 / nMix, (jMix == 0));
+ }
}
+
+ // clone and give ownership to event pool
+ TObjArray* tracksClone = (TObjArray*) tracks->Clone();
+ tracksClone->SetOwner(kTRUE);
+
+ pool->UpdatePool(tracksClone);
+ //pool->PrintInfo();
}
-
- // clone and give ownership to event pool
- TObjArray* tracksClone = (TObjArray*) tracks->Clone();
- tracksClone->SetOwner(kTRUE);
-
- pool->UpdatePool(tracksClone);
- //pool->PrintInfo();
delete tracks;
}