CMS 3D CMS Logo

LargeEvents.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripTools
4 // Class: LargeEvents
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Tue Oct 21 20:55:22 CEST 2008
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 #include <string>
22 
23 // user include files
26 
31 
33 
35 
37 
44 
47 
48 //
49 // class declaration
50 //
51 
52 template <class T>
53 class LargeEvents : public edm::EDFilter {
54 public:
55  explicit LargeEvents(const edm::ParameterSet&);
56  ~LargeEvents() override;
57 
58 private:
59  void beginJob() override;
60  bool filter(edm::Event&, const edm::EventSetup&) override;
61  void endJob() override;
62 
63  // ----------member data ---------------------------
64 
66  int _absthr;
67  int _modthr;
72 };
73 
74 //
75 // constants, enums and typedefs
76 //
77 
78 //
79 // static data member definitions
80 //
81 
82 //
83 // constructors and destructor
84 //
85 template <class T>
87  : _collectionToken(consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))),
88  _absthr(iConfig.getUntrackedParameter<int>("absoluteThreshold")),
89  _modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
90  _useQuality(iConfig.getUntrackedParameter<bool>("useQuality", false)),
91  _qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel", "")) {
92  //now do what ever initialization is needed
93 }
94 
95 template <class T>
97  // do anything here that needs to be done at desctruction time
98  // (e.g. close files, deallocate resources etc.)
99 }
100 
101 //
102 // member functions
103 //
104 
105 // ------------ method called on each new Event ------------
106 template <class T>
108  using namespace edm;
109 
110  if (_useQuality) {
111  if (_qualityWatcher.check(iSetup)) {
112  iSetup.get<SiStripQualityRcd>().get(_qualityLabel, _qualityHandle);
113  LogDebug("SiStripQualityUpdated") << "SiStripQuality has changed and it will be updated";
114  }
115  }
116 
117  Handle<T> digis;
118  iEvent.getByToken(_collectionToken, digis);
119 
120  int ndigitot = 0;
121  for (typename T::const_iterator it = digis->begin(); it != digis->end(); it++) {
122  if (!_useQuality || !_qualityHandle->IsModuleBad(it->detId())) {
123  if (_modthr < 0 || int(it->size()) < _modthr) {
124  ndigitot += it->size();
125  }
126  }
127  }
128 
129  if (ndigitot > _absthr) {
130  LogDebug("LargeEventSelected") << "event with " << ndigitot << " digi/cluster selected";
131  return true;
132  }
133 
134  return false;
135 }
136 
137 // ------------ method called once each job just before starting event loop ------------
138 template <class T>
140 
141 // ------------ method called once each job just after ending the event loop ------------
142 template <class T>
144 
145 //define this as a plug-in
149 
LargeEvents::endJob
void endJob() override
Definition: LargeEvents.cc:143
electrons_cff.bool
bool
Definition: electrons_cff.py:372
LargeEvents::LargeEvents
LargeEvents(const edm::ParameterSet &)
Definition: LargeEvents.cc:86
MessageLogger.h
funct::false
false
Definition: Factorize.h:34
edm::ESWatcher< SiStripQualityRcd >
ESHandle.h
LargeEvents::_collectionToken
edm::EDGetTokenT< T > _collectionToken
Definition: LargeEvents.cc:65
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelCluster.h
EDFilter.h
LargeEvents::~LargeEvents
~LargeEvents() override
Definition: LargeEvents.cc:96
edm::Handle
Definition: AssociativeIterator.h:50
LargeEvents::beginJob
void beginJob() override
Definition: LargeEvents.cc:139
LargeEvents::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: LargeEvents.cc:107
LargeEvents::_absthr
int _absthr
Definition: LargeEvents.cc:66
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiStripQualityRcd
Definition: SiStripDependentRecords.h:56
SiStripDigi.h
edm::ESHandle< SiStripQuality >
LargeSiPixelClusterEvents
LargeEvents< edmNew::DetSetVector< SiPixelCluster > > LargeSiPixelClusterEvents
Definition: LargeEvents.cc:148
LargeEvents::_modthr
int _modthr
Definition: LargeEvents.cc:67
LargeSiStripDigiEvents
LargeEvents< edm::DetSetVector< SiStripDigi > > LargeSiStripDigiEvents
Definition: LargeEvents.cc:146
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
SiStripCluster.h
Event.h
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:669
LargeEvents::_qualityWatcher
edm::ESWatcher< SiStripQualityRcd > _qualityWatcher
Definition: LargeEvents.cc:71
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
LargeEvents
Definition: LargeEvents.cc:53
edm::EDFilter
Definition: EDFilter.h:39
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
InputTag.h
std
Definition: JetResolutionObject.h:76
LargeEvents::_qualityHandle
edm::ESHandle< SiStripQuality > _qualityHandle
Definition: LargeEvents.cc:70
Frameworkfwd.h
ESWatcher.h
T
long double T
Definition: Basic3DVectorLD.h:48
SiStripQuality.h
SiStripQualityRcd.h
LargeEvents::_useQuality
bool _useQuality
Definition: LargeEvents.cc:68
DetSet.h
ParameterSet.h
edm::Event
Definition: Event.h:73
LargeSiStripClusterEvents
LargeEvents< edmNew::DetSetVector< SiStripCluster > > LargeSiStripClusterEvents
Definition: LargeEvents.cc:147
DetSetVectorNew.h
LargeEvents::_qualityLabel
std::string _qualityLabel
Definition: LargeEvents.cc:69