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 ()
 
- 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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void do_hand_fill (const HcalElectronicsMap *)
 
virtual void endJob ()
 

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 &)
 
- 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

Definition at line 21 of file HtrXmlPattern.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file HtrXmlPattern.cc.

References edm::ParameterSet::getUntrackedParameter(), m_fill_by_hand, m_filled, m_hand_pattern_number, m_sets_to_show, HtrXmlPatternToolParameters::m_show_errors, m_tool, m_toolparameters, m_write_root_file, ValidationMatrix::out_dir, and AlCaHLTBitMon_QueryRunRegistry::string.

14 {
15  m_filled=0;
16  m_fill_by_hand = iConfig.getUntrackedParameter<bool>("fill_by_hand");
17  m_hand_pattern_number = iConfig.getUntrackedParameter<int> ("hand_pattern_number");
18  m_sets_to_show = iConfig.getUntrackedParameter<int> ("sets_to_show");
19  m_write_root_file = iConfig.getUntrackedParameter<bool>("write_root_file");
20 
22  m_toolparameters->m_show_errors = iConfig.getUntrackedParameter<bool> ("show_errors");
23  m_toolparameters->m_presamples_per_event = iConfig.getUntrackedParameter<int> ("presamples_per_event");
24  m_toolparameters->m_samples_per_event = iConfig.getUntrackedParameter<int> ("samples_per_event");
25 
26  m_toolparameters->m_XML_file_mode = iConfig.getUntrackedParameter<int> ("XML_file_mode");
27  m_toolparameters->m_file_tag = iConfig.getUntrackedParameter<std::string>("file_tag");
28  m_toolparameters->m_user_output_directory = iConfig.getUntrackedParameter<std::string>("user_output_directory");
29 
30  std::string out_dir=m_toolparameters->m_user_output_directory;
31  while (out_dir.find_last_of('/')==out_dir.length()-1) out_dir.erase(out_dir.find_last_of('/'));
32  m_toolparameters->m_output_directory=out_dir+"/"+(m_toolparameters->m_file_tag)+"/";
33 
34  m_tool = new HtrXmlPatternTool(m_toolparameters);
35 }
T getUntrackedParameter(std::string const &, T const &) const
HtrXmlPatternToolParameters * m_toolparameters
Definition: HtrXmlPattern.h:31
int m_hand_pattern_number
Definition: HtrXmlPattern.h:33
bool m_write_root_file
Definition: HtrXmlPattern.h:36
HtrXmlPatternTool * m_tool
Definition: HtrXmlPattern.h:30
HtrXmlPattern::~HtrXmlPattern ( )

Definition at line 38 of file HtrXmlPattern.cc.

References m_tool, and m_toolparameters.

39 {
40  delete m_tool;
41  delete m_toolparameters;
42 }
HtrXmlPatternToolParameters * m_toolparameters
Definition: HtrXmlPattern.h:31
HtrXmlPatternTool * m_tool
Definition: HtrXmlPattern.h:30

Member Function Documentation

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

Definition at line 45 of file HtrXmlPattern.cc.

References edm::SortedCollection< T, SORT >::begin(), EnergyCorrector::c, KineDebug3::count(), gather_cfg::cout, do_hand_fill(), edm::SortedCollection< T, SORT >::end(), HtrXmlPatternTool::Fill(), edm::EventSetup::get(), HcalDbService::getHcalMapping(), edm::Event::getManyByType(), photonIsolationHIProducer_cfi::hbhe, AnalysisDataFormats_SUSYBSMObjects::hc, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, mps_fire::i, HcalElectronicsMap::lookup(), m_fill_by_hand, m_filled, m_sets_to_show, m_tool, and hcalSimParameters_cfi::zdc.

46 {
47  using namespace std;
48 
49  if (m_filled) return;
50 
52  iSetup.get<HcalDbRecord>().get( pSetup );
53  const HcalElectronicsMap* readoutMap=pSetup->getHcalMapping();
54 
55  if (m_fill_by_hand) {
56  do_hand_fill(readoutMap);
57  m_filled=1;
58  return;
59  }
60 
61  std::vector<edm::Handle<HBHEDigiCollection> > hbhe;
62  std::vector<edm::Handle<HODigiCollection> > ho;
63  std::vector<edm::Handle<HFDigiCollection> > hf;
64  std::vector<edm::Handle<ZDCDigiCollection> > zdc;
65  std::vector<edm::Handle<HcalCalibDigiCollection> > hc;
66  std::vector<edm::Handle<HcalTrigPrimDigiCollection> > htp;
67  std::vector<edm::Handle<HcalHistogramDigiCollection> > hh;
68 
69  iEvent.getManyByType(hbhe);
70  if (hbhe.empty()) {
71  cout << "No HB/HE Digis." << endl;
72  } else {
73  std::vector<edm::Handle<HBHEDigiCollection> >::iterator i;
74  for (i=hbhe.begin(); i!=hbhe.end(); i++) {
75  const HBHEDigiCollection& c=*(*i);
76 
77  int count=0;
78  for (HBHEDigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) {
79  const HcalElectronicsId HEID = readoutMap->lookup(j->id());
80  m_tool->Fill(HEID,j);
81 
82  if ( count++<m_sets_to_show || m_sets_to_show<0 ) {
83  cout << *j << std::endl;
84  cout << HEID << endl;
85  cout << "count: " << count << endl;
86  }
87  }
88  if (m_sets_to_show!=0) cout << "HB/HE count: " << count << endl;
89  }
90  }
91 
92  iEvent.getManyByType(hf);
93  if (hf.empty()) {
94  cout << "No HF Digis." << endl;
95  } else {
96  std::vector<edm::Handle<HFDigiCollection> >::iterator i;
97  for (i=hf.begin(); i!=hf.end(); i++) {
98  const HFDigiCollection& c=*(*i);
99 
100  int count=0;
101  for (HFDigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) {
102  const HcalElectronicsId HEID = readoutMap->lookup(j->id());
103  m_tool->Fill(HEID,j);
104 
105  if ( count++<m_sets_to_show || m_sets_to_show<0 ) {
106  cout << *j << std::endl;
107  cout << HEID << endl;
108  cout << "count: " << count << endl;
109  }
110  }
111  if (m_sets_to_show!=0) 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) cout << "HO count: " << count << endl;
135  }
136  }
137 
138  cout << endl;
139 
140 }
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:450
std::vector< HBHEDataFrame >::const_iterator const_iterator
const_iterator end() const
void Fill(const HcalElectronicsId HEID, HBHEDigiCollection::const_iterator data)
const T & get() const
Definition: EventSetup.h:56
susybsm::HSCParticleCollection hc
Definition: classes.h:25
const HcalElectronicsMap * getHcalMapping() const
virtual void do_hand_fill(const HcalElectronicsMap *)
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
const_iterator begin() const
HtrXmlPatternTool * m_tool
Definition: HtrXmlPattern.h:30
void HtrXmlPattern::do_hand_fill ( const HcalElectronicsMap emap)
privatevirtual

Definition at line 143 of file HtrXmlPattern.cc.

References SimDataFormats::CaloAnalysis::cp, ChannelPattern::Fill_by_hand(), HtrXmlPatternSet::getCrate(), CrateData::getHalfHtrData(), HalfHtrData::getPattern(), HtrXmlPatternTool::GetPatternSet(), m_hand_pattern_number, m_tool, ChannelPattern::NUM_CRATES, and ChannelPattern::NUM_SLOTS.

Referenced by analyze().

144 {
146 
147  for (int iCrate=0;iCrate<ChannelPattern::NUM_CRATES;iCrate++) {
148  CrateData *cd=hxps->getCrate(iCrate);
149  if (!cd) continue;
150  for (int iSlot=0;iSlot<ChannelPattern::NUM_SLOTS;iSlot++) {
151  for (int iTb=0;iTb<2;iTb++) {
152  HalfHtrData* hhd=cd->getHalfHtrData(iSlot,iTb);
153  if (!hhd) continue;
154  for (int iChannel=1;iChannel<25;iChannel++) {
155  ChannelPattern *cp=hhd->getPattern(iChannel);
156  if (!cp) continue;
158  }
159  }
160  }
161  }
162 
163 }
void Fill_by_hand(const HcalElectronicsMap *, int)
static const int NUM_CRATES
ChannelPattern * getPattern(int chan)
int m_hand_pattern_number
Definition: HtrXmlPattern.h:33
static const int NUM_SLOTS
HtrXmlPatternSet * GetPatternSet()
HalfHtrData * getHalfHtrData(int slot, int one_two_tb)
CrateData * getCrate(int crate)
HtrXmlPatternTool * m_tool
Definition: HtrXmlPattern.h:30
void HtrXmlPattern::endJob ( void  )
privatevirtual

Member Data Documentation

bool HtrXmlPattern::m_fill_by_hand
private

Definition at line 34 of file HtrXmlPattern.h.

Referenced by analyze(), and HtrXmlPattern().

bool HtrXmlPattern::m_filled
private

Definition at line 35 of file HtrXmlPattern.h.

Referenced by analyze(), and HtrXmlPattern().

int HtrXmlPattern::m_hand_pattern_number
private

Definition at line 33 of file HtrXmlPattern.h.

Referenced by do_hand_fill(), and HtrXmlPattern().

int HtrXmlPattern::m_sets_to_show
private

Definition at line 32 of file HtrXmlPattern.h.

Referenced by analyze(), and HtrXmlPattern().

HtrXmlPatternTool* HtrXmlPattern::m_tool
private

Definition at line 30 of file HtrXmlPattern.h.

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

HtrXmlPatternToolParameters* HtrXmlPattern::m_toolparameters
private

Definition at line 31 of file HtrXmlPattern.h.

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

bool HtrXmlPattern::m_write_root_file
private

Definition at line 36 of file HtrXmlPattern.h.

Referenced by endJob(), and HtrXmlPattern().