Generate on a three dimensional grid to simulate test-beam situation
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Jun 1999 16:05:04 +0000 (16:05 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Jun 1999 16:05:04 +0000 (16:05 +0000)
where you can scan chambers without overlap to test reconstruction
program. By A.Morsch.

EVGEN/AliGenScan.cxx [new file with mode: 0644]
EVGEN/AliGenScan.h [new file with mode: 0644]

diff --git a/EVGEN/AliGenScan.cxx b/EVGEN/AliGenScan.cxx
new file mode 100644 (file)
index 0000000..25455e1
--- /dev/null
@@ -0,0 +1,119 @@
+#include "AliGenScan.h"
+#include <stdlib.h>
+#include "AliRun.h"
+ ClassImp(AliGenScan)
+    
+ AliGenScan::AliGenScan()
+        :AliGenerator(-1)
+{
+//
+    fXmin=0;
+    fXmax=0;
+    fNx=1;
+    fYmin=0;
+    fYmax=0;
+    fNy=1;
+    fZmin=0;
+    fZmax=0;
+    fNz=1;
+//
+//  Read all particles
+    fNpart=-1;
+}
+
+AliGenScan::AliGenScan(Int_t npart)
+    :AliGenerator(npart)
+{
+    fXmin=0;
+    fXmax=0;
+    fNx=1;
+    fYmin=0;
+    fYmax=0;
+    fNy=1;
+    fZmin=0;
+    fZmax=0;
+    fNz=1;
+}
+
+//____________________________________________________________
+AliGenScan::~AliGenScan()
+{}
+
+void AliGenScan::SetRange(Int_t nx, Float_t xmin, Float_t xmax,
+                    Int_t ny, Float_t ymin, Float_t ymax,
+                    Int_t nz, Float_t zmin, Float_t zmax)
+{
+    fXmin=xmin;
+    fXmax=xmax;
+    fNx=nx;
+    fYmin=ymin;
+    fYmax=ymax;
+    fNy=ny;
+    fZmin=zmin;
+    fZmax=zmax;
+    fNz=nz;
+}
+
+//____________________________________________________________
+void AliGenScan::Generate()
+{
+  //
+  // Generate one trigger
+  //
+  AliMC* pMC = AliMC::GetMC();
+  
+  Float_t polar[3]= {0,0,0};
+  //
+  Float_t origin[3];
+  Float_t p[3];
+  Int_t nt;
+  Float_t pmom, theta, phi;
+  //
+  Float_t random[6];
+  Float_t dx,dy,dz;
+  
+  //
+  if (fNy > 0) {
+      dx=(fXmax-fXmin)/fNx;
+  } else {
+      dx=1e10;
+  }
+
+  if (fNy > 0) {
+      dy=(fYmax-fYmin)/fNy;
+  } else {
+      dy=1e10;
+  }
+
+  if (fNz > 0) {
+      dz=(fZmax-fZmin)/fNz;
+  } else {
+      dz=1e10;
+  }
+  for (Int_t ix=0; ix<fNx; ix++) {
+      for (Int_t iy=0; iy<fNy; iy++) {
+         for (Int_t iz=0; iz<fNz; iz++){
+             pMC->Rndm(random,6);
+             origin[0]=fXmin+ix*dx+2*(random[0]-0.5)*fOsigma[0];
+             origin[1]=fYmin+iy*dy+2*(random[1]-0.5)*fOsigma[1];
+             origin[2]=fZmin+iz*dz+2*(random[2]-0.5)*fOsigma[2];            
+             pmom=fPMin+random[3]*(fPMax-fPMin);
+             theta=fThetaMin+random[4]*(fThetaMax-fThetaMin);
+             phi=fPhiMin+random[5]*(fPhiMax-fPhiMin);
+             p[0] = pmom*TMath::Cos(phi)*TMath::Sin(theta);
+             p[1] = pmom*TMath::Sin(phi)*TMath::Sin(theta);
+             p[2] = pmom*TMath::Cos(theta);
+             gAlice->SetTrack(1,-1,fIpart,p,origin,polar,0,"Primary",nt);
+         }
+      }
+  }
+}
+
+
+
+
+
+
+
+
+
diff --git a/EVGEN/AliGenScan.h b/EVGEN/AliGenScan.h
new file mode 100644 (file)
index 0000000..807bb9c
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef AliGenScan_H
+#define AliGenScan_H
+/////////////////////////////////////////////////////////
+//  Manager and hits classes for set:MUON version 0    //
+/////////////////////////////////////////////////////////
+#include "AliGenerator.h"
+#include "TNamed.h"
+#include "TF1.h"
+#include "TArrayF.h"
+#include "TTree.h"
+
+// Read background particles from a FLUKA boundary source file
+
+class AliGenScan : public AliGenerator
+{
+protected:
+    Float_t fXmin;
+    Float_t fXmax;
+    Int_t   fNx;
+    Float_t fYmin;
+    Float_t fYmax;
+    Int_t   fNy;
+    Float_t fZmin;
+    Float_t fZmax;
+    Int_t   fNz;
+    Int_t fIpart; // Particle type
+    
+public:
+   AliGenScan();
+   AliGenScan(Int_t npart);
+   virtual ~AliGenScan();
+   // Set Scanning Range 
+   virtual void SetRange(Int_t nx, Float_t xmin, Float_t xmax,
+                        Int_t ny, Float_t ymin, Float_t ymax,
+                        Int_t nz, Float_t zmin, Float_t zmax);
+   
+   // Initialise 
+   virtual void Init() {}
+   // generate event
+   virtual void Generate();
+   virtual void SetPart(Int_t part) {fIpart=part;}   
+   
+  ClassDef(AliGenScan,1) //Boundary source
+};
+#endif
+
+
+
+
+
+