Author: [log in to unmask]
Date: Fri Dec 9 08:55:27 2016
New Revision: 4617
Log:
updated the energy mc smearing and rf time correction to avoid bug when cluster list has size 0
Modified:
java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java
java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterRFTimeCorrDriver.java
Modified: java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java
=============================================================================
--- java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java (original)
+++ java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java Fri Dec 9 08:55:27 2016
@@ -25,9 +25,9 @@
// Variables derived as the difference between data and mc noise in
// ecal cluster energy resolution.
- static final double A = -0.0000981;
- static final double B = 0.0013725;
- static final double C = 0.00301;
+ static final double A = -0.00000981;
+ static final double B = 0.00013725;
+ static final double C = 0.000301;
// Calculate the noise factor to smear the Ecal energy by
private static double calcNoise(double energy){
Modified: java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterRFTimeCorrDriver.java
=============================================================================
--- java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterRFTimeCorrDriver.java (original)
+++ java/branches/branch-1116Fixes/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterRFTimeCorrDriver.java Fri Dec 9 08:55:27 2016
@@ -51,32 +51,34 @@
double clT = parameter[0];
double selectedClT = parameter[0];
double rfT = parameter[0];
- int seedX = 1;
- int seedY = 1;
+ int seedX = 0;
+ int seedY = 0;
int jj=0;
//read in ecal clusters, choose the highest energy cluster in the trigger time window
if (event.hasCollection(Cluster.class, "EcalClusters")){
- while (foundTdiff==false){
- jj++;
- // Get the list of clusters in the event
+ // Get the list of clusters in the event
List<Cluster> cl = event.get(Cluster.class, "EcalClusters");
// Sort the clusters as highest to lowest energy
Comparator<Cluster> comparator = new ClusterUtilities.ClusterSeedComparator();
- ClusterUtilities.sort(cl,comparator, true,true);
+ ClusterUtilities.sort(cl,comparator, true,true);
+ int listSize = cl.size();
+ while (foundTdiff==false){
+ if (listSize==0){break;}
+ //choose the highest seed energy cluster in the time window
+ for (Cluster cc : cl){
+ clT = ClusterUtilities.getSeedHitTime(cc);
+ if (clT>parameter[1]-jj*10 && clT<parameter[2]+jj*10){
+ foundTdiff = true;
+ selectedClT = clT;
+ seedX = ClusterUtilities.findSeedHit(cc).getIdentifierFieldValue("ix");
+ seedY = ClusterUtilities.findSeedHit(cc).getIdentifierFieldValue("iy");
+ break;
+ }//end if
+ }//end for
+ jj++;
+ }//end while
+ }//end if has clusters
- //choose the highest seed energy cluster in the time window
- for (Cluster cc : cl){
- clT = ClusterUtilities.getSeedHitTime(cc);
- if (clT>parameter[1]-jj*10 && clT<parameter[2]+jj*10){
- foundTdiff = true;
- selectedClT = clT;
- seedX = ClusterUtilities.findSeedHit(cc).getIdentifierFieldValue("ix");
- seedY = ClusterUtilities.findSeedHit(cc).getIdentifierFieldValue("iy");
- break;
- }
- }
- }//end if cluster
- }
double jitter=0;
//read in rf time
if (event.hasCollection(GenericObject.class, "RFHits")) {
@@ -87,10 +89,8 @@
jitter = ((rfT-selectedClT+400*2.004) % 2.004) - 1.002;
selectedClT-=jitter;
}
-
- if (foundTdiff){
- triggerTime.add(new TriggerTime(selectedClT, seedX,seedY));
- }
+
+ triggerTime.add(new TriggerTime(selectedClT, seedX,seedY));
event.put("TriggerTime", triggerTime, TriggerTime.class, 1);
}//end process event
|