Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SpillTypeFilter.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // FILL_IN: [Document your code!!]
00004 //
00005 // boehm@physics.harvard.edu
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" // For JOBMODULE macro
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 //  fCuts.Reset();
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   // VldContext vc;
00068    //first ask mom for a NtpStRecord
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         //      printf("SPILL TYPE %d\n",header->GetRemoteSpillType());
00092         }
00093 
00094 
00095    if (!passes) return JobCResult::kFailed;
00096    return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00097 }
00098 
00100 void SpillTypeFilter::EndJob()
00101 {
00102   cout<<counter<<" events processed and "<<kept<<" were output"<<endl;
00103 
00104   //fCuts.Report();
00105 //Now i have to output the tree
00106   // Here is where all of the writeout work will be done, first the tree and then the histos
00107 
00108   //If we are oscillating the files, then the effective exposure is only one third per file
00109   //    if you are not using an equal number of files from each type I accept no responsibility
00110   //    for the nature of your results
00111 
00112 }
00113 
00114 const Registry& SpillTypeFilter::DefaultConfig() const
00115 {
00116 //======================================================================
00117 // Supply the default configuration for the module
00118 //======================================================================
00119    MSG("SpillTypeFilter",Msg::kDebug)<<"In Trimmer::DefaultConfig"<<endl;
00120 
00121   static Registry r = fCuts.DefaultConfig();
00122  
00123   // Set name of config
00124   std::string name = this->GetName();
00125   name += ".config.default";
00126   r.SetName(name.c_str());
00127                                                                                 
00128   // Set values in configuration
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 // Configure the module given the Registry r
00146 //======================================================================
00147   MSG("SpillTypeFilter",Msg::kDebug)<<"In Trimmer::Config"<<endl;
00148   
00149   fCuts.Config(r);
00150                                                                                
00151   //  const char* tmps;
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 //    if(!fCuts.PassesFileCut())  passes = false;
00173 
00174      // Cut on min Total pulse height per prong (sigcor)
00175 //     if((nr->srevent.planes<1.05||nr->srevent.planes>16) ||
00176 //         (nr->hitcalc.fHitLongEnergy<30||nr->hitcalc.fHitLongEnergy>5000)||
00177 //         (nr->shwfit.uv_molrad_vert<0||nr->shwfit.uv_molrad_vert>5.51)||
00178 //        (nr->shwfit.par_b<0.315||nr->shwfit.par_b>1.47)) passes=false;
00179 
00180    return passes;
00181 }
00182 

Generated on Mon Feb 15 11:07:38 2010 for loon by  doxygen 1.3.9.1