Move to AOD/ESD schema - ITS readers not needed any more
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jun 2004 10:10:43 +0000 (10:10 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jun 2004 10:10:43 +0000 (10:10 +0000)
HBTAN/AliHBTReaderITSv1.cxx [deleted file]
HBTAN/AliHBTReaderITSv1.h [deleted file]
HBTAN/AliHBTReaderITSv2.cxx [deleted file]
HBTAN/AliHBTReaderITSv2.h [deleted file]

diff --git a/HBTAN/AliHBTReaderITSv1.cxx b/HBTAN/AliHBTReaderITSv1.cxx
deleted file mode 100644 (file)
index 11ec99f..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-//____________________________________________________________________
-//////////////////////////////////////////////////////////////////////
-//                                                                  //
-//  class AliHBTReaderITSv1                                         //
-//                                                                  //
-//  Reader for ITSv1 tracks. Not maintained since v1 is not         //
-//  supposed to be used                                             //
-//                                                                  //
-//////////////////////////////////////////////////////////////////////
-
-#include <Riostream.h>
-#include <TBranch.h>
-#include <TFile.h>
-#include <TObjArray.h>
-#include <TParticle.h>
-#include <TString.h>
-#include <TTree.h>
-
-#include "AliHBTParticle.h"
-#include "AliHBTParticleCut.h"
-#include "AliHBTReaderITSv1.h"
-#include "AliHBTRun.h"
-#include "AliITSIOTrack.h"
-#include "AliKalmanTrack.h"
-#include "AliMagF.h"
-#include "AliRun.h"
-#include "AliStack.h"
-
-ClassImp(AliHBTReaderITSv1)
-/********************************************************************/
-
-AliHBTReaderITSv1::AliHBTReaderITSv1(const Char_t* tracksfilename,const Char_t* galicefilename):
- fITSTracksFileName(tracksfilename),
- fGAliceFileName(galicefilename)
-{
- //ctor
-}
-/********************************************************************/
-
-AliHBTReaderITSv1::AliHBTReaderITSv1(TObjArray* dirs, const Char_t* tracksfilename,const Char_t* galicefilename):
- AliHBTReader(dirs),
- fITSTracksFileName(tracksfilename),
- fGAliceFileName(galicefilename)
-{
-//ctor
-}
-/********************************************************************/
-
-AliHBTReaderITSv1::~AliHBTReaderITSv1()
-{
-//dtor
-}
-/********************************************************************/
-
-
-Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks)
-{
-//Reads data
- Int_t nevents = 0;
- AliITSIOTrack *iotrack=new AliITSIOTrack;
- Int_t currentdir = 0;
- Int_t ndirs;
- Int_t totalnevents = 0;
- if (fDirs)
-  {
-    ndirs = fDirs->GetEntries();
-  }
- else
-  {
-    ndirs = 0;
-  }
- do //do while is good even if 
-  {  
-   TFile* gAliceFile = OpenGAliceFile(currentdir);
-   if(gAliceFile == 0x0)
-    {
-       Error("Read","Can not open the file with gAlice");
-       delete iotrack;
-       return 1;
-    }
-   if (gAlice->TreeE())//check if tree E exists
-     {
-      nevents = (Int_t)gAlice->TreeE()->GetEntries();//if yes get number of events in gAlice
-      cout<<"________________________________________________________\n";
-      cout<<"Found "<<nevents<<" event(s) in directory "<<GetDirName(currentdir)<<endl;
-      cout<<"Setting Magnetic Field. Factor is "<<gAlice->Field()->Factor()<<endl;
-      AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
-     }
-    else
-     {//if not return an error
-       Error("Read","Can not find Header tree (TreeE) in gAlice");
-       delete iotrack;
-       return 4;
-     }
-
-   TFile *file = OpenTrackFile(currentdir);
-   if(file == 0x0)
-    {
-       Error("Read","Can not open the file with ITS tracks V1");
-       delete iotrack;
-       return 2;
-    }
-    
-   Int_t naccepted = 0;
-   char tname[30];
-   
-   for (Int_t currentEvent = 0; currentEvent < nevents; currentEvent++)
-    { 
-      cout<<"Reading Event "<<currentEvent;
-      
-      sprintf(tname,"TreeT%d",currentEvent);
-      file->cd(); 
-      TTree *tracktree=(TTree*)file->Get(tname);
-      TBranch *tbranch=tracktree->GetBranch("ITStracks");
-      tbranch->SetAddress(&iotrack);
-      
-      gAliceFile->cd();
-      gAlice->GetEvent(currentEvent);
-      gAlice->Stack()->Particles();
-
-      Int_t nentr=(Int_t)tracktree->GetEntries();
-      
-      cout<<".  Found "<<nentr<<" tracks.";
-      fflush(0);
-      
-      for (Int_t i=0; i<nentr; i++) 
-       {
-
-        tracktree->GetEvent(i);
-        if(!iotrack) continue;       
-        Int_t label = iotrack->GetLabel();
-        if (label < 0) 
-         {
-           continue;
-         }
-
-        TParticle *p = (TParticle*)gAlice->Stack()->Particle(label);
-        if(!p)
-         {
-           Warning("Read","Can not get particle with label &d",label);
-           continue;
-         }
-        if(Pass(p->GetPdgCode())) continue; //check if we are intersted with particles of this type
-                                           //if not take next partilce
-
-        AliHBTParticle* part = new AliHBTParticle(*p,i);
-        if(Pass(part)) { delete part; continue;}//check if meets all criteria of any of our cuts
-                                                //if it does not delete it and take next good track
-        
-        Double_t px=iotrack->GetPx();
-        Double_t py=iotrack->GetPy();
-        Double_t pz=iotrack->GetPz();
-        Double_t mass = p->GetMass();
-        Double_t tEtot = TMath::Sqrt(px*px + py*py + pz*pz + mass*mass);//total energy of the track
-        Double_t x= iotrack->GetX();
-        Double_t y= iotrack->GetY();
-        Double_t z= iotrack->GetZ();
-        
-        AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(), i, px, py , pz, tEtot, x, y, z, 0.);
-        if(Pass(track)) { delete  track;continue;}//check if meets all criteria of any of our cuts
-                                                  //if it does not delete it and take next good track
-
-        particles->AddParticle(totalnevents,part);//put track and particle on the run
-        tracks->AddParticle(totalnevents,track);
-        naccepted++;
-       }//end loop over tracks in the event
-
-       totalnevents++;
-       cout<<"  Accepted "<<naccepted<<" tracks"<<endl;
-     }//end of loop over events in current directory
-    
-    gAliceFile->Close();
-    delete gAliceFile;
-    gAliceFile = 0;
-    
-    file->Close(); 
-    delete file;
-    file = 0;
-    currentdir++;
-   }while(currentdir < ndirs);//end of loop over directories specified in fDirs Obj Array
-
-
-  delete iotrack;
-  fIsRead = kTRUE;
-  return 0;
- }
-/********************************************************************/
-
-TFile* AliHBTReaderITSv1::OpenTrackFile(Int_t ndir)
-{
-//opens files to be read for given directoru nomber in fDirs Array
-   const TString& dirname = GetDirName(ndir); 
-   if (dirname == "")
-    {
-      Error("OpenGAliceFile","Can not get directory name");
-      return 0x0;
-    }
-   TString filename = dirname + "/" + fITSTracksFileName;
-
-   TFile *file = TFile::Open(filename.Data());   
-   if (!file)
-    {
-      Error("Read","Can not open file %s",filename.Data());
-      return 0x0;
-    }
-   if (!file->IsOpen())
-    {
-      Error("Read","Can not open file %s",filename.Data());
-      return 0x0;
-    }
-   
-   return file;
-}
-
-
-/********************************************************************/
-TFile* AliHBTReaderITSv1::OpenGAliceFile(Int_t ndir)
-{
-//Opens galice.root file
-  const TString& dirname = GetDirName(ndir); 
-   if (dirname == "")
-    {
-      Error("OpenGAliceFile","Can not get directory name");
-      return 0x0;
-    }
-  
-  TString filename = dirname + "/" + fGAliceFileName;
-
-  TFile* gAliceFile = TFile::Open(filename.Data());
-  if ( gAliceFile== 0x0)
-   {
-     Error("OpenFiles","Can't open file named %s",filename.Data());
-     return 0x0;
-   }
-  if (!gAliceFile->IsOpen())
-   {
-     Error("OpenFiles","Can't open file named %s",filename.Data());
-     return 0x0;
-   }
-
-  if (!(gAlice=(AliRun*)gAliceFile->Get("gAlice")))
-   {
-     Error("OpenFiles","gAlice have not been found on %s !\n",filename.Data());
-     gAliceFile->Close();
-     delete gAliceFile;
-     return 0x0;
-   }
-  
-  return gAliceFile;
-}
-
-/********************************************************************/
-/********************************************************************/
-
-
diff --git a/HBTAN/AliHBTReaderITSv1.h b/HBTAN/AliHBTReaderITSv1.h
deleted file mode 100644 (file)
index 90366bf..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef ALIHBTREADERITSV1_H
-#define ALIHBTREADERITSV1_H
-//____________________________________________________________________
-//////////////////////////////////////////////////////////////////////
-//                                                                  //
-//  class AliHBTReaderITSv1                                         //
-//                                                                  //
-//  Reader for ITSv1 tracks. Not maintained since v1 is not         //
-//  supposed to be used                                             //
-//                                                                  //
-//////////////////////////////////////////////////////////////////////
-
-
-#include "AliHBTReader.h"
-
-#include <TString.h>
-
-class TObjArray;
-class TFile;
-class AliHBTReaderITSv1: public AliHBTReader
-{
-  public:    
-    AliHBTReaderITSv1(const Char_t* tracksfilename="itstracks.root",
-                      const Char_t* galicefilename="galice.root");
-    AliHBTReaderITSv1(TObjArray* dirs,
-                      const Char_t* tracksfilename="itstracks.root",
-                      const Char_t* galicefilename="galice.root");    
-    
-    
-    virtual ~AliHBTReaderITSv1();
-    
-    Int_t Read(AliHBTRun* particles, AliHBTRun *tracks);//reads tracks and particles and puts them in runs
-    
-    
-  protected:
-    TString fITSTracksFileName; //name of the file with tracks
-    TString fGAliceFileName;//name of the file containing Run Loader
-    
-    TFile* OpenTrackFile(Int_t n);//opens files to be read for given directoru nomber in fDirs Array
-    TFile* OpenGAliceFile(Int_t n);
-    
-  private:
-    ClassDef(AliHBTReaderITSv1,1)
-};
-
-#endif
diff --git a/HBTAN/AliHBTReaderITSv2.cxx b/HBTAN/AliHBTReaderITSv2.cxx
deleted file mode 100644 (file)
index 4f57aad..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-#include "AliHBTReaderITSv2.h"
-
-#include <Varargs.h>
-
-#include <TString.h>
-#include <TObjString.h>
-#include <TTree.h>
-#include <TParticle.h>
-
-#include <AliRun.h>
-#include <AliRunLoader.h>
-#include <AliLoader.h>
-#include <AliStack.h>
-#include <AliMagF.h>
-#include <AliITStrackV2.h>
-
-#include "AliHBTRun.h"
-#include "AliHBTEvent.h"
-#include "AliHBTParticle.h"
-#include "AliHBTParticleCut.h"
-
-
-ClassImp(AliHBTReaderITSv2)
-
-AliHBTReaderITSv2::AliHBTReaderITSv2():
- fFileName("galice.root"),
- fRunLoader(0x0),
- fITSLoader(0x0),
- fMagneticField(0.0),
- fUseMagFFromRun(kTRUE)
-{
-  //constructor, 
-  //Defaults:
-  //  galicefilename = "galice.root"
-}
-/********************************************************************/
-
-AliHBTReaderITSv2::AliHBTReaderITSv2(const Char_t* galicefilename):
- fFileName(galicefilename),
- fRunLoader(0x0),
- fITSLoader(0x0),
- fMagneticField(0.0),
- fUseMagFFromRun(kTRUE)
-{
-  //constructor, 
-  //Defaults:
-  //  galicefilename = "galice.root"
-}
-/********************************************************************/
-
-AliHBTReaderITSv2::AliHBTReaderITSv2(TObjArray* dirs, const Char_t* galicefilename): 
- AliHBTReader(dirs),
- fFileName(galicefilename),
- fRunLoader(0x0),
- fITSLoader(0x0),
- fMagneticField(0.0),
- fUseMagFFromRun(kTRUE)
-{
-  //constructor, 
-  //Defaults:
-  //  galicefilename = "galice.root"
-  
-}
-/********************************************************************/
-void AliHBTReaderITSv2::Rewind()
-{
-  //rewinds reading
-  delete fRunLoader;
-  fRunLoader = 0x0;
-  fCurrentDir = 0;
-  fNEventsRead= 0;
-}
-/********************************************************************/
-
-AliHBTReaderITSv2::~AliHBTReaderITSv2()
-{
-  //dtor
-  delete fRunLoader;
-}
-/********************************************************************/
-Int_t AliHBTReaderITSv2::ReadNext()
-{
-//reads data from next event
-  
- register Int_t i = 0; //iterator
-// AliITStrackerV2 *tracker; // ITS tracker - used for cooking labels
- TTree *tracktree = 0x0; // tree for tracks
- AliITStrackV2 *iotrack = 0x0;
- Double_t xk;
- Double_t par[5]; //Kalman track parameters
- Float_t phi, lam, pt;//angles and transverse momentum
- Int_t label; //label of the current track
- if (fParticlesEvent == 0x0)  fParticlesEvent = new AliHBTEvent();
- if (fTracksEvent == 0x0)  fTracksEvent = new AliHBTEvent();
-
- fParticlesEvent->Reset();
- fTracksEvent->Reset();
- do //do while is good even if Ndirs==0 (than read from current directory)
-   {
-    if (fRunLoader == 0x0) 
-      if (OpenNextFile()) continue;//directory counter is increased inside in case of error
-
-    if (fCurrentEvent == fRunLoader->GetNumberOfEvents())
-     {
-       //read next directory
-       delete fRunLoader;//close current session
-       fRunLoader = 0x0;//assure pointer is null
-       fCurrentDir++;//go to next dir
-       continue;//directory counter is increased inside in case of error
-     }
-     
-    Info("ReadNext","Reading Event %d",fCurrentEvent);
-     
-    fRunLoader->GetEvent(fCurrentEvent);
-    
-    tracktree=fITSLoader->TreeT();
-    if (!tracktree) 
-     {
-       Error("ReadNext","Can't get a tree with ITS tracks"); 
-       fCurrentEvent++;
-       continue;
-     }
-      
-    TBranch *tbranch=tracktree->GetBranch("tracks");
-    if (!tbranch) 
-     {
-       Error("ReadNext","Can't get a branch with ITS tracks"); 
-       fCurrentEvent++;
-       continue;
-     }
-
-    AliStack* stack = fRunLoader->Stack();
-    if (stack == 0x0)
-     {
-       Error("ReadNext","Can not get stack for current event",fCurrentEvent);
-       fCurrentEvent++;
-       continue;
-     }
-     
-    //must be here because on the beginning conv. const. is not set yet 
-    if (iotrack == 0x0) iotrack = new AliITStrackV2(); //buffer track for reading data from tree
-    
-    Int_t ntr = (Int_t)tracktree->GetEntries();
-    
-    for (i=0; i < ntr; i++) //loop over all tpc tracks
-     { 
-       tbranch->SetAddress(&iotrack);
-       tracktree->GetEvent(i);
-
-       label=iotrack->GetLabel();
-       if (label < 0) 
-        {
-          continue;
-        }
-
-       TParticle *p = stack->Particle(label);
-       if(p == 0x0) continue; //if returned pointer is NULL
-       if(p->GetPDG() == 0x0) continue; //if particle has crezy PDG code (not known to our database)
-
-       if(Pass(p->GetPdgCode())) continue; //check if we are intersted with particles of this type 
-                                           //if not take next partilce
-
-       AliHBTParticle* part = new AliHBTParticle(*p,i);
-       if(Pass(part)) { delete part; continue;}//check if meets all criteria of any of our cuts
-                                               //if it does not delete it and take next good track
-
-       iotrack->PropagateTo(3.,0.0028,65.19);
-       iotrack->PropagateToVertex();
-
-       iotrack->GetExternalParameters(xk,par);     //get properties of the track
-       phi=TMath::ASin(par[2]) + iotrack->GetAlpha(); 
-       if (phi<-TMath::Pi()) phi+=2*TMath::Pi();
-       if (phi>=TMath::Pi()) phi-=2*TMath::Pi();
-       lam=par[3]; 
-       pt=1.0/TMath::Abs(par[4]);
-
-       Double_t tpx = pt * TMath::Cos(phi); //track x coordinate of momentum
-       Double_t tpy = pt * TMath::Sin(phi); //track y coordinate of momentum
-       Double_t tpz = pt * lam; //track z coordinate of momentum
-
-       Double_t mass = p->GetMass();
-       Double_t tEtot = TMath::Sqrt( tpx*tpx + tpy*tpy + tpz*tpz + mass*mass);//total energy of the track
-
-       AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(), i, tpx, tpy , tpz, tEtot, 0., 0., 0., 0.);
-       if(Pass(track))//check if meets all criteria of any of our cuts
-                      //if it does not delete it and take next good track
-        { 
-         delete track;
-         delete part;
-         continue;
-        }
-        
-       fParticlesEvent->AddParticle(part);
-       fTracksEvent->AddParticle(track);
-     }//end of loop over tracks in the event
-       
-    Info("ReadNext","Read %d tracks and %d particles from event %d (event %d in dir %d).",
-            fParticlesEvent->GetNumberOfParticles(), fTracksEvent->GetNumberOfParticles(),
-            fNEventsRead,fCurrentEvent,fCurrentDir);
-     
-    fCurrentEvent++;
-    fNEventsRead++;
-    delete iotrack;
-    return 0;
-   }while(fCurrentDir < GetNumberOfDirs());//end of loop over directories specified in fDirs Obj Array
-
- delete iotrack;
- return 1;
-}
-
-/********************************************************************/
-Int_t AliHBTReaderITSv2::OpenNextFile()
-{
-  //opens next file
-  TString filename = GetDirName(fCurrentDir);
-  if (filename.IsNull())
-   {
-     DoOpenError("Can not get directory name");
-     return 1;
-   }
-  filename = filename +"/"+ fFileName;
-  fRunLoader = AliRunLoader::Open(filename,AliConfig::GetDefaultEventFolderName());
-  if( fRunLoader == 0x0)
-   {
-     DoOpenError("Can not open session.");
-     return 1;
-   }
-
-  if (fRunLoader->GetNumberOfEvents() <= 0)
-   {
-     DoOpenError("There is no events in this directory.");
-     return 1;
-   }
-
-  if (fRunLoader->LoadKinematics())
-   {
-     DoOpenError("Error occured while loading kinematics.");
-     return 1;
-   }
-  fITSLoader = fRunLoader->GetLoader("ITSLoader");
-  if ( fITSLoader == 0x0)
-   {
-     DoOpenError("Exiting due to problems with opening files.");
-     return 1;
-   }
-   
-  Info("OpenNextSession","________________________________________________________");
-  Info("OpenNextSession","Found %d event(s) in directory %s",
-        fRunLoader->GetNumberOfEvents(),GetDirName(fCurrentDir).Data());
-  Float_t mf;
-  if (fUseMagFFromRun)
-   {
-     if (fRunLoader->LoadgAlice())
-      {
-        DoOpenError("Error occured while loading AliRun.");
-        return 1;
-      }
-     mf = fRunLoader->GetAliRun()->Field()->SolenoidField();
-     Info("OpenNextSession","Setting Magnetic Field from run: B=%fT",mf/10.);
-     fRunLoader->UnloadgAlice();
-   }
-  else
-   {
-     Info("OpenNextSession","Setting Own Magnetic Field: B=%fT",fMagneticField);
-     if (fMagneticField == 0x0)
-      {
-        Fatal("OpenNextSession","Magnetic field can not be 0.");
-        return 1;//pro forma
-      }
-     mf = fMagneticField*10.;
-   }
-  AliKalmanTrack::SetConvConst(1000/0.299792458/mf);
-
-  if (fITSLoader->LoadTracks())
-   {
-     DoOpenError("Error occured while loading TPC tracks.");
-     return 1;
-   }
-  
-  fCurrentEvent = 0;
-  return 0;
-}
-/********************************************************************/
-
-void AliHBTReaderITSv2::DoOpenError( const char *va_(fmt), ...)
-{
-  // Does error display and clean-up in case error caught on Open Next Session
-
-   va_list ap;
-   va_start(ap,va_(fmt));
-   Error("OpenNextFile", va_(fmt), ap);
-   va_end(ap);
-   
-   delete fRunLoader;
-   fRunLoader = 0x0;
-   fITSLoader = 0x0;
-   fCurrentDir++;
-}
-
-/********************************************************************/
diff --git a/HBTAN/AliHBTReaderITSv2.h b/HBTAN/AliHBTReaderITSv2.h
deleted file mode 100644 (file)
index e52a0e5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef ALIHBTREADERITSV2_H
-#define ALIHBTREADERITSV2_H
-
-#include "AliHBTReader.h"
-
-
-class AliLoader;
-class AliRunLoader;
-class TString;
-
-class AliHBTReaderITSv2: public AliHBTReader
-{
-  public:
-    
-    AliHBTReaderITSv2();
-    AliHBTReaderITSv2(const Char_t* galicefilename);
-    AliHBTReaderITSv2(TObjArray* dirs, const Char_t* galicefilename = "galice.root");
-
-    virtual ~AliHBTReaderITSv2();
-    
-    void          Rewind();
-    
-    Bool_t        ReadsTracks() const {return kTRUE;}
-    Bool_t        ReadsParticles() const {return kTRUE;}
-    
-    void          SetMagneticField(Float_t mf){fMagneticField=mf;}
-    void          UseMagneticFieldFromRun(Bool_t flag = kTRUE){fUseMagFFromRun=flag;}
-    
-  protected:
-    
-    Int_t         ReadNext();//reads tracks and particles and puts them in runs
-    Int_t         OpenNextFile();
-    void          DoOpenError( const char *va_(fmt), ...);
-        
-    TString       fFileName;//name of the file with galice.root
-    AliRunLoader* fRunLoader;//!Run Loader
-    AliLoader*    fITSLoader;//! ITS Loader
-        
-    Float_t       fMagneticField;//magnetic field value that was enforced while reading
-    Bool_t        fUseMagFFromRun;//flag indicating if using field specified in gAlice (kTRUE)
-                               // or enforece other defined by fMagneticField
-    
-    ClassDef(AliHBTReaderITSv2,2)
-};
-
-#endif