Initial import.
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Apr 2004 15:48:45 +0000 (15:48 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Apr 2004 15:48:45 +0000 (15:48 +0000)
16 files changed:
JETAN/AliJet.cxx [new file with mode: 0644]
JETAN/AliJet.h [new file with mode: 0644]
JETAN/AliJetEvent.cxx [new file with mode: 0644]
JETAN/AliJetEvent.h [new file with mode: 0644]
JETAN/AliJetEventParticles.cxx [new file with mode: 0644]
JETAN/AliJetEventParticles.h [new file with mode: 0644]
JETAN/AliJetParticle.cxx [new file with mode: 0644]
JETAN/AliJetParticle.h [new file with mode: 0644]
JETAN/AliJetParticlesReader.cxx [new file with mode: 0644]
JETAN/AliJetParticlesReader.h [new file with mode: 0644]
JETAN/AliJetParticlesReaderESD.cxx [new file with mode: 0644]
JETAN/AliJetParticlesReaderESD.h [new file with mode: 0644]
JETAN/AliJetParticlesReaderKine.cxx [new file with mode: 0644]
JETAN/AliJetParticlesReaderKine.h [new file with mode: 0644]
JETAN/JetAnalysisLinkDef.h [new file with mode: 0644]
JETAN/libJETAN.pkg [new file with mode: 0644]

diff --git a/JETAN/AliJet.cxx b/JETAN/AliJet.cxx
new file mode 100644 (file)
index 0000000..5e15762
--- /dev/null
@@ -0,0 +1,131 @@
+// $Id$
+
+//__________________________________________________________
+///////////////////////////////////////////////////////////////////
+//
+// class AliJet
+//
+// loizides@ikf.uni-frankfurt.de
+//
+///////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <TClonesArray.h>
+#include "AliJetParticle.h"
+#include "AliJet.h"
+
+ClassImp(AliJet)
+
+#if 0
+/**************************************************************************/ 
+AliJetEvent::AliJetEvent(Int_t size) :
+  fNParticles(0),
+  fParticles(new TClonesArray("AliJetParticle",size)),
+  fVertexX(0.),
+  fVertexY(0.),
+  fVertexZ(0.)
+{
+  //default constructor   
+}
+
+/**************************************************************************/ 
+AliJetEvent::AliJetEvent(const AliJetEvent& source) :
+  TObject(source), 
+  fNParticles(source.fNParticles),
+  fParticles(new TClonesArray("AliJetEvent",source.fNParticles)),
+  fVertexX(0.),
+  fVertexY(0.),
+  fVertexZ(0.)
+{
+  //copy constructor
+  for(Int_t i =0; i<fNParticles; i++)
+    {
+      const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
+      fParticles->AddAt(new AliJetParticle(*(kjp)),i);
+    }
+}
+
+/**************************************************************************/ 
+
+AliJetEvent::~AliJetEvent()
+{
+  //destructor   
+  Reset();
+  delete fParticles;
+}
+
+
+/**************************************************************************/ 
+
+void  AliJetEvent::Reset(Int_t size)
+{
+  //deletes all particles from the event
+
+  if(fParticles) fParticles->Clear();
+  if(size>=0) fParticles->Expand(size);
+  fNParticles = 0;
+} 
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(AliJetParticle* part)
+{
+  //Adds new particle to the event
+  fParticles->AddAt(part,fNParticles++);
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(const AliJetParticle* part)
+{
+  //Adds new particle to the event
+  fParticles->AddAt(new AliJetParticle(*part),fNParticles++); 
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(const TParticle* part,Int_t idx, Int_t l)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(Float_t px, Float_t py, Float_t pz, 
+                              Float_t etot, Int_t idx, Int_t l)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l); 
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
+                             Float_t pt, Float_t phi, Float_t eta)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta); 
+}
+
+
+/**************************************************************************/ 
+
+const AliJetParticle* AliJetEvent::GetParticleSafely(Int_t n)
+{
+  //returns nth particle with range check
+  if( (n<0) || (fNParticles<=n) ) return 0;
+  return (const AliJetParticle*)fParticles->At(n);
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::Print(Option_t* /*t*/) const
+{
+  if(fHeader.Length()) cout << fHeader.Data() << endl;
+  cout << "no of particles: " << fNParticles << endl;
+}
+
+#endif
diff --git a/JETAN/AliJet.h b/JETAN/AliJet.h
new file mode 100644 (file)
index 0000000..d4e55cc
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef ALIJET_H
+#define ALIJET_H
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////
+//
+// class AliJet
+//
+// loizides@ikf.uni-frankfurt.de
+//
+///////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+#include <TClonesArray.h>
+#include <TObjString.h>
+#include <TString.h>
+class TParticle;
+class AliJetParticle;
+
+class AliJet: public TObject
+{
+  public:
+#if 0
+  AliJetEvent(Int_t size=1000);
+  AliJetEvent(const AliJetEvent& source);
+  virtual ~AliJetEvent();
+    
+  void SetVertex(Float_t v[3]){fVertexX=v[0];fVertexY=v[1];fVertexZ=v[2];}
+  void SetVertex(Float_t v1,Float_t v2, Float_t v3){fVertexX=v1;fVertexY=v2;fVertexZ=v3;}
+  void SetHeader(TString& s){fHeader=s;}
+  void Reset(Int_t size=-1); //deletes all entries
+  
+  //adds particle to the event
+  void AddParticle(AliJetParticle* p);  
+  void AddParticle(const AliJetParticle* p); 
+  void AddParticle(const TParticle* part,Int_t idx=-1, Int_t l=0); 
+  void AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx=-1, Int_t l=0);
+  void AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
+                  Float_t pt, Float_t phi, Float_t eta);
+
+  const AliJetParticle* GetParticle(Int_t n) //gets particle without boundary check
+    {return (const AliJetParticle*)fParticles->At(n);} 
+  const AliJetParticle* GetParticleSafely(Int_t n); 
+  Int_t GetNParticles()              const {return fNParticles;}
+  const TClonesArray* GetParticles() const {return fParticles;}
+  Float_t GetVertexX()               const {return fVertexX;}  
+  Float_t GetVertexY()               const {return fVertexY;}  
+  Float_t GetVertexZ()               const {return fVertexZ;}  
+
+  void Print(Option_t *t="") const;
+
+  protected:
+  TString fHeader;          //   event description
+  Int_t fNParticles;        //   number of particles read
+  TClonesArray *fParticles; //-> particles in event
+
+  Float_t fVertexX; //vertex x
+  Float_t fVertexY; //vertex y
+  Float_t fVertexZ; //vertex z
+#endif
+  ClassDef(AliJet,1) //class AliJet
+};
+#endif
diff --git a/JETAN/AliJetEvent.cxx b/JETAN/AliJetEvent.cxx
new file mode 100644 (file)
index 0000000..f44c0be
--- /dev/null
@@ -0,0 +1,131 @@
+// $Id$
+
+//__________________________________________________________
+///////////////////////////////////////////////////////////////////
+//
+// class AliJetEvent
+//
+// loizides@ikf.uni-frankfurt.de
+//
+///////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <TClonesArray.h>
+#include "AliJetParticle.h"
+#include "AliJetEvent.h"
+
+ClassImp(AliJetEvent)
+
+#if 0
+/**************************************************************************/ 
+AliJetEvent::AliJetEvent(Int_t size) :
+  fNParticles(0),
+  fParticles(new TClonesArray("AliJetParticle",size)),
+  fVertexX(0.),
+  fVertexY(0.),
+  fVertexZ(0.)
+{
+  //default constructor   
+}
+
+/**************************************************************************/ 
+AliJetEvent::AliJetEvent(const AliJetEvent& source) :
+  TObject(source), 
+  fNParticles(source.fNParticles),
+  fParticles(new TClonesArray("AliJetEvent",source.fNParticles)),
+  fVertexX(0.),
+  fVertexY(0.),
+  fVertexZ(0.)
+{
+  //copy constructor
+  for(Int_t i =0; i<fNParticles; i++)
+    {
+      const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
+      fParticles->AddAt(new AliJetParticle(*(kjp)),i);
+    }
+}
+
+/**************************************************************************/ 
+
+AliJetEvent::~AliJetEvent()
+{
+  //destructor   
+  Reset();
+  delete fParticles;
+}
+
+
+/**************************************************************************/ 
+
+void  AliJetEvent::Reset(Int_t size)
+{
+  //deletes all particles from the event
+
+  if(fParticles) fParticles->Clear();
+  if(size>=0) fParticles->Expand(size);
+  fNParticles = 0;
+} 
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(AliJetParticle* part)
+{
+  //Adds new particle to the event
+  fParticles->AddAt(part,fNParticles++);
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(const AliJetParticle* part)
+{
+  //Adds new particle to the event
+  fParticles->AddAt(new AliJetParticle(*part),fNParticles++); 
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(const TParticle* part,Int_t idx, Int_t l)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(Float_t px, Float_t py, Float_t pz, 
+                              Float_t etot, Int_t idx, Int_t l)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l); 
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
+                             Float_t pt, Float_t phi, Float_t eta)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta); 
+}
+
+
+/**************************************************************************/ 
+
+const AliJetParticle* AliJetEvent::GetParticleSafely(Int_t n)
+{
+  //returns nth particle with range check
+  if( (n<0) || (fNParticles<=n) ) return 0;
+  return (const AliJetParticle*)fParticles->At(n);
+}
+
+/**************************************************************************/ 
+
+void AliJetEvent::Print(Option_t* /*t*/) const
+{
+  if(fHeader.Length()) cout << fHeader.Data() << endl;
+  cout << "no of particles: " << fNParticles << endl;
+}
+
+#endif
diff --git a/JETAN/AliJetEvent.h b/JETAN/AliJetEvent.h
new file mode 100644 (file)
index 0000000..df98682
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef ALIJETEVENT_H
+#define ALIJETEVENT_H
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////
+//
+// class AliJetEvent
+//
+// Piotr.Skowronski@cern.ch 
+//
+///////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+#include <TClonesArray.h>
+#include <TObjString.h>
+#include <TString.h>
+class TParticle;
+class AliJetParticle;
+class AliJet;
+
+class AliJetEvent: public TObject
+{
+  public:
+#if 0
+  AliJetEvent(Int_t size=1000);
+  AliJetEvent(const AliJetEvent& source);
+  virtual ~AliJetEvent();
+    
+  void SetHeader(TString& s){fHeader=s;}
+  //void Reset(Int_t size=-1); //deletes all entries
+  
+  //adds particle to the event
+  void AddJet(AliJet* j);  
+  void AddJet(const AliJet* j); 
+
+  const AliJet* GetJet(Int_t n) //gets jet without boundary check
+    {return (const AliJet*)fJets->At(n);} 
+  const AliJetParticle* GetParticleSafely(Int_t n); 
+
+  Int_t GetNParticles()              const {return fNParticles;}
+  const TClonesArray* GetParticles() const {return fParticles;}
+  Float_t GetVertexX()               const {return fVertexX;}  
+  Float_t GetVertexY()               const {return fVertexY;}  
+  Float_t GetVertexZ()               const {return fVertexZ;}  
+
+  void Print(Option_t *t="") const;
+
+  protected:
+  TString fHeader;          //   event description
+  Int_t fNParticles;        //   number of particles read
+  TClonesArray *fParticles; //-> particles in event
+
+
+  Float_t fVertexX; //vertex x
+  Float_t fVertexY; //vertex y
+  Float_t fVertexZ; //vertex z
+#endif
+  ClassDef(AliJetEvent,1) //class AliJetEvent
+};
+#endif
diff --git a/JETAN/AliJetEventParticles.cxx b/JETAN/AliJetEventParticles.cxx
new file mode 100644 (file)
index 0000000..719dea7
--- /dev/null
@@ -0,0 +1,129 @@
+// $Id$
+
+//__________________________________________________________
+///////////////////////////////////////////////////////////////////
+//
+// class AliJetEventParticles
+//
+// loizides@ikf.uni-frankfurt.de
+//
+///////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <TClonesArray.h>
+#include "AliJetParticle.h"
+#include "AliJetEventParticles.h"
+
+ClassImp(AliJetEventParticles)
+
+/**************************************************************************/ 
+AliJetEventParticles::AliJetEventParticles(Int_t size) :
+  fNParticles(0),
+  fParticles(new TClonesArray("AliJetParticle",size)),
+  fVertexX(0.),
+  fVertexY(0.),
+  fVertexZ(0.)
+{
+  //default constructor   
+}
+
+/**************************************************************************/ 
+AliJetEventParticles::AliJetEventParticles(const AliJetEventParticles& source) :
+  TObject(source), 
+  fNParticles(source.fNParticles),
+  fParticles(new TClonesArray("AliJetEventParticles",source.fNParticles)),
+  fVertexX(0.),
+  fVertexY(0.),
+  fVertexZ(0.)
+{
+  //copy constructor
+  for(Int_t i =0; i<fNParticles; i++)
+    {
+      const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
+      fParticles->AddAt(new AliJetParticle(*(kjp)),i);
+    }
+}
+
+/**************************************************************************/ 
+
+AliJetEventParticles::~AliJetEventParticles()
+{
+  //destructor   
+  Reset();
+  delete fParticles;
+}
+
+
+/**************************************************************************/ 
+
+void  AliJetEventParticles::Reset(Int_t size)
+{
+  //deletes all particles from the event
+
+  if(fParticles) fParticles->Clear();
+  if(size>=0) fParticles->Expand(size);
+  fNParticles = 0;
+} 
+
+/**************************************************************************/ 
+
+void AliJetEventParticles::AddParticle(AliJetParticle* part)
+{
+  //Adds new particle to the event
+  fParticles->AddAt(part,fNParticles++);
+}
+
+/**************************************************************************/ 
+
+void AliJetEventParticles::AddParticle(const AliJetParticle* part)
+{
+  //Adds new particle to the event
+  fParticles->AddAt(new AliJetParticle(*part),fNParticles++); 
+}
+
+/**************************************************************************/ 
+
+void AliJetEventParticles::AddParticle(const TParticle* part,Int_t idx, Int_t l)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
+}
+
+/**************************************************************************/ 
+
+void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz, 
+                              Float_t etot, Int_t idx, Int_t l)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l); 
+}
+
+/**************************************************************************/ 
+
+void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
+                             Float_t pt, Float_t phi, Float_t eta)
+{
+  //Adds new particle to the event
+  new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta); 
+}
+
+
+/**************************************************************************/ 
+
+const AliJetParticle* AliJetEventParticles::GetParticleSafely(Int_t n)
+{
+  //returns nth particle with range check
+  if( (n<0) || (fNParticles<=n) ) return 0;
+  return (const AliJetParticle*)fParticles->At(n);
+}
+
+/**************************************************************************/ 
+
+void AliJetEventParticles::Print(Option_t* /*t*/) const
+{
+  cout << "--- AliJetEventParticles ---" << endl;
+  if(fHeader.Length()) cout << fHeader.Data() << endl;
+  cout << "no of particles: " << fNParticles << endl;
+}
diff --git a/JETAN/AliJetEventParticles.h b/JETAN/AliJetEventParticles.h
new file mode 100644 (file)
index 0000000..022f588
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef ALIJETEVENTPARTICLES_H
+#define ALIJETEVENTPARTICLES_H
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////
+//
+// class AliJetEventParticles
+//
+// loizides@ikf.uni-frankfurt.de 
+//
+///////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+#include <TClonesArray.h>
+#include <TObjString.h>
+#include <TString.h>
+class TParticle;
+class AliJetParticle;
+
+class AliJetEventParticles: public TObject
+{
+  public:
+  AliJetEventParticles(Int_t size=1000);
+  AliJetEventParticles(const AliJetEventParticles& source);
+  virtual ~AliJetEventParticles();
+    
+  void SetVertex(Float_t v[3]){fVertexX=v[0];fVertexY=v[1];fVertexZ=v[2];}
+  void SetVertex(Float_t v1,Float_t v2, Float_t v3){fVertexX=v1;fVertexY=v2;fVertexZ=v3;}
+  void SetHeader(TString& s){fHeader=s;}
+  void Reset(Int_t size=-1); //deletes all entries
+  
+  //adds particle to the event
+  void AddParticle(AliJetParticle* p);  
+  void AddParticle(const AliJetParticle* p); 
+  void AddParticle(const TParticle* part,Int_t idx=-1, Int_t l=0); 
+  void AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx=-1, Int_t l=0);
+  void AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
+                  Float_t pt, Float_t phi, Float_t eta);
+
+  const AliJetParticle* GetParticle(Int_t n) //gets particle without boundary check
+    {return (const AliJetParticle*)fParticles->At(n);} 
+  const AliJetParticle* GetParticleSafely(Int_t n); 
+  Int_t GetNParticles()              const {return fNParticles;}
+  const TClonesArray* GetParticles() const {return fParticles;}
+  Float_t GetVertexX()               const {return fVertexX;}  
+  Float_t GetVertexY()               const {return fVertexY;}  
+  Float_t GetVertexZ()               const {return fVertexZ;}  
+
+  void Print(Option_t *t="") const;
+
+  protected:
+  TString fHeader;          //   event description
+  Int_t fNParticles;        //   number of particles read
+  TClonesArray *fParticles; //-> particles in event
+
+  Float_t fVertexX; //vertex x
+  Float_t fVertexY; //vertex y
+  Float_t fVertexZ; //vertex z
+
+  ClassDef(AliJetEventParticles,1) //class AliJetEventParticles
+};
+#endif
diff --git a/JETAN/AliJetParticle.cxx b/JETAN/AliJetParticle.cxx
new file mode 100644 (file)
index 0000000..9e42c18
--- /dev/null
@@ -0,0 +1,482 @@
+// $Id$
+
+//___________________________________________________________
+/////////////////////////////////////////////////////////////
+//
+// class AliJetParticle
+//
+// loizides@ikf.uni-frankfurt.de
+//
+/////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <TMath.h>
+#include <TParticle.h>
+#include "AliJetParticle.h"
+
+ClassImp(AliJetParticle)
+
+AliJetParticle::AliJetParticle() : 
+  TObject()    
+{
+  Clear();
+}
+
+AliJetParticle::AliJetParticle(const AliJetParticle& in) :
+  TObject(in)
+{
+  SetMomentum(in.fPx,in.fPy,in.fPz,in.fE);
+  fIdxInEvent=in.fIdxInEvent;
+  fLabel=in.fLabel;
+}
+AliJetParticle::AliJetParticle(const TParticle* p, Int_t idx, Int_t l) :
+  TObject()
+{
+  SetMomentum(p->Px(),p->Py(),p->Pz(),p->Energy());
+  fIdxInEvent=idx;
+  fLabel=l;
+}
+
+AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz, 
+                               Float_t etot, Int_t idx, Int_t l) :
+  TObject()
+{
+  SetMomentum(px,py,pz,etot);
+  fIdxInEvent=idx;
+  fLabel=l;
+}
+
+AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz, 
+                               Float_t etot, Int_t idx, Int_t l,
+                              Float_t pt, Float_t phi, Float_t eta) :
+  TObject(),
+  fPx(px),fPy(py),fPz(pz),
+  fE(etot),fIdxInEvent(idx),fLabel(l),
+  fPt(pt),fEta(eta),fPhi(phi)
+{
+
+}
+
+void AliJetParticle::Calculate()
+{
+  //calculate values from px, py, pz
+  //which are frequently needed
+
+  fPt=TMath::Sqrt(fPx*fPx+fPy*fPy);
+  const Float_t kp=P();
+  fEta=0.5*TMath::Log((kp+fPz+1e-30)/(kp-fPz+1e-30)); 
+  fPhi=TMath::Pi()+TMath::ATan2(-fPy,-fPx);
+}
+
+void AliJetParticle::Clear(Option_t* /*t*/)
+{
+  fPx=0.;
+  fPy=0.;
+  fPz=0.;
+  fE=0.;
+  fIdxInEvent=0;
+  fLabel=0;
+  fPt=0.;
+  fEta=0.;
+  fPhi=0.;
+}
+
+void AliJetParticle::Print(Option_t* /*t*/) const
+{
+  cout << fPt << " " << fEta << " " << fPhi << endl;
+}
+
+
+
+#if 0
+Int_t AliHBTParticle::fgDebug = 0;
+//______________________________________________________________________________
+AliHBTParticle::AliHBTParticle():  
+ fPdgIdx(0), fIdxInEvent(0),fNPids(0),fPids(0x0),fPidProb(0x0),
+ fCalcMass(0),fPx(0), fPy(0),fPz(0),fE(0), fVx(0), fVy(0),fVz(0),fVt(0),
+ fTrackPoints(0x0),fClusterMap(0x0)
+{//empty particle
+}
+//______________________________________________________________________________
+
+AliHBTParticle::AliHBTParticle(Int_t pdg, Int_t idx,
+               Double_t px, Double_t py, Double_t pz, Double_t etot,
+               Double_t vx, Double_t vy, Double_t vz, Double_t time):  
+  fPdgIdx(0), fIdxInEvent(idx),fNPids(0),fPids(0x0),fPidProb(0x0),
+  fCalcMass(0), 
+  fPx(px), fPy(py),fPz(pz),fE(etot), 
+  fVx(vx), fVy(vy),fVz(vz),fVt(time),
+  fTrackPoints(0x0),fClusterMap(0x0)
+{
+//mormal constructor
+  SetPdgCode(pdg);
+  if (GetPDG()) {
+     fCalcMass    = GetPDG()->Mass();
+  } else {
+     Double_t a2 = fE*fE -fPx*fPx -fPy*fPy -fPz*fPz;
+     if (a2 >= 0) fCalcMass =  TMath::Sqrt(a2);
+     else         fCalcMass = -TMath::Sqrt(-a2);
+  }
+}
+//______________________________________________________________________________
+
+AliHBTParticle::AliHBTParticle(Int_t pdg, Float_t prob, Int_t idx, 
+                               Double_t px, Double_t py, Double_t pz, Double_t etot,
+                               Double_t vx, Double_t vy, Double_t vz, Double_t time):
+  fPdgIdx(0), fIdxInEvent(idx),fNPids(0),fPids(0x0),fPidProb(0x0),
+  fCalcMass(0), 
+  fPx(px), fPy(py),fPz(pz),fE(etot), 
+  fVx(vx), fVy(vy),fVz(vz),fVt(time),
+  fTrackPoints(0x0),fClusterMap(0x0)
+{
+//mormal constructor
+  SetPdgCode(pdg,prob);
+  if (GetPDG()) {
+     fCalcMass    = GetPDG()->Mass();
+  } else {
+     Double_t a2 = fE*fE -fPx*fPx -fPy*fPy -fPz*fPz;
+     if (a2 >= 0) fCalcMass =  TMath::Sqrt(a2);
+     else         fCalcMass = -TMath::Sqrt(-a2);
+  }
+}
+//______________________________________________________________________________
+AliHBTParticle::AliHBTParticle(const AliHBTParticle& in):
+   TObject(in),
+   fPdgIdx(in.fPdgIdx), fIdxInEvent(in.fIdxInEvent),
+   fNPids(in.fNPids),fPids(new Int_t[fNPids]),fPidProb(new Float_t[fNPids]),
+   fCalcMass(in.GetCalcMass()),
+   fPx(in.Px()),fPy(in.Py()),fPz(in.Pz()),fE(in.Energy()), 
+   fVx(in.Vx()),fVy(in.Vy()),fVz(in.Vz()),fVt(in.T()),
+   fTrackPoints(0x0), fClusterMap(0x0)
+{
+ //Copy constructor
+ for(Int_t i = 0; i<fNPids; i++)
+  {
+    fPids[i] =  in.fPids[i];
+    fPidProb[i] = in.fPidProb[i];
+  }
+ if (in.fTrackPoints)
+   fTrackPoints = (AliHBTTrackPoints*)in.fTrackPoints->Clone();
+ if (in.fClusterMap)
+   fClusterMap = (AliHBTClusterMap*)in.fClusterMap->Clone();
+}
+
+//______________________________________________________________________________
+AliHBTParticle::AliHBTParticle(const TParticle &p,Int_t idx):
+   fPdgIdx(0), fIdxInEvent(idx),
+   fNPids(0),fPids(0x0),fPidProb(0x0),
+   fCalcMass(p.GetCalcMass()),
+   fPx(p.Px()),fPy(p.Py()),fPz(p.Pz()),fE(p.Energy()), 
+   fVx(p.Vx()),fVy(p.Vy()),fVz(p.Vz()),fVt(p.T()),
+   fTrackPoints(0x0),fClusterMap(0x0)
+{
+ //all copied in the initialization
+ SetPdgCode(p.GetPdgCode());
+}
+//______________________________________________________________________________
+
+AliHBTParticle::~AliHBTParticle()
+{
+//dtor  
+  delete [] fPids;
+  delete [] fPidProb;
+  delete fTrackPoints;
+  delete fClusterMap;
+}
+//______________________________________________________________________________
+
+AliHBTParticle& AliHBTParticle::operator=(const AliHBTParticle& in)
+{
+//assigment operator
+  
+  fNPids = in.fNPids;
+  delete [] fPids;
+  delete [] fPidProb;
+  Int_t* fPids = new Int_t[fNPids];
+  Float_t* fPidProb = new Float_t[fNPids];
+  for (Int_t i = 0; i < fNPids;i++)
+   {
+     fPids[i]    = in.fPids[i];
+     fPidProb[i] = in.fPidProb[i];
+   }
+   
+  fPdgIdx = in.fPdgIdx; 
+  fIdxInEvent = in.fIdxInEvent;  
+  fCalcMass = in.GetCalcMass();
+  fPx = in.Px();
+  fPy = in.Py();
+  fPz = in.Pz();
+  fE = in.Energy(); 
+  fVx = in.Vx();
+  fVy = in.Vy();
+  fVz = in.Vz();
+  fVt = in.T();
+  
+  delete fTrackPoints;
+  fTrackPoints = (in.fTrackPoints)?(AliHBTTrackPoints*)fTrackPoints->Clone():0x0;
+  
+  delete fClusterMap;
+  fClusterMap =  (in.fClusterMap)?(AliHBTClusterMap*)in.fClusterMap->Clone():0x0;
+  
+  return *this;
+}
+//______________________________________________________________________________
+
+void AliHBTParticle::SetPdgCode(Int_t pdg,Float_t prob)
+{
+  SetPIDprobability(pdg,prob);
+  fPdgIdx = GetPidSlot(pdg);
+}
+
+//______________________________________________________________________________
+void AliHBTParticle::SetPIDprobability(Int_t pdg, Float_t prob)
+{
+//Sets another pdg code and corresponding probabilty
+//Ids are set in decreasing order
+//Check if total prbaility is not ivercoming unity is performed
+//in case, warning is printed
+  if (fgDebug > 9) Info("SetPIDprobability","Setting PID %d prob %f",pdg,prob);
+
+  Float_t totprob = 0.0;//sums up probabilities
+  Int_t idx = GetPidSlot(pdg);
+  Int_t i;
+  if (idx > -1) 
+   {
+     fPidProb[idx] = prob;
+     for (i = 0; i < fNPids;i++) totprob+=fPidProb[i];
+     if (totprob > (1.0+0.000001))
+       {
+         Warning("SetPIDprobability","Total probability greater than unity (%f)",totprob);
+       }
+     if (fgDebug > 9) 
+      {
+        Info("SetPIDprobability","Current Total probability: %f",totprob);
+      }
+     return;
+   }
+    
+  Int_t currentpid = GetPdgCode();
+  fNPids++;
+  Float_t* aPidProbNew = new Float_t[fNPids];
+  Int_t* aPidsNew = new Int_t[fNPids];
+  
+  for (i = 0; i < fNPids-1;i++)//find a slot
+   {
+     if ( fPidProb[i] > prob)
+      {
+        if (fgDebug>9) Info("SetPID","Copying entry %d",i);
+        aPidProbNew[i] = fPidProb[i];
+        aPidsNew[i] = fPids[i];
+        totprob+=fPidProb[i];
+      }
+     else break;
+   }
+
+  if (fgDebug > 9) Info("SetPID","Setting new PID on entry %d",i);
+  aPidProbNew[i] = prob;
+  aPidsNew[i] = pdg;
+  totprob+=prob;
+  
+
+  for (Int_t j = fNPids-1; j > i ;j--)//copy rest of old araays 
+   {
+     if (fgDebug > 9) Info("SetPID","Copying from old entry %d to new entry %d",j-1,j);
+     aPidProbNew[j] = fPidProb[j-1];
+     aPidsNew[j] = fPids[j-1];
+     totprob+=fPidProb[j-1];
+   }
+
+  delete [] fPidProb;
+  delete [] fPids;
+  
+  fPidProb = aPidProbNew;
+  fPids = aPidsNew;
+  
+  fPdgIdx = GetPidSlot(currentpid);
+  if (fPdgIdx == -1) fPdgIdx = 0;
+  
+  if (totprob > (1.0+0.000001))//place for numerical error
+   {
+     Warning("SetId","Total probability is greater than unity (%f)!!!",totprob);
+     Print();
+   }
+}
+//______________________________________________________________________________
+
+Float_t AliHBTParticle::GetPIDprobability(Int_t pdg) const
+{
+//Returns probability that this particle is the type of pdg
+  Int_t idx = GetPidSlot(pdg);
+  if (idx < 0) return 0.0;//such pid was not specified for this particle
+  return fPidProb[idx];
+}
+//______________________________________________________________________________
+
+const Char_t* AliHBTParticle::GetName() const 
+{
+  //returns name of this particle 
+   static char def[4] = "XXX";
+   const TParticlePDG *ap = TDatabasePDG::Instance()->GetParticle(GetPdgCode());
+   if (ap) return ap->GetName();
+   else    return def;
+}
+//______________________________________________________________________________
+
+Int_t AliHBTParticle::GetPidSlot(Int_t pdg) const
+{
+ //returns position of the given PID in fPids (and fPidProb) array.
+ if (fPids == 0x0) return -1;
+ for (Int_t i = 0; i< fNPids; i++)
+  {
+   if (fPids[i] == pdg) return i;
+  }
+ return -1;
+}
+//______________________________________________________________________________
+
+Int_t AliHBTParticle::GetNthPid(Int_t idx) const
+{
+  //returns PID sitting on slot idx in fPids
+  if ( (idx < 0) || (idx >= fNPids) )
+   {
+     Error("GetNthPid","Out Of Bounds");
+     return 0;
+   }
+  return fPids[idx];
+}
+//______________________________________________________________________________
+
+Float_t AliHBTParticle::GetNthPidProb(Int_t idx) const
+{
+  //returns PID sitting on slot idx in fPidProb
+  if ( (idx < 0) || (idx >= fNPids) )
+   {
+     Error("GetNthPid","Out Of Bounds");
+     return 0;
+   }
+  return fPidProb[idx];
+}
+//______________________________________________________________________________
+
+void AliHBTParticle::Print() const
+{
+//prints information about particle
+  printf("____________________________________________________\n");
+  printf("Idx: %d  PID: %d  Name: ",fIdxInEvent,GetPdgCode());
+  TParticlePDG *pdgp = TDatabasePDG::Instance()->GetParticle(GetPdgCode());
+  if (pdgp)
+   {
+     printf("%s Mass: %f\n",pdgp->GetName(),pdgp->Mass());
+   }
+  else
+   {
+     printf("Not known\n");
+   }
+  
+  printf("Px: %+f Py: %+f Pz: %+f E: %+f Calculated Mass: %f\nVx: %+f Vy: %+f Vz: %+f T: %+f\n",
+          Px(),Py(),Pz(),Energy(),GetCalcMass(),Vx(),Vy(),Vz(),T());
+
+  for (Int_t i = 0; i < fNPids; i++)
+   {
+     printf("# %d  PID: %d  Probability %f name ",i,fPids[i],fPidProb[i]);
+     const TParticlePDG *ap = TDatabasePDG::Instance()->GetParticle(fPids[i]);
+     if (ap)
+      {
+        printf("%s Mass %f\n",ap->GetName(),ap->Mass());
+      }
+     else
+      {
+        printf("Not known\n");
+      }
+   }
+}
+
+//______________________________________________________________________________
+
+//void AliHBTParticle::Streamer(TBuffer &b)
+//{
+//     // Stream all objects in the array to or from the I/O buffer.
+//   UInt_t R__s, R__c;
+//   Int_t i;
+//   if (b.IsReading()) 
+//    {
+//      delete [] fPids;
+//      delete [] fPidProb;
+//      
+//      Version_t v = b.ReadVersion(&R__s, &R__c);
+//      if (v == 1)
+//       {
+//         AliHBTParticle::Class()->ReadBuffer(b, this);
+//      }
+//      else
+//       {
+//        TObject::Streamer(b);
+//       b >> fPdgIdx;
+//       b >> fIdxInEvent;
+//       
+//       b >> fNPids;
+//       Int_t* fPids = new Int_t[fNPids];
+//        Float_t* fPidProb = new Float_t[fNPids];
+//        for (i = 0;i<fNPids;i++) 
+//         {
+//           b >> fPids[i];
+//         }
+//        for (i = 0;i<fNPids;i++) 
+//        {
+//          b >> fPidProb[i];
+//         }
+//        b >> fCalcMass;
+//
+//        b >> fPx;
+//       b >> fPy;
+//       b >> fPz;
+//        b >> fE;
+//
+//       b >> fVx;
+//        b >> fVy;
+//        b >> fVz;
+//       b >> fVt;
+//       Info("Streamer","Read data");
+//        Print();
+//       }
+//
+//      b.CheckByteCount(R__s, R__c,AliHBTParticle::IsA());
+//    } 
+//  else 
+//   {
+//     R__c = b.WriteVersion(AliHBTParticle::IsA(), kTRUE);
+//     TObject::Streamer(b);
+//     Info("Streamer","Read data");
+//     Print();
+//
+//     b << fPdgIdx;
+//     b << fIdxInEvent;
+//     b << fNPids;
+//     for (i = 0;i<fNPids;i++) 
+//      {
+//        b << fPids[i];
+//      }
+//      {
+//      {
+//     for (i = 0;i<fNPids;i++) 
+//     {
+//        b << fPidProb[i];
+//      }
+//     b << fCalcMass;
+//
+//     b << fPx;
+//     b << fPy;
+//     b << fPz;
+//     b << fE;
+//
+//     b << fVx;
+//     b << fVy;
+//     b << fVz;
+//     b << fVt;
+//
+//    b.SetByteCount(R__c, kTRUE);
+//   }
+//}
+#endif
diff --git a/JETAN/AliJetParticle.h b/JETAN/AliJetParticle.h
new file mode 100644 (file)
index 0000000..1c6c19f
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef ALIJETPARTICLE_H
+#define ALIJETPARTICLE_H
+/* $Id$ */
+
+//___________________________________________________________
+/////////////////////////////////////////////////////////////
+//
+// class AliJetParticle
+//
+// loizides@ikf.uni-frankfurt.de
+//
+/////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+#include <TMath.h>
+class TParticle;
+
+class AliJetParticle : public TObject
+{
+  public:
+  AliJetParticle();
+  AliJetParticle(const AliJetParticle& in); 
+  AliJetParticle(const TParticle* p, Int_t idx, Int_t l=0);
+  AliJetParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l=0);
+  AliJetParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
+                 Float_t pt, Float_t eta, Float_t phi);
+  virtual ~AliJetParticle(){};
+
+  void SetMomentum(Float_t px, Float_t py, Float_t pz, Float_t e)
+                    {fPx=px; fPy=py; fPz=pz; fE=e; Calculate();}
+  void SetMomentum(Float_t px, Float_t py, Float_t pz, Float_t e,
+                  Float_t pt, Float_t phi, Float_t eta)
+                    {fPx=px;fPy=py;fPz=pz;fE=e;fPt=pt;fEta=eta;fPhi=phi;}
+  
+  void SetUID(Int_t id) {fIdxInEvent = id;}
+  void SetLabel(Int_t l){fLabel = l;}
+  
+  Float_t P()      const {return TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz);}
+  Float_t Y()      const {if (fE  != fPz) return 0.5*TMath::Log((fE+fPz)/(fE-fPz));
+                                    else return 1.e30;}
+  Float_t Theta () const {return (fPz==0)?TMath::PiOver2():TMath::ACos(fPz/P());}
+
+  Int_t GetUID()   const {return fIdxInEvent;}
+  Int_t GetLabel() const {return fLabel;}
+
+  Float_t Px()     const {return fPx;}
+  Float_t Py()     const {return fPy;}
+  Float_t Pz()     const {return fPz;}
+  Float_t Energy() const {return fE;}
+
+  Float_t Pt()     const {return fPt;}
+  Float_t Eta()    const {return fEta;}
+  Float_t Phi()    const {return fPhi;} 
+
+  void Clear(Option_t *t="");
+  void Print(Option_t *t="") const;
+
+  protected:
+  void Calculate();     //calculate values
+
+  Float_t fPx;          // x component of momentum at vertex
+  Float_t fPy;          // y component of momentum at vertex
+  Float_t fPz;          // z component of momentum at vertex
+  Float_t fE;           // total energy
+  Int_t   fIdxInEvent;  // index of particle as appeared in complete event
+  Int_t   fLabel;
+  Float_t fPt;          // normally calculated 
+  Float_t fEta;         // normally calculated 
+  Float_t fPhi;         // normally calculated 
+
+  ClassDef(AliJetParticle,1)  // Basic Jet Particle class
+};
+#endif
diff --git a/JETAN/AliJetParticlesReader.cxx b/JETAN/AliJetParticlesReader.cxx
new file mode 100644 (file)
index 0000000..8e44348
--- /dev/null
@@ -0,0 +1,311 @@
+// $Id$
+
+//_________________________________________________________________________
+///////////////////////////////////////////////////////////////////////////
+//
+// class AliJetParticlesReader
+//
+// loizides@ikf.uni-frankfurt.de
+///////////////////////////////////////////////////////////////////////////
+
+#include <TObjArray.h>
+#include <TClonesArray.h>
+#include <TClass.h>
+#include <TString.h>
+#include <TObjString.h>
+
+#include "AliJetEventParticles.h"
+#include "AliJetParticlesReader.h"
+
+ClassImp(AliJetParticlesReader)
+
+AliJetParticlesReader::AliJetParticlesReader()
+  : TNamed(),
+    fEventParticles(0),
+    fOwner(kTRUE),
+    fDirs(0),
+    fCurrentEvent(0),
+    fCurrentDir(0),
+    fNEventsRead(0),
+    fFirst(0),
+    fLast(0),
+    fPtMin(0),fPtMax(1000),
+    fEtaMin(-1),fEtaMax(1),
+    fPhiMin(0),fPhiMax(2*TMath::Pi())
+{
+}
+
+AliJetParticlesReader::AliJetParticlesReader(TObjArray *dirs)
+  : TNamed(),
+    fEventParticles(0),
+    fOwner(kTRUE),
+    fDirs(dirs),
+    fCurrentEvent(0),
+    fCurrentDir(0),
+    fNEventsRead(0),
+    fFirst(0),
+    fLast(0),
+    fPtMin(0),fPtMax(1000),
+    fEtaMin(-1),fEtaMax(1),
+    fPhiMin(0),fPhiMax(2*TMath::Pi())
+{
+}
+
+AliJetParticlesReader::~AliJetParticlesReader()
+{
+  if((fOwner) && (fEventParticles)) delete fEventParticles;
+}
+
+Int_t AliJetParticlesReader::Next()
+{
+  //moves to next event
+
+  //if asked to read up to event nb. fLast, 
+  //and it is overcome, report no more events
+  if ((fNEventsRead > fLast) && (fLast > 0) ) return kFALSE;
+  
+  do //if asked to read from event fFirst, rewind to it
+    {
+      if ( ReadNext() == kFALSE) 
+       return kFALSE; //if no more evets, return it
+    } while (fNEventsRead < fFirst);
+   
+  //here we have event
+
+  return kTRUE;
+}
+
+TString& AliJetParticlesReader::GetDirName(Int_t entry)
+{
+  //returns directory name of entry to read
+
+  TString* retval;//return value
+  if (fDirs == 0)
+    {
+     retval = new TString(".");
+     return *retval;
+   }
+
+  if ((entry>fDirs->GetEntries()) || (entry<0))
+                 //if out of bounds return empty string
+                 //note that entry==0 is accepted even if array is empty (size=0)
+    {
+      Error("GetDirName","Entry out of bounds");
+      retval = new TString();
+      return *retval;
+    }
+
+  if (fDirs->GetEntries() == 0)
+    { 
+      retval = new TString(".");
+      return *retval;
+    }
+
+  TClass *objclass = fDirs->At(entry)->IsA();
+  TClass *stringclass = TObjString::Class();
+
+  TObjString *dir = (TObjString*)objclass->DynamicCast(stringclass,fDirs->At(entry));
+  if(dir == 0)
+   {
+     Error("GetDirName","Object in TObjArray is not a TObjString");
+     retval = new TString();
+     return *retval;
+   }
+
+  //Info("GetDirName","Returned ok %s",dir->String().Data());
+  return dir->String();
+}
+
+
+#if 0
+/*************************************************************************************/
+
+void AliHBTReader::AddParticleCut(AliHBTParticleCut* cut)
+{
+ //sets the new cut 
+  if (!cut) //if cut is NULL return with error
+   {
+    Error("AddParticleType","NULL pointers are not accepted any more.\nIf You want to accept all particles of this type, set an empty cut ");
+    return;
+   }
+  AliHBTParticleCut *c = (AliHBTParticleCut*)cut->Clone();
+  fCuts->Add(c);
+}
+/********************************************************************/
+
+AliHBTEvent* AliHBTReader::GetParticleEvent(Int_t n)
+ {
+ //returns Nth event with simulated particles
+  if (ReadsParticles() == kFALSE)
+   {
+     Error("GetParticleEvent","This reader is not able to provide simulated particles.");
+     return 0;
+   } 
+   
+  if (!fIsRead) 
+   { 
+    if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+    if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+    
+    if (Read(fParticles,fTracks))
+     {
+       Error("GetParticleEvent","Error in reading");
+       return 0x0;
+     }
+    else fIsRead = kTRUE;
+   }
+  return fParticles->GetEvent(n);
+ }
+/********************************************************************/
+
+AliHBTEvent* AliHBTReader::GetTrackEvent(Int_t n)
+ {
+ //returns Nth event with reconstructed tracks
+  if (ReadsTracks() == kFALSE)
+   {
+     Error("GetTrackEvent","This reader is not able to provide recosntructed tracks.");
+     return 0;
+   } 
+  if (!fIsRead) 
+   {
+    if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+    if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+    
+    if(Read(fParticles,fTracks))
+     {
+       Error("GetTrackEvent","Error in reading");
+       return 0x0;
+     }
+    else fIsRead = kTRUE;
+   }
+  return fTracks->GetEvent(n);
+ }
+/********************************************************************/
+
+Int_t AliHBTReader::GetNumberOfPartEvents()
+ {
+ //returns number of events of particles
+  if (ReadsParticles() == kFALSE)
+   {
+     Error("GetNumberOfPartEvents","This reader is not able to provide simulated particles.");
+     return 0;
+   } 
+   
+  if (!fIsRead) 
+   {
+    if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+    if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+    
+    if (Read(fParticles,fTracks))
+     {
+       Error("GetNumberOfPartEvents","Error in reading");
+       return 0;
+     }
+    else fIsRead = kTRUE;
+   }
+   return fParticles->GetNumberOfEvents();
+ }
+/********************************************************************/
+Int_t AliHBTReader::GetNumberOfTrackEvents()
+ {
+ //returns number of events of tracks
+  if (ReadsTracks() == kFALSE)
+   {
+     Error("GetNumberOfTrackEvents","This reader is not able to provide recosntructed tracks.");
+     return 0;
+   } 
+  if (!fIsRead)
+   {
+     if (ReadsParticles() && (fParticles == 0x0)) fParticles = new AliHBTRun();
+     if (ReadsTracks() && (fTracks == 0x0)) fTracks = new AliHBTRun();
+     
+     if(Read(fParticles,fTracks))
+      {
+        Error("GetNumberOfTrackEvents","Error in reading");
+        return 0;
+      }
+     else fIsRead = kTRUE;
+   }
+  return fTracks->GetNumberOfEvents();
+ }
+/********************************************************************/
+
+Int_t AliHBTReader::Read(AliHBTRun* particles, AliHBTRun *tracks)
+{
+ //reads data and puts put to the particles and tracks objects
+ //reurns 0 if everything is OK
+ //
+  Info("Read","");
+  
+  if ( ReadsParticles() && (particles == 0x0) ) //check if an object is instatiated
+   {
+     Error("Read"," particles object must be instatiated before passing it to the reader");
+     return 1;
+   }
+  if ( ReadsTracks() && (tracks == 0x0) )  //check if an object is instatiated
+   {
+     Error("Read"," tracks object must be instatiated before passing it to the reader");
+     return 1;
+   }
+   
+  if (ReadsParticles()) particles->Reset();//clear runs == delete all old events
+  if (ReadsTracks()) tracks->Reset();
+  
+  Rewind();
+  
+  Int_t i = 0;
+  while(Next() == kFALSE)
+   {
+     if (ReadsTracks()) tracks->SetEvent(i,fTracksEvent);
+     if (ReadsParticles()) particles->SetEvent(i,fParticlesEvent);
+     i++;
+   }
+  return 0;
+}      
+/*************************************************************************************/
+
+Bool_t AliHBTReader::Pass(AliHBTParticle* p)
+{
+ //Method examines whether particle meets all cut and particle type criteria
+  
+   if(p==0x0)//of corse we not pass NULL pointers
+    {
+     Warning("Pass()","No Pasaran! We never accept NULL pointers");
+     return kTRUE;
+    }
+   //if no particle is specified, we pass all particles
+   //excluding NULL pointers, of course
+  if ( fCuts->GetEntriesFast() == 0 ) return kFALSE; //if no cut specified accept all particles
+  for(Int_t i=0; i<fCuts->GetEntriesFast(); i++)   
+   {
+     AliHBTParticleCut &cut = *((AliHBTParticleCut*)fCuts->At(i));
+     if(!cut.Pass(p)) return kFALSE;  //accepted
+   }
+   
+  return kTRUE;//not accepted
+}
+/*************************************************************************************/
+
+Bool_t  AliHBTReader::Pass(Int_t pid)
+{
+//this method checks if any of existing cuts accepts this pid particles
+//or any cuts accepts all particles
+
+ if(pid == 0)
+  return kTRUE;
+
+ if ( fCuts->GetEntriesFast() == 0 ) return kFALSE; //if no cut specified accept all particles
+  
+ for(Int_t i=0; i<fCuts->GetEntriesFast(); i++)   
+   {
+     AliHBTParticleCut &cut = *((AliHBTParticleCut*)fCuts->At(i));
+     //if some of cuts accepts all particles or some accepts particles of this type, accept
+     if ( (cut.GetPID() == 0) || (cut.GetPID() == pid) ) return kFALSE; 
+   }
+ return kTRUE;
+}
+
+#endif
diff --git a/JETAN/AliJetParticlesReader.h b/JETAN/AliJetParticlesReader.h
new file mode 100644 (file)
index 0000000..b4f846c
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef ALIJETPARTICLESREADER_H
+#define ALIJETPARTICLESREADER_H
+
+/* $Id$ */
+
+//_________________________________________________________________________
+///////////////////////////////////////////////////////////////////////////
+//
+// class AliJetReader
+//
+// loizides@ikf.uni-frankfurt.de
+///////////////////////////////////////////////////////////////////////////
+
+#include <TNamed.h>
+#include <TObjArray.h>
+class TClonesArray;
+class TString;
+class AliJetEventParticles;
+
+class AliJetParticlesReader: public TNamed
+{
+  public:
+  AliJetParticlesReader();
+  AliJetParticlesReader(TObjArray* dirs);
+  virtual ~AliJetParticlesReader();
+
+  void SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names
+  void ReadEventsFromTo(Int_t first,Int_t last){fFirst = first; fLast = last;}
+
+  virtual Int_t Next(); //call this if you want the next event
+  virtual void  Rewind() = 0;
+
+  void SetPtCut(Float_t ptmin=0, Float_t ptmax=1000)
+    {fPtMin=ptmin;fPtMax=ptmax;}
+  void SetPhiCut(Float_t phi=2*TMath::Pi()){SetPhiCut(0,phi);}
+  void SetPhiCut(Float_t phimin, Float_t phimax)
+    {fPhiMin=phimin;fPhiMax=phimax;}
+  void SetEtaCut(Float_t e=1){SetEtaCut(-e,e);}
+  void SetEtaCut(Float_t emin, Float_t emax)
+    {fEtaMin=emin;fEtaMax=emax;}
+
+  const AliJetEventParticles* GetEventParticles() const {return fEventParticles;}
+  AliJetEventParticles* GetEventParticles(Bool_t o) 
+    {fOwner=o; return fEventParticles;} //return particles and set ownership
+
+  Int_t GetNumberOfDirs()       const {return (fDirs)?fDirs->GetEntries():0;}
+  Int_t GetCurEventNumber()     const {return fCurrentEvent;}
+  Int_t GetCurDirNumber()       const {return fCurrentDir;}
+  Int_t GetTotEventsRead()      const {return fNEventsRead;} 
+  Int_t GetFirstEvent()         const {return fFirst;}
+  Int_t GetLastEvent()          const {return fLast;}
+
+  protected:
+
+  virtual Int_t ReadNext() = 0; //this methods reads next event and 
+                                 //put result in fParticles
+  TString& GetDirName(Int_t entry);
+
+  AliJetEventParticles* fEventParticles; //array with read particles
+  Bool_t fOwner;              //ownership of particles
+  TObjArray*   fDirs;         //array with directories to read data from
+  Int_t        fCurrentEvent; //number of current event in current file
+  Int_t        fCurrentDir;   //number of current directory in array
+  Int_t        fNEventsRead;  //total number of processed events 
+  Int_t        fFirst;        //first event to return (all before are skipped)
+  Int_t        fLast;         //last event to return (relative to total number)
+
+  Float_t fPtMin;   //min pt cut
+  Float_t fPtMax;   //max pt cut
+  Float_t fEtaMin;  //min eta cut
+  Float_t fEtaMax;  //max eta cut
+  Float_t fPhiMin;  //min phi cut
+  Float_t fPhiMax;  //max phi cut
+
+  ClassDef(AliJetParticlesReader,1) // Basic AliJetParticles Reader class
+};
+
+#endif
diff --git a/JETAN/AliJetParticlesReaderESD.cxx b/JETAN/AliJetParticlesReaderESD.cxx
new file mode 100644 (file)
index 0000000..68f0568
--- /dev/null
@@ -0,0 +1,246 @@
+// $Id$
+
+//____________________________________________________________________
+//////////////////////////////////////////////////////////////////////
+//                                                                  //
+// class AliHBTReaderESD                                            //
+//                                                                  //
+// Reader for ALICE Event Summary Data (ESD).                       //
+//                                                                  //
+// Piotr.Skowronski@cern.ch                                         //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#include <TMath.h>
+#include <TPDGCode.h>
+#include <TString.h>
+#include <TObjString.h>
+#include <TTree.h>
+#include <TFile.h>
+#include <TKey.h>
+#include <TH1.h>
+#include <AliESD.h>
+#include <AliESDtrack.h>
+#include <AliJetEventParticles.h>
+#include "AliJetParticlesReaderESD.h"
+
+ClassImp(AliJetParticlesReaderESD)
+
+AliJetParticlesReaderESD::AliJetParticlesReaderESD(const Char_t* esdfilename) :
+  AliJetParticlesReader(),
+  fESDFileName(esdfilename),
+  fFile(0),
+  fKeyIterator(0),
+  fPassFlag(AliESDtrack::kTPCrefit)
+{
+  //constructor
+}
+
+/********************************************************************/
+  
+AliJetParticlesReaderESD::AliJetParticlesReaderESD(
+                                      TObjArray* dirs,
+                                      const Char_t* esdfilename) :
+  AliJetParticlesReader(dirs),
+  fESDFileName(esdfilename),
+  fFile(0),
+  fKeyIterator(0),
+  fPassFlag(AliESDtrack::kTPCrefit)
+{
+  //constructor
+}
+
+/********************************************************************/
+
+AliJetParticlesReaderESD::~AliJetParticlesReaderESD()
+{
+  //desctructor
+  if(fFile) delete fFile;
+  if(fKeyIterator) delete fKeyIterator;
+}
+
+
+Int_t AliJetParticlesReaderESD::ReadNext()
+{
+  //reads next event from fFile
+
+  do   // is OK even if 0 dirs specified, 
+    {  // in that case we try to read from "./"
+      if (fFile == 0)
+       {
+         fFile = OpenFile(fCurrentDir);
+         if (fFile == 0)
+           {
+             Error("ReadNext","Cannot get fFile for dir no. %d",fCurrentDir);
+             fCurrentDir++;
+             continue;
+           }
+     
+         fKeyIterator = new TIter(fFile->GetListOfKeys());  
+         fCurrentEvent = 0;
+         //fFile->Dump();
+         //fFile->GetListOfKeys()->Print();
+       } 
+
+      TKey* key = (TKey*)fKeyIterator->Next();
+      if (key == 0)
+       {
+         fCurrentDir++;
+         delete fKeyIterator;
+         fKeyIterator = 0;
+         delete fFile; //we have to assume there are no more ESD objects in the fFile
+         fFile = 0;
+         continue;
+       }
+
+      TString esdname = "ESD";
+      esdname+=fCurrentEvent;
+      AliESD* esd = dynamic_cast<AliESD*>(fFile->Get(esdname));
+      if (esd == 0)
+      {
+       //Info("ReadNext","This key is not an AliESD object %s",key->GetName());
+       Info("ReadNext","Can not find AliESD object named %s",esdname.Data());
+       
+       fCurrentDir++;
+       delete fKeyIterator;
+       fKeyIterator = 0;
+       delete fFile;//we have to assume there is no more ESD objects in the fFile
+       fFile = 0;
+       continue;
+      }
+     
+      ReadESD(esd);
+      
+      fCurrentEvent++;
+      fNEventsRead++;
+      delete esd;
+      return kTRUE;//success -> read one event
+    }  while(fCurrentDir < GetNumberOfDirs());
+       //end of loop over directories specified in fDirs Obj Array  
+  return kFALSE; //no more directories to read
+}
+
+/**********************************************************/
+
+Int_t AliJetParticlesReaderESD::ReadESD(AliESD* esd)
+{
+  //Reads one ESD
+
+  if (esd == 0)
+   {
+     Error("ReadESD","ESD is NULL");
+     return kFALSE;
+   }
+
+  //TDatabasePDG* pdgdb = TDatabasePDG::Instance();
+  //if (pdgdb == 0)
+  //{
+  //   Error("ReadESD","Can not get PDG Database Instance.");
+  //   return kFALSE;
+  // }
+   
+  //Float_t mf = esd->GetMagneticField(); 
+  //if ( (mf == 0.0) && (fNTrackPoints > 0) )
+  //{
+  //   Error("ReadESD","Magnetic Field is 0 and Track Points demanded. Skipping to next event.");
+  //   return kFALSE;
+  //}
+
+  Info("ReadESD","Reading Event %d",fCurrentEvent);
+  if((!fOwner) || (fEventParticles==0)) 
+    fEventParticles = new AliJetEventParticles();
+
+  Double_t vertexpos[3];//vertex position
+  const AliESDVertex* kvertex = esd->GetVertex();
+  if (kvertex == 0)
+   {
+     Info("ReadESD","ESD returned NULL pointer to vertex - assuming (0.0,0.0,0.0)");
+     vertexpos[0] = 0.0;
+     vertexpos[1] = 0.0;
+     vertexpos[2] = 0.0;
+   }
+  else
+   {
+     kvertex->GetXYZ(vertexpos);
+   }
+  fEventParticles->SetVertex(vertexpos[0],vertexpos[1],vertexpos[2]);
+
+  const Int_t kntr = esd->GetNumberOfTracks();
+  Info("ReadESD","Found %d tracks.",kntr);
+  for (Int_t i = 0;i<kntr; i++)
+   {
+     const AliESDtrack *kesdtrack = esd->GetTrack(i);
+     if (kesdtrack == 0)
+      {
+        Error("ReadESD","Can not get track %d", i);
+        continue;
+      }
+
+     if ((kesdtrack->GetStatus() & fPassFlag) == kFALSE)
+      {
+       Info("ReadNext","Particle skipped.");
+        continue;
+      }
+
+     Double_t mom[3];  //momentum
+     kesdtrack->GetPxPyPz(mom);
+     //kesdtrack->GetConstrainedPxPyPz(mom);
+     //Double_t pos[3];//position
+     //kesdtrack->GetXYZ(pos);
+     //kesdtrack->GetConstrainedXYZ(pos);
+     const Float_t kmass=kesdtrack->GetMass();
+     const Float_t kp2=mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2];
+     const Float_t ketot=TMath::Sqrt(kmass*kmass+kp2);
+     const Float_t kpt=TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]);
+     const Float_t kp=TMath::Sqrt(kp2);
+     const Float_t keta=0.5*TMath::Log((kp+mom[2]+1e-30)/(kp-mom[2]+1e-30)); 
+     const Float_t kphi=TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]);
+     if(IsAcceptedParticle(kpt,kphi,keta))
+       fEventParticles->AddParticle(mom[0],mom[1],mom[2],ketot,i,kesdtrack->GetLabel(),kpt,kphi,keta);
+
+   } // loop over tracks
+
+  return kTRUE;
+}
+
+/**********************************************************/
+
+void AliJetParticlesReaderESD::Rewind()
+{
+  //rewinds reading 
+
+  if(fFile) delete fFile;
+  if(fKeyIterator) delete fKeyIterator;
+  fKeyIterator = 0;
+  fFile = 0;
+  fCurrentDir = 0;
+  fNEventsRead = 0;
+}
+
+/**********************************************************/
+
+TFile* AliJetParticlesReaderESD::OpenFile(Int_t n)
+{
+  //opens fFile with kine tree
+
+ const TString& dirname = GetDirName(n);
+ if (dirname == "")
+  {
+   Error("OpenFiles","Can not get directory name");
+   return 0;
+  }
+ TString filename = dirname +"/"+ fESDFileName;
+ TFile *ret = TFile::Open(filename.Data()); 
+ if (ret == 0)
+  {
+    Error("OpenFiles","Can't open fFile %s",filename.Data());
+    return 0;
+  }
+ if (!ret->IsOpen())
+  {
+    Error("OpenFiles","Can't open fFile  %s",filename.Data());
+    return 0;
+  }
+   
+ return ret;
+}
diff --git a/JETAN/AliJetParticlesReaderESD.h b/JETAN/AliJetParticlesReaderESD.h
new file mode 100644 (file)
index 0000000..a82cba5
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef ALIJETPARTICLESREADERESD_H
+#define ALIJETPARTICLESREADERESD_H
+
+//___________________________________________________________________________
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// Multi file reader for ESD                                               //
+//                                                                         //
+// This reader reads tracks from Event Summary Data                        //
+// do not read particles                                                   //
+// Piotr.Skowronski@cern.ch                                                //
+// more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html    //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#include <TString.h>
+#include <AliESDtrack.h>
+#include "AliJetParticlesReader.h"
+
+class TFile;
+class AliESD;
+
+class AliJetParticlesReaderESD: public AliJetParticlesReader
+{
+  public:
+  AliJetParticlesReaderESD(const Char_t* esdfilename = "AliESDs.root") ;
+  AliJetParticlesReaderESD(TObjArray* dirs,const Char_t* esdfilename = "AliESDs.root");
+
+  void SetCompareFlag(ULong_t f){fPassFlag=f;}
+  void SetCompareFlagTPC()
+    {fPassFlag=AliESDtrack::kTPCrefit & AliESDtrack::kTPCrefit;}
+
+#if 0
+    kITSin=0x0001,kITSout=0x0002,kITSrefit=0x0004,kITSpid=0x0008,
+    kTPCin=0x0010,kTPCout=0x0020,kTPCrefit=0x0040,kTPCpid=0x0080,
+    kTRDin=0x0100,kTRDout=0x0200,kTRDrefit=0x0400,kTRDpid=0x0800,
+    kTOFin=0x1000,kTOFout=0x2000,kTOFrefit=0x4000,kTOFpid=0x8000,
+    kPHOSpid=0x10000, kRICHpid=0x20000,
+    kTRDStop=0x20000000,
+    kESDpid=0x40000000,
+    kTIME=0x80000000
+#endif
+
+  virtual ~AliJetParticlesReaderESD();
+
+  //Int_t Next();
+  void Rewind();
+
+  protected:
+  Int_t    ReadESD(AliESD* esd); //read esd file/objects
+  Int_t    ReadNext();           //read the next event
+  TFile*   OpenFile(Int_t evno); //opens file to be read for given event
+  Bool_t   IsAcceptedParticle(Float_t px, Float_t py, Float_t pz) const;
+    
+  TString fESDFileName; // name of the file with tracks
+  TFile*  fFile;        //! pointer to current ESD file
+  TIter*  fKeyIterator; //! key iterator through file
+  ULong_t fPassFlag;    //flag to compare esd flag with 
+
+  ClassDef(AliJetParticlesReaderESD,1) //
+};
+
+inline Bool_t AliJetParticlesReaderESD::IsAcceptedParticle(Float_t pt, Float_t phi, Float_t eta) const
+{
+  if((pt<fPtMin)||(pt>fPtMax)) return kFALSE;
+  if((eta<fEtaMin)||(eta>fEtaMax)) return kFALSE;
+  if((phi<fPhiMin)||(phi>fPhiMax)) return kFALSE;
+
+  return kTRUE;
+}
+#endif
diff --git a/JETAN/AliJetParticlesReaderKine.cxx b/JETAN/AliJetParticlesReaderKine.cxx
new file mode 100644 (file)
index 0000000..4b5af82
--- /dev/null
@@ -0,0 +1,186 @@
+// $Id$
+
+//_______________________________________________________________________
+/////////////////////////////////////////////////////////////////////////
+//
+// class AliJetParticlesReaderKine
+//
+// Reader for Kinematics
+//
+// loizides@ikf.uni-frankfurt.de
+//
+/////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <TString.h>
+#include <TParticle.h>
+#include <AliRunLoader.h>
+#include <AliStack.h>
+
+#include "AliJetParticle.h"
+#include "AliJetEventParticles.h"
+#include "AliJetParticlesReaderKine.h"
+
+ClassImp(AliJetParticlesReaderKine)
+
+
+/**********************************************************/
+
+AliJetParticlesReaderKine::AliJetParticlesReaderKine() :
+  AliJetParticlesReader(),
+  fFileName("galice.root"),
+  fRunLoader(0),
+  fNeutral(kTRUE),fCharged(kTRUE),fEM(kTRUE),
+  fUseTracks(kFALSE)
+{
+  //constructor
+}
+
+/**********************************************************/
+
+
+AliJetParticlesReaderKine::AliJetParticlesReaderKine(TString& fname) :
+  AliJetParticlesReader(),
+  fFileName(fname),
+  fRunLoader(0),
+  fNeutral(kTRUE),fCharged(kTRUE),fEM(kTRUE),
+  fUseTracks(kFALSE)
+{
+  //constructor
+}
+
+/**********************************************************/
+
+AliJetParticlesReaderKine::AliJetParticlesReaderKine(TObjArray* dirs, const Char_t *filename):
+  AliJetParticlesReader(dirs),
+  fFileName(filename),
+  fRunLoader(0),
+  fNeutral(kTRUE),fCharged(kTRUE),fEM(kTRUE),
+  fUseTracks(kFALSE)
+{
+  //constructor
+}
+
+/**********************************************************/
+
+AliJetParticlesReaderKine::~AliJetParticlesReaderKine()
+{
+  //destructor
+  if(fRunLoader) delete fRunLoader;
+}
+
+/**********************************************************/
+
+void AliJetParticlesReaderKine::Rewind()
+{
+  //Rewinds to the beginning
+  if(fRunLoader) delete fRunLoader;
+  fRunLoader = 0;
+  fCurrentDir = 0;
+  fNEventsRead= 0;  
+}
+
+/**********************************************************/
+
+Int_t AliJetParticlesReaderKine::ReadNext()
+{
+  //Reads Kinematics Tree
+
+  if((!fOwner) || (fEventParticles == 0)) 
+    fEventParticles = new AliJetEventParticles();
+
+  do  
+    { 
+      if (!OpenFile(fCurrentDir))
+      { 
+       fCurrentDir++;
+       continue;
+      }
+    
+      if (fCurrentEvent == fRunLoader->GetNumberOfEvents())
+       {
+         //read next directory
+         delete fRunLoader; //close current session
+         fRunLoader = 0;    //assure pointer is null
+         fCurrentDir++;     //go to next dir
+         continue; 
+       }
+     
+      //Info("ReadNext","Reading Event %d",fCurrentEvent);
+
+      fRunLoader->GetEvent(fCurrentEvent);
+      AliStack* stack = fRunLoader->Stack();
+      if (!stack)
+       {
+         Error("ReadNext","Can not get stack for event %d",fCurrentEvent);
+         continue;
+       }
+
+      //get vertex
+      const TParticle *kv = stack->Particle(0);
+      if(kv) {
+       fEventParticles->SetVertex(kv->Vx(),kv->Vy(),kv->Vz());
+      }
+
+      Int_t npart = stack->GetNprimary();
+      if(fUseTracks)
+       npart = stack->GetNtrack();
+
+      fEventParticles->Reset(npart);
+      for (Int_t i = 0;i<npart; i++)
+       {
+         TParticle *p = stack->Particle(i);
+         if(!p) continue;
+         if(p->GetFirstMother() >= 0) continue; 
+
+         if(IsAcceptedParticle(p)) //put particle in event
+           fEventParticles->AddParticle(p,i); 
+       }
+
+      fCurrentEvent++;
+      fNEventsRead++;
+      return kTRUE;
+    } while(fCurrentDir < GetNumberOfDirs());
+      //end of loop over directories specified in fDirs Obj Array
+  return kFALSE;
+}
+
+/**********************************************************/
+
+Int_t AliJetParticlesReaderKine::OpenFile(Int_t n)
+{
+  //opens file with kine tree
+
+  const TString& dirname = GetDirName(n);
+  if (dirname == "")
+    { 
+      Error("OpenNextFile","Can not get directory name with index %d",n);
+      return kFALSE;
+    }
+
+  TString filename = dirname +"/"+ fFileName;
+  fRunLoader = AliRunLoader::Open(filename.Data()); 
+
+  if (fRunLoader == 0)
+    {
+      Error("OpenNextFile","Can't open session from file %s",filename.Data());
+      return kFALSE;
+    }
+  
+  if (fRunLoader->GetNumberOfEvents() <= 0)
+    {
+      Error("OpenNextFile","There is no events in this directory.");
+      delete fRunLoader;
+      fRunLoader = 0;
+      return kFALSE;
+    }
+  
+  if (fRunLoader->LoadKinematics())
+    {
+      Error("OpenNextFile","Error occured while loading kinematics.");
+      return kFALSE;
+    }
+  
+  fCurrentEvent = 0;
+  return kTRUE;
+}
diff --git a/JETAN/AliJetParticlesReaderKine.h b/JETAN/AliJetParticlesReaderKine.h
new file mode 100644 (file)
index 0000000..f0db5b3
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef ALIJETPARTICLESREADERKINE_H
+#define ALIJETPARTICLESREADERKINE_H
+
+/* $Id$ */
+
+//_______________________________________________________________________
+/////////////////////////////////////////////////////////////////////////
+//
+// class AliJetParticlesReaderKine
+//
+// Reader for Kinematics
+//
+// loizides@ikf.uni-frankfurt.de
+//
+/////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <TString.h>
+#include <TParticle.h>
+#include "AliJetParticlesReader.h"
+class AliRunLoader;
+
+class AliJetParticlesReaderKine: public AliJetParticlesReader
+{
+  public:
+  AliJetParticlesReaderKine();
+  AliJetParticlesReaderKine(TString&);
+  AliJetParticlesReaderKine(TObjArray*, const Char_t *filename="galice.root");
+  virtual ~AliJetParticlesReaderKine();
+
+  void Rewind();
+  void SetNeutral(Bool_t b){fNeutral=b;}
+  void SetCharged(Bool_t b){fCharged=b;}
+  void SetEM(Bool_t b){fEM=b;}
+  void SetUseTracks(Bool_t b){fUseTracks=b;}
+
+  protected:
+  Int_t  ReadNext();
+  Int_t  OpenFile(Int_t n);
+  Bool_t IsAcceptedParticle(TParticle *p) const;
+   
+  TString       fFileName;  //file name of galice 
+  AliRunLoader* fRunLoader; //!pointer to loader
+
+  Bool_t  fNeutral; //neutral cut
+  Bool_t  fCharged; //charged cut
+  Bool_t  fEM;      //em (e+,e-,gamma) cut
+  Bool_t  fUseTracks; // use ntracks instead of nprimaries
+  ClassDef(AliJetParticlesReaderKine,1)
+};
+
+inline Bool_t AliJetParticlesReaderKine::IsAcceptedParticle(TParticle *p) const
+{
+  //if(p->GetStatusCode()%100!=1) return kFALSE;
+  Int_t pcode=p->GetPdgCode();  
+  if ((pcode==11)||(pcode==-11)||(pcode==22)) {
+    if(!fEM) return kFALSE;
+  }  else {
+    TParticlePDG *pdg=p->GetPDG();
+    Float_t ch=pdg->Charge(); 
+    if((!fCharged)&&(ch)) return kFALSE;
+    if((!fNeutral)&&(!ch)) return kFALSE;
+  }
+
+  Float_t eta=p->Eta();
+  if((eta<fEtaMin)||(eta>fEtaMax)) return kFALSE;
+
+  Float_t phi=p->Phi();
+  if((phi<fPhiMin)||(phi>fPhiMax)) return kFALSE;
+
+  Float_t pt=p->Pt();
+  if((pt<fPtMin)||(pt>fPtMax)) return kFALSE;
+
+  return kTRUE;
+}
+#endif
diff --git a/JETAN/JetAnalysisLinkDef.h b/JETAN/JetAnalysisLinkDef.h
new file mode 100644 (file)
index 0000000..a462ad4
--- /dev/null
@@ -0,0 +1,14 @@
+#ifdef __CINT__
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class AliJetParticle+;
+#pragma link C++ class AliJet+;
+#pragma link C++ class AliJetEvent+;
+#pragma link C++ class AliJetEventParticles+;
+#pragma link C++ class AliJetParticlesReader+;
+#pragma link C++ class AliJetParticlesReaderESD+;
+#pragma link C++ class AliJetParticlesReaderKine+;
+#endif
diff --git a/JETAN/libJETAN.pkg b/JETAN/libJETAN.pkg
new file mode 100644 (file)
index 0000000..d2df920
--- /dev/null
@@ -0,0 +1,12 @@
+#-*-Mode: Makefile-*-
+
+SRCS = AliJetParticle.cxx AliJet.cxx AliJetEvent.cxx AliJetEventParticles.cxx \
+       AliJetParticlesReader.cxx AliJetParticlesReaderESD.cxx \
+       AliJetParticlesReaderKine.cxx 
+
+HDRS:= $(SRCS:.cxx=.h)
+
+DHDR= JetAnalysisLinkDef.h
+
+EINCLUDE:= STEER ANALYSIS
+