CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HtrXmlPattern Class Reference

#include <HtrXmlPattern.h>

Inheritance diagram for HtrXmlPattern:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HtrXmlPattern (const edm::ParameterSet &)
 
 ~HtrXmlPattern () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
virtual void do_hand_fill (const HcalElectronicsMap *)
 
void endJob () override
 

Private Attributes

bool m_fill_by_hand
 
bool m_filled
 
int m_hand_pattern_number
 
int m_sets_to_show
 
HtrXmlPatternToolm_tool
 
HtrXmlPatternToolParametersm_toolparameters
 
bool m_write_root_file
 

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 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 21 of file HtrXmlPattern.h.

Constructor & Destructor Documentation

◆ HtrXmlPattern()

HtrXmlPattern::HtrXmlPattern ( const edm::ParameterSet iConfig)
explicit

Definition at line 13 of file HtrXmlPattern.cc.

13  {
14  m_filled = false;
15  m_fill_by_hand = iConfig.getUntrackedParameter<bool>("fill_by_hand");
16  m_hand_pattern_number = iConfig.getUntrackedParameter<int>("hand_pattern_number");
17  m_sets_to_show = iConfig.getUntrackedParameter<int>("sets_to_show");
18  m_write_root_file = iConfig.getUntrackedParameter<bool>("write_root_file");
19 
21  m_toolparameters->m_show_errors = iConfig.getUntrackedParameter<bool>("show_errors");
22  m_toolparameters->m_presamples_per_event = iConfig.getUntrackedParameter<int>("presamples_per_event");
23  m_toolparameters->m_samples_per_event = iConfig.getUntrackedParameter<int>("samples_per_event");
24 
25  m_toolparameters->m_XML_file_mode = iConfig.getUntrackedParameter<int>("XML_file_mode");
28 
30  while (out_dir.find_last_of('/') == out_dir.length() - 1)
31  out_dir.erase(out_dir.find_last_of('/'));
33 
35 }

References edm::ParameterSet::getUntrackedParameter(), HtrXmlPatternToolParameters::m_file_tag, m_fill_by_hand, m_filled, m_hand_pattern_number, HtrXmlPatternToolParameters::m_output_directory, HtrXmlPatternToolParameters::m_presamples_per_event, HtrXmlPatternToolParameters::m_samples_per_event, m_sets_to_show, HtrXmlPatternToolParameters::m_show_errors, m_tool, m_toolparameters, HtrXmlPatternToolParameters::m_user_output_directory, m_write_root_file, HtrXmlPatternToolParameters::m_XML_file_mode, ValidationMatrix::out_dir, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~HtrXmlPattern()

HtrXmlPattern::~HtrXmlPattern ( )
override

Definition at line 37 of file HtrXmlPattern.cc.

37  {
38  delete m_tool;
39  delete m_toolparameters;
40 }

References m_tool, and m_toolparameters.

Member Function Documentation

◆ analyze()

void HtrXmlPattern::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 43 of file HtrXmlPattern.cc.

43  {
44  using namespace std;
45 
46  if (m_filled)
47  return;
48 
50  iSetup.get<HcalDbRecord>().get(pSetup);
51  const HcalElectronicsMap* readoutMap = pSetup->getHcalMapping();
52 
53  if (m_fill_by_hand) {
54  do_hand_fill(readoutMap);
55  m_filled = true;
56  return;
57  }
58 
59  std::vector<edm::Handle<HBHEDigiCollection> > hbhe;
60  std::vector<edm::Handle<HODigiCollection> > ho;
61  std::vector<edm::Handle<HFDigiCollection> > hf;
62  std::vector<edm::Handle<ZDCDigiCollection> > zdc;
63  std::vector<edm::Handle<HcalCalibDigiCollection> > hc;
64  std::vector<edm::Handle<HcalTrigPrimDigiCollection> > htp;
65  std::vector<edm::Handle<HcalHistogramDigiCollection> > hh;
66 
67  iEvent.getManyByType(hbhe);
68  if (hbhe.empty()) {
69  cout << "No HB/HE Digis." << endl;
70  } else {
71  std::vector<edm::Handle<HBHEDigiCollection> >::iterator i;
72  for (i = hbhe.begin(); i != hbhe.end(); i++) {
73  const HBHEDigiCollection& c = *(*i);
74 
75  int count = 0;
76  for (HBHEDigiCollection::const_iterator j = c.begin(); j != c.end(); j++) {
77  const HcalElectronicsId HEID = readoutMap->lookup(j->id());
78  m_tool->Fill(HEID, j);
79 
80  if (count++ < m_sets_to_show || m_sets_to_show < 0) {
81  cout << *j << std::endl;
82  cout << HEID << endl;
83  cout << "count: " << count << endl;
84  }
85  }
86  if (m_sets_to_show != 0)
87  cout << "HB/HE count: " << count << endl;
88  }
89  }
90 
91  iEvent.getManyByType(hf);
92  if (hf.empty()) {
93  cout << "No HF Digis." << endl;
94  } else {
95  std::vector<edm::Handle<HFDigiCollection> >::iterator i;
96  for (i = hf.begin(); i != hf.end(); i++) {
97  const HFDigiCollection& c = *(*i);
98 
99  int count = 0;
100  for (HFDigiCollection::const_iterator j = c.begin(); j != c.end(); j++) {
101  const HcalElectronicsId HEID = readoutMap->lookup(j->id());
102  m_tool->Fill(HEID, j);
103 
104  if (count++ < m_sets_to_show || m_sets_to_show < 0) {
105  cout << *j << std::endl;
106  cout << HEID << endl;
107  cout << "count: " << count << endl;
108  }
109  }
110  if (m_sets_to_show != 0)
111  cout << "HF count: " << count << endl;
112  }
113  }
114 
115  iEvent.getManyByType(ho);
116  if (ho.empty()) {
117  cout << "No HO Digis." << endl;
118  } else {
119  std::vector<edm::Handle<HODigiCollection> >::iterator i;
120  for (i = ho.begin(); i != ho.end(); i++) {
121  const HODigiCollection& c = *(*i);
122 
123  int count = 0;
124  for (HODigiCollection::const_iterator j = c.begin(); j != c.end(); j++) {
125  const HcalElectronicsId HEID = readoutMap->lookup(j->id());
126  m_tool->Fill(HEID, j);
127 
128  if (count++ < m_sets_to_show || m_sets_to_show < 0) {
129  cout << *j << std::endl;
130  cout << HEID << endl;
131  cout << "count: " << count << endl;
132  }
133  }
134  if (m_sets_to_show != 0)
135  cout << "HO count: " << count << endl;
136  }
137  }
138 
139  cout << endl;
140 }

References HltBtagPostValidation_cff::c, KineDebug3::count(), gather_cfg::cout, do_hand_fill(), HtrXmlPatternTool::Fill(), edm::EventSetup::get(), get, HcalDbService::getHcalMapping(), photonIsolationHIProducer_cfi::hbhe, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, mps_fire::i, iEvent, dqmiolumiharvest::j, HcalElectronicsMap::lookup(), m_fill_by_hand, m_filled, m_sets_to_show, m_tool, and hcalSimParameters_cfi::zdc.

◆ do_hand_fill()

void HtrXmlPattern::do_hand_fill ( const HcalElectronicsMap emap)
privatevirtual

Definition at line 142 of file HtrXmlPattern.cc.

142  {
144 
145  for (int iCrate = 0; iCrate < ChannelPattern::NUM_CRATES; iCrate++) {
146  CrateData* cd = hxps->getCrate(iCrate);
147  if (!cd)
148  continue;
149  for (int iSlot = 0; iSlot < ChannelPattern::NUM_SLOTS; iSlot++) {
150  for (int iTb = 0; iTb < 2; iTb++) {
151  HalfHtrData* hhd = cd->getHalfHtrData(iSlot, iTb);
152  if (!hhd)
153  continue;
154  for (int iChannel = 1; iChannel < 25; iChannel++) {
155  ChannelPattern* cp = hhd->getPattern(iChannel);
156  if (!cp)
157  continue;
158  cp->Fill_by_hand(emap, m_hand_pattern_number);
159  }
160  }
161  }
162  }
163 }

References hippyaddtobaddatafiles::cd(), CommonMethods::cp(), HtrXmlPatternSet::getCrate(), HalfHtrData::getPattern(), HtrXmlPatternTool::GetPatternSet(), m_hand_pattern_number, m_tool, ChannelPattern::NUM_CRATES, and ChannelPattern::NUM_SLOTS.

Referenced by analyze().

◆ endJob()

void HtrXmlPattern::endJob ( void  )
overrideprivatevirtual

Member Data Documentation

◆ m_fill_by_hand

bool HtrXmlPattern::m_fill_by_hand
private

Definition at line 34 of file HtrXmlPattern.h.

Referenced by analyze(), and HtrXmlPattern().

◆ m_filled

bool HtrXmlPattern::m_filled
private

Definition at line 35 of file HtrXmlPattern.h.

Referenced by analyze(), and HtrXmlPattern().

◆ m_hand_pattern_number

int HtrXmlPattern::m_hand_pattern_number
private

Definition at line 33 of file HtrXmlPattern.h.

Referenced by do_hand_fill(), and HtrXmlPattern().

◆ m_sets_to_show

int HtrXmlPattern::m_sets_to_show
private

Definition at line 32 of file HtrXmlPattern.h.

Referenced by analyze(), and HtrXmlPattern().

◆ m_tool

HtrXmlPatternTool* HtrXmlPattern::m_tool
private

Definition at line 30 of file HtrXmlPattern.h.

Referenced by analyze(), do_hand_fill(), endJob(), HtrXmlPattern(), and ~HtrXmlPattern().

◆ m_toolparameters

HtrXmlPatternToolParameters* HtrXmlPattern::m_toolparameters
private

Definition at line 31 of file HtrXmlPattern.h.

Referenced by endJob(), HtrXmlPattern(), and ~HtrXmlPattern().

◆ m_write_root_file

bool HtrXmlPattern::m_write_root_file
private

Definition at line 36 of file HtrXmlPattern.h.

Referenced by endJob(), and HtrXmlPattern().

HtrXmlPatternToolParameters::m_show_errors
bool m_show_errors
Definition: HtrXmlPatternToolParameters.h:12
HtrXmlPatternTool
Definition: HtrXmlPatternTool.h:9
mps_fire.i
i
Definition: mps_fire.py:355
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HtrXmlPattern::m_sets_to_show
int m_sets_to_show
Definition: HtrXmlPattern.h:32
ChannelPattern
Definition: HtrXmlPatternSet.h:8
HtrXmlPattern::m_toolparameters
HtrXmlPatternToolParameters * m_toolparameters
Definition: HtrXmlPattern.h:31
HtrXmlPatternTool::createHists
void createHists()
Definition: HtrXmlPatternTool.cc:194
HtrXmlPatternToolParameters::m_file_tag
std::string m_file_tag
Definition: HtrXmlPatternToolParameters.h:17
ValidationMatrix.out_dir
out_dir
Definition: ValidationMatrix.py:453
HalfHtrData
Definition: HtrXmlPatternSet.h:44
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::SortedCollection
Definition: SortedCollection.h:49
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HtrXmlPatternTool::writeXML
void writeXML()
Definition: HtrXmlPatternTool.cc:112
HcalDbService::getHcalMapping
const HcalElectronicsMap * getHcalMapping() const
Definition: HcalDbService.cc:343
HalfHtrData::getPattern
ChannelPattern * getPattern(int chan)
Definition: HtrXmlPatternSet.h:47
HtrXmlPatternSet
Definition: HtrXmlPatternSet.h:72
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
HtrXmlPatternToolParameters::m_output_directory
std::string m_output_directory
Definition: HtrXmlPatternToolParameters.h:19
HtrXmlPatternToolParameters::m_XML_file_mode
int m_XML_file_mode
Definition: HtrXmlPatternToolParameters.h:16
CrateData
Definition: HtrXmlPatternSet.h:62
HtrXmlPattern::m_filled
bool m_filled
Definition: HtrXmlPattern.h:35
ChannelPattern::NUM_CRATES
static const int NUM_CRATES
Definition: HtrXmlPatternSet.h:11
edm::ESHandle< HcalDbService >
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
HtrXmlPatternTool::prepareDirs
void prepareDirs()
Definition: HtrXmlPatternTool.cc:110
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
HtrXmlPatternTool::GetPatternSet
HtrXmlPatternSet * GetPatternSet()
Definition: HtrXmlPatternTool.h:19
iEvent
int iEvent
Definition: GenABIO.cc:224
photonIsolationHIProducer_cfi.ho
ho
Definition: photonIsolationHIProducer_cfi.py:10
HtrXmlPatternToolParameters::m_presamples_per_event
int m_presamples_per_event
Definition: HtrXmlPatternToolParameters.h:13
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
HtrXmlPatternTool::Fill
void Fill(const HcalElectronicsId HEID, HBHEDigiCollection::const_iterator data)
Definition: HtrXmlPatternTool.cc:41
HcalElectronicsMap
Definition: HcalElectronicsMap.h:31
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
hcalSimParameters_cfi.zdc
zdc
Definition: hcalSimParameters_cfi.py:92
HtrXmlPatternToolParameters::m_user_output_directory
std::string m_user_output_directory
Definition: HtrXmlPatternToolParameters.h:18
std
Definition: JetResolutionObject.h:76
HcalElectronicsMap::lookup
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
Definition: HcalElectronicsMap.cc:70
HtrXmlPattern::do_hand_fill
virtual void do_hand_fill(const HcalElectronicsMap *)
Definition: HtrXmlPattern.cc:142
ChannelPattern::NUM_SLOTS
static const int NUM_SLOTS
Definition: HtrXmlPatternSet.h:13
HtrXmlPattern::m_tool
HtrXmlPatternTool * m_tool
Definition: HtrXmlPattern.h:30
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40
HcalDbRecord
Definition: HcalDbRecord.h:30
HtrXmlPatternSet::getCrate
CrateData * getCrate(int crate)
Definition: HtrXmlPatternSet.cc:295
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CommonMethods.cp
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
Definition: CommonMethods.py:192
HtrXmlPatternToolParameters::m_samples_per_event
int m_samples_per_event
Definition: HtrXmlPatternToolParameters.h:14
HtrXmlPatternToolParameters
Definition: HtrXmlPatternToolParameters.h:6
HtrXmlPattern::m_write_root_file
bool m_write_root_file
Definition: HtrXmlPattern.h:36
HtrXmlPattern::m_hand_pattern_number
int m_hand_pattern_number
Definition: HtrXmlPattern.h:33
HtrXmlPattern::m_fill_by_hand
bool m_fill_by_hand
Definition: HtrXmlPattern.h:34