]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCv2.cxx
Using AliLog (F.Carminati)
[u/mrichter/AliRoot.git] / TPC / AliTPCv2.cxx
index a27f0d86ec6145e917851c46885ff137888a69b9..03aac702cf79beddf2c8362f8ad371b6cf351a5b 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.37  2001/04/27 15:23:07  kowal2
-Correct materian in the central part of the inner containment vessel
-
-Revision 1.36  2001/04/26 06:15:12  kowal2
-Corrected bug in the inner containment vessel (cones)
-
-Revision 1.35  2001/04/24 11:17:33  kowal2
-New TPC geometry.
-
-Revision 1.34  2001/04/23 10:20:18  hristov
-Constant casted to avoid ambiguity
-
-Revision 1.33  2001/04/20 08:16:47  kowal2
-Protection against too small betaGamma. Thanks to Ivana and Yves.
-
-Revision 1.32  2001/03/13 13:07:34  kowal2
-Corrected bug in the TPC mother volume geometry.
-Thanks to A. Morsch
-
-Revision 1.31  2000/11/30 11:48:50  kowal2
-TLorentzVector.h adde to satisfy the latest changes by Federico
-
-Revision 1.30  2000/11/14 10:48:57  kowal2
-Correct material used for TSA4. Thanks to J. Barbosa.
-
-Revision 1.29  2000/11/06 17:24:10  kowal2
-Corrected bug in the outer containment vessel and
-the outer field cage geometry.
-Thanks to J. Barbosa.
-
-Revision 1.28  2000/11/02 16:55:24  kowal2
-Corrected bug in the inner containment vessel geometry.
-Thanks to J. Belikov
-
-Revision 1.27  2000/11/02 07:24:11  kowal2
-Correction in the TPC geometry.
-Changes due to the new hit structure.
-
-Revision 1.26  2000/10/05 16:16:29  kowal2
-Corrections of the hit recording algorithm.
-
-Revision 1.25  2000/10/02 21:28:18  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.24  2000/08/28 10:02:30  kowal2
-Corrected bug in the StepManager
-
-Revision 1.23  2000/07/10 20:57:39  hristov
-Update of TPC code and macros by M.Kowalski
-
-Revision 1.22  2000/06/30 12:07:50  kowal2
-Updated from the TPC-PreRelease branch
-
-Revision 1.21.2.4  2000/06/26 07:39:42  kowal2
-Changes to obey the coding rules
-
-Revision 1.21.2.3  2000/06/25 08:38:41  kowal2
-Splitted from AliTPCtracking
-
-Revision 1.21.2.2  2000/06/16 12:58:13  kowal2
-Changed parameter settings
-
-Revision 1.21.2.1  2000/06/09 07:15:07  kowal2
-
-Defaults loaded automatically (hard-wired)
-Optional parameters can be set via macro called in the constructor
-
-Revision 1.21  2000/05/15 10:00:30  kowal2
-Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova
-
-Revision 1.20  2000/04/17 09:37:33  kowal2
-removed obsolete AliTPCDigitsDisplay.C
-
-Revision 1.19.8.2  2000/04/10 08:31:52  kowal2
-
-Different geometry for different sectors
-Updated readout chambers
-Some modifications to StepManager by J.Belikov
-
-Revision 1.19.8.1  2000/04/10 07:56:53  kowal2
-Not used anymore - removed
-
-Revision 1.19  1999/11/04 17:28:07  fca
-Correct barrel part of HV Degrader
-
-Revision 1.18  1999/10/14 16:52:08  fca
-Only use PDG codes and not GEANT ones
-
-Revision 1.17  1999/10/08 06:27:23  fca
-Corrected bug in the HV degrader geometry, thanks to G.Tabary
-
-Revision 1.16  1999/10/04 13:39:54  fca
-Correct array index problem
-
-Revision 1.15  1999/09/29 09:24:34  fca
-Introduction of the Copyright and cvs Log
-
-*/
+/* $Id$ */
 
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -127,21 +28,22 @@ Introduction of the Copyright and cvs Log
 //                                                                           //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
+
 #include <stdlib.h>
 
+#include <TLorentzVector.h>
 #include <TMath.h>
+#include <TVirtualMC.h>
+#include <TPDGCode.h>
 
-#include "AliTPCv2.h"
-#include "AliTPCDigitsArray.h"
-#include "AliRun.h"
-#include "AliMC.h"
 #include "AliConst.h"
-#include "AliPDG.h"
+#include "AliRun.h"
+#include "AliTPCDigitsArray.h"
 #include "AliTPCParam.h"
 #include "AliTPCParamSR.h"
-#include "AliTPCTrackHits.h"
-#include "TLorentzVector.h"
-
+#include "AliTPCTrackHitsV2.h"
+#include "AliTPCv2.h"
+#include "AliMC.h"
 
 ClassImp(AliTPCv2)
  
@@ -206,25 +108,25 @@ void AliTPCv2::CreateGeometry()
   
   // --------------------------------------------------- 
   //        sector specification check 
-  // --------------------------------------------------- 
+  // ---------------------------------------------------
   if (fSecAL >= 0) {
     ifl1 = 0;
     
     for (i = 0; i < 6; ++i) {
       if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
-       ifl1 = 1;
-       printf("*** SECTOR %d selected\n",fSecLows[i]);
+       ifl1 = 1;
+       printf("%s: *** SECTOR %d selected\n",ClassName(),fSecLows[i]);
       }
     }
 
   } else {
-    printf("*** ALL LOWER SECTORS SELECTED ***\n");
+    printf("%s: *** ALL LOWER SECTORS SELECTED ***\n",ClassName());
     ifl1 = 1;
   }
 
   if (ifl1 == 0) {
-    printf("*** ERROR: AT LEAST ONE LOWER SECTOR MUST BE SPECIFIED ***\n");
-    printf("!!! PROGRAM STOPPED !!!\n");
+    printf("%s: *** ERROR: AT LEAST ONE LOWER SECTOR MUST BE SPECIFIED ***\n",ClassName());
+    printf("%s: !!! PROGRAM STOPPED !!!\n",ClassName());
     exit(1);
   }
 
@@ -233,12 +135,12 @@ void AliTPCv2::CreateGeometry()
     for (i = 0; i < 12; ++i) {
       if (fSecUps[i] > 2*nInnerSector-1 && 
           fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
-       printf("*** SECTOR %d selected\n",fSecUps[i]);
+       printf("%s: *** SECTOR %d selected\n",ClassName(),fSecUps[i]);
       }
     }
     
   } else {
-    printf("*** ALL UPPER SECTORS SELECTED ***\n");
+    printf("%s: *** ALL UPPER SECTORS SELECTED ***\n",ClassName());
   }
   
  
@@ -256,7 +158,7 @@ void AliTPCv2::CreateGeometry()
   //
 
   dm[3]=-283.7;
-  dm[4]=65.6;
+  dm[4]=77.017;
   dm[5]=278.;
 
   //
@@ -298,7 +200,7 @@ void AliTPCv2::CreateGeometry()
   //
 
   dm[24]=283.7;
-  dm[25]=65.6;
+  dm[25]=77.017;
   dm[26]=278.;
   
   gMC->Gsvolu("TPC ","PCON",idtmed[0],dm,27);
@@ -488,13 +390,13 @@ void AliTPCv2::CreateGeometry()
 
   dm[15]=250.6;
   dm[16]=258.;
-  dm[17]=275.5;
+  dm[17]=269.6;
 
   //
 
   dm[18]=253.6;
   dm[19]=258.;
-  dm[20]=275.5;
+  dm[20]=269.6;
 
   gMC->Gsvolu("TOFC","PCON",idtmed[4],dm,21);
 
@@ -529,7 +431,8 @@ void AliTPCv2::CreateGeometry()
   gMC->Gspos("TSA7",1,"TSA6",0.,0.,0.,0,"ONLY"); 
   gMC->Gspos("TSA6",1,"TOFC",0.,0.,0.,0,"ONLY");
 
-  // TOFC->TOIN
+  // TOFC->TOIN 
+  // TOFC overlaps with 
 
   gMC->Gspos("TOFC",1,"TOIN",0.,0.,0.,0,"ONLY");
 
@@ -1908,8 +1811,8 @@ void AliTPCv2::Init()
 
   gMC->Gstpar(idtmed[2],"LOSS",5); // specific energy loss
 
-  printf("*** TPC version 2 initialized ***\n");
-  printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
+  printf("%s: *** TPC version 2 initialized ***\n",ClassName());
+  printf("%s: Maximum number of steps = %d\n",ClassName(),gMC->GetMaxNStep());
 
   //
   
@@ -1933,7 +1836,7 @@ void AliTPCv2::StepManager()
   const Float_t kbig = 1.e10;
 
   Int_t id,copy;
-  Float_t hits[4];
+  Float_t hits[5];
   Int_t vol[2];  
   TLorentzVector p;
   
@@ -1953,6 +1856,12 @@ void AliTPCv2::StepManager()
 
   id = gMC->CurrentVolID(copy); // current volume Id
 
+  if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting()) &&
+       ((id == fIdLSec) || (id == fIdUSec)) ) {
+
+    AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
+  }
+
   if(id == fIdLSec){
     vol[0] = copy-1; // lower sector number
   }
@@ -1994,9 +1903,12 @@ void AliTPCv2::StepManager()
       hits[1]=p[1];
       hits[2]=p[2];
       hits[3]=0.; // this hit has no energy loss
-      // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+      // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
+
+      // Get also the track time for pileup simulation
+      hits[4]=gMC->TrackTime();
 
-      AddHit(gAlice->CurrentTrack(), vol,hits);  //MI change
+      AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);  //MI change
 
     }
 
@@ -2005,9 +1917,12 @@ void AliTPCv2::StepManager()
      hits[1]=p[1];
      hits[2]=p[2];
      hits[3]=0.; // this hit has no energy loss
-     // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+     // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
+
+     // Get also the track time for pileup simulation
+     hits[4]=gMC->TrackTime();
 
-     AddHit(gAlice->CurrentTrack(), vol,hits);  //MI change    
+     AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);  //MI change    
 
   }
   else return;
@@ -2029,14 +1944,18 @@ void AliTPCv2::StepManager()
     
     // Add this hit
     
-    // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+    // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
     if (fHitType&&2){
       gMC->TrackMomentum(p);
       Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
       Float_t precision =   (momentum>0.1) ? 0.002 :0.01;
       fTrackHits->SetHitPrecision(precision);
     }
-    AddHit(gAlice->CurrentTrack(), vol,hits);  //MI change 
+
+    // Get also the track time for pileup simulation
+    hits[4]=gMC->TrackTime();
+
+    AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);  //MI change 
     
   } 
   
@@ -2062,10 +1981,7 @@ void AliTPCv2::StepManager()
       if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
     }
   
-  Float_t random[1];
-  gMC->Rndm(random,1); // good, old GRNDM from Geant3
-  
-  Double_t rnd = (Double_t)random[0];
+  Double_t rnd = gMC->GetRandom()->Rndm();
   
   gMC->SetMaxStep(-TMath::Log(rnd)/pp);