AliEMCALJetFinderAlgo::AliEMCALJetFinderAlgo()
{
fDebug =0;
+ fOutputPointer=0;
+ fInputPointer=0;
+ fOutputAllocated=kFALSE;
}
- AliEMCALJetFinderAlgo::~AliEMCALJetFinderAlgo()
+
+AliEMCALJetFinderAlgo::~AliEMCALJetFinderAlgo()
{
+ if (fOutputAllocated)
+ delete fOutputPointer;
+}
+void AliEMCALJetFinderAlgo::SetOutput(AliEMCALJetFinderOutput* output) {
+ if (fOutputAllocated)
+ delete fOutputPointer;
+ fOutputPointer=output;
+ fOutputAllocated=kFALSE;
}
void AliEMCALJetFinderAlgo::InitInput(AliEMCALJetFinderInput* input)
{
// Take input data
if (fDebug>1) Info("InitInput","Beginning InitInput");
- fInputPointer = input;
- fOutputObject.Reset(kResetAll);
+ fInputPointer = input;
+ if (fOutputPointer==0) {
+
+ if (fDebug>1) Info("InitInput","Allocating output object");
+ fOutputPointer=new AliEMCALJetFinderOutput();
+ fOutputAllocated=kTRUE;
+ }
+ fOutputPointer->Reset(kResetAll);
// automatically copy parton and particle info to output object
for (Int_t counter = 0 ; counter < fInputPointer->GetNPartons();counter++)
{
- fOutputObject.AddParton(fInputPointer->GetParton(counter));
+ fOutputPointer->AddParton(fInputPointer->GetParton(counter));
}
for (Int_t counter = 0 ; counter < fInputPointer->GetNParticles();counter++)
{
- fOutputObject.AddParticle(fInputPointer->GetParticle(counter));
+ fOutputPointer->AddParticle(fInputPointer->GetParticle(counter));
}
}
virtual ~AliEMCALJetFinderAlgo();
virtual void FindJets() = 0 ;
void InitInput(AliEMCALJetFinderInput* input);
- void SetDebug(Int_t debug = 0){fDebug = debug; fOutputObject.SetDebug(debug);}
- AliEMCALJetFinderOutput* GetOutput() { return &fOutputObject;}
+ void SetDebug(Int_t debug = 0){fDebug = debug; if (fOutputPointer) fOutputPointer->SetDebug(debug);}
+ AliEMCALJetFinderOutput* GetOutput() { return fOutputPointer;}
+ void SetOutput(AliEMCALJetFinderOutput *output);
Float_t PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls);
Bool_t GetPythiaComparison(){return fPythiaComparison;}
void SetPythiaComparison(Bool_t value){fPythiaComparison=value;}
protected:
AliEMCALJetFinderInput* fInputPointer; // pointer to the input object
- AliEMCALJetFinderOutput fOutputObject; // output object for results
+ AliEMCALJetFinderOutput* fOutputPointer; // output object for results
+ Bool_t fOutputAllocated; // flags if ouputobject is woned by JetFinderAlgo
Int_t fDebug; // debug level
Bool_t fPythiaComparison; // for pyclus comparison
- ClassDef(AliEMCALJetFinderAlgo,3)
+ ClassDef(AliEMCALJetFinderAlgo,4)
};
#endif
/*
$Log$
+Revision 1.12 2004/03/15 19:59:37 mhorner
+Pyhtia comparison extended
+
Revision 1.11 2004/03/09 17:06:38 mhorner
Made more robust
void AliEMCALJetFinderAlgoOmni::InitUnitArray()
{
//Initialises unit arrays
- if(fArrayInitialised) delete[] fUnit;
+ if(fArrayInitialised) delete [] fUnit;
+ if(fArrayInitialised) delete [] fUnitNoCuts;
fUnit = new AliEMCALJetFinderAlgoUA1Unit[fNumUnits];
fUnitNoCuts = new AliEMCALJetFinderAlgoUA1Unit[fNumUnits];
fArrayInitialised = 1;
// {
AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- AliEMCALGeometry * geom = gime->EMCALGeometry();
+ AliEMCALGeometry * geom;
+ if (gime)
+ geom = gime->EMCALGeometry();
+ else
+ geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL");
// }
//Stores the resulting jet information in appropriate storage structure (TO BE DECIDED!!!!)
if (fDebug>1) Info("StoreJetInfo","Storing Jet Information");
AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- AliEMCALGeometry * geom = gime->EMCALGeometry();
+ AliEMCALGeometry * geom;
+ if (gime)
+ geom = gime->EMCALGeometry();
+ else
+ geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL");
//Store:
//fJetESum is the final jet energy (background has been subtracted)
//fJetEta is the final jet Eta
//fNumInCone is the final number of cells included in the jet cone
//fEtaInit is the eta of the initiator cell
//fPhiInit is the phi of the initiator cell
- fJet.SetEnergy(fJetESum);
- fJet.SetEta(fJetEta);
- fJet.SetPhi(fJetPhi);
+
+ AliEMCALJet jet(fJetESum,fJetPhi,fJetEta);
cout<<"For iteration "<<fNumIter <<" and Jet number " <<fNumJets <<endl;
cout<<"The jet energy is: " <<fJetESum <<endl;
}//end count3 for
//Save in JET object
- fJet.SetTrackList(numTracksInCone,pTArray, etaArray, phiArray, pdgArray);
- fJet.SetEMCALEnergy(emcalEnergy);
- fJet.SetEMCALEnergyBGSub(emcalEnergyBGSub);
- fJet.SetTrackEnergy(trackEnergy);
- fJet.SetTrackEnergyPtCut(trackEnergyPtCut);
- fOutputObject.AddJet(&fJet);
+ jet.SetTrackList(numTracksInCone,pTArray, etaArray, phiArray, pdgArray);
+ jet.SetEMCALEnergy(emcalEnergy);
+ jet.SetEMCALEnergyBGSub(emcalEnergyBGSub);
+ jet.SetTrackEnergy(trackEnergy);
+ jet.SetTrackEnergyPtCut(trackEnergyPtCut);
+ fOutputPointer->AddJet(&jet);
delete[] pTArray;
delete[] etaArray;
delete[] phiArray;
//Step 4. Find the value of the average background energy
FindBG();
- fOutputObject.Reset(kResetJets); //Reset output object to store info for new iteration
+ fOutputPointer->Reset(kResetJets); //Reset output object to store info for new iteration
fNumJets=0;
//Loop over the array of unit objects and flag those with energy below MinCellEt
AliEMCALJetFinderAlgoUA1Unit *fUnit; //Array of JetFinder Unit objects (treated as the cells)
AliEMCALJetFinderAlgoUA1Unit *fUnitNoCuts; //Second array of JetFinder Unit objects ('raw data')
AliEMCALHadronCorrectionv1 *fHadCorr; //Pointer to Hadron Correction Object
- AliEMCALJet fJet; //Jet object
AliEMCALJetFinderAlgoBGCalcType_t fBGType; //Method of background calculation to be used
Int_t fNumIter; //Number of iterations for entire algorithm
Int_t fNumUnits; //Number of units in the unit object array (same as num towers in EMCAL)
Int_t fNumJets; //Number of jets in an event
Bool_t fArrayInitialised; //To check that array of units is initialised
- ClassDef(AliEMCALJetFinderAlgoOmni,2)
+ ClassDef(AliEMCALJetFinderAlgoOmni,3)
};
#endif
// Defines all TClonesArrays
// Creates full array of Digits - all other arrays will have objects created as necessary
-if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor");
-
-fInitialised = kFALSE;
-fNDigits = 19152; // This is the number of digits
-fNMaxDigits = fNDigits;
-fNMaxTracks = 3000;
-fNMaxParticles = 2000;
-fNMaxPartons = 4;
-fNTracks = 0;
-fNPartons = 0;
-fNParticles = 0;
+ //if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor");
+ fDebug=0;
+ fInitialised = kFALSE;
+ fNDigits = 19152; // This is the number of digits
+ fNMaxDigits = fNDigits;
+ fNMaxTracks = 3000;
+ fNMaxParticles = 2000;
+ fNMaxPartons = 4;
+ fNTracks = 0;
+ fNPartons = 0;
+ fNParticles = 0;
}
}
}
+
+void AliEMCALJetFinderInput::AddTrack(TMCParticle *track)
+{
+// Adds a TParticle to the particle array
+
+if (fDebug>5) Info("AddTrack","Beginning AddTrack");
+
+ if (!fInitialised) InitArrays();
+ if (fNTracks < fNMaxTracks){
+ new((*fTracksArray)[fNTracks])
+ TParticle(track->GetKF(), track->GetKS(), track->GetParent(), 0,
+ track->GetFirstChild(), track->GetLastChild(),
+ track->GetPx(), track->GetPy(), track->GetPz(),
+ track->GetEnergy(),
+ track->GetVx(), track->GetVy(), track->GetVz(),
+ track->GetTime());
+ fNTracks++;
+ if (fDebug>5) Info("AddTrack","Added Track %i",fNTracks);
+ } else {
+ Error("AddTrack","Cannot AddTrack - maximum exceeded");
+ }
+}
+
+
void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton)
{
// Adds an AliEMCALParton to the parton array
}
+void AliEMCALJetFinderInput::AddParticle(TMCParticle *particle)
+{
+// Adds a TParticle to the particle array
+
+if (fDebug>5) Info("AddParticle","Beginning AddParticle");
+
+ if (!fInitialised) InitArrays();
+ if (fNParticles < fNMaxParticles){
+ new((*fParticlesArray)[fNParticles])
+ TParticle(particle->GetKF(), particle->GetKS(), particle->GetParent(), 0,
+ particle->GetFirstChild(), particle->GetLastChild(),
+ particle->GetPx(), particle->GetPy(), particle->GetPz(),
+ particle->GetEnergy(),
+ particle->GetVx(), particle->GetVy(), particle->GetVz(),
+ particle->GetTime());
+ fNParticles++;
+ if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
+ } else {
+ Error("AddParticle","Cannot AddParticle - maximum exceeded");
+ }
+}
+
AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID)
{
#include "TObject.h"
#include "TParticle.h"
+#include "TMCParticle.h"
#include "TClonesArray.h"
#include "AliEMCALParton.h"
#include "AliEMCALDigit.h"
void SetDebug(Int_t debug=0){fDebug = debug;}
void AddEnergyToDigit(Int_t digitID,Int_t denergy);
void AddTrack(TParticle track);
+ void AddTrack(TMCParticle *track);
void AddParton(AliEMCALParton *parton);
void AddParticle(TParticle *particle);
+ void AddParticle(TMCParticle *particle);
AliEMCALDigit* GetDigit(Int_t digitID);
Int_t GetNDigits() const {return fNDigits;}
TParticle* GetTrack(Int_t trackID);
Int_t fDebug; // This is the debug value
Bool_t fInitialised; // Stores whether or not the arrays have been initialised
- ClassDef(AliEMCALJetFinderInput,4)
+ ClassDef(AliEMCALJetFinderInput,5)
};
#endif
fNMaxParticles=2000;
fNMaxPartons=4;
fInitialised=kFALSE;
+ fDebug=0;
fNPartons=0;
fNJets=0;
fNParticles=0;
-
+
+ fJetsArray=0;
+ fParticlesArray=0;
+ fPartonsArray=0;
if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor");
{
// Initialise arrays - legacy from TClones days
if (fDebug>1) Info("AliEMCALJetFinderOutput","Beginning InitArrays");
-
+ fParticlesArray=new TClonesArray("TParticle",fNMaxParticles);
+ fPartonsArray=new TClonesArray("AliEMCALParton",fNMaxPartons);
+ fJetsArray=new TClonesArray("AliEMCALJet",fNMaxJets);
+ //fJetsArray->BypassStreamer(kFALSE);
+ fInitialised=1;
}
//_______________________________________________________________________
{
// Default destrucotr
if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor");
+ delete fParticlesArray;
+ delete fPartonsArray;
+ delete fJetsArray;
}
//_______________________________________________________________________
resettype == kResetJets||
resettype == kResetData ){
fNJets = 0;
+ if (fJetsArray)
+ fJetsArray->Clear();
}
if ( resettype == kResetAll ||
resettype == kResetPartons||
resettype == kResetData ){
fNPartons = 0;
+ if (fPartonsArray)
+ fPartonsArray->Clear();
}
if ( resettype == kResetAll ||
resettype == kResetParticles||
resettype == kResetData ){
fNParticles = 0;
+ if (fParticlesArray)
+ fParticlesArray->Clear();
}
}
//________________________________________________________________________
if (fNJets < fNMaxJets){
- new( &fJetsArray[fNJets]) AliEMCALJet( *jet );
+ new(fJetsArray->AddrAt(fNJets)) AliEMCALJet( *jet );
fNJets++;
}else
{
if (!fInitialised) InitArrays();
if (fNPartons < fNMaxPartons){
- new( &fPartonsArray[fNPartons] ) AliEMCALParton( *parton );
+ new(fPartonsArray->AddrAt(fNPartons)) AliEMCALParton( *parton );
fNPartons++;
}else
{
if (!fInitialised) InitArrays();
if (fNParticles < fNMaxParticles){
- new( &fParticlesArray[fNParticles] ) TParticle( *particle );
+ new(fParticlesArray->AddrAt(fNParticles)) TParticle( *particle );
fNParticles++;
}else
{
if (fDebug>1) Info("GetJet","Beginning GetJet");
if (jetID >= fNJets) return 0;
- return &(fJetsArray[jetID]);
+ return (AliEMCALJet*)fJetsArray->At(jetID);
}
if (fDebug>1) Info("GetParton","Beginning GetParton");
if (partonID >= fNPartons) return 0;
- return &(fPartonsArray[partonID]);
+ return (AliEMCALParton*) fPartonsArray->At(partonID);
}
//______________________________________________________________________
if (fDebug>1) Info("GetParticle","Beginning GetParticle");
if (particleID >= fNParticles) return 0;
-return &(fParticlesArray[particleID]);
+ return (TParticle*) fParticlesArray->At(particleID);
}
void SetDebug(Int_t debug){fDebug = debug;}
AliEMCALJet* GetJet(Int_t jetID);
Int_t GetNJets() const {return fNJets;}
+ TClonesArray *GetJets() {return fJetsArray; }
AliEMCALParton* GetParton(Int_t partonID);
Int_t GetNPartons() const {return fNPartons;}
TParticle* GetParticle(Int_t particleID);
+ TClonesArray *GetParticles() {return fParticlesArray; }
Int_t GetNParticles() const {return fNParticles;}
+ ClassDef(AliEMCALJetFinderOutput,5)
private:
void InitArrays();
- AliEMCALJet fJetsArray[10]; // [10] Array of jet objects
- AliEMCALParton fPartonsArray[4]; // [4] Array of parton objects
+ TClonesArray *fJetsArray; // Array of jet objects
+ TClonesArray *fPartonsArray; // Array of parton objects
Int_t fNPartons; // Number of Partons actually stored
Int_t fNJets; // Number of jets actually stored
- TParticle fParticlesArray[2000]; // [2000] Array of particles
+ TClonesArray *fParticlesArray; // Array of particles
Int_t fNParticles; // Number of particles actually stored
Int_t fNMaxJets; // Maximum number of jets
Int_t fNMaxParticles; // Maximum number of primary particles
Int_t fDebug; // Debug level
Bool_t fInitialised; // stores whether or not the arrays have been initialised
- ClassDef(AliEMCALJetFinderOutput,3)
};
#endif