Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <string>
00023 #include <iostream>
00024 #include <memory>
00025
00026
00027 #include "FWCore/Framework/interface/Frameworkfwd.h"
00028
00029 #include "HLTrigger/HLTcore/interface/HLTFilter.h"
00030 #include "FWCore/Framework/interface/Event.h"
00031 #include "FWCore/Framework/interface/MakerMacros.h"
00032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00034
00035 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00036 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00037 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00038 #include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h"
00039 #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h"
00040 #include "EventFilter/HcalRawToDigi/interface/HcalHTRData.h"
00041
00042 #include "HLTrigger/special/interface/HLTHcalNZSFilter.h"
00043
00044
00045
00046
00047 HLTHcalNZSFilter::HLTHcalNZSFilter(const edm::ParameterSet& iConfig)
00048 {
00049
00050
00051 dataInputTag_ = iConfig.getParameter<edm::InputTag>("InputTag") ;
00052 summary_ = iConfig.getUntrackedParameter<bool>("FilterSummary",false) ;
00053 }
00054
00055
00056 HLTHcalNZSFilter::~HLTHcalNZSFilter()
00057 {
00058
00059
00060
00061
00062 }
00063
00064
00065
00066
00067
00068
00069
00070 bool
00071 HLTHcalNZSFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
00072 {
00073 using namespace edm;
00074
00075
00076 if (!iEvent.isRealData()) return false;
00077
00078 edm::Handle<FEDRawDataCollection> rawdata;
00079 iEvent.getByLabel(dataInputTag_,rawdata);
00080
00081 int nFEDs = 0 ; int nNZSfed = 0 ; int nZSfed = 0 ;
00082 for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++) {
00083 const FEDRawData& fedData = rawdata->FEDData(i) ;
00084 if ( fedData.size() < 24 ) continue ;
00085 nFEDs++ ;
00086
00087
00088 HcalHTRData htr;
00089 const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(fedData.data()) ;
00090 int nZS = 0 ; int nUS = 0 ; int nSpigot = 0 ;
00091 for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
00092 if (!dccHeader->getSpigotPresent(spigot)) continue;
00093
00094
00095 dccHeader->getSpigotData(spigot,htr, fedData.size());
00096 if ((htr.getFirmwareFlavor()&0xE0)==0x80) continue ;
00097
00098 nSpigot++ ;
00099
00100 if ( htr.isUnsuppressed() ) nUS++ ;
00101 else nZS++ ;
00102 }
00103
00104 if ( nUS == nSpigot ) nNZSfed++ ;
00105 else {
00106 nZSfed++ ;
00107 if ( nUS > 0 ) LogWarning("HLTHcalNZSFilter") << "Mixture of ZS(" << nZS
00108 << ") and NZS(" << nUS
00109 << ") spigots in FED " << i ;
00110 }
00111 }
00112
00113 if ( (nNZSfed == nFEDs) && (nFEDs > 0) ) { eventsNZS_++ ; return true ; }
00114 else {
00115 if ( nNZSfed > 0 ) LogWarning("HLTHcalNZSFilter") << "Mixture of ZS(" << nZSfed
00116 << ") and NZS(" << nNZSfed
00117 << ") FEDs in this event" ;
00118 return false ;
00119 }
00120
00121 }
00122
00123
00124 void
00125 HLTHcalNZSFilter::beginJob(void)
00126 {
00127 eventsNZS_ = 0 ;
00128 }
00129
00130
00131 void
00132 HLTHcalNZSFilter::endJob(void) {
00133 if ( summary_ ) edm::LogWarning("HLTHcalNZSFilter") << "Kept " << eventsNZS_ << " non-ZS events" ;
00134 }