10 modified files
lcsim/src/org/lcsim/recon/tracking/seedtracker/trackingdrivers/clic_sid
diff -u -r1.3 -r1.4
--- MainTrackingDriver.java 29 Dec 2010 22:30:31 -0000 1.3
+++ MainTrackingDriver.java 23 Sep 2011 18:39:06 -0000 1.4
@@ -49,6 +49,11 @@
// Tracking code
String sfile = StrategyXMLUtils.getDefaultStrategiesPrefix() + "autogen_ttbar_sidloi3.xml";
List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromResource(sfile);
+ for(SeedStrategy strat:slist)
+ {
+ String name = strat.getName();
+ System.out.println("Using strategy: "+name);
+ }
_st = new SeedTracker(slist);
add(_st);
}
@@ -74,6 +79,11 @@
// Tracking code
String sfile = StrategyXMLUtils.getDefaultStrategiesPrefix() + "autogen_ttbar_sidloi3.xml";
List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromResource(sfile);
+ for(SeedStrategy strat:slist)
+ {
+ String name = strat.getName();
+ System.out.println("Using strategy: "+name);
+ }
_st = new SeedTracker(slist);
add(_st);
}
lcsim/src/org/lcsim/recon/tracking/seedtracker/trackingdrivers/clic_sid
diff -u -r1.1 -r1.2
--- TrackerHitDriver_strips.java 14 Dec 2010 21:44:04 -0000 1.1
+++ TrackerHitDriver_strips.java 23 Sep 2011 18:39:06 -0000 1.2
@@ -56,25 +56,16 @@
// Instantiate the sensor simulation classes and set the thresholds
SiSensorSim strip_simulation = new CDFSiSensorSim();
-// SiSensorSim pixel_simulation = new CDFSiSensorSim();
// Instantiate the readout chips and set the noise parameters
GenericReadoutChip strip_readout = new GenericReadoutChip();
-// strip_readout.setNoiseIntercept(800.);
- strip_readout.setNoiseIntercept(1000.);
+ strip_readout.setNoiseIntercept(800.);
strip_readout.setNoiseSlope(0.);
strip_readout.setNoiseThreshold(4000.);
strip_readout.setNeighborThreshold(4000.);
-// DigitalReadoutChip pixel_readout = new DigitalReadoutChip();
-/* pixel_readout.setNoiseIntercept(80.);
- pixel_readout.setNoiseSlope(0.);
- pixel_readout.setNoiseThreshold(500.);
- pixel_readout.setNeighborThreshold(500.);
- pixel_readout.setConversionConstant(1000); */
// Instantiate the digitizer that produces the raw hits
_strip_digitizer = new RawTrackerHitMaker(strip_simulation, strip_readout);
-// _pixel_digitizer = new RawTrackerHitMaker(pixel_simulation, pixel_readout);
_digitizer_name = _strip_digitizer.getName();
// Instantiate a nearest neighbor clustering algorithm for the pixels
@@ -82,11 +73,6 @@
strip_clustering.setSeedThreshold(4000.);
strip_clustering.setNeighborThreshold(2000.);
- // Instantiate a nearest neighbor clustering algorithm for the pixels
-/* NearestNeighbor pixel_clustering = new NearestNeighbor();
- pixel_clustering.setSeedThreshold(200.);
- pixel_clustering.setNeighborThreshold(200.); */
-
// Instantiate the clusterers and set hit-making parameters
_strip_clusterer = new StripHitMaker(strip_simulation, strip_readout, strip_clustering);
_strip_clusterer.setMaxClusterSize(10);
@@ -96,24 +82,13 @@
_strip_clusterer.SetThreeClusterErr(1 / 3.0);
_strip_clusterer.SetFourClusterErr(1 / 2.0);
_strip_clusterer.SetFiveClusterErr(1 / 1.0);
-/*
- _pixel_clusterer = new PixelHitMaker(pixel_simulation, pixel_readout, pixel_clustering);
- _pixel_clusterer.SetOneClusterErr(1 / Math.sqrt(12.));
- _pixel_clusterer.SetTwoClusterErr(1 / 5.0);
- _pixel_clusterer.SetThreeClusterErr(1 / 3.0);
- _pixel_clusterer.SetFourClusterErr(1 / 2.0);
- _pixel_clusterer.SetFiveClusterErr(1 / 1.0); */
// Specify the readouts to process
-/* _readouts.add("SiVertexBarrelHits");
- _readouts.add("SiVertexEndcapHits"); */
_readouts.add("SiTrackerBarrelHits");
_readouts.add("SiTrackerEndcapHits");
_readouts.add("SiTrackerForwardHits");
// Specify the detectors to process
-/* _process_paths.add("SiVertexBarrel");
- _process_paths.add("SiVertexEndcap"); */
_process_paths.add("SiTrackerBarrel");
_process_paths.add("SiTrackerEndcap");
_process_paths.add("SiTrackerForward");
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.4 -r1.5
--- CarrierPropagator.java 24 Feb 2011 20:53:59 -0000 1.4
+++ CarrierPropagator.java 23 Sep 2011 18:39:06 -0000 1.5
@@ -25,8 +25,8 @@
boolean trace = false;
boolean init_OK = true;
boolean ignore_dif = false;
- boolean doPrint=false;
//just for fun we can set it to true and see carrier move without diffusion
+ boolean doPrint=false;
boolean pconf_real = true;
String name="CCD_classic";
Random rnd = new Random();
@@ -45,7 +45,6 @@
List<SensorRegion> absorbers = new ArrayList<SensorRegion>();
List<SensorRegion> reflectors = new ArrayList<SensorRegion>();
List<Hep3Vector> p_trace = new ArrayList<Hep3Vector>();
- List<ChargeChunk> chunks = new ArrayList<ChargeChunk>();
double freetoplim=0.02;
double freebotlim=0.;
NamedFieldMap EField = null;
@@ -328,18 +327,6 @@
public boolean useTable(String nam, String dname)
{
- // Replaced reading of detector conditions with lcsim resource files. --JM
- /*
- String dfname = "/detectors/"+dname+".zip";
- String enam = "PixilatedSensorTables/"+nam;
- ConditionsManager cm = ConditionsManagerImplementation.defaultInstance();
- try {cm.setDetector(dname, 0); }
- catch(Exception e) {
- throw new RuntimeException("Could not find conditions information for detector "+dname);
- }
- try {
- InputStream is = cm.getRawConditions(enam).getInputStream();
- */
use_table = false;
BufferedReader reader;
System.out.println(this.getClass().getSimpleName() + " looking for resource " + nam);
@@ -618,6 +605,7 @@
}
}
} // end of if(dmatch) clouse
+ if(tab_read) System.out.println("Successfully red table!");
return tab_read;
}
@@ -722,6 +710,7 @@
public List<ChargeChunk> transportBlob(Hep3Vector sp, int npairs)
{
+ List<ChargeChunk> chunks = new ArrayList<ChargeChunk>();
chunks.clear();
startP.setV(sp.x(),sp.y(),sp.z());
equivalentPoint(startP,ep);
@@ -1222,6 +1211,7 @@
dy=cp.y()+psizey/2.;
dz=cp.z();
if(doPrint) System.out.println("carrier collected at X="+cp.x()+" Y="+cp.y()+" Z="+cp.z());
+ equivalentPoint(cp,ep);
offsetX = epOx;
offsetY = epOy;
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.3 -r1.4
--- ErrorEstimate.java 24 Feb 2011 20:53:59 -0000 1.3
+++ ErrorEstimate.java 23 Sep 2011 18:39:06 -0000 1.4
@@ -35,10 +35,29 @@
double nfactmin = 2.2;
double nfactmax = 7.2;
boolean tab_read=false;
+ boolean new_form = false;
+ double costmin = -0.995;
+ double costmax = 0.995;
+ double talmi = -0.05;
+ double talma = 0.05;
+ double dcost = 0.025;
+ double dtal = 0.01;
+ int rspbn = 5;
+ int cspbn = 3;
+ int ntbn = 0;
+ int nlab =0;
+ double pszx = 0.;
+ double pszy = 0.;
+ double epith = 0.;
DecimalFormat df = new DecimalFormat();
double[][][] sigmasr = null;
double[][][] sigmasc = null;
+
+ double[][] table = null;
+
+ int[] lath = new int[3];
+
Random rnd = new Random();
public ErrorEstimate()
@@ -46,6 +65,10 @@
df.setMaximumFractionDigits(5);
}
+ public void setNewTableForm(boolean yes) { new_form = yes; }
+
+ public boolean isNew() {return new_form;}
+
public void setTableParameters(int ntlb,int ntab,int nnb,double tlmin,double tlmax,double tamin,double tamax,double nfmin,double nfmax)
{
ntlbns = ntlb;
@@ -141,9 +164,14 @@
return tab_read;
}
-
public boolean readTable(BufferedReader r)
{
+ if(new_form) return readTableNew(r);
+ return readTableOld(r);
+ }
+
+ public boolean readTableOld(BufferedReader r)
+ {
int[] tpar = new int[10];
double[] dpar = new double[40];
int ntp = freader.readLineOfInt(r,tpar);
@@ -202,17 +230,262 @@
return true;
}
+ public boolean readTableNew(BufferedReader r)
+ {
+ int[] tpar = new int[10];
+ double[] dpar = new double[40];
+ int ntp = freader.readLineOfInt(r,tpar);
+ if(ntp != 8) { System.out.println("Error in table header"); return false; }
+ cal_stat=tpar[0];
+ ntbn=tpar[1];
+ rspbn=tpar[2];
+ cspbn=tpar[3];
+ nlab=tpar[4];
+ lath[0]=tpar[5];
+ lath[1]=tpar[6];
+ lath[2]=tpar[7];
+ table = new double[ntbn][6];
+ System.out.println("Table in new format is made from "+cal_stat+" samples and has "+ntbn+" shape bins");
+ ntp=0;
+ while(ntp==0)
+ ntp=freader.readLineOfDouble(r,dpar);
+ if(ntp != 3) System.out.println("Error in table header, double values");
+ pszx=dpar[0]/1000.;
+ pszy=dpar[1]/1000.;
+ epith=dpar[2]/1000.;
+ System.out.println("Pixel dimensions "+dpar[0]+" x "+dpar[1]+" x "+dpar[2]+ "u**3");
+ for(int i=0; i<ntbn; i++)
+ {
+ ntp=0;
+ while(ntp == 0)
+ {
+ ntp=freader.readLineOfDouble(r,dpar);
+ }
+ if(ntp!=6) {System.out.println("wrong number of values in input line!"+ntp); return false; }
+ for(int k=0; k<6; k++)
+ {
+ table[i][k]=dpar[k];
+ }
+ }
+ return true;
+ }
+
+ public void calibrateNew(PixilatedSensor sensor, int stat, String fname)
+ {
+ System.out.println("Calibrating resolution. Please wait!");
+ cal_stat=stat;
+ IPixelSensorElectronics electronics = sensor.getElectronics();
+ int nctst = (int) ((costmax-costmin)/dcost) + 1;
+ int ntast = (int) ((talma-talmi)/dtal) + 1;
+ double ccost =0.;
+ double ctal = 0.;
+ double ctla = 0.;
+ double noise = electronics.getNoiseLevel();
+ double anoise=noise;
+ double adcsc = electronics.getADCScale();
+ pszx = sensor.getPixelConfiguration().getPixelSizeX();
+ pszy = sensor.getPixelConfiguration().getPixelSizeY();
+ epith = sensor.getPixelConfiguration().getEpiThickness();
+ BasicHep3Vector startp = new BasicHep3Vector(0.,0.,0.);
+ BasicHep3Vector endp = new BasicHep3Vector(0.,0.,0.);
+ int nstxy = (int) Math.sqrt((double) cal_stat);
+ double stx = pszx/nstxy;
+ double sty = pszy/nstxy;
+ double dz = 0.1;
+ int cth = sensor.getClusterThreshold();
+ boolean digir = false;
+ boolean negy = false;
+ if(cth < 2) digir = true;
+ nlab = 0;
+ if(!digir)
+ {
+ nlab = 3;
+ lath[0]= cth+cth/2;
+ lath[1]= cth*2 + cth/2;
+ lath[2]= cth*3 + cth/2;
+ }
+ ntbn = nlab + rspbn*cspbn;
+ table = new double[ntbn][6];
+ double[][] acval = new double[ntbn][6];
+ int[][] nent = new int[ntbn][3];
+ for(int i=0; i<ntbn; i++)
+ {
+ for(int j=0; j<3; j++)
+ {
+ acval[i][j]=0.;
+ nent[i][j]=0;
+ }
+ }
+ double xst=0.;
+ double yst=0.;
+ double xend = 0.;
+ double yend = 0.;
+ double xcntr = 0.;
+ double ycntr = 0.;
+ double[] rcc = new double[2];
+ for(int n=0; n<nctst; n++)
+ {
+ System.out.println("Calibrating cos(theta) bin "+n+" out of "+nctst);
+ ccost = costmin+n*dcost;
+ ctla = ccost/Math.sqrt(1.-ccost*ccost);
+ {
+ for(int m=0; m<ntast; m++)
+ {
+ ctal = talmi + m*dtal;
+ for(int i=0; i<nstxy; i++)
+ {
+ xst=0.5*stx+i*stx - dz*ctal;
+ xend = xst + 2.* dz * ctal;
+ for(int j=0; j<nstxy; j++)
+ {
+ yst=0.5*sty+j*sty - dz*ctla;
+ yend = yst + 2.* dz * ctla;
+ negy = (yend < yst);
+ xcntr = (xst+xend)/2.;
+ ycntr = (yst+yend)/2.;
+ sensor.sensorToRC(xcntr,ycntr,rcc);
+ startp.setV(xst,yst,-dz);
+ endp.setV(xend,yend,dz);
+ sensor.clear();
+ sensor.processLocalTrack((Hep3Vector) startp, (Hep3Vector) endp,0.);
+ electronics.processSensor(sensor,0);
+ sensor.findClusters();
+ List<PixCluster> clusters = sensor.getClusters();
+ if(clusters.size() == 1)
+ {
+ for(PixCluster pcl:clusters)
+ {
+ pcl.findCenter();
+ double clcr = pcl.getCenterRow();
+ double clcc = pcl.getCenterColumn();
+ double rres = clcr-rcc[0];
+ double cres = clcc-rcc[1];
+ double rrsq = rres*rres;
+ double crsq = cres*cres;
+ int camp = pcl.getTotalAmp();
+ int rspan = pcl.getRowSpan();
+ if(rspan > rspbn) rspan=rspbn;
+ int cspan = pcl.getColSpan();
+ if(cspan > cspbn) cspan=cspbn;
+ int tbin = nlab + (rspan-1)*cspbn+cspan-1;
+ if(!digir)
+ {
+ if(nlab==3)
+ {
+ if(camp < lath[2]) tbin = 2;
+ if(camp < lath[1]) tbin = 1;
+ if(camp < lath[0]) tbin = 0;
+ }
+ if(nlab==2)
+ {
+ if(camp < lath[1]) tbin = 1;
+ if(camp < lath[0]) tbin = 0;
+ }
+ if((nlab == 1) && (camp<lath[0])) tbin = 0;
+ }
+ if(tbin < ntbn)
+ {
+ acval[tbin][0]+=cres;
+ acval[tbin][1]+=crsq;
+ nent[tbin][0]++;
+ if(negy)
+ {
+ acval[tbin][2]+=rres;
+ acval[tbin][3]+=rrsq;
+ nent[tbin][1]++;
+ }
+ else
+ {
+ acval[tbin][4]+=rres;
+ acval[tbin][5]+=rrsq;
+ nent[tbin][2]++;
+ }
+ }
+ sensor.clearReadout();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for(int i=0; i<ntbn; i++)
+ {
+ if(nent[i][0] > 3)
+ {
+ table[i][0] = acval[i][0]/nent[i][0];
+ table[i][1] = Math.sqrt(acval[i][1]/nent[i][0] - table[i][0]*table[i][0]);
+ }
+ if((nent[i][0] < 3) && (i>0))
+ {
+ table[i][0] = table[i-1][0];
+ table[i][1] = table[i-1][1];
+ }
+ if((nent[i][0] < 3) && (i==0))
+ {
+ table[i][0] = 0.;
+ table[i][1] = 0.;
+ }
+ if(nent[i][1] > 3)
+ {
+ table[i][2] = acval[i][2]/nent[i][1]; // recording everything in microns
+ table[i][3] = Math.sqrt(acval[i][3]/nent[i][1] - table[i][2]*table[i][2]);
+ }
+ if((nent[i][1] < 3) && (i>0))
+ {
+ table[i][2] = table[i-1][2];
+ table[i][3] = table[i-1][3];
+ }
+ if((nent[i][0] < 3) && (i==0))
+ {
+ table[i][2] = 0.;
+ table[i][3] = 0.;
+ }
+ if(nent[i][2] > 3)
+ {
+ table[i][4] = acval[i][4]/nent[i][2]; // recording everything in microns
+ table[i][5] = Math.sqrt(acval[i][5]/nent[i][2] - table[i][4]*table[i][4]);
+ }
+ if((nent[i][2] < 3) && (i>0))
+ {
+ table[i][4] = table[i-1][4];
+ table[i][5] = table[i-1][5];
+ }
+ if((nent[i][0] < 3) && (i==0))
+ {
+ table[i][4] = 0.;
+ table[i][5] = 0.;
+ }
+ }
+ for(int i=0; i<ntbn; i++)
+ {
+ // convert everything into microns
+ table[i][0]*=(1000.*pszx);
+ table[i][1]*=(1000.*pszx);
+ table[i][2]*=(1000.*pszy);
+ table[i][3]*=(1000.*pszy);
+ table[i][4]*=(1000.*pszy);
+ table[i][5]*=(1000.*pszy);
+ }
+ saveCalibrationTableNew(fname);
+ }
public void calibrate(PixilatedSensor sensor, int stat, String fname)
{
+ if(!new_form) calibrateOld(sensor, stat, fname);
+ if(new_form) calibrateNew(sensor, stat, fname);
+ }
+
+ public void calibrateOld(PixilatedSensor sensor, int stat, String fname)
+ {
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();
+ pszx = sensor.getPixelConfiguration().getPixelSizeX();
+ pszy = sensor.getPixelConfiguration().getPixelSizeY();
double dz = 0.1;
boolean alongx = (sensor.getRowOrientation()==PixilatedSensor.RowOrientation.ALONGX);
int[][][] bcon = new int[ntlbns][ntabns][nnobns];
@@ -431,6 +704,59 @@
saveCalibrationTable(fname);
}
+
+ public void saveCalibrationTableNew(String fnam)
+ {
+ String cacheDir = System.getProperty("user.home");
+ File cachedir = new File(cacheDir);
+ if(cachedir == null)
+ {
+ System.out.println("CovMatrix is unable to find user home directory!");
+ }
+ else
+ {
+ File home = new File(cachedir,".cache");
+ File cache = new File(home,fnam);
+ try
+ {
+ cache.createNewFile();
+ FileWriter ofw = new FileWriter(cache);
+ ofw.write("// Measurement errors table \r\n");
+ Date date = new Date();
+ DateFormat daf = new SimpleDateFormat();
+ ofw.write("// Table was created: "+daf.format(date)+"\r\n");
+ ofw.write(" "+cal_stat+" "+ntbn+" "+rspbn+" "+cspbn+" "+nlab+" "+lath[0]+" "+lath[1]+" "+lath[2]+"\r\n");
+ ofw.write("\r\n");
+ ofw.write(df.format(pszx*1000.)+" , "+df.format(pszy*1000.)+" , "+df.format(epith));
+ ofw.write("\r\n");
+ for(int i=0; i<ntbn; i++)
+ {
+ ofw.write("\r\n");
+ for(int j=0; j<6; j++)
+ {
+ if(j!= 5) ofw.write(df.format(table[i][j])+", ");
+ else
+ {
+ ofw.write(df.format(table[i][j])+"\r\n");
+ }
+ }
+ }
+ ofw.write("\r\n");
+ ofw.flush();
+ ofw.close();
+ }
+ catch(IOException e)
+ {
+ System.out.println("IOException caught: "+e.getMessage());
+ }
+ finally
+ {
+ }
+ }
+ }
+
+
+
public void saveCalibrationTable(String fnam)
{
String cacheDir = System.getProperty("user.home");
@@ -508,9 +834,63 @@
}
}
-
public double[] calculateErrors(PixCluster pcl, PixilatedSensor sensor)
{
+ if(!new_form) return calculateErrorsOld(pcl,sensor);
+ return calculateErrorsNew(pcl,sensor);
+ }
+
+ public double[] calculateErrorsNew(PixCluster pcl, PixilatedSensor sensor)
+ {
+ IDetectorElement dele = sensor.getParent();
+ double clcr = pcl.getCenterRow();
+ double clcc = pcl.getCenterColumn();
+// System.out.println("cluster center row: "+clcr+" column "+clcc);
+ double[] locc = sensor.toLocal(clcr,clcc);
+ Hep3Vector localc = new BasicHep3Vector(locc[0],locc[1],locc[2]);
+ Hep3Vector glc = sensor.localToGlobal().transformed(localc);
+ Hep3Vector locscnt = new BasicHep3Vector(0.,0.,0.);
+ Hep3Vector locsplx = new BasicHep3Vector(1.,0.,0.);
+ Hep3Vector glscnt = sensor.localToGlobal().transformed(locscnt); // sensor center position in global cs
+ Hep3Vector glsplx = sensor.localToGlobal().transformed(locsplx);
+ double scr = Math.sqrt(glscnt.x()*glscnt.x()+glscnt.y()*glscnt.y());
+ double htr = Math.sqrt(glc.x()*glc.x()+glc.y()*glc.y());
+ double htz = glc.z();
+ double tl = Math.abs(htz)/htr;
+// double tlfct = 1. + 0.06*(tl-0.9)*(tl-0.9);
+ double tlfct = 1.;
+ if(tl < 1.) tlfct = 1.2-0.2*tl;
+ double pszxu = pszx*1000.;
+ double pszyu = pszy*1000.;
+ int cth = sensor.getClusterThreshold();
+ double ampcc = 100. * cth;
+ int camp = pcl.getTotalAmp();
+ int rspan = pcl.getRowSpan();
+ if(rspan > rspbn) rspan=rspbn;
+ int cspan = pcl.getColSpan();
+ if(cspan > cspbn) cspan=cspbn;
+ int tbin = nlab + (rspan-1)*cspbn+cspan-1;
+ double afct = 1.3*ampcc/((double) camp + ampcc);
+ if(nlab==3)
+ {
+ if(camp < lath[2]) tbin = 2;
+ if(camp < lath[1]) tbin = 1;
+ if(camp < lath[0]) tbin = 0;
+ }
+ double[] ere = new double[4];
+ ere[0]=table[tbin][0]/pszxu;
+ ere[1]=afct*table[tbin][1]/pszxu;
+ if(htz < 0.) { ere[2]=table[tbin][2]/pszyu; ere[3]=tlfct*table[tbin][3]/pszyu; }
+ if(htz >= 0.)
+ {
+ ere[2]=-table[tbin][4]/pszyu;
+ ere[3]=tlfct*table[tbin][5]/pszyu;
+ }
+ return ere;
+ }
+
+ public double[] calculateErrorsOld(PixCluster pcl, PixilatedSensor sensor)
+ {
IDetectorElement dele = sensor.getParent();
double nfstps = (nfactmax-nfactmin)/(nnobns-1);
double tls = (tlma-tlmi)/(ntlbns-1);
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.2 -r1.3
--- FastAnalogElectronics.java 8 Mar 2011 19:16:01 -0000 1.2
+++ FastAnalogElectronics.java 23 Sep 2011 18:39:06 -0000 1.3
@@ -228,7 +228,7 @@
tf = strtri + j*dtf;
if(buf<n_buffers)
{
- int tstm = (int) Math.floor(tf/clock_period);
+ int tstm = (int) Math.floor(tf/clock_period + 0.001);
tstmps[buf]=tstm;
fri[buf] = ari;
buf++;
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.2 -r1.3
--- PixCluster.java 29 Dec 2010 22:29:37 -0000 1.2
+++ PixCluster.java 23 Sep 2011 18:39:06 -0000 1.3
@@ -7,7 +7,7 @@
* in the pixilated sensor
*
* @author Nick Sinev
- * @version $Id: PixCluster.java,v 1.2 2010/12/29 22:29:37 sinev Exp $
+ * @version $Id: PixCluster.java,v 1.3 2011/09/23 18:39:06 sinev Exp $
*/
public class PixCluster
@@ -17,6 +17,8 @@
IPixilatedSensor sensor = null;
double cent_row = 0.;
double cent_col = 0.;
+ int rowspan = 1;
+ int colspan = 1;
public enum CenterMethod {GRAVITYCENTER, LIMITEDCENTER, TABULATED};
CenterMethod method = CenterMethod.GRAVITYCENTER;
@@ -39,6 +41,10 @@
public void findCenter()
{
+ int minr = 100000;
+ int maxr = -100000;
+ int minc = 100000;
+ int maxc = -100000;
if(method == CenterMethod.GRAVITYCENTER)
{
double cr = 0.;
@@ -49,14 +55,20 @@
for(RawTrackerHit hit:hits)
{
long cellID = hit.getCellID();
- double r = (double) sensor.getRow(cellID);
- double c = (double) sensor.getColumn(cellID);
+ int r = sensor.getRow(cellID);
+ int c = sensor.getColumn(cellID);
double w = (double) (hit.getADCValues()[0]);
// System.out.println("Raw hit: row "+r+" col "+c+" ampl "+w);
- cr+=r*w;
- cc+=c*w;
+ if(r<minr) minr=r;
+ if(r>maxr) maxr=r;
+ if(c<minc) minc=c;
+ if(c>maxc) maxc=c;
+ cr+=(double) r * w;
+ cc+=(double) c * w;
sw+=w;
- }
+ }
+ rowspan=maxr-minr+1;
+ colspan=maxc-minc+1;
cr/=sw;
cc/=sw;
cent_row = cr;
@@ -75,6 +87,10 @@
return amp;
}
+ public int getRowSpan() { return rowspan; }
+
+ public int getColSpan() { return colspan; }
+
public int getMinTimeStamp()
{
int mts = 0;
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.6 -r1.7
--- PixilatedSensor.java 8 Mar 2011 19:16:01 -0000 1.6
+++ PixilatedSensor.java 23 Sep 2011 18:39:06 -0000 1.7
@@ -20,12 +20,16 @@
*
*/
boolean debug = false;
+ boolean doHist = true;
public boolean ddebug = false;
int clust_thresh = 8;
int t_window = 1;
+ int ctr_nbins = 200;
+ double ctr_int = 4.0E-7;
private boolean use_fixed_resol = false;
private double res_pfrx = 0.3;
- private double res_pfry = 0.3;
+ private double res_pfry = 0.3;
+ boolean init_done = false;
static PixSimConstants cons = PixSimConstants.instance();
static final double oneovsqrt12 = 0.2886751;
public static final double bunch_period = cons.BunchInterval;
@@ -36,7 +40,7 @@
private List<PixCluster> clusters = new ArrayList<PixCluster>();
private IPixelConfiguration pixel_configuration = new PixelConfiguration();
private CarrierPropagator _cpr = new CarrierPropagator();
- private TrackSegmentSimulation _tss = new TrackSegmentSimulation();
+ private TrackSegmentSimulation _tss = null;
private IPixelSensorElectronics electronics = null;
private IReadout readout = null;
private ErrorEstimate covm = null;
@@ -150,19 +154,26 @@
public void setErrorEstimate(ErrorEstimate es) { covm = es; }
+ public void setDoHist(boolean yes) { doHist=yes; }
+
public IPixelSensorElectronics getElectronics() { return electronics; }
public List<PixCluster> getClusters() { return clusters; }
public void calibrateErrorEstimate(int stat,String fname)
{
- covm.calibrate(this,stat,fname);
+ if(covm.isNew()) covm.calibrateNew(this,stat,fname);
+ if(!covm.isNew()) covm.calibrate(this,stat,fname);
}
public void useFixedResolution(boolean yes) { use_fixed_resol=yes; }
public void setFixedResolution(double rfrx, double rfry) { res_pfrx= rfrx; res_pfry=rfry; }
+ public void setCtrMaxTime(double tim) { ctr_int = tim; }
+
+ public void setCtrNBins(int nb) { ctr_nbins = nb; }
+
private void setBoundaries()
{
ITransform3D glocal = null;
@@ -289,6 +300,13 @@
simhits.clear();
rawhits.clear();
clusters.clear();
+ if(!init_done)
+ {
+ _tss.setNumberOfBins(ctr_nbins);
+ _tss.setTimeBin(ctr_int/ctr_nbins);
+// System.out.println("setting time bin in tss: "+ctr_int/ctr_nbins+" for "+ctr_nbins+" bins");
+ init_done=true;
+ }
}
void clearReadout()
@@ -531,6 +549,20 @@
System.out.println("Pixel of segment start: row "+crow+" column "+ccol);
System.out.println("in pixel coord.syst: sp: "+sp.x()+" "+sp.y()+" "+sp.z()+" ep: "+ep.x()+" "+ep.y()+" "+ep.z());
}
+ if(doHist)
+ {
+ double xpr = seg_end.x()-seg_strt.x();
+ double ypr = seg_end.y()-seg_strt.y();
+ double zpr = seg_end.z()-seg_strt.z();
+ double stlam = ypr/zpr;
+ double stalp = xpr/zpr;
+ if(Math.abs(stlam) < 5.) aida.cloud1D("Tangent lambda in sensor CS distribution").fill(stlam);
+ if(Math.abs(stalp) < 0.5)
+ {
+ aida.cloud1D("Tangent alpha in sensor CS distribution").fill(stalp);
+ aida.cloud2D("Tan alpha vs x in sensor CS").fill((seg_strt.x()+seg_end.x())/2.,stalp);
+ }
+ }
_tss.clear();
_tss.simulateSegment(sp,ep,bc);
List<ChargeTrain> ctl = _tss.getChargeTrains();
@@ -665,28 +697,97 @@
double iclcc = (int) Math.floor(clcc);
double[] locc = toLocal(clcr,clcc);
Hep3Vector lposnc = new BasicHep3Vector(locc[0],locc[1],locc[2]);
- Hep3Vector lpos = VecOp.add(lposnc,Lorentz_corr);
- Hep3Vector glpos = global.transformed(lpos);
- double[] pos = new double[3];
- pos[0]=glpos.x();
- pos[1]=glpos.y();
- pos[2]=glpos.z();
+ Hep3Vector glnc = global.transformed(lposnc);
+
+ int minr=100000;
+ int maxr=-1;
+ int minc=100000;
+ int maxc =-1;
+ int rspn = 1;
+ int cspn = 1;
+ int tcam = 0;
+ List<RawTrackerHit> hits = pcl.getHits();
+ List<RawTrackerHit> rrhts = new ArrayList<RawTrackerHit>();
+
+ // I need to replace my private cellID, which i carjacked in RawTrackerHit for my own needs
+ // with standard one. I also want to add row and column number to RowTrackerHit adc array, as it is no longer
+ // can be extracted from CellID
+
+ for(RawTrackerHit rht:hits)
+ {
+ long ceid = 0;
+ if(parent != null) ceid = parent.getIdentifier().getValue();
+ List<SimTrackerHit> sth = rht.getSimTrackerHits();
+ short[] adv = rht.getADCValues();
+ short[] eadv = new short[5];
+ eadv[0]=adv[0];
+ eadv[1]=adv[1];
+ eadv[2]=adv[2];
+ eadv[3]=getRow(rht.getCellID());
+ eadv[4]=getColumn(rht.getCellID());
+ int tm = rht.getTime();
+ tcam+=eadv[0];
+ RawTrackerHit nrht = new BaseRawTrackerHit(tm,ceid,eadv,sth,parent);
+ rrhts.add(nrht);
+ }
+ double[] shpcor = new double[3];
+ shpcor[0]=0.;
+ shpcor[1]=0.;
+ shpcor[2]=0.;
double xx = res_pfrx * pszx * res_pfrx * pszx;
double yy = res_pfry * pszy * res_pfry * pszy;
if(!use_fixed_resol)
{
- double[] er = covm.calculateErrors(pcl,this);
- if(row_orient == RowOrientation.ALONGX)
+ if(!covm.isNew())
{
- xx=er[0]*(pszx*pszx);
- yy=er[1]*(pszy*pszy);
+ double[] er = covm.calculateErrors(pcl,this);
+ if(row_orient == RowOrientation.ALONGX)
+ {
+ xx=er[0]*(pszx*pszx);
+ yy=er[1]*(pszy*pszy);
+ }
+ if(row_orient == RowOrientation.ALONGY)
+ {
+ yy=er[0]*(pszy*pszy);
+ xx=er[1]*(pszx*pszx);
+ }
}
- if(row_orient == RowOrientation.ALONGY)
+ if(covm.isNew())
{
- yy=er[0]*(pszy*pszy);
- xx=er[1]*(pszx*pszx);
+ double[] er = covm.calculateErrors(pcl,this);
+ if(row_orient == RowOrientation.ALONGX)
+ {
+ xx=er[1]*er[1]*pszx*pszx;
+ yy=er[3]*er[3]*pszy*pszy;
+ shpcor[0]=er[0]*pszx;
+ shpcor[1]=er[2]*pszy;
+ }
+ if(row_orient == RowOrientation.ALONGY)
+ {
+ yy=er[1]*er[1]*pszy*pszy;
+ xx=er[3]*er[3]*pszx*pszx;
+ shpcor[0]=er[2]*pszy;
+ shpcor[1]=er[0]*pszx;
+ }
+
}
}
+ Hep3Vector shpcv = new BasicHep3Vector(shpcor[0],shpcor[1],shpcor[2]);
+ Hep3Vector lpos0 = VecOp.add(lposnc,Lorentz_corr);
+ Hep3Vector lpos = VecOp.add(lpos0,shpcv);
+ Hep3Vector glpos = global.transformed(lpos);
+ double[] pos = new double[3];
+ pos[0]=glpos.x();
+ pos[1]=glpos.y();
+ pos[2]=glpos.z();
+/* if(pos[2] >= 0.)
+ {
+ System.out.println("Got z correction for positive Z: "+shpcor[1]*1000.);
+ System.out.println("Uncorrected local hit coord: "+locc[0]*1000.+" "+locc[1]*1000.+" "+locc[2]*1000.);
+ System.out.println("Corrected: "+lpos.x()*1000.+" "+lpos.y()*1000.+" "+lpos.z()*1000.);
+ System.out.println("Global uncorrected: "+glnc.x()+" "+glnc.y()+" "+glnc.z());
+ System.out.println("Global corrected: "+pos[0]+" "+pos[1]+" "+pos[2]);
+ } */
SymmetricMatrix cm = new SymmetricMatrix(3);
cm.setElement(0,0,xx);
cm.setElement(1,1,yy);
@@ -695,9 +796,8 @@
double[] packed = rcm.asPackedArray(true);
double t=0.;
double e=0.;
- List<RawTrackerHit> hits = pcl.getHits();
TrackerHit th = new BaseTrackerHit(pos,packed,t,e,0);
- ((BaseTrackerHit) th).addRawTrackerHits(hits);
+ ((BaseTrackerHit) th).addRawTrackerHits(rrhts);
if(readout != null) readout.addHit(th);
nthits++;
}
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.10 -r1.11
--- PixilatedSensorManager.java 8 Mar 2011 23:09:26 -0000 1.10
+++ PixilatedSensorManager.java 23 Sep 2011 18:39:06 -0000 1.11
@@ -23,12 +23,14 @@
* for each event (only sensors which have hits in them are created)
*
* @author Nick Sinev
- * @version $Id: PixilatedSensorManager.java,v 1.10 2011/03/08 23:09:26 sinev Exp $
+ * @version $Id: PixilatedSensorManager.java,v 1.11 2011/09/23 18:39:06 sinev Exp $
*/
public class PixilatedSensorManager extends Driver
{
- private static int dbg_lvl = 0;
+ private static int dbg_lvl = 1;
+ private static int ctr_nbins = 200;
+ private static double ctr_dur = 4.0E-7;
private static boolean doHist = true;
boolean cal_res_bar = false;
boolean cal_res_ec = false;
@@ -39,6 +41,8 @@
boolean digital = false;
boolean fixed_res_barr = false;
boolean fixed_res_ec = false;
+ boolean new_err_est_bar = false;
+ boolean new_err_est_ec = false;
double fr_resx_barr = 0.3;
double fr_resy_barr = 0.3;
double fr_resx_ec = 0.3;
@@ -99,7 +103,10 @@
private static String rtab_name_bar = null;
private static String rtab_name_ec_pl = null;
private static String rtab_name_ec_mi = null;
-
+ private static String efield_map_file = null;
+ private static BasicHep3Vector B = new BasicHep3Vector(0.,5.,0.);
+ private static NamedFieldMap Bfield = new UniformFieldMap(B);
+ private static TCADFieldMap tc_fm = null;
// working objects for 3 sensor positions
static List<IDetectorElement> vxbrels = new ArrayList<IDetectorElement>();
@@ -213,6 +220,19 @@
"chronopix_16x16x12hr_B5_res_barr.dat"
};
+ private static String[] opt_rtab_name_bar_n =
+ {"CCD_20x20x20_B5_res_bar_new.dat",
+ "Chronopix_20x20x20_hr_B5_res_bar_new.dat",
+ "CPCCD_20x20x20_B5_res_bar_new.dat",
+ "Chronopix_20x20x16_hr_B5_res_bar.dat",
+ "ShortColCCD_20x20x20_B5_res_bar_new.dat",
+ "Chronopix_12x12x20hr_B5_res_bar_new.dat",
+ "Chronopix_16x16x20hr_B5_res_bar_new.dat",
+ "Chronopix_8x8x12hr_B5_res_bar_new.dat",
+ "Chronopix_12x12x12hr_B5_res_barr_new.dat",
+ "chronopix_16x16x12hr_B5_res_barr_new.dat"
+ };
+
private static String[] opt_rtab_name_ec_pl=
{"CCD_20x20x20_B5_res_ec.dat",
"Chronopix_20x20x20_hr_B5_res_EC.dat",
@@ -226,9 +246,22 @@
"chronopix_16x16x12hr_B5_res_EC.dat"
};
+ private static String[] opt_rtab_name_ec_pl_n=
+ {"CCD_20x20x20_B5_res_ec_new.dat",
+ "Chronopix_20x20x20_hr_B5_res_EC_new.dat",
+ "CPCCD_20x20x20_B5_res_EC_new.dat",
+ "Chronopix_20x20x16_hr_B5_res_EC_new.dat",
+ "ShortColCCD_20x20x20_B5_res_EC_new.dat",
+ "Chronopix_12x12x20hr_B5_res_EC_new.dat",
+ "Chronopix_16x16x20hr_B5_res_EC_new.dat",
+ "Chronopix_8x8x12hr_B5_res_EC_new.dat",
+ "Chronopix_12x12x12hr_B5_res_EC_new.dat",
+ "chronopix_16x16x12hr_B5_res_EC_new.dat"
+ };
+
private static String[] opt_rtab_name_ec_mi =
{"CCD_20x20x20_B5_res_ec.dat",
- "Chronopix_20x20x20_B5_res_EC.dat",
+ "Chronopix_20x20x20_hr_B5_res_EC.dat",
"CPCCD_20x20x20_B5_res_EC.dat",
"Chronopix_20x20x16_hr_B5_res_EC.dat",
"ShortColCCD_20x20x20_B5_res_EC.dat",
@@ -236,10 +269,22 @@
"Chronopix_16x16x20hr_B5_res_EC.dat",
"Chronopix_8x8x12hr_B5_res_EC.dat",
"Chronopix_12x12x12hr_B5_res_EC.dat",
- "chronopix_16x16x12hr_B5_res_EC.dat",
- "mimosa18_B5_res_EC.dat"
+ "chronopix_16x16x12hr_B5_res_EC.dat"
};
+ private static String[] opt_rtab_name_ec_mi_n=
+ {"CCD_20x20x20_B5_res_ec_new.dat",
+ "Chronopix_20x20x20_hr_B5_res_EC_new.dat",
+ "CPCCD_20x20x20_B5_res_EC_new.dat",
+ "Chronopix_20x20x16_hr_B5_res_EC_new.dat",
+ "ShortColCCD_20x20x20_B5_res_EC_new.dat",
+ "Chronopix_12x12x20hr_B5_res_EC_new.dat",
+ "Chronopix_16x16x20hr_B5_res_EC_new.dat",
+ "Chronopix_8x8x12hr_B5_res_EC_new.dat",
+ "Chronopix_12x12x12hr_B5_res_EC_new.dat",
+ "chronopix_16x16x12hr_B5_res_EC_new.dat"
+ };
+
@@ -329,7 +374,28 @@
chdep=chd;
}
- public void setDebugLevel(int level) { dbg_lvl=level; }
+ public void setDebugLevel(int level) { dbg_lvl=level; System.out.println("Setting debug level to "+dbg_lvl);}
+
+ public void setEFieldFileName( String name ) { efield_map_file= name; }
+
+ public void useNewErrorEstim(boolean byes, boolean ecyes)
+ {
+ if(byes) rtab_name_bar = opt_rtab_name_bar_n[option];
+ if(!byes) rtab_name_bar = opt_rtab_name_bar[option];
+ if(ecyes)
+ {
+ rtab_name_ec_pl = opt_rtab_name_ec_pl_n[option];
+ rtab_name_ec_mi = opt_rtab_name_ec_mi_n[option];
+ }
+ if(!ecyes)
+ {
+ rtab_name_ec_pl = opt_rtab_name_ec_pl[option];
+ rtab_name_ec_mi = opt_rtab_name_ec_mi[option];
+ }
+ eeb.setNewTableForm(byes);
+ eeep.setNewTableForm(ecyes);
+ eeem.setNewTableForm(ecyes);
+ }
public void useFixedResolution(boolean yes) { fixed_res_barr = yes; fixed_res_ec = yes; }
@@ -404,6 +470,11 @@
public void setLogfile(String name) { logfile_nam=name; }
+ public void setCtrNBins(int nb) { ctr_nbins = nb; System.out.println("Number CTR bins is set to "+ctr_nbins); }
+
+ public void setCtrDuration(double dur) { ctr_dur = dur; }
+
+
public void setLorentzCorrection(Hep3Vector cvb, Hep3Vector cvep, Hep3Vector cvem)
{
if(cvb != null ) Lor_corr_b.setV(cvb.x(),cvb.y(),cvb.z());
@@ -630,6 +701,34 @@
private void setup()
{
+ if(!use_prop_tab_barrel)
+ {
+ Medium bulk=new Silicon();
+ if(efield_map_file == null) throw new RuntimeException("File name for e field is not defined");
+ tc_fm= new TCADFieldMap(efield_map_file);
+ double[] flims = tc_fm.getMapLimits();
+ double pszx = flims[1]-flims[0];
+ double pszy = flims[3]-flims[2];
+ double pszz = flims[5]-flims[4];
+ System.out.println("Field limits: X"+flims[0]+" "+flims[1]+" Y: "+flims[2]+" "+flims[3]+" Z: "+flims[4]+" "+flims[5]);
+ List<SensorRegion> collectors = new ArrayList<SensorRegion>();
+ List<SensorRegion> absorbers = new ArrayList<SensorRegion>();
+ List<SensorRegion> reflectors = new ArrayList<SensorRegion>();
+ SensorRegion ce = new SensorRegion();
+ ce.setBox(0.,0.,0.,0.004,0.004,0.002);
+ collectors.add(ce);
+ SensorRegion refl = new SensorRegion();
+ refl.setBoxLimits(flims[0],flims[1],flims[2],flims[3],flims[5]-0.002,flims[5]+0.002);
+ reflectors.add(refl);
+ SensorRegion ab = new SensorRegion();
+ ab.setBoxLimits(flims[0],flims[1],flims[2],flims[3],-0.001,0.0001);
+ absorbers.add(ab);
+ bpcf = new PixelConfiguration("Barrel_pcf",bulk,tc_fm,Bfield,pszx,pszy,pszz);
+ bpcf = new PixelConfiguration();
+ bpcf.setCollectors(collectors);
+ bpcf.setAbsorbers(absorbers);
+ bpcf.setReflectors(reflectors);
+ }
if(option == 0)
{
IPixelSensorElectronics el = new CCDElectronics();
@@ -644,7 +743,10 @@
bar_el = el;
ecp_el = el;
ecm_el = el;
- bpcf = new PixelConfiguration();
+ if(bpcf==null)
+ {
+ bpcf = new PixelConfiguration();
+ }
bcpr = new CarrierPropagator(bpcf);
ecppr = new CarrierPropagator(bpcf);
ecmpr = ecppr;
@@ -654,30 +756,59 @@
{
if(!digital)
{
- bar_el = new CCDElectronics();
- bar_el.setADCScale(adc_scale_bar);
- bar_el.setNoiseLevel(enoise);
- bar_el.setADCSaturation(adc_satur_bar);
- bar_el.setPixelThreshold(pixel_thr_barr);
- bar_el.includeElectronicNoiseHits(incl_el_noise);
- if(bc_per_cl != 0) bar_el.setBunchesPerClock(bc_per_cl);
- else bar_el.setClocksPerBunch(cl_per_bc);
- bar_el.useCorrelatedDoubleSampling(false);
- if((pixel_thr_barr==pixel_thr_ec) && (Math.abs(adc_scale_bar-adc_scale_ec) < 0.01))
+ if(ilcopt != IlcOption.CLIC)
{
- ecp_el = bar_el;
- ecm_el = bar_el;
+ bar_el = new CCDElectronics();
+ bar_el.setADCScale(adc_scale_bar);
+ bar_el.setNoiseLevel(enoise);
+ bar_el.setADCSaturation(adc_satur_bar);
+ bar_el.setPixelThreshold(pixel_thr_barr);
+ bar_el.includeElectronicNoiseHits(incl_el_noise);
+ if(bc_per_cl != 0) bar_el.setBunchesPerClock(bc_per_cl);
+ else bar_el.setClocksPerBunch(cl_per_bc);
+ bar_el.useCorrelatedDoubleSampling(false);
+ if((pixel_thr_barr==pixel_thr_ec) && (Math.abs(adc_scale_bar-adc_scale_ec) < 0.01))
+ {
+ ecp_el = bar_el;
+ ecm_el = bar_el;
+ }
+ else
+ {
+ ecp_el = new CCDElectronics();
+ ecp_el.setADCScale(adc_scale_ec);
+ ecp_el.setPixelThreshold(pixel_thr_ec);
+ ecp_el.includeElectronicNoiseHits(incl_el_noise);
+ ecm_el=ecp_el;
+ }
+// opt_Lor_corr_b_x[option]=0.00556;
}
- else
+ else //CLIC with analog electronics
{
- ecp_el = new CCDElectronics();
- ecp_el.setADCScale(adc_scale_ec);
- ecp_el.setPixelThreshold(pixel_thr_ec);
- ecp_el.includeElectronicNoiseHits(incl_el_noise);
- ecm_el=ecp_el;
+ bar_el = new FastAnalogElectronics(ilcopt);
+ bar_el.setADCScale(adc_scale_bar);
+ bar_el.setNoiseLevel(enoise);
+ bar_el.setADCSaturation(adc_satur_bar);
+ bar_el.setPixelThreshold(pixel_thr_barr);
+ bar_el.includeElectronicNoiseHits(incl_el_noise);
+ if(bc_per_cl != 0) bar_el.setBunchesPerClock(bc_per_cl);
+ else bar_el.setClocksPerBunch(cl_per_bc);
+ bar_el.useCorrelatedDoubleSampling(false);
+ if((pixel_thr_barr==pixel_thr_ec) && (Math.abs(adc_scale_bar-adc_scale_ec) < 0.01))
+ {
+ ecp_el = bar_el;
+ ecm_el = bar_el;
+ }
+ else
+ {
+ ecp_el = new FastAnalogElectronics(ilcopt);
+ ecp_el.setADCScale(adc_scale_ec);
+ ecp_el.setPixelThreshold(pixel_thr_ec);
+ ecp_el.includeElectronicNoiseHits(incl_el_noise);
+ ecm_el=ecp_el;
+ }
+
}
-// opt_Lor_corr_b_x[option]=0.00556;
- }
+ }
if(digital)
{
bar_el = new ChronoPixelElectronics(ilcopt);
@@ -753,8 +884,10 @@
ecm_el=bar_el;
cluster_thr_barr=1;
cluster_thr_ec=1;
- }
- bpcf = new PixelConfiguration(pixdx,pixdy,pixdz);
+ }
+ if(bpcf==null)
+ {
+ bpcf = new PixelConfiguration(pixdx,pixdy,pixdz);
List<SensorRegion> collectors = new ArrayList<SensorRegion>();
List<SensorRegion> absorbers = new ArrayList<SensorRegion>();
List<SensorRegion> reflectors = new ArrayList<SensorRegion>();
@@ -770,7 +903,7 @@
bpcf.setCollectors(collectors);
bpcf.setAbsorbers(absorbers);
bpcf.setReflectors(reflectors);
-
+ }
bcpr = new CarrierPropagator(bpcf);
eppcf = new PixelConfiguration();
ecppr = new CarrierPropagator(eppcf);
@@ -779,6 +912,7 @@
}
if(option > 3) System.out.println("This sensor option is not implemented yet! ");
+ System.out.println("Completed sensors setup after all user input modifications");
}
private void setOptionVariables()
@@ -828,13 +962,18 @@
bc_per_cl = opt_bc_per_cl_c[option];
cl_per_bc = opt_cl_per_bc_c[option];
time_window = opt_tw_c[option];
- }
+ }
+ eeb.setNewTableForm(new_err_est_bar);
+ eeep.setNewTableForm(new_err_est_ec);
+ eeem.setNewTableForm(new_err_est_ec);
+ System.out.println("Set all variables according to sensor and ILC options");
}
// driver process function
public void process(EventHeader event)
{
+ super.process(event);
int tabfld=-1;
Detector cdet=event.getDetector();
if(cdet!=det)
@@ -849,17 +988,27 @@
vxbrels.clear();
vxecpels.clear();
vxecmels.clear();
+ if(dbg_lvl > 0)
+ {
+ System.out.println("First event! Doing all settings");
+ }
if(use_prop_tab_barrel)
{
+ if(dbg_lvl > 0) System.out.println("Barrel propagator is using table");
if(prop_tab_barrel_local)
{
- if(bcpr.useTable(bar_prop_tname))
- if(dbg_lvl > 0) System.out.println("Using table for barrel sensor carrier propagator");
+ if(dbg_lvl > 0) System.out.println("Want to use local table: "+ bar_prop_tname);
+ if(bcpr.useTable(bar_prop_tname))
+ {
+ if(dbg_lvl > 0) System.out.println("Red local table for barrel sensor carrier propagator");
+ else{}
+ }
+ else{ System.out.println("Barrel propagator could not read table!");}
}
- else
+ if(!prop_tab_barrel_local)
{
if(bcpr.useTable(bar_prop_tname,det))
- if(dbg_lvl > 0) System.out.println("Using table for barrel sensor carrier propagator");
+ if(dbg_lvl > 0) System.out.println("Using detector resource table for barrel sensor carrier propagator");
}
tabfld = extractFieldFromName(bar_prop_tname);
double[] pos = {0,0,0};
@@ -880,12 +1029,12 @@
if(prop_tab_ec_pl_local)
{
if(ecppr.useTable(ec_pl_prop_tname))
- if(dbg_lvl > 0) System.out.println("Using table for ec pl sensor carrier propagator");
+ if(dbg_lvl > 0) System.out.println("Using local table for ec pl sensor carrier propagator");
}
else
{
if(ecppr.useTable(ec_pl_prop_tname,det))
- if(dbg_lvl > 0) System.out.println("Using table for ec pl sensor carrier propagator");
+ if(dbg_lvl > 0) System.out.println("Using detector resource table for ec pl sensor carrier propagator");
}
}
}
@@ -897,12 +1046,12 @@
if(prop_tab_ec_mi_local)
{
if(ecmpr.useTable(ec_mi_prop_tname))
- if(dbg_lvl > 0) System.out.println("Using table for ec mi sensor carrier propagator");
+ if(dbg_lvl > 0) System.out.println("Using local table for ec mi sensor carrier propagator");
}
else
{
if(ecmpr.useTable(ec_mi_prop_tname,det))
- if(dbg_lvl > 0) System.out.println("Using table for ec mi sensor carrier propagator");
+ if(dbg_lvl > 0) System.out.println("Using detector resource table for ec mi sensor carrier propagator");
}
}
}
@@ -1004,13 +1153,18 @@
for(IDetectorElement de:vxbrels)
{
PixilatedSensor pse = new PixilatedSensor(de,bcpr,false);
+// if(dbg_lvl > 0) System.out.println("DE name: "+de.getName());
+ if(de.getName().indexOf("layer5") != -1) pse.setDoHist(true); else pse.setDoHist(false);
pse.setElectronics(bar_el);
pse.useFixedResolution(fixed_res_barr);
if(fixed_res_barr) pse.setFixedResolution(fr_resx_barr,fr_resy_barr);
pse.setErrorEstimate(eeb);
pse.setClusterThreshold(cluster_thr_barr);
pse.setTimeWindow(time_window);
- pse.setLorentzCorrection(Lor_corr_b);
+ pse.setLorentzCorrection(Lor_corr_b);
+ pse.setCtrMaxTime(ctr_dur);
+ pse.setCtrNBins(ctr_nbins);
+// System.out.println("Set "+ctr_nbins+" ctr bins in barrel sensor");
if(nbe==0 && cal_res_bar && !fixed_res_barr)
{
eeb.setTableParameters(11,11,11,0.,1.5,0.,1.5,1.5,6.5);
@@ -1035,6 +1189,8 @@
pse.setClusterThreshold(cluster_thr_ec);
pse.setTimeWindow(time_window);
pse.setLorentzCorrection(Lor_corr_ep);
+ pse.setCtrMaxTime(ctr_dur);
+ pse.setCtrNBins(ctr_nbins);
if(nbc==0 && cal_res_ec && !fixed_res_ec)
{
eeep.setTableParameters(11,11,11,0.,1.5,0.,1.5,1.5,6.5);
@@ -1060,6 +1216,8 @@
pse.setClusterThreshold(cluster_thr_ec);
pse.setTimeWindow(time_window);
pse.setLorentzCorrection(Lor_corr_em);
+ pse.setCtrMaxTime(ctr_dur);
+ pse.setCtrNBins(ctr_nbins);
if(!ec_pl_ec_mi_same_prop)
{
if(!read_rest_ec)
@@ -1133,7 +1291,16 @@
for(IDetectorElement vtxp:vxbrels)
{
IDetectorElement de = vtxp.findDetectorElement(vhitp);
- if(de != null) hitde=de;
+ if(de != null)
+ {
+ hitde=de;
+ if(dbg_lvl > 1)
+ {
+ IIdentifierHelper helper = de.getIdentifierHelper();
+ int lrn = helper.getValue(de.getIdentifier(), "layer");
+ System.out.println("hit in layer "+lrn+" belongs to de "+de.getName());
+ }
+ }
}
if(hitde == null)
{
@@ -1155,7 +1322,11 @@
if((psen.getParent() !=null) && (psen.getParent() == hitde))
{
psen.addSimPixelHit(spht);
- if(dbg_lvl > 1) System.out.println("Added SimPixelHit to "+hitde.getName());
+ if(dbg_lvl > 1)
+ {
+ System.out.println("Added SimPixelHit to "+hitde.getName());
+ System.out.println("This hit has layer number "+spht.getLayer());
+ }
foundmatch = true;
}
}
@@ -1411,8 +1582,8 @@
event.put("RecVtxBarrHits",ebhits,TrackerHit.class,0);
if(dbg_lvl > 1) System.out.println("Adding "+eehits.size()+" hits to RecVtxEndcapHits collection");
event.put("RecVtxEndcapHits",eehits,TrackerHit.class,0);
-// event.put("RecVtxRawHits",rawhits,RawTrackerHit.class,(1 << LCIOConstants.RTHBIT_HITS));
- event.put("RecVtxRawHits",rawhits,RawTrackerHit.class,0);
+ event.put("RecVtxRawHits",rawhits,RawTrackerHit.class,(1 << LCIOConstants.TRAWBIT_ID1));
+// event.put("RecVtxRawHits",rawhits,RawTrackerHit.class,0);
if(doHist)
{
int nrechits = 0;
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.3 -r1.4
--- SimPixelHit.java 24 Aug 2011 18:51:18 -0000 1.3
+++ SimPixelHit.java 23 Sep 2011 18:39:06 -0000 1.4
@@ -11,7 +11,7 @@
import org.lcsim.geometry.Subdetector;
/**
- * @version $Id: SimPixelHit.java,v 1.3 2011/08/24 18:51:18 jeremy Exp $
+ * @version $Id: SimPixelHit.java,v 1.4 2011/09/23 18:39:06 sinev Exp $
*/
public class SimPixelHit extends BaseHitWithPosition implements SimTrackerHit
@@ -20,6 +20,7 @@
SimHitParameters _param = null;
double _time = 0.;
public double _dedx = 0.;
+ int _layer = -1;
public SimPixelHit(SimTrackerHit parent)
{
@@ -35,6 +36,14 @@
_time=time;
}
+ public SimPixelHit(SimTrackerHit parent, double time, int lrn)
+ {
+ _parent=parent;
+ _dedx = parent.getdEdx();
+ _time=time;
+ _layer=lrn;
+ }
+
public SimPixelHit(SimHitParameters hpar, double time)
{
_parent = null;
@@ -42,11 +51,20 @@
_time = time;
}
+ public SimPixelHit(SimHitParameters hpar, double time, int lrn)
+ {
+ _parent = null;
+ _param = hpar;
+ _time = time;
+ _layer = lrn;
+ }
+
public SimTrackerHit getParent() { return _parent; }
/** Layer containing hit */
public int getLayer()
{
+ if(_layer != -1) return _layer;
if(_parent != null) return _parent.getLayer();
return 0;
}
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.3 -r1.4
--- TrackSegmentSimulation.java 8 Mar 2011 19:16:01 -0000 1.3
+++ TrackSegmentSimulation.java 23 Sep 2011 18:39:06 -0000 1.4
@@ -1,6 +1,7 @@
package org.lcsim.recon.vertexing.pixsim;
import java.util.*;
import hep.physics.vec.*;
+import org.lcsim.util.aida.AIDA;
/**
* CarrierPropagator.java
@@ -13,6 +14,7 @@
public class TrackSegmentSimulation
{
+ static boolean doHist=true;
static public double MAXDELTAE = 1.75E-5; // 17.5KeV corresponds to 5 micron range ....
static public double MINDELTAE = 1.0E-5; // 10KeV corresponds to 1.5 micron range
static double MAXDSTEP = 1.5E-3; // steps for delta-electron path
@@ -32,6 +34,8 @@
List<ChargeTrain> ctl = new ArrayList<ChargeTrain>();
short BC = 0;
int nbins = 200;
+ int totpairs = 0;
+ private static AIDA aida = AIDA.defaultInstance();
/**
*
@@ -63,10 +67,11 @@
{
BC=bc;
double clen = 0.;
- int pairs = 0;
TransportState result = new TransportState();
int bn = 0;
double tt = 0.;
+ int pairs = 0;
+ totpairs=0;
boolean newct = false;
ctl.clear();
startPoint.setV(startp.x(),startp.y(),startp.z());
@@ -92,6 +97,7 @@
delta= ( eloss> MINDELTAE);
nstps=1;
pairs=(int) (eloss/siLoss.GEVPERPAIR);
+ totpairs+=pairs;
ppstep=pairs;
plstp=ppstep;
delen=0.;
@@ -213,6 +219,8 @@
public List<ChargeTrain> getChargeTrains() { return ctl; }
+ public int getNGeneratedPairs() { return totpairs; }
+
public void clear() { ctl.clear(); }
}
\ No newline at end of file
CVSspam 0.2.8