00001
00002 #include "NtupleUtils/NuCutter.h"
00003 #include "NtupleUtils/NuCutImps.h"
00004
00005 #include "MessageService/MsgService.h"
00006
00007 #include "TString.h"
00008
00009
00010 CVSID("$Id: NuCutter.cxx,v 1.9 2010/02/01 15:24:36 sjc Exp $");
00011
00013
00014
00015 NuCut *NuCutter::GetNewCutInstance(TString ana, const NuPlots *plots) const
00016 {
00017
00018 if (ana == "") return 0;
00019
00020
00021 ana.ToUpper();
00022
00023 if (ana == "CC0325STD") {
00024 return new NuCutImps::CC0325Std(plots);
00025 } else if (ana == "CC0720TEST") {
00026 return new NuCutImps::CC0720Test(plots);
00027 } else if (ana == "CCAPRESEL") {
00028 return new NuCutImps::CCAPresel(plots);
00029 } else if (ana == "CCA" || ana == "CCA_NUBAR" || ana == "CCA_0" || ana == "CCA_1" ||
00030 ana == "CCA_2" || ana == "CCA_3" || ana == "CCA_4") {
00031 return new NuCutImps::CCA(plots,ana);
00032 } else if (ana == "CCA_NC") {
00033 return new NuCutImps::CCA_NC(plots);
00034 } else if (ana == "NMBBRAVO" || ana == "BRAVO") {
00035 return new NuCutImps::Bravo(plots);
00036 } else if (ana == "NMBCHARLIE" || ana == "CHARLIE") {
00037 return new NuCutImps::Charlie(plots);
00038 } else if (ana == "NMBDELTA" || ana == "DELTA") {
00039 return new NuCutImps::Delta(plots);
00040 } else if (ana == "NMBBRAVOPRIME" || ana == "BRAVOPRIME") {
00041 return new NuCutImps::BravoPrime(plots);
00042 } else if (ana == "CHAIRSOUND") {
00043 return new NuCutImps::ChairSound(plots);
00044 } else if (ana == "PASS" || ana == "PASSTHROUGH") {
00045 return new NuCutImps::PassThrough(plots);
00046 } else if (ana == "MSROCK_NOV09") {
00047 return new NuCutImps::MSRock_Nov09(plots);
00048 } else {
00049
00050 return 0;
00051 }
00052 }
00053
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00071
00072 NuCutter::NuCutter() : fCut(0)
00073 {
00074
00075 }
00076
00077 NuCutter::NuCutter(NuCut *cut) : fCut(cut)
00078 {
00079
00080 }
00081
00083
00084 NuCutter::NuCutter(const TString &anaVersion, const NuPlots *plots) : fCut(0)
00085 {
00086
00087 if (anaVersion.IsDigit()) {
00088 MSG("NuCutter",Msg::kInfo) << "Falling back to NuCuts-style Cut for anaVersion " << anaVersion << endl;
00089 fCut = new NuCutImps::NuCutsSelection(anaVersion.Atoi(), plots);
00090
00091 } else {
00092 fCut = GetNewCutInstance(anaVersion, plots);
00093 if (fCut == 0)
00094 MSG("NuCutter",Msg::kFatal) << "AnaVersion " << anaVersion << " can not be initialised through NuCuts" << endl;
00095 }
00096 }
00097
00099
00100 void NuCutter::SetCut(NuCut *cut)
00101 {
00102 if (fCut) delete fCut;
00103 fCut = cut;
00104 }
00105
00107
00108 void NuCutter::SetCut(const TString &anaVersion, const NuPlots *plots)
00109 {
00110 SetCut(GetNewCutInstance(anaVersion, plots));
00111
00112
00113 if (fCut == 0)
00114 MSG("NuCutter",Msg::kFatal) << "AnaVersion " << anaVersion << " can not be initialised through NuCuts" << endl;
00115 }
00116
00118
00119 Bool_t NuCutter::MakeCuts(const NuEvent &nu)
00120 {
00121 if (!fCut) return false;
00122
00123 return fCut->MakeCuts(nu);
00124 }
00125
00127
00128 Bool_t NuCutter::MakePreselectionCuts(const NuEvent &nu)
00129 {
00130 if (!fCut) return false;
00131
00132 return fCut->MakePreselectionCuts(nu);
00133 }
00134
00136
00137 Bool_t NuCutter::MakeSelectionCuts(const NuEvent &nu)
00138 {
00139 if (!fCut) return false;
00140
00141 return fCut->MakeSelectionCuts(nu);
00142 }
00143
00145
00147