Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/SteveMagill on MAIN | |||
CorrScHitDriver.java | +85 | added 1.1 |
diff -N CorrScHitDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ CorrScHitDriver.java 14 Feb 2012 19:40:12 -0000 1.1 @@ -0,0 +1,85 @@
+package org.lcsim.contrib.SteveMagill; + +import hep.aida.ITree; +import java.util.*; +import org.lcsim.event.CalorimeterHit; +import org.lcsim.event.EventHeader; +import org.lcsim.util.Driver; +import org.lcsim.util.aida.AIDA; +import org.lcsim.recon.cluster.util.*; + +public class CorrScHitDriver extends Driver +{ + private AIDA aida = AIDA.defaultInstance(); + private ITree _tree; + private String[] _snames; + private String[] _cnames; + private double _escalib; + private double _eccalib; + private double _p1; + private double _p2; + private double _p3; + private double _p4; + private boolean hitdb = true; + + /** Creates a new instance of SimpleClusterToReconstructedParticleExampleDriver */ + public CorrScHitDriver(double scfactor, double ccfactor, double p1, double p2, double p3, double p4) + { + _tree = aida.tree(); + _escalib = scfactor; // calibration factor for scint cell energy + _eccalib = ccfactor; // calibration factor for ceren cell energy + _p1 = p1; // polynomial factors for CS correction + _p2 = p2; + _p3 = p3; + _p4 = p4; + } + + protected void process(EventHeader event) + { + + // get scintillator hits from event and form Esum + double scEsum = 0; + for (int i=0; i<_snames.length; i++) + { + List<CalorimeterHit> schits = event.get(CalorimeterHit.class,_snames[i]); + for (CalorimeterHit sch : schits) + { +// long shid = schit.getCellID(); + scEsum += _escalib*sch.getCorrectedEnergy(); // electron calibration + } + } + + // get cerenkov hits from event and form Esum + double chEsum = 0; + for (int i=0; i<_cnames.length; i++) + { + List<CalorimeterHit> chhits = event.get(CalorimeterHit.class,_cnames[i]); + for (CalorimeterHit chh : chhits) + { +// long shid = schit.getCellID(); + chEsum += _eccalib*chh.getCorrectedEnergy(); // electron calibration + } + } + +// now do correction using all hits + double csrat = chEsum/scEsum; + if (csrat>1.) csrat = 1.; +// System.out.println(" CS Ratio " + csrat); + double cScHitE = scEsum/(_p1+_p2*csrat+_p3*csrat*csrat+_p4*csrat*csrat*csrat); + if (hitdb) aida.cloud1D("Uncorr Scintillator Hit ESum").fill(scEsum); + if (hitdb) aida.cloud1D("CS Corrected Scintillator Esum").fill(cScHitE); + if (hitdb) aida.cloud1D("C over S for this particle").fill(csrat); + if (hitdb) aida.cloud1D("CS Polynomial Correction Factor").fill(_p1+_p2*csrat+_p3*csrat*csrat+_p4*csrat*csrat*csrat); + + } + + public void setInputScHitNames(String[] snames) + { + _snames = snames; + } + public void setInputChHitNames(String[] cnames) + { + _cnames = cnames; + } + +}
\ No newline at end of file
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