#include <TSystem.h>
#include <TInterpreter.h>
#include <TChain.h>
+#include <TFile.h>
#include <TH1.h>
#include "AliAnalysisTaskJets.h"
void AliAnalysisTaskJets::CreateOutputObjects()
{
// Create the output container
+ OpenFile(0);
fTreeJ = fJetFinder->MakeTreeJ("TreeJ");
}
fJetFinder = (AliJetFinder*) gInterpreter->ProcessLine("ConfigJetAnalysis()");
// Initialise Jet Analysis
fJetFinder->Init();
+ // Write header information to local file
+ fJetFinder->WriteHeaders();
}
void AliAnalysisTaskJets::ConnectInputData(Option_t */*option*/)
// Connect the input data
//
if (fDebug > 1) printf("AnalysisTaskJets::ConnectInputData() \n");
- char ** address = (char **)GetBranchAddress(0, "ESD");
+ fChain = (TChain*)GetInputData(0);
+ char ** address = (char **)GetBranchAddress(0, "ESD");
if (address) {
+
+// Branch has been already connected
fESD = (AliESD*)(*address);
}
else {
+// First task taking the branch enables it
fESD = new AliESD();
- SetBranchAddress(0, "ESD", &fESD); // first task taking the branch enables it
+ SetBranchAddress(0, "ESD", &fESD);
}
- fChain = (TChain*)GetInputData(0);
+
fJetFinder->ConnectTree(fChain, fESD);
- fJetFinder->WriteHeaders();
}
void AliAnalysisTaskJets::Exec(Option_t */*option*/)
// Execute analysis for current event
//
Long64_t ientry = fChain->GetReadEntry();
- if (fDebug > 1) printf("Analysing event # %5d \n", (Int_t) ientry);
+ if (fDebug > 1) printf("Analysing event # %5d\n", (Int_t) ientry);
fJetFinder->ProcessEvent(ientry);
PostData(0, fTreeJ);
}
// Terminate analysis
//
if (fDebug > 1) printf("AnalysisJets: Terminate() \n");
-
- if (fJetFinder) fJetFinder->FinishRun();
+ // if (fJetFinder) fJetFinder->FinishRun();
}
TTree* AliJetFinder::MakeTreeJ(char* name)
{
// Create the tree for reconstructed jets
- fOut = new TFile("jets.root","recreate");
- fOut->cd();
fTreeJ = new TTree(name, "AliJet");
fTreeJ->Branch("FoundJet", &fJets, 1000);
fTreeJ->Branch("GenJet", &fGenJets,1000);
void AliJetFinder::WriteRHeaderToFile()
{
// write reader header
- fOut->cd();
- AliJetReaderHeader *rh = fReader->GetReaderHeader();
- rh->Write();
+ AliJetReaderHeader *rh = fReader->GetReaderHeader();
+ rh->Write();
}
////////////////////////////////////////////////////////////////////////
void AliJetFinder::WriteHeaders()
{
// Write the Headers
- if (fOut) {
- fOut->cd();
- WriteRHeaderToFile();
- WriteJHeaderToFile();
- }
+ TFile* f = new TFile("jets_local.root", "recreate");
+ WriteRHeaderToFile();
+ WriteJHeaderToFile();
+ f->Close();
}
//
Int_t debug = fReader->GetReaderHeader()->GetDebug();
if (debug > 0) printf("<<<<< Processing Event %5d >>>>> \n", (Int_t) entry);
+
Bool_t ok = fReader->FillMomentumArray(entry);
if (!ok) return kFALSE;
+
+ // Leading particles
fLeading->FindLeading(fReader);
+ // Jets
FindJets();
- if (fOut) {
- fOut->cd();
- fTreeJ->Fill();
- }
-
+ // Fill the tree
+ fTreeJ->Fill();
+
if (fPlots) fPlots->FillHistos(fJets);
fLeading->Reset();
fGenJets->ClearJets();
// add jets to list
Int_t* idxjets = new Int_t[nj];
Int_t nselectj = 0;
+ printf("Found %d jets \n", nj);
+
for(Int_t kj=0; kj<nj; kj++){
if ((etaJet[kj] > (header->GetJetEtaMax())) ||
(etaJet[kj] < (header->GetJetEtaMin())) ||
void AliUA1JetFinderV1::WriteJHeaderToFile()
{
AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader;
- fOut->cd();
header->Write();
}