X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=JETAN%2FAliJetFinder.cxx;h=07322fb195d64017d78b33eaa0361a1e527554f8;hb=13ee0d77cb46c85895c87367498b183b15aff843;hp=0e2f500367bafa35b49c0a205c8465a67713dc9e;hpb=9e4cc50d36e1a922f8ef44ee621f59de0b64ba7d;p=u%2Fmrichter%2FAliRoot.git diff --git a/JETAN/AliJetFinder.cxx b/JETAN/AliJetFinder.cxx index 0e2f500367b..07322fb195d 100644 --- a/JETAN/AliJetFinder.cxx +++ b/JETAN/AliJetFinder.cxx @@ -20,105 +20,48 @@ // manages the search for jets // Authors: jgcn@mda.cinvestav.mx // andreas.morsch@cern.ch +// magali.estienne@subatech.in2p3.fr //--------------------------------------------------------------------- #include #include -#include #include "AliJetFinder.h" -#include "AliJet.h" #include "AliAODJet.h" -#include "AliJetReader.h" -#include "AliJetReaderHeader.h" -#include "AliJetControlPlots.h" -#include "AliLeading.h" #include "AliAODEvent.h" +#include "AliJetUnitArray.h" +#include "AliJetReaderHeader.h" +#include "AliJetHeader.h" +#include "AliJetReader.h" +#include "AliAODJetEventBackground.h" ClassImp(AliJetFinder) AliJetFinder::AliJetFinder(): - fTreeJ(0), - fPlotMode(kFALSE), - fJets(0), - fGenJets(0), - fLeading(0), fReader(0x0), fHeader(0x0), fAODjets(0x0), fNAODjets(0), - fPlots(0x0), - fOut(0x0) - + fAODEvBkg(0), + fDebug(0) { + // // Constructor - fJets = new AliJet(); - fGenJets = new AliJet(); - fLeading = new AliLeading(); + // fAODjets = 0; } //////////////////////////////////////////////////////////////////////// - AliJetFinder::~AliJetFinder() { - // destructor - // here reset and delete jets - fJets->ClearJets(); - delete fJets; - fGenJets->ClearJets(); - delete fGenJets; - // close file - if (fOut) { - fOut->Close(); - fOut->Delete(); - } - delete fOut; - // reset and delete control plots - if (fPlots) delete fPlots; + // + // Destructor + // } -//////////////////////////////////////////////////////////////////////// -void AliJetFinder::SetOutputFile(const char */*name*/) -{ - // opens output file - // fOut = new TFile(name,"recreate"); -} //////////////////////////////////////////////////////////////////////// - -void AliJetFinder::PrintJets() -{ - // Print jet information - cout << " Jets found with jet algorithm:" << endl; - fJets->PrintJets(); - cout << " Jets found by pythia:" << endl; - fGenJets->PrintJets(); -} - -//////////////////////////////////////////////////////////////////////// - -void AliJetFinder::SetPlotMode(Bool_t b) -{ - // Sets the plotting mode - fPlotMode=b; - if (b && !fPlots) fPlots = new AliJetControlPlots(); -} - -//////////////////////////////////////////////////////////////////////// -TTree* AliJetFinder::MakeTreeJ(char* name) -{ - // Create the tree for reconstructed jets - fTreeJ = new TTree(name, "AliJet"); - fTreeJ->Branch("FoundJet", &fJets, 1000); - fTreeJ->Branch("GenJet", &fGenJets,1000); - fTreeJ->Branch("LeadingPart",&fLeading,1000); - return fTreeJ; -} - -//////////////////////////////////////////////////////////////////////// - void AliJetFinder::WriteRHeaderToFile() { // write reader header @@ -126,74 +69,15 @@ void AliJetFinder::WriteRHeaderToFile() rh->Write(); } -//////////////////////////////////////////////////////////////////////// - - -void AliJetFinder::Run() -{ - // Do some initialization - Init(); - // connect files - fReader->OpenInputFiles(); - - // write headers - WriteHeaders(); - // loop over events - Int_t nFirst, nLast, option, debug, arrayInitialised; - nFirst = fReader->GetReaderHeader()->GetFirstEvent(); - nLast = fReader->GetReaderHeader()->GetLastEvent(); - - option = fReader->GetReaderHeader()->GetDetector(); - debug = fReader->GetReaderHeader()->GetDebug(); - arrayInitialised = fReader->GetArrayInitialised(); - - // loop over events - for (Int_t i=nFirst;iFillMomentumArray(); - fLeading->FindLeading(fReader); - fReader->GetGenJets(fGenJets); - - if (option == 0) { // TPC with fMomentumArray - if(debug > 1) - printf("In FindJetsTPC() routine: find jets with fMomentumArray !!!\n"); - FindJetsTPC(); - } else { - if(debug > 1) printf("In FindJets() routine: find jets with fUnitArray !!!\n"); - FindJets(); - } - if (fOut) { - fOut->cd(); - } - - if (fPlots) fPlots->FillHistos(fJets); - fLeading->Reset(); - fGenJets->ClearJets(); - Reset(); - } - - // write out - if (fPlots) { - fPlots->Normalize(); - fPlots->PlotHistos(); - } - if (fOut) { - fOut->cd(); - fPlots->Write(); - fOut->Close(); - } -} - - -// -// The following methods have been added to allow for event steering from the outside -// +//////////////////////////////////////////////////////////////////////// void AliJetFinder::ConnectTree(TTree* tree, TObject* data) { // Connect the input file fReader->ConnectTree(tree, data); } +//////////////////////////////////////////////////////////////////////// void AliJetFinder::WriteHeaders() { // Write the Headers @@ -203,52 +87,89 @@ void AliJetFinder::WriteHeaders() f->Close(); } - +//////////////////////////////////////////////////////////////////////// Bool_t AliJetFinder::ProcessEvent() { -// -// Process one event -// - Bool_t ok = fReader->FillMomentumArray(); - if (!ok) return kFALSE; - - // Leading particles - fLeading->FindLeading(fReader); - // Jets - FindJets(); - - if (fPlots) fPlots->FillHistos(fJets); - fLeading->Reset(); - fGenJets->ClearJets(); - Reset(); - return kTRUE; + // + // Process one event + // Charged only jets + // + + Bool_t ok = fReader->FillMomentumArray(); + if (!ok) return kFALSE; + // Jets + FindJets(); // V1 + Reset(); + return kTRUE; } -void AliJetFinder::FinishRun() +//////////////////////////////////////////////////////////////////////// +Bool_t AliJetFinder::ProcessEvent2() { - // Finish a run - if (fPlots) { - fPlots->Normalize(); - fPlots->PlotHistos(); - } - - if (fOut) { - fOut->cd(); - if (fPlots) { - fPlots->Write(); - } - fOut->Close(); + // + // Process one event + // Charged only or charged+neutral jets + // + + TRefArray* ref = new TRefArray(); + Bool_t procid = kFALSE; + Bool_t ok = fReader->ExecTasks(procid,ref); + + // Delete reference pointer + if (!ok) {delete ref; return kFALSE;} + // Jets + FindJets(); + + Int_t nEntRef = ref->GetEntries(); + + for(Int_t i=0; iAt(i))->SetUnitTrackID(0); + ((AliJetUnitArray*)ref->At(i))->SetUnitEnergy(0.); + ((AliJetUnitArray*)ref->At(i))->SetUnitCutFlag(kPtSmaller); + ((AliJetUnitArray*)ref->At(i))->SetUnitCutFlag2(kPtSmaller); + ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlag(kBad); + ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlagC(kTRUE,kBad); + ((AliJetUnitArray*)ref->At(i))->SetUnitDetectorFlag(kTpc); + ((AliJetUnitArray*)ref->At(i))->SetUnitFlag(kOutJet); + ((AliJetUnitArray*)ref->At(i))->ClearUnitTrackRef(); + + // Reset process ID + AliJetUnitArray* uA = (AliJetUnitArray*)ref->At(i); + uA->ResetBit(kIsReferenced); + uA->SetUniqueID(0); } + + // Delete the reference pointer + ref->Delete(); + delete ref; + + Reset(); + + return kTRUE; } + void AliJetFinder::AddJet(AliAODJet p) { // Add new jet to the list new ((*fAODjets)[fNAODjets++]) AliAODJet(p); } -void AliJetFinder::ConnectAOD(AliAODEvent* aod) +void AliJetFinder::ConnectAOD(const AliAODEvent* aod) { // Connect to the AOD fAODjets = aod->GetJets(); + fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(AliAODJetEventBackground::StdBranchName())); } + +//////////////////////////////////////////////////////////////////////// +void AliJetFinder::ConnectAODNonStd(AliAODEvent* aod,const char *bname) +{ + + fAODjets = dynamic_cast(aod->FindListObject(bname)); + fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(Form("%s_%s",AliAODJetEventBackground::StdBranchName(),bname))); + // how is this is reset? Cleared? -> by the UserExec!! +} +