NuCut Class Reference

#include <NuCut.h>

Inheritance diagram for NuCut:
NuCutImps::Bravo NuCutImps::Bravo0720 NuCutImps::Bravo0720BFnu NuCutImps::BravoPrime NuCutImps::CC0325Std NuCutImps::CC0720BFnu NuCutImps::CC0720Resolution NuCutImps::CC0720Std NuCutImps::CC0720Test NuCutImps::CC1070Resolution NuCutImps::CC1070Std NuCutImps::CC2014 NuCutImps::CC2014NewCoilCut NuCutImps::CC2014NewCoilCutResolution NuCutImps::CC2014Resolution NuCutImps::ChairSound NuCutImps::Charlie NuCutImps::Delta NuCutImps::MSRock_Nov09 NuCutImps::NC0299MECC NuCutImps::NC0299MENC NuCutImps::NC0720Std NuCutImps::NC1056CC NuCutImps::NC1056NC NuCutImps::NCPRLCC NuCutImps::NCPRLNC NuCutImps::NSI2011Fhc NuCutImps::NSI2011Rhc NuCutImps::NuCutsSelection NuCutImps::PassThrough NuCutImps::Preselection2010 NuCutImps::Preselection2014 NuCutImps::PreselectionNC2012 NuCutImps::RAF0720Ext NuCutImps::RAF0720Std NuCutImps::RetroToFCC NuCutImps::RetroToFNC NuCutImps::RetroToFRAF NuCutImps::RHC0150Std NuCutImps::RHC0350BFnu NuCutImps::RHC0350BFnuBravo NuCutImps::RHC0350Std NuCutImps::RM0720 NuCutImps::RM2 NuCutImps::ToFPreselection

List of all members.

Public Member Functions

 NuCut (TString name, const NuPlots *plots=0)
virtual ~NuCut ()
virtual Bool_t MakeCuts (const NuEvent &nu)
virtual Bool_t MakePreselectionCuts (const NuEvent &nu)
 Applies just the preselection cut.
virtual Bool_t MakeSelectionCuts (const NuEvent &nu)
 Applies just the selection cut.
void ResetStatus (void)
 Resets the stored status of the cut pass.
virtual Bool_t InFidVol (const NuEvent &nu) const
virtual Bool_t InFidVolEvt (const NuEvent &nu) const
virtual Bool_t InFidVolTrueEvt (const NuMCEvent &mc) const
virtual Bool_t InFidVolTrueEvt (const NuEvent &nu) const
void SetFidVol (const TString &fidvol="")
 Sets the 'infid' fiducial volume.
Bool_t Failed (void) const
 Have we failed the selection?
Bool_t Passed (void) const
Bool_t Passed (const TString &cutname) const
 Have we passed the cut with the given name.
Bool_t Failed (const TString &cutname) const
 Have we failed the cut with the given name.
Bool_t PassedExcept (const TString &cutname) const
 Have we passed all cuts except the named one.
Bool_t PassedUpTo (const TString &cutname) const
 Have we passed all cuts up to the named one.
virtual TString GetName () const
 Return the name of the current cut.
virtual void PrintCurrent (void) const
 Prints current status of cuts.
virtual void PrintSummary (void)
 Prints a summary of all cuts.
virtual void PrintNMinusOneSummary ()
 Print a summary of events cut by only a single cut.
Int_t AnaVersion (void) const
 Returns the AnaVersion (an integer signature) of this cut class.

Protected Member Functions

virtual void Preselection (const NuEvent &nu)=0
virtual void Selection (const NuEvent &nu)=0
virtual void Defer_Preselection (NuCut &tocut, const NuEvent &nu)
virtual void Defer_Selection (NuCut &tocut, const NuEvent &nu)
Bool_t Cut_If (Bool_t condition, const TString &name)
Bool_t Keep_If (Bool_t condition, const TString &name)
Bool_t Keep_Data_If (Bool_t condition, const NuEvent &nu, const TString &name)
Bool_t Cut_Data_If (Bool_t condition, const NuEvent &nu, const TString &name)
Bool_t SafeToReturn (void)
 Is it safe to return? This will mean we can abort partway through a cut.
Int_t AnaVersionHash (const TString name)
 Calculate a new ana version from the name, by hashing.
void SetAnaVersion (Int_t anaVersion)
 Sets the Ana Version for this class.

Protected Attributes

TString fFidVol
 The desired 'infid' fiducial volume.
const TString fSelName
const NuPlotsfPlots
 A pointer to the plots object.

Private Attributes

Int_t fAnaVersion
 What 'ana version' to associate with this cut.
Bool_t fPassCuts
std::vector< std::pair
< TString, Int_t > > 
fCutList
 A list of cuts applied this instance, that stores the name and condition.
Int_t fEventCount
std::vector< std::pair
< TString, Int_t > > 
fCutTotals
 Stores a total for events passing all cuts.
std::map< TString, int > fNMinusOneTotals

Detailed Description

Definition at line 16 of file NuCut.h.


Constructor & Destructor Documentation

NuCut::NuCut ( TString  name,
const NuPlots plots = 0 
)

Definition at line 20 of file NuCut.cxx.

References AnaVersionHash(), fAnaVersion, and fEventCount.

00020                                                : 
00021   fFidVol(), 
00022   fSelName(name), 
00023   fPlots(plots),
00024   fPassCuts(true)
00025 {
00026   fEventCount = 0;
00027   fAnaVersion = AnaVersionHash(name);
00028 }

NuCut::~NuCut (  )  [virtual]

Definition at line 31 of file NuCut.cxx.

00032 {
00033   
00034 }


Member Function Documentation

Int_t NuCut::AnaVersion ( void   )  const [inline]
Int_t NuCut::AnaVersionHash ( const TString  name  )  [protected]

Calculate a new ana version from the name, by hashing.

Definition at line 468 of file NuCut.cxx.

References hash().

Referenced by NuCut().

00469 {
00470   TString upper(name);
00471   name.Hash();
00472   upper.ToUpper();
00473   Int_t hash = upper.Hash();
00474   // This will reduce the hash space by half, but will ensure that we never
00475   // get any conflict from real (old) anaVersion numbers
00476   if (hash > 0) hash *= -1;
00477   
00478   return hash;
00479 }

Bool_t NuCut::Cut_Data_If ( Bool_t  condition,
const NuEvent nu,
const TString &  name 
) [protected]

Definition at line 171 of file NuCut.cxx.

References Cut_If(), fPassCuts, SimFlag::kData, and NuEvent::simFlag.

Referenced by NuCutImps::PreselectionNC2012::Preselection().

00172 {
00173   // Only cuts if data
00174   if (nu.simFlag == SimFlag::kData)
00175   {
00176     return Cut_If(condition, name);
00177   }
00178   
00179   return fPassCuts;
00180 }

Bool_t NuCut::Cut_If ( Bool_t  condition,
const TString &  name 
) [protected]
void NuCut::Defer_Preselection ( NuCut tocut,
const NuEvent nu 
) [protected, virtual]

Defers preselection to a different class. This function will take care of all syncing issues i.e. the aim is for calling this to have the same effect as the cuts being in this class instance.

WARNING: The internal state of the cut object passed in will *NOT* be respected.

Definition at line 277 of file NuCut.cxx.

References fCutList, Keep_If(), MakePreselectionCuts(), and ResetStatus().

Referenced by NuCutImps::NCPRLNC::Preselection(), NuCutImps::Bravo0720BFnu::Preselection(), NuCutImps::RAF0720Std::Preselection(), NuCutImps::CC1070Std::Preselection(), NuCutImps::RetroToFRAF::Preselection(), NuCutImps::RetroToFCC::Preselection(), NuCutImps::CC0720Resolution::Preselection(), NuCutImps::CC0720Test::Preselection(), NuCutImps::NC1056NC::Preselection(), NuCutImps::RHC0150Std::Preselection(), NuCutImps::CC0720Std::Preselection(), NuCutImps::Bravo0720::Preselection(), NuCutImps::CC0720BFnu::Preselection(), NuCutImps::NC0720Std::Preselection(), NuCutImps::RAF0720Ext::Preselection(), NuCutImps::CC2014NewCoilCutResolution::Preselection(), NuCutImps::CC2014Resolution::Preselection(), NuCutImps::Bravo::Preselection(), NuCutImps::NC0299MENC::Preselection(), NuCutImps::RHC0350BFnuBravo::Preselection(), NuCutImps::NSI2011Rhc::Preselection(), NuCutImps::CC2014::Preselection(), NuCutImps::RHC0350Std::Preselection(), NuCutImps::CC1070Resolution::Preselection(), NuCutImps::CC2014NewCoilCut::Preselection(), NuCutImps::RM2::Preselection(), NuCutImps::BravoPrime::Preselection(), NuCutImps::RetroToFNC::Preselection(), NuCutImps::NC1056CC::Preselection(), NuCutImps::RHC0350BFnu::Preselection(), NuCutImps::NSI2011Fhc::Preselection(), NuCutImps::RM0720::Preselection(), NuCutImps::NC0299MECC::Preselection(), NuCutImps::Delta::Preselection(), and NuCutImps::Charlie::Preselection().

00278 {
00279   // Make sure the object is in a fresh state
00280   cut.ResetStatus();
00281   
00282   // Now, run the preselection cut
00283   cut.MakePreselectionCuts(nu);
00284   
00285   // // Now, combine out status - this is currently very simple, as we are
00286   // // not yet tracking named cuts. This will become a bit more involved 
00287   // // at that stage, but for now, this works!
00288   // //fPassCuts = fPassCuts && !cut.Failed();
00289   // 
00290   // 
00291   // // Not yet tracking individual cuts, but in the interm track
00292   // // what the whole deferred selection does
00293   // Keep_If(cut.Passed(), "DeferredPreselection");
00294 
00295   // Now copy out all the selections into our list!
00296   for (UInt_t i = 0; i < cut.fCutList.size(); ++i) {
00297     Keep_If(cut.fCutList[i].second, cut.fCutList[i].first);
00298   }
00299 }

void NuCut::Defer_Selection ( NuCut tocut,
const NuEvent nu 
) [protected, virtual]

Defers the main selection to a different class As with Defer_Preselection, but for the main selection part

Definition at line 303 of file NuCut.cxx.

References fCutList, Keep_If(), MakeSelectionCuts(), and ResetStatus().

Referenced by NuCutImps::NC1056CC::Selection(), NuCutImps::Bravo0720BFnu::Selection(), NuCutImps::CC0720BFnu::Selection(), NuCutImps::Delta::Selection(), NuCutImps::CC2014Resolution::Selection(), NuCutImps::NSI2011Rhc::Selection(), NuCutImps::NC1056NC::Selection(), NuCutImps::RM0720::Selection(), NuCutImps::NSI2011Fhc::Selection(), NuCutImps::CC0720Resolution::Selection(), NuCutImps::NC0299MECC::Selection(), NuCutImps::Bravo::Selection(), NuCutImps::RHC0350Std::Selection(), NuCutImps::RM2::Selection(), NuCutImps::BravoPrime::Selection(), NuCutImps::Charlie::Selection(), NuCutImps::RHC0350BFnuBravo::Selection(), NuCutImps::CC2014NewCoilCutResolution::Selection(), NuCutImps::RHC0350BFnu::Selection(), NuCutImps::Bravo0720::Selection(), NuCutImps::CC1070Resolution::Selection(), and NuCutImps::NC0299MENC::Selection().

00304 {
00305   // Make sure the object is in a fresh state
00306   cut.ResetStatus();
00307   
00308   // Now, run the preselection cut
00309   cut.MakeSelectionCuts(nu);
00310   
00311   // Now copy out all the selections
00312   for (UInt_t i = 0; i < cut.fCutList.size(); ++i) {
00313     Keep_If(cut.fCutList[i].second, cut.fCutList[i].first);
00314   }
00315   
00316   // Now, combine out status - this is currently very simple, as we are
00317   // not yet tracking named cuts. This will become a bit more involved 
00318   // at that stage, but for now, this works!
00319   //fPassCuts = fPassCuts && !cut.Failed();
00320 }

Bool_t NuCut::Failed ( const TString &  cutname  )  const [inline]

Have we failed the cut with the given name.

Definition at line 69 of file NuCut.h.

References Passed().

00069 { return !Passed(cutname);};

Bool_t NuCut::Failed ( void   )  const [inline]

Have we failed the selection?

Definition at line 58 of file NuCut.h.

References fPassCuts.

Referenced by NuCutter::Failed().

00058 { return !fPassCuts; }

virtual TString NuCut::GetName ( void   )  const [inline, virtual]

Return the name of the current cut.

Definition at line 78 of file NuCut.h.

References fSelName.

Referenced by InFidVol(), InFidVolEvt(), InFidVolTrueEvt(), MakePreselectionCuts(), Passed(), PassedExcept(), PassedUpTo(), PrintCurrent(), PrintNMinusOneSummary(), PrintSummary(), and SetFidVol().

00078 { return fSelName; }

Bool_t NuCut::InFidVol ( const NuEvent nu  )  const [virtual]

Fiducial volume calculation function. This is the basic 'infid' derived version, and should be overridden/passed to for any more complicated evaluations.

Reimplemented in NuCutImps::Preselection2010, NuCutImps::Preselection2014, NuCutImps::CC0325Std, NuCutImps::CC0720Std, NuCutImps::CC1070Std, NuCutImps::CC2014, NuCutImps::CC2014NewCoilCut, NuCutImps::RHC0150Std, NuCutImps::CC0720Resolution, NuCutImps::CC1070Resolution, NuCutImps::CC2014Resolution, NuCutImps::CC2014NewCoilCutResolution, NuCutImps::NC0720Std, NuCutImps::RAF0720Std, NuCutImps::RAF0720Ext, NuCutImps::NSI2011Fhc, NuCutImps::NSI2011Rhc, NuCutImps::CC0720BFnu, NuCutImps::NuCutsSelection, NuCutImps::PreselectionNC2012, NuCutImps::NCPRLCC, and NuCutImps::RetroToFCC.

Definition at line 200 of file NuCut.cxx.

References choose_infid_set(), NuEvent::detector, fFidVol, GetName(), FidVol::getName(), infid(), Msg::kInfo, Msg::kWarning, MAXMSG, MSG, NuEvent::ntrk, NuEvent::simFlag, NuEvent::xTrkVtx, NuEvent::yTrkVtx, and NuEvent::zTrkVtx.

00201 {
00202   // Check we are still in the correct fiducial volume (and we have set one)
00203   if (FidVol::getName() != fFidVol) {
00204     MSG("NuCut",Msg::kInfo) << "Fiducial volume has changed in " << GetName() << ", resetting to \"" << fFidVol << "\"" << endl;
00205     // Reset the fiducial volume to outs
00206     if (FidVol::getName() != fFidVol) {
00207       choose_infid_set(fFidVol.Data());
00208     }
00209   }
00210   
00211   // assert(nu.ntrk > 0);  // No track means the track vertex is meaningless
00212   if (nu.ntrk == 0) {
00213     MAXMSG("NuCut",Msg::kWarning,3) << "Testing vertex against Fiducial volume, but no tracks!" << endl;
00214   }
00215   
00216   return infid(static_cast<Detector::Detector_t>(nu.detector),
00217     static_cast<SimFlag::SimFlag_t>(nu.simFlag),
00218     nu.xTrkVtx,nu.yTrkVtx,nu.zTrkVtx);
00219 }

Bool_t NuCut::InFidVolEvt ( const NuEvent nu  )  const [virtual]

Duplicate of InFidVol except acting on event vertex instead of track vertex.

Reimplemented in NuCutImps::NuCutsSelection.

Definition at line 223 of file NuCut.cxx.

References choose_infid_set(), NuEvent::detector, fFidVol, GetName(), FidVol::getName(), infid(), Msg::kInfo, MSG, NuEvent::simFlag, NuEvent::xEvtVtx, NuEvent::yEvtVtx, and NuEvent::zEvtVtx.

Referenced by NuCutImps::CC2014::InFidVol(), NuCutImps::NC0720Std::InFidVol(), NuCutImps::RHC0150Std::InFidVol(), NuCutImps::CC1070Std::InFidVol(), NuCutImps::Preselection2010::InFidVol(), NuCutImps::RetroToFCC::InFidVol(), NuCutImps::CC0720BFnu::InFidVol(), NuCutImps::Preselection2014::InFidVol(), NuCutImps::CC0720Std::InFidVol(), and NuCutImps::CC2014NewCoilCut::InFidVol().

00224 {
00225   // Check we are still in the correct fiducial volume (and we have set one)
00226   if (FidVol::getName() != fFidVol) {
00227     MSG("NuCut",Msg::kInfo) << "Fiducial volume has changed in " << GetName() << ", resetting to \"" << fFidVol << "\"" << endl;
00228     // Reset the fiducial volume to outs
00229     if (FidVol::getName() != fFidVol) {
00230       choose_infid_set(fFidVol.Data());
00231     }
00232   }
00233 
00234   return infid(Detector::Detector_t(nu.detector),
00235                SimFlag::SimFlag_t(nu.simFlag),
00236                nu.xEvtVtx, nu.yEvtVtx, nu.zEvtVtx);
00237 }

Bool_t NuCut::InFidVolTrueEvt ( const NuEvent nu  )  const [virtual]

Definition at line 259 of file NuCut.cxx.

References choose_infid_set(), NuEvent::detector, fFidVol, GetName(), FidVol::getName(), infid(), Msg::kInfo, MSG, NuEvent::simFlag, NuEvent::vtxxMC, NuEvent::vtxyMC, and NuEvent::vtxzMC.

00260 {
00261   // Check we are still in the correct fiducial volume (and we have set one)
00262   if (FidVol::getName() != fFidVol) {
00263     MSG("NuCut",Msg::kInfo) << "Fiducial volume has changed in " << GetName() << ", resetting to \"" << fFidVol << "\"" << endl;
00264     // Reset the fiducial volume to outs
00265     if (FidVol::getName() != fFidVol) {
00266       choose_infid_set(fFidVol.Data());
00267     }
00268   }
00269   
00270   return infid(Detector::Detector_t(nu.detector),
00271                SimFlag::SimFlag_t(nu.simFlag),
00272                nu.vtxxMC,nu.vtxyMC,nu.vtxzMC);
00273 }

Bool_t NuCut::InFidVolTrueEvt ( const NuMCEvent mc  )  const [virtual]

Determines if a MC event is truly in the fiducial volume. Behaves just like InFidVol

Reimplemented in NuCutImps::NuCutsSelection.

Definition at line 241 of file NuCut.cxx.

References choose_infid_set(), NuMCEvent::detector, fFidVol, GetName(), FidVol::getName(), infid(), Msg::kInfo, MSG, NuMCEvent::simFlag, NuMCEvent::vtxxMC, NuMCEvent::vtxyMC, and NuMCEvent::vtxzMC.

Referenced by NuReco::GetTruthInfo(), and NuDSTAna::MakeMicroDST().

00242 {
00243   // Check we are still in the correct fiducial volume (and we have set one)
00244   if (FidVol::getName() != fFidVol) {
00245     MSG("NuCut",Msg::kInfo) << "Fiducial volume has changed in " << GetName() << ", resetting to \"" << fFidVol << "\"" << endl;
00246     // Reset the fiducial volume to outs
00247     if (FidVol::getName() != fFidVol) {
00248       choose_infid_set(fFidVol.Data());
00249     }
00250   }
00251   
00252   return infid(Detector::Detector_t(mc.detector),
00253                SimFlag::SimFlag_t(mc.simFlag),
00254                mc.vtxxMC,mc.vtxyMC,mc.vtxzMC);
00255 }

Bool_t NuCut::Keep_Data_If ( Bool_t  condition,
const NuEvent nu,
const TString &  name 
) [protected]
Bool_t NuCut::Keep_If ( Bool_t  condition,
const TString &  name 
) [protected]

Definition at line 144 of file NuCut.cxx.

References fCutList, and fPassCuts.

Referenced by Defer_Preselection(), Defer_Selection(), Keep_Data_If(), NuCutImps::NuCutsSelection::Preselection(), NuCutImps::NCPRLCC::Preselection(), NuCutImps::Preselection2014::Preselection(), NuCutImps::RAF0720Std::Preselection(), NuCutImps::ToFPreselection::Preselection(), NuCutImps::PreselectionNC2012::Preselection(), NuCutImps::CC1070Std::Preselection(), NuCutImps::RetroToFRAF::Preselection(), NuCutImps::RetroToFCC::Preselection(), NuCutImps::RHC0150Std::Preselection(), NuCutImps::CC0720Std::Preselection(), NuCutImps::ChairSound::Preselection(), NuCutImps::NC0720Std::Preselection(), NuCutImps::RAF0720Ext::Preselection(), NuCutImps::CC2014::Preselection(), NuCutImps::CC0325Std::Preselection(), NuCutImps::MSRock_Nov09::Preselection(), NuCutImps::CC2014NewCoilCut::Preselection(), NuCutImps::RetroToFNC::Preselection(), NuCutImps::Preselection2010::Preselection(), NuCutImps::CC2014Resolution::Resolution(), NuCutImps::CC2014NewCoilCutResolution::Resolution(), NuCutImps::CC1070Resolution::Resolution(), NuCutImps::CC0720Resolution::Resolution(), NuCutImps::NCPRLNC::Selection(), NuCutImps::CC0720BFnu::Selection(), NuCutImps::Bravo0720BFnu::Selection(), NuCutImps::ChairSound::Selection(), NuCutImps::RetroToFCC::Selection(), NuCutImps::Delta::Selection(), NuCutImps::NCPRLCC::Selection(), NuCutImps::CC1070Std::Selection(), NuCutImps::RM0720::Selection(), NuCutImps::RHC0150Std::Selection(), NuCutImps::RAF0720Std::Selection(), NuCutImps::RetroToFNC::Selection(), NuCutImps::RHC0350Std::Selection(), NuCutImps::Bravo::Selection(), NuCutImps::NuCutsSelection::Selection(), NuCutImps::MSRock_Nov09::Selection(), NuCutImps::RAF0720Ext::Selection(), NuCutImps::CC0720Std::Selection(), NuCutImps::RM2::Selection(), NuCutImps::CC0325Std::Selection(), NuCutImps::BravoPrime::Selection(), NuCutImps::RHC0350BFnuBravo::Selection(), NuCutImps::NC0720Std::Selection(), NuCutImps::CC2014NewCoilCut::Selection(), NuCutImps::Charlie::Selection(), NuCutImps::CC0720Test::Selection(), NuCutImps::RetroToFRAF::Selection(), NuCutImps::RHC0350BFnu::Selection(), NuCutImps::CC2014::Selection(), and NuCutImps::Bravo0720::Selection().

00145 {
00146   fPassCuts = fPassCuts && condition;
00147 
00148   // Store this cut, whatever for now
00149   fCutList.push_back(pair<TString,Int_t>(s,condition));
00150   
00151   return fPassCuts;
00152 }

Bool_t NuCut::MakeCuts ( const NuEvent nu  )  [virtual]

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 39 of file NuCut.cxx.

References fPassCuts, MakePreselectionCuts(), MakeSelectionCuts(), and ResetStatus().

Referenced by NuSystematic::AbsoluteHadronicCalibrationSterile(), NuSystematic::AllBackgroundsScaleBothShift(), NuSystematic::CCBackgroundShift(), NuSystematic::CCBackgroundShiftSterile(), NuSystematic::CCWSBackground(), NuDSTAna::DPSystematic(), NuSystematic::FDCleaningCosmicsShift(), NuSystematic::FDCleaningCosmicsShiftSterile(), NuSystematic::FDCleaningShift(), NuSystematic::FDCleaningShiftSterile(), NuDSTAna::IsGoodStdCuts(), NuCutter::MakeCuts(), NuSystematic::NCBackgroundShift(), NuSystematic::NCNuBarBackgroundShift(), NuSystematic::NDCleaningShift(), NuSystematic::NDCleaningShiftSterile(), NuSystematic::NormalisationShift(), NuSystematic::NormalisationShiftSterile(), NuDSTAna::QPStudy(), NuSystematic::RelativeHadronicCalibrationSterile(), NuSystematic::RockSelectionShift(), NuCutImps::NC1056CC::Selection(), NuCutImps::NCPRLCC::Selection(), NuCutImps::NC0299MECC::Selection(), NuCutImps::RAF0720Std::Selection(), NuCutImps::RetroToFNC::Selection(), NuCutImps::RAF0720Ext::Selection(), NuCutImps::NC0720Std::Selection(), NuCutImps::RetroToFRAF::Selection(), NuDSTAna::SelectorTable(), NuDSTAna::TestNuSyst(), and NuSystematic::WSNuBarBackgroundShift().

00040 {
00041   // Since we are asking for a full cut, reset the pass status
00042   ResetStatus();
00043   
00044   MakePreselectionCuts(nu);
00045   MakeSelectionCuts(nu);
00046   
00047   return fPassCuts;
00048 }

Bool_t NuCut::MakePreselectionCuts ( const NuEvent nu  )  [virtual]

Applies just the preselection cut.

Definition at line 53 of file NuCut.cxx.

References fPassCuts, GetName(), Msg::kDebug, MAXMSG, and Preselection().

Referenced by NuReco::CalcEvtVariables(), Defer_Preselection(), NuDSTAna::IsGoodPreSelectionCuts(), MakeCuts(), and NuCutter::MakePreselectionCuts().

00054 {
00055   Preselection(nu);
00056   MAXMSG("NuCut",Msg::kDebug,50) << "Passed " << GetName() << " Preselection = " << (fPassCuts ? "Yes" : "No") << endl;
00057   return fPassCuts;
00058 }

Bool_t NuCut::MakeSelectionCuts ( const NuEvent nu  )  [virtual]

Applies just the selection cut.

Definition at line 63 of file NuCut.cxx.

References fPassCuts, and Selection().

Referenced by Defer_Selection(), MakeCuts(), and NuCutter::MakeSelectionCuts().

00064 {
00065   Selection(nu);
00066   return fPassCuts;
00067 }

Bool_t NuCut::Passed ( const TString &  cutname  )  const

Have we passed the cut with the given name.

Definition at line 324 of file NuCut.cxx.

References fCutList, GetName(), Msg::kError, MSG, and PrintCurrent().

00325 {
00326   for (UInt_t i = 0; i < fCutList.size(); ++i) {
00327     if (fCutList[i].first == cutname) {
00328       return fCutList[i].second;
00329     }
00330   }
00331   MSG("NuCut",Msg::kError) << "Cut " << cutname << " not found in selection " << GetName() << endl;
00332   PrintCurrent();
00333   // Death here requested by Jeff & Justin
00334   assert(0);
00335   return false;
00336 }

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

Have we passed all cuts except the named one.

Definition at line 340 of file NuCut.cxx.

References fCutList, GetName(), Msg::kError, MSG, and PrintCurrent().

Referenced by NuCutter::PassedExcept(), NuDSTAna::QPStudy(), and NuDSTAna::SelectorTable().

00341 {
00342   Bool_t found = false;
00343   Bool_t pass = true;
00344   for (UInt_t i = 0; i < fCutList.size(); ++i) {
00345     if (fCutList[i].first != cutname) {
00346       pass = pass && fCutList[i].second;
00347     } else {
00348       found = true;
00349     }
00350   }
00351   if (!found) {
00352     MSG("NuCut",Msg::kError) << "Cut " << cutname << " not found in selection " << GetName() << endl;
00353     PrintCurrent();
00354     // Death here requested by Jeff & Justin
00355     assert(0);
00356   }
00357 
00358   return pass;
00359 }

Bool_t NuCut::PassedUpTo ( const TString &  cutname  )  const

Have we passed all cuts up to the named one.

Definition at line 363 of file NuCut.cxx.

References fCutList, GetName(), Msg::kError, MSG, and PrintCurrent().

Referenced by NuCutter::PassedUpTo().

00364 {
00365   Bool_t found = false;
00366   Bool_t pass = true;
00367   for (UInt_t i = 0; i < fCutList.size(); ++i) {
00368     if (fCutList[i].first != cutname) {
00369       pass = pass && fCutList[i].second;
00370     } else {
00371       found = true;
00372       break;
00373     }
00374   }
00375   if (!found) {
00376     MSG("NuCut",Msg::kError) << "Cut " << cutname << " not found in selection " << GetName() << endl;
00377     PrintCurrent();
00378     // Death here requested by Jeff & Justin
00379     assert(0);
00380   }
00381 
00382   return pass;
00383 }

virtual void NuCut::Preselection ( const NuEvent nu  )  [protected, pure virtual]
void NuCut::PrintCurrent ( void   )  const [virtual]

Prints current status of cuts.

Definition at line 388 of file NuCut.cxx.

References fCutList, GetName(), Msg::kInfo, MSG, and Passed().

Referenced by Passed(), PassedExcept(), PassedUpTo(), and NuCutter::PrintCurrent().

00389 {
00390   MSG("NuCut",Msg::kInfo) << "Selection " << GetName() << " has " << fCutList.size() << " cuts:" << endl;
00391   for (UInt_t i = 0; i < fCutList.size(); ++i) {
00392     MSG("NuCut",Msg::kInfo) << "  " << fCutList[i].first << " " << (fCutList[i].second?"Passed":"Failed") << endl;
00393   }
00394   if (Passed()) MSG("NuCut",Msg::kInfo) << "  -- Event Passed" << endl;
00395   else          MSG("NuCut",Msg::kInfo) << "  ** Event Failed" << endl;
00396 
00397 }

void NuCut::PrintNMinusOneSummary (  )  [virtual]

Print a summary of events cut by only a single cut.

Definition at line 435 of file NuCut.cxx.

References fEventCount, fNMinusOneTotals, GetName(), it, Msg::kInfo, len, MSG, and ResetStatus().

Referenced by NuCutter::PrintNMinusOneSummary().

00436 {
00437   // Make sure we are reset and counted
00438   ResetStatus();
00439   
00440   // Find the longest name
00441   Int_t lsize = 12;
00442   for(map<TString, int>::iterator it = fNMinusOneTotals.begin();
00443       it != fNMinusOneTotals.end(); ++it){
00444     int len = it->first.Length();
00445     if(len > lsize) lsize = len;
00446   }
00447 
00448   // The 'total width'
00449   const Int_t width = lsize + 20;
00450 
00451   MSG("NuCut",Msg::kInfo) << setw(width/2) << right << setfill('=') << (" "+GetName()) << setw(width/2+width%2) << left << " N-1 Summary " << '\n';
00452   MSG("NuCut",Msg::kInfo) << setw(lsize) << left << setfill(' ') << "Cut" << "   # Cut   % of evts\n";
00453 
00454   MSG("NuCut",Msg::kInfo) << setw(width) << left << setfill('=') << "" << "\n";
00455   MSG("NuCut",Msg::kInfo) << setfill(' ');
00456   for(map<TString, int>::iterator it = fNMinusOneTotals.begin();
00457       it != fNMinusOneTotals.end(); ++it){
00458     MSG("NuCut",Msg::kInfo)
00459       << setw(lsize) << left << it->first
00460       << "  " << setw(8) << right << it->second
00461       << "  " << setw(7) << right << fixed << setprecision(2) << it->second*100./fEventCount << "%\n";
00462   }
00463   MSG("NuCut",Msg::kInfo) << endl;
00464 }

void NuCut::PrintSummary ( void   )  [virtual]

Prints a summary of all cuts.

Reimplemented in NuCutImps::NuCutsSelection.

Definition at line 402 of file NuCut.cxx.

References fCutTotals, fEventCount, GetName(), Msg::kInfo, len, MSG, and ResetStatus().

Referenced by NuDSTAna::DPSystematic(), NuCutter::PrintSummary(), NuSystematic::SetCCSelector(), NuSystematic::SetNCSelector(), NuSystematic::SetNuBarSelector(), and NuSystematic::SetRockSelector().

00403 {
00404   // Make sure we are reset and counted
00405   ResetStatus();
00406   
00407   // Find the longest name
00408   Int_t lsize = 12;
00409   for (UInt_t i = 0; i < fCutTotals.size(); ++i)
00410   {
00411     Int_t len = fCutTotals[i].first.Length();
00412     if (len > lsize) lsize = len;
00413   }
00414   // The 'total width'
00415   Int_t width = lsize + 20;
00416   // Print a summary of this events cuts
00417   MSG("NuCut",Msg::kInfo) << setw(width/2) << right << setfill('=') << (" "+GetName()) << setw(width/2+width%2) << left << " Summary " << '\n';
00418   MSG("NuCut",Msg::kInfo) << setw(lsize) << left << setfill(' ') << "Cut" << "  # Passed  % Passed\n";
00419 
00420   MSG("NuCut",Msg::kInfo) << setw(width) << left << setfill('=') << "" << "\n";
00421   MSG("NuCut",Msg::kInfo) << setw(lsize) << left << setfill(' ') << "Total Events" << "  " << setw(8) << right << fEventCount << "   100.00%\n";
00422   for (UInt_t i = 0; i < fCutTotals.size(); ++i)
00423   {
00424     // stat = stat && fCutList[i].second;
00425     MSG("NuCut",Msg::kInfo)
00426       << setw(lsize) << left << fCutTotals[i].first
00427       << "  " << setw(8) << right << fCutTotals[i].second
00428       << "  " << setw(7) << right << fixed << setprecision(2) << fCutTotals[i].second*100./fEventCount << "%\n";
00429   }
00430   MSG("NuCut",Msg::kInfo) << endl;
00431 }

void NuCut::ResetStatus ( void   ) 

Resets the stored status of the cut pass.

Definition at line 72 of file NuCut.cxx.

References fCutList, fCutTotals, fEventCount, fNMinusOneTotals, fPassCuts, n, and Munits::second.

Referenced by NuReco::CalcEvtVariables(), Defer_Preselection(), Defer_Selection(), MakeCuts(), PrintNMinusOneSummary(), PrintSummary(), and NuCutter::ResetStatus().

00073 {
00074   // We're already reset
00075   if(fCutList.empty()) return;
00076 
00077   fPassCuts = true;
00078   
00079   // Push back the cut statii onto the central list. This shouldn't go here, probably
00080   // but has for now.
00081   Bool_t passed = true;
00082   for (UInt_t i = 0; i < fCutList.size(); ++i) {
00083     // Take each of these, and push them back onto the cut totals list.
00084     TString &cutname = fCutList[i].first;
00085     Bool_t passcut = fCutList[i].second;
00086     
00087     // Check if it already exists in the vector
00088     UInt_t sumindex;
00089     for (sumindex = 0; sumindex < fCutTotals.size(); ++sumindex)
00090     {
00091       if (fCutTotals[sumindex].first == cutname) break;
00092     }
00093     
00094     // Now check if we have to push_back a new entry
00095     if (sumindex == fCutTotals.size())
00096     {
00097       // We have to push back
00098       fCutTotals.push_back(pair<TString,Int_t>(cutname, 0));
00099     }
00100     
00101     // Now, shall we add to this?
00102     // Add to totals, if we have still passed after this cut
00103     passed = passed && passcut;
00104     if (passed)
00105     {
00106       fCutTotals[sumindex].second++;
00107     }
00108   } // end for i
00109   
00110   // If the cut list was not empty, add to the event count
00111   if (!fCutList.empty()) fEventCount++;
00112   
00113 
00114   int nFailed = 0;
00115   for(unsigned int n = 0; n < fCutList.size(); ++n){
00116     if(!fCutList[n].second) ++nFailed;
00117   }
00118   // If it failed exactly one cut then add that cut to the N-1 list
00119   if(nFailed == 1){
00120     for(unsigned int n = 0; n < fCutList.size(); ++n){
00121       if(!fCutList[n].second) ++fNMinusOneTotals[fCutList[n].first];
00122     }
00123   }
00124 
00125 
00126   // Now, clear the interim list
00127   fCutList.clear();
00128 }

Bool_t NuCut::SafeToReturn ( void   )  [inline, protected]

Is it safe to return? This will mean we can abort partway through a cut.

Definition at line 130 of file NuCut.h.

References fPassCuts.

00130 { return fPassCuts; }

virtual void NuCut::Selection ( const NuEvent nu  )  [protected, pure virtual]
void NuCut::SetAnaVersion ( Int_t  anaVersion  )  [inline, protected]

Sets the Ana Version for this class.

Definition at line 136 of file NuCut.h.

References fAnaVersion.

Referenced by NuCutImps::Bravo::Bravo(), NuCutImps::Bravo0720::Bravo0720(), NuCutImps::Bravo0720BFnu::Bravo0720BFnu(), NuCutImps::BravoPrime::BravoPrime(), NuCutImps::CC0325Std::CC0325Std(), NuCutImps::CC0720BFnu::CC0720BFnu(), NuCutImps::CC0720Resolution::CC0720Resolution(), NuCutImps::CC0720Std::CC0720Std(), NuCutImps::CC1070Resolution::CC1070Resolution(), NuCutImps::CC1070Std::CC1070Std(), NuCutImps::CC2014::CC2014(), NuCutImps::CC2014NewCoilCut::CC2014NewCoilCut(), NuCutImps::CC2014NewCoilCutResolution::CC2014NewCoilCutResolution(), NuCutImps::CC2014Resolution::CC2014Resolution(), NuCutImps::Charlie::Charlie(), NuCutImps::Delta::Delta(), NuCutImps::NC0299MECC::NC0299MECC(), NuCutImps::NC0299MENC::NC0299MENC(), NuCutImps::NC0720Std::NC0720Std(), NuCutImps::NC1056CC::NC1056CC(), NuCutImps::NC1056NC::NC1056NC(), NuCutImps::NCPRLCC::NCPRLCC(), NuCutImps::NCPRLNC::NCPRLNC(), NuCutImps::NSI2011Fhc::NSI2011Fhc(), NuCutImps::NSI2011Rhc::NSI2011Rhc(), NuCutImps::NuCutsSelection::NuCutsSelection(), NuCutImps::Preselection2010::Preselection2010(), NuCutImps::Preselection2014::Preselection2014(), NuCutImps::PreselectionNC2012::PreselectionNC2012(), NuCutImps::RAF0720Ext::RAF0720Ext(), NuCutImps::RAF0720Std::RAF0720Std(), NuCutImps::RetroToFCC::RetroToFCC(), NuCutImps::RetroToFNC::RetroToFNC(), NuCutImps::RetroToFRAF::RetroToFRAF(), NuCutImps::RHC0150Std::RHC0150Std(), NuCutImps::RHC0350BFnu::RHC0350BFnu(), NuCutImps::RHC0350BFnuBravo::RHC0350BFnuBravo(), NuCutImps::RHC0350Std::RHC0350Std(), NuCutImps::RM0720::RM0720(), NuCutImps::RM2::RM2(), and NuCutImps::ToFPreselection::ToFPreselection().

00136 { fAnaVersion = anaVersion; };

void NuCut::SetFidVol ( const TString &  fidvol = ""  ) 

Sets the 'infid' fiducial volume.

Definition at line 185 of file NuCut.cxx.

References choose_infid_set(), fFidVol, GetName(), FidVol::getName(), Msg::kWarning, and MSG.

Referenced by NuCutImps::Bravo::Bravo(), NuCutImps::Bravo0720::Bravo0720(), NuCutImps::Bravo0720BFnu::Bravo0720BFnu(), NuCutImps::BravoPrime::BravoPrime(), NuCutImps::CC0325Std::CC0325Std(), NuCutImps::CC0720BFnu::CC0720BFnu(), NuCutImps::CC0720Resolution::CC0720Resolution(), NuCutImps::CC0720Std::CC0720Std(), NuCutImps::CC0720Test::CC0720Test(), NuCutImps::CC1070Resolution::CC1070Resolution(), NuCutImps::CC1070Std::CC1070Std(), NuCutImps::CC2014::CC2014(), NuCutImps::CC2014NewCoilCut::CC2014NewCoilCut(), NuCutImps::CC2014NewCoilCutResolution::CC2014NewCoilCutResolution(), NuCutImps::CC2014Resolution::CC2014Resolution(), NuCutImps::ChairSound::ChairSound(), NuCutImps::Charlie::Charlie(), NuCutImps::Delta::Delta(), NuCutImps::MSRock_Nov09::MSRock_Nov09(), NuCutImps::NC0720Std::NC0720Std(), NuCutImps::NSI2011Fhc::NSI2011Fhc(), NuCutImps::NSI2011Rhc::NSI2011Rhc(), NuCutImps::Preselection2010::Preselection2010(), NuCutImps::Preselection2014::Preselection2014(), NuCutImps::RAF0720Ext::RAF0720Ext(), NuCutImps::RAF0720Std::RAF0720Std(), NuCutImps::RetroToFCC::RetroToFCC(), NuCutImps::RetroToFNC::RetroToFNC(), NuCutImps::RetroToFRAF::RetroToFRAF(), NuCutImps::RHC0150Std::RHC0150Std(), NuCutImps::RHC0350BFnu::RHC0350BFnu(), NuCutImps::RHC0350BFnuBravo::RHC0350BFnuBravo(), NuCutImps::RHC0350Std::RHC0350Std(), NuCutImps::RM0720::RM0720(), NuCutImps::RM2::RM2(), and NuCutImps::ToFPreselection::ToFPreselection().

00186 {
00187   if (fFidVol != "" && fidvol == "") {
00188     MSG("NuCut", Msg::kWarning) << "Setting blank fiducial volume in " << GetName() << ", but one has already been set."
00189       << "Cannot reset - will continue using whatever is set (but not forcing it)" << endl;
00190   }
00191   fFidVol = fidvol;
00192   // Set the fiducial volume
00193   if (FidVol::getName() != fidvol) {
00194     choose_infid_set(fidvol.Data());
00195   }
00196 }


Member Data Documentation

Int_t NuCut::fAnaVersion [private]

What 'ana version' to associate with this cut.

Definition at line 146 of file NuCut.h.

Referenced by AnaVersion(), NuCut(), and SetAnaVersion().

std::vector<std::pair<TString,Int_t> > NuCut::fCutList [private]

A list of cuts applied this instance, that stores the name and condition.

Definition at line 154 of file NuCut.h.

Referenced by Cut_If(), Defer_Preselection(), Defer_Selection(), Keep_If(), Passed(), PassedExcept(), PassedUpTo(), PrintCurrent(), and ResetStatus().

std::vector<std::pair<TString,Int_t> > NuCut::fCutTotals [private]

Stores a total for events passing all cuts.

Definition at line 161 of file NuCut.h.

Referenced by PrintSummary(), and ResetStatus().

Int_t NuCut::fEventCount [private]

Counts the number of events that we have treated. An event is counted every time ResetStatus() is called, after having made cuts

Definition at line 159 of file NuCut.h.

Referenced by NuCut(), PrintNMinusOneSummary(), PrintSummary(), and ResetStatus().

TString NuCut::fFidVol [protected]

The desired 'infid' fiducial volume.

Definition at line 136 of file NuCut.h.

Referenced by InFidVol(), InFidVolEvt(), InFidVolTrueEvt(), and SetFidVol().

std::map<TString, int> NuCut::fNMinusOneTotals [private]

Definition at line 162 of file NuCut.h.

Referenced by PrintNMinusOneSummary(), and ResetStatus().

Bool_t NuCut::fPassCuts [private]
const NuPlots* NuCut::fPlots [protected]
const TString NuCut::fSelName [protected]

Definition at line 139 of file NuCut.h.

Referenced by GetName().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1