1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// -*- C++ -*-
//
// Package: CalibTracker/SiStripDCS/plugins
// Class: FilterTrackerOn
//
/**\class FilterTrackerOn FilterTrackerOn.cc
Description: EDFilter returning true when the number of modules with HV on in the Tracker is
above a given threshold.
*/
//
// Original Author: Marco DE MATTIA
// Created: 2010/03/10 10:51:00
//
//
// system include files
#include <memory>
#include <iostream>
#include <algorithm>
// user include files
#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
class FilterTrackerOn : public edm::stream::EDFilter<> {
public:
explicit FilterTrackerOn(const edm::ParameterSet&);
static void fillDescriptions(edm::ConfigurationDescriptions&);
~FilterTrackerOn() override;
private:
bool filter(edm::Event&, const edm::EventSetup&) override;
int minModulesWithHVoff_;
edm::ESGetToken<SiStripDetVOff, SiStripDetVOffRcd> detVOffToken_;
};
FilterTrackerOn::FilterTrackerOn(const edm::ParameterSet& iConfig)
: minModulesWithHVoff_(iConfig.getParameter<int>("MinModulesWithHVoff")), detVOffToken_(esConsumes()) {}
FilterTrackerOn::~FilterTrackerOn() = default;
void FilterTrackerOn::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.setComment("Filters out events in which at least a fraction of Tracker is DCS ON");
desc.addUntracked<int>("MinModulesWithHVoff", 0);
descriptions.addWithDefaultLabel(desc);
}
bool FilterTrackerOn::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {
using namespace edm;
const auto& detVOff = iSetup.getData(detVOffToken_);
LogDebug("FilterTrackerOn") << "detVOff.getHVoffCounts() = " << detVOff.getHVoffCounts() << " < "
<< minModulesWithHVoff_;
if (detVOff.getHVoffCounts() > minModulesWithHVoff_) {
LogDebug("FilterTrackerOn") << " skipping event";
return false;
}
LogDebug("FilterTrackerOn") << " keeping event";
return true;
}
// EDFilter on the max number of modules with HV off
DEFINE_FWK_MODULE(FilterTrackerOn);
|