ROOT logo

General KDetector example (strip detector with trenches)

{
  KDetector det; 
  det.SStep=1; // this variable determines the precision of your stepping
  det.nx=1000; // number of nodes in x
  det.ny=50;   // number of nodes in y
  det.nz=1;    // for 2D simulations no. of z nodes =1 

  Float_t dimX=1000; //dimension in [um] in x
  Float_t dimY=50;  // in y

  //init geometry
  det.EG=new TH3I("EG","EG",det.nx,0,dimX,det.ny,0,dimY,det.nz,0,1);
  det.EG->GetXaxis()->SetTitle("x [#mum]");
  det.EG->GetYaxis()->SetTitle("y [#mum]");
  det.EG->GetZaxis()->SetTitle("z [#mum]");

  //init material
  det.DM=new TH3I("DM","DM",det.nx,0,dimX,det.ny,0,dimY,det.nz,0,1);
  det.DM->GetXaxis()->SetTitle("x [#mum]");
  det.DM->GetYaxis()->SetTitle("y [#mum]");
  det.DM->GetZaxis()->SetTitle("z [#mum]");

  //init space charge histo
  det.NeffH=new TH3F("Neff","Neff",det.nx,0,dimX,det.ny,0,dimY,det.nz,0,1);
  det.NeffH->GetXaxis()->SetTitle("x [#mum]");
  det.NeffH->GetYaxis()->SetTitle("y [#mum]");
  det.NeffH->GetZaxis()->SetTitle("z [#mum]");

  //  SetUpMaterial
  for(int j=0;j<=det.ny;j++)
    for(int i=0;i<=det.nx;i++) 
      {
	det->DM->SetBinContent(i,j,1,0); 
	//the material is all being set to 0? Is 0 silicon? Are the electrodes made of silicon as well? Also what is 1 here?
	//--->>> The electrodes are poly-Si or Al - however what really determines them is selecting them as 
	//       electrodes in the sense of Ramo's concept of induced charge. 

	det->NeffH->SetBinContent(i,j,1,0.1);  // very high resistivity Neff=1e11 cm-3
	//what is 0.1? /--->>> 0.1 is Neff measured in [cm^-3], so 0.1 is 5e11 cm-3. The sign of that parameter determines the sign of the space charge.
      }



  // Collection electrode
  Float_t BackPos[3]={500,1,0.5}; //Why don't we set the electrode exactly at the edge of the boundary? Does that cause weird end effects?
  // --->>> this is for back electrode, z=0.5 and y=1 are purely technical - which has to 
  //        do with setting the mesh for calculation
  
  Float_t BackSiz[3]={500,0.5,0.5};
  det.ElRectangle(BackPos,BackSiz,2,1); //position, size, weighting, material
  //What is the collection electrode? Why is the weighting field set to 16385, and what material is 0?
  //--->>> The collection electrode is set by proper weighting potential. I selected the strip in the center 
  //       When you setup electrode you can use 0 - not an electrode
  //                                            1 - GND electrode
  //                                            2 - HV electrode (not that you can use many voltages as for SDD, 
  //                                                but I guess this is not your case 

  det.Voltage=-200.; //--->>>  you have to set the HV - in this case -200 V at the back

  // Area  definitions
  Float_t StripPos[3]={50,50,0}; //--->>>  definition of strip positions in x,y,z 
  Float_t StripSiz[3]={12,0.5,0}; //--->>>  definition of the oxide (as example) trenches position in x,y,z i
  Float_t OxSiz[3]={20,4,0}; //--->>>  definition of the oxide (as example) trenches size in x,y,z 

  Float_t SideWall1Size[]={20,20,0}; //--->>>  definition of the sidewals
  Float_t SideWall2Size[]={40,6,0};  //--->>>  definition of the sidewalls - I had to compose them of 
                                     //       two to make it look like on you plot
  Float_t SideWallPos[3];            //--->>>  sidewall positions
  

  // definition of voltages to be applied to the field strips

  int Wpval=1; ////--->>>  variable for weighting potential
  for(int i=0; i<=8; i++) //loop 9 strips
    {
      if(i==4) Wpval=16385; else Wpval=1; //--->>>  signal strip is strip #4

      StripPos[0]=i*80+180; //--->>>  positioning of the strips (80 microns pitch, 24 microns implant width, 
                            //        1 um implant depth)- see the definition of the strip 
      StripPos[1]=49;
      det.ElRectangle(StripPos,StripSiz,Wpval,1);  //det->SetElecVolt(i) what is this doing, how do we set the weighting field for the strip? 
      ////--->>>  this is generation for Silicon Drift Detectors (SDD), it doesn't apply to you, I guess

      StripPos[1]=46;     //--->>> trench position in y
      StripPos[0]=i*80+180+40;   //--->>> trench position in x
      if(i!=8)
	{
	  det.ElRectangle(StripPos,OxSiz,0,2);     //--->>> select "no electrode"=0 and "material"=2
      det.ElRectangle(StripPos,OxSiz,det.NeffH,5); //--->>> setting oxide charge concentration to 5e12 cm-3
	}
     }

  //positioning of the walls
   SideWallPos[0]=100; SideWallPos[1]=30; det.ElRectangle(SideWallPos,SideWall1Size,0,20); 
   SideWallPos[0]=900; SideWallPos[1]=30; det.ElRectangle(SideWallPos,SideWall1Size,0,20); 
   SideWallPos[0]=40;  SideWallPos[1]=44; det.ElRectangle(SideWallPos,SideWall2Size,0,20); 
   SideWallPos[0]=960; SideWallPos[1]=44; det.ElRectangle(SideWallPos,SideWall2Size,0,20); 

  SideWall1Size[0]=60; SideWall1Size[1]=25; SideWall1Size[2]=0; 
  SideWallPos[0]=60;  SideWallPos[1]=25; det.ElRectangle(SideWallPos,SideWall1Size,det.NeffH,0);  
  SideWallPos[0]=940; SideWallPos[1]=25; det.ElRectangle(SideWallPos,SideWall1Size,det.NeffH,0);  
   



  det.SetBoundaryConditions(); //Is there any way to change the boundary conditions? Or is the V always 0 at the boundaries?
  //--->>> boundary condition is always reflective (no field lines can escape the simulation volume, derivative of the potential normal to surface =0) where there are no electrodes and with fixed potential at the place of the electrodes. This is commonly used set of boundary conditions in almost all simulators including TCAD.

  //calculation of the fields, weighting and electric
  det.CalField(0);
  det.CalField(1);


  det.SetEntryPoint(500,1,0.5);
  det.SetExitPoint(500,50,0.5); //Does this always have to be a straight line?
  //--->>> no, not at all, this is most commonly used distribution, but you can design any deposition you like.
  //       so, photo-electron, e.g. I use short line in chosen direction, but you can use any pattern you like.
  //       Absorption of visible light in silicon e.g. uses exponential decay in intensity.




  det.SetDriftHisto(10e-9); //What does this parameter do?
  // --->>> this sets the range of current histogram - now I changed it to 0-5ns 
  det.SetPrecision(1e-10); //What does the precision control in calculating the fields and the MIP?
  // this is the precision of tracking in terms of time
  det.diff=1; //our diff=0
  // --->>>diffusion on = 1, diffusion off=0
  det. ShowMipIR(300); //what is the difference between ShowMipIR and MipIR?
    // ShowMipIR is for visualisation only, while MipIR does proper calculation of the current.

  TCanvas Show;
  Show.Divide(2,2);
  Show.cd(1);
  // Draw electric potential [V]
   det.Draw("EP").Draw("COLZ");
  Show.cd(2);
  // Draw weighting potential (no units)
   det.Draw("WP").Draw("COLZ");
  Show.cd(3);
  // Draw absolute value of electric field [V/um]
   det.Draw("EF").Draw("COLZ");
  Show.cd(4);
  // Draw material (red = air, white=silicon, violet=electrode Al, Blue=oxide);
   det.Draw("M").Draw("COLZ");


  // SIMULATION OF INDUCED CURRENT ON SIGNAL STRIP FOR HIT STRIP
  TCanvas Drift;
  Drift.Divide(2,3);
  Drift.cd(1);
  // Draw mip track
  det.ShowMipIR(20);  // B=0; 30 e-h pair buckets along the track generated
  det.diff=1;          // diffusion is on
  Drift.cd(2);
  
  det.MipIR(50);            //simulation of drift for 50 buckets along the particle track
  det.sum.DrawCopy();           // total induced current
  det.neg.SetLineColor(4);  //elecrons are blue
  det.pos.SetLineColor(2);  // holes are red
  det.neg.DrawCopy("SAME");
  det.pos.DrawCopy("SAME");
  // Draw mip track


  // SIMULATION OF INDUCED CURRENT ON SIGNAL STRIP FOR HIT NEIGHBOUR
  Drift.cd(3); 
  det.SetEntryPoint(420,1,0.5);
  det.SetExitPoint(420,50,0.5);
  
   det.ShowMipIR(20);  // B=0; 30 e-h pair buckets along the track generated
  det.diff=1;          // diffusion is on
  Drift.cd(4);
  
  det.MipIR(50);            //simulation of drift for 50 buckets along the particle track
  det.sum.DrawCopy();           // total induced current
  det.neg.SetLineColor(4);  //elecrons are blue
  det.pos.SetLineColor(2);  // holes are red
  det.neg.DrawCopy("SAME");
  det.pos.DrawCopy("SAME");



  // SIMULATION OF INDUCED CURRENT ON SIGNAL STRIP FOR 

  det.SetEntryPoint(380,35,0.5);
  det.SetExitPoint(400,28,0.5);
  Drift.cd(5);
  // Draw mip track
  det.ShowMipIR(20);  // B=0; 30 e-h pair buckets along the track generated
  det.diff=1;          // diffusion je on
  Drift.cd(6);
  
  det.MipIR(50);            //simulation of drift for 50 buckets along the particle track
  det.sum.DrawCopy();           // total induced current
  det.neg.SetLineColor(4);  //electrons are blue
  det.pos.SetLineColor(2);  // holes are red
  det.neg.DrawCopy("SAME");
  det.pos.DrawCopy("SAME");
  // Draw mip track



}
 GeneralDevice.C:1
 GeneralDevice.C:2
 GeneralDevice.C:3
 GeneralDevice.C:4
 GeneralDevice.C:5
 GeneralDevice.C:6
 GeneralDevice.C:7
 GeneralDevice.C:8
 GeneralDevice.C:9
 GeneralDevice.C:10
 GeneralDevice.C:11
 GeneralDevice.C:12
 GeneralDevice.C:13
 GeneralDevice.C:14
 GeneralDevice.C:15
 GeneralDevice.C:16
 GeneralDevice.C:17
 GeneralDevice.C:18
 GeneralDevice.C:19
 GeneralDevice.C:20
 GeneralDevice.C:21
 GeneralDevice.C:22
 GeneralDevice.C:23
 GeneralDevice.C:24
 GeneralDevice.C:25
 GeneralDevice.C:26
 GeneralDevice.C:27
 GeneralDevice.C:28
 GeneralDevice.C:29
 GeneralDevice.C:30
 GeneralDevice.C:31
 GeneralDevice.C:32
 GeneralDevice.C:33
 GeneralDevice.C:34
 GeneralDevice.C:35
 GeneralDevice.C:36
 GeneralDevice.C:37
 GeneralDevice.C:38
 GeneralDevice.C:39
 GeneralDevice.C:40
 GeneralDevice.C:41
 GeneralDevice.C:42
 GeneralDevice.C:43
 GeneralDevice.C:44
 GeneralDevice.C:45
 GeneralDevice.C:46
 GeneralDevice.C:47
 GeneralDevice.C:48
 GeneralDevice.C:49
 GeneralDevice.C:50
 GeneralDevice.C:51
 GeneralDevice.C:52
 GeneralDevice.C:53
 GeneralDevice.C:54
 GeneralDevice.C:55
 GeneralDevice.C:56
 GeneralDevice.C:57
 GeneralDevice.C:58
 GeneralDevice.C:59
 GeneralDevice.C:60
 GeneralDevice.C:61
 GeneralDevice.C:62
 GeneralDevice.C:63
 GeneralDevice.C:64
 GeneralDevice.C:65
 GeneralDevice.C:66
 GeneralDevice.C:67
 GeneralDevice.C:68
 GeneralDevice.C:69
 GeneralDevice.C:70
 GeneralDevice.C:71
 GeneralDevice.C:72
 GeneralDevice.C:73
 GeneralDevice.C:74
 GeneralDevice.C:75
 GeneralDevice.C:76
 GeneralDevice.C:77
 GeneralDevice.C:78
 GeneralDevice.C:79
 GeneralDevice.C:80
 GeneralDevice.C:81
 GeneralDevice.C:82
 GeneralDevice.C:83
 GeneralDevice.C:84
 GeneralDevice.C:85
 GeneralDevice.C:86
 GeneralDevice.C:87
 GeneralDevice.C:88
 GeneralDevice.C:89
 GeneralDevice.C:90
 GeneralDevice.C:91
 GeneralDevice.C:92
 GeneralDevice.C:93
 GeneralDevice.C:94
 GeneralDevice.C:95
 GeneralDevice.C:96
 GeneralDevice.C:97
 GeneralDevice.C:98
 GeneralDevice.C:99
 GeneralDevice.C:100
 GeneralDevice.C:101
 GeneralDevice.C:102
 GeneralDevice.C:103
 GeneralDevice.C:104
 GeneralDevice.C:105
 GeneralDevice.C:106
 GeneralDevice.C:107
 GeneralDevice.C:108
 GeneralDevice.C:109
 GeneralDevice.C:110
 GeneralDevice.C:111
 GeneralDevice.C:112
 GeneralDevice.C:113
 GeneralDevice.C:114
 GeneralDevice.C:115
 GeneralDevice.C:116
 GeneralDevice.C:117
 GeneralDevice.C:118
 GeneralDevice.C:119
 GeneralDevice.C:120
 GeneralDevice.C:121
 GeneralDevice.C:122
 GeneralDevice.C:123
 GeneralDevice.C:124
 GeneralDevice.C:125
 GeneralDevice.C:126
 GeneralDevice.C:127
 GeneralDevice.C:128
 GeneralDevice.C:129
 GeneralDevice.C:130
 GeneralDevice.C:131
 GeneralDevice.C:132
 GeneralDevice.C:133
 GeneralDevice.C:134
 GeneralDevice.C:135
 GeneralDevice.C:136
 GeneralDevice.C:137
 GeneralDevice.C:138
 GeneralDevice.C:139
 GeneralDevice.C:140
 GeneralDevice.C:141
 GeneralDevice.C:142
 GeneralDevice.C:143
 GeneralDevice.C:144
 GeneralDevice.C:145
 GeneralDevice.C:146
 GeneralDevice.C:147
 GeneralDevice.C:148
 GeneralDevice.C:149
 GeneralDevice.C:150
 GeneralDevice.C:151
 GeneralDevice.C:152
 GeneralDevice.C:153
 GeneralDevice.C:154
 GeneralDevice.C:155
 GeneralDevice.C:156
 GeneralDevice.C:157
 GeneralDevice.C:158
 GeneralDevice.C:159
 GeneralDevice.C:160
 GeneralDevice.C:161
 GeneralDevice.C:162
 GeneralDevice.C:163
 GeneralDevice.C:164
 GeneralDevice.C:165
 GeneralDevice.C:166
 GeneralDevice.C:167
 GeneralDevice.C:168
 GeneralDevice.C:169
 GeneralDevice.C:170
 GeneralDevice.C:171
 GeneralDevice.C:172
 GeneralDevice.C:173
 GeneralDevice.C:174
 GeneralDevice.C:175
 GeneralDevice.C:176
 GeneralDevice.C:177
 GeneralDevice.C:178
 GeneralDevice.C:179
 GeneralDevice.C:180
 GeneralDevice.C:181
 GeneralDevice.C:182
 GeneralDevice.C:183
 GeneralDevice.C:184
 GeneralDevice.C:185
 GeneralDevice.C:186
 GeneralDevice.C:187
 GeneralDevice.C:188
 GeneralDevice.C:189
 GeneralDevice.C:190
 GeneralDevice.C:191
 GeneralDevice.C:192
 GeneralDevice.C:193
 GeneralDevice.C:194
 GeneralDevice.C:195
 GeneralDevice.C:196
 GeneralDevice.C:197
 GeneralDevice.C:198
 GeneralDevice.C:199
 GeneralDevice.C:200
 GeneralDevice.C:201
 GeneralDevice.C:202
 GeneralDevice.C:203
 GeneralDevice.C:204
 GeneralDevice.C:205