CMS 3D CMS Logo

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 () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) 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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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

◆ BigEventsDebugger()

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

Definition at line 92 of file BigEventsDebugger.cc.

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

References BTVHLTOfflineSource_cfi::dirname, edm::ParameterSet::getParameter(), 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(), LaserClient_cfi::nbins, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~BigEventsDebugger()

template<class T >
BigEventsDebugger< T >::~BigEventsDebugger ( )
override

Definition at line 145 of file BigEventsDebugger.cc.

145  {
146  // do anything here that needs to be done at desctruction time
147  // (e.g. close files, deallocate resources etc.)
148 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 156 of file BigEventsDebugger.cc.

156  {
157  using namespace edm;
158 
160 
161  // create a folder for each event
162 
163  if (m_singleevents) {
164  m_hist.clear();
165  m_hprof.clear();
166  m_hist2d.clear();
167 
168  char dirname[500];
169  sprintf(dirname, "event_%u_%llu", iEvent.run(), iEvent.id().event());
170  TFileDirectory subd = tfserv->mkdir(dirname);
171 
172  //book histos
173 
174  unsigned int nbins = 768;
175  if (m_folded)
176  nbins = 256;
177 
178  for (std::vector<std::string>::const_iterator label = m_labels.begin(); label != m_labels.end(); ++label) {
179  if (m_want1dHisto) {
180  std::string hname = *label + "hist";
181  std::string htitle = *label + " occupancy";
182  m_hist.push_back(subd.make<TH1F>(hname.c_str(), htitle.c_str(), nbins, -0.5, nbins - 0.5));
183  }
184  if (m_wantProfile) {
185  std::string hname = *label + "prof";
186  std::string htitle = *label + " charge profile";
187  m_hprof.push_back(subd.make<TProfile>(hname.c_str(), htitle.c_str(), nbins, -0.5, nbins - 0.5));
188  }
189  if (m_want2dHisto) {
190  std::string hname = *label + "hist2d";
191  std::string htitle = *label + " charge distribution";
192  m_hist2d.push_back(subd.make<TH2F>(hname.c_str(), htitle.c_str(), nbins, -0.5, nbins - 0.5, 257, -0.5, 256.5));
193  }
194  }
195  }
196 
197  //analyze event
198 
199  Handle<T> digis;
200  iEvent.getByToken(m_collectionToken, digis);
201  m_digiprofiler.fill(digis, m_hist, m_hprof, m_hist2d);
202 }

References BTVHLTOfflineSource_cfi::dirname, iEvent, label, TFileService::mkdir(), LaserClient_cfi::nbins, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_collectionToken

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

Definition at line 67 of file BigEventsDebugger.cc.

◆ m_digiprofiler

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

Definition at line 66 of file BigEventsDebugger.cc.

◆ m_folded

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

Definition at line 69 of file BigEventsDebugger.cc.

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

◆ m_hist

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

Definition at line 75 of file BigEventsDebugger.cc.

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

◆ m_hist2d

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

Definition at line 77 of file BigEventsDebugger.cc.

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

◆ m_hprof

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

Definition at line 76 of file BigEventsDebugger.cc.

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

◆ m_labels

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

Definition at line 74 of file BigEventsDebugger.cc.

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

◆ m_singleevents

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

Definition at line 68 of file BigEventsDebugger.cc.

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

◆ m_want1dHisto

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

Definition at line 70 of file BigEventsDebugger.cc.

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

◆ m_want2dHisto

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

Definition at line 72 of file BigEventsDebugger.cc.

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

◆ m_wantProfile

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

Definition at line 71 of file BigEventsDebugger.cc.

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

BigEventsDebugger::m_want1dHisto
bool m_want1dHisto
Definition: BigEventsDebugger.cc:70
BigEventsDebugger::m_folded
bool m_folded
Definition: BigEventsDebugger.cc:69
BigEventsDebugger::m_hist
std::vector< TH1F * > m_hist
Definition: BigEventsDebugger.cc:75
TFileDirectory::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileDirectory.h:53
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory
Definition: TFileDirectory.h:24
BigEventsDebugger::m_digiprofiler
DigiCollectionProfiler< T > m_digiprofiler
Definition: BigEventsDebugger.cc:66
edm::Handle
Definition: AssociativeIterator.h:50
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
BigEventsDebugger::m_hist2d
std::vector< TH2F * > m_hist2d
Definition: BigEventsDebugger.cc:77
BigEventsDebugger::m_hprof
std::vector< TProfile * > m_hprof
Definition: BigEventsDebugger.cc:76
BigEventsDebugger::m_want2dHisto
bool m_want2dHisto
Definition: BigEventsDebugger.cc:72
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
BigEventsDebugger::m_singleevents
bool m_singleevents
Definition: BigEventsDebugger.cc:68
BigEventsDebugger::m_collectionToken
edm::EDGetTokenT< T > m_collectionToken
Definition: BigEventsDebugger.cc:67
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BigEventsDebugger::m_wantProfile
bool m_wantProfile
Definition: BigEventsDebugger.cc:71
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
BigEventsDebugger::m_labels
std::vector< std::string > m_labels
Definition: BigEventsDebugger.cc:74