CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
BigEventsDebugger< T > Class Template Reference

#include <myTKAnalyses/BigEventsDebugger/src/BigEventsDebugger.cc>

Inheritance diagram for BigEventsDebugger< T >:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 BigEventsDebugger (const edm::ParameterSet &)
 
 ~BigEventsDebugger ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob (const edm::EventSetup &)
 
virtual void endJob ()
 

Private Attributes

edm::InputTag m_collection
 
DigiCollectionProfiler< Tm_digiprofiler
 
bool m_folded
 
std::vector< TH1F * > m_hist
 
std::vector< TH2F * > m_hist2d
 
std::vector< TProfile * > m_hprof
 
std::vector< std::string > m_labels
 
bool m_singleevents
 
bool m_want1dHisto
 
bool m_want2dHisto
 
bool m_wantProfile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<class T>
class BigEventsDebugger< T >

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 56 of file BigEventsDebugger.cc.

Constructor & Destructor Documentation

template<class T >
BigEventsDebugger< T >::BigEventsDebugger ( const edm::ParameterSet iConfig)
explicit

Definition at line 96 of file BigEventsDebugger.cc.

References edm::ParameterSet::getParameter(), diffTwoXMLs::label, BigEventsDebugger< T >::m_folded, BigEventsDebugger< T >::m_hist, BigEventsDebugger< T >::m_hist2d, BigEventsDebugger< T >::m_hprof, BigEventsDebugger< T >::m_labels, BigEventsDebugger< T >::m_singleevents, BigEventsDebugger< T >::m_want1dHisto, BigEventsDebugger< T >::m_want2dHisto, BigEventsDebugger< T >::m_wantProfile, TFileDirectory::make(), TFileDirectory::mkdir(), pileupCalc::nbins, and AlCaHLTBitMon_QueryRunRegistry::string.

96  :
97  m_digiprofiler(iConfig),
98  m_collection(iConfig.getParameter<edm::InputTag>("collection")),
99  m_singleevents(iConfig.getParameter<bool>("singleEvents")),
100  m_folded(iConfig.getUntrackedParameter<bool>("foldedStrips",false)),
101  m_want1dHisto(iConfig.getUntrackedParameter<bool>("want1dHisto",true)),
102  m_wantProfile(iConfig.getUntrackedParameter<bool>("wantProfile",true)),
103  m_want2dHisto(iConfig.getUntrackedParameter<bool>("want2dHisto",false))
104 
105 {
106  //now do what ever initialization is needed
107 
108  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet> >("selections");
109 
110  for(std::vector<edm::ParameterSet>::const_iterator selconfig=selconfigs.begin();selconfig!=selconfigs.end();++selconfig) {
111  m_labels.push_back(selconfig->getParameter<std::string>("label"));
112  }
113 
114 
116 
117  if(!m_singleevents) {
118  char dirname[500];
119  sprintf(dirname,"Summary");
120  TFileDirectory subd = tfserv->mkdir(dirname);
121 
122  //book histos
123 
124  unsigned int nbins =768;
125  if(m_folded) nbins=256;
126 
127  for(std::vector<std::string>::const_iterator label=m_labels.begin(); label!=m_labels.end(); ++label) {
128  if(m_want1dHisto) {
129  std::string hname = *label + "hist";
130  std::string htitle = *label + " occupancy";
131  m_hist.push_back(subd.make<TH1F>(hname.c_str(),htitle.c_str(),nbins,-0.5,nbins-0.5));
132  }
133  if(m_wantProfile) {
134  std::string hname = *label + "prof";
135  std::string htitle = *label + " charge profile";
136  m_hprof.push_back(subd.make<TProfile>(hname.c_str(),htitle.c_str(),nbins,-0.5,nbins-0.5));
137  }
138  if(m_want2dHisto) {
139  std::string hname = *label + "hist2d";
140  std::string htitle = *label + " charge distribution";
141  m_hist2d.push_back(subd.make<TH2F>(hname.c_str(),htitle.c_str(),nbins,-0.5,nbins-0.5,257,-0.5,256.5));
142  }
143  }
144  }
145 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< TH1F * > m_hist
std::vector< TH2F * > m_hist2d
DigiCollectionProfiler< T > m_digiprofiler
std::vector< TProfile * > m_hprof
edm::InputTag m_collection
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
std::vector< std::string > m_labels
T * make() const
make new ROOT object
template<class T >
BigEventsDebugger< T >::~BigEventsDebugger ( )

Definition at line 148 of file BigEventsDebugger.cc.

149 {
150 
151 
152  // do anything here that needs to be done at desctruction time
153  // (e.g. close files, deallocate resources etc.)
154 
155 }

Member Function Documentation

template<class T >
void BigEventsDebugger< T >::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 165 of file BigEventsDebugger.cc.

References edm::EventID::event(), edm::Event::getByLabel(), edm::EventBase::id(), diffTwoXMLs::label, TFileDirectory::mkdir(), pileupCalc::nbins, edm::Event::run(), and AlCaHLTBitMon_QueryRunRegistry::string.

166 {
167  using namespace edm;
168 
170 
171  // create a folder for each event
172 
173  if(m_singleevents) {
174 
175  m_hist.clear(); m_hprof.clear(); m_hist2d.clear();
176 
177  char dirname[500];
178  sprintf(dirname,"event_%u_%u",iEvent.run(),iEvent.id().event());
179  TFileDirectory subd = tfserv->mkdir(dirname);
180 
181  //book histos
182 
183  unsigned int nbins =768;
184  if(m_folded) nbins=256;
185 
186  for(std::vector<std::string>::const_iterator label=m_labels.begin(); label!=m_labels.end(); ++label) {
187  if(m_want1dHisto) {
188  std::string hname = *label + "hist";
189  std::string htitle = *label + " occupancy";
190  m_hist.push_back(subd.make<TH1F>(hname.c_str(),htitle.c_str(),nbins,-0.5,nbins-0.5));
191  }
192  if(m_wantProfile) {
193  std::string hname = *label + "prof";
194  std::string htitle = *label + " charge profile";
195  m_hprof.push_back(subd.make<TProfile>(hname.c_str(),htitle.c_str(),nbins,-0.5,nbins-0.5));
196  }
197  if(m_want2dHisto) {
198  std::string hname = *label + "hist2d";
199  std::string htitle = *label + " charge distribution";
200  m_hist2d.push_back(subd.make<TH2F>(hname.c_str(),htitle.c_str(),nbins,-0.5,nbins-0.5,257,-0.5,256.5));
201  }
202  }
203 
204  }
205 
206  //analyze event
207 
208  Handle<T> digis;
209  iEvent.getByLabel(m_collection,digis);
211 
212 }
EventNumber_t event() const
Definition: EventID.h:44
std::vector< TH1F * > m_hist
std::vector< TH2F * > m_hist2d
DigiCollectionProfiler< T > m_digiprofiler
std::vector< TProfile * > m_hprof
edm::InputTag m_collection
RunNumber_t run() const
Definition: Event.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
edm::EventID id() const
Definition: EventBase.h:56
std::vector< std::string > m_labels
template<class T >
void BigEventsDebugger< T >::beginJob ( const edm::EventSetup )
privatevirtual

Definition at line 218 of file BigEventsDebugger.cc.

219 {
220 }
template<class T >
void BigEventsDebugger< T >::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 225 of file BigEventsDebugger.cc.

225  {
226 }

Member Data Documentation

template<class T >
edm::InputTag BigEventsDebugger< T >::m_collection
private

Definition at line 70 of file BigEventsDebugger.cc.

template<class T >
DigiCollectionProfiler<T> BigEventsDebugger< T >::m_digiprofiler
private

Definition at line 69 of file BigEventsDebugger.cc.

template<class T >
bool BigEventsDebugger< T >::m_folded
private

Definition at line 72 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
std::vector<TH1F*> BigEventsDebugger< T >::m_hist
private

Definition at line 78 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
std::vector<TH2F*> BigEventsDebugger< T >::m_hist2d
private

Definition at line 80 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
std::vector<TProfile*> BigEventsDebugger< T >::m_hprof
private

Definition at line 79 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
std::vector<std::string> BigEventsDebugger< T >::m_labels
private

Definition at line 77 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
bool BigEventsDebugger< T >::m_singleevents
private

Definition at line 71 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
bool BigEventsDebugger< T >::m_want1dHisto
private

Definition at line 73 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
bool BigEventsDebugger< T >::m_want2dHisto
private

Definition at line 75 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().

template<class T >
bool BigEventsDebugger< T >::m_wantProfile
private

Definition at line 74 of file BigEventsDebugger.cc.

Referenced by BigEventsDebugger< T >::BigEventsDebugger().