-// $Id: AliJetEmbeddingFromAODTask.cxx $
+// $Id$
//
// Jet embedding from AOD task.
//
#include "AliFJWrapper.h"
#include "AliLog.h"
#include "AliInputEventHandler.h"
+#include "AliNamedString.h"
ClassImp(AliJetEmbeddingFromAODTask)
fJetType(0),
fJetAlgo(1),
fJetParticleLevel(kTRUE),
+ fParticleMinPt(0),
+ fParticleMaxPt(0),
+ fParticleSelection(0),
fIncludeNoITS(kFALSE),
fCutMaxFractionSharedTPCClusters(0.4),
fUseNegativeLabels(kTRUE),
fAODCaloCells(0),
fAODMCParticles(0),
fCurrentAODEntry(-1),
+ fAODFilePath(0),
fHistFileMatching(0),
fHistAODFileError(0),
fHistNotEmbedded(0),
fHistEmbeddingQA(0),
- fHistRejectedEvents(0)
+ fHistRejectedEvents(0),
+ fEmbeddingCount(0)
{
// Default constructor.
SetSuffix("AODEmbedding");
fJetType(0),
fJetAlgo(1),
fJetParticleLevel(kTRUE),
+ fParticleMinPt(0),
+ fParticleMaxPt(0),
+ fParticleSelection(0),
fIncludeNoITS(kFALSE),
fCutMaxFractionSharedTPCClusters(0.4),
fUseNegativeLabels(kTRUE),
fAODCaloCells(0),
fAODMCParticles(0),
fCurrentAODEntry(-1),
+ fAODFilePath(0),
fHistFileMatching(0),
fHistAODFileError(0),
fHistNotEmbedded(0),
fHistEmbeddingQA(0),
- fHistRejectedEvents(0)
+ fHistRejectedEvents(0),
+ fEmbeddingCount(0)
{
// Standard constructor.
SetSuffix("AODEmbedding");
else
fEsdTreeMode = kTRUE;
+ fAODFilePath = static_cast<AliNamedString*>(InputEvent()->FindListObject("AODEmbeddingFile"));
+ if (!fAODFilePath) {
+ fAODFilePath = new AliNamedString("AODEmbeddingFile", "");
+ AliDebug(3,"Adding AOD embedding file path object to the event list...");
+ InputEvent()->AddObject(fAODFilePath);
+ }
+
return AliJetModelBaseTask::ExecOnce();
}
if (fHistFileMatching)
fHistFileMatching->Fill(fCurrentFileID, fCurrentAODFileID-1);
+
+ fEmbeddingCount = 0;
return kTRUE;
}
} while (!IsAODEventSelected());
- fHistRejectedEvents->Fill(attempts);
+ if (fHistRejectedEvents)
+ fHistRejectedEvents->Fill(attempts);
if (!fCurrentAODTree)
return kFALSE;
+ fEmbeddingCount++;
+
return kTRUE;
}
}
+ // Particle selection
+ if ((fParticleSelection == 1 && FindParticleInRange(fAODTracks)==kFALSE) ||
+ (fParticleSelection == 2 && FindParticleInRange(fAODClusters)==kFALSE) ||
+ (fParticleSelection == 3 && FindParticleInRange(fAODMCParticles)==kFALSE))
+ return kFALSE;
+
// Jet selection
if (fJetMinPt > 0) {
TLorentzVector jet;
return kTRUE;
}
+//________________________________________________________________________
+Bool_t AliJetEmbeddingFromAODTask::FindParticleInRange(TClonesArray *array)
+{
+ if (!array) return kFALSE;
+
+ if (array->GetClass()->InheritsFrom("AliVParticle")) {
+ const Int_t nentries = array->GetEntriesFast();
+ for (Int_t i = 0; i < nentries; i++) {
+ AliVParticle *part = static_cast<AliVParticle*>(array->At(i));
+ if (!part) continue;
+ if (part->Pt() > fParticleMinPt && part->Pt() < fParticleMaxPt) return kTRUE;
+ }
+ }
+ else if (array->GetClass()->InheritsFrom("AliVCluster")) {
+ const Int_t nentries = array->GetEntriesFast();
+ for (Int_t i = 0; i < nentries; i++) {
+ AliVCluster *clus = static_cast<AliVCluster*>(array->At(i));
+ if (!clus) continue;
+
+ TLorentzVector vect;
+ Double_t vert[3] = {0,0,0};
+ clus->GetMomentum(vect,vert);
+
+ if (vect.Pt() > fParticleMinPt && vect.Pt() < fParticleMaxPt) return kTRUE;
+ }
+ }
+ else {
+ AliWarning(Form("Unable to do event selection based on particle pT: %s class type not recognized.",array->GetClass()->GetName()));
+ }
+
+ return kFALSE;
+}
+
//________________________________________________________________________
void AliJetEmbeddingFromAODTask::Run()
{
if (fHistEmbeddingQA)
fHistEmbeddingQA->Fill("OK", 1);
+ fAODFilePath->SetString(fCurrentAODFile->GetName());
+
if (fOutMCParticles) {
if (fCopyArray && fMCParticles)
else {
AliDebug(3, "Track not embedded because ITS refit failed.");
continue;
- }
+ }
}
else {
type = 1;
else
type = ptrack->GetLabel();
isEmc = ptrack->IsEMCAL();
+
+ if (!fIncludeNoITS && type==2) {
+ AliDebug(3, "Track not embedded because ITS refit failed.");
+ continue;
+ }
}
}
AliDebug(1,Form("%s: Track %d with label==0", GetName(), i));
}
- AddTrack(track->Pt(), track->Eta(), track->Phi(), type, track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), isEmc, label, track->Charge());
+ AddTrack(track->Pt(), track->Eta(), track->Phi(), type, track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), track->GetTrackPtOnEMCal(), isEmc, label, track->Charge());
AliDebug(3, "Track embedded!");
}
}