CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripDetWithSomething.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripTools
4 // Class: SiStripDetWithSomething
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Wed Oct 22 17:54:30 CEST 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
31 
32 #include <vector>
33 
35 
37 
42 
43 //
44 // class declaration
45 //
46 
47 template <class T>
49  public:
52 
53  private:
54  virtual void beginJob() ;
55  virtual bool filter(edm::Event&, const edm::EventSetup&);
56  virtual void endJob() ;
57 
58  // ----------member data ---------------------------
59 
61  std::vector<unsigned int> _wantedmod;
62 
63 };
64 
65 //
66 // constants, enums and typedefs
67 //
68 
69 //
70 // static data member definitions
71 //
72 
73 //
74 // constructors and destructor
75 //
76 template <class T>
78  _digicollection(iConfig.getParameter<edm::InputTag>("collectionName")),
79  _wantedmod(iConfig.getUntrackedParameter<std::vector<unsigned int> >("selectedModules"))
80 
81 {
82  //now do what ever initialization is needed
83 
84  sort(_wantedmod.begin(),_wantedmod.end());
85 
86  edm::LogInfo("SelectedModules") << "Selected module list";
87  for(std::vector<unsigned int>::const_iterator mod = _wantedmod.begin();mod!=_wantedmod.end();mod++) {
88  edm::LogVerbatim("SelectedModules") << *mod ;
89  }
90 
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  Handle<T> digis;
116  iEvent.getByLabel(_digicollection,digis);
117 
118  for(typename T::const_iterator it = digis->begin();it!=digis->end();it++) {
119 
120  for(std::vector<unsigned int>::const_iterator mod=_wantedmod.begin();
121  mod!=_wantedmod.end()&&it->detId()>=*mod;
122  mod++) {
123  if(*mod == it->detId()) {
124  edm::LogInfo("ModuleFound") << " module " << *mod << " found with "
125  << it->size() << " digis/clusters";
126  return true;
127  }
128  }
129  }
130 
131  return false;
132 }
133 
134 // ------------ method called once each job just before starting event loop ------------
135 template <class T>
136 void
138 {
139 }
140 
141 // ------------ method called once each job just after ending the event loop ------------
142 template <class T>
143 void
145 }
146 
149 
150 //define this as a plug-in
SiStripDetWithSomething(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:243
SiStripDetWithSomething< edmNew::DetSetVector< SiStripCluster > > SiStripDetWithCluster
virtual bool filter(edm::Event &, const edm::EventSetup &)
list mod
Load physics model.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
SiStripDetWithSomething< edm::DetSetVector< SiStripDigi > > SiStripDetWithDigi
std::vector< unsigned int > _wantedmod