NuCutter Class Reference

#include <NuCutter.h>

List of all members.

Public Member Functions

 NuCutter ()
 Initialises with no cut.
 NuCutter (NuCut *cut)
 Initialise with an existing cut.
 NuCutter (const TString &anaVersion, const NuPlots *plots=0)
 Initialise the Current object, with an analysis version.
virtual ~NuCutter ()
void SetCut (NuCut *cut)
 Sets a cut.
void SetCut (const TString &anaVersion, const NuPlots *plots=0)
 Sets a cut, from anaversionstring.
NuCutGetCut (void)
Bool_t IsValid ()
 Is this NuCutter object valid?
Bool_t MakeCuts (const NuEvent &nu)
Bool_t MakePreselectionCuts (const NuEvent &nu)
 Applies just the preselection cut.
Bool_t MakeSelectionCuts (const NuEvent &nu)
 Applies just the selection cut.
Bool_t Passed ()
 Returns true if the event counts as passed.
Bool_t Failed ()
 Returns true if the event counts as failed.
Bool_t Passed (const TString &cutname)
 Returns the pass status of a given cut name.
Bool_t Failed (const TString &cutname)
 Returns the fail status of a given cut name.
Bool_t PassedExcept (const TString &cutname)
 Returns the pass status every cut except that named.
Bool_t PassedUpTo (const TString &cutname)
 Returns the pass status every cut up to the named cut.
void PrintSummary (void)
 Prints a summary of all cutted events.
void PrintNMinusOneSummary ()
 Prints a summary of all events removed by a single cut.
void PrintCurrent (void)
 Prints a summary of the current event.
Int_t AnaVersion (void) const
 Returns the AnaVersion numeric signature of the cut.
void ResetStatus (void)
 Resets the stored status of the cut pass.
 ClassDef (NuCutter, 0)

Private Member Functions

NuCutGetNewCutInstance (TString anaVersion, const NuPlots *plots) const

Private Attributes

NuCutfCut
 The Cut to apply.

Detailed Description

A class to apply cuts. Deliberately shares most of the frontend interface of NuCuts. If there is no Cut set, then all functions will return failed.

Definition at line 14 of file NuCutter.h.


Constructor & Destructor Documentation

NuCutter::NuCutter (  ) 

Initialises with no cut.

Definition at line 148 of file NuCutter.cxx.

00148                    : fCut(0)
00149 {
00150   
00151 }

NuCutter::NuCutter ( NuCut cut  ) 

Initialise with an existing cut.

Definition at line 153 of file NuCutter.cxx.

00153                              : fCut(cut)
00154 {
00155   
00156 }

NuCutter::NuCutter ( const TString &  anaVersion,
const NuPlots plots = 0 
)

Initialise the Current object, with an analysis version.

A backwards-compatability constructor, that can pass a NuPlots object. We may want to reconsider the NuPlots interface at some point

Definition at line 160 of file NuCutter.cxx.

References fCut, GetNewCutInstance(), Msg::kFatal, Msg::kInfo, and MSG.

00160                                                                   : fCut(0)
00161 {
00162   // If anaVersion is all numbers, use the backwards compatability cut
00163   if (anaVersion.IsDigit()) {
00164     MSG("NuCutter",Msg::kInfo) << "Falling back to NuCuts-style Cut for anaVersion " << anaVersion << endl;
00165     fCut = new NuCutImps::NuCutsSelection(anaVersion.Atoi(), plots);
00166     
00167   } else {
00168     fCut = GetNewCutInstance(anaVersion, plots);
00169     if (fCut == 0) {
00170       MSG("NuCutter",Msg::kFatal) << "AnaVersion " << anaVersion << " can not be initialised through NuCuts" << endl;
00171     }
00172   }
00173 }

NuCutter::~NuCutter (  )  [virtual]

Definition at line 177 of file NuCutter.cxx.

References fCut.

00178 {
00179   if(fCut) delete fCut;
00180 }


Member Function Documentation

Int_t NuCutter::AnaVersion ( void   )  const [inline]
NuCutter::ClassDef ( NuCutter  ,
 
)
Bool_t NuCutter::Failed ( const TString &  cutname  )  [inline]

Returns the fail status of a given cut name.

Definition at line 79 of file NuCutter.h.

References NuCut::Failed(), and fCut.

00079 { if (!fCut) return false; return fCut->Failed(cutname); }

Bool_t NuCutter::Failed ( void   )  [inline]

Returns true if the event counts as failed.

Definition at line 75 of file NuCutter.h.

References NuCut::Failed(), and fCut.

Referenced by FoverNHistos::MakeDataPlots(), DataStabilityAnalysisClass::MakePlots(), FitTree::MakeVectors(), ToFPlotter::PassCCCuts(), ToFPlotter::PassNCCuts(), and ToFPlotter::PassRAFCuts().

00075 { if (!fCut) return true;  return fCut->Failed(); }

NuCut* NuCutter::GetCut ( void   )  [inline]
NuCut * NuCutter::GetNewCutInstance ( TString  anaVersion,
const NuPlots plots 
) const [private]

Creates a new instance of a cut. This function accepts a string, and returns a corresponding cut. This is designed as an interim solution for a generic cut factory, which is why it (was) private - to discourage use. However, needs have overtaken and currently I have no time to implement a generic factory

When a better solution comes along, this function can be diverted to use that.

Parameters:
anaVersion A string of the cut to make
Returns:
A new cut instance, or else zero. The calling function is responsible for destruction.

Definition at line 18 of file NuCutter.cxx.

References Msg::kError, Msg::kWarning, MAXMSG, and MSG.

Referenced by NuCutter(), and SetCut().

00019 {
00020   // If we are passed in a blank string, return nothing
00021   if (ana == "") return 0;
00022   
00023   // Only compare upper case
00024   ana.ToUpper();
00025   
00026   if (ana == "CC0325STD") {
00027     return new NuCutImps::CC0325Std(plots);
00028   } else if (ana == "RHC0150STD") {
00029     return new NuCutImps::RHC0150Std(plots);
00030   } else if (ana == "RHC0350STD") {
00031     return new NuCutImps::RHC0350Std(plots);
00032   } else if (ana == "RAF0720STD") {
00033       return new NuCutImps::RAF0720Std(plots);
00034   } else if (ana == "RAF0720EXT") {
00035       return new NuCutImps::RAF0720Ext(plots);
00036   } else if (ana == "CC0720TEST") {
00037     return new NuCutImps::CC0720Test(plots);
00038   } else if (ana == "PRESELECTION2010") {
00039     return new NuCutImps::Preselection2010(plots);
00040   } else if (ana == "PRESELECTION2014") {
00041     return new NuCutImps::Preselection2014(plots);
00042   } else if (ana == "CCA" || ana == "CCA_NUBAR" || ana == "CC0720STD"){
00043     if(ana == "CCA"){
00044       MAXMSG("NuCutter", Msg::kWarning, 10)
00045         << "anaVersion CCA is deprecated. You should use CC0720Std instead"
00046         << endl;
00047     }
00048     return new NuCutImps::CC0720Std(plots);
00049   } else if (ana == "CCA_0" || ana == "CCA_1" ||
00050              ana == "CCA_2" || ana == "CCA_3" || ana == "CCA_4") {
00051     int quantile = -1;
00052     if(ana == "CCA_0") quantile = 0;
00053     if(ana == "CCA_1") quantile = 1;
00054     if(ana == "CCA_2") quantile = 2;
00055     if(ana == "CCA_3") quantile = 3;
00056     if(ana == "CCA_4") quantile = 4;
00057     assert(quantile != -1);
00058     return new NuCutImps::CC1070Resolution(plots, ana, quantile);
00059   } else if (ana == "NC0720STD" || ana == "CCA_NC") {
00060     if(ana == "CCA_NC"){
00061       MAXMSG("NuCutter", Msg::kWarning, 10)
00062         << "anaVersion CCA_NC is deprecated. You should use NC0720Std instead"
00063         << endl;
00064     }
00065     return new NuCutImps::NC0720Std(plots);
00066   } else if (ana == "NMBBRAVO" || ana == "BRAVO") {
00067     return new NuCutImps::Bravo(plots);
00068   } else if (ana == "NMBCHARLIE" || ana == "CHARLIE") {
00069     return new NuCutImps::Charlie(plots);
00070   } else if (ana == "NMBDELTA" || ana == "DELTA") {
00071     return new NuCutImps::Delta(plots);
00072   } else if (ana == "NMBBRAVOPRIME" || ana == "BRAVOPRIME") {
00073     return new NuCutImps::BravoPrime(plots);
00074   } else if (ana == "BRAVO0720"){
00075     return new NuCutImps::Bravo0720;
00076   } else if (ana == "CHAIRSOUND") {
00077     return new NuCutImps::ChairSound(plots);
00078   } else if (ana == "RM2") {
00079     return new NuCutImps::RM2(plots);
00080   } else if (ana == "RM0720") {
00081     return new NuCutImps::RM0720(plots);
00082   } else if (ana == "PASS" || ana == "PASSTHROUGH") {
00083     return new NuCutImps::PassThrough(plots);
00084   } else if (ana == "MSROCK_NOV09") {
00085     return new NuCutImps::MSRock_Nov09(plots);
00086   } else if (ana == "NSI2011FHC") {
00087     return new NuCutImps::NSI2011Fhc(plots);
00088   } else if (ana == "NSI2011RHC") {
00089     return new NuCutImps::NSI2011Rhc(plots);
00090   } else if (ana == "RHC0350BFNU") {
00091     return new NuCutImps::RHC0350BFnu(plots);
00092   } else if (ana == "RHC0350BFNUBRAVO") {
00093     return new NuCutImps::RHC0350BFnuBravo(plots);
00094   } else if (ana == "CC0720BFNU") {
00095     return new NuCutImps::CC0720BFnu(plots);
00096   } else if (ana == "BRAVO0720BFNU") {
00097     return new NuCutImps::Bravo0720BFnu(plots);
00098   } else if (ana == "RETROTOFCC") {
00099     return new NuCutImps::RetroToFCC(plots);
00100   } else if (ana == "RETROTOFNC") {
00101     return new NuCutImps::RetroToFNC(plots);
00102   } else if (ana == "RETROTOFRAF") {
00103     return new NuCutImps::RetroToFRAF(plots);
00104   } else if (ana == "PRESELECTIONNC2012") {
00105     return new NuCutImps::PreselectionNC2012(plots);
00106   } else if (ana == "NCPRLCC") {
00107     return new NuCutImps::NCPRLCC(plots);
00108   } else if (ana == "NCPRLNC") {
00109     return new NuCutImps::NCPRLNC(plots);
00110   } else if (ana == "CC1070STD"){
00111     return new NuCutImps::CC1070Std(plots);
00112   } else if (ana == "CC2014"){
00113     return new NuCutImps::CC2014(plots);
00114   } else if (ana == "CC2014NEWCOILCUT"){
00115     return new NuCutImps::CC2014NewCoilCut(plots);
00116   } else if (ana == "NC1056CC") {
00117     return new NuCutImps::NC1056CC(plots);
00118   } else if (ana == "NC1056NC") {
00119     return new NuCutImps::NC1056NC(plots);
00120   } else if (ana == "NC0299MECC") {
00121     return new NuCutImps::NC0299MECC(plots);
00122   } else if (ana == "NC0299MENC") {
00123     return new NuCutImps::NC0299MENC(plots);    
00124   }else {
00125     MSG("NuCutter",Msg::kError) << "Cut named " << ana << " is not recognised!" << endl;
00126     return 0;
00127   }
00128 }

Bool_t NuCutter::IsValid (  )  [inline]

Is this NuCutter object valid?

Definition at line 55 of file NuCutter.h.

References fCut.

00055 { return fCut; }

Bool_t NuCutter::MakeCuts ( const NuEvent nu  ) 

Applies the full cut to this event. This includes both the preselection and selection

Parameters:
nu The NuEvent to cut
Returns:
The conclusion of the cut - true for pass

Definition at line 204 of file NuCutter.cxx.

References fCut, and NuCut::MakeCuts().

Referenced by DataMCPlots::MakeDataPlots(), FoverNHistos::MakeDataPlots(), NuDSTAna::MakeMicroDST(), DataStabilityAnalysisClass::MakePlots(), TemplateAnalysisClass::MakePlots(), NuDSTAna::MakePurityEfficiencyPlotsCCNC(), FitTree::MakeVectors(), ToFPlotter::PassCCCuts(), ToFPlotter::PassNCCuts(), ToFPlotter::PassRAFCuts(), and NuDSTAna::StdNMBAna().

00205 {
00206   if (!fCut) return false;
00207   
00208   return fCut->MakeCuts(nu);
00209 }

Bool_t NuCutter::MakePreselectionCuts ( const NuEvent nu  ) 

Applies just the preselection cut.

Definition at line 213 of file NuCutter.cxx.

References fCut, and NuCut::MakePreselectionCuts().

Referenced by NuDSTAna::MakeCuts(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDst2014(), and NuDSTAna::MakeMicroDstNC2012().

00214 {
00215   if (!fCut) return false;
00216   
00217   return fCut->MakePreselectionCuts(nu);
00218 }

Bool_t NuCutter::MakeSelectionCuts ( const NuEvent nu  ) 

Applies just the selection cut.

Definition at line 222 of file NuCutter.cxx.

References fCut, and NuCut::MakeSelectionCuts().

Referenced by NuDSTAna::MakeCuts().

00223 {
00224   if (!fCut) return false;
00225   
00226   return fCut->MakeSelectionCuts(nu);
00227 }

Bool_t NuCutter::Passed ( const TString &  cutname  )  [inline]

Returns the pass status of a given cut name.

Definition at line 77 of file NuCutter.h.

References fCut, and NuCut::Passed().

00077 { if (!fCut) return false; return fCut->Passed(cutname); }

Bool_t NuCutter::Passed ( void   )  [inline]
Bool_t NuCutter::PassedExcept ( const TString &  cutname  )  [inline]

Returns the pass status every cut except that named.

Definition at line 82 of file NuCutter.h.

References fCut, and NuCut::PassedExcept().

Referenced by DataMCPlots::MakeDataPlots().

00082 { if (!fCut) return false; return fCut->PassedExcept(cutname); }

Bool_t NuCutter::PassedUpTo ( const TString &  cutname  )  [inline]

Returns the pass status every cut up to the named cut.

Definition at line 85 of file NuCutter.h.

References fCut, and NuCut::PassedUpTo().

Referenced by DataMCPlots::FillPlotsNCN_1(), DataMCPlots::MakeDataPlots(), and NuDSTAna::MakePurityEfficiencyPlotsCCNC().

00085 { if (!fCut) return false; return fCut->PassedUpTo(cutname); }

void NuCutter::PrintCurrent ( void   )  [inline]

Prints a summary of the current event.

Definition at line 94 of file NuCutter.h.

References fCut, and NuCut::PrintCurrent().

00094 { if (fCut) fCut->PrintCurrent(); }

void NuCutter::PrintNMinusOneSummary (  )  [inline]

Prints a summary of all events removed by a single cut.

Definition at line 91 of file NuCutter.h.

References fCut, and NuCut::PrintNMinusOneSummary().

Referenced by FoverNHistos::MakeDataPlots(), DataStabilityAnalysisClass::MakePlots(), and FitTree::MakeVectors().

00091 { if (fCut) fCut->PrintNMinusOneSummary(); }

void NuCutter::PrintSummary ( void   )  [inline]
void NuCutter::ResetStatus ( void   )  [inline]
void NuCutter::SetCut ( const TString &  anaVersion,
const NuPlots plots = 0 
)

Sets a cut, from anaversionstring.

Definition at line 192 of file NuCutter.cxx.

References fCut, GetNewCutInstance(), Msg::kFatal, MSG, and SetCut().

00193 {
00194   SetCut(GetNewCutInstance(anaVersion, plots));
00195   // This function will not let you set an invalid cut - this prevents
00196   // errors from not validating the input
00197   if (fCut == 0) {
00198     MSG("NuCutter",Msg::kFatal) << "AnaVersion " << anaVersion << " can not be initialised through NuCuts" << endl;
00199   }
00200 }

void NuCutter::SetCut ( NuCut cut  ) 

Sets a cut.

Definition at line 184 of file NuCutter.cxx.

References fCut.

Referenced by SetCut().

00185 {
00186   if (fCut) delete fCut;
00187   fCut = cut;
00188 }


Member Data Documentation

NuCut* NuCutter::fCut [private]

The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1