TrimModule Class Reference

#include <TrimModule.h>

Inheritance diagram for TrimModule:
JobCModule

List of all members.

Public Member Functions

 TrimModule ()
 ~TrimModule ()
JobCResult Reco (MomNavigator *mom)
void EndJob ()
void BeginJob ()
bool PassesCuts (NueRecord *nr)
bool PassesBeamCuts (NueRecord *nr)
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Attributes

int counter
int kept
NueAnalysisCuts fCuts
std::string kOutputFile
Int_t kReWeight
Float_t kTheta23
Float_t kUe3Square
Float_t kDeltaMSquare

Detailed Description

Definition at line 25 of file TrimModule.h.


Constructor & Destructor Documentation

TrimModule::TrimModule (  ) 

Definition at line 35 of file TrimModule.cxx.

00035                       :
00036   counter(0),
00037   kOutputFile("TrimmedOut.root"),
00038   kReWeight(0),
00039   kTheta23(1.0),
00040   kUe3Square(0.01),
00041   kDeltaMSquare(0.0025)
00042 {}

TrimModule::~TrimModule (  ) 

Definition at line 46 of file TrimModule.cxx.

00047 {}


Member Function Documentation

void TrimModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 50 of file TrimModule.cxx.

References counter, and kept.

00051 {
00052   kept = 0;
00053 //  fCuts.Reset();
00054   if(counter%1000==0){
00055     cout<<"On entry "<<counter<<endl;
00056   }
00057 }

void TrimModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 165 of file TrimModule.cxx.

References NueAnalysisCuts::Config(), fCuts, Registry::Get(), Msg::kDebug, kDeltaMSquare, kOutputFile, kReWeight, kTheta23, kUe3Square, and MSG.

00166 {
00167 //======================================================================
00168 // Configure the module given the Registry r
00169 //======================================================================
00170   MSG("TrimModule",Msg::kDebug)<<"In TrimModule::Config"<<endl;
00171   
00172   fCuts.Config(r);
00173                                                                                
00174   //  const char* tmps;
00175   int imps;
00176   if(r.Get("ReWeight", imps)) {kReWeight = imps;}
00177   
00178   double fmps;
00179   if(r.Get("DeltaMSquare", fmps)) {kDeltaMSquare = fmps;}
00180   if(r.Get("Ue3Square", fmps))    {kUe3Square = fmps;}
00181   if(r.Get("Theta23", fmps))  {kTheta23 = fmps;}
00182 
00183   const char* tmps;
00184   if(r.Get("OutputFile", tmps)) {kOutputFile = tmps;}
00185   
00186 }

const Registry & TrimModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 137 of file TrimModule.cxx.

References NueAnalysisCuts::DefaultConfig(), fCuts, JobCModule::GetName(), Msg::kDebug, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00138 {
00139 //======================================================================
00140 // Supply the default configuration for the module
00141 //======================================================================
00142    MSG("TrimModule",Msg::kDebug)<<"In TrimModule::DefaultConfig"<<endl;
00143 
00144   static Registry r = fCuts.DefaultConfig();
00145  
00146   // Set name of config
00147   std::string name = this->GetName();
00148   name += ".config.default";
00149   r.SetName(name.c_str());
00150                                                                                 
00151   // Set values in configuration
00152   r.UnLockValues();
00153   r.Set("OutputFile", "TrimmedNtuple.root");
00154 
00155   r.Set("DeltaMSquare", 0.0025);
00156   r.Set("Theta23", TMath::Pi()/4);
00157   r.Set("Ue3Square", 0.01);
00158   r.Set("ReWeight", 0);
00159   
00160   r.LockValues();
00161                                                                                 
00162   return r;
00163 }

void TrimModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 123 of file TrimModule.cxx.

References counter, and kept.

00124 {
00125   cout<<counter<<" events processed and "<<kept<<" were output"<<endl;
00126 
00127   //fCuts.Report();
00128 //Now i have to output the tree
00129   // Here is where all of the writeout work will be done, first the tree and then the histos
00130 
00131   //If we are oscillating the files, then the effective exposure is only one third per file
00132   //    if you are not using an equal number of files from each type I accept no responsibility
00133   //    for the nature of your results
00134 
00135 }

bool TrimModule::PassesBeamCuts ( NueRecord nr  ) 

Definition at line 188 of file TrimModule.cxx.

References fCuts, RecRecordImp< T >::GetHeader(), VldContext::GetSimFlag(), RecHeader::GetVldContext(), SimFlag::kData, and NueAnalysisCuts::PassesBeamCut().

Referenced by Reco().

00189 {
00190   //bool passes = true;
00191   if(nr->GetHeader().GetVldContext().GetSimFlag()!=SimFlag::kData) return true;
00192   if(fCuts.PassesBeamCut()) return true;;
00193 
00194   return false;
00195 }

bool TrimModule::PassesCuts ( NueRecord nr  ) 

Definition at line 199 of file TrimModule.cxx.

References fCuts, NueAnalysisCuts::PassesAllCuts(), NueAnalysisCuts::PassesFiducialVolume(), and NueAnalysisCuts::PassesFullContainment().

Referenced by Reco().

00200 {
00201     bool passes = true;   
00202     if(nr == 0) return false;
00203     if(!fCuts.PassesFiducialVolume())    passes = false;
00204     if(!fCuts.PassesFullContainment())  passes = false;   
00205      
00206     if(!fCuts.PassesAllCuts())           passes = false;
00207 
00208      // Cut on min Total pulse height per prong (sigcor)
00209 //     if((nr->srevent.planes<1.05||nr->srevent.planes>16) ||
00210 //         (nr->hitcalc.fHitLongEnergy<30||nr->hitcalc.fHitLongEnergy>5000)||
00211 //         (nr->shwfit.uv_molrad_vert<0||nr->shwfit.uv_molrad_vert>5.51)||
00212 //        (nr->shwfit.par_b<0.315||nr->shwfit.par_b>1.47)) passes=false;
00213 
00214    return passes;
00215 }

JobCResult TrimModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 60 of file TrimModule.cxx.

References counter, ANtpTruthInfoBeamNue::DeltamSquared23, fCuts, ANtpTruthInfoBeamNue::fOscProb, MomNavigator::FragmentIter(), NueHeader::GetEventNo(), RecRecordImp< T >::GetHeader(), NueHeader::GetSnarl(), Msg::kDebug, kDeltaMSquare, kept, Msg::kError, JobCResult::kPassed, kReWeight, kTheta23, kUe3Square, NueRecord::mctrue, MSG, ANtpTruthInfoBeam::nonOscNuFlavor, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, Oscillate(), PassesBeamCuts(), PassesCuts(), NueAnalysisCuts::SetInfoObject(), ANtpTruthInfoBeamNue::Theta23, and ANtpTruthInfoBeamNue::Ue3Squared.

00061 {
00062    //get all NueRecords from mom 
00063    //may have more than one per go since mom reads in a snarl's worth of data
00064    //so, this is a little more complicated than just asking for a NueRecord
00065    TObject *obj=0;
00066 //  static Float_t total_pot = 0;
00067 
00068    vector<NueRecord *> records;
00069 
00070    TIter objiter = mom->FragmentIter();
00071    while((obj=objiter.Next())){
00072       NueRecord *nr = dynamic_cast<NueRecord *>(obj);
00073       if(nr){
00074          MSG("TrimModule",Msg::kDebug)<<"Found a NueRecord in MOM"<<endl;
00075       }
00076       else{
00077          MSG("TrimModule",Msg::kError)<<"Didn't find a NueRecord in MOM"<<endl;
00078          continue;
00079       }
00080       nr->SetName("NueRecord_junk");
00081       MSG("TrimModule",Msg::kDebug)<<"Found a NueRecord in MOM"
00082                        <<" Snarl "<<nr->GetHeader().GetSnarl()
00083                        <<" Event "<<nr->GetHeader().GetEventNo()<<endl;
00084  
00085       if(nr->GetHeader().GetEventNo()<0){
00086         continue;
00087       }
00088 
00089       if(kReWeight)
00090       {
00091           int nuFlavor = nr->mctrue.nuFlavor;
00092           int  nonOsc = nr->mctrue.nonOscNuFlavor;
00093           float energy = nr->mctrue.nuEnergy;
00094                                                                                 
00095           Float_t newWeight = NueConvention::Oscillate(nuFlavor, nonOsc, energy,
00096                                 735, kDeltaMSquare, kTheta23, kUe3Square);
00097                                                                   
00098           nr->mctrue.Ue3Squared = kUe3Square;
00099           nr->mctrue.DeltamSquared23 = kDeltaMSquare;
00100           nr->mctrue.Theta23  = kTheta23;
00101           nr->mctrue.fOscProb = newWeight;
00102       }
00103 
00104       fCuts.SetInfoObject(nr);
00105       if(PassesCuts(nr) && PassesBeamCuts(nr)){
00106            MSG("TrimModule",Msg::kDebug)<<"Excellent a NueRecord survives"
00107                      <<" Snarl "<<nr->GetHeader().GetSnarl()
00108                      <<" Event "<<nr->GetHeader().GetEventNo()<<endl;
00109 
00110            nr->SetName("NueRecord_trim");
00111            kept++;
00112       }
00113       if(counter%1000==0){
00114          cout<<"On entry "<<counter<<endl;
00115       }
00116       counter++;
00117    }
00118 
00119    return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00120 }


Member Data Documentation

int TrimModule::counter [private]

Definition at line 44 of file TrimModule.h.

Referenced by BeginJob(), EndJob(), and Reco().

Definition at line 47 of file TrimModule.h.

Referenced by Config(), DefaultConfig(), PassesBeamCuts(), PassesCuts(), and Reco().

Float_t TrimModule::kDeltaMSquare [private]

Definition at line 54 of file TrimModule.h.

Referenced by Config(), and Reco().

int TrimModule::kept [private]

Definition at line 45 of file TrimModule.h.

Referenced by BeginJob(), EndJob(), and Reco().

std::string TrimModule::kOutputFile [private]

Definition at line 49 of file TrimModule.h.

Referenced by Config().

Int_t TrimModule::kReWeight [private]

Definition at line 51 of file TrimModule.h.

Referenced by Config(), and Reco().

Float_t TrimModule::kTheta23 [private]

Definition at line 52 of file TrimModule.h.

Referenced by Config(), and Reco().

Float_t TrimModule::kUe3Square [private]

Definition at line 53 of file TrimModule.h.

Referenced by Config(), and Reco().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1