-// $Id$
//
// Emcal base analysis task.
//
fTrackPtCut(0),
fMinNTrack(0),
fUseAliAnaUtils(kFALSE),
+ fRejectPileup(kFALSE),
+ fTklVsClusSPDCut(kFALSE),
fAliAnalysisUtils(0x0),
fOffTrigger(AliVEvent::kAny),
fTrigClass(),
fMinMCLabel(0),
fMCLabelShift(0),
fNcentBins(4),
+ fNeedEmcalGeom(kTRUE),
+ fIsEsd(kFALSE),
fGeom(0),
fTracks(0),
fCaloClusters(0),
fPtHard(0),
fPtHardBin(0),
fNTrials(0),
+ fXsection(0),
fParticleCollArray(),
fClusterCollArray(),
- fMainTriggerPatch(0x0),
- fTriggerType(kND),
+ fTriggers(0),
fOutput(0),
+ fHistEventCount(0),
fHistTrialsAfterSel(0),
fHistEventsAfterSel(0),
+ fHistXsectionAfterSel(0),
fHistTrials(0),
- fHistXsection(0),
fHistEvents(0),
+ fHistXsection(0),
fHistPtHard(0),
fHistCentrality(0),
fHistZVertex(0),
fParticleCollArray.SetOwner(kTRUE);
fClusterCollArray.SetOwner(kTRUE);
-
}
//________________________________________________________________________
fTrackPtCut(0),
fMinNTrack(0),
fUseAliAnaUtils(kFALSE),
+ fRejectPileup(kFALSE),
+ fTklVsClusSPDCut(kFALSE),
fAliAnalysisUtils(0x0),
fOffTrigger(AliVEvent::kAny),
fTrigClass(),
fMinMCLabel(0),
fMCLabelShift(0),
fNcentBins(4),
+ fNeedEmcalGeom(kTRUE),
+ fIsEsd(kFALSE),
fGeom(0),
fTracks(0),
fCaloClusters(0),
fPtHard(0),
fPtHardBin(0),
fNTrials(0),
+ fXsection(0),
fParticleCollArray(),
fClusterCollArray(),
- fMainTriggerPatch(0x0),
- fTriggerType(kND),
+ fTriggers(0),
fOutput(0),
+ fHistEventCount(0),
fHistTrialsAfterSel(0),
fHistEventsAfterSel(0),
+ fHistXsectionAfterSel(0),
fHistTrials(0),
- fHistXsection(0),
fHistEvents(0),
+ fHistXsection(0),
fHistPtHard(0),
fHistCentrality(0),
fHistZVertex(0),
void AliAnalysisTaskEmcal::UserCreateOutputObjects()
{
// Create user output.
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (mgr) {
+ AliVEventHandler *evhand = mgr->GetInputEventHandler();
+ if (evhand) {
+ if (evhand->InheritsFrom("AliESDInputHandler")) {
+ fIsEsd = kTRUE;
+ }
+ else {
+ fIsEsd = kFALSE;
+ }
+ }
+ else {
+ AliError("Event handler not found!");
+ }
+ }
+ else {
+ AliError("Analysis manager not found!");
+ }
+
if (!fCreateHisto)
return;
fHistEventsAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
fHistEventsAfterSel->GetYaxis()->SetTitle("total events");
fOutput->Add(fHistEventsAfterSel);
+
+ fHistXsectionAfterSel = new TProfile("fHistXsectionAfterSel", "fHistXsectionAfterSel", 11, 0, 11);
+ fHistXsectionAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
+ fHistXsectionAfterSel->GetYaxis()->SetTitle("xsection");
+ fOutput->Add(fHistXsectionAfterSel);
fHistTrials = new TH1F("fHistTrials", "fHistTrials", 11, 0, 11);
fHistTrials->GetXaxis()->SetTitle("p_{T} hard bin");
fHistTrials->GetYaxis()->SetTitle("trials");
fOutput->Add(fHistTrials);
- fHistXsection = new TProfile("fHistXsection", "fHistXsection", 11, 0, 11);
- fHistXsection->GetXaxis()->SetTitle("p_{T} hard bin");
- fHistXsection->GetYaxis()->SetTitle("xsection");
- fOutput->Add(fHistXsection);
-
fHistEvents = new TH1F("fHistEvents", "fHistEvents", 11, 0, 11);
fHistEvents->GetXaxis()->SetTitle("p_{T} hard bin");
fHistEvents->GetYaxis()->SetTitle("total events");
fOutput->Add(fHistEvents);
+ fHistXsection = new TProfile("fHistXsection", "fHistXsection", 11, 0, 11);
+ fHistXsection->GetXaxis()->SetTitle("p_{T} hard bin");
+ fHistXsection->GetYaxis()->SetTitle("xsection");
+ fOutput->Add(fHistXsection);
+
const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234};
const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000};
fHistEventPlane->GetYaxis()->SetTitle("counts");
fOutput->Add(fHistEventPlane);
- fHistEventRejection = new TH1I("fHistEventRejection","Reasons to reject event",20,0,20);
- fHistEventRejection->Fill("PhysSel",0);
- fHistEventRejection->Fill("trigger",0);
- fHistEventRejection->Fill("trigTypeSel",0);
- fHistEventRejection->Fill("Cent",0);
- fHistEventRejection->Fill("vertex contr.",0);
- fHistEventRejection->Fill("Vz",0);
- fHistEventRejection->Fill("trackInEmcal",0);
- fHistEventRejection->Fill("minNTrack",0);
- fHistEventRejection->Fill("VtxSel2013pA",0);
- fHistEventRejection->Fill("PileUp",0);
- fHistEventRejection->Fill("EvtPlane",0);
- fHistEventRejection->Fill("SelPtHardBin",0);
+ fHistEventRejection = new TH1F("fHistEventRejection","Reasons to reject event",20,0,20);
+ fHistEventRejection->GetXaxis()->SetBinLabel(1,"PhysSel");
+ fHistEventRejection->GetXaxis()->SetBinLabel(2,"trigger");
+ fHistEventRejection->GetXaxis()->SetBinLabel(3,"trigTypeSel");
+ fHistEventRejection->GetXaxis()->SetBinLabel(4,"Cent");
+ fHistEventRejection->GetXaxis()->SetBinLabel(5,"vertex contr.");
+ fHistEventRejection->GetXaxis()->SetBinLabel(6,"Vz");
+ fHistEventRejection->GetXaxis()->SetBinLabel(7,"trackInEmcal");
+ fHistEventRejection->GetXaxis()->SetBinLabel(8,"minNTrack");
+ fHistEventRejection->GetXaxis()->SetBinLabel(9,"VtxSel2013pA");
+ fHistEventRejection->GetXaxis()->SetBinLabel(10,"PileUp");
+ fHistEventRejection->GetXaxis()->SetBinLabel(11,"EvtPlane");
+ fHistEventRejection->GetXaxis()->SetBinLabel(12,"SelPtHardBin");
+ fHistEventRejection->GetXaxis()->SetBinLabel(13,"Bkg evt");
fHistEventRejection->GetYaxis()->SetTitle("counts");
fOutput->Add(fHistEventRejection);
+ fHistEventCount = new TH1F("fHistEventCount","fHistEventCount",2,0,2);
+ fHistEventCount->GetXaxis()->SetBinLabel(1,"Accepted");
+ fHistEventCount->GetXaxis()->SetBinLabel(2,"Rejected");
+ fHistEventCount->GetYaxis()->SetTitle("counts");
+ fOutput->Add(fHistEventCount);
+
PostData(1, fOutput);
}
Bool_t AliAnalysisTaskEmcal::FillGeneralHistograms()
{
if (fIsPythia) {
- fHistEventsAfterSel->SetBinContent(fPtHardBin + 1, fHistEventsAfterSel->GetBinContent(fPtHardBin + 1) + 1);
- fHistTrialsAfterSel->SetBinContent(fPtHardBin + 1, fHistTrialsAfterSel->GetBinContent(fPtHardBin + 1) + fNTrials);
+ fHistEventsAfterSel->Fill(fPtHardBin, 1);
+ fHistTrialsAfterSel->Fill(fPtHardBin, fNTrials);
+ fHistXsectionAfterSel->Fill(fPtHardBin, fXsection);
fHistPtHard->Fill(fPtHard);
}
{
// Main loop, called for each event.
- fMainTriggerPatch = NULL;
-
if (!fInitialized)
ExecOnce();
if (!RetrieveEventObjects())
return;
- if (!IsEventSelected())
+ if (IsEventSelected()) {
+ if (fGeneralHistograms) fHistEventCount->Fill("Accepted",1);
+ }
+ else {
+ if (fGeneralHistograms) fHistEventCount->Fill("Rejected",1);
return;
+ }
if (fGeneralHistograms && fCreateHisto) {
if (!FillGeneralHistograms())
return kFALSE;
AliClusterContainer *cont = GetClusterContainer(c);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s:Container %d not found",GetName(),c));
return 0;
}
return cont->AcceptCluster(clus);
-
}
//________________________________________________________________________
return kFALSE;
AliParticleContainer *cont = GetParticleContainer(c);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s:Container %d not found",GetName(),c));
return 0;
}
fXsec = 0;
fTrials = 1;
- if(file.Contains(".zip#")){
+ if (file.Contains(".zip#")) {
Ssiz_t pos1 = file.Index("root_archive",12,0,TString::kExact);
Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
Ssiz_t pos2 = file.Index(".root",5,TString::kExact);
file.Replace(pos+1,pos2-pos1,"");
- }
- else {
+ } else {
// not an archive take the basename....
file.ReplaceAll(gSystem->BaseName(file.Data()),"");
}
// problem that we cannot really test the existance of a file in a archive so we have to live with open error message from root
TFile *fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec.root"));
- if(!fxsec){
+ if (!fxsec) {
// next trial fetch the histgram file
fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root"));
- if(!fxsec){
+ if (!fxsec) {
// not a severe condition but inciate that we have no information
return kFALSE;
- }
- else{
+ } else {
// find the tlist we want to be independtent of the name so use the Tkey
TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
- if(!key){
+ if (!key) {
fxsec->Close();
return kFALSE;
}
TList *list = dynamic_cast<TList*>(key->ReadObj());
- if(!list){
+ if (!list) {
fxsec->Close();
return kFALSE;
}
fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
fxsec->Close();
}
- } // no tree pyxsec.root
- else {
+ } else { // no tree pyxsec.root
TTree *xtree = (TTree*)fxsec->Get("Xsection");
- if(!xtree){
+ if (!xtree) {
fxsec->Close();
return kFALSE;
}
//________________________________________________________________________
Bool_t AliAnalysisTaskEmcal::UserNotify()
{
+ // Called when file changes.
+
if (!fIsPythia || !fGeneralHistograms || !fCreateHisto)
return kTRUE;
return kFALSE;
}
- Float_t xsection = 0;
- Float_t trials = 0;
- Int_t pthard = 0;
+ Float_t xsection = 0;
+ Float_t trials = 0;
+ Int_t pthardbin = 0;
TFile *curfile = tree->GetCurrentFile();
if (!curfile) {
}
TChain *chain = dynamic_cast<TChain*>(tree);
- if (chain)
- tree = chain->GetTree();
+ if (chain) tree = chain->GetTree();
Int_t nevents = tree->GetEntriesFast();
- PythiaInfoFromFile(curfile->GetName(), xsection, trials, pthard);
+ PythiaInfoFromFile(curfile->GetName(), xsection, trials, pthardbin);
- fHistTrials->Fill(pthard, trials);
- fHistXsection->Fill(pthard, xsection);
- fHistEvents->Fill(pthard, nevents);
+ // TODO: Workaround
+ if ((pthardbin < 0) || (pthardbin > 10)) pthardbin = 0;
+
+ fHistTrials->Fill(pthardbin, trials);
+ fHistXsection->Fill(pthardbin, xsection);
+ fHistEvents->Fill(pthardbin, nevents);
return kTRUE;
}
return;
}
- fGeom = AliEMCALGeometry::GetInstance();
- if (!fGeom) {
- AliError(Form("%s: Can not create geometry", GetName()));
- return;
+ if (fNeedEmcalGeom) {
+ fGeom = AliEMCALGeometry::GetInstance();
+ if (!fGeom) {
+ AliError(Form("%s: Can not create geometry", GetName()));
+ return;
+ }
}
+
if (fEventPlaneVsEmcal >= 0) {
- Double_t ep = (fGeom->GetArm1PhiMax() + fGeom->GetArm1PhiMin()) / 2 * TMath::DegToRad() + fEventPlaneVsEmcal - TMath::Pi();
- fMinEventPlane = ep - TMath::Pi() / 4;
- fMaxEventPlane = ep + TMath::Pi() / 4;
+ if (fGeom) {
+ Double_t ep = (fGeom->GetArm1PhiMax() + fGeom->GetArm1PhiMin()) / 2 * TMath::DegToRad() + fEventPlaneVsEmcal - TMath::Pi();
+ fMinEventPlane = ep - TMath::Pi() / 4;
+ fMaxEventPlane = ep + TMath::Pi() / 4;
+ }
+ else {
+ AliWarning("Could not set event plane limits because EMCal geometry was not loaded!");
+ }
}
//Load all requested track branches - each container knows name already
- for(Int_t i =0; i<fParticleCollArray.GetEntriesFast(); i++) {
+ for (Int_t i =0; i<fParticleCollArray.GetEntriesFast(); i++) {
AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
cont->SetArray(InputEvent());
}
if (fParticleCollArray.GetEntriesFast()>0) {
fTracks = GetParticleArray(0);
- if(!fTracks) {
+ if (!fTracks) {
AliError(Form("%s: Could not retrieve first track branch!", GetName()));
return;
}
}
//Load all requested cluster branches - each container knows name already
- for(Int_t i =0; i<fClusterCollArray.GetEntriesFast(); i++) {
+ for (Int_t i =0; i<fClusterCollArray.GetEntriesFast(); i++) {
AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
cont->SetArray(InputEvent());
}
- if(fClusterCollArray.GetEntriesFast()>0) {
+ if (fClusterCollArray.GetEntriesFast()>0) {
fCaloClusters = GetClusterArray(0);
- if(!fCaloClusters) {
+ if (!fCaloClusters) {
AliError(Form("%s: Could not retrieve first cluster branch!", GetName()));
return;
}
} else {
Int_t runNumber = InputEvent()->GetRunNumber();
if ((runNumber >= 136851 && runNumber <= 139517) || // LHC10h
- (runNumber >= 166529 && runNumber <= 170593)) // LHC11h
- {
+ (runNumber >= 166529 && runNumber <= 170593)) { // LHC11h
return kAA;
- }
- else if ((runNumber>=188365 && runNumber <= 188366) || // LHC12g
- (runNumber >= 195344 && runNumber <= 196608)) // LHC13b-f
- {
+ } else if ((runNumber>=188365 && runNumber <= 188366) || // LHC12g
+ (runNumber >= 195344 && runNumber <= 196608)) { // LHC13b-f
return kpA;
} else {
return kpp;
}
}
-//_____________________________________________________
-AliAnalysisTaskEmcal::TriggerType AliAnalysisTaskEmcal::GetTriggerType()
+//________________________________________________________________________
+ULong_t AliAnalysisTaskEmcal::GetTriggerList()
{
- // Get trigger type: kND, kJ1, kJ2
-
- if(!fTriggerPatchInfo)
- return kND;
-
+ if (!fTriggerPatchInfo)
+ return 0;
+
//number of patches in event
Int_t nPatch = fTriggerPatchInfo->GetEntries();
//loop over patches to define trigger type of event
+ Int_t nG1 = 0;
+ Int_t nG2 = 0;
Int_t nJ1 = 0;
Int_t nJ2 = 0;
+ Int_t nL0 = 0;
AliEmcalTriggerPatchInfo *patch;
- for(Int_t iPatch = 0; iPatch < nPatch; iPatch++ ){
+ for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
patch = (AliEmcalTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
- if(patch->IsJetHigh()) nJ1++;
- if(patch->IsJetLow()) nJ2++;
+ if (patch->IsGammaHigh()) nG1++;
+ if (patch->IsGammaLow()) nG2++;
+ if (patch->IsJetHigh()) nJ1++;
+ if (patch->IsJetLow()) nJ2++;
+ if (patch->IsLevel0()) nL0++;
}
- if(nJ1>0)
- return kJ1;
- else if(nJ2>0)
- return kJ2;
- else
- return kND;
-
+ AliDebug(2, "Patch summary: ");
+ AliDebug(2, Form("Number of patches: %d", nPatch));
+ AliDebug(2, Form("Jet: low[%d], high[%d]" ,nJ2, nJ1));
+ AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
+
+ ULong_t triggers(0);
+ if (nL0>0) SETBIT(triggers, kL0);
+ if (nG1>0) SETBIT(triggers, kG1);
+ if (nG2>0) SETBIT(triggers, kG2);
+ if (nJ1>0) SETBIT(triggers, kJ1);
+ if (nJ2>0) SETBIT(triggers, kJ2);
+ return triggers;
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskEmcal::HasTriggerType(TriggerType trigger)
+{
+ // Check if event has a given trigger type
+ if(trigger & kND){
+ return fTriggers == 0;
+ }
+ return TESTBIT(fTriggers, trigger);
}
//________________________________________________________________________
} else {
const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
if (aev) {
- res = aev->GetHeader()->GetOfflineTrigger();
+ res = ((AliVAODHeader*)aev->GetHeader())->GetOfflineTrigger();
}
}
if ((res & fOffTrigger) == 0) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("PhysSel",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("PhysSel",1);
return kFALSE;
}
}
}
}
if (!fired.Contains("-B-")) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("trigger",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
return kFALSE;
}
TObjArray *arr = fTrigClass.Tokenize("|");
if (!arr) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("trigger",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
return kFALSE;
}
Bool_t match = 0;
}
delete arr;
if (!match) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("trigger",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
return kFALSE;
}
}
if (fTriggerTypeSel != kND) {
- if(fTriggerType != fTriggerTypeSel) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("trigTypeSel",1);
+ if (!HasTriggerType(fTriggerTypeSel)) {
+ if (fGeneralHistograms) fHistEventRejection->Fill("trigTypeSel",1);
return kFALSE;
}
}
-
if ((fMinCent != -999) && (fMaxCent != -999)) {
if (fCent<fMinCent || fCent>fMaxCent) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("Cent",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("Cent",1);
+ return kFALSE;
+ }
+ }
+
+ if (fUseAliAnaUtils) {
+ if (!fAliAnalysisUtils)
+ fAliAnalysisUtils = new AliAnalysisUtils();
+ fAliAnalysisUtils->SetMinVtxContr(2);
+ fAliAnalysisUtils->SetMaxVtxZ(999);
+ if(fMinVz<-10.) fMinVz = -10.;
+ if(fMinVz>10.) fMaxVz = 10.;
+
+ if (!fAliAnalysisUtils->IsVertexSelected2013pA(InputEvent())) {
+ if (fGeneralHistograms) fHistEventRejection->Fill("VtxSel2013pA",1);
+ return kFALSE;
+ }
+
+ if (fRejectPileup && fAliAnalysisUtils->IsPileUpEvent(InputEvent())) {
+ if (fGeneralHistograms) fHistEventRejection->Fill("PileUp",1);
+ return kFALSE;
+ }
+
+ if(fTklVsClusSPDCut && fAliAnalysisUtils->IsSPDClusterVsTrackletBG(InputEvent())) {
+ if (fGeneralHistograms) fHistEventRejection->Fill("Bkg evt",1);
return kFALSE;
}
}
if ((fMinVz != -999) && (fMaxVz != -999)) {
if (fNVertCont == 0 ) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("vertex contr.",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("vertex contr.",1);
return kFALSE;
}
Double_t vz = fVertex[2];
if (vz<fMinVz || vz>fMaxVz) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("Vz",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("Vz",1);
return kFALSE;
}
}
Int_t ntracks = GetNParticles(0);
for (Int_t i = 0; i < ntracks; i++) {
AliVParticle *track = GetAcceptParticleFromArray(i,0);
- if(!track)
+ if (!track)
continue;
Double_t phiMin = fGeom->GetArm1PhiMin() * TMath::DegToRad();
Double_t phiMax = fGeom->GetArm1PhiMax() * TMath::DegToRad();
Int_t runNumber = InputEvent()->GetRunNumber();
- if(runNumber>=177295 && runNumber<=197470) { //small SM masked in 2012 and 2013
+ if (runNumber>=177295 && runNumber<=197470) { //small SM masked in 2012 and 2013
phiMin = 1.4;
phiMax = TMath::Pi();
}
}
}
if (!trackInEmcalOk) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("trackInEmcal",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("trackInEmcal",1);
return kFALSE;
}
}
Int_t ntracks = GetNParticles(0);
for (Int_t i = 0; i < ntracks; i++) {
AliVParticle *track = GetAcceptParticleFromArray(i,0);
- if(!track)
+ if (!track)
continue;
if (track->Pt() > fTrackPtCut) {
nTracksAcc++;
- if(nTracksAcc>=fMinNTrack)
+ if (nTracksAcc>=fMinNTrack)
break;
}
}
if (nTracksAcc<fMinNTrack) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("minNTrack",1);
- return kFALSE;
- }
- }
-
- if(fUseAliAnaUtils) {
- if(!fAliAnalysisUtils)
- fAliAnalysisUtils = new AliAnalysisUtils();
- fAliAnalysisUtils->SetMinVtxContr(2);
- fAliAnalysisUtils->SetMaxVtxZ(10.);
-
- if(!fAliAnalysisUtils->IsVertexSelected2013pA(InputEvent())) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("VtxSel2013pA",1);
- return kFALSE;
- }
-
- if(fAliAnalysisUtils->IsPileUpEvent(InputEvent())) {
- fHistEventRejection->Fill("PileUp",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("minNTrack",1);
return kFALSE;
}
}
!(fEPV0 + TMath::Pi() > fMinEventPlane && fEPV0 + TMath::Pi() <= fMaxEventPlane) &&
!(fEPV0 - TMath::Pi() > fMinEventPlane && fEPV0 - TMath::Pi() <= fMaxEventPlane))
{
- if (fGeneralHistograms)
- fHistEventRejection->Fill("EvtPlane",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("EvtPlane",1);
return kFALSE;
}
if (fSelectPtHardBin != -999 && fSelectPtHardBin != fPtHardBin) {
- if (fGeneralHistograms)
- fHistEventRejection->Fill("SelPtHardBin",1);
+ if (fGeneralHistograms) fHistEventRejection->Fill("SelPtHardBin",1);
return kFALSE;
}
-
+
return kTRUE;
}
AliCentrality *aliCent = InputEvent()->GetCentrality();
if (aliCent) {
fCent = aliCent->GetCentralityPercentile(fCentEst.Data());
- if(fNcentBins==4) {
+ if (fNcentBins==4) {
if (fCent >= 0 && fCent < 10) fCentBin = 0;
else if (fCent >= 10 && fCent < 30) fCentBin = 1;
else if (fCent >= 30 && fCent < 50) fCentBin = 2;
AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
fCentBin = fNcentBins-1;
}
- }
- else {
+ } else {
Double_t centWidth = (fMaxCent-fMinCent)/(Double_t)fNcentBins;
- fCentBin = TMath::FloorNint(fCent/centWidth);
- if(fCentBin>=fNcentBins) {
+ if(centWidth>0.)
+ fCentBin = TMath::FloorNint(fCent/centWidth);
+ else
+ fCentBin = 0;
+ if (fCentBin>=fNcentBins) {
AliWarning(Form("%s: fCentBin too large: cent = %f fCentBin = %d. Assuming 99", GetName(),fCent,fCentBin));
fCentBin = fNcentBins-1;
}
}
} else {
AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
- fCentBin = 3;
+ fCentBin = fNcentBins-1;
}
AliEventplane *aliEP = InputEvent()->GetEventplane();
if (aliEP) {
AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
if (aodMCH) {
- for(UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
+ for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
if (fPythiaHeader) break;
}
if (fPythiaHeader) {
fPtHard = fPythiaHeader->GetPtHard();
-
+
const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234};
const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000};
for (fPtHardBin = 0; fPtHardBin < 11; fPtHardBin++) {
if (fPtHard >= ptHardLo[fPtHardBin] && fPtHard < ptHardHi[fPtHardBin])
break;
}
-
+
+ fXsection = fPythiaHeader->GetXsection();
fNTrials = fPythiaHeader->Trials();
}
}
- fTriggerType = GetTriggerType();
+ fTriggers = GetTriggerList();
return kTRUE;
}
//________________________________________________________________________
-AliParticleContainer* AliAnalysisTaskEmcal::AddParticleContainer(const char *n) {
-
+AliParticleContainer* AliAnalysisTaskEmcal::AddParticleContainer(const char *n)
+{
// Add particle container
// will be called in AddTask macro
TString tmp = TString(n);
- if(tmp.IsNull()) return 0;
+ if (tmp.IsNull()) return 0;
AliParticleContainer *cont = 0x0;
cont = new AliParticleContainer();
}
//________________________________________________________________________
-AliClusterContainer* AliAnalysisTaskEmcal::AddClusterContainer(const char *n) {
-
+AliClusterContainer* AliAnalysisTaskEmcal::AddClusterContainer(const char *n)
+{
// Add cluster container
// will be called in AddTask macro
TString tmp = TString(n);
- if(tmp.IsNull()) return 0;
+ if (tmp.IsNull()) return 0;
AliClusterContainer *cont = 0x0;
cont = new AliClusterContainer();
}
//________________________________________________________________________
-AliParticleContainer* AliAnalysisTaskEmcal::GetParticleContainer(Int_t i) const {
+AliParticleContainer* AliAnalysisTaskEmcal::GetParticleContainer(Int_t i) const
+{
// Get i^th particle container
- if(i<0 || i>fParticleCollArray.GetEntriesFast()) return 0;
+ if (i<0 || i>fParticleCollArray.GetEntriesFast()) return 0;
AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
return cont;
}
//________________________________________________________________________
-AliClusterContainer* AliAnalysisTaskEmcal::GetClusterContainer(Int_t i) const {
+AliClusterContainer* AliAnalysisTaskEmcal::GetClusterContainer(Int_t i) const
+{
// Get i^th cluster container
- if(i<0 || i>fClusterCollArray.GetEntriesFast()) return 0;
+ if (i<0 || i>fClusterCollArray.GetEntriesFast()) return 0;
AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
return cont;
}
//________________________________________________________________________
-AliParticleContainer* AliAnalysisTaskEmcal::GetParticleContainer(const char *name) const {
+AliParticleContainer* AliAnalysisTaskEmcal::GetParticleContainer(const char *name) const
+{
// Get particle container with name
AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.FindObject(name));
}
//________________________________________________________________________
-AliClusterContainer* AliAnalysisTaskEmcal::GetClusterContainer(const char *name) const {
+AliClusterContainer* AliAnalysisTaskEmcal::GetClusterContainer(const char *name) const
+{
// Get cluster container with name
AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.FindObject(name));
}
//________________________________________________________________________
-TClonesArray* AliAnalysisTaskEmcal::GetParticleArray(Int_t i) const {
+TClonesArray* AliAnalysisTaskEmcal::GetParticleArray(Int_t i) const
+{
// Get i^th TClonesArray with AliVParticle
AliParticleContainer *cont = GetParticleContainer(i);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s: Particle container %d not found",GetName(),i));
return 0;
}
}
//________________________________________________________________________
-TClonesArray* AliAnalysisTaskEmcal::GetClusterArray(Int_t i) const {
+TClonesArray* AliAnalysisTaskEmcal::GetClusterArray(Int_t i) const
+{
// Get i^th TClonesArray with AliVCluster
AliClusterContainer *cont = GetClusterContainer(i);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s:Cluster container %d not found",GetName(),i));
return 0;
}
}
//________________________________________________________________________
-AliVParticle* AliAnalysisTaskEmcal::GetAcceptParticleFromArray(Int_t p, Int_t c) const {
+AliVParticle* AliAnalysisTaskEmcal::GetAcceptParticleFromArray(Int_t p, Int_t c) const
+{
// Get particle p if accepted from container c
// If particle not accepted return 0
AliParticleContainer *cont = GetParticleContainer(c);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s: Particle container %d not found",GetName(),c));
return 0;
}
}
//________________________________________________________________________
-AliVCluster* AliAnalysisTaskEmcal::GetAcceptClusterFromArray(Int_t cl, Int_t c) const {
+AliVCluster* AliAnalysisTaskEmcal::GetAcceptClusterFromArray(Int_t cl, Int_t c) const
+{
// Get particle p if accepted from container c
// If particle not accepted return 0
AliClusterContainer *cont = GetClusterContainer(c);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s: Cluster container %d not found",GetName(),c));
return 0;
}
}
//________________________________________________________________________
-Int_t AliAnalysisTaskEmcal::GetNParticles(Int_t i) const {
+Int_t AliAnalysisTaskEmcal::GetNParticles(Int_t i) const
+{
// Get number of entries in particle array i
AliParticleContainer *cont = GetParticleContainer(i);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s: Particle container %d not found",GetName(),i));
return 0;
}
}
//________________________________________________________________________
-Int_t AliAnalysisTaskEmcal::GetNClusters(Int_t i) const {
+Int_t AliAnalysisTaskEmcal::GetNClusters(Int_t i) const
+{
// Get number of entries in cluster array i
AliClusterContainer *cont = GetClusterContainer(i);
- if(!cont) {
+ if (!cont) {
AliError(Form("%s: Cluster container %d not found",GetName(),i));
return 0;
}
}
//________________________________________________________________________
-AliEmcalTriggerPatchInfo* AliAnalysisTaskEmcal::GetMainTriggerPatch() {
- //get main trigger match; if not known yet, look for it and cache
-
- if(fMainTriggerPatch)
- return fMainTriggerPatch;
+AliEmcalTriggerPatchInfo* AliAnalysisTaskEmcal::GetMainTriggerPatch(TriggerCategory trigger, Bool_t doSimpleOffline)
+{
+ // Get main trigger match
+ //
+ // For the selection of the main trigger patch, high and low threshold triggers of a given category are grouped
+ // If there are more than 1 main patch of a given trigger category (i.e. different high and low threshold patches),
+ // the highest one according to the ADC value is taken. In case doSimpleOffline is true, then only the patches from
+ // the simple offline trigger are used.
- if(!fTriggerPatchInfo) {
+ if (!fTriggerPatchInfo) {
AliError(Form("%s: fTriggerPatchInfo not available",GetName()));
return 0;
}
//number of patches in event
Int_t nPatch = fTriggerPatchInfo->GetEntries();
- //extract main trigger patch
- AliEmcalTriggerPatchInfo *patch;
- for(Int_t iPatch = 0; iPatch < nPatch; iPatch++ ){
-
+ //extract main trigger patch(es)
+ AliEmcalTriggerPatchInfo *patch(NULL), *selected(NULL);
+ for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
+
patch = (AliEmcalTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
- if( patch->IsMainTrigger() ) {
- fMainTriggerPatch = patch;
- break;
+ if (patch->IsMainTrigger()) {
+ if(doSimpleOffline){
+ if(patch->IsOfflineSimple()){
+ switch(trigger){
+ case kTriggerLevel0:
+ // option not yet implemented in the trigger maker
+ if(patch->IsLevel0()) selected = patch;
+ break;
+ case kTriggerLevel1Jet:
+ if(patch->IsJetHighSimple() || patch->IsJetLowSimple()){
+ if(!selected) selected = patch;
+ else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
+ }
+ break;
+ case kTriggerLevel1Gamma:
+ if(patch->IsGammaHighSimple() || patch->IsGammaLowSimple()){
+ if(!selected) selected = patch;
+ else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
+ }
+ break;
+ default: // Silence compiler warnings
+ AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
+ };
+ }
+ } else { // Not OfflineSimple
+ switch(trigger){
+ case kTriggerLevel0:
+ if(patch->IsLevel0()) selected = patch;
+ break;
+ case kTriggerLevel1Jet:
+ if(patch->IsJetHigh() || patch->IsJetLow()){
+ if(!selected) selected = patch;
+ else if (patch->GetADCAmp() > selected->GetADCAmp())
+ selected = patch;
+ }
+ break;
+ case kTriggerLevel1Gamma:
+ if(patch->IsGammaHigh() || patch->IsGammaLow()){
+ if(!selected) selected = patch;
+ else if (patch->GetADCAmp() > selected->GetADCAmp())
+ selected = patch;
+ }
+ break;
+ default:
+ AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
+ };
+ }
+ }
+ else if ((trigger == kTriggerRecalcJet && patch->IsRecalcJet()) ||
+ (trigger == kTriggerRecalcGamma && patch->IsRecalcGamma())) { // recalculated patches
+ if (doSimpleOffline && patch->IsOfflineSimple()) {
+ if(!selected) selected = patch;
+ else if (patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) // this in fact should not be needed, but we have it in teh other branches as well, so keeping it for compleness
+ selected = patch;
+ }
+ else if (!doSimpleOffline && !patch->IsOfflineSimple()) {
+ if(!selected) selected = patch;
+ else if (patch->GetADCAmp() > selected->GetADCAmp())
+ selected = patch;
+ }
}
}
+ return selected;
+}
- return fMainTriggerPatch;
+//________________________________________________________________________
+void AliAnalysisTaskEmcal::AddObjectToEvent(TObject *obj)
+{
+ // Add object to event
+ if (!(InputEvent()->FindListObject(obj->GetName()))) {
+ InputEvent()->AddObject(obj);
+ } else {
+ AliFatal(Form("%s: Container with name %s already present. Aborting", GetName(), obj->GetName()));
+ }
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array) const
+{
+ Double_t binWidth = (max-min)/n;
+ array[0] = min;
+ for (Int_t i = 1; i <= n; i++) {
+ array[i] = array[i-1]+binWidth;
+ }
+}
+
+//________________________________________________________________________
+Double_t* AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max) const
+{
+ Double_t *array = new Double_t[n+1];
+
+ GenerateFixedBinArray(n, min, max, array);
+
+ return array;
}
+//________________________________________________________________________
+void AliAnalysisTaskEmcal::SetRejectionReasonLabels(TAxis* axis)
+{
+ axis->SetBinLabel(1, "NullObject");
+ axis->SetBinLabel(2, "Pt");
+ axis->SetBinLabel(3, "Acceptance");
+ axis->SetBinLabel(4, "BitMap");
+ axis->SetBinLabel(5, "Bit4");
+ axis->SetBinLabel(6, "Bit5");
+ axis->SetBinLabel(7, "Bit6");
+ axis->SetBinLabel(8, "Bit7");
+ axis->SetBinLabel(9, "MCFlag");
+ axis->SetBinLabel(10, "MCGenerator");
+ axis->SetBinLabel(11, "ChargeCut");
+ axis->SetBinLabel(12, "MinDistanceTPCSectorEdge");
+ axis->SetBinLabel(13, "MinMCLabelAccept");
+ axis->SetBinLabel(14, "IsEMCal");
+ axis->SetBinLabel(15, "Time");
+ axis->SetBinLabel(16, "Energy");
+ axis->SetBinLabel(17, "Bit16");
+ axis->SetBinLabel(18, "Bit17");
+ axis->SetBinLabel(19, "Area");
+ axis->SetBinLabel(20, "AreaEmc");
+ axis->SetBinLabel(21, "ZLeadingCh");
+ axis->SetBinLabel(22, "ZLeadingEmc");
+ axis->SetBinLabel(23, "NEF");
+ axis->SetBinLabel(24, "MinLeadPt");
+ axis->SetBinLabel(25, "MaxTrackPt");
+ axis->SetBinLabel(26, "MaxClusterPt");
+ axis->SetBinLabel(27, "Flavour");
+ axis->SetBinLabel(28, "TagStatus");
+ axis->SetBinLabel(29, "Bit28");
+ axis->SetBinLabel(30, "Bit29");
+ axis->SetBinLabel(31, "Bit30");
+ axis->SetBinLabel(32, "Bit31");
+}