]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HBTAN/AliHBTReaderTPC.cxx
geometry 12 + 24 && recent media properties
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReaderTPC.cxx
index e310ce4c987dcbf5a0b1f4ea0299389b9bd7ccfd..d4c8e6bd2f7882ef2f0e7863732072d0c86e2328 100644 (file)
@@ -3,32 +3,31 @@
 //
 // class AliHBTReaderTPC
 //
-// reader for TPC tracking
-// needs galice.root, AliTPCtracks.root, AliTPCclusters.root
-//
+// reader for TPC tracks
+// needs galice.root
+// just to shut up coding conventions checker
+// 
 // more info: http://aliweb.cern.ch/people/skowron/analyzer/index.html
 // Piotr.Skowronski@cern.ch
 //
 ///////////////////////////////////////////////////////////////////////////
 #include <TTree.h>
-#include <TFile.h>
 #include <TParticle.h>
+#include <TH1.h>
 
-#include <Varargs.h>
 
 #include <AliRun.h>
 #include <AliLoader.h>
 #include <AliStack.h>
 #include <AliMagF.h>
 #include <AliTPCtrack.h>
-#include <AliTPCParam.h>
-#include <AliTPCtracker.h>
 #include <AliTPCLoader.h>
 
-#include "AliHBTRun.h"
 #include "AliHBTEvent.h"
 #include "AliHBTParticle.h"
-#include "AliHBTParticleCut.h"
+#include "AliHBTTrackPoints.h"
+#include "AliHBTClusterMap.h"
+
 
 ClassImp(AliHBTReaderTPC)
 
@@ -38,19 +37,28 @@ AliHBTReaderTPC::AliHBTReaderTPC():
  fTPCLoader(0x0),
  fMagneticField(0.0),
  fUseMagFFromRun(kTRUE),
+ fNTrackPoints(0),
+ fdR(0.0),
+ fClusterMap(kFALSE),
  fNClustMin(0),
- fNClustMax(190),
+ fNClustMax(150),
  fNChi2PerClustMin(0.0),
  fNChi2PerClustMax(10e5),
+ fC00Min(0.0),
+ fC00Max(10e5),
+ fC11Min(0.0),
+ fC11Max(10e5),
+ fC22Min(0.0),
+ fC22Max(10e5),
+ fC33Min(0.0),
+ fC33Max(10e5),
  fC44Min(0.0),
  fC44Max(10e5)
 {
-  //constructor, 
-  //Defaults:
-  //  galicefilename = ""  - this means: Do not open gAlice file - 
-  //                         just leave the global pointer untouched
+  //constructor
   
 }
+/********************************************************************/
 
 AliHBTReaderTPC::AliHBTReaderTPC(const Char_t* galicefilename):
  fFileName(galicefilename),
@@ -58,20 +66,28 @@ AliHBTReaderTPC::AliHBTReaderTPC(const Char_t* galicefilename):
  fTPCLoader(0x0),
  fMagneticField(0.0),
  fUseMagFFromRun(kTRUE),
+ fNTrackPoints(0),
+ fdR(0.0),
  fNClustMin(0),
- fNClustMax(190),
+ fNClustMax(150),
  fNChi2PerClustMin(0.0),
  fNChi2PerClustMax(10e5),
+ fC00Min(0.0),
+ fC00Max(10e5),
+ fC11Min(0.0),
+ fC11Max(10e5),
+ fC22Min(0.0),
+ fC22Max(10e5),
+ fC33Min(0.0),
+ fC33Max(10e5),
  fC44Min(0.0),
  fC44Max(10e5)
 {
   //constructor, 
   //Defaults:
-  //  galicefilename = ""  - this means: Do not open gAlice file - 
-  //                         just leave the global pointer untouched
-  
 }
 /********************************************************************/
+
 AliHBTReaderTPC::AliHBTReaderTPC(TObjArray* dirs, const Char_t* galicefilename):
  AliHBTReader(dirs), 
  fFileName(galicefilename),
@@ -79,10 +95,21 @@ AliHBTReaderTPC::AliHBTReaderTPC(TObjArray* dirs, const Char_t* galicefilename):
  fTPCLoader(0x0),
  fMagneticField(0.0),
  fUseMagFFromRun(kTRUE),
+ fNTrackPoints(0),
+ fdR(0.0),
+ fClusterMap(kFALSE),
  fNClustMin(0),
- fNClustMax(190),
+ fNClustMax(150),
  fNChi2PerClustMin(0.0),
  fNChi2PerClustMax(10e5),
+ fC00Min(0.0),
+ fC00Max(10e5),
+ fC11Min(0.0),
+ fC11Max(10e5),
+ fC22Min(0.0),
+ fC22Max(10e5),
+ fC33Min(0.0),
+ fC33Max(10e5),
  fC44Min(0.0),
  fC44Max(10e5)
 {
@@ -93,6 +120,33 @@ AliHBTReaderTPC::AliHBTReaderTPC(TObjArray* dirs, const Char_t* galicefilename):
   
 }
 /********************************************************************/
+AliHBTReaderTPC::AliHBTReaderTPC(const AliHBTReaderTPC& in):
+ AliHBTReader(in),
+ fFileName(in.fFileName),
+ fRunLoader(0x0),
+ fTPCLoader(0x0),
+ fMagneticField(in.fMagneticField),
+ fUseMagFFromRun(in.fUseMagFFromRun),
+ fNTrackPoints(in.fNTrackPoints),
+ fdR(in.fdR),
+ fNClustMin(in.fNClustMin),
+ fNClustMax(in.fNClustMax),
+ fNChi2PerClustMin(in.fNChi2PerClustMin),
+ fNChi2PerClustMax(in.fNChi2PerClustMax),
+ fC00Min(in.fC00Min),
+ fC00Max(in.fC00Max),
+ fC11Min(in.fC11Min),
+ fC11Max(in.fC11Max),
+ fC22Min(in.fC22Min),
+ fC22Max(in.fC22Max),
+ fC33Min(in.fC33Min),
+ fC33Max(in.fC33Max),
+ fC44Min(in.fC44Min),
+ fC44Max(in.fC44Max)
+{
+  //cpy constructor, 
+}
+/********************************************************************/
 
 AliHBTReaderTPC::~AliHBTReaderTPC()
 {
@@ -111,13 +165,46 @@ AliHBTReaderTPC::~AliHBTReaderTPC()
     }
 }
 /********************************************************************/
+
+AliHBTReaderTPC& AliHBTReaderTPC::operator=(const AliHBTReaderTPC& in)
+{
+//Assigment operator
+
+ delete fRunLoader;
+
+ fFileName = in.fFileName;
+ fRunLoader = 0x0;
+ fTPCLoader = 0x0;
+ fMagneticField = in.fMagneticField;
+ fUseMagFFromRun = in.fUseMagFFromRun;
+ fNTrackPoints = in.fNTrackPoints;
+ fdR = in.fdR;
+ fNClustMin = in.fNClustMin;
+ fNClustMax = in.fNClustMax;
+ fNChi2PerClustMin = in.fNChi2PerClustMin;
+ fNChi2PerClustMax = in.fNChi2PerClustMax;
+ fC00Min = in.fC00Min;
+ fC00Max = in.fC00Max;
+ fC11Min = in.fC11Min;
+ fC11Max = in.fC11Max;
+ fC22Min = in.fC22Min;
+ fC22Max = in.fC22Max;
+ fC33Min = in.fC33Min;
+ fC33Max = in.fC33Max;
+ fC44Min = in.fC44Min;
+ fC44Max = in.fC44Max;
+ return *this; 
+} 
+/********************************************************************/
+
 void AliHBTReaderTPC::Rewind()
 {
+//Rewind reading to the beginning
   delete fRunLoader;
   fRunLoader = 0x0;
   fCurrentDir = 0;
   fNEventsRead= 0;
+  if (fTrackCounter) fTrackCounter->Reset();
 }
 /********************************************************************/
 
@@ -127,8 +214,7 @@ Int_t AliHBTReaderTPC::ReadNext()
  //reurns 0 if everything is OK
  //
   Info("Read","");
-
+  
   TObjArray *tarray = new TObjArray(5000); //cotainer for tpc tracks
   tarray->SetOwner(); //set the ownership of the objects it contains
                       //when array is is deleted or cleared all objects 
@@ -162,6 +248,7 @@ Int_t AliHBTReaderTPC::ReadNext()
     if (!tracktree) //check if we got the tree
       {//if not return with error
          Error("ReadNext","Can't get a tree with TPC tracks !\n"); 
+         fCurrentEvent++;//go to next dir
          continue;
       }
    
@@ -169,6 +256,7 @@ Int_t AliHBTReaderTPC::ReadNext()
     if (!trackbranch) ////check if we got the branch
       {//if not return with error
         Error("ReadNext","Can't get a branch with TPC tracks !\n"); 
+        fCurrentEvent++;//go to next dir
         continue;
       }
     Int_t ntpctracks=(Int_t)tracktree->GetEntries();//get number of TPC tracks 
@@ -206,18 +294,18 @@ Int_t AliHBTReaderTPC::ReadNext()
 
        if (label < 0) continue;
        
-       if (CheckTrack(iotrack)) continue;
+       if (CheckTrack(iotrack)) continue;//Checks the cuts on track parameters cov. mtx etc
        
        TParticle *p = (TParticle*)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(Rejected(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(Rejected(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);
@@ -240,13 +328,25 @@ Int_t AliHBTReaderTPC::ReadNext()
        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(Rejected(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;
         }
+        
+       if (fNTrackPoints > 0) 
+        {
+          AliHBTTrackPoints* tpts = new AliHBTTrackPoints(fNTrackPoints,iotrack,fdR);
+          track->SetTrackPoints(tpts);
+        }
+       if (  fClusterMap ) 
+        {
+          AliHBTClusterMap* cmap = new AliHBTClusterMap(iotrack);
+          track->SetClusterMap(cmap);
+        }
+    
        fParticlesEvent->AddParticle(part);
        fTracksEvent->AddParticle(track);
       }
@@ -254,7 +354,7 @@ Int_t AliHBTReaderTPC::ReadNext()
     Info("ReadNext","Read %d tracks and %d particles from event %d (event %d in dir %d).",
             fParticlesEvent->GetNumberOfParticles(), fTracksEvent->GetNumberOfParticles(),
             fNEventsRead,fCurrentEvent,fCurrentDir);
-    
+    fTrackCounter->Fill(fTracksEvent->GetNumberOfParticles());
     fCurrentEvent++;
     fNEventsRead++;
     delete tarray;
@@ -268,6 +368,7 @@ Int_t AliHBTReaderTPC::ReadNext()
 
 Int_t AliHBTReaderTPC::OpenNextSession()
 {
+//Opens session thats from fCurrentDir 
   TString filename = GetDirName(fCurrentDir);
   if (filename.IsNull())
    {
@@ -275,7 +376,7 @@ Int_t AliHBTReaderTPC::OpenNextSession()
      return 1;
    }
   filename = filename +"/"+ fFileName;
-  fRunLoader = AliRunLoader::Open(filename,AliConfig::fgkDefaultEventFolderName);
+  fRunLoader = AliRunLoader::Open(filename,AliConfig::GetDefaultEventFolderName());
   if( fRunLoader == 0x0)
    {
      DoOpenError("Can not open session.");
@@ -324,18 +425,6 @@ Int_t AliHBTReaderTPC::OpenNextSession()
   AliKalmanTrack::SetConvConst(1000/0.299792458/mf);
 
 
-  fRunLoader->CdGAFile();
-  AliTPCParam *TPCParam= (AliTPCParam*)gDirectory->Get("75x40_100x60");
-  if (!TPCParam) 
-   {
-    TPCParam=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
-    if (!TPCParam) 
-     { 
-       DoOpenError("TPC parameters have not been found !\n");
-       return 1;
-     }
-   }
-
   if (fTPCLoader->LoadTracks())
    {
      DoOpenError("Error occured while loading TPC tracks.");
@@ -363,18 +452,24 @@ void AliHBTReaderTPC::DoOpenError( const char *va_(fmt), ...)
 }
 
 /********************************************************************/
-Bool_t AliHBTReaderTPC::CheckTrack(AliTPCtrack* t)
+Bool_t AliHBTReaderTPC::CheckTrack(AliTPCtrack* t) const
 {
   //Performs check of the track
   if ( (t->GetNumberOfClusters() > fNClustMax) || (t->GetNumberOfClusters() < fNClustMin) ) return kTRUE;
 
-  Double_t cc[15];
-  t->GetCovariance(cc);
-  if ( (cc[9] < fC44Min) || (cc[9] > fC44Max) ) return kTRUE;
-  
   Float_t chisqpercl = t->GetChi2()/((Double_t)t->GetNumberOfClusters());
   if ( (chisqpercl < fNChi2PerClustMin) || (chisqpercl > fNChi2PerClustMax) ) return kTRUE;
   
+  Double_t cc[15];
+  t->GetExternalCovariance(cc);
+
+  if ( (cc[0]  < fC00Min) || (cc[0]  > fC00Max) ) return kTRUE;
+  if ( (cc[2]  < fC11Min) || (cc[2]  > fC11Max) ) return kTRUE;
+  if ( (cc[5]  < fC22Min) || (cc[5]  > fC22Max) ) return kTRUE;
+  if ( (cc[9]  < fC33Min) || (cc[9]  > fC33Max) ) return kTRUE;
+  if ( (cc[14] < fC44Min) || (cc[14] > fC44Max) ) return kTRUE;
+  
+  
   return kFALSE;
   
 }
@@ -396,6 +491,42 @@ void AliHBTReaderTPC::SetChi2PerCluserRange(Float_t min, Float_t max)
 }
 /********************************************************************/
 
+void AliHBTReaderTPC::SetC00Range(Float_t min, Float_t max)
+{
+ //Sets range of C00 parameter of covariance matrix of the track
+ //it defines uncertainty of the momentum
+  fC00Min = min;
+  fC00Max = max;
+}
+/********************************************************************/
+
+void AliHBTReaderTPC::SetC11Range(Float_t min, Float_t max)
+{
+ //Sets range of C11 parameter of covariance matrix of the track
+ //it defines uncertainty of the momentum
+  fC11Min = min;
+  fC11Max = max;
+}
+/********************************************************************/
+
+void AliHBTReaderTPC::SetC22Range(Float_t min, Float_t max)
+{
+ //Sets range of C22 parameter of covariance matrix of the track
+ //it defines uncertainty of the momentum
+  fC22Min = min;
+  fC22Max = max;
+}
+/********************************************************************/
+
+void AliHBTReaderTPC::SetC33Range(Float_t min, Float_t max)
+{
+ //Sets range of C33 parameter of covariance matrix of the track
+ //it defines uncertainty of the momentum
+  fC33Min = min;
+  fC33Max = max;
+}
+/********************************************************************/
+
 void AliHBTReaderTPC::SetC44Range(Float_t min, Float_t max)
 {
  //Sets range of C44 parameter of covariance matrix of the track