lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.2 -r1.3
--- CarrierPropagator.java 14 Dec 2010 21:42:13 -0000 1.2
+++ CarrierPropagator.java 29 Dec 2010 22:29:37 -0000 1.3
@@ -24,7 +24,8 @@
boolean debug = false;
boolean trace = false;
boolean init_OK = true;
- boolean ignore_dif = false;
+ boolean ignore_dif = false;
+ boolean doPrint=false;
//just for fun we can set it to true and see carrier move without diffusion
boolean pconf_real = true;
String name="CCD_classic";
@@ -619,11 +620,13 @@
double z=0.;
double tt = 0.;
int nrep=nsmp/100;
+ if(nrep==0) nrep=1;
float[][][][][] acct = new float[nx][ny][nz][npx][npy];
BasicHep3Vector pp = new BasicHep3Vector(0.,0.,0.);
TransportState tst = new TransportState();
int ofx = (npx-1)/2;
int ofy = (npy-1)/2;
+ System.out.println("Central pixel offsets in table X: "+ofx+" Y: "+ofy);
int pxi = 0;
int pyi = 0;
double ddx = psizex/(nx-1);
@@ -662,11 +665,19 @@
{
z=z0+k*ddz;
pp.setV(x,y,z);
+// if((i==0) && (j==0) && (k==1)) doPrint=true; else doPrint=false;
+ if(doPrint) System.out.println("start point: X="+pp.x()+" Y="+pp.y()+" Z="+pp.z());
transport(pp,tst);
if(tst.status == TransportStatus.COLLECTED)
{
pxi = ofx+tst.offsetX;
pyi = ofy+tst.offsetY;
+ if(doPrint)
+ {
+ System.out.println("we have final state pixel offsets X: "+tst.offsetX+" Y: "+tst.offsetY);
+ System.out.println("adding to central pixel offsets X: "+ofx+" Y: "+ofy);
+ System.out.println("And so adding hit to pxi :"+pxi+" pyi"+pyi);
+ }
if((pxi>=0)&&(pxi<npx))
{
if((pyi>=0)&&(pyi<npy))
@@ -1064,8 +1075,10 @@
collected = false;
trapped = false;
trapsuspect=false;
+ boolean absorbed = false;
ntrc = 0;
if((cp.z()>epidep) || (cp.z() < 0.)) finish=true;
+ if(doPrint) System.out.println("Starting carrier transport");
if(!finish)
{
equivalentPoint(cp,ep);
@@ -1155,6 +1168,8 @@
if(trace) { Hep3Vector trckp = new BasicHep3Vector(cp.x(),cp.y(),cp.z()); p_trace.add(trckp); }
equivalentPoint(cp,ep);
if(trapped) finish=true;
+ if((doPrint)&&(nst%100 == 0))
+ System.out.println("step "+nst+" position: "+cp.x()+" "+cp.y()+" "+cp.z()+" field Z: "+efield.z());
if(((cp.z()<freebotlim) || (cp.z() > freetoplim))&&(!finish))
{
for(SensorRegion sr:collectors)
@@ -1165,7 +1180,7 @@
{
for(SensorRegion sr:absorbers)
{
- if(sr.isInside(ep)) finish=true;
+ if(sr.isInside(ep)) { finish=true; absorbed = true; }
}
}
if(!finish && (reflectors.size() > 0))
@@ -1189,22 +1204,28 @@
status = 0;
finalP.setV(cp.x(),cp.y(),cp.z());
if(nst >= maxst) status=2;
- if(trapped) status=3;
+ if(trapped) status=3;
+ if(absorbed) status=4;
if(collected)
{
status=1;
dx=cp.x()+psizex/2.;
dy=cp.y()+psizey/2.;
- dz=cp.z();
-
- offsetX = (int) Math.floor(dx/psizex);
- offsetY = (int) Math.floor(dy/psizey);
+ dz=cp.z();
+ if(doPrint) System.out.println("carrier collected at X="+cp.x()+" Y="+cp.y()+" Z="+cp.z());
+ offsetX = epOx;
+ offsetY = epOy;
+ if(doPrint) System.out.println("offset in pixels X: "+offsetX+" Y: "+offsetY);
}
- finalstat[0]=offsetX+epOx;
- finalstat[1]=offsetY+epOy;
+ finalstat[0]=offsetX;
+ finalstat[1]=offsetY;
finalstat[2]=status;
- finalstat[3]=nst;
+ finalstat[3]=nst;
+ if(doPrint) System.out.println("transport status is "+status+" after "+nst+" steps");
+ if(doPrint) System.out.println("Equivalent point X: "+ep.x()+" Y: "+ep.y()+" Z: "+ep.z());
+ if(doPrint) System.out.println("we have epOx: "+epOx+" and epOy "+epOy);
+ if(doPrint) System.out.println("So finalstat[0]="+finalstat[0]+" and finalstat[1]="+finalstat[1]);
}
public int[] getFinalState() { return finalstat; }
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.1 -r1.2
--- ErrorEstimate.java 9 Dec 2008 23:36:34 -0000 1.1
+++ ErrorEstimate.java 29 Dec 2010 22:29:37 -0000 1.2
@@ -36,9 +36,10 @@
double nfactmax = 7.2;
boolean tab_read=false;
DecimalFormat df = new DecimalFormat();
- double[][][] sigmasr = new double[ntlbns][ntabns][nnobns];
+ double[][][] sigmasr = null;
- double[][][] sigmasc = new double[ntlbns][ntabns][nnobns];
+ double[][][] sigmasc = null;
+ Random rnd = new Random();
public ErrorEstimate()
{
@@ -55,7 +56,9 @@
tami = tamin;
tama = tamax;
nfactmin = nfmin;
- nfactmax = nfmax;
+ nfactmax = nfmax;
+ sigmasr = new double[ntlbns][ntabns][nnobns];
+ sigmasc = new double[ntlbns][ntabns][nnobns];
}
public boolean readTable(String fnam)
@@ -136,8 +139,8 @@
nnobns=tpar[3];
sigmasr = new double[ntlbns][ntabns][nnobns];
sigmasc = new double[ntlbns][ntabns][nnobns];
-// System.out.println(
-// "Table made from "+cal_stat+" samples in each of "+ntlbns+" tlbns x "+ntabns+" tabns x "+nnobns+" noise bins");
+ System.out.println(
+ "Table made from "+cal_stat+" samples in each of "+ntlbns+" tlbns x "+ntabns+" tabns x "+nnobns+" noise bins");
ntp=freader.readLineOfDouble(r,dpar);
if(ntp != 6) System.out.println("Error in table header, double values");
tlmi=dpar[0];
@@ -146,7 +149,7 @@
tama=dpar[3];
nfactmin=dpar[4];
nfactmax=dpar[5];
-// System.out.println("Tl min-max "+tlmi+" - "+tlma+" Ta min-max " +tami+" - "+tama+" noise fact min-max "+nfactmin+" - "+nfactmax);
+ System.out.println("Tl min-max "+tlmi+" - "+tlma+" Ta min-max " +tami+" - "+tama+" noise fact min-max "+nfactmin+" - "+nfactmax);
for(int i=0; i<ntlbns; i++)
{
for(int j=0; j<ntabns; j++)
@@ -157,7 +160,11 @@
ntp=freader.readLineOfDouble(r,dpar);
}
if(ntp!=nnobns) {System.out.println("wrong number of values in input line!"+ntp); return false; }
- for(int k=0; k<nnobns; k++) sigmasr[i][j][k]=dpar[k];
+ for(int k=0; k<nnobns; k++)
+ {
+ sigmasr[i][j][k]=dpar[k];
+ if(dpar[k] < 0.00001) System.out.println("sigmasr value is too small for i: "+i+" j: "+j+" k: "+k);
+ }
}
}
for(int i=0; i<ntlbns; i++)
@@ -170,7 +177,11 @@
ntp=freader.readLineOfDouble(r,dpar);
}
if(ntp!=nnobns) {System.out.println("wrong number of values in input line!"+ntp); return false; }
- for(int k=0; k<nnobns; k++) sigmasc[i][j][k]=dpar[k];
+ for(int k=0; k<nnobns; k++)
+ {
+ sigmasc[i][j][k]=dpar[k];
+ if(dpar[k] < 0.00001) System.out.println("sigmasc value is too small for i: "+i+" j: "+j+" k: "+k);
+ }
}
}
return true;
@@ -183,6 +194,7 @@
cal_stat=stat;
IPixelSensorElectronics electronics = sensor.getElectronics();
double noise = electronics.getNoiseLevel();
+ double anoise=noise;
double adcsc = electronics.getADCScale();
double pszx = sensor.getPixelConfiguration().getPixelSizeX();
double pszy = sensor.getPixelConfiguration().getPixelSizeY();
@@ -238,6 +250,7 @@
{
for(int j=0; j<nstxy; j++)
{
+ anoise=noise*(1.+rnd.nextDouble());
xst=0.5*stx+i*stx - dz*ta;
yst=0.5*sty+j*sty - dz*tl;
xend = xst + 2.* dz * ta;
@@ -249,6 +262,7 @@
endp.setV(xend,yend,dz);
sensor.clear();
sensor.processLocalTrack((Hep3Vector) startp, (Hep3Vector) endp,0.);
+ electronics.setNoiseLevel(anoise);
electronics.processSensor(sensor,0);
sensor.findClusters();
List<PixCluster> clusters = sensor.getClusters();
@@ -270,7 +284,8 @@
int camp = pcl.getTotalAmp();
// double esig = camp*adcsc/Math.sqrt(1.+tl*tl+ta*ta);
double esig = camp*adcsc;
- double nfact = Math.sqrt(esig/(noise*Math.sqrt(csz)));
+ double nfact = Math.sqrt(esig/(anoise*Math.sqrt(csz)));
+// double nfact = Math.sqrt(esig/noise);
int snbn = (int) Math.floor((nfact-nfactmin)/nfstps);
if(snbn > nnobns-1) snbn=nnobns-1;
if((snbn > -1) && (snbn < nnobns))
@@ -363,7 +378,8 @@
}
}
}
- System.out.print("for sqrt(n/s) ");
+ electronics.setNoiseLevel(noise);
+ System.out.print("for sqrt(s/n) ");
for(int i=0; i<nnobns; i++) System.out.print(df.format(nfactmin+i*nfstps)+" ");
System.out.println("");
for(int i=0; i<ntlbns; i++)
@@ -380,7 +396,7 @@
}
System.out.println(" ");
}
- System.out.print("for sqrt(n/s) ");
+ System.out.print("for sqrt(s/n) ");
for(int i=0; i<nnobns; i++) System.out.print(df.format(nfactmin+i*nfstps)+" ");
System.out.println("");
for(int i=0; i<ntlbns; i++)
@@ -480,6 +496,7 @@
public double[] calculateErrors(PixCluster pcl, PixilatedSensor sensor)
{
+ IDetectorElement dele = sensor.getParent();
double nfstps = (nfactmax-nfactmin)/(nnobns-1);
double tls = (tlma-tlmi)/(ntlbns-1);
double tas = (tama-tami)/(ntabns-1);
@@ -500,6 +517,32 @@
double htz = Math.abs(glc.z());
double tl = 0.;
double ta = 0.;
+ int i=0;
+ int j=0;
+ int k=0;
+ if((sigmasr == null) || (sigmasc==null))
+ {
+ System.out.println("Sensor in detector element "+dele.getName()+" does not have resolution tables!");
+ }
+ for(i=0; i<ntlbns; i++)
+ {
+ for(j=0; j<ntabns; j++)
+ {
+ for(k=0; k<nnobns; k++)
+ {
+ if(sigmasr != null)
+ {
+ if(sigmasr[i][j][k] < 0.00001)
+ System.out.println("wrong table sigmasr element for i,j,k: "+i+" "+j+" "+k);
+ }
+ if(sigmasc != null)
+ {
+ if(sigmasc[i][j][k] < 0.00001)
+ System.out.println("wrong table sigmasc element for i,j,k: "+i+" "+j+" "+k);
+ }
+ }
+ }
+ }
if(!sensor.isEndcap())
{
tl = htz/htr;
@@ -514,8 +557,6 @@
}
int tlb = (int) Math.floor((tl-tlmi)/tls);
int tab = (int) Math.floor((Math.abs(ta)-tami)/tas);
- if(tlb > ntlbns-1) tlb = ntlbns-1;
- if(tab > ntabns-1) tab = ntabns-1;
List<RawTrackerHit> rthts = pcl.getHits();
double csz = (double) rthts.size();
double rmin = (double) sensor.getNRows();
@@ -544,7 +585,7 @@
if(nfact > nfactmax) nfact=nfactmax;
int snb = (int) Math.floor((nfact-nfactmin)/nfstps);
if(snb < 0) snb = 0;
- if(snb > nnobns-1) snb=nnobns-1;
+ if(snb > nnobns-2) snb=nnobns-2;
if(tlb > ntlbns-2) tlb = ntlbns-2;
if(tab > ntabns-2) tab = ntabns-2;
if(snb > nnobns-2) snb=nnobns-2;
@@ -567,7 +608,15 @@
f[7]=sigmasr[tlb+1][tab+1][snb+1];
double sigrs = interp.interpolate(f,x);
-
+ if((sigrs < 0.0001) || (!(sigrs > 0.0001)))
+ {
+ System.out.println("Too small error in row: "+sigrs+" for tlb "+tlb+" tab "+tab+" snb "+snb+" dtl "+dtl+" dta "+dta+" dnf "+dnf);
+ System.out.println("interpolating between values:");
+ System.out.println(" "+df.format(f[1])+" "+df.format(f[5]));
+ System.out.println(df.format(f[0])+" "+df.format(f[4]));
+ System.out.println(" "+df.format(f[3])+" "+df.format(f[7]));
+ System.out.println(df.format(f[2])+" "+df.format(f[6]));
+ }
f[0]=sigmasc[tlb][tab][snb];
f[1]=sigmasc[tlb][tab][snb+1];
f[2]=sigmasc[tlb][tab+1][snb];
@@ -578,7 +627,15 @@
f[7]=sigmasc[tlb+1][tab+1][snb+1];
double sigcs = interp.interpolate(f,x);
-
+ if((sigcs < 0.0001) || (!(sigcs > 0.0001)))
+ {
+ System.out.println("Too small error in col.: "+sigcs+" for tlb "+tlb+" tab "+tab+" snb "+snb+" dtl "+dtl+" dta "+dta+" dnf "+dnf);
+ System.out.println("interpolating between values:");
+ System.out.println(" "+df.format(f[1])+" "+df.format(f[5]));
+ System.out.println(df.format(f[0])+" "+df.format(f[4]));
+ System.out.println(" "+df.format(f[3])+" "+df.format(f[7]));
+ System.out.println(df.format(f[2])+" "+df.format(f[6]));
+ }
double[] cm = new double[7];
if(csz > 8.)
{
@@ -592,10 +649,6 @@
cm[4]=nfact;
cm[5]=clszr;
cm[6]=clszc;
- if(sigcs < 0.0001)
- System.out.println("Too small error in col."+sigcs+" for tlb "+tlb+" tab "+tab+" snb "+snb+" dtl "+dtl+" dta "+dta+" dnf "+dnf);
- if(sigrs < 0.0001)
- System.out.println("Too small error in row "+sigrs+" for tlb "+tlb+" tab "+tab+" snb "+snb+" dtl "+dtl+" dta "+dta+" dnf "+dnf);
return cm;
}
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.4 -r1.5
--- PixilatedSensorManager.java 17 Dec 2010 21:48:45 -0000 1.4
+++ PixilatedSensorManager.java 29 Dec 2010 22:29:37 -0000 1.5
@@ -21,7 +21,7 @@
* for each event (only sensors which have hits in them are created)
*
* @author Nick Sinev
- * @version $Id: PixilatedSensorManager.java,v 1.4 2010/12/17 21:48:45 sinev Exp $
+ * @version $Id: PixilatedSensorManager.java,v 1.5 2010/12/29 22:29:37 sinev Exp $
*/
public class PixilatedSensorManager extends Driver
@@ -32,13 +32,21 @@
boolean read_rest_bar=true;
boolean read_rest_ec=true;
boolean incl_el_noise = false;
- boolean ready = false;
+ boolean ready = false;
+ boolean digital = false;
static PixSimConstants cons = PixSimConstants.instance();
static final int MAXHTSPEV = 100000;
+ static IlcOption ilcopt = IlcOption.NOMINAL;
private static final double bunch_period = cons.BunchInterval;
+ private static double thr_to_noise_ratio = 5.;
+ private static double adc_scale_bar = 25.;
+ private static double adc_scale_ec = 25.;
private static int phys_bc = 0;
+ private static int time_window = 1;
private static int cluster_thr_barr = 8;
- private static int cluster_thr_ec = 8;
+ private static int cluster_thr_ec = 8;
+ private static int pixel_thr_barr = 4;
+ private static int pixel_thr_ec = 4;
private static boolean firstcall = true;
private static boolean assign_bc = true;
private static double enoise = 50.;
@@ -100,8 +108,19 @@
private static boolean ec_pl_ec_mi_same_prop = true;
// here we have arrays of all settable variables for different sensor options
- private static int[] opt_cluster_thr_barr = {8,1,8,1,1,1,1,1,1,8};
- private static int[] opt_cluster_thr_ec = {8,1,8,1,1,1,1,1,1,8};
+ private static int[] opt_cluster_thr_barr = {8,6,8,1,1,1,1,1,1,8};
+ private static int[] opt_pixel_thr_barr = {4,3,4,1,1,1,1,1,1,4};
+ private static int[] opt_cluster_thr_ec = {8,6,8,1,1,1,1,1,1,8};
+ private static int[] opt_pixel_thr_ec = {4,3,4,1,1,1,1,1,1,4};
+ private static double[] opt_lor_cor_b_x = {0.001,0.0065,0.001,0.001,0.0005,0.0005,0.0005,0.0003,0.0003,0.0003};
+ private static double[] opt_lor_cor_b_y = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
+ private static double[] opt_lor_cor_b_z = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
+ private static double[] opt_lor_cor_ep_x = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
+ private static double[] opt_lor_cor_ep_y = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
+ private static double[] opt_lor_cor_ep_z = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
+ private static double[] opt_lor_cor_em_x = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
+ private static double[] opt_lor_cor_em_y = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
+ private static double[] opt_lor_cor_em_z = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
private static boolean[] opt_prop_tab_barrel_local = {false,false,false,true,true,true,true,true,true,true};
private static boolean[] opt_prop_tab_ec_pl_local = {false,false,false,true,true,true,true,true,true,true};
private static boolean[] opt_prop_tab_ec_mi_local = {false,false,false,true,true,true,true,true,true,true};
@@ -110,10 +129,11 @@
private static boolean[] opt_res_tab_ec_mi_local = {false,false,false,true,true,true,true,true,true,true};
private static boolean[] opt_ec_bar_same_prop = {false,false,false,false,false,false,false,false,false,false};
private static boolean[] opt_ec_pl_ec_mi_same_prop = {true,true,true,true,true,true,true,true,true,true};
+ private static boolean[] is_digital = {false,true,false,true,true,true,true,true,true,true};
private static String[] opt_bar_prop_tname =
{"CCD_20x20x20_B5_propagator.dat",
- "CCD_20x20x20_B5_propagator.dat",
+ "Chronopix_20x20x20_hr_B5_Barr_propagator.dat",
"CCD_20x20x20_B5_propagator.dat",
"CCD_20x20x20_B5_propagator.dat",
"Chronopix_8x8x20hr_B5_Barr_propagator.dat",
@@ -126,7 +146,7 @@
private static String[] opt_ec_pl_prop_tname =
{"CCD_20x20x20_B5_EC_propagator.dat",
- "CCD_20x20x20_B5_EC_propagator.dat",
+ "Chronopix_20x20x20_hr_B5_EC_propagator.dat",
"CCD_20x20x20_B5_EC_propagator.dat",
"CCD_20x20x20_B5_EC_propagator.dat",
"Chronopix_8x8x20_B5_EC_propagator.dat",
@@ -152,7 +172,7 @@
private static String[] opt_rtab_name_bar =
{"CCD_20x20x20_B5_res_bar.dat",
- "CCD_20x20x20_B5_res_bar.dat",
+ "Chronopix_20x20x20_hr_B5_res_bar.dat",
"CPCCD_20x20x20_B5_res_bar.dat",
"ShortColCCD_20x20x20_B5_res_bar.dat",
"Chronopix_8x8x20hr_B5_res_bar.dat",
@@ -165,7 +185,7 @@
private static String[] opt_rtab_name_ec_pl=
{"CCD_20x20x20_B5_res_ec.dat",
- "CCD_20x20x20_B5_res_ec.dat",
+ "Chronopix_20x20x20_hr_B5_res_ec.dat",
"CPCCD_20x20x20_B5_res_ec.dat",
"ShortColCCD_20x20x20_B5_res_ec.dat",
"Chronopix_8x8x20hr_B5_res_ec.dat",
@@ -178,7 +198,7 @@
private static String[] opt_rtab_name_ec_mi =
{"CCD_20x20x20_B5_res_ec.dat",
- "CCDd_20x20x20_B5_res_ec.dat",
+ "Chronopix_20x20x20_B5_res_ec.dat",
"CPCCD_20x20x20_B5_res_ec.dat",
"ShortColCCD_20x20x20_B5_res_ec.dat",
"Chronopix_8x8x20hr_B5_res_ec.dat",
@@ -241,7 +261,7 @@
public PixilatedSensorManager(SensorOption opt, boolean usetable)
{
if(opt == SensorOption.ClassicCCD) option = 0;
- if(opt == SensorOption.ClassicCCDdigit) option = 1;
+ if(opt == SensorOption.Chrono20x20x20) option = 1;
if(opt == SensorOption.CPCCD) option = 2;
if(opt == SensorOption.ShortColumnCCD) option = 3;
if(opt == SensorOption.Chrono8x8x20) option = 4;
@@ -253,13 +273,168 @@
use_prop_tab_barrel = usetable;
use_prop_tab_ec_pl = usetable;
use_prop_tab_ec_mi = usetable;
+ setOptionVariables();
+ }
+
+// Setters
+
+ public void setIlcOption(IlcOption opt) { ilcopt = opt; if(opt==IlcOption.CLIC) time_window=50; }
+
+ public void setTimeWindow(int tw) { time_window=tw; }
+
+ public void includeElectronicsNoiseHits(boolean yes) { incl_el_noise=yes; }
+
+ public void setThresholdToNoiseRatio(double ratio) { thr_to_noise_ratio=ratio; }
+
+ public void setPixelThreshold( int thr) { pixel_thr_barr = thr; pixel_thr_ec = thr; }
+
+ public void setPixelThresholdBarrel( int thr) { pixel_thr_barr = thr; }
+
+ public void setPixelThresholdEndcap( int thr) { pixel_thr_ec = thr; }
+
+ public void setClusterThreshold( int thr) { cluster_thr_barr = thr; cluster_thr_ec = thr;}
+
+ public void setClusterThresholdBarrel( int thr) { cluster_thr_barr = thr; }
+
+ public void setClusterThresholdEndcap( int thr) { cluster_thr_ec = thr; }
+
+ public void setNoiseLevel(double noise) { enoise=noise; }
+
+ public void setADCscale(double scale) { adc_scale_bar = scale; adc_scale_ec=scale;}
+
+ public void setADCscaleEndcap(double scale) { adc_scale_ec=scale;}
+
+ public void setADCscaleBarrel(double scale) { adc_scale_bar = scale; }
+
+ public void setDigitalReadout(boolean yes) { digital=yes; }
+
+ public void setPhysicsBeamCrossing(int bc) { phys_bc=bc; }
+
+ public void setBarrelElectronics(IPixelSensorElectronics el) { bar_el=el; }
+
+ public void setEndcapElectronics(IPixelSensorElectronics el) { ecp_el=el; ecm_el=el; }
+
+ public void setEndcapPlusElectronics(IPixelSensorElectronics el) { ecp_el=el; }
+
+ public void setEndcapMinusElectronics(IPixelSensorElectronics el) { ecm_el=el; }
+
+ public void useLocalPropagatorTables(boolean local)
+ {
+ prop_tab_barrel_local = local;
+ prop_tab_ec_pl_local = local;
+ prop_tab_ec_mi_local = local;
+ }
+
+ public void useLocalResolutionTables(boolean local)
+ {
+ res_tab_barrel_local = local;
+ res_tab_ec_pl_local = local;
+ res_tab_ec_mi_local = local;
+
+ }
+
+ public void calibrateBarrelResolution(boolean yes, int stat, String fname)
+ {
+ calibr_stat_b = stat;
+ rtab_name_bar = fname;
+ cal_res_bar=yes;
+ read_rest_bar=false;
+ }
+
+ public void calibrateEndcapResolution(boolean yes,int stat, String fnamepl, String fnamemi)
+ {
+ calibr_stat_ep = stat;
+ calibr_stat_em = stat;
+ rtab_name_ec_pl = fnamepl;
+ rtab_name_ec_mi = fnamemi;
+ cal_res_ec=yes;
+ read_rest_ec=false;
+ }
+
+ public void calibrateEndcapResolution(boolean yes,int stat, String fname)
+ {
+ calibr_stat_ep = stat;
+ calibr_stat_em = stat;
+ rtab_name_ec_pl = fname;
+ rtab_name_ec_mi = fname;
+ cal_res_ec=yes;
+ read_rest_ec=false;
+ if(!ec_pl_ec_mi_same_prop)
+ System.out.println("Warning!Propagators for plus and minus ec are different! Can't use same resolution table!");
+ }
+
+ public void usePropagatorTable(String tname)
+ {
+ bar_prop_tname = tname;
+ use_prop_tab_barrel = true;
+ use_prop_tab_ec_pl = false;
+ use_prop_tab_ec_mi = false;
+ if(!ec_bar_same_prop) System.out.println("Propagators for barrel and ec are different - can't use same table!");
+ if(ec_bar_same_prop)
+ {
+ if(!ec_pl_ec_mi_same_prop) System.out.println("Propagators for plus and minus ec are different - can't use same table!");
+ if(ec_pl_ec_mi_same_prop)
+ {
+ use_prop_tab_ec_pl = true;
+ use_prop_tab_ec_mi = true;
+ }
+ }
+ }
+
+ public void usePropagatorTables(String btname, String etname)
+ {
+ bar_prop_tname = btname;
+ ec_pl_prop_tname = etname;
+ use_prop_tab_barrel = true;
+ use_prop_tab_ec_pl = true;
+ if(!ec_pl_ec_mi_same_prop) System.out.println("Propagators for plus and minus ec are different - can't use same table!");
+ if(ec_pl_ec_mi_same_prop)
+ {
+ use_prop_tab_ec_mi = true;
+ }
+ }
+
+// getters
+
+ public List<IDetectorElement> getBarrelDetectorElements()
+ {
+ return vxbrels;
}
+ public List<IDetectorElement> getEndcapPlusDetectorElements()
+ {
+ return vxecpels;
+ }
+
+ public List<IDetectorElement> getEndcapMinusDetectorElements()
+ {
+ return vxecmels;
+ }
+
+ public List<PixilatedSensor> getBarrelSensors()
+ {
+ return psbrl;
+ }
+
+ public List<PixilatedSensor> getEndcapPlusSensors()
+ {
+ return psecpl;
+ }
+
+ public List<PixilatedSensor> getEndcapMinusSensors()
+ {
+ return psecml;
+ }
+
+
+
+
+// private functions
+
private void setup()
{
if(option == 0)
{
- setOptionVariables();
IPixelSensorElectronics el = new CCDElectronics();
el.includeElectronicNoiseHits(incl_el_noise);
el.setADCScale(25.);
@@ -280,19 +455,46 @@
}
if(option == 1)
{
- setOptionVariables();
- IPixelSensorElectronics el = new CCDElectronics();
+ IPixelSensorElectronics el=null;
+ if(!digital) el = new CCDElectronics();
+ if(digital) el = new ChronoPixelElectronics(ilcopt);
el.includeElectronicNoiseHits(incl_el_noise);
- el.setADCScale(140.);
- el.setNoiseLevel(enoise);
- el.setADCSaturation(1);
- el.setBunchesPerClock(30); // this is about maximum clock image speed (100 KHz) for classic CCD - asuming 50MHz speed in R register
- // for VXD3 CCD we would set this value to 300 (10 KHz image clock and 5 MHz R register speed)
+ if(digital)
+ {
+ el.setADCScale(enoise*thr_to_noise_ratio);
+ el.setNoiseLevel(enoise);
+ el.setADCSaturation(1);
+ el.useCorrelatedDoubleSampling(false);
+ }
+ if(!digital)
+ {
+ el.setNoiseLevel(enoise);
+ el.setADCSaturation(255);
+ el.useCorrelatedDoubleSampling(true);
+ }
+ el.setBunchesPerClock(1);
el.useCorrelatedDoubleSampling(false);
- el.setPixelThreshold(1);
bar_el = el;
ecp_el = el;
ecm_el = el;
+ if(!digital)
+ {
+ bar_el.setADCScale(adc_scale_bar);
+ bar_el.setPixelThreshold(pixel_thr_barr);
+ ecp_el.setADCScale(adc_scale_ec);
+ ecm_el.setADCScale(adc_scale_ec);
+ ecp_el.setPixelThreshold(pixel_thr_ec);
+ ecm_el.setPixelThreshold(pixel_thr_ec);
+ opt_lor_cor_b_x[option]=0.00556;
+ }
+ if(digital)
+ {
+ bar_el.setPixelThreshold(1);
+ ecp_el.setPixelThreshold(1);
+ ecm_el.setPixelThreshold(1);
+ cluster_thr_barr=1;
+ cluster_thr_ec=1;
+ }
bpcf = new PixelConfiguration();
bcpr = new CarrierPropagator(bpcf);
ecppr = new CarrierPropagator(bpcf);
@@ -301,7 +503,6 @@
}
if(option == 2)
{
- setOptionVariables();
IPixelSensorElectronics el = new CCDElectronics();
el.includeElectronicNoiseHits(incl_el_noise);
el.setADCScale(25.);
@@ -335,114 +536,12 @@
rtab_name_ec_mi = opt_rtab_name_ec_mi[option];
cluster_thr_barr = opt_cluster_thr_barr[option];
cluster_thr_ec = opt_cluster_thr_ec[option];
+ pixel_thr_barr = opt_pixel_thr_barr[option];
+ pixel_thr_ec = opt_pixel_thr_ec[option];
+ digital = is_digital[option];
}
- public void includeElectronicsNoiseHits(boolean yes) { incl_el_noise=yes; }
-
- public void setNoiseLevel(double noise) { enoise=noise; }
-
- public List<IDetectorElement> getBarrelDetectorElements()
- {
- return vxbrels;
- }
-
- public List<IDetectorElement> getEndcapPlusDetectorElements()
- {
- return vxecpels;
- }
-
- public List<IDetectorElement> getEndcapMinusDetectorElements()
- {
- return vxecmels;
- }
-
- public List<PixilatedSensor> getBarrelSensors()
- {
- return psbrl;
- }
-
- public List<PixilatedSensor> getEndcapPlusSensors()
- {
- return psecpl;
- }
-
- public List<PixilatedSensor> getEndcapMinusSensors()
- {
- return psecml;
- }
-
- public void setPhysicsBeamCrossing(int bc)
- {
- phys_bc=bc;
- }
-
- public void setBarrelElectronics(IPixelSensorElectronics el)
- {
- bar_el=el;
- }
-
- public void setEndcapElectronics(IPixelSensorElectronics el)
- {
- ecp_el=el;
- ecm_el=el;
- }
-
- public void setEndcapPlusElectronics(IPixelSensorElectronics el)
- {
- ecp_el=el;
- }
-
- public void setEndcapMinusElectronics(IPixelSensorElectronics el)
- {
- ecm_el=el;
- }
-
- public void calibrateBarrelResolution(boolean yes, int stat, String fname)
- {
- calibr_stat_b = stat;
- rtab_name_bar = fname;
- cal_res_bar=yes;
- }
-
- public void calibrateEndcapResolution(boolean yes,int stat, String fnamepl, String fnamemi)
- {
- calibr_stat_ep = stat;
- calibr_stat_em = stat;
- rtab_name_ec_pl = fnamepl;
- rtab_name_ec_mi = fnamemi;
- cal_res_ec=yes;
- }
-
- public void usePropagatorTable(String tname)
- {
- bar_prop_tname = tname;
- use_prop_tab_barrel = true;
- use_prop_tab_ec_pl = false;
- use_prop_tab_ec_mi = false;
- if(!ec_bar_same_prop) System.out.println("Propagators for barrel and ec are different - can't use same table!");
- if(ec_bar_same_prop)
- {
- if(!ec_pl_ec_mi_same_prop) System.out.println("Propagators for plus and minus ec are different - can't use same table!");
- if(ec_pl_ec_mi_same_prop)
- {
- use_prop_tab_ec_pl = true;
- use_prop_tab_ec_mi = true;
- }
- }
- }
-
- public void usePropagatorTables(String btname, String etname)
- {
- bar_prop_tname = btname;
- ec_pl_prop_tname = etname;
- use_prop_tab_barrel = true;
- use_prop_tab_ec_pl = true;
- if(!ec_pl_ec_mi_same_prop) System.out.println("Propagators for plus and minus ec are different - can't use same table!");
- if(ec_pl_ec_mi_same_prop)
- {
- use_prop_tab_ec_mi = true;
- }
- }
+ // driver process function
public void process(EventHeader event)
{
@@ -593,14 +692,22 @@
{
if(res_tab_barrel_local) eeb.readTable(rtab_name_bar);
else eeb.readTable(rtab_name_bar,det);
- }
+ }
+ BasicHep3Vector Lor_corr = new BasicHep3Vector(0.,0.,0.);
for(IDetectorElement de:vxbrels)
{
PixilatedSensor pse = new PixilatedSensor(de,bcpr,false);
pse.setElectronics(bar_el);
pse.setErrorEstimate(eeb);
- pse.setClusterThreshold(cluster_thr_barr);
- if(nbe==0 && cal_res_bar) pse.calibrateErrorEstimate(calibr_stat_b,rtab_name_bar);
+ pse.setClusterThreshold(cluster_thr_barr);
+ pse.setTimeWindow(time_window);
+ Lor_corr.setV(opt_lor_cor_b_x[option],opt_lor_cor_b_y[option],opt_lor_cor_b_z[option]);
+ pse.setLorentzCorrection(Lor_corr);
+ if(nbe==0 && cal_res_bar)
+ {
+ eeb.setTableParameters(11,11,11,0.,1.5,0.,1.5,1.5,6.5);
+ pse.calibrateErrorEstimate(calibr_stat_b,rtab_name_bar);
+ }
nbe++;
psbrl.add(pse);
}
@@ -615,33 +722,44 @@
PixilatedSensor pse = new PixilatedSensor(de,ecppr,true);
pse.setElectronics(ecp_el);
pse.setErrorEstimate(eeep);
- pse.setClusterThreshold(cluster_thr_ec);
- eeep.setTableParameters(11,11,11,0.,1.5,0.,1.5,2.2,7.2);
- if(nbc==0 && cal_res_ec) pse.calibrateErrorEstimate(calibr_stat_ep,rtab_name_ec_pl);
+ pse.setClusterThreshold(cluster_thr_ec);
+ pse.setTimeWindow(time_window);
+ Lor_corr.setV(opt_lor_cor_ep_x[option],opt_lor_cor_ep_y[option],opt_lor_cor_ep_z[option]);
+ pse.setLorentzCorrection(Lor_corr);
+ if(nbc==0 && cal_res_ec)
+ {
+ eeep.setTableParameters(11,11,11,0.,1.5,0.,1.5,1.5,6.5);
+ pse.calibrateErrorEstimate(calibr_stat_ep,rtab_name_ec_pl);
+ }
nbc++;
psecpl.add(pse);
}
int nbcm = 0;
- if((read_rest_ec)&&(!ec_pl_ec_mi_same_prop)) eeem.readTable(rtab_name_ec_mi);
- if(ec_pl_ec_mi_same_prop) eeem=eeep;
- else
+ if((read_rest_ec)&&(!ec_pl_ec_mi_same_prop))
{
- if(read_rest_ec)
- {
- if(res_tab_ec_mi_local) eeem.readTable(rtab_name_ec_mi);
- else eeem.readTable(rtab_name_ec_mi,det);
- }
+ if(res_tab_ec_mi_local) eeem.readTable(rtab_name_ec_mi);
+ else eeem.readTable(rtab_name_ec_mi,det);
}
+ if(ec_pl_ec_mi_same_prop) eeem=eeep;
for(IDetectorElement de:vxecmels)
{
PixilatedSensor pse = new PixilatedSensor(de,ecmpr,true);
pse.setElectronics(ecm_el);
pse.setErrorEstimate(eeem);
pse.setClusterThreshold(cluster_thr_ec);
+ pse.setTimeWindow(time_window);
+ Lor_corr.setV(opt_lor_cor_em_x[option],opt_lor_cor_em_y[option],opt_lor_cor_em_z[option]);
+ pse.setLorentzCorrection(Lor_corr);
if(!ec_pl_ec_mi_same_prop)
- {
- eeem.setTableParameters(11,11,11,0.,1.5,0.,1.5,2.2,7.2);
- if(nbcm==0 && cal_res_ec) pse.calibrateErrorEstimate(calibr_stat_em,rtab_name_ec_mi);
+ {
+ if(!read_rest_ec)
+ {
+ if(nbcm==0 && cal_res_ec)
+ {
+ eeem.setTableParameters(11,11,11,0.,1.5,0.,1.5,1.5,6.5);
+ pse.calibrateErrorEstimate(calibr_stat_ep,rtab_name_ec_mi);
+ }
+ }
}
nbcm++;
psecml.add(pse);