Commit in hps-java/src/main/java/org/lcsim/hps/users/phansson on MAIN
trigRate.java+2-11.1 -> 1.2
TrigRateDriver.java+49-71.1 -> 1.2
ecalPlots.java+297-181.1 -> 1.2
ECalHitMapPlots.java+31-171.1 -> 1.2
MultScatAnalysis.java+196-1781.4 -> 1.5
+575-221
5 modified files
Local analysis updates.

hps-java/src/main/java/org/lcsim/hps/users/phansson
trigRate.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- trigRate.java	22 Jun 2012 22:57:31 -0000	1.1
+++ trigRate.java	12 Jul 2012 21:32:39 -0000	1.2
@@ -197,7 +197,8 @@
 
             //String path = "plots/20120615_trig_rate/";
             //String path = "plots/20120615_trig_rate_gainfix/";
-            String path = "plots/20120618_trig_rate_gainfix_noFirstRow/";
+            //String path = "plots/20120618_trig_rate_gainfix_noFirstRow/";
+            String path = "plots/20120618_trig_rate_gainfix/";
             //path = "";
             
             List<String> trees = new ArrayList<String>();

hps-java/src/main/java/org/lcsim/hps/users/phansson
TrigRateDriver.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- TrigRateDriver.java	21 Jun 2012 15:35:15 -0000	1.1
+++ TrigRateDriver.java	12 Jul 2012 21:32:39 -0000	1.2
@@ -45,15 +45,14 @@
     private static int crystalRows;
     private boolean hideFrame = true;
     
-    private String outputPlotFileName = "test.aida";
+    private String outputPlotFileName = "trigRate.aida";
     private String trackCollectionName = "MatchedTracks";
     private String ecalClusterCollectionName = "EcalClusters";
     
-
     
     EcalTrackMatch trkMatchTool;
     
-    private boolean doTracking = true;
+    private boolean doTracking = false;
     
     private AIDA aida = AIDA.defaultInstance();
     private IAnalysisFactory af = aida.analysisFactory();
@@ -62,6 +61,8 @@
     private AIDAFrame plotterFrameTrig;
     
     IPlotter plotter_trig_tag;
+    IHistogram1D clusterEnergy[][] = new IHistogram1D[47][11];
+    IHistogram2D meanClusterEnergy;
     
     private int trigger[] = {0,0};
 
@@ -166,6 +167,24 @@
 
         
         
+        for(int irow=-5;irow<=5;++irow) {
+            for(int icol=-23;icol<=23;++icol) {
+                clusterEnergy[icol+23][irow+5] = aida.histogram1D("Cluster energy x=" + icol + " y=" + irow, 50, 0,6000);  
+            }
+        }
+        
+        meanClusterEnergy = aida.histogram2D("Mean cluster energy", 47, -23, 23, 11, -5, 5);
+        
+        IPlotter plotter_clE = af.createPlotterFactory().create();
+        //plotter_clE.createRegions(2,6,0);
+        plotter_clE.setTitle("Cluster Energy");
+        plotter_clE.style().statisticsBoxStyle().setVisible(false);
+        plotter_clE.style().setParameter("hist2DStyle", "colorMap");
+        plotter_clE.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter_clE.currentRegion().plot(meanClusterEnergy);
+        
+        plotterFrame.addPlotter(plotter_clE);
+        
             
             
         if(!hideFrame) {
@@ -210,8 +229,10 @@
         if( debug ) {
             System.out.println("Processing event " + nevents);    
         }
-
         
+        if( refreshRate > 0 && nevents % refreshRate == 0 ) {
+            redraw();
+        }
         
         //fastTracking(event);
         
@@ -242,8 +263,10 @@
             
             
             boolean clusterGoodRegion = false;
-            if(crystalPair[0]<0 && crystalPair[1]>1) clusterGoodRegion = true;
-            if(crystalPair[0]<0 && crystalPair[1]<-1) clusterGoodRegion = true;
+            if(crystalPair[0]<0) clusterGoodRegion = true;
+            if(crystalPair[0]<0) clusterGoodRegion = true;
+//            if(crystalPair[0]<0 && crystalPair[1]>1) clusterGoodRegion = true;
+//            if(crystalPair[0]<0 && crystalPair[1]<-1) clusterGoodRegion = true;
             
             if(debug) {
                 if(crystalPair[1]<-1) {
@@ -252,6 +275,9 @@
             }
             
             
+            clusterEnergy[crystalPair[0]+23][crystalPair[1]+5].fill(cl.getEnergy());
+
+            
             double clEnergyCorr = cl.getEnergy()*C_ep;
             
             if(clusterGoodRegion) {
@@ -368,11 +394,27 @@
    
 
     
-    
+    private void redraw() {
+         meanClusterEnergy.reset();
+         for(int irow=-5;irow<=5;++irow) {
+            for(int icol=-23;icol<=23;++icol) {
+                if(clusterEnergy[icol+23][irow+5].entries()>5) {
+                    meanClusterEnergy.fill(icol,irow,clusterEnergy[icol+23][irow+5].mean());
+                }
+            }
+        }
+    }
         
     
     
     public void endOfData() {
+
+        redraw();
+        
+        
+        
+        
+        
         
         if (outputPlotFileName != "")
         try {

hps-java/src/main/java/org/lcsim/hps/users/phansson
ecalPlots.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ecalPlots.java	22 Jun 2012 22:57:31 -0000	1.1
+++ ecalPlots.java	12 Jul 2012 21:32:39 -0000	1.2
@@ -8,6 +8,11 @@
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.commons.cli.*;
 import org.lcsim.util.aida.AIDA;
 
 /**
@@ -31,6 +36,16 @@
         System.out.println("-----");
     }
     
+    
+    private static Options createCommandLineOptions() {
+        Options option = new Options();
+        option.addOption("s", false, "Save to file");
+        option.addOption("t", true, "Select the type of analysis to run");
+        return option;
+    }
+    
+    
+    
     /**
      * @param args the command line arguments
      */
@@ -39,10 +54,274 @@
         // TODO code application logic here
         
 
-        IAnalysisFactory analysisFactory = IAnalysisFactory.create();
+        IAnalysisFactory af = IAnalysisFactory.create();
         ECalHitMapPlots ecalhtplots = new ECalHitMapPlots();
             
         
+        
+        Options opts = createCommandLineOptions();
+        CommandLineParser parser = new PosixParser();
+        CommandLine cmd=null;
+        try {
+            cmd = parser.parse(opts, args);
+        } catch (ParseException ex) {
+            Logger.getLogger(ecalPlots.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        int type=0;
+        String strType = cmd.getOptionValue("t");
+        if(strType==null) {
+            System.out.println("using default analysis " + type);
+        } else {
+            type = Integer.parseInt(strType);
+        }
+        boolean savePlots = false;
+        if(cmd.hasOption("s")) {
+            savePlots = true;
+        }
+        
+            
+        
+        if(type==0) {
+            
+            try {
+                String path = "plots/20120710_ecal_dataMC/";
+                String file_mc = "../../multscatana.aida";
+                //String file_mc = "multscatana_egs5_500empty.aida";
+                String file_data = "multscatana_run1351.aida";
+                String file_bkg = "multscatana_run1358.aida";
+                
+                //ITree tree_mc = af.createTreeFactory().create(path+"multscatana_egs5_ecalbadchapplied.aida");
+            //if(1==1) return;
+            ITree tree_mc = af.createTreeFactory().create(path+ file_mc);
+            printObjectsInTree(tree_mc);
+            if(1==1) return;
+            
+            ITree tree_data = af.createTreeFactory().create(path+file_data);
+            ITree tree_bkg = af.createTreeFactory().create(path+file_bkg);
+            String name = "dataMC_500empty_run1351_egs5_currentNorm";
+            
+            //Overlay a few histograms
+            List<String> histNames = new ArrayList<String>();
+            
+            histNames.add("Cluster energy all");
+            histNames.add("Cluster energy bottom");
+            histNames.add("Cluster energy top");
+            histNames.add("Cluster size");
+            histNames.add("Cluster size bottom");
+            histNames.add("Cluster size top");
+            histNames.add("Crystal amplitude all");
+            histNames.add("Crystal amplitude bottom");
+            histNames.add("Crystal amplitude top");
+            for(int icol=-5;icol<=5;++icol) {
+                for(int irow=-23;irow<=23;++irow) {
+                    if(Math.abs(irow)==1) {
+                        histNames.add("Cluster energy x=" + icol + " y=" + irow);
+                    }
+                }
+            }
+
+
+            SimpleHPSConditions cond = new SimpleHPSConditions("runConditions.txt");
+            
+            int idx = file_data.indexOf("run");
+            
+            int run_data = Integer.parseInt(file_data.substring(idx+3,idx+7));
+            idx = file_bkg.indexOf("run");
+            int run_bkg = Integer.parseInt(file_bkg.substring(idx+3,idx+7));
+            
+            //normalize to integrated current of data
+            double int_current_mc = 90.0; //nC i.e. 1s of beam at 90nA
+            double k_Q = cond.getIntCurrent(run_data)/int_current_mc;
+            System.out.printf("Run %d: intCurrent %.1fnC MC<->%.1fnC  => k_current %.1f\n",run_data,cond.getIntCurrent(run_data),int_current_mc,k_Q );
+            double k_rec = cond.getRecRate(run_data)/cond.getRate(run_data);
+            System.out.printf("Run %d: rate %.1fHz rec rate %.1fHz  => k_rate %.1f\n",run_data,cond.getRate(run_data),cond.getRecRate(run_data),k_rec );
+            
+                boolean normDataToMC = true;
+                for(String hname : histNames) {
+                    IHistogram1D h_mc = (IHistogram1D)tree_mc.find(hname);
+                    IHistogram1D h_obs = (IHistogram1D)tree_data.find(hname);
+                    IHistogram1D h_bkg = (IHistogram1D)tree_bkg.find(hname);
+                    double rate_obs = cond.getRecRate(run_data);//1933.479;
+                    double rate_bkg = cond.getRecRate(run_bkg);//309.785;
+                    double c_rate = rate_bkg/rate_obs;
+                    h_bkg.scale((h_obs.entries()/h_bkg.entries())*c_rate);
+                    IHistogram1D h_data = ecalhtplots.hf.subtract(hname + " bkgsubtr", h_obs, h_bkg);
+                    if(normDataToMC) {
+                        h_mc.scale(h_data.sumBinHeights()/h_mc.sumBinHeights());
+                    } else {
+                        h_mc.scale(k_Q*k_rec);
+                    }
+                    //System.out.println("mc " + h_mc.entries() + " obs " + h_obs.entries() + " bkg " + h_bkg.entries() + " obs " + h_data.entries());
+                    //System.out.println("mc " + h_mc.sumBinHeights() + " obs " + h_obs.sumBinHeights() + " bkg " + h_bkg.sumBinHeights() + " obs " + h_data.sumBinHeights());
+                    System.out.printf("Run %d: obs %.1f bkg %.1f\t=>\tdata %.1f MC %.1f\t->\tdata/MC=%.2f\n",run_data,h_obs.sumBinHeights(),h_bkg.sumBinHeights(),h_data.sumBinHeights(),h_mc.sumBinHeights(),h_data.sumBinHeights()/h_mc.sumBinHeights());
+
+                    ecalhtplots.plotBasic1D(h_data,h_mc,name+"_"+hname, "","","Data","MC",savePlots);
+
+                }
+            } catch(IOException e) {
+                throw new RuntimeException(e);
+            }
+            
+        }
+        
+        
+        
+        
+        
+         if(type==2) {
+            
+            try {
+                String path = "";//plots/20120710_ecal_dataMC/../../";
+                String file_dead = "multscatana_egs5_160rl.aida";//multscatana_egs5_500empty_nodeadchannelfilter.aida";
+                String file = "multscatana_egs5_160rl.aida";//"multscatana_egs5_500empty.aida";
+                 ITree tree_dead = af.createTreeFactory().create(path+ file_dead);
+                 ITree tree = af.createTreeFactory().create(path+ file);
+                String name = "deadChEffect_egs5";
+
+                //Overlay a few histograms
+                List<String> histNames = new ArrayList<String>();
+                
+                histNames.add("Cluster energy x=4 y=1");
+                histNames.add("Cluster energy x=5 y=1");
+                
+                
+                for(String hname : histNames) {
+                    IHistogram1D h = (IHistogram1D)tree.find(hname);
+                    IHistogram1D h_dead = (IHistogram1D)tree_dead.find(hname);
+                    
+                    //h_bkg.scale((h.entries()/h_dead.entries())*c_rate);
+                    //IHistogram1D h_data = ecalhtplots.hf.subtract(hname + " bkgsubtr", h_obs, h_bkg);
+                    //h_mc.scale(h_data.sumBinHeights()/h_mc.sumBinHeights());
+                    
+                    //System.out.println("mc " + h_mc.entries() + " obs " + h_obs.entries() + " bkg " + h_bkg.entries() + " obs " + h_data.entries());
+                    //System.out.println("mc " + h_mc.sumBinHeights() + " obs " + h_obs.sumBinHeights() + " bkg " + h_bkg.sumBinHeights() + " obs " + h_data.sumBinHeights());
+                    //System.out.printf("Run %d: obs %.1f bkg %.1f\t=>\tdata %.1f MC %.1f\t->\tdata/MC=%.2f\n",run_data,h_obs.sumBinHeights(),h_bkg.sumBinHeights(),h_data.sumBinHeights(),h_mc.sumBinHeights(),h_data.sumBinHeights(),h_mc.sumBinHeights());
+
+                    ecalhtplots.plotBasic1D(h,h_dead,name+"_"+hname, "","","Fixed","Bad Ch. incl.",savePlots);
+
+                }
+                
+                
+
+            } catch(IOException e) {
+                throw new RuntimeException(e);
+            }
+         }
+        
+        
+        
+          
+         if(type==3) {
+            
+            try {
+                String path = "";//plots/20120710_ecal_dataMC/../../";
+                
+                String file_mc = "trigratefile_egs5_160rl.aida";
+                String file_data = "trigratefile_run1351.aida";
+                String file_bkg = "trigratefile_run1358.aida";
+                
+                ITree tree_data = af.createTreeFactory().create(path+ file_data);
+                ITree tree_mc = af.createTreeFactory().create(path+ file_mc);
+                ITree tree_bkg = af.createTreeFactory().create(path+ file_bkg);
+                
+                
+                
+                String name = "dataMC_clusterE_tophalf_norm";
+
+                
+                
+                 SimpleHPSConditions cond = new SimpleHPSConditions("runConditions.txt");
+            
+                int idx = file_data.indexOf("run");
+                int run_data = Integer.parseInt(file_data.substring(idx+3,idx+7));
+                idx = file_bkg.indexOf("run");
+                int run_bkg = Integer.parseInt(file_bkg.substring(idx+3,idx+7));
+
+                //normalize to integrated current of data
+                double int_current_mc = 90.0; //nC i.e. 1s of beam at 90nA
+                double k_Q = cond.getIntCurrent(run_data)/int_current_mc;
+                System.out.printf("Run %d: intCurrent %.1fnC intCurrent(MC) %.1fnC \n",run_data,cond.getIntCurrent(run_data),int_current_mc);
+                System.out.printf("=> k_current %.1f\n",k_Q );
+                
+                double k_rec_data = cond.getRecRate(run_data)/cond.getRate(run_data);
+                System.out.printf("Run %d: rate %.1fHz rec rate %.1fHz\n",run_data,cond.getRate(run_data),cond.getRecRate(run_data));
+                System.out.printf("=> k_rec_data %.2f\n",k_rec_data );
+                
+                double k_rec_bkg = cond.getRecRate(run_bkg)/cond.getRate(run_bkg);
+                System.out.printf("Run %d: rate %.1fHz rec rate %.1fHz\n",run_data,cond.getRate(run_bkg),cond.getRecRate(run_bkg));
+                System.out.printf("=> k_rate_bkg %.2f\n",k_rec_bkg );
+                
+                double k_norm_bkg = cond.getIntCurrent(run_data)/cond.getIntCurrent(run_bkg);;
+                System.out.printf("Run %d: intCurrent %.1fnC \n",run_bkg,cond.getIntCurrent(run_bkg));
+                System.out.printf("=> k_norm_bkg %.1f\n",k_norm_bkg );
+                
+                //Overlay a few histograms
+                List<String> histNames = new ArrayList<String>();
+                for(int ix=-23;ix<=23;++ix) {
+                    for(int iy=-5;iy<=5;++iy) {
+                        
+                        //if(ix<=0) continue;
+                        if(iy<=0) continue;
+                        
+                        histNames.add("Cluster energy x="+ix+" y="+iy);
+                        
+                    }    
+                }
+                System.out.println("Histogram names: "+histNames.toString());
+                
+                int iadded=0;
+                IHistogram1D h_obs=null;
+                IHistogram1D h_bkg=null;
+                IHistogram1D h_mc=null;
+                 
+                
+                boolean dataToMCNorm = true;
+                for(String hname : histNames) {
+                    IHistogram1D h_obs_tmp = (IHistogram1D)tree_data.find(hname);
+                    IHistogram1D h_bkg_tmp = (IHistogram1D)tree_bkg.find(hname);
+                    IHistogram1D h_mc_tmp = (IHistogram1D)tree_mc.find(hname);
+                    if(iadded==0) {
+                        h_obs = ecalhtplots.hf.createCopy(h_obs_tmp.title()+ " sum", h_obs_tmp);
+                        h_bkg = ecalhtplots.hf.createCopy(h_bkg_tmp.title()+ " sum", h_bkg_tmp);
+                        h_mc = ecalhtplots.hf.createCopy(h_mc_tmp.title()+ " sum", h_mc_tmp);
+                    } else {
+                    
+                        h_obs.add(h_obs_tmp);
+                        h_bkg.add(h_bkg_tmp);
+                        h_mc.add(h_mc_tmp);
+                    }
+                    ++iadded;
+                    
+                }
+                
+                System.out.println("Added " + iadded + " histograms");
+
+                h_bkg.scale(k_norm_bkg*k_rec_data/k_rec_bkg);
+
+                IHistogram1D h_data = ecalhtplots.hf.subtract(h_obs.title() + " bkgsubtr", h_obs, h_bkg);
+
+                if(dataToMCNorm) {
+                    h_mc.scale(h_data.sumBinHeights()/h_mc.sumBinHeights());
+                } else {
+                    h_mc.scale(k_Q);
+                }
+                System.out.println("mc " + h_mc.entries() + "(" + h_mc.allEntries() + ")" + " obs " + h_obs.entries()+ "(" + h_obs.allEntries() + ")" + " bkg " + h_bkg.entries()+ "(" + h_bkg.allEntries() + ")" + " obs " + h_data.entries()+ "(" + h_data.allEntries() + ")");
+                System.out.println("mc " + h_mc.sumBinHeights() + " obs " + h_obs.sumBinHeights() + " bkg " + h_bkg.sumBinHeights() + " obs " + h_data.sumBinHeights());
+                System.out.printf("Run %d: obs %.1f bkg %.1f\t=>\tdata %.1f MC %.1f\t->\tdata/MC=%.2f\n",run_data,h_obs.sumBinHeights(),h_bkg.sumBinHeights(),h_data.sumBinHeights(),h_mc.sumBinHeights(),h_data.sumBinHeights()/h_mc.sumBinHeights());
+
+                ecalhtplots.plotBasic1D(h_data,h_mc,name+"_"+h_obs.title(), "","","data","MC",savePlots);
+
+                
+                
+                
+
+            } catch(IOException e) {
+                throw new RuntimeException(e);
+            }
+         }
+         
+         
+        
         /*
         ITree tree_multscatana = null;
         try {
@@ -81,25 +360,25 @@
         
         */
         
-        
-        ITree tree_empty_multscatana = null;
-        ITree tree_1351_multscatana = null;
-        try {
-            tree_empty_multscatana = analysisFactory.createTreeFactory().create("multscatana_1358_EcalChFilter_100k.aida");
-            tree_1351_multscatana = analysisFactory.createTreeFactory().create("multscatana_1351_EcalChFilter.aida");
-            //tree_1351_multscatana = analysisFactory.createTreeFactory().create("plots/PAC/20120610/EcalChFilter_1351/multscatana_1351_EcalChFilter.aida");
-            
-            
-            ecalhtplots.overLayUpStrBkg(tree_empty_multscatana, tree_1351_multscatana);
-            
-            
-            
-        } catch (IOException e) {
-            throw new RuntimeException(e);
+        if(type==1) {
+            ITree tree_empty_multscatana = null;
+            ITree tree_1351_multscatana = null;
+            try {
+                tree_empty_multscatana = af.createTreeFactory().create("multscatana_1358_EcalChFilter_100k.aida");
+                tree_1351_multscatana = af.createTreeFactory().create("multscatana_1351_EcalChFilter.aida");
+                //tree_1351_multscatana = analysisFactory.createTreeFactory().create("plots/PAC/20120610/EcalChFilter_1351/multscatana_1351_EcalChFilter.aida");
+
+
+                ecalhtplots.overLayUpStrBkg(tree_empty_multscatana, tree_1351_multscatana);
+
+
+
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+
         }
         
         
-        
-        
     }
 }

hps-java/src/main/java/org/lcsim/hps/users/phansson
ECalHitMapPlots.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ECalHitMapPlots.java	22 Jun 2012 22:57:31 -0000	1.1
+++ ECalHitMapPlots.java	12 Jul 2012 21:32:39 -0000	1.2
@@ -103,28 +103,42 @@
 
      
      
-    public void plotBasic1D(IHistogram1D h, IHistogram1D h2, String title, String xTitle, String yTitle, String fillColor,boolean writeToFile) {
+    public void plotBasic1D(IHistogram1D h, IHistogram1D h2, String title, String xTitle, String yTitle, String leg1,String leg2,boolean writeToFile) {
         IPlotter plotter_hm = af.createPlotterFactory().create();
-        plotter_hm.setTitle(title);
+        if(title!="") plotter_hm.setTitle(title);
         //if(fillColor=="") fillColor="yellow";
         //plotter_hm.createRegion(10.0,20.0, 460.0,100.0);
         //plotter_hm.createRegion(d, d1, d2, d3)
         plotter_hm.createRegions(1,3);//.plot(hm);
-        plotter_hm.region(0).plot(h);
-        plotter_hm.region(1).plot(h2);
+        //plotter_hm.region(0).style().dataStyle().fillStyle().setOpacity(0);
+        //plotter_hm.region(1).style().dataStyle().fillStyle().setOpacity(0);
+        plotter_hm.region(2).style().dataStyle().fillStyle().setVisible(false);
+        plotter_hm.region(2).style().statisticsBoxStyle().setVisible(false);
+        //plotter_hm.style().dataStyle().fillStyle().setColor(fillColor);
+        plotter_hm.region(1).style().dataStyle().lineStyle().setColor("green");
+        
+        IPlotterStyle dataStyle = plotter_hm.region(0).style();
+        dataStyle.dataStyle().lineStyle().setColor("green");
+        plotter_hm.region(0).plot(h,dataStyle);
+        dataStyle.dataStyle().lineStyle().setColor("blue");
+        plotter_hm.region(1).plot(h2,dataStyle);
         plotter_hm.region(2).plot(h);
         plotter_hm.region(2).plot(h2,"mode=overlay");
-        plotter_hm.style().statisticsBoxStyle().setVisible(true);
-        //plotter_hm.style().dataStyle().fillStyle().setColor(fillColor);
-        ((PlotterRegion) plotter_hm.region(0)).getPlot().getXAxis().setLabel(xTitle);
-        ((PlotterRegion) plotter_hm.region(0)).getPlot().getYAxis().setLabel(yTitle);          
+        
+        //System.out.println("av Params: " + plotter_hm.style().dataStyle().fillStyle().availableParameters().toString());
+        //for(String str : plotter_hm.style().dataStyle().fillStyle().availableParameters()) {
+        //    System.out.println(str);
+        //}
+        
+        if(xTitle!="") ((PlotterRegion) plotter_hm.region(0)).getPlot().getXAxis().setLabel(xTitle);
+        if(yTitle!="") ((PlotterRegion) plotter_hm.region(0)).getPlot().getYAxis().setLabel(yTitle);          
         if(!hide) plotter_hm.show();
         if(writeToFile) {
-        try {
-            plotter_hm.writeToFile(title+".png", "png");
-        } catch(IOException e) {
-            throw new RuntimeException(e);
-        }
+            try {
+                plotter_hm.writeToFile(title+".png", "png");
+            } catch(IOException e) {
+                throw new RuntimeException(e);
+            }
         }
         
     }
@@ -234,11 +248,11 @@
         heYp_b.scale(hYp_b.entries()/heYp_b.entries()*c_b);
         heYn_b.scale(hYn_b.entries()/heYn_b.entries()*c_b);
 
-        plotBasic1D(hYp_t,heYp_t,"(norm) Top track q>0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","blue",save);
-        plotBasic1D(hYn_t,heYn_t,"(norm) Top track q<0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","blue",save);
+        plotBasic1D(hYp_t,heYp_t,"(norm) Top track q>0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","","",save);
+        plotBasic1D(hYn_t,heYn_t,"(norm) Top track q<0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","","",save);
 
-        plotBasic1D(hYp_b,heYp_b,"(norm) Bottom track q>0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","blue",save);
-        plotBasic1D(hYn_b,heYn_b,"(norm) Bottom track q<0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","blue",save);
+        plotBasic1D(hYp_b,heYp_b,"(norm) Bottom track q>0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","","",save);
+        plotBasic1D(hYn_b,heYn_b,"(norm) Bottom track q<0 Y @ -67cm", "Track Y @ -67cm [mm]","Arbitrary Units","","",save);
 
         
         IHistogram1D hsYn_t = hf.subtract("(subtr) Top track q<0 Y @ -67cm", hYn_t, heYn_t);

hps-java/src/main/java/org/lcsim/hps/users/phansson
MultScatAnalysis.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- MultScatAnalysis.java	21 Jun 2012 15:35:44 -0000	1.4
+++ MultScatAnalysis.java	12 Jul 2012 21:32:39 -0000	1.5
@@ -33,6 +33,7 @@
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 import org.lcsim.hps.users.omoreno.ExtendTrack;
+import org.lcsim.recon.cluster.util.BasicCluster;
 import org.lcsim.recon.tracking.seedtracker.SeedTrack;
 
 /**
@@ -56,7 +57,7 @@
     private static int crystalCols;
     private static int crystalRows;
     int ecalClusterSel;
-    boolean hide = true;
+    boolean hide = false;
     
     private String outputPlotFileName = "test.aida";
     private String trackCollectionName = "MatchedTracks";
@@ -76,7 +77,9 @@
     private AIDAFrame plotterFrameTrig;
     
     IPlotter plotter_trig_tag;
-    
+    IPlotter plotter_cltrkmatchE;
+    IHistogram1D clusterEnergy[][] = new IHistogram1D[47][11];
+            
     private int trigger[] = {0,0};
     
     
@@ -183,6 +186,36 @@
         
         
         
+        IPlotter plotter_ecal_pos = af.createPlotterFactory().create();
+        IPlotter plotter_ecal_e = af.createPlotterFactory().create();
+        IPlotter plotter_ecal_hitmap = af.createPlotterFactory().create();
+        IPlotter plotter_ecal_crhitmap = af.createPlotterFactory().create();
+        IPlotter plotter_ecal_cramp = af.createPlotterFactory().create();
+        IPlotter plotter_ecal_cls = af.createPlotterFactory().create();
+        
+        plotter_ecal_e.createRegions(2,3,0);
+        plotter_ecal_e.setTitle("Ecal Cluster Energy");
+        plotter_ecal_cramp.createRegions(2,3,0);
+        plotter_ecal_cramp.setTitle("Ecal Crystal Hit Map");
+        //plotter_ecal_crhitmap.style().statisticsBoxStyle().setVisible(false);
+        plotter_ecal_crhitmap.createRegions(2,3,0);
+        plotter_ecal_crhitmap.setTitle("Ecal Crystal Hit Map");
+        plotter_ecal_crhitmap.style().statisticsBoxStyle().setVisible(false);
+        plotter_ecal_hitmap.createRegions(2,3,0);
+        plotter_ecal_hitmap.setTitle("Ecal Cluster Hit Map");
+        plotter_ecal_hitmap.style().statisticsBoxStyle().setVisible(false);
+        plotter_ecal_pos.createRegions(2,3,0);
+        plotter_ecal_pos.setTitle("Ecal Cluster Position");
+        plotter_ecal_pos.style().statisticsBoxStyle().setVisible(false);
+        plotter_ecal_cls.createRegions(2,3,0);
+        plotter_ecal_cls.setTitle("Ecal Cluster size");
+
+        plotterFrame.addPlotter(plotter_ecal_e);
+        plotterFrame.addPlotter(plotter_ecal_crhitmap);
+        plotterFrame.addPlotter(plotter_ecal_cramp);
+        plotterFrame.addPlotter(plotter_ecal_hitmap);
+        plotterFrame.addPlotter(plotter_ecal_pos);
+        plotterFrame.addPlotter(plotter_ecal_cls);
         
         
 
@@ -809,65 +842,9 @@
         
         
         
-        IPlotter plotter_ecal_pos = af.createPlotterFactory().create();
-        IPlotter plotter_ecal_e = af.createPlotterFactory().create();
-        IPlotter plotter_ecal_hitmap = af.createPlotterFactory().create();
-        IPlotter plotter_ecal_crhitmap = af.createPlotterFactory().create();
-        IPlotter plotter_ecal_cramp = af.createPlotterFactory().create();
-        IPlotter plotter_ecal_cls = af.createPlotterFactory().create();
-        
-        
-        
-        
-        
-        
-        IPlotter plotter_cltrkmatch = af.createPlotterFactory().create();
-        IPlotter plotter_cltrkmatchE = af.createPlotterFactory().create();
-        IPlotter plotter_cltrkmatchEeff = af.createPlotterFactory().create();
-        IPlotter plotter_clEoverP = af.createPlotterFactory().create();
-        plotter_ecal_e.createRegions(2,3,0);
-        plotter_ecal_e.setTitle("Ecal Cluster Energy");
-        plotter_ecal_cramp.createRegions(2,3,0);
-        plotter_ecal_cramp.setTitle("Ecal Crystal Hit Map");
-        //plotter_ecal_crhitmap.style().statisticsBoxStyle().setVisible(false);
-        plotter_ecal_crhitmap.createRegions(2,3,0);
-        plotter_ecal_crhitmap.setTitle("Ecal Crystal Hit Map");
-        plotter_ecal_crhitmap.style().statisticsBoxStyle().setVisible(false);
-        plotter_ecal_hitmap.createRegions(2,3,0);
-        plotter_ecal_hitmap.setTitle("Ecal Cluster Hit Map");
-        plotter_ecal_hitmap.style().statisticsBoxStyle().setVisible(false);
-        plotter_ecal_pos.createRegions(2,3,0);
-        plotter_ecal_pos.setTitle("Ecal Cluster Position");
-        plotter_ecal_pos.style().statisticsBoxStyle().setVisible(false);
-        plotter_ecal_cls.createRegions(2,3,0);
-        plotter_ecal_cls.setTitle("Ecal Cluster size");
-        
-        
-        
-        
-        
-        plotter_cltrkmatch.createRegions(3,3,0);
-        plotter_cltrkmatch.setTitle("Ecal track match");
-        plotter_cltrkmatchE.createRegions(3,3,0);
-        plotter_cltrkmatchE.setTitle("Ecal track match E");
-        plotter_cltrkmatchEeff.createRegions(3,3,0);
-        plotter_cltrkmatchEeff.setTitle("Ecal track match eff E");
-        plotter_clEoverP.createRegions(3,3,0);
-        plotter_clEoverP.setTitle("EoverP");
-        
-        plotterFrame.addPlotter(plotter_ecal_e);
-        plotterFrame.addPlotter(plotter_ecal_crhitmap);
-        plotterFrame.addPlotter(plotter_ecal_cramp);
-        plotterFrame.addPlotter(plotter_ecal_hitmap);
-        plotterFrame.addPlotter(plotter_ecal_pos);
-        plotterFrame.addPlotter(plotter_ecal_cls);
-        
         
-        plotterFrame.addPlotter(plotter_cltrkmatch);
-        plotterFrame.addPlotter(plotter_cltrkmatchE);
-        plotterFrame.addPlotter(plotter_cltrkmatchEeff);
-        plotterFrame.addPlotter(plotter_clEoverP);
         
+      
         
         
         
@@ -1088,11 +1065,18 @@
         
            
                     
+        
+        for(int irow=-5;irow<=5;++irow) {
+            for(int icol=-23;icol<=23;++icol) {
+                clusterEnergy[icol+23][irow+5] = aida.histogram1D("Cluster energy x=" + icol + " y=" + irow, 50, 0,6000);  
+            }
+        }
+        
                     
         
-          IHistogram hcrhm_t = aida.histogram2D("Crystal hit map top", 51, -25.5, 25.5, 6, -0.5, 5.5);
-             IHistogram hcrhm_b = aida.histogram2D("Crystal hit map bottom", 51, -25.5, 25.5, 6, -5.5, 0.5);
-            IHistogram hcrhm_a = aida.histogram2D("Crystal hit map all", 51, -25.5, 25.5, 11, -5.5, 5.5);
+          IHistogram hcrhm_t = aida.histogram2D("Crystal hit map top", 47, -23.5, 23.5, 6, -0.5, 5.5);
+             IHistogram hcrhm_b = aida.histogram2D("Crystal hit map bottom", 47, -23.5, 23.5, 6, -5.5, 0.5);
+            IHistogram hcrhm_a = aida.histogram2D("Crystal hit map all", 47, -23.5, 23.5, 11, -5.5, 5.5);
             
             
             plotter_ecal_crhitmap.createRegions(1,3,0);
@@ -1119,6 +1103,7 @@
             IHistogram hshm_b = aida.histogram2D("Cluster hit map sel bottom", 51, -25.5, 25.5, 6, -5.5, 0.5);
             IHistogram hshm_a = aida.histogram2D("Cluster hit map sel all", 51, -25.5, 25.5, 11, -5.5, 5.5);
      
+            
             plotter_ecal_hitmap.region(0).plot(hhm_t);
             plotter_ecal_hitmap.region(1).plot(hhm_b);
             plotter_ecal_hitmap.region(2).plot(hhm_a);
@@ -1193,10 +1178,95 @@
             ((PlotterRegion) plotter_ecal_pos.region(i)).getPlot().setAllowPopupMenus(true);
             }
             
+            
+            IPlotter plotter_ecal_tmax = af.createPlotterFactory().create();
+            plotter_ecal_tmax.createRegions(4,2,0);
+            plotter_ecal_tmax.setTitle("Cluster hit pos tmax");
+            plotter_ecal_tmax.style().statisticsBoxStyle().setVisible(false);
+            plotterFrame.addPlotter(plotter_ecal_tmax);
+            
+            IHistogram hposTMaxX_t = aida.histogram1D("Cluster hit X-Xcenter top", 50, -25, 25);
+            IHistogram hposTMaxY_t = aida.histogram1D("Cluster hit Y-Ycenter top", 50, -10, 10);
+            IHistogram hposTMaxX_b = aida.histogram1D("Cluster hit X-Xcenter bottom", 50, -25, 25);
+            IHistogram hposTMaxY_b = aida.histogram1D("Cluster hit Y-Ycenter bottom", 50, -10, 10);
+            
+            IHistogram hposTMaxXvsX_t = aida.histogram2D("Cluster hit X vs X-Xcenter top",25, -400,400, 50, -25, 25);
+            IHistogram hposTMaxYvsY_t = aida.histogram2D("Cluster hit Y vs Y-Ycenter top",25, 0,100, 50, -10, 10);
+            
+            IHistogram hposTMaxXvsX_b = aida.histogram2D("Cluster hit X vs X-Xcenter bottom",25, -400,400, 50, -25, 25);
+            IHistogram hposTMaxYvsY_b = aida.histogram2D("Cluster hit Y vs Y-Ycenter bottom",25, -100,00, 50, -10, 10);
+            
+            
+            plotter_ecal_tmax.region(0).plot(hposTMaxX_t);
+            plotter_ecal_tmax.region(1).plot(hposTMaxX_b);
+            plotter_ecal_tmax.region(2).plot(hposTMaxXvsX_t);
+            plotter_ecal_tmax.region(3).plot(hposTMaxXvsX_b);
+            plotter_ecal_tmax.region(4).plot(hposTMaxY_t);
+            plotter_ecal_tmax.region(5).plot(hposTMaxY_b);
+            plotter_ecal_tmax.region(6).plot(hposTMaxYvsY_t);
+            plotter_ecal_tmax.region(7).plot(hposTMaxYvsY_b);
+            
+            style = plotter_ecal_tmax.region(2).style();
+            style.setParameter("hist2DStyle", "colorMap");
+            style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            plotter_ecal_tmax.region(3).setStyle(style);
+            plotter_ecal_tmax.region(6).setStyle(style);
+            plotter_ecal_tmax.region(7).setStyle(style);
+            
         
-           
+        
+              
+        
+        
+        
+        
+            
+        IPlotter plotter_clEoverP = af.createPlotterFactory().create();
+        plotter_clEoverP.createRegions(3,3,0);
+        plotter_clEoverP.setTitle("EoverP");
+ 
+        plotterFrame.addPlotter(plotter_clEoverP);
+        
+        
+        
+        IPlotter plotter_cltrkmatch = af.createPlotterFactory().create();
+        plotter_cltrkmatch.createRegions(2,3,0);
+        plotter_cltrkmatch.setTitle("Ecal track match");
+        plotterFrame.addPlotter(plotter_cltrkmatch);
+        
+        IHistogram hdx_t = aida.histogram1D("Cluster X - track X top" , 25, -1, 500);                        
+        IHistogram hdy_t = aida.histogram1D("Cluster Y - track Y top" , 25, -1, 50);                        
+        IHistogram hdx_b = aida.histogram1D("Cluster X - track X bottom" , 25, -1, 500);                        
+        IHistogram hdy_b = aida.histogram1D("Cluster Y - track Y bottom" , 25, -1, 50);                        
+        
+        plotter_cltrkmatch.region(0).plot(hdx_t);
+        plotter_cltrkmatch.region(1).plot(hdx_b);
+        plotter_cltrkmatch.region(2).plot(hdy_t);
+        plotter_cltrkmatch.region(3).plot(hdy_b);
+        
+        
+        
+        plotter_cltrkmatchE = af.createPlotterFactory().create();
+        plotter_cltrkmatchE.createRegions(2,3,0);
+        plotter_cltrkmatchE.setTitle("Ecal track match efficiency");
+        plotterFrame.addPlotter(plotter_cltrkmatchE);
+        
+        
+        plotter_cltrkmatchE.region(0).plot(hPz_t);
+        plotter_cltrkmatchE.region(1).plot(hmPz_t);
+        //plotter_cltrkmatchE.region(2).plot(hPz_meff_t);
+        plotter_cltrkmatchE.region(3).plot(hPz_b);
+        plotter_cltrkmatchE.region(4).plot(hmPz_b);
+        //plotter_cltrkmatchE.region(5).plot(hPz_meff_b);
         
         
+           
+
+            
+            
+            
+            
+            
         
         String side;
         for (int iSide=0;iSide<3;++iSide) {
@@ -1225,14 +1295,6 @@
             
             
         
-            IHistogram h2222 = aida.histogram2D("allcl_clEtrkdr_" + side ,25,0,2500, 25, -1, 500);                        
-            IHistogram h22221 = aida.histogram2D("allcl_clEtrkdx_" + side ,25,0,2500, 25, -1, 500);                        
-            IHistogram h22223 = aida.histogram2D("allcl_clEtrkdy_" + side ,25,0,2500, 25, -1, 50);                        
-            
-            IHistogram h2222eff = aida.histogram1D("allcl_clEtrkdr_eff_" + side ,25,0,2500);                        
-            IHistogram h22221eff = aida.histogram1D("allcl_clEtrkdx_eff_" + side ,25,0,2500);                        
-            IHistogram h22223eff = aida.histogram1D("allcl_clEtrkdy_eff_" + side ,25,0,2500);                        
-            
             
             IHistogram hEvsP = aida.histogram2D("allcl_clEvsP_" + side ,25,0,2500,25,0,2500);                        
             IHistogram hEoverP = aida.histogram1D("allcl_clEoverP_" + side ,25,0,2);                        
@@ -1246,53 +1308,9 @@
             plotter_ecal_cls.region(iSide+3).plot(h44);
             
             
-            
-            plotter_cltrkmatch.region(iSide).plot(h3333);
-            plotter_cltrkmatch.region(iSide+3).plot(h4444);
-            plotter_cltrkmatch.region(iSide+6).plot(h1111);
-
-            ((PlotterRegion) plotter_cltrkmatch.region(iSide+6)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatch.region(iSide+6)).getPlot().setAllowPopupMenus(true);
-            ((PlotterRegion) plotter_cltrkmatch.region(iSide+3)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatch.region(iSide+3)).getPlot().setAllowPopupMenus(true);
-            ((PlotterRegion) plotter_cltrkmatch.region(iSide)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatch.region(iSide)).getPlot().setAllowPopupMenus(true);
-
-            
-            plotter_cltrkmatchE.region(iSide).plot(h22221);
-            plotter_cltrkmatchE.region(iSide+3).plot(h22223);
-            plotter_cltrkmatchE.region(iSide+6).plot(h2222);
-            
-            plotter_cltrkmatchE.region(iSide).style().setParameter("hist2DStyle", "colorMap");
-            plotter_cltrkmatchE.region(iSide).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-            plotter_cltrkmatchE.region(iSide+3).style().setParameter("hist2DStyle", "colorMap");
-            plotter_cltrkmatchE.region(iSide+3).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-            plotter_cltrkmatchE.region(iSide+6).style().setParameter("hist2DStyle", "colorMap");
-            plotter_cltrkmatchE.region(iSide+6).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-            
-            ((PlotterRegion) plotter_cltrkmatchE.region(iSide)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatchE.region(iSide)).getPlot().setAllowPopupMenus(true);
-            ((PlotterRegion) plotter_cltrkmatchE.region(iSide+3)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatchE.region(iSide+3)).getPlot().setAllowPopupMenus(true);
-            ((PlotterRegion) plotter_cltrkmatchE.region(iSide+6)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatchE.region(iSide+6)).getPlot().setAllowPopupMenus(true);
-            
-            plotter_cltrkmatchEeff.region(iSide).plot(h22221eff);
-            plotter_cltrkmatchEeff.region(iSide+3).plot(h22223eff);
-            plotter_cltrkmatchEeff.region(iSide+6).plot(h2222eff);
-            plotter_cltrkmatchEeff.region(iSide).style().setParameter("hist2DStyle", "colorMap");
-            plotter_cltrkmatchEeff.region(iSide).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-            plotter_cltrkmatchEeff.region(iSide+3).style().setParameter("hist2DStyle", "colorMap");
-            plotter_cltrkmatchEeff.region(iSide+3).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-            plotter_cltrkmatchEeff.region(iSide+6).style().setParameter("hist2DStyle", "colorMap");
-            plotter_cltrkmatchEeff.region(iSide+6).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-            ((PlotterRegion) plotter_cltrkmatchEeff.region(iSide)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatchEeff.region(iSide)).getPlot().setAllowPopupMenus(true);
-            ((PlotterRegion) plotter_cltrkmatchEeff.region(iSide+3)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatchEeff.region(iSide+3)).getPlot().setAllowPopupMenus(true);
-            ((PlotterRegion) plotter_cltrkmatchEeff.region(iSide+6)).getPlot().setAllowUserInteraction(true);
-            ((PlotterRegion) plotter_cltrkmatchEeff.region(iSide+6)).getPlot().setAllowPopupMenus(true);
-            
+           
+
+           
             plotter_clEoverP.region(iSide).plot(hEvsP);
             plotter_clEoverP.region(iSide+3).plot(hEoverP);
             plotter_clEoverP.region(iSide+6).plot(hEoverPsel);
@@ -1427,7 +1445,7 @@
 
         
         
-        
+        if(1==0) {
 
             for(Track trk: tracks) {
                 int side = 1;
@@ -1551,7 +1569,7 @@
 
 
             }
-
+        }
         
         
         
@@ -1571,7 +1589,9 @@
                     aida.histogram1D("Crystal amplitude all").fill(hit.getRawEnergy());
                     if(y>0) aida.histogram1D("Crystal amplitude top").fill(hit.getRawEnergy());
                     else aida.histogram1D("Crystal amplitude bottom").fill(hit.getRawEnergy());
-
+                    
+                    //crystalAmp[x+23][y+5].fill(hit.getRawEnergy());
+                    
                 }
         }
         
@@ -1596,6 +1616,10 @@
             int[] crystalPair = getCrystalPair(cl);
             double theta = Math.atan(cl.getPosition()[1]/cl.getPosition()[2]);
             double py = cl.getEnergy()*Math.sin(theta);
+            
+            BasicCluster bcl = (BasicCluster)cl;
+            double[] posAtCenter = bcl.getPosition();
+            
             //double px = 
             //HepLorentzVector clv = new BasicHepLorentzVector(cl.getEnergy());
             //clv.
@@ -1604,6 +1628,11 @@
             aida.histogram1D("Cluster energy " + sides[side]).fill(cl.getEnergy()); 
             aida.histogram1D("Cluster energy all").fill(cl.getEnergy()); 
             
+            
+            clusterEnergy[crystalPair[0]+23][crystalPair[1]+5].fill(cl.getEnergy());
+        
+            
+            
             aida.histogram2D("Cluster hit map " + sides[side]).fill(crystalPair[0], crystalPair[1]); 
             aida.histogram2D("Cluster hit map all").fill(crystalPair[0], crystalPair[1]); 
 
@@ -1616,6 +1645,12 @@
             aida.histogram1D("Cluster size " + sides[side]).fill(cl.getSize());
             aida.histogram1D("Cluster size").fill(cl.getSize());
 
+            aida.histogram1D("Cluster hit X-Xcenter " + sides[side]).fill(cl.getPosition()[0]-posAtCenter[0]);
+            aida.histogram1D("Cluster hit Y-Ycenter " + sides[side]).fill(cl.getPosition()[1]-posAtCenter[1]);
+
+            aida.histogram2D("Cluster hit X vs X-Xcenter " + sides[side]).fill(cl.getPosition()[0],cl.getPosition()[0]-posAtCenter[0]);
+            aida.histogram2D("Cluster hit Y vs Y-Ycenter " + sides[side]).fill(cl.getPosition()[1],cl.getPosition()[1]-posAtCenter[1]);
+
             
               
             double cl_theta = getSimpleClusterTheta(cl,TARGETZ,0.0);
@@ -1681,61 +1716,35 @@
                 else aida.histogram1D("Bottom cluster theta sel").fill(-1*cl_theta);
             }
 
-            
-            
-            
-           
-            
-
                 trkMatchTool.setCluster(cl);
                 trkMatchTool.match(tracks);
 
-
-
-                aida.histogram2D("allcl_clEtrkdr_all").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrack());
-                if(cl.getPosition()[1]>0) aida.histogram2D("allcl_clEtrkdr_top").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrack());
-                else aida.histogram2D("allcl_clEtrkdr_bottom").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrack());
-
-                aida.histogram2D("allcl_clEtrkdx_all").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrackInX());
-                if(cl.getPosition()[1]>0) aida.histogram2D("allcl_clEtrkdx_top").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrackInX());
-                else aida.histogram2D("allcl_clEtrkdx_bottom").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrackInX());
-
-                aida.histogram2D("allcl_clEtrkdy_all").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrackInY());
-                if(cl.getPosition()[1]>0) aida.histogram2D("allcl_clEtrkdy_top").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrackInY());
-                else aida.histogram2D("allcl_clEtrkdy_bottom").fill(cl.getEnergy(),trkMatchTool.getDistanceToTrackInY());
-
+                
+                
 
 
 
                 //IHistogram2D heff = hf.divide(aida.histogram2D("allcl_clEtrkdr_all").title(), aida.histogram2D("allcl_clEtrkdr_all"), aida.histogram2D("allcl_clEtrkdr_all"))
 
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdr_all"),aida.histogram1D("allcl_clEtrkdr_eff_all"));
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdr_bottom"),aida.histogram1D("allcl_clEtrkdr_eff_bottom"));
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdr_top"),aida.histogram1D("allcl_clEtrkdr_eff_top"));            
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdx_all"),aida.histogram1D("allcl_clEtrkdx_eff_all"));
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdx_bottom"),aida.histogram1D("allcl_clEtrkdx_eff_bottom"));
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdx_top"),aida.histogram1D("allcl_clEtrkdx_eff_top"));
-
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdy_all"),aida.histogram1D("allcl_clEtrkdy_eff_all"));
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdy_top"),aida.histogram1D("allcl_clEtrkdy_eff_top"));
-                fillReset2DEff(aida.histogram2D("allcl_clEtrkdy_bottom"),aida.histogram1D("allcl_clEtrkdy_eff_bottom"));
-
+               
 
                 if(trkMatchTool.isMatched(9999.9)) { //just make sure something is in the tracker for these plots
-                    aida.histogram1D("allcl_cltrkdr_all").fill(trkMatchTool.getDistanceToTrack());
-                    if(cl.getPosition()[1]>0) aida.histogram1D("allcl_cltrkdr_top").fill(trkMatchTool.getDistanceToTrack());
-                    else aida.histogram1D("allcl_cltrkdr_bottom").fill(trkMatchTool.getDistanceToTrack());
-
-                    aida.histogram1D("allcl_cltrkdx_all").fill(trkMatchTool.getDistanceToTrackInX());
-                    if(cl.getPosition()[1]>0) aida.histogram1D("allcl_cltrkdx_top").fill(trkMatchTool.getDistanceToTrackInX());
-                    else aida.histogram1D("allcl_cltrkdx_bottom").fill(trkMatchTool.getDistanceToTrackInX());
-
-                    aida.histogram1D("allcl_cltrkdy_all").fill(trkMatchTool.getDistanceToTrackInY());
-                    if(cl.getPosition()[1]>0) aida.histogram1D("allcl_cltrkdy_top").fill(trkMatchTool.getDistanceToTrackInY());
-                    else aida.histogram1D("allcl_cltrkdy_bottom").fill(trkMatchTool.getDistanceToTrackInY());
+                    
+
+                    if(cl.getPosition()[1]>0) {
+                        aida.histogram1D("Cluster X - track X top").fill(trkMatchTool.getDistanceToTrackInX());
+                        aida.histogram1D("Cluster Y - track Y top").fill(trkMatchTool.getDistanceToTrackInY());
+                    }
+                    else {
+                        aida.histogram1D("Cluster X - track X bottom").fill(trkMatchTool.getDistanceToTrackInX());
+                        aida.histogram1D("Cluster Y - track Y bottom").fill(trkMatchTool.getDistanceToTrackInY());              
+                    }
 
+                   
                 }
 
+                
+                
 
 
                 if(trkMatchTool.isMatched(20.0)) { 
@@ -1905,6 +1914,17 @@
                     else aida.histogram1D("Matched bottom track Chi2").fill(trkMatchTool.getMatchedTrack().getChi2()); 
 
 
+                    
+                    if((nevents % refreshRate) == 0) {
+                        IHistogram1D heff = hf.divide(aida.histogram1D("Matched top track Pz").title(), aida.histogram1D("Matched top track Pz"), aida.histogram1D("Top track Pz"));
+                        plotter_cltrkmatchE.region(2).clear();
+                        plotter_cltrkmatchE.region(2).plot(heff);
+                        IHistogram1D heff2 = hf.divide(aida.histogram1D("Matched bottom track Pz").title(), aida.histogram1D("Matched bottom track Pz"), aida.histogram1D("Bottom track Pz"));
+                        plotter_cltrkmatchE.region(5).clear();
+                        plotter_cltrkmatchE.region(5).plot(heff2);
+        
+                    }
+                    
 
 
                     ExtendTrack exttrk = new ExtendTrack();
@@ -2311,21 +2331,6 @@
   */
     }
 
-    private void fillReset2DEff(IHistogram2D h,IHistogram1D heff) {
-        heff.reset();
-        int num_bin;
-        for(int bin=1;bin<heff.axis().bins();++bin) {
-            num_bin = h.yAxis().coordToIndex(-1);
-            double d = (double)h.binEntriesX(bin);
-            double n = (double)h.binEntries(bin, num_bin);
-            double eff;
-            if(d==0) eff=0;
-            else eff = n/d;
-            heff.fill(heff.axis().binCenter(bin), eff);
-            
-        }
-    }
-
     
       
         private void tagAndProbe(List<HPSEcalCluster> clusters) {
@@ -2418,6 +2423,19 @@
     
     public void endOfData() {
         
+        //Print out ecal channels with no hits
+        IHistogram2D h = aida.histogram2D("Crystal hit map all");
+        System.out.println("Crystals with no hits:");
+        for(int iy=-5;iy<=5;++iy) {
+            for(int ix=-23;ix<=23;++ix) {
+            
+                int n = h.binEntries(h.coordToIndexX(ix), h.coordToIndexY(iy));
+                //System.out.println(ix + " " + iy + "  (" + h.coordToIndexX(ix) + "," + h.coordToIndexY(iy) + ")  n=" + n);
+                if(n==0) System.out.println(ix + " " + iy);
+            }
+        }
+        
+        
         if (outputPlotFileName != "")
         try {
             aida.saveAs(outputPlotFileName);
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1