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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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 () override
 

Private Attributes

edm::EDGetTokenT< Tm_collectionToken
 
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 57 of file BigEventsDebugger.cc.

Constructor & Destructor Documentation

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

Definition at line 97 of file BigEventsDebugger.cc.

References HILowLumiHLTOfflineSource_cfi::dirname, 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(), TFileService::mkdir(), pileupCalc::nbins, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 149 of file BigEventsDebugger.cc.

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

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 166 of file BigEventsDebugger.cc.

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

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

Definition at line 219 of file BigEventsDebugger.cc.

220 {
221 }
template<class T >
void BigEventsDebugger< T >::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 226 of file BigEventsDebugger.cc.

226  {
227 }

Member Data Documentation

template<class T >
edm::EDGetTokenT<T> BigEventsDebugger< T >::m_collectionToken
private

Definition at line 71 of file BigEventsDebugger.cc.

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

Definition at line 70 of file BigEventsDebugger.cc.

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

Definition at line 73 of file BigEventsDebugger.cc.

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

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

Definition at line 79 of file BigEventsDebugger.cc.

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

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

Definition at line 81 of file BigEventsDebugger.cc.

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

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

Definition at line 80 of file BigEventsDebugger.cc.

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

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

Definition at line 78 of file BigEventsDebugger.cc.

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

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

Definition at line 72 of file BigEventsDebugger.cc.

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

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

Definition at line 74 of file BigEventsDebugger.cc.

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

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

Definition at line 76 of file BigEventsDebugger.cc.

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

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

Definition at line 75 of file BigEventsDebugger.cc.

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