1 #include "QualityCut.h" 2 #include "UsefulAnitaEvent.h" 12 int quickFixMC(
int n,
const double* x){
14 double lastX = -DBL_MAX;
15 int firstBadPoint = n;
16 for(
int i=0; i < n; i++){
48 ssc.
apply(usefulEvent, sum);
51 stbc.
apply(usefulEvent, sum);
54 npc.
apply(usefulEvent, sum);
56 Bool_t isGood = (ssc.eventPassesCut && stbc.eventPassesCut && npc.eventPassesCut);
58 sum->flags.isGood = isGood;
75 Bool_t isGood = sum->flags.isGood;
77 const char* p =
"passed";
78 const char* f =
"failed";
79 std::cout <<
"Event Summary run " << sum->run <<
" eventNumber " << sum->eventNumber <<
" failed a quality cut: " << std::endl;
80 std::cout <<
"SURF Saturation cut = " << (sum->flags.isVarner ? f : p) <<
", ";
81 std::cout <<
"Payload Blast cut = " << (sum->flags.isPayloadBlast ? f : p) <<
", ";
82 std::cout <<
"Num points cut = " << (sum->flags.isVarner2 ? f : p) << std::endl;
110 eventPassesCut =
true;
111 description =
"Surf saturation cut, looks for max volts / min volts and the asymmetry between them";
130 for(
int ant=0; ant < NUM_SEAVEYS; ant++){
132 const double* volts = useful->
fVolts[chanIndex];
133 const int n = useful->
fNumPoints[chanIndex] == NUM_SAMP ? quickFixMC(NUM_SAMP, useful->
fTimes[chanIndex]) : useful->
fNumPoints[chanIndex];
135 double maxThisChan = TMath::MaxElement(n, volts);
136 double minThisChan = TMath::MinElement(n, volts);
138 if(maxThisChan > maxVolts){
139 maxVolts = maxThisChan;
143 if(minThisChan < minVolts){
144 minVolts = minThisChan;
149 double asymThisChan = TMath::Abs(maxVolts + minVolts);
150 if(asymThisChan > asymVolts){
151 asymVolts = asymThisChan;
158 if(maxVolts > maxLimit || minVolts < minLimit || asymVolts > asymLimit){
159 eventPassesCut =
false;
166 eventPassesCut =
true;
171 sum->flags.isVarner = 0;
174 sum->flags.isVarner = 1;
200 eventPassesCut =
true;
201 description =
"Removes events with where the peak-to-peak in the top ring is significantly lower than the bottom ring channel with the largest peak-to-peak.";
219 int anitaVersion = AnitaVersion::get();
223 sum->flags.nSectorsWhereBottomExceedsTop = 0;
226 sum->flags.maxBottomToTopRatio[polInd] = -9999;
227 sum->flags.maxBottomToTopRatioSector[polInd] = -1;
228 sum->flags.minBottomToTopRatio[polInd] = 9999;
229 sum->flags.minBottomToTopRatioSector[polInd] = -1;
236 Double_t maxPeakToPeak = 0;
239 for(
int phi=0; phi < NUM_PHI; phi++){
250 int ant = phi + NUM_PHI*ring;
254 const int n = gr->GetN() == NUM_SAMP ? quickFixMC(gr->GetN(), gr->GetX()) : gr->GetN();
255 while(gr->GetN() > n) gr->RemovePoint(gr->GetN()-1);
257 Double_t maxY, maxX, minY, minX;
258 RootTools::getLocalMaxToMin((
const TGraph*)gr, maxY, maxX, minY, minX);
262 Double_t p2p = maxY - minY;
264 peakToPeaks[ring][phi] = p2p;
266 if(ring > 0 && p2p > maxPeakToPeak){
271 sum->flags.nSectorsWhereBottomExceedsTop++;
277 int ant = (maxAnt%NUM_PHI);
280 p2pTop = peakToPeaks[ant/NUM_PHI][ant % NUM_PHI];
283 Double_t ratio = p2pTop > 0 ? maxPeakToPeak/p2pTop : -1;
286 sum->flags.maxBottomToTopRatio[pol] = ratio;
287 sum->flags.maxBottomToTopRatioSector[pol] = maxAnt;
288 sum->flags.minBottomToTopRatio[pol] = maxPeakToPeak;
291 if(ratio > ratioCutHigh || ratio < ratioCutLow){
292 eventPassesCut =
false;
295 eventPassesCut =
true;
299 sum->flags.isPayloadBlast = 0;
302 sum->flags.isPayloadBlast = 1;
322 numPointsCutLow = 200;
323 description =
"Checks there are a reasonable number of points in each waveform.";
340 eventPassesCut =
true;
344 if(sum->mc.weight==0){
346 for(
int chanIndex=0; chanIndex < NUM_CHAN*NUM_SURF; chanIndex++){
347 const int numPoints = useful->
fNumPoints[chanIndex];
348 if(numPoints < numPointsCutLow){
349 eventPassesCut =
false;
358 sum->flags.isVarner2 = 1;
361 sum->flags.isVarner2 = 0;
virtual void apply(const UsefulAnitaEvent *useful, AnitaEventSummary *sum=NULL)
static Bool_t applyAll(const UsefulAnitaEvent *usefulEvent, AnitaEventSummary *sum=NULL)
Applies all the event quality cuts in succession, this should be the primary interface.
Tries to find unphysical spikes in a waveform that are characteristic of a kind of digitiser corrupti...
double fVolts[12 *9][260]
Array of unwrapped (unless kNoCalib) voltages for each channel.
int fNumPoints[12 *9]
Number of poins per channel.
virtual void apply(const UsefulAnitaEvent *useful, AnitaEventSummary *sum=NULL)
Applies the SurfSaturation cut.
virtual void apply(const UsefulAnitaEvent *useful, AnitaEventSummary *sum=NULL)
Apply the number of points cut.
Base class from which all my quality cuts inherit.
TGraph * getGraph(int chanIndex) const
Returns a voltage-time waveform for given channel index.
UsefulAnitaEvent – The Calibrated Useful Anita Event object.
Tries to determine whether an event is a payload blast.
Removes events which have short waveforms.
static Bool_t passedAll(const AnitaEventSummary *sum, bool describe=false)
Reads the flags set in AnitaEventSummary, returns true if the event passed all quality cuts...
Common analysis format between UCorrelator and Acclaim.
NumPointsCut()
Constructor for the number of points cut, contains some hard coded numbers.
enum AnitaPol::EAnitaPol AnitaPol_t
Polarisation enumeration.
SurfSaturationCut()
Constructor for the SurfSaturation cut, sets some hard coded default values.
double fTimes[12 *9][260]
Array of unwrapped (unless kNoCalib) times for each channel.