Skip to content

Commit

Permalink
Robot wuz activate
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jun 26, 2024
1 parent 410c6c9 commit f335e82
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ public class ShaperPileupFitAlgorithm implements ShaperFitAlgorithm {
ShaperLinearFitAlgorithm twoPulseFitter = new ShaperLinearFitAlgorithm(2);
private String fitTimeMinimizer = "Simplex";
private boolean debug = false;
private double refitThreshold = 0.5;
private double refitThreshold = .75;
private int totalFits = 0;
private int refitAttempts = 0;
private int refitsAccepted = 0;

private int doOldDT = 1;

public ShaperPileupFitAlgorithm() {
}

public ShaperPileupFitAlgorithm(double threshold) {
public ShaperPileupFitAlgorithm(double threshold,int DT) {
//System.out.print("Statement in Constructor");
//System.out.print(threshold);
refitThreshold = threshold;
doOldDT = DT;
}

@Override
Expand All @@ -29,18 +33,25 @@ public void setFitTimeMinimizer(String fitTimeMinimizer) {

//===> public Collection<ShapeFitParameters> fitShape(RawTrackerHit rth, HPSSVTCalibrationConstants.ChannelConstants constants) {
public Collection<ShapeFitParameters> fitShape(RawTrackerHit rth, PulseShape shape) {
//System.out.print(refitThreshold);
//===> Collection<ShapeFitParameters> fittedPulses = onePulseFitter.fitShape(rth, constants);
Collection<ShapeFitParameters> fittedPulses = onePulseFitter.fitShape(rth, shape);
double singlePulseChiProb = fittedPulses.iterator().next().getChiProb();
//double time1 = fittedPulses.iterator().next().getT0();
totalFits++;
if (singlePulseChiProb < refitThreshold) {
refitAttempts++;
//===> Collection<ShapeFitParameters> doublePulse = twoPulseFitter.fitShape(rth, constants);
Collection<ShapeFitParameters> doublePulse = twoPulseFitter.fitShape(rth, shape);
double doublePulseChiProb = doublePulse.iterator().next().getChiProb();
ShapeFitParameters Hello = doublePulse.iterator().next();
double doublePulseChiProb = Hello.getChiProb();
double time1 = Hello.getT0();
double time2 = fittedPulses.iterator().next().getT0();
if (doublePulseChiProb > singlePulseChiProb) {
refitsAccepted++;
fittedPulses = doublePulse;
if(((time2-time1)*(time2-time1)>40.0)||(doOldDT==1)){
refitsAccepted++;
fittedPulses = doublePulse;
}
}
}
if (debug && totalFits % 10000 == 0) {
Expand Down

0 comments on commit f335e82

Please sign in to comment.