Update of simple generator
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Mar 2003 12:59:51 +0000 (12:59 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Mar 2003 12:59:51 +0000 (12:59 +0000)
TRD/AliTRDrunSimple.C
TRD/AliTRDsimpleGen.cxx
TRD/AliTRDsimpleMC.cxx
TRD/AliTRDsimpleMC.h

index 6658c03..3a17955 100644 (file)
@@ -47,6 +47,7 @@ void AliTRDrunSimple()
 
   // Initialize the TRD detector
   AliTRDv1     *trd    = new AliTRDv1("TRD","TRD slow simulator");
+  trd->SetHitTypeStandard();
 
   // Needed for some material properties 
   trd->CreateMaterials();
@@ -54,14 +55,15 @@ void AliTRDrunSimple()
   // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 85% Xe + 15% CO2)
   trd->SetGasMix(1);
  
-  // Get the pointer to the geometry object
-  AliTRDgeometry *geometry = trd->GetGeometry();
-  // The number of timebins
-  geometry->SetNTimeBin(30);
-  // The additional timebins before and after the drift region
-  geometry->SetExpandTimeBin(5,15);
+  // Define the parameter object
+  // If no external parameter object is defined, 
+  // default parameter will be used
+  AliTRDparameter *parameter = new AliTRDparameter("TRDparameter"
+                                                 ,"TRD parameter class");
+
+  parameter->SetADCthreshold(0);
+  parameter->SetNTimeBin(30);        // The number of timebins
+  parameter->SetExpandTimeBin(5,15); // The additional timebins
     
   // Switch on TR production
   AliTRDsim *trdsim = trd->CreateTR();
@@ -74,22 +76,15 @@ void AliTRDrunSimple()
 
   // The digitizer
   AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer","Digitizer class");
+
+  digitizer->SetParameter(parameter);
   digitizer->SetSimple();
-  digitizer->SetGasGain(3200.);      // GEANT + new Ermilova spectrum
-  digitizer->SetChipGain(6.1);
-  digitizer->SetNoise(1000.);
-  digitizer->SetADCinRange(1000.);
-  digitizer->SetADCoutRange(1023.);
-  digitizer->SetADCthreshold(0);
   digitizer->InitDetector();
-  //digitizer->SetTimeResponse(0);
-  //digitizer->SetVerbose(1);
                                     
   // The event generator
   AliTRDsimpleGen *generator = simple->GetGenerator();         
   generator->SetMomentum(3.0,3.0);
   generator->SetPdg(11);                             // Electrons 
-  //generator->SetPdg(211);                            // Pions 
 
   //_____________________________________________________________________________ 
   //
@@ -97,8 +92,8 @@ void AliTRDrunSimple()
   //_____________________________________________________________________________ 
   //
 
-  Int_t timeMax  = geometry->GetTimeTotal();   
-  Int_t adcRange = ((Int_t) digitizer->GetADCoutRange()); 
+  Int_t timeMax  = parameter->GetTimeTotal();   
+  Int_t adcRange = ((Int_t) parameter->GetADCoutRange()); 
 
   TH1F     *hQ       = new TH1F("hQ"    ,"Charge per hit (all)" ,100,0.0,1000.0);
   TH1F     *hQdedx   = new TH1F("hQdedx","Charge per hit (dedx)",100,0.0,1000.0);
@@ -125,7 +120,7 @@ void AliTRDrunSimple()
   // Number of events (tracks)
   Int_t nEvent = 10000;
 
-  Float_t x0 = geometry->GetTime0(0) - AliTRDgeometry::DrThick(); 
+  Float_t x0 = parameter->GetTime0(0) - AliTRDgeometry::DrThick(); 
 
   TClonesArray *hitsArray = trd->Hits();
 
index 098fcaf..892d047 100644 (file)
  **************************************************************************/
  
 /*
-$Log$                                                          
+$Log$
+Revision 1.1  2001/11/06 17:19:41  cblume
+Add detailed geometry and simple simulator
+                                                          
 */
  
 ///////////////////////////////////////////////////////////////////////////////
@@ -26,6 +29,9 @@ $Log$
 #include <stdlib.h>
  
 #include <TRandom.h>
+#include <TMCProcess.h>
+
+#include "AliRun.h"
 
 #include "AliTRDsimpleGen.h"
 #include "AliTRDsimpleMC.h"
@@ -109,6 +115,14 @@ void AliTRDsimpleGen::NewParticle(Int_t ievent)
             ,fMomMax);
     }
     printf("\n");
+
+    // Add one dummy particle to the stack so that AddHit will work
+    Float_t mom[3] = { 0.0 };
+    Float_t vtx[3] = { 0.0 };
+    Float_t pol[3] = { 0.0 };
+    Int_t   ntr    = 0;
+    gAlice->SetTrack(0,-1,fPdg,mom,vtx,pol,0.0,kPPrimary,ntr);
+
   }
 
   Double_t p = fMomMax;
index cc910a0..537dbb4 100644 (file)
@@ -15,6 +15,9 @@
  
 /*
 $Log$
+Revision 1.5  2003/01/07 09:03:52  alibrary
+New TrackMomentum and Position without LorentzVectors
+
 Revision 1.4  2002/11/21 22:38:47  alibrary
 Removing AliMC and AliMCProcess
 
@@ -219,7 +222,7 @@ void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg
   fTrackY    = 0.0;
   fTrackZ    = 0.0;
 
-  gAlice->SetCurrentTrack(-1);
+  gAlice->SetCurrentTrack(0);
 
 }
                                                                                 
@@ -299,9 +302,9 @@ void AliTRDsimpleMC::TrackMomentum(Double_t &px, Double_t &py, Double_t &pz, Dou
   // Track Momentum
   //
 
-  px = fTrackPx;
-  py = fTrackPy;
-  pz = fTrackPz;
+  px   = fTrackPx;
+  py   = fTrackPy;
+  pz   = fTrackPz;
   etot = fTrackEtot;
 
 }
@@ -318,13 +321,13 @@ Int_t AliTRDsimpleMC::VolId(const Text_t* volName) const
  
   Int_t volId = -1;
 
-  if      (strcmp(volName,"UL05") == 0) {
+  if      (strcmp(volName,"UJ00") == 0) {
     volId = kVolDrRg;
   }
-  else if (strcmp(volName,"UL06") == 0) {
+  else if (strcmp(volName,"UK00") == 0) {
     volId = kVolAmRg;
   }
-  else if (strcmp(volName,"UCII") == 0) {
+  else if (strcmp(volName,"UC00") == 0) {
     volId = kVolDrCh;
   }
 
@@ -357,6 +360,28 @@ Int_t AliTRDsimpleMC::CurrentVolID(Int_t& copyNo) const
 }
 
 //_____________________________________________________________________________
+const char *AliTRDsimpleMC::CurrentVolName() const
+{
+  //
+  // Check for the current volume
+  //
+
+  Char_t *volName = "UA00";
+
+  // Drift region
+  if      ((fTrackX-fX0) <  AliTRDgeometry::DrThick()) {
+    volName = "UJ00";
+  }
+  else if ((fTrackX-fX0) < (AliTRDgeometry::DrThick() +
+                            AliTRDgeometry::AmThick())) {
+    volName = "UK00";
+  }
+
+  return volName;
+
+}
+
+//_____________________________________________________________________________
 Int_t AliTRDsimpleMC::CurrentVolOffID(Int_t off, Int_t &copyNo) const
 {
   //
index f4022e1..b45bdf4 100644 (file)
@@ -151,7 +151,7 @@ class AliTRDsimpleMC : public TVirtualMC {
   // Tracking volume(s) 
   virtual Int_t         CurrentVolID(Int_t& copyNo) const;
   virtual Int_t         CurrentVolOffID(Int_t off, Int_t& copyNo) const;
-  virtual const char*   CurrentVolName() const                                            { return ""; };
+  virtual const char*   CurrentVolName() const;
   virtual const char*   CurrentVolOffName(Int_t off) const                                { return ""; };
   virtual Int_t         CurrentMaterial(Float_t &a, Float_t &z, 
                                         Float_t &dens, Float_t &radl,