ROOT logo

3D detector example

{
 gStyle->SetCanvasPreferGL(kTRUE);

  // define a 3D detector with 5 electrodes
  // x=100 , y is 50 and thickness 120
  K3D *det=new K3D(5,100,50,120);
  // define the voltage
  det->Voltage=100;
  // define the drift mesh size and simulation mesh size in microns
  det->SetUpVolume(1,1);
  // define  columns #, postions, weigthing factor 2=0 , material Al=1
  det->SetUpColumn(0,0,0,5,75,2,1);
  det->SetUpColumn(1,100,0,5,75,2,1);
  det->SetUpColumn(2,0,50,5,75,2,1);
  det->SetUpColumn(3,100,50,5,75,2,1);
  det->SetUpColumn(4,50,25,5,-75,16385,1);
 Float_t Pos[3]={100,50,1};
  Float_t Size[3]={100,50,2};
  det->ElRectangle(Pos,Size,0,20);

  det->SetUpElectrodes();
  det->SetBoundaryConditions();


  //define the space charge
  TF3 *f2=new TF3("f2","x[0]*x[1]*x[2]*0+[0]",0,3000,0,3000,0,3000);
  f2->SetParameter(0,-2);
  det->NeffF=f2;

  // calculate weigting field
  // calculate electric field
   det->CalField(0);
   det->CalField(1);

   // set entry points of the track
   det->enp[0]=30;
   det->enp[1]=30;
   det->enp[2]=50;
   det->exp[0]=30;
   det->exp[1]=30;
   det->exp[2]=10;

   // switch on the diffusion
   det->diff=1;
  
   // Show mip track
   TCanvas c1; c1.cd();
   det.ShowMipIR(30);
   // Show electric potential
   TCanvas c2; c2.cd();
   det.Draw("EPxy",99).Draw("COLZ");
   // calcualte induced current
   TCanvas c3; c3.cd();
   det.MipIR(100);
   det->sum.Draw();
   det->neg.Draw("SAME");
   det->pos.Draw("SAME");


}
 Test3D.C:1
 Test3D.C:2
 Test3D.C:3
 Test3D.C:4
 Test3D.C:5
 Test3D.C:6
 Test3D.C:7
 Test3D.C:8
 Test3D.C:9
 Test3D.C:10
 Test3D.C:11
 Test3D.C:12
 Test3D.C:13
 Test3D.C:14
 Test3D.C:15
 Test3D.C:16
 Test3D.C:17
 Test3D.C:18
 Test3D.C:19
 Test3D.C:20
 Test3D.C:21
 Test3D.C:22
 Test3D.C:23
 Test3D.C:24
 Test3D.C:25
 Test3D.C:26
 Test3D.C:27
 Test3D.C:28
 Test3D.C:29
 Test3D.C:30
 Test3D.C:31
 Test3D.C:32
 Test3D.C:33
 Test3D.C:34
 Test3D.C:35
 Test3D.C:36
 Test3D.C:37
 Test3D.C:38
 Test3D.C:39
 Test3D.C:40
 Test3D.C:41
 Test3D.C:42
 Test3D.C:43
 Test3D.C:44
 Test3D.C:45
 Test3D.C:46
 Test3D.C:47
 Test3D.C:48
 Test3D.C:49
 Test3D.C:50
 Test3D.C:51
 Test3D.C:52
 Test3D.C:53
 Test3D.C:54
 Test3D.C:55
 Test3D.C:56
 Test3D.C:57
 Test3D.C:58
 Test3D.C:59
 Test3D.C:60
 Test3D.C:61