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

FilterStream.cxx

Go to the documentation of this file.
00001 
00002 // $Id: FilterStream.cxx,v 1.4 2005/02/22 21:41:07 bspeak Exp $
00003 //
00004 // FilterStream is a simple JobCModules that passes or failes events
00005 // based on StreamType as configured in the Config method.
00006 // If any of the four conditions are met, kPassed is returned
00007 //
00008 // Author: B. Speakman 2004.09.03
00009 //
00011 #include "CandData/CandRecord.h"
00012 #include "JobControl/JobCModuleRegistry.h"
00013 #include "MinosObjectMap/MomNavigator.h"
00014 #include "MessageService/MsgService.h"
00015 #include "RawData/RawRecord.h"
00016 
00017 #include "FilterStream.h"
00018 #include "RSM.h"
00019 
00020 ClassImp(FilterStream)
00021 CVSID("$Id: FilterStream.cxx,v 1.4 2005/02/22 21:41:07 bspeak Exp $");
00022 
00023 JOBMODULE(FilterStream,"FilterStream","Filter on the Input Stream");
00024 
00025 FilterStream::FilterStream() {
00026   RSMSyn << "FilterStream::FilterStream" << endl;
00027   fPassMonitor = true;
00028   fPassSnarl = true;
00029   fPassCand = true;
00030   fPassLI = true;
00031 }
00032 
00033 FilterStream::~FilterStream() {
00034   RSMSyn << "FilterStream::~FilterStream" << endl;
00035 }
00036 
00037 JobCResult FilterStream::Ana(const MomNavigator* mom) {
00038   RSMVer << "FilterStream::Ana" << endl;
00039   bool HasMonitor = false;
00040   bool HasSnarl = false;
00041   bool HasCand = false;
00042   bool HasLI = false;
00043 
00044   const char* rcInStr = 0;
00045   RawRecord* record = 0;
00046   CandRecord* candrec = 0;
00047 
00048   TIter itr = const_cast<MomNavigator*>(mom)->FragmentIter();
00049 
00050   TObject *obj = 0;
00051   while ((obj=itr())) {
00052     if ((record=dynamic_cast<RawRecord*>(obj))) {
00053       if(!record->GetTempTags().Get("stream",rcInStr)) continue;
00054 
00055       if(!strcmp("DaqMonitor",rcInStr)) HasMonitor = true;
00056       if(!strcmp("DaqSnarl",rcInStr)) HasSnarl = true;
00057       if(!strcmp("LightInjection",rcInStr)) HasLI = true;
00058     }
00059     if((candrec=dynamic_cast<CandRecord*>(obj))) HasCand = true;
00060   }
00061 
00062   if(HasMonitor && fPassMonitor) return JobCResult::kPassed;
00063   if(HasSnarl && fPassSnarl) return JobCResult::kPassed;
00064   if(HasLI && fPassLI) return JobCResult::kPassed;
00065   if(HasCand && fPassCand) return JobCResult::kPassed;
00066 
00067   return JobCResult::kFailed;
00068 }
00069 
00070 const Registry& FilterStream::DefaultConfig() const {
00071   RSMSyn << "FilterStream::DefaultConfig" << endl;
00072   static Registry r;
00073 
00074   string name = this->JobCModule::GetName();
00075   r.SetName((name+".config.default").c_str());
00076 
00077   r.UnLockValues();
00078 
00079   r.Set("PassMonitor",1);
00080   r.Set("PassSnarl",1);
00081   r.Set("PassCand",1);
00082   r.Set("PassLI",1);
00083 
00084   r.LockValues();
00085 
00086   return r;
00087 }
00088 
00089 void FilterStream::Config(const Registry& r) {
00090   RSMSyn << "FilterStream::Config" << endl;
00091   int tmpi=0;
00092   if(r.Get("PassMonitor",tmpi)) fPassMonitor = static_cast<bool>(tmpi);
00093   if(r.Get("PassSnarl",tmpi)) fPassSnarl = static_cast<bool>(tmpi);
00094   if(r.Get("PassCand",tmpi)) fPassCand = static_cast<bool>(tmpi);
00095   if(r.Get("PassLI",tmpi)) fPassLI = static_cast<bool>(tmpi);
00096 }

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