Author: [log in to unmask]
Date: Wed Dec 10 13:15:16 2014
New Revision: 1674
Log:
Rename cosmic analysis classes so that the names are more clear. Add javadoc to methods and improve the class documentation.
Added:
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CosmicClusterDriver.java
- copied, changed from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CosmicClusterPlotsDriver.java
- copied, changed from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterPlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CrystalEnergyPlotsDriver.java
- copied, changed from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalEnergyPlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeADCHistogramDriver.java
- copied, changed from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCPlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeADCProfileDriver.java
- copied, changed from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCProfilePlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeHitSelectionDriver.java
- copied, changed from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitSelectionDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeSignalFitDriver.java
- copied, changed from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitFitDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeSignalFitFunction.java
- copied, changed from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalWindowModeFitFunction.java
Removed:
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCPlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCProfilePlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCThresholdPlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterPlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitFitDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitSelectionDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalEnergyPlotsDriver.java
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalWindowModeFitFunction.java
Modified:
java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/LandauPdf.java
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CosmicClusterDriver.java (from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CosmicClusterDriver.java Wed Dec 10 13:15:16 2014
@@ -21,13 +21,26 @@
import org.lcsim.util.Driver;
/**
- * Cluster input hit list of raw ECAL data for cosmic events.
+ * <p>
+ * This Driver clusters an input list of CalorimeterHits into a cosmic cluster
+ * using an iterative nearest neighbors algorithm.
+ * <p>
+ * There is a set of cuts applied on the initial cluster list that includes the following:
+ * <ul>
+ * <li>must have at least 3 hits total in the cluster</li>
+ * <li>must have at least 3 contiguous hits in the cluster</li>
+ * <li>must have at least three rows of crystals with hits</li>
+ * <li>must have no more than 2 hits in each row of crystals</li>
+ * </ul>
+ * <p>
+ * The new Cluster collection is written to the LCIO event with the default
+ * collection name of "EcalCosmicClusters". This collection name can be changed
+ * using the {@link #setOutputClusterCollectionName(String)} method.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Tim "THammer" Nelson <[log in to unmask]>
*/
-// TODO: Add output collection of RawTrackerHits.
-public class EcalCosmicClusterDriver extends Driver {
+public class CosmicClusterDriver extends Driver {
String inputHitCollectionName = "EcalCosmicCalHits";
String outputClusterCollectionName = "EcalCosmicClusters";
@@ -38,30 +51,60 @@
int minimumRows = 3;
int maximumHitsPerRow = 2;
+ /**
+ * Set the name of the ECAL subdetector.
+ * @param ecalName The name of the ECAL subdetector.
+ */
public void setEcalName(String ecalName) {
this.ecalName = ecalName;
}
+ /**
+ * Set the name of the input RawTrackerHit collection name.
+ * By default this is initialized to "EcalCosmicCalHits".
+ * @param inputHitCollectionName The name of the input hit collection.
+ */
public void setInputHitCollectionName(String inputHitCollectionName) {
this.inputHitCollectionName = inputHitCollectionName;
}
+ /**
+ * Set the name of the output cluster collection.
+ * By default this is initialized to "EcalCosmicClusters".
+ * @param outputClusterCollectionName The name of the output cluster collection.
+ */
public void setOutputClusterCollectionName(String outputClusterCollectionName) {
this.outputClusterCollectionName = outputClusterCollectionName;
}
+ /**
+ * Set the minimum number of hits in the cluster for it to pass selection.
+ * @param minimumClusterSize The minimum number of hits in the cluster.
+ */
public void setMinimumClusterSize(int minimumClusterSize) {
this.minimumClusterSize = minimumClusterSize;
}
+ /**
+ * Set the minimum number of rows that must have at least one hit.
+ * @param minimumRows The minimum number of rows that must have at least one hit.
+ */
public void setMinimumRows(int minimumRows) {
this.minimumRows = minimumRows;
}
+ /**
+ * Set the maximum number of hits per row.
+ * @param maximumHitsPerRow The maximum number of hits per row.
+ */
public void setMaximumHitsPerRow(int maximumHitsPerRow) {
this.maximumHitsPerRow = maximumHitsPerRow;
}
+ /**
+ * Initialize conditions dependent class variables.
+ * @param detector The current Detector object.
+ */
public void detectorChanged(Detector detector) {
ecal = (HPSEcal3) detector.getSubdetector(ecalName);
if (ecal == null) {
@@ -73,6 +116,10 @@
}
}
+ /**
+ * Process the event by making a list of output clusters that pass the basic
+ * selection cuts.
+ */
public void process(EventHeader event) {
if (event.hasCollection(CalorimeterHit.class, inputHitCollectionName)) {
List<CalorimeterHit> calHits = event.get(CalorimeterHit.class, inputHitCollectionName);
@@ -89,16 +136,17 @@
calCluster.setEnergy(totalEnergy);
clusterCollection.add(calCluster);
}
- //if (clusterCollection.size() > 0) {
int flags = 1 << LCIOConstants.CLBIT_HITS;
event.put(outputClusterCollectionName, clusterCollection, Cluster.class, flags);
- //System.out.println("added " + clusterCollection.size() + " clusters to " + outputClusterCollectionName);
- //} else {
- // throw new NextEventException();
- //}
- }
- }
-
+ }
+ }
+
+ /**
+ * Given a hit, find its list of neighboring crystals that have hits and return their IDs.
+ * @param hit The input hit.
+ * @param hitMap The hit map with all the collection's hits.
+ * @return The set of neighboring hit IDs.
+ */
private Set<Long> findNeighborHitIDs(CalorimeterHit hit, Map<Long, CalorimeterHit> hitMap) {
Set<Long> neigbhors = ecal.getNeighborMap().get(hit.getCellID());
Set<Long> neighborHitIDs = new HashSet<Long>();
@@ -110,6 +158,11 @@
return neighborHitIDs;
}
+ /**
+ * Create a map of ID to hit from a list of hits.
+ * @param hitList The input hit list.
+ * @return The hit map.
+ */
private Map<Long, CalorimeterHit> createHitMap(List<CalorimeterHit> hitList) {
Map<Long, CalorimeterHit> hitMap = new HashMap<Long, CalorimeterHit>();
for (CalorimeterHit hit : hitList) {
@@ -118,6 +171,14 @@
return hitMap;
}
+ /**
+ * This is the primary clustering algorithm which uses a topological, iterative
+ * nearest neighbor algorithm. It uses each hit as a seed and tries to then
+ * extend the cluster by adding neighboring hits. Clustered hits are added
+ * to a list which is checked so that they are not reused.
+ * @param hitList The input hit list from the event.
+ * @return A list of calorimeter hits that can be turned into clusters.
+ */
private List<List<CalorimeterHit>> createClusteredHits(List<CalorimeterHit> hitList) {
// Create empty list of clusters which are just lists of hits.
@@ -168,13 +229,18 @@
}
if (clusterHits.size() >= this.minimumClusterSize) {
- //System.out.println("adding cosmic cluster of size " + clusterHits.size());
clusterList.add(clusterHits);
}
}
return clusterList;
}
+ /**
+ * This method takes a list of potential cluster hits and applies selection cuts,
+ * returning a new list that has the hit lists which did not pass the cuts removed.
+ * @param clusteredHitLists The input hit lists.
+ * @return The hit lists that passed the cuts.
+ */
List<List<CalorimeterHit>> applyCuts(List<List<CalorimeterHit>> clusteredHitLists) {
List<List<CalorimeterHit>> selectedHitLists = new ArrayList<List<CalorimeterHit>>();
for (List<CalorimeterHit> hitList : clusteredHitLists) {
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CosmicClusterPlotsDriver.java (from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterPlotsDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicClusterPlotsDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CosmicClusterPlotsDriver.java Wed Dec 10 13:15:16 2014
@@ -39,7 +39,7 @@
* Create ADC value plots from the cosmic clusters.
* @author Jeremy McCormick <[log in to unmask]>
*/
-public class EcalCosmicClusterPlotsDriver extends Driver {
+public class CosmicClusterPlotsDriver extends Driver {
EcalConditions conditions = null;
EcalChannelCollection channels = null;
@@ -167,7 +167,7 @@
buffer.append("ecal_channel_id t0 pulse_width");
buffer.append('\n');
- AbstractIFunction fitFunction = new EcalWindowModeFitFunction();
+ AbstractIFunction fitFunction = new RawModeSignalFitFunction();
functionFactory.catalog().add("ecal_fit_function", fitFunction);
for (Entry<EcalChannel, IProfile1D> entry : this.adcProfiles.entrySet()) {
doFit(entry.getKey(), entry.getValue());
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CrystalEnergyPlotsDriver.java (from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalEnergyPlotsDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalEnergyPlotsDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/CrystalEnergyPlotsDriver.java Wed Dec 10 13:15:16 2014
@@ -23,10 +23,11 @@
import org.lcsim.util.aida.AIDA;
/**
- * This Driver will create a histogram for every channel in the ECAL and plot its corrected energy.
+ * This Driver will create a histogram for every crystal in the ECAL and plot its corrected energy
+ * for the event.
* @author Jeremy McCormick <[log in to unmask]>
*/
-public class EcalEnergyPlotsDriver extends Driver {
+public class CrystalEnergyPlotsDriver extends Driver {
EcalConditions conditions = null;
EcalChannelCollection channels = null;
Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/LandauPdf.java
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/LandauPdf.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/LandauPdf.java Wed Dec 10 13:15:16 2014
@@ -2,9 +2,9 @@
/**
* <p>
- * Landau Probability Distribution
+ * Landau probability distribution function (PDF) implementation to be used for fitting.
* <p>
- * Copied from math/mathcore/src/ProbFuncMathCore.cxx::landau_pdf in ROOT (version 5.34.18).
+ * Copied from ROOT class <code>math/mathcore/src/ProbFuncMathCore.cxx::landau_pdf</code> (version 5.34.18).
*/
public class LandauPdf {
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeADCHistogramDriver.java (from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCPlotsDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCPlotsDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeADCHistogramDriver.java Wed Dec 10 13:15:16 2014
@@ -24,10 +24,10 @@
/**
* This Driver will create a histogram for every channel in the ECAL and plot its ADC values
- * from the LCSim event collection of raw hits.
+ * from the LCSim event collection of raw mode hits, without performing any pedestal subtraction.
* @author Jeremy McCormick <[log in to unmask]>
*/
-public class EcalADCPlotsDriver extends Driver {
+public class RawModeADCHistogramDriver extends Driver {
EcalConditions conditions = null;
EcalChannelCollection channels = null;
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeADCProfileDriver.java (from r1673, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCProfilePlotsDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalADCProfilePlotsDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeADCProfileDriver.java Wed Dec 10 13:15:16 2014
@@ -1,18 +1,11 @@
package org.hps.analysis.ecal.cosmic;
import hep.aida.IAnalysisFactory;
-import hep.aida.IFitFactory;
-import hep.aida.IFitResult;
-import hep.aida.IFitter;
-import hep.aida.IFunction;
-import hep.aida.IFunctionFactory;
import hep.aida.IProfile1D;
-import hep.aida.ref.fitter.FitResult;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import org.hps.conditions.database.TableConstants;
import org.hps.conditions.ecal.EcalChannel;
@@ -26,9 +19,10 @@
import org.lcsim.util.aida.AIDA;
/**
+ * This Driver makes profile plots of the raw mode ADC data.
* @author Jeremy McCormick <[log in to unmask]>
*/
-public class EcalADCProfilePlotsDriver extends Driver {
+public class RawModeADCProfileDriver extends Driver {
EcalConditions conditions = null;
EcalChannelCollection channels = null;
@@ -45,7 +39,7 @@
conditions = ConditionsManager.defaultInstance().getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
channels = conditions.getChannelCollection();
for (EcalChannel channel : conditions.getChannelCollection()) {
- adcProfiles.put(channel, aida.profile1D(inputHitsCollectionName + "/ : ADC Values : " + String.format("%03d", channel.getChannelId()), 100, 0, 100));
+ adcProfiles.put(channel, aida.profile1D(inputHitsCollectionName + "/ADC Values : " + String.format("%03d", channel.getChannelId()), 100, 0, 100));
}
}
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeHitSelectionDriver.java (from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitSelectionDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitSelectionDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeHitSelectionDriver.java Wed Dec 10 13:15:16 2014
@@ -20,14 +20,15 @@
/**
* This Driver will process ECAL raw mode (window) data and extract hits
- * that look like signal, by requiring a certain number of ADC samples
- * in a row that are above a sigma threshold. For events with number
- * of hits greater than a minimum (5 by default), it will convert
- * the raw data into CalorimeterHits and write them to an output
- * collection.
+ * that look like signal by using a simple selection cut. The cut requires
+ * that a certain number of ADC samples in a row are above a sigma threshold.
+ * Then those events that have at least a minimum number of hits that pass
+ * this cut will be written into a new collection. If there are not enough
+ * hits to pass this last cut, then the event is automatically skipped.
+ *
* @author Jeremy McCormick <[log in to unmask]>
*/
-public class EcalCosmicHitSelectionDriver extends Driver {
+public class RawModeHitSelectionDriver extends Driver {
EcalConditions conditions = null;
EcalChannelCollection channels = null;
@@ -53,28 +54,45 @@
}
/**
- * Set the number of hits in a row which must be above threshold for the ADC values to be
- * saved for the event.
- * @param selectedHits The minimum number of hits above threshold.
+ * Set the number of ADC samples in a row which must be above the threshold.
+ * @param selectedHits The minimum number of samples above threshold.
*/
public void setMinimumSelectedSamples(int minimumSelectedSamples) {
this.minimumSelectedSamples = minimumSelectedSamples;
}
+ /**
+ * Set the minimum number of hits for the event to pass selection cuts.
+ * @param minimumNumberOfHits The minimum number of hits.
+ */
public void setMinimumNumberOfHits(int minimumNumberOfHits) {
this.minimumNumberOfHits = minimumNumberOfHits;
}
+ /**
+ * Set the name of the output hits collection.
+ * @param outputHitsCollectionName The output hits collection name.
+ */
public void setOutputHitsCollectionName(String outputHitsCollectionName) {
this.outputHitsCollectionName = outputHitsCollectionName;
}
+ /**
+ * Initialize conditions dependent class variables.
+ * @param detector The current Detector object.
+ */
public void detectorChanged(Detector detector) {
ecal = (HPSEcal3)detector.getSubdetector(ecalName);
conditions = ConditionsManager.defaultInstance().getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
channels = conditions.getChannelCollection();
}
+ /**
+ * Process the event, performing selection cuts on the collection of RawTrackerHits
+ * that has a hit for every crystal. Those events that don't have enough hits passing
+ * the cuts are skipped.
+ * @param event The LCIO event.
+ */
public void process(EventHeader event) {
if (event.hasCollection(RawTrackerHit.class, inputHitsCollectionName)) {
List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputHitsCollectionName);
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeSignalFitDriver.java (from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitFitDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalCosmicHitFitDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeSignalFitDriver.java Wed Dec 10 13:15:16 2014
@@ -28,16 +28,21 @@
import org.lcsim.util.aida.AIDA;
/**
- * This Driver will perform a functional fit on ECAL window mode data
+ * <p>
+ * This Driver will perform a function fit on ECAL window mode data
* to determine the likelihood of a signal being present, e.g. from a cosmic
- * ray MIP signal. Those hits with a signal significance greater than a settable
- * threshold (by default 4 sigma) will be written into an output collection
- * of selected hits that can be used by other Drivers.
+ * ray MIP signal. By default, the mean and sigma are fixed in the fit, and the
+ * pedestal and normalization are allowed to float. The pedestal can also be
+ * configured as fixed using the {@link #setFixPedestal(boolean)} method.
+ * <p>
+ * Those hits with a signal significance greater than a settable
+ * threshold (by default set to 4 sigma) will be written into an output collection
+ * of selected hits that can be used by other Drivers.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Tim Nelson <[log in to unmask]>
*/
-public class EcalCosmicHitFitDriver extends Driver {
+public class RawModeSignalFitDriver extends Driver {
// ECAL conditions data.
EcalConditions conditions = null;
@@ -120,7 +125,8 @@
}
/**
- * Perform start of job setup using the detector and conditions information.
+ * Initialize conditions dependent class variables.
+ * @param detector The current Detector object.
*/
public void detectorChanged(Detector detector) {
ecal = (HPSEcal3)detector.getSubdetector(ecalName);
@@ -134,12 +140,13 @@
}
/**
- * Perform initialization to create the DPS for the ADC values and configure the global fit parameters.
+ * Perform start of job initialize.
+ * The DataPointSet for the ADC values is initialized and global fit parameters are set here.
*/
public void startOfData() {
adcDataPointSet = aida.analysisFactory().createDataPointSetFactory(null).create("ADC DataPointSet", 2);
- fitFunction = new EcalWindowModeFitFunction();
+ fitFunction = new RawModeSignalFitFunction();
fitFunction.setParameter("mean", signalMean);
fitFunction.setParameter("sigma", signalSigma);
fitFunction.setParameter("norm", norm);
@@ -153,8 +160,8 @@
/**
* Process the event, performing a signal fit for every raw data hit in the input collection.
- * Those hits that pass the selection cut are added to a new hits collection that can be converted
- * to a CalorimeterHit collection and clustered.
+ * The hits that pass the sigma selection cut are added to a new hits collection, which can be
+ * converted to a CalorimeterHit collection and then clustered.
* @throw NextEventException if there are not enough hits that pass the selection cut.
*/
public void process(EventHeader event) {
@@ -218,9 +225,9 @@
}
/**
- * Fit the ADC samples of a hit, returning the signal significance.
- * @param channel The ECAL channel information.
- * @param adcDataPointSet The DPS to use for the fit containing all 100 ADC samples.
+ * Fit all of the ADC samples in a hit using a DataPointSet and then return the fit result.
+ * @param channel The ECAL channel conditions information.
+ * @param adcDataPointSet The DataPointSet to use for the fit containing all 100 ADC samples.
* @return The significance which is the normalization divided by its error.
*/
IFitResult fitAdcSamples(EcalChannel channel, IDataPointSet adcDataPointSet) {
@@ -229,9 +236,6 @@
IFitResult fitResult = fitter.fit(adcDataPointSet, fitFunction);
this.signalNormHistograms.get(channel).fill(fitResult.fittedParameter("norm"));
this.pedestalNormHistograms.get(channel).fill(fitResult.fittedParameter("pedestal"));
- //double signalSignificance = fitResult.fittedParameter("norm") / fitResult.errors()[2];
- //this.signalSignificanceHistograms.get(channel).fill(signalSignificance);
- //return signalSignificance;
return fitResult;
}
}
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeSignalFitFunction.java (from r1672, java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalWindowModeFitFunction.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/EcalWindowModeFitFunction.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/cosmic/RawModeSignalFitFunction.java Wed Dec 10 13:15:16 2014
@@ -2,26 +2,61 @@
import hep.aida.ref.function.AbstractIFunction;
-public class EcalWindowModeFitFunction extends AbstractIFunction {
+/**
+ * <p>
+ * This class implements a function for fitting a signal plus pedestal
+ * in non-pedestal subtracted raw mode ADC data.
+ * <p>
+ * It has four function parameters:
+ * <ul>
+ * <li><b>mean</b> - the mean of the Landau function
+ * <li><b>sigma</b> - the width of the Landau
+ * <li><b>norm</b> - the normalization parameter
+ * <li><b>pedestal</b> - the pedestal constant
+ * </ul>
+ * <p>
+ * The class is designed to be used with the AIDA fitting API.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @author Tim Nelson <[log in to unmask]>
+ */
+public class RawModeSignalFitFunction extends AbstractIFunction {
+ // This is the backing function used to get the Landau PDF values.
LandauPdf landauPdf = new LandauPdf();
- public EcalWindowModeFitFunction() {
+ /**
+ * No argument constructor.
+ */
+ public RawModeSignalFitFunction() {
this("");
}
- public EcalWindowModeFitFunction(String title) {
+ /**
+ * Constructor with function title.
+ * The no arg constructor uses this one.
+ * @param title The title of the function.
+ */
+ public RawModeSignalFitFunction(String title) {
super();
this.variableNames = new String[] { "x0" };
this.parameterNames = new String[] { "mean", "sigma", "norm", "pedestal" };
init(title);
}
-
+
+ /**
+ * Get the Y value of the Landau function at X.
+ * @value v The input X value (array of length 1).
+ */
@Override
public double value(double[] v) {
return this.parameter("pedestal") + this.parameter("norm") * landauPdf.getValue(v[0]);
}
+ /**
+ * Set a parameter value on the function.
+ * If these are mean or sigma values, they are pushed to the {@link #landauPdf} object.
+ */
@Override
public void setParameter(String key, double value) throws IllegalArgumentException {
super.setParameter(key, value);
@@ -32,6 +67,10 @@
}
}
+ /**
+ * Set all parameters at once.
+ * The mean and sigma are pushed to the {@link #landauPdf} object.
+ */
@Override
public void setParameters(double[] parameters) throws IllegalArgumentException {
super.setParameters(parameters);
|