#ifndef ALIEMCALJETTASK_H
#define ALIEMCALJETTASK_H
class TClonesArray;
class TObjArray;
class AliVEvent;
class AliEMCALGeometry;
class AliEmcalJetUtility;
class AliFJWrapper;
namespace fastjet {
class PseudoJet;
}
#include "AliLog.h"
#include "AliAnalysisTaskSE.h"
#include "AliFJWrapper.h"
#include "AliAODMCParticle.h"
#include "AliEmcalJet.h"
class AliEmcalJetTask : public AliAnalysisTaskSE {
public:
enum JetType {
kNone=0,
kKT=1<<0,
kAKT=1<<1,
kFullJet=1<<2,
kChargedJet=1<<3,
kNeutralJet=1<<4,
kR020Jet=1<<5,
kR030Jet=1<<6,
kR040Jet=1<<7,
kRX1Jet=1<<8,
kRX2Jet=1<<9,
kRX3Jet=1<<10
};
AliEmcalJetTask();
AliEmcalJetTask(const char *name);
virtual ~AliEmcalJetTask();
void UserCreateOutputObjects();
void UserExec(Option_t* option);
void Terminate(Option_t* ) {;}
void SetAlgo(Int_t a) { if (IsLocked()) return; if (a==0) fJetType |= kKT; else fJetType |= kAKT; }
void SetClusName(const char *n) { if (IsLocked()) return; fCaloName = n ; }
void SetClusLabelRange(Int_t min, Int_t max) { if (IsLocked()) return; fMinLabelClusters = min ; fMaxLabelClusters = max; }
void SetEtaRange(Double_t emi, Double_t ema) { if (IsLocked()) return; fEtaMin = emi ; fEtaMax = ema ; }
void SetGhostArea(Double_t gharea) { if (IsLocked()) return; fGhostArea = gharea; }
void SetJetsName(const char *n) { if (IsLocked()) return; fJetsName = n ; }
void SetJetEtaRange(Double_t emi, Double_t ema) { if (IsLocked()) return; fJetEtaMin = emi ; fJetEtaMax = ema; }
void SetJetPhiRange(Double_t pmi, Double_t pma) { if (IsLocked()) return; fJetPhiMin = pmi ; fJetPhiMax = pma; }
void SetJetType(UInt_t t) { if (IsLocked()) return; fJetType = t ; }
void SetLocked() { fLocked = kTRUE;}
void SetMinJetArea(Double_t a) { if (IsLocked()) return; fMinJetArea = a ; }
void SetMinJetClusPt(Double_t min) { if (IsLocked()) return; fMinJetClusPt = min ; }
void SetMinJetPt(Double_t j) { if (IsLocked()) return; fMinJetPt = j ; }
void SetMinJetTrackPt(Double_t min) { if (IsLocked()) return; fMinJetTrackPt = min ; }
void SetMinMCLabel(Int_t s) { if (IsLocked()) return; fMinMCLabel = s ; }
void SetPhiRange(Double_t pmi, Double_t pma) { if (IsLocked()) return; fPhiMin = pmi ; fPhiMax = pma; }
void SetRecombScheme(Int_t scheme) { if (IsLocked()) return; fRecombScheme = scheme; }
void SetTracksName(const char *n) { if (IsLocked()) return; fTracksName = n ; }
void SetTrackEfficiency(Double_t t) { if (IsLocked()) return; fTrackEfficiency = t ; }
void SetTrackLabelRange(Int_t min, Int_t max) { if (IsLocked()) return; fMinLabelTracks = min ; fMaxLabelTracks = max; }
void SetLegacyMode(Bool_t mode) { if (IsLocked()) return; fLegacyMode = mode ; }
void SetMCFlag(UInt_t m) { if (IsLocked()) return; fMCFlag = m ; }
void SelectHIJING(Bool_t s) { if (IsLocked()) return; if (s) fGeneratorIndex = 0; else fGeneratorIndex = -1; }
void SetGeneratorIndex(Short_t i) { if (IsLocked()) return; fGeneratorIndex = i ; }
AliEmcalJetUtility* AddUtility(AliEmcalJetUtility* utility);
const char* GetClusName() { return fCaloName.Data() ; }
Double_t GetEtaMin() { return fEtaMin ; }
Double_t GetEtaMax() { return fEtaMax ; }
Double_t GetGhostArea() { return fGhostArea ; }
const char* GetJetsName() { return fJetsName.Data() ; }
Double_t GetJetEtaMin() { return fJetEtaMin ; }
Double_t GetJetEtaMax() { return fJetEtaMax ; }
Double_t GetJetPhiMin() { return fJetPhiMin ; }
Double_t GetJetPhiMax() { return fJetPhiMax ; }
UInt_t GetJetType() { return fJetType ; }
Bool_t GetLegacyMode() { return fLegacyMode ; }
Double_t GetMinJetArea() { return fMinJetArea ; }
Double_t GetMinJetClusPt() { return fMinJetClusPt ; }
Double_t GetMinJetPt() { return fMinJetPt ; }
Double_t GetMinJetTrackPt() { return fMinJetTrackPt ; }
Int_t GetMinMCLabel() { return fMinMCLabel ; }
Double_t GetPhiMin() { return fPhiMin ; }
Double_t GetPhiMax() { return fPhiMax ; }
Double_t GetRadius() { return fRadius ; }
Int_t GetRecombScheme() { return fRecombScheme ; }
const char* GetTracksName() { return fTracksName.Data() ; }
Double_t GetTrackEfficiency() { return fTrackEfficiency ; }
AliVEvent* GetEvent() { return fEvent ; }
TClonesArray* GetClusters() { return fClus ; }
TClonesArray* GetTracks() { return fTracks ; }
TClonesArray* GetJets() { return fJets ; }
TObjArray* GetUtilities() { return fUtilities ; }
void FillJetConstituents(AliEmcalJet *jet, std::vector<fastjet::PseudoJet>& constituents, TClonesArray *tracks, TClonesArray *clusters,
std::vector<fastjet::PseudoJet>& constituents_sub, Int_t flag = 0, TClonesArray *particles_sub = 0);
Int_t GetIndexSub(Double_t phi_sub, std::vector<fastjet::PseudoJet>& constituents_unsub);
Bool_t IsLocked()
{
if (fLocked) {
AliFatal("Jet finder task is locked! Changing properties is not allowed.");
return kTRUE;
}
else {
return kFALSE;
}
}
void SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB)
{
if(!fIsPSelSet)
{
fIsPSelSet = kTRUE;
fOfflineTriggerMask = offlineTriggerMask;
}
else
{
AliWarning("Manually setting the event selection for jet finders is not allowed! Using trigger=old_trigger | your_trigger");
fOfflineTriggerMask = fOfflineTriggerMask | offlineTriggerMask;
}
}
void SetRadius(Double_t r)
{
if (IsLocked()) return;
fRadius = r;
if ((fJetType & (kRX1Jet|kRX2Jet|kRX3Jet)) == 0)
AliWarning("Radius value will be ignored if jet type is not set to a user defined radius (kRX1Jet,kRX2Jet,kRX3Jet).");
}
void SetType(Int_t t)
{
if(IsLocked()) return;
if (t==0) fJetType |= kFullJet;
else if (t==1) fJetType |= kChargedJet;
else if (t==2) fJetType |= kNeutralJet;
}
void SelectPhysicalPrimaries(Bool_t s)
{
if(IsLocked()) return;
if (s) fMCFlag |= AliAODMCParticle::kPhysicalPrim;
else fMCFlag &= ~AliAODMCParticle::kPhysicalPrim;
}
protected:
void FindJets();
void FillJetBranch();
Bool_t DoInit();
void InitUtilities();
void PrepareUtilities();
void ExecuteUtilities(AliEmcalJet* jet, Int_t ij);
void TerminateUtilities();
Bool_t GetSortedArray(Int_t indexes[], std::vector<fastjet::PseudoJet> array) const;
TString fTracksName;
TString fCaloName;
TString fJetsName;
UInt_t fJetType;
Int_t fMinLabelTracks;
Int_t fMaxLabelTracks;
Int_t fMinLabelClusters;
Int_t fMaxLabelClusters;
Int_t fMinMCLabel;
Double_t fRadius;
Double_t fMinJetTrackPt;
Double_t fMinJetClusPt;
Double_t fPhiMin;
Double_t fPhiMax;
Double_t fEtaMin;
Double_t fEtaMax;
Double_t fMinJetArea;
Double_t fMinJetPt;
Double_t fJetPhiMin;
Double_t fJetPhiMax;
Double_t fJetEtaMin;
Double_t fJetEtaMax;
Double_t fGhostArea;
Int_t fRecombScheme;
Double_t fTrackEfficiency;
UInt_t fMCFlag;
Short_t fGeneratorIndex;
TObjArray *fUtilities;
Bool_t fLocked;
Bool_t fIsInit;
Bool_t fIsPSelSet;
Bool_t fIsEmcPart;
Bool_t fLegacyMode;
Double_t fVertex[3];
AliEMCALGeometry *fGeom;
TClonesArray *fJets;
AliVEvent *fEvent;
TClonesArray *fTracks;
TClonesArray *fClus;
AliFJWrapper fFastJetWrapper;
private:
AliEmcalJetTask(const AliEmcalJetTask&);
AliEmcalJetTask &operator=(const AliEmcalJetTask&);
ClassDef(AliEmcalJetTask, 17)
};
#endif