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

FiltCosmicModule.cxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 #include "FiltCosmicModule.h"
00006 #include "MessageService/MsgService.h"
00007 #include "MinosObjectMap/MomNavigator.h"
00008 #include "JobControl/JobCModuleRegistry.h" // For JOBMODULE macro
00009 #include "JobControl/JobCommand.h"  
00010 #include "Conventions/Munits.h"
00011 
00012 #include "CandData/CandHeader.h"
00013 #include "RecoBase/CandEventListHandle.h"
00014 #include "RecoBase/CandEventHandle.h"
00015 
00016 // ROOT includes
00017 #include "TSystem.h"
00018 #include "TFile.h"
00019 #include "TTree.h"
00020 #include "TMath.h"
00021 
00022 JOBMODULE(FiltCosmicModule, "FiltCosmicModule",
00023           "Filt");
00024 CVSID("$Id: FiltCosmicModule.cxx,v 1.1 2008/09/17 02:56:19 tjyang Exp $");
00025 //......................................................................
00026 
00027 FiltCosmicModule::FiltCosmicModule() 
00028 {
00032 
00033 }
00034 //......................................................................
00035 
00036 FiltCosmicModule::~FiltCosmicModule()
00037 {
00041 }
00042 
00043 //......................................................................
00044 
00045 void FiltCosmicModule::BeginJob()
00046 {
00050 }
00051 
00052 //......................................................................
00053 
00054 void FiltCosmicModule::EndJob()
00055 {
00059 }
00060 
00061 //......................................................................
00062 
00063 void FiltCosmicModule::BeginFile()
00064 {
00068 }
00069 
00070 //......................................................................
00071 
00072 void FiltCosmicModule::EndFile()
00073 {
00077 }
00078 
00079 //......................................................................
00080 
00081 void FiltCosmicModule::BeginRun()
00082 {
00086 }
00087 
00088 //......................................................................
00089 
00090 void FiltCosmicModule::EndRun()
00091 {
00095 }
00096 
00097 //......................................................................
00098 
00099 JobCResult FiltCosmicModule::Ana(const MomNavigator* mom)
00100 {
00101   JobCResult result = JobCResult::kFailed;
00102 
00103   CandRecord *record = dynamic_cast<CandRecord *>(mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00104  
00105   if (record == 0) {
00106     MSG("Filt",Msg::kError) << "No PrimaryCandidateRecord CandRecord found." << endl;
00107     return result;
00108   }
00109 
00110   const CandHeader* header  = dynamic_cast<const CandHeader*>(record->GetHeader());
00111   if(header){
00112     MSG("Filt",Msg::kDebug) << " Run/Snarl: " << header->GetRun() << " / "<< header->GetSnarl() <<endl;
00113   }
00114 
00115   const CandEventListHandle * eventlist = dynamic_cast<CandEventListHandle*>(record->FindCandHandle("CandEventListHandle")); 
00116 
00117   if (eventlist==NULL) {
00118     MSG("Filt",Msg::kDebug) << " Bailing out of Event eventlist = " << eventlist << endl;
00119     return result;
00120   }
00121 
00122   TIter event_iter(eventlist->GetDaughterIterator());
00123 
00124   // for cosmic ray, we only test the first event of the snarl
00125   const CandEventHandle* event = dynamic_cast<const CandEventHandle*>(event_iter());  
00126   
00127   if (event == NULL) {
00128     MSG("Filt",Msg::kDebug) << " Bailing out of Event = " << event << endl;
00129     return result;
00130   } else {
00131     MSG("Filt",Msg::kDebug) << " New event " <<endl;
00132   
00133     const int nshowers = event->GetLastShower() + 1;
00134     const int ntracks = event->GetLastTrack() + 1;
00135 
00136     MSG("Filt",Msg::kDebug) << " ntrack : " << ntracks << " nshower : " << nshowers << endl;
00137 
00138     if (nshowers<1 || ntracks<1) {
00139       return result; 
00140     } else {
00141       MSG("Filt",Msg::kDebug) << "event passed" << endl;
00142       result = JobCResult::kPassed; 
00143     }
00144   }
00145   return result;
00146 }
00147 
00148 //......................................................................
00149 
00150 JobCResult FiltCosmicModule::Reco(MomNavigator* /* mom */)
00151 {
00155   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00156 }
00157 
00158 //......................................................................
00159 
00160 void FiltCosmicModule::Report()
00161 {
00165 }
00166 
00167 //......................................................................
00168 
00169 void FiltCosmicModule::Reset()
00170 {
00174 }
00175 
00176 //......................................................................
00177 
00178 void FiltCosmicModule::HandleCommand(JobCommand* /* c */)
00179 {
00183 }
00184 

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