Changeset 178 in Idarraga for allpix


Ignore:
Timestamp:
Apr 24, 2011, 3:40:54 PM (13 years ago)
Author:
benoit
Message:

Full Field addition, with 1D field

Location:
allpix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • allpix/include/AllPixFEI3StandardDigitizer.hh

    r177 r178  
    5656  G4double SlimEdgeEffect(G4int nX,G4double xpos,G4double eHit);
    5757  G4bool isSlimEdge(G4int nX, G4int nY);
     58  void Efield1D(G4double z);
    5859  G4double elec;
    5960
     
    7071  G4double b;
    7172  G4double c;
     73  G4double Neff;
    7274
    7375  G4double detectorThickness;
     
    114116  G4bool doSlimEdge;
    115117
     118  G4double epsilon;
     119  G4double echarge;
     120  G4int precision;
     121
    116122
    117123  //////////////////////////////////////////////////////
  • allpix/src/AllPixFEI3StandardDigitizer.cc

    r177 r178  
    1313#include "TF1.h"
    1414#include "CLHEP/Random/RandGauss.h"
     15#include "CLHEP/Random/RandFlat.h"
    1516
    1617//#include "SystemOfUnits.h"
     
    4243        //////////////////////////
    4344
    44         biasVoltage=600.0; //[V]
     45        biasVoltage=1000.0; //[V]
    4546        Temperature = 300.0;
    4647        detectorThickness = gD->GetSensorZ();
     
    9899        //////////////////////
    99100
    100         fluence = 1e15/cm2;
     101        fluence = 0.0/cm2;
     102        //Beta_electrons = 5e-16*cm2/ns;
    101103        Beta_electrons = 5e-16*cm2/ns;
    102104        b=7.94e-3/cm;
     
    104106        trappingTime = 1.0/(Beta_electrons*fluence);
    105107
    106         double echarge = 1.60217646e-19;
    107         double epsilon = 11.8*8.854187817e-12/m;
    108 
    109         double Neff=0;
     108        echarge = 1.60217646e-19;
     109        epsilon = 11.8*8.854187817e-12/m;
     110
     111        Neff=0;
    110112        double Neff0=0;
    111113        if(bulkType) Neff0=-1.0/(resistivity*Default_Hole_Mobility*(s/cm2)*echarge*cm3);
    112114        else  Neff0=1.0/(resistivity*Default_Electron_Mobility*(s/cm2)*echarge*cm3);
    113115
    114         if(!bulkType)Neff=Neff*TMath::Exp(-c*fluence)-b*fluence;
     116        if(!bulkType)Neff=Neff0*TMath::Exp(-c*fluence)-b*fluence;
    115117        else Neff=Neff0-b*fluence;
    116118
     
    118120        depletedDepth=TMath::Sqrt(2*epsilon*biasVoltage/(echarge*TMath::Abs(Neff)));
    119121        if(depletedDepth>detectorThickness)depletedDepth=detectorThickness;
    120         electricFieldY = biasVoltage/depletedDepth; // V/um
     122        electricFieldZ = biasVoltage/depletedDepth; // V/um
    121123        electricFieldX = 0; // V/um
    122         electricFieldZ = 0; // V/um
     124        electricFieldY = 0; // V/um
    123125
    124126        G4cout << "!!!!!!!Radiation Damage Report !!!!!!!!" << endl
     
    137139
    138140        doTrapping =true;
    139         doFullField = false;
     141        doFullField = true;
    140142
    141143
     
    148150        dtIni = 0.01*ns;
    149151
     152        precision = 5;
     153
    150154
    151155        /////////////////////////////
     
    168172        case 3 :
    169173                MipTOT=60;
    170                 MipCharge=21000;
     174                MipCharge=22000;
    171175                CounterDepth=255;
    172176                Lv1Unit = 25*ns;
     
    229233
    230234        case 1 :
    231                 doSlimEdge=true;
     235                doSlimEdge=false;
    232236                GRShift =250*um;
    233237                break;
     
    294298        G4double ytemp=y;
    295299        G4double ztemp=z;
    296 
     300        //cout << "z : " << z/um << endl;
    297301        vector<G4double> step;
    298         while(z>0 && z<detectorThickness){
     302        int counter=0;
     303        while( ztemp>0 && ztemp<detectorThickness){
    299304
    300305                driftTime+=dt;
    301                 step=RKF5Integration(x,y,z,dt);
     306                step=RKF5Integration(xtemp,ytemp,ztemp,dt);
    302307                xtemp+=step[0];
    303308                ytemp+=step[1];
    304309                ztemp+=step[2];
    305                 SetDt(dt,step[3]);
     310                if(GetElectricFieldNorm(xtemp,ytemp,ztemp)==0)ztemp=detectorThickness;
     311                dt=SetDt(dt,step[3]);
     312                counter++;
     313                //cout << "!!!!!! Drifting youhou! !!!!! " << TString::Format("dt: %f z : %f drift : %f Ez : %f",dt/ns,ztemp/um,driftTime/ns,electricFieldZ*cm) << endl;
    306314        }
    307315
     
    316324
    317325
    318 void AllPixFEI3StandardDigitizer::ComputeElectricField(G4double /*x*/, G4double /*y*/, G4double /*z*/){}
     326void AllPixFEI3StandardDigitizer::ComputeElectricField(G4double /*x*/, G4double /*y*/, G4double z){
     327
     328                Efield1D(z);
     329}
    319330
    320331
     
    327338
    328339        //ComputeElectricField(x,y,z);
    329         G4double parElectricField = electricFieldY;//GetElectricFieldNorm(x,y,z);
     340        G4double parElectricField = electricFieldZ;//GetElectricFieldNorm(x,y,z);
    330341        G4double mobilite = Default_Electron_Mobility*
    331342        TMath::Power((1.0/(1.+ TMath::Power((Default_Electron_Mobility*parElectricField)/
     
    355366        //G4cout << "Hit position with respect to pixel (um) "<< (a_hit->GetPosWithRespectToPixel().z() + detectorThickness/2.0)/um  <<endl;
    356367        //return (a_hit->GetPosWithRespectToPixel().z() + detectorThickness/2.0 ) /(mobility*electricFieldY);
    357         double drift = ( CLHEP::RandGauss::shoot((depletedDepth/detectorThickness)*detectorThickness/2,(depletedDepth/detectorThickness)*detectorThickness/4)) /(mobility*electricFieldY);
     368        double drift = ( CLHEP::RandGauss::shoot((depletedDepth/detectorThickness)*detectorThickness/2,(depletedDepth/detectorThickness)*detectorThickness/4)) /(mobility*electricFieldZ);
    358369        //cout << "drift: " << mobility*s/cm2 << endl;
    359370        return drift;
     
    384395}
    385396
     397
     398void AllPixFEI3StandardDigitizer::Efield1D(G4double z){
     399
     400
     401        electricFieldZ=(detectorThickness-z)*biasVoltage/depletedDepth;
     402        if(z>depletedDepth){
     403                electricFieldZ=0;
     404                //cout << "bip" << endl;
     405        }
     406
     407}
     408
     409
     410
     411
    386412/**
    387413 * Digitizer for FEI3Standard
     
    415441        for(G4int itr  = 0 ; itr < nEntries ; itr++) {
    416442
     443                G4double eHitTotal = elec*CLHEP::RandGauss::shoot((*hitsCollection)[itr]->GetEdep()/elec,TMath::Sqrt((*hitsCollection)[itr]->GetEdep()/elec)*0.118);
     444
     445                //under-depletion
     446                eHitTotal = eHitTotal*depletedDepth/detectorThickness;
     447
     448                for(G4int nQ  = 0 ; nQ < precision ; nQ++) {
     449
     450                double eHit = double(eHitTotal)/precision;
    417451                // Hit Info
    418452
     
    427461
    428462                G4double ypos = (*hitsCollection)[itr]->GetPosWithRespectToPixel().y();
    429                 G4double zpos = (*hitsCollection)[itr]->GetPosWithRespectToPixel().z();
    430 
    431                 G4double eHit = elec*CLHEP::RandGauss::shoot((*hitsCollection)[itr]->GetEdep()/elec,TMath::Sqrt((*hitsCollection)[itr]->GetEdep()/elec)*0.118);
    432 
    433                 //under-depletion
    434                 eHit = eHit*depletedDepth/detectorThickness;
     463                //G4double zpos = (*hitsCollection)[itr]->GetPosWithRespectToPixel().z();
     464                G4double zpos = CLHEP::RandFlat::shoot()*depletedDepth;
     465
    435466
    436467
     
    448479                }
    449480                else{
     481
     482                        // Until we get out position
    450483                        vector<G4double> data = ComputeDriftTimeFullField(xpos,ypos,zpos);
    451484                        driftTime = data[3];
     
    569602        }
    570603
     604
    571605        // Now create digits.  One per pixel
    572606        map<pair<G4int, G4int>, G4double >::iterator pCItr = pixelsContent.begin();
     
    599633        }
    600634
     635        }
     636
    601637        G4int dc_entries = m_digitsCollection->entries();
    602638        if(dc_entries > 0){
     
    693729
    694730//______________________________________________________________________________
    695 G4double  AllPixFEI3StandardDigitizer::SetDt(G4double Dt, G4double ErreurMoy)
    696 {
    697 
     731G4double  AllPixFEI3StandardDigitizer::SetDt(G4double dt, G4double ErreurMoy)
     732{
     733
     734        double Dt=dt;
    698735        if(isnan(ErreurMoy)){Dt=tup;}
    699736        else if(ErreurMoy > Target){ Dt*=0.9;}
Note: See TracChangeset for help on using the changeset viewer.