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

NtpSRFilterModule.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // NtpSRFilterModule.cxx
00004 //
00005 // A JobControl Module for filtering a filled NtpSRRecord to a subset
00006 // of its data.
00007 //
00009 #include <iostream>
00010 using namespace std;
00011 
00012 #include "CandNtupleSR/Module/NtpSRFilterModule.h"
00013 #include "CandNtupleSR/NtpSRRecord.h"
00014 #include "MessageService/MsgService.h"
00015 #include "JobControl/JobCModuleRegistry.h"
00016 #include "JobControl/JobCommand.h"
00017 #include "MinosObjectMap/MomNavigator.h"
00018 
00019 #include <cassert>
00020 
00021 ClassImp(NtpSRFilterModule)
00022 
00023 //   Definition of static data members
00024 //   *********************************
00025 
00026 CVSID("$Id: NtpSRFilterModule.cxx,v 1.10 2005/03/06 04:26:34 asousa Exp $");
00027 JOBMODULE(NtpSRFilterModule, "NtpSRFilterModule",
00028          "A module for filtering filled SR ntuple records.");
00029 
00030 
00031 // Definition of methods (alphabetical order)
00032 // ***************************************************
00033 
00034 //......................................................................
00035 
00036 const Registry& NtpSRFilterModule::DefaultConfig() const {
00037   //
00038   // Purpose: Method to return default configuration.
00039   // 
00040   // Arguments: none.
00041   //
00042   // Return: Registry containing default configuration
00043   //
00044 
00045   MSG("NtpSR",Msg::kDebug) << 
00046     "NtpSRFilterModule::DefaultConfig" << endl;
00047 
00048   static Registry r; 
00049   std::string name = this->JobCModule::GetName();
00050   name += ".config.default";
00051   r.SetName(name.c_str());
00052 
00053   r.UnLockValues();
00054   r.Set("PreScale",1000000000);
00055   r.Set("RecordName","Primary");
00056   r.LockValues();
00057 
00058   return r;
00059 }
00060 
00061 //......................................................................
00062 
00063 void NtpSRFilterModule::Config(const Registry& r) {
00064   //
00065   // Purpose: Configure the module given a registry.
00066   //
00067   // Arguments: Registry to use to configure the module.
00068   //
00069   // Return: none.
00070   //
00071 
00072   MSG("NtpSR",Msg::kDebug) << "NtpSRFilterModule::Config" << endl;
00073   
00074   Int_t tmpi;
00075   //  Double_t tmpd;
00076   const Char_t* tmps;
00077 
00078   if ( r.Get("PreScale",tmpi) ) fPreScale = tmpi;
00079   if ( r.Get("RecordName",tmps) ) fRecordName = tmps;
00080 
00081 }
00082 
00083 //......................................................................
00084 
00085 JobCResult NtpSRFilterModule::Reco(MomNavigator *mom) {
00086   //
00087   //  Purpose:  Filter contents of existing ntuple record.
00088   //
00089   //  Arguments: mom.
00090   //  
00091   //  Return: status.
00092   // 
00093 
00094   JobCResult result(JobCResult::kPassed);  
00095   MSG("NtpSR",Msg::kDebug) << "NtpSRFilterModule::Reco" << endl;
00096 
00097   // Check that mom exists.
00098   assert(mom);
00099 
00100   NtpSRRecord* ntprec = dynamic_cast<NtpSRRecord*>
00101      (mom->GetFragment("NtpSRRecord",fRecordName.c_str()));
00102   if (!ntprec) {
00103     MSG("NtpSR",Msg::kWarning) << "No NtpSRRecord of name " 
00104                                << fRecordName.c_str() << " in Mom" << endl;
00105     result.SetWarning().SetFailed();
00106     return result;
00107   }
00108 
00109   fNReco++;
00110   if ( fNReco%fPreScale == 0 ) return result; // every nth record is skipped
00111 
00112   // Purge strip data from record
00113   ntprec -> ClearStrips();
00114 
00115   return result;
00116 
00117 }
00118 
00119 
00120 
00121 
00122 
00123 

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