* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* *
- * Permission to use, copy, modify and distribute this software and its *
+ * Permission to usec, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
#include "AliJetReader.h"
#include "AliJetReaderHeader.h"
-#include "AliJet.h"
#include "AliAODJet.h"
#include "AliAODEvent.h"
#include "AliJetFinder.h"
AliCdfJetFinder::AliCdfJetFinder():
AliJetFinder(),
fHistos(0),
- fDebug(0),
fFromAod(0),
fAODwrite(0),
fAODtracksWrite(0),
+ fAnalyseJets(0),
fRefArr (NULL),
fNJets(-9999),
fNPart(-9999),
//______________________________________________________________________________
AliCdfJetFinder::~AliCdfJetFinder()
{
+ Clean();
// destructor
}
// * Go to the next highest PT particle (not already included in a jet) and include in the "jet" all particles
// (not already included in a jet) within the radius R =0.7.
// * Continue until all particles are in a "jet".
-
+ if (fDebug) { printf("AliCDJetfinder::FindJets() %d \n", __LINE__ ); }
AliCdfJetHeader *header = (AliCdfJetHeader*)fHeader;
if (header)
{
- fDebug = header->IsDebugCDF();
+ fDebug = header->GetDebug();
fAODwrite = header->IsAODwrite() ; // write jets to AOD
fAODtracksWrite = header->IsAODtracksWrite() ; // write jet tracks to AOD
fRadius = header->GetRadius(); // get Radius from jet finder header
InitData();
-if (!fNPart) { if (fDebug) {cout << "entries = 0 ; Event empty !!!" << endl ;} return; } // if event empty then exit
-
-FindCones();
-
-ComputeConesWeight();
-
-if (fAODwrite) { cout << "Writing AOD" << endl ; WriteJets(); }
-
-AnalizeJets();
-
-Clean();
+ if (!fNPart) {
+ if (fDebug) {
+ cout << "entries = 0 ; Event empty !!!" << endl ;
+ }
+ // no need to call clean, InitData does not
+ // create pointers if npart == 0
+ return;
+ } // if event empty then exit
+
+ FindCones();
+
+ ComputeConesWeight();
+
+ if (fAODwrite) {
+ if(fDebug)cout << "Writing AOD" << endl ;
+ WriteJets();
+ }
+
+ if (fAnalyseJets) AnalizeJets();
+
+ Clean();
}
// initialisation of variables and data members
TClonesArray * vectArray = fReader->GetMomentumArray() ;
- if ( vectArray == 0 ) { cout << "Could not get the momentum array" << endl; return; }
+ if ( vectArray == 0 ) { cout << "Could not get the momentum array" << endl; return; }
fNPart = vectArray->GetEntries() ; // n particles in this event;
if ( fNPart == 0 ) { return ; } // if event empty then exit
- fJets->SetNinput ( fNPart ) ; // number of input objects
-
fVectParticle = new varContainer* [fNPart]; // container for Particles
fPtArray = new Double_t [fNPart] ; // momentum array
if (fDebug) { cout << "\n\n\n\n\n\n------------------\nBegin Event Analysis\n------------------\n\n" << endl ;}
- cout << "fNPart = " << fNPart << endl;
+ if(fDebug)cout << "fNPart = " << fNPart << endl;
TBits lkupTable ( fNPart ) ; // bit container ; 1-to-1 corespondence with fIdxArray
{ // loop over particles in event until all flags are set
UInt_t firstnonflagged = lkupTable.FirstNullBit() ; // set the index to the first NON flagged bit ; less conditions
- cout << "\n\nfirst_non_flagged : " << firstnonflagged << endl;
+ if(fDebug)cout << "\n\nfirst_non_flagged : " << firstnonflagged << endl;
++fNJets; // incrementing the jet counter
if (fDebug) { printf("JET %d \n", fNJets); }
en = TMath::Sqrt ( px * px + py * py + pz * pz );
AliAODJet jet (px, py, pz, en);
- AddJet(jet);
+
if (fDebug) jet.Print("");
if (fFromAod && fAODtracksWrite)
{
- for ( Int_t jetTrack = 0; jetTrack < fNPart; jetTrack++ )
- { if ( fVectParticle[jetTrack]->njet == jetnr ) { jet.AddTrack(fRefArr->At(jetTrack)) ; } }
+ for ( Int_t jetTrack = 0; jetTrack < fNPart; jetTrack++ )
+ { if ( fVectParticle[jetTrack]->njet == jetnr ) { jet.AddTrack(fRefArr->At(jetTrack)) ; } }
}
- // tracks REFs written in AOD
+ // tracks REFs written in AOD
+ AddJet(jet);
}
//jets vector parsed and written to AOD
{
// analyzing of jets and filling of histograms
+ const Double_t kPI = TMath::Pi();
+
//persistent pointer to histo20
TH1F *hR = (TH1F*)fHistos->FindObject("histo20");
void AliCdfJetFinder::Clean()
{
// CLEANING SECTION
- delete [] fVectParticle;
- delete [] fVectJet;
- delete [] fPtArray;
- delete [] fIdxArray;
+ for ( Int_t i = 0 ; i < fNPart ; i++ ){
+ delete fVectParticle[i];
+ fVectParticle[i] = 0;
+ }
+ delete [] fVectParticle;fVectParticle = 0;
+
+ for ( Int_t i = 0 ; i < fNJets ; i++ ){
+ delete fVectJet[i];
+ fVectJet[i] = 0;
+ }
+ delete [] fVectJet;fVectJet = 0;
+
+ delete [] fPtArray;fPtArray = 0;
+ delete [] fIdxArray;fIdxArray = 0;
Reset();
}