MCMonitorCosmic Class Reference

#include <MCMonitorCosmic.h>

Inheritance diagram for MCMonitorCosmic:
JobCModule

List of all members.

Classes

struct  DigiTrk

Public Member Functions

 MCMonitorCosmic ()
 ~MCMonitorCosmic ()
void BeginJob ()
void EndJob ()
void BeginFile ()
void EndFile ()
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Member Functions

void FillTrueHistograms (NtpStRecord *strec, NtpMCRecord *mcrec)
void FillTrueDigiHits (NtpStRecord *strec, NtpMCRecord *mcrec)

Private Attributes

MCMonitorCosmicHistogramsfHists
std::string fOutRootFileName
int fNumSnarlsInCurrFile
std::vector< int > fNumSnarlsInFile

Detailed Description

Definition at line 17 of file MCMonitorCosmic.h.


Constructor & Destructor Documentation

MCMonitorCosmic::MCMonitorCosmic (  ) 

Definition at line 25 of file MCMonitorCosmic.cxx.

References Msg::kDebug, and MSG.

00025                                  : 
00026   fHists(new MCMonitorCosmicHistograms("MCMonCosmic")),fOutRootFileName("") {
00027   // Default constructor
00028 
00029   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic constructor" << endl;
00030 
00031 }

MCMonitorCosmic::~MCMonitorCosmic (  ) 

Definition at line 33 of file MCMonitorCosmic.cxx.

References Msg::kDebug, and MSG.

00034 {
00035   // Destructor
00036   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic destructor" << endl;
00037 
00038 }


Member Function Documentation

JobCResult MCMonitorCosmic::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 101 of file MCMonitorCosmic.cxx.

References fHists, fNumSnarlsInCurrFile, MomNavigator::GetFragment(), Msg::kDebug, JobCResult::kFailed, JobCResult::kPassed, Msg::kWarning, and MSG.

00102 {
00103 
00104   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic::Ana" << endl;
00105 
00106   // get NtpSt from the file
00107   NtpStRecord* strec =
00108     dynamic_cast<NtpStRecord*>( mom->GetFragment("NtpStRecord") );
00109   // (just in case strec isn't present . . .)
00110   NtpMCRecord* mcrec = 0;
00111   NtpSRRecord* srrec = 0;
00112   NtpTHRecord* threc = 0;
00113   
00114   if (!strec) {
00115     mcrec = dynamic_cast<NtpMCRecord*>( mom->GetFragment("NtpMCRecord") );
00116     if (!mcrec) {
00117       MSG("MCMon",Msg::kWarning)
00118         << "No NtpStRecord or NtpMCRecord in Mom! Aborting . . ."
00119         << endl;
00120       return JobCResult::kFailed;
00121     }
00122     srrec = dynamic_cast<NtpSRRecord*>(mom->GetFragment("NtpSRRecord"));
00123     threc = dynamic_cast<NtpTHRecord*>(mom->GetFragment("NtpTHRecord"));
00124   } 
00125 
00126   fHists -> FillHistograms(strec, mcrec, srrec, threc);
00127 
00128   // Increment #snarls/file
00129   fNumSnarlsInCurrFile++;
00130 
00131   MSG("MCMon",Msg::kDebug) << "\n-----> Processed " << fNumSnarlsInCurrFile 
00132                            << " snarls in this file." << endl;
00133 
00134   return JobCResult::kPassed; 
00135 
00136 }

void MCMonitorCosmic::BeginFile (  )  [virtual]

Implement for notification of begin of file. See GetCurrentFile().

Reimplemented from JobCModule.

Definition at line 80 of file MCMonitorCosmic.cxx.

References Msg::kDebug, and MSG.

00080                                 {
00081   //
00082 
00083   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic::BeginFile" << endl;
00084 
00085 }

void MCMonitorCosmic::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 40 of file MCMonitorCosmic.cxx.

References Msg::kDebug, and MSG.

00040                                {
00041   
00042   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic::BeginJob" << endl;
00043 
00044 }

void MCMonitorCosmic::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 160 of file MCMonitorCosmic.cxx.

References fOutRootFileName, Registry::GetCharString(), Msg::kDebug, and MSG.

00161 {
00162   //
00163   // Configure the module given the Registry r
00164   //
00165 
00166   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic::Config" << endl;
00167 
00168   fOutRootFileName   = r.GetCharString("OutFile");
00169 }

const Registry & MCMonitorCosmic::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 138 of file MCMonitorCosmic.cxx.

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

00139 {
00140   //
00141   // Supply the default configuration for the module
00142   //
00143   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic::DefaultConfig" << endl;
00144 
00145   static Registry r; // Default configuration for module
00146 
00147   // Set name of config
00148   std::string name = this->GetName();
00149   name += ".config.default";
00150   r.SetName(name.c_str());
00151 
00152   // Set values in configuration
00153   r.UnLockValues();
00154   r.Set("OutFile","mcmonitor.root");    // Output root file for histograms
00155   r.LockValues();
00156 
00157   return r;
00158 }

void MCMonitorCosmic::EndFile (  )  [virtual]

Implement for notification of end of file. See GetLastFile().

Reimplemented from JobCModule.

Definition at line 87 of file MCMonitorCosmic.cxx.

References fNumSnarlsInCurrFile, fNumSnarlsInFile, Msg::kDebug, and MSG.

Referenced by EndJob().

00087                               {
00088 
00089   MSG("MCMon",Msg::kDebug)
00090     << "In MCMonitorCosmic::EndFile \n" 
00091     << "Num Snarls in Current File           : "
00092     << fNumSnarlsInCurrFile << endl;
00093   // Send 'number of X per file' info to vectors; increment fFileNum
00094   fNumSnarlsInFile.push_back(fNumSnarlsInCurrFile);
00095 
00096   fNumSnarlsInCurrFile = 0;
00097 
00098 }

void MCMonitorCosmic::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 46 of file MCMonitorCosmic.cxx.

References MCMonitorCosmicHistograms::AllSumw2(), EndFile(), fHists, fNumSnarlsInCurrFile, fNumSnarlsInFile, fOutRootFileName, MCMonitorCosmicHistograms::GetName(), Msg::kDebug, Msg::kInfo, MSG, MCMonitorCosmicHistograms::NumHistograms(), and MCMonitorCosmicHistograms::SetCanRebin().

00046                              {
00047   //
00048   //
00049   MSG("MCMon",Msg::kDebug) << "In MCMonitorCosmic::EndJob" << endl;
00050 
00051   if (fNumSnarlsInCurrFile !=  0) EndFile();
00052 
00053   unsigned int numFiles = fNumSnarlsInFile.size();
00054   unsigned int numSnarls = 0;
00055   for ( unsigned int ifile = 0; ifile < numFiles; ifile++ ) {
00056     numSnarls += fNumSnarlsInFile[ifile];
00057   }
00058   
00059   fHists->SetCanRebin();
00060   fHists->AllSumw2();
00061   
00062   // Send all of the histograms to output root file
00063   MSG("MCMon",Msg::kInfo)
00064      << "MCMonitor::EndJob storing histograms to file "
00065      << fOutRootFileName.c_str() << endl;
00066   HistMan hm((fHists->GetName()).c_str());
00067   hm.WriteOut(fOutRootFileName.c_str());
00068 
00069   // Print a summary of the module
00070   cout << std::string(75,'-') << endl;
00071   cout << "Processed " << numFiles << " files" << endl
00072        << "Processed " << numSnarls << " snarls" << endl
00073        << "Produced  " << fHists->NumHistograms()
00074        << " histograms written to file: " << fOutRootFileName.c_str()
00075        << endl;
00076   cout << std::string(75,'-') << endl;
00077 
00078 }

void MCMonitorCosmic::FillTrueDigiHits ( NtpStRecord strec,
NtpMCRecord mcrec 
) [private]
void MCMonitorCosmic::FillTrueHistograms ( NtpStRecord strec,
NtpMCRecord mcrec 
) [private]

Member Data Documentation

Definition at line 65 of file MCMonitorCosmic.h.

Referenced by Ana(), and EndJob().

Definition at line 71 of file MCMonitorCosmic.h.

Referenced by Ana(), EndFile(), and EndJob().

std::vector<int> MCMonitorCosmic::fNumSnarlsInFile [private]

Definition at line 72 of file MCMonitorCosmic.h.

Referenced by EndFile(), and EndJob().

std::string MCMonitorCosmic::fOutRootFileName [private]

Definition at line 68 of file MCMonitorCosmic.h.

Referenced by Config(), and EndJob().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1