00001
00002
00003
00004
00005
00007 #include "TH1F.h"
00008 #include "TFile.h"
00009 #include "Conventions/Detector.h"
00010 #include "NueAna/NueRecord.h"
00011 #include "MessageService/MsgService.h"
00012 #include "MinosObjectMap/MomNavigator.h"
00013 #include "MessageService/MsgService.h"
00014 #include "JobControl/JobCModuleRegistry.h"
00015 #include "HistMan/HistMan.h"
00016 #include <fstream>
00017 #include "AnalysisNtuples/ANtpDefaultValue.h"
00018 #include "TClass.h"
00019 #include "TDataType.h"
00020 #include "TDataMember.h"
00021 #include "TRealData.h"
00022 #include <string>
00023 #include "SpillTypeFilter.h"
00024 #include "NueAna/NueAnalysisCuts.h"
00025 #include "CandNtupleSR/NtpSRRecord.h"
00026
00027
00028 const int CALend=110;
00029 const int SM1end=230;
00030 const int SM2end=484;
00031
00032 JOBMODULE(SpillTypeFilter, "SpillTypeFilter",
00033 "Reduce the file size of AnaNue files by filtering out events");
00034 CVSID("$Id: SpillTypeFilter.cxx,v 1.2 2008/11/19 18:33:13 rhatcher Exp $");
00035
00036
00037 SpillTypeFilter::SpillTypeFilter():
00038 counter(0),
00039 kOutputFile("TrimmedOut.root"),
00040 kReWeight(0),
00041 kTheta23(1.0),
00042 kUe3Square(0.01),
00043 kDeltaMSquare(0.0025)
00044 {}
00045
00046
00047
00048 SpillTypeFilter::~SpillTypeFilter()
00049 {}
00050
00051
00052 void SpillTypeFilter::BeginJob()
00053 {
00054 kept = 0;
00055
00056 if(counter%1000==0){
00057 cout<<"On entry "<<counter<<endl;
00058 }
00059 }
00060
00061
00062 JobCResult SpillTypeFilter::Reco(MomNavigator* mom)
00063 {
00064 bool foundST=false;
00065 bool passes=false;
00066
00067
00068
00069 NtpStRecord *str=dynamic_cast<NtpStRecord *>(mom->GetFragment("NtpStRecord","Primary"));
00070 if(str){
00071 foundST=true;
00072
00073 }
00074
00075
00076
00077
00078
00079
00080 Int_t evtn = 0;
00081 if(foundST){
00082 evtn=str->evthdr.nevent;
00083 }
00084
00085 const RecCandHeader *header;
00086 header = &(str->GetHeader());
00087
00088 if(header->GetRemoteSpillType()==3)
00089 {
00090 passes=true;
00091
00092 }
00093
00094
00095 if (!passes) return JobCResult::kFailed;
00096 return JobCResult::kPassed;
00097 }
00098
00100 void SpillTypeFilter::EndJob()
00101 {
00102 cout<<counter<<" events processed and "<<kept<<" were output"<<endl;
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 }
00113
00114 const Registry& SpillTypeFilter::DefaultConfig() const
00115 {
00116
00117
00118
00119 MSG("SpillTypeFilter",Msg::kDebug)<<"In Trimmer::DefaultConfig"<<endl;
00120
00121 static Registry r = fCuts.DefaultConfig();
00122
00123
00124 std::string name = this->GetName();
00125 name += ".config.default";
00126 r.SetName(name.c_str());
00127
00128
00129 r.UnLockValues();
00130 r.Set("OutputFile", "TrimmedNtuple.root");
00131
00132 r.Set("DeltaMSquare", 0.0025);
00133 r.Set("Theta23", TMath::Pi()/4);
00134 r.Set("Ue3Square", 0.01);
00135 r.Set("ReWeight", 0);
00136
00137 r.LockValues();
00138
00139 return r;
00140 }
00141
00142 void SpillTypeFilter::Config(const Registry& r)
00143 {
00144
00145
00146
00147 MSG("SpillTypeFilter",Msg::kDebug)<<"In Trimmer::Config"<<endl;
00148
00149 fCuts.Config(r);
00150
00151
00152 int imps;
00153 if(r.Get("ReWeight", imps)) {kReWeight = imps;}
00154
00155 double fmps;
00156 if(r.Get("DeltaMSquare", fmps)) {kDeltaMSquare = fmps;}
00157 if(r.Get("Ue3Square", fmps)) {kUe3Square = fmps;}
00158 if(r.Get("Theta23", fmps)) {kTheta23 = fmps;}
00159
00160 const char* tmps;
00161 if(r.Get("OutputFile", tmps)) {kOutputFile = tmps;}
00162
00163 }
00164
00165 bool SpillTypeFilter::PassesCuts()
00166 {
00167 bool passes = true;
00168 if(!fCuts.PassesFiducialVolume()) passes = false;
00169 if(!fCuts.PassesFullContainment()) passes = false;
00170
00171 if(!fCuts.PassesAllCuts()) passes = false;
00172
00173
00174
00175
00176
00177
00178
00179
00180 return passes;
00181 }
00182