CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BigEventsDebugger.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: BigEventsDebugger
4 // Class: BigEventsDebugger
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Sun Nov 16 16:04:44 CET 2008
16 // $Id: BigEventsDebugger.cc,v 1.1 2011/10/02 16:58:33 venturia Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
31 
33 
34 #include <vector>
35 #include "TH2F.h"
36 #include "TProfile.h"
37 
39 
42 
46 
48 
49 //
50 // class decleration
51 //
52 
54  public:
55  explicit BigEventsDebugger(const edm::ParameterSet&);
57 
58 
59  private:
60  virtual void beginJob(const edm::EventSetup&) ;
61  virtual void analyze(const edm::Event&, const edm::EventSetup&);
62  virtual void endJob() ;
63 
64  // ----------member data ---------------------------
65 
67 
68  TProfile* m_tibprof;
69  TProfile* m_tobprof;
70  TProfile* m_tecpprof;
71  TProfile* m_tecmprof;
72 
73  TH2F* m_tib2d;
74  TH2F* m_tob2d;
75  TH2F* m_tecp2d;
76  TH2F* m_tecm2d;
77 
78  std::vector<unsigned int> m_maskedmod;
79 };
80 
81 //
82 // constants, enums and typedefs
83 //
84 
85 //
86 // static data member definitions
87 //
88 
89 //
90 // constructors and destructor
91 //
93  m_singleevents(iConfig.getParameter<bool>("singleEvents")),
94  m_maskedmod(iConfig.getUntrackedParameter<std::vector<unsigned int> >("maskedModules"))
95 
96 {
97  //now do what ever initialization is needed
98 
99  sort(m_maskedmod.begin(),m_maskedmod.end());
100 
102 
103  if(!m_singleevents) {
104  char dirname[500];
105  sprintf(dirname,"Summary");
106  TFileDirectory subd = tfserv->mkdir(dirname);
107 
108  //book histos
109 
110  m_tibprof = subd.make<TProfile>("tibprof","TIB Digi charge profile",256,-0.5,255.5);
111  m_tobprof = subd.make<TProfile>("tobprof","TOB Digi charge profile",256,-0.5,255.5);
112  m_tecpprof = subd.make<TProfile>("tecpprof","TECp Digi charge profile",256,-0.5,255.5);
113  m_tecmprof = subd.make<TProfile>("tecmprof","TECm Digi charge profile",256,-0.5,255.5);
114 
115  m_tib2d = subd.make<TH2F>("tib2d","TIB Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
116  m_tob2d = subd.make<TH2F>("tob2d","TOB Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
117  m_tecp2d = subd.make<TH2F>("tecp2d","TECp Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
118  m_tecm2d = subd.make<TH2F>("tecm2d","TECm Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
119 
120  }
121 
122 }
123 
124 
126 {
127 
128 
129  // do anything here that needs to be done at desctruction time
130  // (e.g. close files, deallocate resources etc.)
131 
132 }
133 
134 
135 //
136 // member functions
137 //
138 
139 // ------------ method called to for each event ------------
140 void
142 {
143  using namespace edm;
144 
146 
147  // create a folder for each event
148 
149  if(m_singleevents) {
150 
151  char dirname[500];
152  sprintf(dirname,"event_%u_%u",iEvent.run(),iEvent.id().event());
153  TFileDirectory subd = tfserv->mkdir(dirname);
154 
155  //book histos
156 
157  m_tibprof = subd.make<TProfile>("tibprof","TIB Digi charge profile",256,-0.5,255.5);
158  m_tobprof = subd.make<TProfile>("tobprof","TOB Digi charge profile",256,-0.5,255.5);
159  m_tecpprof = subd.make<TProfile>("tecpprof","TECp Digi charge profile",256,-0.5,255.5);
160  m_tecmprof = subd.make<TProfile>("tecmprof","TECm Digi charge profile",256,-0.5,255.5);
161 
162  m_tib2d = subd.make<TH2F>("tib2d","TIB Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
163  m_tob2d = subd.make<TH2F>("tob2d","TOB Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
164  m_tecp2d = subd.make<TH2F>("tecp2d","TECp Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
165  m_tecm2d = subd.make<TH2F>("tecm2d","TECm Digi charge distribution",256,-0.5,255.5,257,-0.5,256.5);
166 
167  }
168 
169  //analyze event
170 
172  m_tobprof,
173  m_tecpprof,
174  m_tecmprof,
175  m_tib2d,
176  m_tob2d,
177  m_tecp2d,
178  m_tecm2d);
179 
181  iEvent.getByLabel("siStripDigis","ZeroSuppressed",digis);
182  profiler.setMaskedModules(m_maskedmod);
183  profiler.analyze(digis);
184 
185 }
186 
187 
188 // ------------ method called once each job just before starting event loop ------------
189 void
191 {
192  edm::LogInfo("MaskedModules") << m_maskedmod.size() << " masked modules ";
193  for(std::vector<unsigned int>::const_iterator it=m_maskedmod.begin();it!=m_maskedmod.end();it++) {
194  edm::LogVerbatim("MaskedModules") << (*it);
195  }
196 }
197 
198 // ------------ method called once each job just after ending the event loop ------------
199 void
201 }
202 
203 //define this as a plug-in
EventNumber_t event() const
Definition: EventID.h:44
virtual void beginJob()
Definition: EDAnalyzer.h:58
std::vector< unsigned int > m_maskedmod
void setMaskedModules(std::vector< unsigned int > maskedmod)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:243
RunNumber_t run() const
Definition: Event.h:67
BigEventsDebugger(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void endJob()
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
edm::EventID id() const
Definition: EventBase.h:56
T * make() const
make new ROOT object
void analyze(edm::Handle< edm::DetSetVector< SiStripDigi > > digis)