Multievent loop improved (Yu.Belikov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Nov 2002 11:57:42 +0000 (11:57 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Nov 2002 11:57:42 +0000 (11:57 +0000)
HBTAN/AliHBTReaderPPprod.cxx
HBTAN/AliHBTReaderTPC.cxx
ITS/AliITSFindTracksV2.C
ITS/AliITSTrackerV1.cxx
ITS/AliITStrackerV2.cxx
ITS/AliITStrackerV2.h
STEER/AliTracker.cxx
STEER/AliTracker.h
TPC/AliTPCFindTracks.C

index 74b4021..dc9c248 100644 (file)
@@ -160,14 +160,17 @@ Int_t AliHBTReaderPPprod::Read(AliHBTRun* particles, AliHBTRun *tracks)
          AliTPCtrack *iotrack=0;
          
          fClustersFile->cd();
-         AliTPCtracker *tracker = new AliTPCtracker(TPCParam,currentEvent);
+       //AliTPCtracker *tracker=new AliTPCtracker(TPCParam,currentEvent);//I.B.
+       AliTPCtracker *tracker=new AliTPCtracker(TPCParam);               //I.B.
+       tracker->SetEventNumber(currentEvent);                            //I.B.
          if (!tracker) 
           {
             Error("AliHBTReaderPPprod::Read","Can't get a tracker !\n"); 
             return 3;
           }
-         tracker->LoadInnerSectors();
-         tracker->LoadOuterSectors();
+         //tracker->LoadInnerSectors(); //I.B.
+         //tracker->LoadOuterSectors(); //I.B.
+         tracker->LoadClusters();     //I.B.
    
          for (i=0; i<NTPCtracks; i++)
           {
index 1d80a23..eea77ae 100644 (file)
@@ -1,5 +1,7 @@
 #include "AliHBTReaderTPC.h"
 
+#include <Riostream.h>
+//#include <Riostream.h>
 #include <TTree.h>
 #include <TFile.h>
 #include <TParticle.h>
 
 
 ClassImp(AliHBTReaderTPC)
-//______________________________________________
-//
-// class AliHBTReaderTPC
-//
 //reader for TPC tracking
-//needs galice.root, AliTPCtracks.root, AliTPCclusters.root
+//needs galice.root, AliTPCtracks.root, AliTPCclusters.root, good_tracks_tpc 
 //
 //more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
 //Piotr.Skowronski@cern.ch
-//
 
-AliHBTReaderTPC:: AliHBTReaderTPC(const Char_t* trackfilename,
-                                  const Char_t* clusterfilename,
-                                  const Char_t* galicefilename):
- fTrackFileName(trackfilename),
- fClusterFileName(clusterfilename),
- fGAliceFileName(galicefilename)
+AliHBTReaderTPC::
+ AliHBTReaderTPC(const Char_t* trackfilename,const Char_t* clusterfilename,
+                 const Char_t* galicefilename):
+                 fTrackFileName(trackfilename),fClusterFileName(clusterfilename),
+                 fGAliceFileName(galicefilename)
 {
   //constructor, 
   //Defaults:
@@ -47,13 +43,13 @@ AliHBTReaderTPC:: AliHBTReaderTPC(const Char_t* trackfilename,
   fIsRead = kFALSE;
 }
 /********************************************************************/
-AliHBTReaderTPC::AliHBTReaderTPC(TObjArray* dirs,
+AliHBTReaderTPC::
+AliHBTReaderTPC(TObjArray* dirs,
                   const Char_t* trackfilename, const Char_t* clusterfilename,
                   const Char_t* galicefilename):
- AliHBTReader(dirs), 
- fTrackFileName(trackfilename),
- fClusterFileName(clusterfilename),
- fGAliceFileName(galicefilename)
+                  AliHBTReader(dirs), fTrackFileName(trackfilename),
+                  fClusterFileName(clusterfilename),fGAliceFileName(galicefilename)
+
 {
   //constructor, 
   //Defaults:
@@ -65,6 +61,7 @@ AliHBTReaderTPC::AliHBTReaderTPC(TObjArray* dirs,
   fParticles = new AliHBTRun();
   fTracks    = new AliHBTRun();
   fIsRead = kFALSE;
+  
 }
 /********************************************************************/
 
@@ -88,7 +85,6 @@ AliHBTEvent* AliHBTReaderTPC::GetParticleEvent(Int_t n)
    return fParticles->GetEvent(n);
  }
 /********************************************************************/
-
 AliHBTEvent* AliHBTReaderTPC::GetTrackEvent(Int_t n)
  {
  //returns Nth event with reconstructed tracks
@@ -134,7 +130,7 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks)
  //reads data and puts put to the particles and tracks objects
  //reurns 0 if everything is OK
  //
-  Info("Read","");
+  cout<<"AliHBTReaderTPC::Read()"<<endl;
   Int_t i; //iterator and some temprary values
   Int_t Nevents = 0;
   Int_t totalNevents = 0;
@@ -183,9 +179,9 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks)
     if (gAlice->TreeE())//check if tree E exists
      {
       Nevents = (Int_t)gAlice->TreeE()->GetEntries();//if yes get number of events in gAlice
-      Info("Read","________________________________________________________");
-      Info("Read","Found %d event(s) in directory %s",Nevents,GetDirName(currentdir).Data());
-      Info("Read","Setting Magnetic Field: B=%fT",gAlice->Field()->SolenoidField());
+      cout<<"________________________________________________________\n";
+      cout<<"Found "<<Nevents<<" event(s) in directory "<<GetDirName(currentdir)<<endl;
+      cout<<"Setting Magnetic Field: B="<<gAlice->Field()->SolenoidField()<<"T"<<endl;
       AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField());
      }
     else
@@ -211,7 +207,7 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks)
   
     for(Int_t currentEvent =0; currentEvent<Nevents;currentEvent++)//loop over all events
      {
-       Info("Read","Reading Event %d",currentEvent);
+       cout<<"Reading Event "<<currentEvent<<endl;
        /**************************************/
         /**************************************/
          /**************************************/ 
@@ -237,20 +233,23 @@ Int_t AliHBTReaderTPC::Read(AliHBTRun* particles, AliHBTRun *tracks)
             continue;
           }
          Int_t NTPCtracks=(Int_t)tracktree->GetEntries();//get number of TPC tracks 
-         Info("Read","Found %d TPC tracks.",NTPCtracks);
+         cout<<"Found "<<NTPCtracks<<" TPC tracks.\n";
          //Copy tracks to array
          
          AliTPCtrack *iotrack=0;
          
          aClustersFile->cd();//set cluster file active 
-         AliTPCtracker *tracker = new AliTPCtracker(TPCParam,currentEvent);//create the tacker for this event
+         //AliTPCtracker *tracker = new AliTPCtracker(TPCParam,currentEvent);//create the tacker for this event
+         AliTPCtracker *tracker = new AliTPCtracker(TPCParam); //I.B.
+         tracker->SetEventNumber(currentEvent);                //I.B.
          if (!tracker) //check if it has created succeffuly
           {//if not return with error
             Error("Read","Can't get a tracker !\n"); 
             continue;
           }
-         tracker->LoadInnerSectors();
-         tracker->LoadOuterSectors();
+         //tracker->LoadInnerSectors(); //I.B.
+         //tracker->LoadOuterSectors(); //I.B.
+         tracker->LoadClusters();       //I.B.
    
          for (i=0; i<NTPCtracks; i++) //loop over all tpc tracks
           {
index 00ac80a..ab96d5f 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef __CINT__
-  #include <iostream.h>
+  #include <Riostream.h>
   #include "AliITSgeom.h"
   #include "AliITStrackerV2.h"
 
@@ -7,7 +7,7 @@
   #include "TStopwatch.h"
 #endif
 
-Int_t AliITSFindTracksV2() {
+Int_t AliITSFindTracksV2(Int_t nev=1) {  //number of events to process
    cerr<<"Looking for tracks...\n";
 
    TFile *out=TFile::Open("AliITStracksV2.root","new");
@@ -20,16 +20,20 @@ Int_t AliITSFindTracksV2() {
    if (!file->IsOpen()) {cerr<<"Can't open AliITSclustersV2.root !\n";return 3;}
 
    AliITSgeom *geom=(AliITSgeom*)file->Get("AliITSgeom");
+   if (!geom) {cerr<<"Can't get AliITSgeom !\n"; return 4;}
 
+   Int_t rc=0;
    TStopwatch timer;
    AliITStrackerV2 tracker(geom);
-
-   //Double_t xyz[]={0.,0.,0.}; tracker.SetVertex(xyz);  //primary vertex
-   //Int_t flag[]={1};                                   //some default flags
-   //flag[0]= 0; tracker.SetupFirstPass(flag);           //no constraint
-   //flag[0]=-1; tracker.SetupSecondPass(flag);          //skip second pass
-
-   Int_t rc=tracker.Clusters2Tracks(in,out);
+   for (Int_t i=0; i<nev; i++) {
+     cerr<<"Processing event number : "<<i<<endl;
+     tracker.SetEventNumber(i);
+     //Double_t xyz[]={0.,0.,0.}; tracker.SetVertex(xyz);  //primary vertex
+     //Int_t flag[]={1};                                   //some default flags
+     //flag[0]= 0; tracker.SetupFirstPass(flag);           //no constraint
+     //flag[0]=-1; tracker.SetupSecondPass(flag);          //skip second pass
+     rc=tracker.Clusters2Tracks(in,out);
+   }
    timer.Stop(); timer.Print();
 
    delete geom; //Thanks to Mariana Bondila
index 2cafa11..89ebc15 100644 (file)
@@ -15,6 +15,9 @@
  
 /*
 $Log$
+Revision 1.27  2002/10/31 10:17:40  hristov
+Corrected usage of AliKalmanTrack::SetConvConst (Alpha)
+
 Revision 1.26  2002/10/25 18:44:33  barbera
 Unnecessary print-out removed
 
@@ -548,11 +551,14 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
     if (!digp) { cerr<<"TPC parameters have not been found !\n"; getchar();}
 
     cf->cd();
-    AliTPCtracker *tracker = new AliTPCtracker(digp,evNumber);  
+    //AliTPCtracker *tracker = new AliTPCtracker(digp,evNumber); //I.B.  
+    AliTPCtracker *tracker = new AliTPCtracker(digp);            //I.B.
+    tracker->SetEventNumber(evNumber);                           //I.B.
 
     // Load clusters
-    tracker->LoadInnerSectors();
-    tracker->LoadOuterSectors();
+    //tracker->LoadInnerSectors(); //I.B.
+    //tracker->LoadOuterSectors(); //I.B.  
+    tracker->LoadClusters();       //I.B.
 
     // Load tracks
     TFile *tf=TFile::Open("AliTPCtracksSorted.root");  
index 6a361a1..8c6314b 100644 (file)
 //#define DEBUG
 
 #ifdef DEBUG
-Int_t LAB=70201;
+Int_t LAB=113;
 #endif
 
 AliITStrackerV2::AliITSlayer AliITStrackerV2::fLayers[kMaxLayer]; // ITS layers
 
-AliITStrackerV2::
-AliITStrackerV2(const AliITSgeom *geom, Int_t eventn) throw (const Char_t *) :
-AliTracker() {
+AliITStrackerV2::AliITStrackerV2(const AliITSgeom *geom) : AliTracker() {
   //--------------------------------------------------------------------
-  //This is the AliITStracker constructor
-  //It also reads clusters from a root file
+  //This is the AliITStrackerV2 constructor
   //--------------------------------------------------------------------
-  fEventN=eventn;  //MI change add event number  - used to generate identifier 
-
   AliITSgeom *g=(AliITSgeom*)geom;
 
   Float_t x,y,z;
@@ -77,41 +72,49 @@ AliTracker() {
 
         Double_t r =-x*rot[1] + y*rot[0];         if (i==1) r=-r;
         Double_t phi=TMath::ATan2(rot[1],rot[0]); if (i==1) phi-=3.1415927;
-        phi+=0.5*TMath::Pi(); 
+        phi+=0.5*TMath::Pi(); if (phi<0) phi += 2*TMath::Pi();
         AliITSdetector &det=fLayers[i-1].GetDetector((j-1)*ndet + k-1); 
 
-if (phi<0) phi += 2*TMath::Pi();
-
         new(&det) AliITSdetector(r,phi); 
       } 
     }  
 
   }
 
-  try {
-     //Read clusters
-     //MI change 
-     char   cname[100]; 
-     sprintf(cname,"TreeC_ITS_%d",eventn);
-     TTree *cTree=(TTree*)gDirectory->Get(cname);
+  fI=kMaxLayer;
 
-     if (!cTree) throw 
-        ("AliITStrackerV2::AliITStrackerV2 can't get cTree !\n");
+  fPass=0;
+  fConstraint[0]=1; fConstraint[1]=0;
+}
 
-     TBranch *branch=cTree->GetBranch("Clusters");
-     if (!branch) throw 
-        ("AliITStrackerV2::AliITStrackerV2 can't get Clusters branch !\n");
+void AliITStrackerV2::LoadClusters() {
+  //--------------------------------------------------------------------
+  //This function loads ITS clusters
+  //--------------------------------------------------------------------
+  char   cname[100]; 
+  sprintf(cname,"TreeC_ITS_%d",GetEventNumber());
+  TTree *cTree=(TTree*)gDirectory->Get(cname);
+  if (!cTree) { 
+    cerr<<"AliITStrackerV2::LoadClusters can't get cTree !\n";
+    exit(1);
+  }
+  TBranch *branch=cTree->GetBranch("Clusters");
+  if (!branch) { 
+    cerr<<"AliITStrackerV2::LoadClusters can't get Clusters branch !\n";
+    exit(1);
+  }
 
-     TClonesArray dummy("AliITSclusterV2",10000), *clusters=&dummy;
-     branch->SetAddress(&clusters);
+  TClonesArray dummy("AliITSclusterV2",10000), *clusters=&dummy;
+  branch->SetAddress(&clusters);
 
-     Int_t nentr=(Int_t)cTree->GetEntries();
-     for (i=0; i<nentr; i++) {
-       if (!cTree->GetEvent(i)) continue;
-       Int_t lay,lad,det; g->GetModuleId(i,lay,lad,det);
-       Int_t ncl=clusters->GetEntriesFast();
-       while (ncl--) {
-         AliITSclusterV2 *c=(AliITSclusterV2*)clusters->UncheckedAt(ncl);
+  Int_t j=0;
+  for (Int_t i=0; i<kMaxLayer; i++) {
+    Int_t jmax = j + fLayers[i].GetNladders()*fLayers[i].GetNdetectors();
+    for (; j<jmax; j++) {           
+      if (!cTree->GetEvent(j)) continue;
+      Int_t ncl=clusters->GetEntriesFast();
+      while (ncl--) {
+        AliITSclusterV2 *c=(AliITSclusterV2*)clusters->UncheckedAt(ncl);
 
 #ifdef DEBUG
 if (c->GetLabel(2)!=LAB)
@@ -120,21 +123,19 @@ if (c->GetLabel(0)!=LAB) continue;
 cout<<lay-1<<' '<<lad-1<<' '<<det-1<<' '<<c->GetY()<<' '<<c->GetZ()<<endl;
 #endif
 
-         fLayers[lay-1].InsertCluster(new AliITSclusterV2(*c));
-       }
-       clusters->Delete();
-     }
-     delete cTree; //Thanks to Mariana Bondila
-  }
-  catch (const Char_t *msg) {
-    cerr<<msg<<endl;
-    throw;
+        fLayers[i].InsertCluster(new AliITSclusterV2(*c));
+      }
+      clusters->Delete();
+    }
   }
+  delete cTree; //Thanks to Mariana Bondila
+}
 
-  fI=kMaxLayer;
-
-  fPass=0;
-  fConstraint[0]=1; fConstraint[1]=0;
+void AliITStrackerV2::UnloadClusters() {
+  //--------------------------------------------------------------------
+  //This function unloads ITS clusters
+  //--------------------------------------------------------------------
+  for (Int_t i=0; i<kMaxLayer; i++) fLayers[i].ResetClusters();
 }
 
 //#ifdef DEBUG
@@ -148,6 +149,8 @@ Int_t AliITStrackerV2::Clusters2Tracks(const TFile *inp, TFile *out) {
   TFile *in=(TFile*)inp;
   TDirectory *savedir=gDirectory; 
 
+  LoadClusters();
+
   if (!in->IsOpen()) {
      cerr<<"AliITStrackerV2::Clusters2Tracks(): ";
      cerr<<"file with TPC tracks is not open !\n";
@@ -162,11 +165,11 @@ Int_t AliITStrackerV2::Clusters2Tracks(const TFile *inp, TFile *out) {
 
   in->cd();
  
-  char   tname[100];
+  Char_t tname[100];
   Int_t nentr=0; TObjArray itsTracks(15000);
 
   {/* Read TPC tracks */ 
-    sprintf(tname,"TreeT_TPC_%d",fEventN);
+    sprintf(tname,"TreeT_TPC_%d",GetEventNumber());
     TTree *tpcTree=(TTree*)in->Get(tname);
     if (!tpcTree) {
        cerr<<"AliITStrackerV2::Clusters2Tracks(): "
@@ -188,12 +191,12 @@ Int_t AliITStrackerV2::Clusters2Tracks(const TFile *inp, TFile *out) {
        }
        if (TMath::Abs(t->GetD())>4) continue;
 
-       t->PropagateTo(80.,0.0053);
-       if (TMath::Abs(t->GetY())>13.) t->CorrectForMaterial(0.03);
+       t->PropagateTo(80.,0.0053,30);
+       if (TMath::Abs(t->GetY())>12.8) t->CorrectForMaterial(0.03);
        if (TMath::Abs(t->GetZ())<0.2) t->CorrectForMaterial(0.40);
-       t->PropagateTo(61.,0.0052);
-       Double_t xk=52.,x,y,z; t->GetGlobalXYZat(xk,x,y,z);
-       if (TMath::Abs(y)<7.77) t->PropagateTo(xk,0.19,24.); 
+       t->PropagateTo(61.,0.0053,30);
+       //Double_t xk=52.,x,y,z; t->GetGlobalXYZat(xk,x,y,z);
+       //if (TMath::Abs(y)<7.77) t->PropagateTo(xk,0.19,24.); 
        t->PropagateTo(50.,0.001);
 
        itsTracks.AddLast(t);
@@ -205,7 +208,7 @@ Int_t AliITStrackerV2::Clusters2Tracks(const TFile *inp, TFile *out) {
 
   out->cd();
 
-  sprintf(tname,"TreeT_ITS_%d",fEventN);
+  sprintf(tname,"TreeT_ITS_%d",GetEventNumber());
   TTree itsTree(tname,"Tree with ITS tracks");
   AliITStrackV2 *otrack=&fBestTrack;
   itsTree.Branch("tracks","AliITStrackV2",&otrack,32000,0);
@@ -264,6 +267,9 @@ cout<<fBestTrack.GetNumberOfClusters()<<" number of clusters\n\n";
   itsTree.Write();
 
   itsTracks.Delete();
+
+  UnloadClusters();
+
   savedir->cd();
   cerr<<"Number of TPC tracks: "<<nentr<<endl;
   cerr<<"Number of prolonged tracks: "<<itsTree.GetEntries()<<endl;
@@ -278,6 +284,8 @@ Int_t AliITStrackerV2::PropagateBack(const TFile *inp, TFile *out) {
   TFile *in=(TFile*)inp;
   TDirectory *savedir=gDirectory; 
 
+  LoadClusters();
+
   if (!in->IsOpen()) {
      cerr<<"AliITStrackerV2::PropagateBack(): ";
      cerr<<"file with ITS tracks is not open !\n";
@@ -291,7 +299,10 @@ Int_t AliITStrackerV2::PropagateBack(const TFile *inp, TFile *out) {
   }
 
   in->cd();
-  TTree *itsTree=(TTree*)in->Get("TreeT_ITS_0");
+
+  Char_t tname[100];
+  sprintf(tname,"TreeT_ITS_%d",GetEventNumber());
+  TTree *itsTree=(TTree*)in->Get(tname);
   if (!itsTree) {
      cerr<<"AliITStrackerV2::PropagateBack() ";
      cerr<<"can't get a tree with ITS tracks !\n";
@@ -301,7 +312,9 @@ Int_t AliITStrackerV2::PropagateBack(const TFile *inp, TFile *out) {
   itsTree->SetBranchAddress("tracks",&itrack);
 
   out->cd();
-  TTree backTree("TreeT_ITSb_0","Tree with back propagated ITS tracks");
+
+  sprintf(tname,"TreeT_ITSb_%d",GetEventNumber());
+  TTree backTree(tname,"Tree with back propagated ITS tracks");
   AliTPCtrack *otrack=0;
   backTree.Branch("tracks","AliTPCtrack",&otrack,32000,0);
 
@@ -339,8 +352,9 @@ for (Int_t k=0; k<nc; k++) {
          Double_t r=layer.GetR();
          if (fI==2 || fI==4) {             
             Double_t rs=0.5*(fLayers[fI-1].GetR() + r);
-            Double_t d=0.011; if (fI==4) d=0.0053;
-            if (!fTrackToFollow.PropagateTo(rs,-d)) throw "";
+            Double_t d=0.0034, x0=38.6;
+            if (fI==2) {rs=9.; d=0.0097; x0=42.;}
+            if (!fTrackToFollow.PropagateTo(rs,-d,x0)) throw "";
          }
 
          Double_t x,y,z;
@@ -401,17 +415,18 @@ for (Int_t k=0; k<nc; k++) {
             if (!fTrackToFollow.Update(cl,maxchi2,index)) 
               cerr<<"AliITStrackerV2::PropagateBack: filtering failed !\n";
          }
-
-         x=layer.GetThickness(fTrackToFollow.GetY(),fTrackToFollow.GetZ());
-         fTrackToFollow.CorrectForMaterial(-x); 
-
+         {
+         Double_t x0;
+         x=layer.GetThickness(fTrackToFollow.GetY(),fTrackToFollow.GetZ(),x0);
+         fTrackToFollow.CorrectForMaterial(-x,x0); 
+         }
        }
 
-       Double_t xk=52.,x,y,z; fTrackToFollow.GetGlobalXYZat(xk,x,y,z);
-       if (TMath::Abs(y)<7.77) 
-          fTrackToFollow.PropagateTo(xk,-0.19,24.); 
-       fTrackToFollow.PropagateTo(61,-0.0110);
-       fTrackToFollow.PropagateTo(80.,-0.0053);
+       fTrackToFollow.PropagateTo(50.,-0.001);
+       //Double_t xk=52.,x,y,z; fTrackToFollow.GetGlobalXYZat(xk,x,y,z);
+       //if (TMath::Abs(y)<7.77) fTrackToFollow.PropagateTo(xk,-0.19,24.); 
+       fTrackToFollow.PropagateTo(61,-0.0053,30);
+       fTrackToFollow.PropagateTo(80.,-0.0053,30);
 
        fTrackToFollow.SetLabel(itsLabel);
        otrack=new AliTPCtrack(fTrackToFollow,fTrackToFollow.GetAlpha()); 
@@ -425,7 +440,7 @@ for (Int_t k=0; k<nc; k++) {
   }
 
   backTree.Write();
-  savedir->cd();
+
   cerr<<"Number of ITS tracks: "<<nentr<<endl;
   cerr<<"Number of back propagated ITS tracks: "<<ntrk<<endl;
 
@@ -433,10 +448,13 @@ for (Int_t k=0; k<nc; k++) {
 
   delete itsTree; //Thanks to Mariana Bondila
 
+  UnloadClusters();
+
+  savedir->cd();
+
   return 0;
 }
 
-
 AliCluster *AliITStrackerV2::GetCluster(Int_t index) const {
   //--------------------------------------------------------------------
   //       Return pointer to a given cluster
@@ -462,10 +480,12 @@ cout<<i<<' ';
     AliITStrackV2 &track=fTracks[i];
 
     Double_t r=layer.GetR();
+
     if (i==3 || i==1) {
        Double_t rs=0.5*(fLayers[i+1].GetR() + r);
-       Double_t d=0.011; if (i==3) d=0.0053;
-       if (!fTrackToFollow.PropagateTo(rs,d)) {
+       Double_t d=0.0034, x0=38.6;
+       if (i==1) {rs=9.; d=0.0097; x0=42;}
+       if (!fTrackToFollow.PropagateTo(rs,d,x0)) {
         //cerr<<"AliITStrackerV2::FollowProlongation: "
          //"propagation failed !\n";
          break;
@@ -587,6 +607,11 @@ cout<<fI<<" change detector !\n";
 cout<<fI<<" chi2="<<chi2<<' '
     <<fTrackToFollow.GetY()<<' '<<fTrackToFollow.GetZ()<<' '
     <<dy<<' '<<dz<<endl;
+{
+Double_t phi=TMath::ATan(fTrackToFollow.GetY()/fTrackToFollow.GetX())
+            +fTrackToFollow.GetAlpha(); phi=phi*180./3.141593;
+cout<<phi<<endl;
+}
 #endif
 
   if (chi2>=kMaxChi2) return 0;
@@ -604,8 +629,9 @@ cout<<fI<<" chi2="<<chi2<<' '
     SetSampledEdx(c->GetQ(),fTrackToFollow.GetNumberOfClusters()-1); //b.b.
 
   {
-   Double_t d=layer.GetThickness(fTrackToFollow.GetY(),fTrackToFollow.GetZ());
-   fTrackToFollow.CorrectForMaterial(d);
+ Double_t x0;
+ Double_t d=layer.GetThickness(fTrackToFollow.GetY(),fTrackToFollow.GetZ(),x0);
+   fTrackToFollow.CorrectForMaterial(d,x0);
   }
 
   if (fConstraint[fPass]) {
@@ -653,6 +679,15 @@ AliITStrackerV2::AliITSlayer::~AliITSlayer() {
   for (Int_t i=0; i<fN; i++) delete fClusters[i];
 }
 
+void AliITStrackerV2::AliITSlayer::ResetClusters() {
+  //--------------------------------------------------------------------
+  // This function removes loaded clusters
+  //--------------------------------------------------------------------
+  for (Int_t i=0; i<fN; i++) delete fClusters[i];
+  fN=0;
+  fI=0;
+}
+
 Int_t AliITStrackerV2::AliITSlayer::InsertCluster(AliITSclusterV2 *c) {
   //--------------------------------------------------------------------
   //This function adds a cluster to this layer
@@ -747,58 +782,107 @@ cout<<np<<' '<<nz<<endl;
 }
 
 Double_t 
-AliITStrackerV2::AliITSlayer::GetThickness(Double_t y, Double_t z) const {
+AliITStrackerV2::AliITSlayer::GetThickness(Double_t y,Double_t z,Double_t &x0)
+const {
   //--------------------------------------------------------------------
   //This function returns the layer thickness at this point (units X0)
   //--------------------------------------------------------------------
   Double_t d=0.0085;
+  x0=21.82;
 
   if (43<fR&&fR<45) { //SSD2
-     d=0.0036;
-     if (TMath::Abs(y-0.00)>3.40) d+=0.0036;
-     if (TMath::Abs(y-2.50)<0.10) d+=(0.02-0.0036);
-     if (TMath::Abs(y+1.90)<0.10) d+=(0.02-0.0036);
+     Double_t dd=0.0034;
+     d=dd;
+     if (TMath::Abs(y-0.00)>3.40) d+=dd;
+     if (TMath::Abs(y-1.90)<0.45) {d+=(0.013-0.0034);}
+     if (TMath::Abs(y+1.90)<0.45) {d+=(0.013-0.0034);}
      for (Int_t i=0; i<12; i++) {
-       if (TMath::Abs(z-3.6*(i+0.5))<0.20) {d+=0.0036; break;}
-       if (TMath::Abs(z+3.6*(i+0.5))<0.20) {d+=0.0036; break;}         
-       if (TMath::Abs(z-3.6*(i+0.929))<0.50) {d+=(0.02-0.0036); break;}
-       if (TMath::Abs(z+3.6*(i+0.104))<0.50) {d+=(0.02-0.0036); break;}
+       if (TMath::Abs(z-3.9*(i+0.5))<0.15) {
+          if (TMath::Abs(y-0.00)>3.40) d+=dd;
+          d+=0.0034; 
+          break;
+       }
+       if (TMath::Abs(z+3.9*(i+0.5))<0.15) {
+          if (TMath::Abs(y-0.00)>3.40) d+=dd;
+          d+=0.0034; 
+          break;
+       }         
+       if (TMath::Abs(z-3.4-3.9*i)<0.50) {d+=(0.016-0.0034); break;}
+       if (TMath::Abs(z+0.5+3.9*i)<0.50) {d+=(0.016-0.0034); break;}
      }
   } else 
   if (37<fR&&fR<41) { //SSD1
-     d=0.0036;
-     if (TMath::Abs(y-0.00)>3.40) d+=0.0036;
-     if (TMath::Abs(y-2.20)<0.10) d+=(0.02-0.0036);
-     if (TMath::Abs(y+2.20)<0.10) d+=(0.02-0.0036);
+     Double_t dd=0.0034;
+     d=dd;
+     if (TMath::Abs(y-0.00)>3.40) d+=dd;
+     if (TMath::Abs(y-1.90)<0.45) {d+=(0.013-0.0034);}
+     if (TMath::Abs(y+1.90)<0.45) {d+=(0.013-0.0034);}
      for (Int_t i=0; i<11; i++) {
-       if (TMath::Abs(z-3.6*i)<0.20) {d+=0.0036; break;}
-       if (TMath::Abs(z+3.6*i)<0.20) {d+=0.0036; break;}         
-       if (TMath::Abs(z-3.6*(i+0.54))<0.50) {d+=(0.02-0.0036); break;}
-       if (TMath::Abs(z+3.6*(i+0.58))<0.50) {d+=(0.02-0.0036); break;}         
+       if (TMath::Abs(z-3.9*i)<0.15) {
+          if (TMath::Abs(y-0.00)>3.40) d+=dd;
+          d+=dd; 
+          break;
+       }
+       if (TMath::Abs(z+3.9*i)<0.15) {
+          if (TMath::Abs(y-0.00)>3.40) d+=dd;
+          d+=dd; 
+          break;
+       }         
+       if (TMath::Abs(z-1.85-3.9*i)<0.50) {d+=(0.016-0.0034); break;}
+       if (TMath::Abs(z+2.05+3.9*i)<0.50) {d+=(0.016-0.0034); break;}         
      }
   } else
   if (13<fR&&fR<26) { //SDD
-     d=0.0034;
-     if (TMath::Abs(y-0.00)>3.30) d+=0.0034;
-     if (TMath::Abs(y-2.10)<0.20) d+=0.0034*3;
-     if (TMath::Abs(y+2.10)<0.20) d+=0.0034*3;
-     for (Int_t i=0; i<4; i++) { 
-       if (TMath::Abs(z-7.3*i)<0.60) {d+=0.0034; break;}
-       if (TMath::Abs(z+7.3*i)<0.60) {d+=0.0034; break;}
+     Double_t dd=0.0033;
+     d=dd;
+     if (TMath::Abs(y-0.00)>3.30) d+=dd;
+
+     if (TMath::Abs(y-1.80)<0.55) {
+        d+=0.016;
+        for (Int_t j=0; j<20; j++) {
+          if (TMath::Abs(z+0.7+1.47*j)<0.12) {d+=0.08; x0=9.; break;}
+          if (TMath::Abs(z-0.7-1.47*j)<0.12) {d+=0.08; x0=9.; break;}
+        } 
+     }
+     if (TMath::Abs(y+1.80)<0.55) {
+        d+=0.016;
+        for (Int_t j=0; j<20; j++) {
+          if (TMath::Abs(z-0.7-1.47*j)<0.12) {d+=0.08; x0=9.; break;}
+          if (TMath::Abs(z+0.7+1.47*j)<0.12) {d+=0.08; x0=9.; break;}
+        } 
+     }
+
+     for (Int_t i=0; i<4; i++) {
+       if (TMath::Abs(z-7.3*i)<0.60) {
+          d+=dd;
+          if (TMath::Abs(y-0.00)>3.30) d+=dd; 
+          break;
+       }
+       if (TMath::Abs(z+7.3*i)<0.60) {
+          d+=dd; 
+          if (TMath::Abs(y-0.00)>3.30) d+=dd; 
+          break;
+       }
      }
   } else
   if (6<fR&&fR<8) {   //SPD2
-     d=0.0093;
-     if (TMath::Abs(y-3.08)>0.45) d+=0.0064;
-     if (TMath::Abs(y-3.03)<0.10) d+=0.0192;
+     Double_t dd=0.0063; x0=21.5;
+     d=dd;
+     if (TMath::Abs(y-3.08)>0.5) d+=dd;
+     //if (TMath::Abs(y-3.08)>0.45) d+=dd;
+     if (TMath::Abs(y-3.03)<0.10) {d+=0.014;}
   } else
   if (3<fR&&fR<5) {   //SPD1
-     d=0.0093;
-     if (TMath::Abs(y+0.21)>0.55) d+=0.0064;
-     if (TMath::Abs(y+0.10)<0.10) d+=0.0192;
+     Double_t dd=0.0063; x0=21.5;
+     d=dd;
+     if (TMath::Abs(y+0.21)>0.6) d+=dd;
+     //if (TMath::Abs(y+0.21)>0.45) d+=dd;
+     if (TMath::Abs(y+0.10)<0.10) {d+=0.014;}
   }
 
-  d+=0.002;
+#ifdef DEBUG
+  cout<<"d="<<d<<endl;
+#endif
 
   return d;
 }
@@ -808,28 +892,28 @@ Double_t AliITStrackerV2::GetEffectiveThickness(Double_t y,Double_t z) const
   //--------------------------------------------------------------------
   //Returns the thickness between the current layer and the vertex (units X0)
   //--------------------------------------------------------------------
-  Double_t d=0.1/65.19*1.848;
+  Double_t d=0.0028*3*3; //beam pipe
+  Double_t x0=0;
 
   Double_t xn=fLayers[fI].GetR();
   for (Int_t i=0; i<fI; i++) {
     Double_t xi=fLayers[i].GetR();
-    d+=fLayers[i].GetThickness(y,z)*xi*xi;
+    d+=fLayers[i].GetThickness(y,z,x0)*xi*xi;
   }
 
   if (fI>1) {
-    Double_t xi=0.5*(fLayers[1].GetR()+fLayers[2].GetR());
-    d+=0.011*xi*xi;
+    Double_t xi=9.;
+    d+=0.0097*xi*xi;
   }
 
   if (fI>3) {
     Double_t xi=0.5*(fLayers[3].GetR()+fLayers[4].GetR());
-    d+=0.0053*xi*xi;
+    d+=0.0034*xi*xi;
   }
+
   return d/(xn*xn);
 }
 
-
-
 Int_t AliITStrackerV2::AliITSlayer::InRoad() const {
   //--------------------------------------------------------------------
   // This function returns number of clusters within the "window" 
@@ -873,8 +957,9 @@ Bool_t AliITStrackerV2::RefitAt(Double_t x, AliITStrackV2 *t, Int_t *index) {
      Double_t hI=i-0.5*step; 
      if (hI==1.5 || hI==3.5) {             
         Double_t rs=0.5*(fLayers[i-step].GetR() + r);
-        Double_t ds=0.011; if (hI==3.5) ds=0.0053;
-        if (!t->PropagateTo(rs,ds)) {
+        Double_t d=0.0034, x0=38.6; 
+        if (hI==1.5) {rs=9.; d=0.0097; x0=42;}
+        if (!t->PropagateTo(rs,d,x0)) {
           return kFALSE;
         }
      }
@@ -942,8 +1027,9 @@ Bool_t AliITStrackerV2::RefitAt(Double_t x, AliITStrackV2 *t, Int_t *index) {
      }
 
      {
-     Double_t d=layer.GetThickness(t->GetY(),t->GetZ());
-     t->CorrectForMaterial(-step*d);
+     Double_t x0;
+     Double_t d=layer.GetThickness(t->GetY(),t->GetZ(),x0);
+     t->CorrectForMaterial(-step*d,x0);
      }
 
   }
index c0bca0a..c606071 100644 (file)
@@ -21,8 +21,10 @@ class TFile;
 class AliITStrackerV2 : public AliTracker {
 public:
   AliITStrackerV2():AliTracker(){}
-  AliITStrackerV2(const AliITSgeom *geom,Int_t event=0) throw (const Char_t *);
+  AliITStrackerV2(const AliITSgeom *geom);
   AliCluster *GetCluster(Int_t index) const;
+  void LoadClusters();
+  void UnloadClusters();
   Int_t Clusters2Tracks(const TFile *in, TFile *out);
   Int_t PropagateBack(const TFile *in, TFile *out);
   void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
@@ -47,6 +49,7 @@ public:
     AliITSlayer(Double_t r, Double_t p, Double_t z, Int_t nl, Int_t nd);
    ~AliITSlayer();
     Int_t InsertCluster(AliITSclusterV2 *c);
+    void ResetClusters();
     void SelectClusters(Double_t zmi,Double_t zma,Double_t ymi,Double_t yma);
     const AliITSclusterV2 *GetNextCluster(Int_t &ci);
     void *operator new(size_t s, AliITSlayer *p) {return p;}
@@ -54,9 +57,11 @@ public:
     AliITSclusterV2 *GetCluster(Int_t i) const {return fClusters[i];} 
     AliITSdetector &GetDetector(Int_t n) const { return fDetectors[n]; }
     Int_t FindDetectorIndex(Double_t phi, Double_t z) const;
-    Double_t GetThickness(Double_t y, Double_t z) const;
+    Double_t GetThickness(Double_t y, Double_t z, Double_t &x0) const;
     Int_t InRoad() const ;
     Int_t GetNumberOfClusters() const {return fN;}
+    Int_t GetNladders() const {return fNladders;}
+    Int_t GetNdetectors() const {return fNdetectors;}
   private:
     Double_t fR;                // mean radius of this layer
     Double_t fPhiOffset;        // offset of the first detector in Phi
@@ -86,7 +91,6 @@ private:
      fTrackToFollow.~AliITStrackV2();
      new(&fTrackToFollow) AliITStrackV2(t);
   }
-  Int_t fEventN;                         //event number
   Int_t fI;                              // index of the current layer
   static AliITSlayer fLayers[kMaxLayer]; // ITS layers
   AliITStrackV2 fTracks[kMaxLayer];      // track estimations at the ITS layers
index 8c3b66d..c2d7f01 100644 (file)
 
 ClassImp(AliTracker)
 
-Double_t AliTracker::fX;
-Double_t AliTracker::fY;
-Double_t AliTracker::fZ;
-
 //__________________________________________________________________________
 void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
   //--------------------------------------------------------------------
index ce9769f..b1aebfa 100644 (file)
@@ -16,11 +16,12 @@ class TFile;
 
 class AliTracker {
 public:
-  AliTracker() { fX=fY=fZ=0.; }
+  AliTracker() { fX=fY=fZ=0.; fEventN=0; }
   virtual ~AliTracker(){}
   virtual Int_t Clusters2Tracks(const TFile *in, TFile *out)=0;
   virtual Int_t PropagateBack(const TFile *in, TFile *out)=0;
-  static void SetVertex(Double_t *xyz) { fX=xyz[0]; fY=xyz[1]; fZ=xyz[2]; }
+  void SetVertex(Double_t *xyz) { fX=xyz[0]; fY=xyz[1]; fZ=xyz[2]; }
+  void SetEventNumber(Int_t ev) { fEventN=ev; }
 
 //protected:
   virtual AliCluster *GetCluster(Int_t index) const=0;
@@ -29,11 +30,14 @@ public:
   Double_t GetX() const {return fX;}
   Double_t GetY() const {return fY;}
   Double_t GetZ() const {return fZ;}
+  Int_t GetEventNumber() const {return fEventN;}
 
 private:
-  static Double_t fX;  //X-coordinate of the primary vertex
-  static Double_t fY;  //Y-coordinate of the primary vertex
-  static Double_t fZ;  //Z-coordinate of the primary vertex
+  Int_t fEventN;//event number
+
+  Double_t fX;  //X-coordinate of the primary vertex
+  Double_t fY;  //Y-coordinate of the primary vertex
+  Double_t fZ;  //Z-coordinate of the primary vertex
 
   ClassDef(AliTracker,1) //abstract tracker
 };
index 745de21..604a439 100644 (file)
@@ -1,9 +1,5 @@
-/****************************************************************************
- *           Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                 *
- ****************************************************************************/
-
 #ifndef __CINT__
-  #include <iostream.h>
+  #include <Riostream.h>
   #include "AliTPCParam.h"
   #include "AliTPCtracker.h"
 
@@ -11,11 +7,8 @@
   #include "TStopwatch.h"
 #endif
 
-Int_t AliTPCFindTracks(Int_t eventn=1) {
-
+Int_t AliTPCFindTracks(Int_t eventn=1) { 
    cerr<<"Looking for tracks...\n";
-   TFile f("galice.root");
-   gAlice = (AliRun*)f.Get("gAlice");
 
    TFile *out=TFile::Open("AliTPCtracks.root","new");
    if (!out->IsOpen()) {cerr<<"Delete old AliTPCtracks.root !\n"; return 1;}
@@ -29,12 +22,12 @@ Int_t AliTPCFindTracks(Int_t eventn=1) {
    TStopwatch timer;
 
    Int_t rc=0;
+   AliTPCtracker tracker(par);
    for (Int_t i=0;i<eventn;i++){
      printf("Processing event %d\n",i);
-     AliTPCtracker *tracker = new AliTPCtracker(par,i);
-     //Double_t xyz[]={0.,0.,0.}; tracker->SetVertex(xyz); //primary vertex
-     rc=tracker->Clusters2Tracks(0,out);
-     delete tracker;
+     tracker.SetEventNumber(i);
+     //Double_t xyz[]={0.,0.,0.}; tracker.SetVertex(xyz); //primary vertex
+     rc=tracker.Clusters2Tracks(0,out);
    }
    timer.Stop(); timer.Print();