ChannelModule.cc

00001 #include "ChannelModule.hh"
00002 #include "ConvertData.hh"
00003 #include <algorithm>
00004 ChannelModule::ChannelModule(const std::string& name, 
00005                              const std::string& helptext) :
00006   BaseModule(name, helptext)
00007 {
00008   AddDependency("ConvertData");
00009   RegisterParameter("skip_sum",_skip_sum = false,
00010                     "Skip processing the sum channel?");
00011   RegisterParameter("sum_only",_sum_only = false,
00012                     "Process only the sum channel and not others?");
00013 }
00014 
00015 ChannelModule::~ChannelModule()
00016 {
00017 }
00018 
00019 int ChannelModule::Process(EventPtr event)
00020 {
00021   int returnval = 0;
00022   _current_event = event;
00023   EventDataPtr data = event->GetEventData();
00024   for(size_t ch=0; ch < data->channels.size(); ch++){
00025     ChannelData* chdata = &(data->channels[ch]);
00026     // did we ask to skip this channel manually?
00027     if( _skip_channels.find( chdata->channel_id ) != _skip_channels.end())
00028       continue;
00029     if( _skip_sum && chdata->channel_id == ChannelData::CH_SUM)
00030       continue;
00031     if( _sum_only && chdata->channel_id != ChannelData::CH_SUM)
00032       continue;
00033     // Does this channel pass all cuts?
00034     if(CheckCuts(chdata)){
00035       returnval += Process(chdata);
00036     }
00037   }
00038   return returnval;
00039 }
00040 
00041 bool ChannelModule::CheckCuts(ChannelData* chdata)
00042 {
00043   for(std::vector<ProcessingCut*>::iterator cutit = _cuts.begin();
00044       cutit != _cuts.end(); cutit++){
00045     if((*cutit) -> ProcessChannel(chdata) == false)
00046       return false;
00047   }
00048   return true;
00049 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 20 Jun 2014 for daqman by  doxygen 1.6.1