3 // Jet embedding from AOD task.
5 // Author: S.Aiola, C.Loizides
7 #include "AliJetEmbeddingFromAODTask.h"
9 // C++ standard library
15 #include <TClonesArray.h>
16 #include <TObjArray.h>
17 #include <TObjString.h>
21 #include <TStreamerInfo.h>
24 #include <TLorentzVector.h>
27 #include "AliVEvent.h"
28 #include "AliAODTrack.h"
29 #include "AliESDtrack.h"
30 #include "AliPicoTrack.h"
31 #include "AliVTrack.h"
32 #include "AliVCluster.h"
33 #include "AliVCaloCells.h"
34 #include "AliAODMCParticle.h"
35 #include "AliCentrality.h"
36 #include "AliVHeader.h"
37 #include "AliVVertex.h"
38 #include "AliAODHeader.h"
39 #include "AliFJWrapper.h"
41 #include "AliInputEventHandler.h"
42 #include "AliNamedString.h"
44 ClassImp(AliJetEmbeddingFromAODTask)
46 //________________________________________________________________________
47 AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() :
48 AliJetModelBaseTask("AliJetEmbeddingFromAODTask"),
50 fRandomAccess(kFALSE),
57 fAODMCParticlesName(),
60 fTriggerMask(AliVEvent::kAny),
68 fJetConstituentMinPt(0),
72 fJetParticleLevel(kTRUE),
75 fParticleSelection(0),
76 fIncludeNoITS(kFALSE),
77 fCutMaxFractionSharedTPCClusters(0.4),
78 fUseNegativeLabels(kTRUE),
83 fEmbedCentrality(kFALSE),
100 fHistFileMatching(0),
101 fHistAODFileError(0),
104 fHistRejectedEvents(0),
107 // Default constructor.
108 SetSuffix("AODEmbedding");
109 fAODfilterBits[0] = -1;
110 fAODfilterBits[1] = -1;
119 //________________________________________________________________________
120 AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask(const char *name, Bool_t drawqa) :
121 AliJetModelBaseTask(name, drawqa),
123 fRandomAccess(kFALSE),
124 fAODTreeName("aodTree"),
125 fAODHeaderName("header"),
126 fAODVertexName("vertices"),
127 fAODTrackName("tracks"),
129 fAODCellsName("emcalCells"),
130 fAODMCParticlesName(AliAODMCParticle::StdBranchName()),
133 fTriggerMask(AliVEvent::kAny),
141 fJetConstituentMinPt(0),
145 fJetParticleLevel(kTRUE),
148 fParticleSelection(0),
149 fIncludeNoITS(kFALSE),
150 fCutMaxFractionSharedTPCClusters(0.4),
151 fUseNegativeLabels(kTRUE),
156 fEmbedCentrality(kFALSE),
157 fEsdTreeMode(kFALSE),
159 fCurrentAODFileID(0),
161 fPicoTrackVersion(0),
169 fCurrentAODEntry(-1),
173 fHistFileMatching(0),
174 fHistAODFileError(0),
177 fHistRejectedEvents(0),
180 // Standard constructor.
181 SetSuffix("AODEmbedding");
182 fAODfilterBits[0] = -1;
183 fAODfilterBits[1] = -1;
192 //________________________________________________________________________
193 AliJetEmbeddingFromAODTask::~AliJetEmbeddingFromAODTask()
197 if (fCurrentAODFile) {
198 fCurrentAODFile->Close();
199 delete fCurrentAODFile;
203 //________________________________________________________________________
204 void AliJetEmbeddingFromAODTask::UserCreateOutputObjects()
209 AliJetModelBaseTask::UserCreateOutputObjects();
211 fHistFileMatching = new TH2C("fHistFileMatching", "fHistFileMatching", fTotalFiles, -0.5, fTotalFiles - 0.5, fFileList->GetEntriesFast(), -0.5, fFileList->GetEntriesFast() -0.5);
212 fHistFileMatching->GetXaxis()->SetTitle("File no. (PYTHIA)");
213 fHistFileMatching->GetYaxis()->SetTitle("File no. (Embedded AOD)");
214 fHistFileMatching->GetZaxis()->SetTitle("counts");
215 fOutput->Add(fHistFileMatching);
217 fHistAODFileError = new TH1C("fHistAODFileError", "fHistAODFileError", fFileList->GetEntriesFast(), -0.5, fFileList->GetEntriesFast() -0.5);
218 fHistAODFileError->GetXaxis()->SetTitle("File no. (Embedded AOD)");
219 fHistAODFileError->GetYaxis()->SetTitle("counts");
220 fOutput->Add(fHistAODFileError);
222 fHistNotEmbedded = new TH1C("fHistNotEmbedded", "fHistNotEmbedded", fTotalFiles, -0.5, fTotalFiles - 0.5);
223 fHistNotEmbedded->GetXaxis()->SetTitle("File no. (PYTHIA)");
224 fHistNotEmbedded->GetYaxis()->SetTitle("counts");
225 fOutput->Add(fHistNotEmbedded);
227 fHistEmbeddingQA = new TH1F("fHistEmbeddingQA", "fHistEmbeddingQA", 2, 0, 2);
228 fHistEmbeddingQA->GetXaxis()->SetTitle("Event state");
229 fHistEmbeddingQA->GetYaxis()->SetTitle("counts");
230 fHistEmbeddingQA->GetXaxis()->SetBinLabel(1, "OK");
231 fHistEmbeddingQA->GetXaxis()->SetBinLabel(2, "Not embedded");
232 fOutput->Add(fHistEmbeddingQA);
234 fHistRejectedEvents = new TH1F("fHistRejectedEvents", "fHistRejectedEvents", 500, -0.5, 499.5);
235 fHistRejectedEvents->GetXaxis()->SetTitle("# of rejected events");
236 fHistRejectedEvents->GetYaxis()->SetTitle("counts");
237 fOutput->Add(fHistRejectedEvents);
239 PostData(1, fOutput);
242 //________________________________________________________________________
243 Bool_t AliJetEmbeddingFromAODTask::UserNotify()
245 TString path(fInputHandler->GetTree()->GetCurrentFile()->GetPath());
246 if (path.EndsWith("/"))
247 path.Remove(path.Length()-1);
248 path.Remove(path.Last('/'));
249 path.Remove(0, path.Last('/')+1);
251 AliWarning(Form("Could not extract file number from path %s", path.Data()));
254 fCurrentFileID = path.Atoi();
255 if (!fRandomAccess) {
256 fCurrentAODFileID = fFileList->GetEntriesFast() * fCurrentFileID / fTotalFiles-1;
257 AliInfo(Form("Start embedding from file ID %d", fCurrentAODFileID));
262 //________________________________________________________________________
263 Bool_t AliJetEmbeddingFromAODTask::ExecOnce()
265 if (fAODTreeName.Contains("aod"))
266 fEsdTreeMode = kFALSE;
268 fEsdTreeMode = kTRUE;
270 fAODFilePath = static_cast<AliNamedString*>(InputEvent()->FindListObject("AODEmbeddingFile"));
272 fAODFilePath = new AliNamedString("AODEmbeddingFile", "");
273 AliDebug(3,"Adding AOD embedding file path object to the event list...");
274 InputEvent()->AddObject(fAODFilePath);
277 return AliJetModelBaseTask::ExecOnce();
280 //________________________________________________________________________
281 Bool_t AliJetEmbeddingFromAODTask::OpenNextFile()
283 if (fCurrentAODFile) {
284 fCurrentAODFile->Close();
285 delete fCurrentAODFile;
291 while ((!fCurrentAODFile || fCurrentAODFile->IsZombie()) && i < fAttempts) {
292 if (i > 0 && fHistAODFileError) {
293 fHistAODFileError->Fill(fCurrentAODFileID);
296 fCurrentAODFile = GetNextFile();
300 if (!fCurrentAODFile || fCurrentAODFile->IsZombie()) {
301 AliError("Could not open AOD file to embed!");
305 const TList *clist = fCurrentAODFile->GetStreamerInfoCache();
307 TStreamerInfo *cinfo = static_cast<TStreamerInfo*>(clist->FindObject("AliPicoTrack"));
309 fPicoTrackVersion = cinfo->GetClassVersion();
311 fPicoTrackVersion = 0;
314 fCurrentAODTree = static_cast<TTree*>(fCurrentAODFile->Get(fAODTreeName));
315 if (!fCurrentAODTree) {
316 AliError(Form("Could not get tree %s from file %s", fAODTreeName.Data(), fCurrentAODFile->GetName()));
320 if (!fAODHeaderName.IsNull())
321 fCurrentAODTree->SetBranchAddress(fAODHeaderName, &fAODHeader);
323 if (!fAODVertexName.IsNull())
324 fCurrentAODTree->SetBranchAddress(fAODVertexName, &fAODVertex);
326 if (!fAODTrackName.IsNull())
327 fCurrentAODTree->SetBranchAddress(fAODTrackName, &fAODTracks);
329 if (!fAODClusName.IsNull())
330 fCurrentAODTree->SetBranchAddress(fAODClusName, &fAODClusters);
332 if (!fAODCellsName.IsNull())
333 fCurrentAODTree->SetBranchAddress(fAODCellsName, &fAODCaloCells);
335 if (!fAODMCParticlesName.IsNull())
336 fCurrentAODTree->SetBranchAddress(fAODMCParticlesName, &fAODMCParticles);
339 fFirstAODEntry = TMath::Nint(gRandom->Rndm()*fCurrentAODTree->GetEntries())-1;
345 fLastAODEntry = fCurrentAODTree->GetEntries();
346 fCurrentAODEntry = fFirstAODEntry;
348 AliDebug(3,Form("Will start embedding from entry %d", fCurrentAODEntry+1));
350 if (fHistFileMatching)
351 fHistFileMatching->Fill(fCurrentFileID, fCurrentAODFileID-1);
358 //________________________________________________________________________
359 TFile* AliJetEmbeddingFromAODTask::GetNextFile()
362 fCurrentAODFileID = TMath::Nint(gRandom->Rndm()*fFileList->GetEntriesFast());
366 if (fCurrentAODFileID >= fFileList->GetEntriesFast()) {
367 AliError("No more file in the list!");
371 TObjString *objFileName = static_cast<TObjString*>(fFileList->At(fCurrentAODFileID));
372 TString fileName(objFileName->GetString());
374 if (fileName.BeginsWith("alien://") && !gGrid) {
375 AliInfo("Trying to connect to AliEn ...");
376 TGrid::Connect("alien://");
379 TString baseFileName(fileName);
380 if (baseFileName.Contains(".zip#")) {
381 Ssiz_t pos = baseFileName.Last('#');
382 baseFileName.Remove(pos);
385 if (gSystem->AccessPathName(baseFileName)) {
386 AliError(Form("File %s does not exist!", baseFileName.Data()));
390 AliDebug(3,Form("Trying to open file %s...", fileName.Data()));
391 TFile *file = TFile::Open(fileName);
393 if (!file || file->IsZombie()) {
394 AliError(Form("Unable to open file: %s!", fileName.Data()));
401 //________________________________________________________________________
402 Bool_t AliJetEmbeddingFromAODTask::GetNextEntry()
407 if (fCurrentAODEntry+1 >= fLastAODEntry) { // in case it did not start from the first entry, it will go back
408 fLastAODEntry = fFirstAODEntry;
410 fCurrentAODEntry = -1;
412 if (!fCurrentAODFile || !fCurrentAODTree || fCurrentAODEntry+1 >= fLastAODEntry) {
413 if (!OpenNextFile()) {
414 AliError("Could not open the next file!");
419 if (!fCurrentAODTree) {
420 AliError("Could not get the tree!");
425 fCurrentAODTree->GetEntry(fCurrentAODEntry);
428 if (attempts == 1000)
429 AliWarning("After 1000 attempts no event has been accepted by the event selection (trigger, centrality...)!");
431 } while (!IsAODEventSelected());
433 if (fHistRejectedEvents)
434 fHistRejectedEvents->Fill(attempts);
436 if (!fCurrentAODTree)
439 if (!fEsdMode && !fEsdTreeMode && fAODHeader) {
440 AliAODHeader *aodHeader = static_cast<AliAODHeader*>(fAODHeader);
441 AliAODHeader *evHeader = static_cast<AliAODHeader*>(InputEvent()->GetHeader());
442 if (fEmbedCentrality) {
443 AliCentrality *cent = aodHeader->GetCentralityP();
444 evHeader->SetCentrality(cent);
453 //________________________________________________________________________
454 Bool_t AliJetEmbeddingFromAODTask::IsAODEventSelected()
456 // AOD event selection.
458 if (!fEsdTreeMode && fAODHeader) {
459 AliAODHeader *aodHeader = static_cast<AliAODHeader*>(fAODHeader);
462 if (fTriggerMask != 0) {
463 UInt_t offlineTrigger = aodHeader->GetOfflineTrigger();
464 if ((offlineTrigger & fTriggerMask) == 0) {
465 AliDebug(2,Form("Event rejected due to physics selection. Event trigger mask: %d, trigger mask selection: %d.",
466 offlineTrigger, fTriggerMask));
471 // Centrality selection
472 if (fMinCentrality >= 0) {
473 AliCentrality *cent = aodHeader->GetCentralityP();
474 Float_t centVal = cent->GetCentralityPercentile("V0M");
475 if (centVal < fMinCentrality || centVal >= fMaxCentrality) {
476 AliDebug(2,Form("Event rejected due to centrality selection. Event centrality: %f, centrality range selection: %f to %f",
477 centVal, fMinCentrality, fMaxCentrality));
485 Double_t vert[3]={0};
486 ((AliVVertex*)fAODVertex->At(0))->GetXYZ(vert);
487 if (TMath::Abs(vert[2]) > fZVertexCut) {
488 AliDebug(2,Form("Event rejected due to Z vertex selection. Event Z vertex: %f, Z vertex cut: %f",
489 vert[2], fZVertexCut));
492 Double_t dist = TMath::Sqrt((vert[0]-fVertex[0])*(vert[0]-fVertex[0])+(vert[1]-fVertex[1])*(vert[1]-fVertex[1])+(vert[2]-fVertex[2])*(vert[2]-fVertex[2]));
493 if (dist > fMaxVertexDist) {
494 AliDebug(2,Form("Event rejected because the distance between the current and embedded verteces is > %f. "
495 "Current event vertex (%f, %f, %f), embedded event vertex (%f, %f, %f). Distance = %f",
496 fMaxVertexDist, fVertex[0], fVertex[1], fVertex[2], vert[0], vert[1], vert[2], dist));
502 // Particle selection
503 if ((fParticleSelection == 1 && FindParticleInRange(fAODTracks)==kFALSE) ||
504 (fParticleSelection == 2 && FindParticleInRange(fAODClusters)==kFALSE) ||
505 (fParticleSelection == 3 && FindParticleInRange(fAODMCParticles)==kFALSE))
512 if (fJetParticleLevel) {
514 jet = GetLeadingJet(fAODMCParticles);
516 AliWarning("Particle level jets selected, but not MC particles found. The jet event selection will be skipped.");
521 if (fAODTracks || fAODClusters)
522 jet = GetLeadingJet(fAODTracks, fAODClusters);
524 AliWarning("Detector level jets selected, but not tracks or clusters found. The jet event selection will be skipped.");
529 AliDebug(1, Form("Leading jet pt = %f", jet.Pt()));
530 if (jet.Pt() < fJetMinPt)
537 //________________________________________________________________________
538 Bool_t AliJetEmbeddingFromAODTask::FindParticleInRange(TClonesArray *array)
540 if (!array) return kFALSE;
542 if (array->GetClass()->InheritsFrom("AliVParticle")) {
543 const Int_t nentries = array->GetEntriesFast();
544 for (Int_t i = 0; i < nentries; i++) {
545 AliVParticle *part = static_cast<AliVParticle*>(array->At(i));
547 if (part->Pt() > fParticleMinPt && part->Pt() < fParticleMaxPt) return kTRUE;
550 else if (array->GetClass()->InheritsFrom("AliVCluster")) {
551 const Int_t nentries = array->GetEntriesFast();
552 for (Int_t i = 0; i < nentries; i++) {
553 AliVCluster *clus = static_cast<AliVCluster*>(array->At(i));
557 Double_t vert[3] = {0,0,0};
558 clus->GetMomentum(vect,vert);
560 if (vect.Pt() > fParticleMinPt && vect.Pt() < fParticleMaxPt) return kTRUE;
564 AliWarning(Form("Unable to do event selection based on particle pT: %s class type not recognized.",array->GetClass()->GetName()));
570 //________________________________________________________________________
571 void AliJetEmbeddingFromAODTask::Run()
573 if (!GetNextEntry()) {
574 if (fHistNotEmbedded)
575 fHistNotEmbedded->Fill(fCurrentFileID);
576 if (fHistEmbeddingQA)
577 fHistEmbeddingQA->Fill("Not embedded", 1);
578 AliError("Unable to get the AOD event to embed. Nothing will be embedded.");
582 if (fHistEmbeddingQA)
583 fHistEmbeddingQA->Fill("OK", 1);
585 fAODFilePath->SetString(fCurrentAODFile->GetName());
587 if (fOutMCParticles) {
589 if (fCopyArray && fMCParticles)
592 if (fAODMCParticles) {
593 AliDebug(3, Form("%d MC particles will be processed for embedding.", fAODMCParticles->GetEntriesFast()));
594 for (Int_t i = 0; i < fAODMCParticles->GetEntriesFast(); i++) {
595 AliAODMCParticle *part = static_cast<AliAODMCParticle*>(fAODMCParticles->At(i));
597 AliError(Form("Could not find MC particle %d in branch %s of tree %s!", i, fAODMCParticlesName.Data(), fAODTreeName.Data()));
601 AliDebug(3, Form("Processing MC particle %d with pT = %f, eta = %f, phi = %f", i, part->Pt(), part->Eta(), part->Phi()));
603 if (!part->IsPhysicalPrimary())
606 if (part->Pt() < fPtMin || part->Pt() > fPtMax ||
607 part->Eta() < fEtaMin || part->Eta() > fEtaMax ||
608 part->Phi() < fPhiMin || part->Phi() > fPhiMax)
611 AddMCParticle(part, i);
612 AliDebug(3, "Embedded!");
619 if (fCopyArray && fTracks)
622 AliDebug(3, Form("Start embedding with %d tracks.", fOutTracks->GetEntriesFast()));
625 AliDebug(3, Form("%d tracks will be processed for embedding.", fAODTracks->GetEntriesFast()));
626 for (Int_t i = 0; i < fAODTracks->GetEntriesFast(); i++) {
627 AliVTrack *track = static_cast<AliVTrack*>(fAODTracks->At(i));
629 AliError(Form("Could not find track %d in branch %s of tree %s!", i, fAODTrackName.Data(), fAODTreeName.Data()));
633 AliDebug(3, Form("Processing track %d with pT = %f, eta = %f, phi = %f, label = %d", i, track->Pt(), track->Eta(), track->Phi(), track->GetLabel()));
636 Bool_t isEmc = kFALSE;
638 AliAODTrack *aodtrack = static_cast<AliAODTrack*>(track);
639 if (aodtrack->TestFilterBit(fAODfilterBits[0])) {
642 else if (aodtrack->TestFilterBit(fAODfilterBits[1])) {
643 if ((aodtrack->GetStatus()&AliESDtrack::kITSrefit)==0) {
647 AliDebug(3, "Track not embedded because ITS refit failed.");
655 else { /*not a good track*/
656 AliDebug(3, "Track not embedded because not an hybrid track.");
659 if (fCutMaxFractionSharedTPCClusters > 0) {
660 Double_t frac = Double_t(aodtrack->GetTPCnclsS()) / Double_t(aodtrack->GetTPCncls());
661 if (frac > fCutMaxFractionSharedTPCClusters)
664 if (TMath::Abs(aodtrack->GetTrackEtaOnEMCal()) < 0.75 &&
665 aodtrack->GetTrackPhiOnEMCal() > 70 * TMath::DegToRad() &&
666 aodtrack->GetTrackPhiOnEMCal() < 190 * TMath::DegToRad())
669 else if (fPicoTrackVersion > 0) { /*not AOD mode, let's see if it is PicoTrack*/
670 AliPicoTrack *ptrack = dynamic_cast<AliPicoTrack*>(track);
672 if (fPicoTrackVersion >= 3)
673 type = ptrack->GetTrackType();
675 type = ptrack->GetLabel();
676 isEmc = ptrack->IsEMCAL();
678 if (!fIncludeNoITS && type==2) {
679 AliDebug(3, "Track not embedded because ITS refit failed.");
685 if (track->Pt() < fPtMin || track->Pt() > fPtMax ||
686 track->Eta() < fEtaMin || track->Eta() > fEtaMax ||
687 track->Phi() < fPhiMin || track->Phi() > fPhiMax) {
688 AliDebug(3, "Track not embedded because out of limits.");
692 if (fTrackEfficiency) {
693 Double_t r = gRandom->Rndm();
694 if (fTrackEfficiency->Eval(track->Pt()) < r) {
695 AliDebug(3, "Track not embedded because of artificial inefficiency.");
702 if (fUseNegativeLabels)
703 label = track->GetLabel();
705 label = TMath::Abs(track->GetLabel());
708 AliDebug(1,Form("%s: Track %d with label==0", GetName(), i));
711 AddTrack(track->Pt(), track->Eta(), track->Phi(), type, track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), track->GetTrackPtOnEMCal(), isEmc, label, track->Charge());
712 AliDebug(3, "Track embedded!");
719 if (fCopyArray && fClusters)
723 for (Int_t i = 0; i < fAODClusters->GetEntriesFast(); i++) {
724 AliVCluster *clus = static_cast<AliVCluster*>(fAODClusters->At(i));
726 AliError(Form("Could not find cluster %d in branch %s of tree %s!", i, fAODClusName.Data(), fAODTreeName.Data()));
730 if (!clus->IsEMCAL())
734 Double_t vert[3] = {0,0,0};
735 clus->GetMomentum(vect,vert);
737 if (vect.Pt() < fPtMin || vect.Pt() > fPtMax ||
738 vect.Eta() < fEtaMin || vect.Eta() > fEtaMax ||
739 vect.Phi() < fPhiMin || vect.Phi() > fPhiMax)
744 label = clus->GetLabel();
746 AliDebug(1,Form("%s: Clus %d with label<=0", GetName(), i));
755 Double_t totalEnergy = 0;
756 Int_t totalCells = 0;
759 totalCells += fCaloCells->GetNumberOfCells();
761 totalCells += fAODCaloCells->GetNumberOfCells();
763 SetNumberOfOutCells(totalCells);
769 for (Short_t i = 0; i < fAODCaloCells->GetNumberOfCells(); i++) {
773 Short_t cellNum = -1;
776 fAODCaloCells->GetCell(i, cellNum, amp, time, mclabel, efrac);
780 AliDebug(1,Form("%s: Cell %d with label<=0", GetName(), i));
786 AliDebug(2,Form("Adding cell with amplitude %f, absolute ID %d, time %f, mc label %d", amp, cellNum, time, mclabel));
787 AddCell(amp, cellNum, time, mclabel);
791 AliDebug(2,Form("Added cells = %d (energy = %f), total cells = %d", fAddedCells, totalEnergy, totalCells));
795 //________________________________________________________________________
796 TLorentzVector AliJetEmbeddingFromAODTask::GetLeadingJet(TClonesArray *tracks, TClonesArray *clusters)
799 fastjet::JetAlgorithm jalgo(fastjet::kt_algorithm);
802 jalgo = fastjet::antikt_algorithm;
806 AliFJWrapper fjw(name, name);
807 fjw.SetAreaType(fastjet::active_area_explicit_ghosts);
808 fjw.SetGhostArea(1); // set a very large ghost area to speed up jet finding
809 fjw.SetR(fJetRadius);
810 fjw.SetAlgorithm(jalgo);
815 const Int_t Ntracks = tracks->GetEntries();
816 for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) {
817 AliVParticle *t = static_cast<AliVParticle*>(tracks->At(iTracks));
821 AliAODMCParticle *aodmcpart = dynamic_cast<AliAODMCParticle*>(t);
822 if (aodmcpart && !aodmcpart->IsPhysicalPrimary())
825 if ((fJetType == 1 && t->Charge() == 0) ||
826 (fJetType == 2 && t->Charge() != 0))
829 if (t->Pt() < fJetConstituentMinPt)
832 fjw.AddInputVector(t->Px(), t->Py(), t->Pz(), t->P(), iTracks + 100);
836 if (clusters && fJetType != 1) {
837 Double_t vert[3]={0};
839 ((AliVVertex*)fAODVertex->At(0))->GetXYZ(vert);
841 const Int_t Nclus = clusters->GetEntries();
842 for (Int_t iClus = 0; iClus < Nclus; ++iClus) {
843 AliVCluster *c = static_cast<AliVCluster*>(clusters->At(iClus));
851 c->GetMomentum(nP, vert);
853 if (nP.Pt() < fJetConstituentMinPt)
856 fjw.AddInputVector(nP.Px(), nP.Py(), nP.Pz(), nP.P(), -iClus - 100);
863 std::vector<fastjet::PseudoJet> jets_incl = fjw.GetInclusiveJets();
864 AliDebug(1,Form("%d jets found", (Int_t)jets_incl.size()));
868 Int_t njets = jets_incl.size();
871 //std::vector<fastjet::PseudoJet> jets_incl_sorted = fastjet::sorted_by_pt(jets_incl);
872 for (Int_t i = 0; i < njets; i++) {
873 if (jet.Pt() >= jets_incl[i].perp())
875 if (jets_incl[i].eta() < fJetMinEta || jets_incl[i].eta() > fJetMaxEta || jets_incl[i].phi() < fJetMinPhi || jets_incl[i].phi() > fJetMaxPhi)
877 jet.SetPxPyPzE(jets_incl[i].px(), jets_incl[i].py(), jets_incl[i].pz(), jets_incl[i].E());