]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Using symbolic constants instead of hardwired numbers (Yu.Belikov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 23 Apr 2006 05:46:22 +0000 (05:46 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 23 Apr 2006 05:46:22 +0000 (05:46 +0000)
STEER/AliESDtrack.cxx
STEER/AliESDtrack.h
TRD/AliTRDtracker.cxx

index 7f79c431fb477a2dd6a1defd4887d4333d28faea..123cd1e073e88e14829f3600baece1a7e8d7e5d5 100644 (file)
@@ -130,12 +130,12 @@ AliESDtrack::AliESDtrack() :
   //  fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
 
   Int_t i;
-  for (i=0; i<12; i++)  fITSchi2MIP[i]=1e10;
-  for (i=0; i<12; i++)  { fITSindex[i]=-1; }
-  for (i=0; i<180; i++) { fTPCindex[i]=-2; }
+  for (i=0; i<kMaxITScluster; i++)  fITSchi2MIP[i]=1e10;
+  for (i=0; i<kMaxITScluster; i++)  { fITSindex[i]=-1; }
+  for (i=0; i<kMaxTPCcluster; i++) { fTPCindex[i]=-2; }
   for (i=0; i<3; i++)   { fKinkIndexes[i]=0;}
   for (i=0; i<3; i++)   { fV0Indexes[i]=-1;}
-  for (i=0; i<180; i++) { fTRDindex[i]=-2; }
+  for (i=0; i<kMaxTRDcluster; i++) { fTRDindex[i]=-2; }
   for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
   for (i=0;i<4;i++) {fTPCPoints[i]=-1;}
   for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
@@ -206,17 +206,17 @@ AliESDtrack::AliESDtrack(const AliESDtrack& track):
   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
   for (Int_t i=0;i<AliPID::kSPECIES;i++)  fR[i]=track.fR[i];
   //
-  for (Int_t i=0;i<12;i++) fITSchi2MIP[i]=track.fITSchi2MIP[i];
-  for (Int_t i=0;i<12;i++) fITSindex[i]=track.fITSindex[i];    
+  for (Int_t i=0;i<kMaxITScluster;i++) fITSchi2MIP[i]=track.fITSchi2MIP[i];
+  for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=track.fITSindex[i];    
   for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i]; 
   //
-  for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];  
+  for (Int_t i=0;i<kMaxTPCcluster;i++) fTPCindex[i]=track.fTPCindex[i];  
   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i]; 
   for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
   for (Int_t i=0; i<3;i++)   { fKinkIndexes[i]=track.fKinkIndexes[i];}
   for (Int_t i=0; i<3;i++)   { fV0Indexes[i]=track.fV0Indexes[i];}
   //
-  for (Int_t i=0;i<180;i++) fTRDindex[i]=track.fTRDindex[i];   
+  for (Int_t i=0;i<kMaxTRDcluster;i++) fTRDindex[i]=track.fTRDindex[i];   
   for (Int_t i=0;i<kNPlane;i++) {
       fTRDsignals[i]=track.fTRDsignals[i]; 
       fTRDTimBin[i]=track.fTRDTimBin[i];
@@ -285,9 +285,9 @@ void AliESDtrack::MakeMiniESDtrack(){
 
   // Reset ITS track related information
   fITSchi2 = 0;
-  for (Int_t i=0;i<12;i++) fITSchi2MIP[i]=0;
+  for (Int_t i=0;i<kMaxITScluster;i++) fITSchi2MIP[i]=0;
   fITSncls = 0;       
-  for (Int_t i=0;i<12;i++) fITSindex[i]=-1;    
+  for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=-1;    
   fITSsignal = 0;     
   for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0; 
   fITSLabel = 0;       
@@ -298,7 +298,7 @@ void AliESDtrack::MakeMiniESDtrack(){
   fTPCchi2 = 0;       
   fTPCncls = 0;       
   fTPCnclsF = 0;       
-  for (Int_t i=0;i<180;i++) fTPCindex[i] = -2;  
+  for (Int_t i=0;i<kMaxTPCcluster;i++) fTPCindex[i] = -2;  
   fTPCClusterMap = 0;  
   fTPCsignal= 0;      
   fTPCsignalS= 0;      
@@ -313,7 +313,7 @@ void AliESDtrack::MakeMiniESDtrack(){
   fTRDchi2 = 0;        
   fTRDncls = 0;       
   fTRDncls0 = 0;       
-  for (Int_t i=0;i<180;i++) fTRDindex[i] = -2;   
+  for (Int_t i=0;i<kMaxTRDcluster;i++) fTRDindex[i] = -2;   
   fTRDsignal = 0;      
   for (Int_t i=0;i<kNPlane;i++) {
       fTRDsignals[i] = 0; 
@@ -400,7 +400,7 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
   case kITSin: case kITSout: case kITSrefit:
     fITSncls=t->GetNumberOfClusters();
     fITSchi2=t->GetChi2();
-    for (Int_t i=0;i<12;i++) fITSindex[i]=t->GetClusterIndex(i);
+    for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=t->GetClusterIndex(i);
     fITSsignal=t->GetPIDsignal();
     fITSLabel = t->GetLabel();
     fITSFakeRatio = t->GetFakeRatio();
@@ -422,7 +422,7 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
       //"jump to case label crosses initialization of `Int_t prevrow'"
        Int_t prevrow = -1;
        //       for (Int_t i=0;i<fTPCncls;i++) 
-       for (Int_t i=0;i<160;i++) 
+       for (Int_t i=0;i<kMaxTPCcluster;i++) 
         {
           fTPCindex[i]=t->GetClusterIndex(i);
 
@@ -661,7 +661,7 @@ void AliESDtrack::SetITSpid(const Double_t *p) {
 }
 
 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
-  for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
+  for (Int_t i=0; i<kMaxITScluster; i++) fITSchi2MIP[i]=chi2mip[i];
 }
 //_______________________________________________________________________
 void AliESDtrack::GetITSpid(Double_t *p) const {
@@ -674,7 +674,7 @@ Int_t AliESDtrack::GetITSclusters(Int_t *idx) const {
   //---------------------------------------------------------------------
   // This function returns indices of the assgined ITS clusters 
   //---------------------------------------------------------------------
-  for (Int_t i=0; i<12; i++) idx[i]=fITSindex[i];
+  for (Int_t i=0; i<kMaxITScluster; i++) idx[i]=fITSindex[i];
   return fITSncls;
 }
 
@@ -684,7 +684,7 @@ Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
   // This function returns indices of the assgined ITS clusters 
   //---------------------------------------------------------------------
   if (idx!=0)
-    for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i];  // MI I prefer some constant
+    for (Int_t i=0; i<kMaxTPCcluster; i++) idx[i]=fTPCindex[i];  // MI I prefer some constant
   return fTPCncls;
 }
 
@@ -725,7 +725,7 @@ Int_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
   // This function returns indices of the assgined TRD clusters 
   //---------------------------------------------------------------------
   if (idx!=0)
-    for (Int_t i=0; i<180; i++) idx[i]=fTRDindex[i];  // MI I prefer some constant
+    for (Int_t i=0; i<kMaxTRDcluster; i++) idx[i]=fTRDindex[i];  // MI I prefer some constant
   return fTRDncls;
 }
 
index 31d4bdce17b9c9539fe0c2dc289b226a55773a6f..c2b300e9d17c0a4820358453a8b80373cf364df7 100644 (file)
@@ -31,8 +31,6 @@ class AliESDVertex;
 class AliKalmanTrack;
 class AliTrackPointArray;
 
-const Int_t kNPlane = 6;
-
 class AliESDtrack : public AliExternalTrackParam {
 public:
   AliESDtrack();
@@ -216,6 +214,12 @@ public:
     kESDpid=0x40000000,
     kTIME=0x80000000
   }; 
+  enum {
+    kNPlane = 6,
+    kMaxITScluster=12,
+    kMaxTPCcluster=160,
+    kMaxTRDcluster=180
+  };
 protected:
   
   //AliESDtrack & operator=(const AliESDtrack & );
@@ -244,9 +248,9 @@ protected:
 
   // ITS related track information
   Float_t fITSchi2;        // chi2 in the ITS
-  Float_t fITSchi2MIP[12];     // chi2s in the ITS
+  Float_t fITSchi2MIP[kMaxITScluster];     // chi2s in the ITS
   Int_t   fITSncls;        // number of clusters assigned in the ITS
-  Int_t   fITSindex[12];   //! indices of the assigned ITS clusters
+  Int_t   fITSindex[kMaxITScluster];   //! indices of the assigned ITS clusters
   Float_t fITSsignal;      // detector's PID signal
   Float_t fITSr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
   Int_t   fITSLabel;       // label according TPC
@@ -257,7 +261,7 @@ protected:
   Float_t fTPCchi2;        // chi2 in the TPC
   Int_t   fTPCncls;        // number of clusters assigned in the TPC
   UShort_t fTPCnclsF;      // number of findable clusters in the TPC
-  Int_t  fTPCindex[180];  //! indices of the assigned TPC clusters
+  Int_t  fTPCindex[kMaxTPCcluster];  //! indices of the assigned TPC clusters
   TBits   fTPCClusterMap;  // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow
   Float_t fTPCsignal;      // detector's PID signal
   UShort_t fTPCsignalN;      // number of points used for dEdx
@@ -272,7 +276,7 @@ protected:
   Float_t fTRDchi2;        // chi2 in the TRD
   Int_t   fTRDncls;        // number of clusters assigned in the TRD
   Int_t   fTRDncls0;       // number of clusters assigned in the TRD before first material cross
-  Int_t  fTRDindex[180];   //! indices of the assigned TRD clusters
+  Int_t  fTRDindex[kMaxTRDcluster];   //! indices of the assigned TRD clusters
   Float_t fTRDsignal;      // detector's PID signal
   Float_t fTRDsignals[kNPlane];  // TRD signals from all six planes
   Int_t   fTRDTimBin[kNPlane];   // Time bin of Max cluster from all six planes
index eefa48590eb165cc9cbbc59377fa094efc99fe60..c74fe1caa2e6e238c6291bea571bb902f44e79cb 100644 (file)
@@ -657,7 +657,7 @@ Int_t AliTRDtracker::PropagateBack(AliESD* event) {
       
       if (track->PropagateTo(xtof)) {
        seed->UpdateTrackParams(track, AliESDtrack::kTRDout);
-        for (Int_t i=0;i<kNPlane;i++) {
+        for (Int_t i=0;i<AliESDtrack::kNPlane;i++) {
            seed->SetTRDsignals(track->GetPIDsignals(i),i);
            seed->SetTRDTimBin(track->GetPIDTimBin(i),i);
         }
@@ -668,7 +668,7 @@ Int_t AliTRDtracker::PropagateBack(AliESD* event) {
       if (track->GetNumberOfClusters()>15&&track->GetNumberOfClusters()>0.5*expectedClr){
        seed->UpdateTrackParams(track, AliESDtrack::kTRDout);
        //seed->SetStatus(AliESDtrack::kTRDStop);    
-        for (Int_t i=0;i<kNPlane;i++) {
+        for (Int_t i=0;i<AliESDtrack::kNPlane;i++) {
            seed->SetTRDsignals(track->GetPIDsignals(i),i);
            seed->SetTRDTimBin(track->GetPIDTimBin(i),i);
         }
@@ -748,7 +748,7 @@ Int_t AliTRDtracker::RefitInward(AliESD* event)
 
     AliTRDtrack *pt = new AliTRDtrack(seed2,seed2.GetAlpha());
     Int_t * indexes2 = seed2.GetIndexes();
-    for (Int_t i=0;i<kNPlane;i++) {
+    for (Int_t i=0;i<AliESDtrack::kNPlane;i++) {
       pt->SetPIDsignals(seed2.GetPIDsignals(i),i);
       pt->SetPIDTimBin(seed2.GetPIDTimBin(i),i);
     }
@@ -772,7 +772,7 @@ Int_t AliTRDtracker::RefitInward(AliESD* event)
     Double_t xTPC = 250;
     if(PropagateToX(t,xTPC,fgkMaxStep)) {
       seed->UpdateTrackParams(pt, AliESDtrack::kTRDrefit);
-      for (Int_t i=0;i<kNPlane;i++) {
+      for (Int_t i=0;i<AliESDtrack::kNPlane;i++) {
         seed->SetTRDsignals(pt->GetPIDsignals(i),i);
         seed->SetTRDTimBin(pt->GetPIDTimBin(i),i);
       }
@@ -787,7 +787,7 @@ Int_t AliTRDtracker::RefitInward(AliESD* event)
         pt2->CookdEdx( ); // Modification by PS
         CookdEdxTimBin(*pt2);
        seed->UpdateTrackParams(pt2, AliESDtrack::kTRDrefit);
-        for (Int_t i=0;i<kNPlane;i++) {
+        for (Int_t i=0;i<AliESDtrack::kNPlane;i++) {
           seed->SetTRDsignals(pt2->GetPIDsignals(i),i);
           seed->SetTRDTimBin(pt2->GetPIDTimBin(i),i);
         }
@@ -925,7 +925,7 @@ Int_t AliTRDtracker::FollowBackProlongation(AliTRDtrack& t)
   AliTRDtracklet tracklet;
   //
   //
-  for (Int_t iplane = 0; iplane<kNPlane; iplane++){
+  for (Int_t iplane = 0; iplane<AliESDtrack::kNPlane; iplane++){
     Int_t    row0    = GetGlobalTimeBin(0, iplane,GetTimeBinsPerPlane()-1);
     Int_t    rowlast = GetGlobalTimeBin(0, iplane,0);
     //
@@ -2726,11 +2726,11 @@ void AliTRDtracker::CookdEdxTimBin(AliTRDtrack& TRDtrack)
   // Time bin for Max. Cluster
   // Prashant Shukla (shukla@physi.uni-heidelberg.de)
 
-  Double_t  clscharge[kNPlane], maxclscharge[kNPlane];
-  Int_t  nCluster[kNPlane], timebin[kNPlane];
+  Double_t  clscharge[AliESDtrack::kNPlane], maxclscharge[AliESDtrack::kNPlane];
+  Int_t  nCluster[AliESDtrack::kNPlane], timebin[AliESDtrack::kNPlane];
 
   //Initialization of cluster charge per plane.  
-  for (Int_t iPlane = 0; iPlane < kNPlane; iPlane++) {
+  for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
     clscharge[iPlane] = 0.0;
     nCluster[iPlane] = 0;
     timebin[iPlane] = -1;
@@ -2758,7 +2758,7 @@ void AliTRDtracker::CookdEdxTimBin(AliTRDtrack& TRDtrack)
 
   // Setting the fdEdxPlane and fTimBinPlane variabales 
   Double_t totalCharge = 0;
-  for (Int_t iPlane = 0; iPlane < kNPlane; iPlane++) {
+  for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
     // Quality control of TRD track.
     if (nCluster[iPlane]<= 5) {
       clscharge[iPlane]=0.0;