CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ByMultiplicityEventFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripTools
4 // Class: ByMultiplicityEventFilter
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Tue Oct 21 20:55:22 CEST 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 #include <string>
23 
24 // user include files
27 
30 
32 
33 
35 
39 
41 
43 
44 
45 //
46 // class declaration
47 //
48 
49 template <class T>
51  public:
54 
55 
56  private:
57  virtual void beginJob() override ;
58  virtual bool filter(edm::Event&, const edm::EventSetup&) override;
59  virtual void endJob() override ;
60 
61  // ----------member data ---------------------------
62 
66 
67 };
68 
69 //
70 // constants, enums and typedefs
71 //
72 
73 //
74 // static data member definitions
75 //
76 
77 //
78 // constructors and destructor
79 //
80 template <class T>
82  m_multiplicities(iConfig.getParameter<edm::ParameterSet>("multiplicityConfig"),consumesCollector()),
83  m_selector(iConfig.getParameter<std::string>("cut")),
84  m_taggedMode(iConfig.getUntrackedParameter<bool>("taggedMode", false)),
85  m_forcedValue(iConfig.getUntrackedParameter<bool>("forcedValue", true))
86 
87 
88 {
89  //now do what ever initialization is needed
90  produces<bool>();
91 
92 }
93 
94 template <class T>
96 {
97 
98  // do anything here that needs to be done at desctruction time
99  // (e.g. close files, deallocate resources etc.)
100 
101 }
102 
103 
104 //
105 // member functions
106 //
107 
108 // ------------ method called on each new Event ------------
109 template <class T>
110 bool
112 {
113  using namespace edm;
114 
115  m_multiplicities.getEvent(iEvent,iSetup);
116 
117  bool value = m_selector(m_multiplicities);
118  iEvent.put( std::auto_ptr<bool>(new bool(value)) );
119 
120  if(m_taggedMode) return m_forcedValue;
121  return value;
122 
123 }
124 
125 // ------------ method called once each job just before starting event loop ------------
126 template <class T>
127 void
129 {
130 }
131 
132 // ------------ method called once each job just after ending the event loop ------------
133 template <class T>
134 void
136 }
137 
138 
139 
140 //define this as a plug-in
141 /*
142 typedef ByMultiplicityEventFilter<SingleMultiplicity<edm::DetSetVector<SiStripDigi> > > BySiStripDigiMultiplicityEventFilter;
143 typedef ByMultiplicityEventFilter<SingleMultiplicity<edmNew::DetSetVector<SiStripCluster> > > BySiStripClusterMultiplicityEventFilter;
144 typedef ByMultiplicityEventFilter<SingleMultiplicity<edmNew::DetSetVector<SiPixelCluster> > > BySiPixelClusterMultiplicityEventFilter;
145 typedef ByMultiplicityEventFilter<MultiplicityPair<edmNew::DetSetVector<SiPixelCluster>,edmNew::DetSetVector<SiStripCluster> > > BySiPixelClusterVsSiStripClusterMultiplicityEventFilter;
146 */
153 
ByMultiplicityEventFilter< SiPixelClusterSiStripClusterMultiplicityPair > BySiPixelClusterVsSiStripClusterMultiplicityEventFilter
ByMultiplicityEventFilter< ClusterSummarySingleMultiplicity > ByClusterSummarySingleMultiplicityEventFilter
ByMultiplicityEventFilter< ClusterSummaryMultiplicityPair > ByClusterSummaryMultiplicityPairEventFilter
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
virtual bool filter(edm::Event &, const edm::EventSetup &) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
ByMultiplicityEventFilter< SingleSiStripClusterMultiplicity > BySiStripClusterMultiplicityEventFilter
ByMultiplicityEventFilter(const edm::ParameterSet &)
StringCutObjectSelector< T > m_selector
ByMultiplicityEventFilter< SingleSiPixelClusterMultiplicity > BySiPixelClusterMultiplicityEventFilter
ByMultiplicityEventFilter< SingleSiStripDigiMultiplicity > BySiStripDigiMultiplicityEventFilter
volatile std::atomic< bool > shutdown_flag false
long double T