CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/HLTrigger/special/src/HLTL1NumberFilter.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    HLTL1NumberFilter
00004 // Class:      HLTL1NumberFilter
00005 // 
00013 //
00014 // Original Author:  Martin Grunewald
00015 //         Created:  Tue Jan 22 13:55:00 CET 2008
00016 // $Id: HLTL1NumberFilter.cc,v 1.1 2009/08/21 08:11:23 bdahmes Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <string>
00023 #include <iostream>
00024 #include <memory>
00025 
00026 // user include files
00027 #include "HLTrigger/special/interface/HLTL1NumberFilter.h"
00028 #include "DataFormats/Common/interface/Handle.h"
00029 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00030 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
00031 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00032 
00033 //
00034 // constructors and destructor
00035 //
00036 HLTL1NumberFilter::HLTL1NumberFilter(const edm::ParameterSet& iConfig)
00037 {
00038   //now do what ever initialization is needed
00039   input_  = iConfig.getParameter<edm::InputTag>("rawInput") ;   
00040   period_ = iConfig.getParameter<unsigned int>("period") ;
00041   invert_ = iConfig.getParameter<bool>("invert") ;
00042 }
00043 
00044 
00045 HLTL1NumberFilter::~HLTL1NumberFilter()
00046 {
00047  
00048   // do anything here that needs to be done at desctruction time
00049   // (e.g. close files, deallocate resources etc.)
00050 
00051 }
00052 
00053 
00054 //
00055 // member functions
00056 //
00057 
00058 // ------------ method called on each new Event  ------------
00059 bool
00060 HLTL1NumberFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
00061 {
00062   using namespace edm;
00063 
00064   if (iEvent.isRealData()) {
00065     bool accept(false);
00066     edm::Handle<FEDRawDataCollection> theRaw ;
00067     iEvent.getByLabel(input_,theRaw) ;
00068     const FEDRawData& data = theRaw->FEDData(FEDNumbering::MINTriggerGTPFEDID) ;
00069     FEDHeader header(data.data()) ;
00070     if (period_!=0) accept = ( ( (header.lvl1ID())%period_ ) == 0 );
00071     if (invert_) accept = !accept;
00072     return accept;
00073   } else {
00074     return true;
00075   }
00076 
00077 }