lcsim/sandbox/NickSinev/PixSim
diff -u -r1.1 -r1.2
--- PixilatedSensorManager.java 27 Jun 2008 23:38:32 -0000 1.1
+++ PixilatedSensorManager.java 30 Jun 2008 18:55:05 -0000 1.2
@@ -19,7 +19,7 @@
* for each event (only sensors which have hits in them are created)
*
* @author Nick Sinev
- * @version $Id: PixilatedSensorManager.java,v 1.1 2008/06/27 23:38:32 sinev Exp $
+ * @version $Id: PixilatedSensorManager.java,v 1.2 2008/06/30 18:55:05 sinev Exp $
*/
public class PixilatedSensorManager extends Driver
@@ -28,7 +28,8 @@
boolean cal_res_ec = false;
boolean read_rest_bar=true;
boolean read_rest_ec=true;
- boolean incl_el_noise = false;
+ boolean incl_el_noise = false;
+ boolean ready = false;
static PixSimConstants cons = PixSimConstants.instance();
static final int MAXHTSPEV = 10000;
private static final double bunch_period = cons.BunchInterval;
@@ -94,11 +95,11 @@
private static int[] opt_cluster_thr_barr = {8,8,8,1,1,1,1,1,1,8};
private static int[] opt_cluster_thr_ec = {8,8,8,1,1,1,1,1,1,8};
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 = {true,true,true,true,true,true,true,true,true,true};
- private static boolean[] opt_prop_tab_ec_mi_local = {true,true,true,true,true,true,true,true,true,true};
- private static boolean[] opt_res_tab_barrel_local = {true,true,true,true,true,true,true,true,true,true};
- private static boolean[] opt_res_tab_ec_pl_local = {true,true,true,true,true,true,true,true,true,true};
- private static boolean[] opt_res_tab_ec_mi_local = {true,true,true,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};
+ private static boolean[] opt_res_tab_barrel_local = {false,false,false,true,true,true,true,true,true,true};
+ private static boolean[] opt_res_tab_ec_pl_local = {false,false,false,true,true,true,true,true,true,true};
+ 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};
@@ -230,78 +231,62 @@
public PixilatedSensorManager(SensorOption opt, boolean usetable)
{
- if(opt == SensorOption.ClassicCCD)
+ if(opt == SensorOption.ClassicCCD) option = 0;
+ if(opt == SensorOption.CPCCD) option = 1;
+ if(opt == SensorOption.ShortColumnCCD) option = 2;
+ if(opt == SensorOption.Chrono8x8x20) option = 3;
+ if(opt == SensorOption.Chrono12x12x20) option = 4;
+ if(opt == SensorOption.Chrono16x16x20) option = 5;
+ if(opt == SensorOption.Chrono8x8x12) option = 6;
+ if(opt == SensorOption.Chrono12x12x12) option = 7;
+ if(opt == SensorOption.Chrono16x16x12) option = 8;
+ if(opt == SensorOption.Mimosa) option = 9;
+ use_prop_tab_barrel = usetable;
+ use_prop_tab_ec_pl = usetable;
+ use_prop_tab_ec_mi = usetable;
+ }
+
+ private void setup()
{
- option = 0;
- setOptionVariables();
- IPixelSensorElectronics el = new CCDElectronics();
- el.includeElectronicNoiseHits(incl_el_noise);
- el.setADCScale(25.);
- el.setNoiseLevel(50.);
- el.setADCSaturation(255);
- el.setBunchesPerClock(30); // this is about maximum clock image speed (100 KHz) for classic CCD - asuming 50MHz speed in R register
+ if(option == 0)
+ {
+ setOptionVariables();
+ IPixelSensorElectronics el = new CCDElectronics();
+ el.includeElectronicNoiseHits(incl_el_noise);
+ el.setADCScale(25.);
+ el.setNoiseLevel(50.);
+ el.setADCSaturation(255);
+ 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)
- el.useCorrelatedDoubleSampling(true);
- el.setPixelThreshold(4);
- bar_el = el;
- ecp_el = el;
- ecm_el = el;
- bpcf = new PixelConfiguration();
- bcpr = new CarrierPropagator(bpcf);
- ecppr = new CarrierPropagator(bpcf);
- ecmpr = ecppr;
- }
- if(opt == SensorOption.CPCCD)
- {
- option = 1;
- setOptionVariables();
- IPixelSensorElectronics el = new CCDElectronics();
- el.setADCScale(25.);
- el.setNoiseLevel(50.);
- el.setADCSaturation(255);
- el.useCorrelatedDoubleSampling(true);
- el.setPixelThreshold(4);
- el.setClocksPerBunch(16); // 50 MHz image clock speed in column parallel CCD
- bar_el = el;
- ecp_el = el;
- ecm_el = el;
- }
- if(opt == SensorOption.ShortColumnCCD)
- {
- option = 2;
+ el.useCorrelatedDoubleSampling(true);
+ el.setPixelThreshold(4);
+ bar_el = el;
+ ecp_el = el;
+ ecm_el = el;
+ bpcf = new PixelConfiguration();
+ bcpr = new CarrierPropagator(bpcf);
+ ecppr = new CarrierPropagator(bpcf);
+ ecmpr = ecppr;
+ ready = true;
+ }
+ if(option == 1)
+ {
+ setOptionVariables();
+ IPixelSensorElectronics el = new CCDElectronics();
+ el.includeElectronicNoiseHits(incl_el_noise);
+ el.setADCScale(25.);
+ el.setNoiseLevel(50.);
+ el.setADCSaturation(255);
+ el.useCorrelatedDoubleSampling(true);
+ el.setPixelThreshold(4);
+ el.setClocksPerBunch(16); // 50 MHz image clock speed in column parallel CCD
+ bar_el = el;
+ ecp_el = el;
+ ecm_el = el;
+ ready = true;
+ }
+ if(option > 1) System.out.println("This sensor option is not implemented yet! ");
}
- if(opt == SensorOption.Chrono8x8x20)
- {
- option = 3;
- }
- if(opt == SensorOption.Chrono12x12x20)
- {
- option = 4;
- }
- if(opt == SensorOption.Chrono16x16x20)
- {
- option = 5;
- }
- if(opt == SensorOption.Chrono8x8x12)
- {
- option = 6;
- }
- if(opt == SensorOption.Chrono12x12x12)
- {
- option = 7;
- }
- if(opt == SensorOption.Chrono16x16x12)
- {
- option = 8;
- }
- if(opt == SensorOption.Mimosa)
- {
- option = 9;
- }
- use_prop_tab_barrel = usetable;
- use_prop_tab_ec_pl = usetable;
- use_prop_tab_ec_mi = usetable;
- }
private void setOptionVariables()
{
@@ -322,6 +307,8 @@
cluster_thr_ec = opt_cluster_thr_ec[option];
}
+ public void includeElectronicsNoise(boolean yes) { incl_el_noise=yes; }
+
public List<IDetectorElement> getBarrelDetectorElements()
{
return vxbrels;
@@ -436,40 +423,62 @@
if(firstcall)
{
firstcall=false;
+ setup();
vxbrels.clear();
vxecpels.clear();
vxecmels.clear();
if(use_prop_tab_barrel)
{
- if(bcpr.useTable(bar_prop_tname,det)) System.out.println("Using table for barrel sensor carrier propagator");
+ if(prop_tab_barrel_local)
+ {
+ if(bcpr.useTable(bar_prop_tname)) System.out.println("Using table for barrel sensor carrier propagator");
+ }
+ else
+ {
+ if(bcpr.useTable(bar_prop_tname,det)) System.out.println("Using table for barrel sensor carrier propagator");
+ }
}
if(use_prop_tab_ec_pl)
{
if(ec_bar_same_prop) System.out.println("Carrier propagator for barrel and ec sensors is the same");
if(!ec_bar_same_prop)
{
- if(ecppr.useTable(ec_pl_prop_tname)) System.out.println("Using table for ec pl sensor carrier propagator");
+ if(prop_tab_ec_pl_local)
+ {
+ if(ecppr.useTable(ec_pl_prop_tname)) System.out.println("Using table for ec pl sensor carrier propagator");
+ }
+ else
+ {
+ if(ecppr.useTable(ec_pl_prop_tname,det)) System.out.println("Using table for ec pl sensor carrier propagator");
+ }
}
}
if(use_prop_tab_ec_mi)
{
if(!ec_pl_ec_mi_same_prop)
{
- if(ecmpr.useTable(ec_mi_prop_tname)) System.out.println("Using table for ec mi sensor carrier propagator");
+ if(prop_tab_ec_mi_local)
+ {
+ if(ecmpr.useTable(ec_mi_prop_tname)) System.out.println("Using table for ec mi sensor carrier propagator");
+ }
+ else
+ {
+ if(ecmpr.useTable(ec_mi_prop_tname,det)) System.out.println("Using table for ec mi sensor carrier propagator");
+ }
}
}
IDetectorElement tde = det.getDetectorElement();
if(tde != null)
{
- System.out.println("Detector elements: ");
+// System.out.println("Detector elements: ");
List<IDetectorElement> chlds= (List<IDetectorElement>) tde.getChildren();
for(IDetectorElement chld:chlds)
{
String name = chld.getName();
- System.out.println(name);
+// System.out.println(name);
if((name.indexOf("Vtx")!=-1) || (name.indexOf("Vertex") != -1))
{
- System.out.println(" processing "+name);
+// System.out.println(" processing "+name);
if(name.indexOf("Barrel") !=-1)
{
if(!chld.hasChildren()) vxbrels.add(chld);
@@ -512,10 +521,10 @@
}
if(name.indexOf("Endcap") !=-1)
{
- System.out.println("It is endcap!");
+// System.out.println("It is endcap!");
if(!chld.hasChildren())
{
- System.out.println("It does not have children!");
+// System.out.println("It does not have children!");
if(name.indexOf("positive") != -1)
vxecpels.add(chld);
if(name.indexOf("negative") != -1)
@@ -529,7 +538,7 @@
if(!chld1.hasChildren())
{
name = chld1.getName();
- System.out.println(" "+name);
+// System.out.println(" "+name);
if(name.indexOf("positive") != -1)
vxecpels.add(chld1);
if(name.indexOf("negative") != -1)
@@ -543,7 +552,7 @@
if(!chld2.hasChildren())
{
name = chld2.getName();
- System.out.println(" "+name);
+// System.out.println(" "+name);
if(name.indexOf("positive") != -1)
vxecpels.add(chld2);
if(name.indexOf("negative") != -1)
@@ -589,9 +598,13 @@
} // end of if((name.indexOf("Vtx")!=-1) || (name.indexOf("Vertex") != -1))
} // end of for(IDetectorElement chld:chlds)
} // end of if(tde != null)
- System.out.println("Detector contains "+vxbrels.size()+" barrel vertex and "+vxecpels.size()+" endcap detector elements");
+// System.out.println("Detector contains "+vxbrels.size()+" barrel vertex and "+vxecpels.size()+" endcap detector elements");
int nbe = 0;
- if(read_rest_bar) eeb.readTable(rtab_name_bar);
+ if(read_rest_bar)
+ {
+ if(res_tab_barrel_local) eeb.readTable(rtab_name_bar);
+ else eeb.readTable(rtab_name_bar,det);
+ }
for(IDetectorElement de:vxbrels)
{
PixilatedSensor pse = new PixilatedSensor(de,bcpr,false);
@@ -602,7 +615,11 @@
psbrl.add(pse);
}
int nbc = 0;
- if(read_rest_ec) eeep.readTable(rtab_name_ec_pl);
+ if(read_rest_ec)
+ {
+ if(res_tab_ec_pl_local) eeep.readTable(rtab_name_ec_pl);
+ else eeep.readTable(rtab_name_ec_pl,det);
+ }
for(IDetectorElement de:vxecpels)
{
PixilatedSensor pse = new PixilatedSensor(de,ecppr,true);
@@ -616,6 +633,14 @@
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)
+ {
+ if(res_tab_ec_mi_local) eeem.readTable(rtab_name_ec_mi);
+ else eeem.readTable(rtab_name_ec_mi,det);
+ }
+ }
for(IDetectorElement de:vxecmels)
{
PixilatedSensor pse = new PixilatedSensor(de,ecmpr,true);
@@ -630,6 +655,7 @@
psecml.add(pse);
}
} // end of if(firstcall)
+ if(!ready) return;
for(IDetectorElement de:vxbrels)
{
if(de.hasReadout()) { IReadout ro = de.getReadout(); ro.clear(); }