]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Now the parametrised tracking uses the new class AliGausCorr (A.Dainese)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Mar 2002 09:27:17 +0000 (09:27 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Mar 2002 09:27:17 +0000 (09:27 +0000)
TPC/AliBarrelRec_TPCparam.C
TPC/AliTPCtrackerParam.cxx
TPC/AliTPCtrackerParam.h

index 299e0261ee483b1f25c9137dcc1cd5b21028080d..ba7be5316f12403b17ab283ecca8f3d9fc39ac9f 100644 (file)
  ****************************************************************************/
 
 #ifndef __CINT__
-  #include "alles.h"
-  #include "AliMagF.h"
-  #include "AliITS.h"
-  #include "AliITSgeom.h"
-  #include "AliITSRecPoint.h"
-  #include "AliITSclusterV2.h"
-  #include "AliITSsimulationFastPoints.h"
-  #include "AliITStrackerV2.h"
-  #include "AliTPCtrackerParam.h"
+#include <iostream.h>
+#include <TFile.h>
+#include <TStopwatch.h>
+#include <TObject.h>
+#include "alles.h"
+#include "AliRun.h"
+#include "AliHeader.h"
+#include "AliGenEventHeader.h"
+#include "AliMagF.h"
+#include "AliModule.h"
+#include "AliArrayI.h"
+#include "AliDigits.h"
+#include "AliITS.h"
+#include "AliTPC.h"
+#include "AliITSgeom.h"
+#include "AliITSRecPoint.h"
+#include "AliITSclusterV2.h"
+#include "AliITSsimulationFastPoints.h"
+#include "AliITStrackerV2.h"
+#include "AliKalmanTrack.h"
+#include "AliTPCtrackerParam.h"
 #endif
 
 typedef struct {
   Int_t lab;
   Int_t pdg;
+  Int_t mumlab;
   Int_t mumpdg;
   Float_t Vx,Vy,Vz;
   Float_t Px,Py,Pz;
@@ -39,6 +52,12 @@ Int_t ITSFindTracks(const Char_t *galice,const Char_t *inname,const Char_t *inna
 Int_t ITSMakeRefFile(const Char_t *galice, const Char_t *inname, const Char_t *outname, Int_t n);
 
 Int_t AliBarrelRec_TPCparam(Int_t n=1) {
+
+  const Char_t *name=" AliBarrelRec_TPCparam";
+  cerr<<'\n'<<name<<"...\n";
+  gBenchmark->Start(name);
+
+
   const Char_t *TPCtrkNameS="AliTPCtracksParam.root";
   const Char_t *galiceName="galice.root";
   const Char_t *ITSclsName="AliITSclustersV2.root";
@@ -57,21 +76,21 @@ Int_t AliBarrelRec_TPCparam(Int_t n=1) {
 
   AliKalmanTrack::SetConvConst(100/0.299792458/BfieldValue);
 
-  
+
   // ********** Build TPC tracks with parameterization *********** //
   if (TPCParamTracks(galiceName,TPCtrkNameS,collcode,BfieldValue,n)) {
     cerr<<"Failed to get TPC hits !\n";
     return 1;
   }
-
   
   // ********** Find ITS clusters *********** //
   if (ITSFindClusters(galiceName,ITSclsName,n)) {
     cerr<<"Failed to get ITS clusters !\n";
     return 1;
-  } 
+  }  
+  
   
-
   // ********* Find ITS tracks *********** //
   if (ITSFindTracks(galiceName,TPCtrkNameS,ITSclsName,ITStrkName,n)) {
     cerr<<"Failed to get ITS tracks !\n";
@@ -85,6 +104,8 @@ Int_t AliBarrelRec_TPCparam(Int_t n=1) {
     return 1;
   } 
   
+  gBenchmark->Stop(name);
+  gBenchmark->Show(name);
 
   return 0;
 }
@@ -119,16 +140,22 @@ Int_t TPCParamTracks(const Char_t *galice, const Char_t *outname,
 
 Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) {
 
+  
   cerr<<"\n*******************************************************************\n";
 
   Int_t rc=0;
   const Char_t *name="ITSFindClusters";
   cerr<<'\n'<<name<<"...\n";
   gBenchmark->Start(name);
+
+  // delete reconstruction Tree if it's there
+  TFile *f =TFile::Open(inname,"update");
+  f->Delete("TreeR0;*");
+  f->Close();
+
   TFile *out=TFile::Open(outname,"recreate");
   TFile *in =TFile::Open(inname,"update");
-
   
   if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
     cerr<<"Can't get gAlice !\n";
@@ -245,7 +272,7 @@ Int_t ITSFindClusters(const Char_t *inname, const Char_t *outname, Int_t n) {
   out->Close();
   gBenchmark->Stop(name);
   gBenchmark->Show(name);
-
   return rc;
 }
 
@@ -253,14 +280,14 @@ Int_t ITSFindTracks(const Char_t *galice, const Char_t * inname,
                     const Char_t *inname2, const Char_t *outname, 
                     Int_t n) {
 
+  
   cerr<<"\n*******************************************************************\n";
 
   Int_t rc=0;
   const Char_t *name="ITSFindTracks";
   cerr<<'\n'<<name<<"...\n";
   gBenchmark->Start(name);
-  
   
   TFile *out=TFile::Open(outname,"recreate");
   TFile *in =TFile::Open(inname);
@@ -298,9 +325,9 @@ Int_t ITSFindTracks(const Char_t *galice, const Char_t * inname,
 
     // setup vertex constraint in the two tracking passes
     Int_t flags[2];
-    flags[0]=0;
+    flags[0]=1;
     tracker.SetupFirstPass(flags);
-    flags[0]=-1;
+    flags[0]=0;
     tracker.SetupSecondPass(flags);
     
     rc=tracker.Clusters2Tracks(in,out);
@@ -311,7 +338,7 @@ Int_t ITSFindTracks(const Char_t *galice, const Char_t * inname,
   in->Close();
   in2->Close();
   out->Close();
-
   gBenchmark->Stop(name);
   gBenchmark->Show(name);
   
@@ -354,7 +381,7 @@ Int_t ITSMakeRefFile(const Char_t *galice, const Char_t *inname,
 
     AliITStrackV2 *itstrack=0;
 
-    Int_t nparticles=gAlice->GetEvent(event);  
+    gAlice->GetEvent(event);  
 
     trk->cd();
 
@@ -370,7 +397,7 @@ Int_t ITSMakeRefFile(const Char_t *galice, const Char_t *inname,
     char ttname[100];
     sprintf(ttname,"Tree_Ref_%d",event);
     TTree *reftree = new TTree(ttname,"Tree with true track params");
-    reftree->Branch("rectracks",&rectrk,"lab/I:pdg:Vx/F:Vy:Vz:Px:Py:Pz");
+    reftree->Branch("rectracks",&rectrk,"lab/I:pdg:mumlab:mumpdg:Vx/F:Vy:Vz:Px:Py:Pz");
 
     for (Int_t i=0; i<nentr; i++) {
       itstrack=new AliITStrackV2;
@@ -381,6 +408,7 @@ Int_t ITSMakeRefFile(const Char_t *galice, const Char_t *inname,
       Part = (TParticle*)gAlice->Particle(label);
       rectrk.lab=label;
       rectrk.pdg=Part->GetPdgCode();
+      rectrk.mumlab = Part->GetFirstMother();
       if(Part->GetFirstMother()>=0) {
        Mum = (TParticle*)gAlice->Particle(Part->GetFirstMother());
        rectrk.mumpdg=Mum->GetPdgCode();
@@ -405,7 +433,7 @@ Int_t ITSMakeRefFile(const Char_t *galice, const Char_t *inname,
   trk->Close();
   kin->Close();
   out->Close();
-
+  
   gBenchmark->Stop(name);
   gBenchmark->Show(name);
   
index dad38396a0c9f9726a6a336aad432c5963bb3f00..a50faf16cace5810d707405034d9567a55e959ca 100644 (file)
  * appear in the supporting documentation. The authors make no claims     *
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-/*
-$Log$
-Revision 1.1  2002/02/18 09:06:54  kowal2
-TPC parametrization by Andrea Dainese
-
-*/
-/*************************************************************************
+ **************************************************************************
+ **************************************************************************
  *                                                                        *
  * This class builds AliTPCtrack objects from generated tracks to feed    *
  * ITS tracking (V2). The AliTPCtrack is built from its first hit in      *
  * the TPC. The track is assigned a Kalman-like covariance matrix         *
  * depending on its pT and pseudorapidity and track parameters are        *
- * smeared according this covariance matrix.                              *
+ * smeared according to this covariance matrix.                           *
  * Output file contains sorted tracks, ready for matching with ITS        *
  *                                                                        *
  * Test macro is: AliBarrelRec_TPCparam.C                                 * 
@@ -38,6 +32,11 @@ TPC parametrization by Andrea Dainese
 #include "AliTPCtrack.h"
 #include "TMatrixD.h"
 #include "AliKalmanTrack.h"
+#include "AliMagFCM.h"
+#include "AliGausCorr.h"
+
+
+
 
 ClassImp(AliTPCtrackerParam)
 
@@ -57,27 +56,33 @@ Int_t AliTPCtrackerParam::BuildTPCtracks(const TFile *inp, TFile *out, Int_t n)
 {
  
   if(fColl!=0) { 
-    cerr<<"AliTPCtrackerParam::BuildTPCtracks:  Invalid collision!"<<endl<<
-                "Available:  0   ->   PbPb6000"<<endl; return 0; 
+    cerr<<"AliTPCtrackerParam::BuildTPCtracks:  Invalid collision!\n
+                 Available:  0   ->   PbPb6000"<<endl; return 0; 
   }
   if(fBz!=0.4) {
-    cerr<<"AliTPCtrackerParam::BuildTPCtracks:  Invalid field!"<<endl<<
-                "Available:  0.4"<<endl; return 0;
+    cerr<<"AliTPCtrackerParam::BuildTPCtracks:  Invalid field!\n
+                 Available:  0.4"<<endl; return 0;
   }
 
   TFile *infile=(TFile*)inp;
 
-  AliKalmanTrack::SetConvConst(100/0.299792458/fBz);
-
   // Get gAlice object from file
   if(!(gAlice=(AliRun*)infile->Get("gAlice"))) {
     cerr<<"gAlice has not been found on galice.root !\n";
     return 1;
   }
 
-  // Set random number generator seed
-  TDatime t;
-  gRandom->SetSeed(t.Get());
+  AliMagFCM *fiel = (AliMagFCM*)gAlice->Field();
+  Double_t fieval=(Double_t)fiel->SolenoidField()/10.;
+  printf("Magnetic field is %6.2f Tesla\n",fieval);
+  if(fBz!=fieval) {
+    cerr<<"AliTPCtrackerParam::BuildTPCtracks:  Invalid field!"<<endl;
+    cerr<<"Field selected is: "<<fBz<<" T\n";
+    cerr<<"Field found on file is: "<<fieval<<" T\n";
+    return 0;
+  }
+
+  AliKalmanTrack::SetConvConst(100/0.299792458/fBz);
 
 
   // loop over first n events in file
@@ -424,40 +429,11 @@ TMatrixD AliTPCtrackerParam::GetSmearingMatrix(Double_t* cc,Double_t pt,Double_t
 //-----------------------------------------------------------------
 void AliTPCtrackerParam::SmearTrack(Double_t* xx,Double_t* xxsm,TMatrixD cov) {
 
-  // build triangular matrix Bmat
-  TMatrixD* Bmat = new TMatrixD(5,5);
-
-  for(Int_t j=0;j<5;j++){
-    Double_t accum = 0;
-    for(Int_t k=0;k<j;k++){
-      accum += (*Bmat)(j,k)* (*Bmat)(j,k);
-    }
-    (*Bmat)(j,j)=TMath::Sqrt(TMath::Abs(cov(j,j)-accum));
-    for(Int_t i=j+1;i<5;i++){
-      accum = 0;
-      for(Int_t k=0;k<j;k++){
-       accum+=(*Bmat)(i,k)* (*Bmat)(j,k);
-      }
-      (*Bmat)(i,j) = (cov(i,j)-accum) / (*Bmat)(j,j);
-    }
-  }
-
-  // get array of numbers with normal distribution
-  TArrayD norm;
-  norm.Set(5);
-  for(Int_t l=0;l<5;l++) {
-    norm[l]=gRandom->Gaus();
-  }
-
-  // use Bmat matrix to generate correlated numbers
-  TArrayD corr;
-  corr.Set(5);
-  for(Int_t i=0;i<5;i++){
-    corr[i]=0;
-    for(Int_t j=0;j<=i;j++) corr[i] += (*Bmat)(i,j)*norm[j];
-  }
-
-  delete Bmat;
+  AliGausCorr *corgen = new AliGausCorr(cov,5);
+  TArrayD corr(5);
+  corgen->GetGaussN(corr);
+  delete corgen;
+  corgen = 0;
 
   for(Int_t l=0;l<5;l++) {
     xxsm[l] = xx[l]+corr[l];
@@ -475,7 +451,7 @@ void AliTPCtrackerParam::CookTracks(TObjArray& tarray,TObjArray& newtarray)
   // open file with matrixes DB
   TFile* DBfile = new TFile(s->Data());  
 
-  AliTPCtrack* track=new AliTPCtrack;
+  AliTPCtrack* track = 0;
   Int_t entr = (Int_t)tarray.GetEntriesFast();
 
   for(Int_t k=0; k<entr; k++) {
@@ -544,11 +520,17 @@ void AliTPCtrackerParam::CookTracks(TObjArray& tarray,TObjArray& newtarray)
 
     // fill the array
     newtarray.AddLast(tpctrack);
-  
+   delete matrix;  
+
   }
 
   DBfile->Close();
 
+  delete s;
+  delete DBfile;
+
+
   return; 
 }
 //-----------------------------------------------------------------
index fd57779b39f02b0a7bde02086449773e574a141c..09cbcf0b72247af8f7bdb3ed373eb9251baa8667 100644 (file)
@@ -2,7 +2,6 @@
 #define ALITPCTRACKERPARAM_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
 /* See cxx source for full Copyright notice                               */
-/* $Id$ */
 //-----------------------------------------------------------------------------
 //                    TPC Tracking Parameterization Class
 //
@@ -10,6 +9,7 @@
 //-----------------------------------------------------------------------------
 #include "alles.h"
 #include "AliMagF.h"
+#include "AliGausCorr.h"
 #include "AliTPCtrack.h"
 
 class AliTPCtrackerParam {