#include <HtrXmlPattern.h>
Public Member Functions | |
HtrXmlPattern (const edm::ParameterSet &) | |
~HtrXmlPattern () | |
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 |
HtrXmlPatternTool * | m_tool |
HtrXmlPatternToolParameters * | m_toolparameters |
bool | m_write_root_file |
Definition at line 21 of file HtrXmlPattern.h.
HtrXmlPattern::HtrXmlPattern | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 14 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.
{ m_filled=0; m_fill_by_hand = iConfig.getUntrackedParameter<bool>("fill_by_hand"); m_hand_pattern_number = iConfig.getUntrackedParameter<int> ("hand_pattern_number"); m_sets_to_show = iConfig.getUntrackedParameter<int> ("sets_to_show"); m_write_root_file = iConfig.getUntrackedParameter<bool>("write_root_file"); m_toolparameters = new HtrXmlPatternToolParameters; m_toolparameters->m_show_errors = iConfig.getUntrackedParameter<bool> ("show_errors"); m_toolparameters->m_presamples_per_event = iConfig.getUntrackedParameter<int> ("presamples_per_event"); m_toolparameters->m_samples_per_event = iConfig.getUntrackedParameter<int> ("samples_per_event"); m_toolparameters->m_XML_file_mode = iConfig.getUntrackedParameter<int> ("XML_file_mode"); m_toolparameters->m_file_tag = iConfig.getUntrackedParameter<std::string>("file_tag"); m_toolparameters->m_user_output_directory = iConfig.getUntrackedParameter<std::string>("user_output_directory"); std::string out_dir=m_toolparameters->m_user_output_directory; while (out_dir.find_last_of('/')==out_dir.length()-1) out_dir.erase(out_dir.find_last_of('/')); m_toolparameters->m_output_directory=out_dir+"/"+(m_toolparameters->m_file_tag)+"/"; m_tool = new HtrXmlPatternTool(m_toolparameters); }
HtrXmlPattern::~HtrXmlPattern | ( | ) |
Definition at line 39 of file HtrXmlPattern.cc.
References m_tool, and m_toolparameters.
{ delete m_tool; delete m_toolparameters; }
void HtrXmlPattern::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 46 of file HtrXmlPattern.cc.
References edm::SortedCollection< T, SORT >::begin(), trackerHits::c, prof2calltree::count, gather_cfg::cout, do_hand_fill(), edm::SortedCollection< T, SORT >::end(), HtrXmlPatternTool::Fill(), edm::EventSetup::get(), edm::Event::getManyByType(), i, j, m_fill_by_hand, m_filled, m_sets_to_show, and m_tool.
{ using namespace std; if (m_filled) return; edm::ESHandle<HcalDbService> pSetup; iSetup.get<HcalDbRecord>().get( pSetup ); const HcalElectronicsMap* readoutMap=pSetup->getHcalMapping(); if (m_fill_by_hand) { do_hand_fill(readoutMap); m_filled=1; return; } std::vector<edm::Handle<HBHEDigiCollection> > hbhe; std::vector<edm::Handle<HODigiCollection> > ho; std::vector<edm::Handle<HFDigiCollection> > hf; std::vector<edm::Handle<ZDCDigiCollection> > zdc; std::vector<edm::Handle<HcalCalibDigiCollection> > hc; std::vector<edm::Handle<HcalTrigPrimDigiCollection> > htp; std::vector<edm::Handle<HcalHistogramDigiCollection> > hh; iEvent.getManyByType(hbhe); if (hbhe.empty()) { cout << "No HB/HE Digis." << endl; } else { std::vector<edm::Handle<HBHEDigiCollection> >::iterator i; for (i=hbhe.begin(); i!=hbhe.end(); i++) { const HBHEDigiCollection& c=*(*i); int count=0; for (HBHEDigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) { const HcalElectronicsId HEID = readoutMap->lookup(j->id()); m_tool->Fill(HEID,j); if ( count++<m_sets_to_show || m_sets_to_show<0 ) { cout << *j << std::endl; cout << HEID << endl; cout << "count: " << count << endl; } } if (m_sets_to_show!=0) cout << "HB/HE count: " << count << endl; } } iEvent.getManyByType(hf); if (hf.empty()) { cout << "No HF Digis." << endl; } else { std::vector<edm::Handle<HFDigiCollection> >::iterator i; for (i=hf.begin(); i!=hf.end(); i++) { const HFDigiCollection& c=*(*i); int count=0; for (HFDigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) { const HcalElectronicsId HEID = readoutMap->lookup(j->id()); m_tool->Fill(HEID,j); if ( count++<m_sets_to_show || m_sets_to_show<0 ) { cout << *j << std::endl; cout << HEID << endl; cout << "count: " << count << endl; } } if (m_sets_to_show!=0) cout << "HF count: " << count << endl; } } iEvent.getManyByType(ho); if (ho.empty()) { cout << "No HO Digis." << endl; } else { std::vector<edm::Handle<HODigiCollection> >::iterator i; for (i=ho.begin(); i!=ho.end(); i++) { const HODigiCollection& c=*(*i); int count=0; for (HODigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) { const HcalElectronicsId HEID = readoutMap->lookup(j->id()); m_tool->Fill(HEID,j); if ( count++<m_sets_to_show || m_sets_to_show<0 ) { cout << *j << std::endl; cout << HEID << endl; cout << "count: " << count << endl; } } if (m_sets_to_show!=0) cout << "HO count: " << count << endl; } } cout << endl; }
void HtrXmlPattern::do_hand_fill | ( | const HcalElectronicsMap * | emap | ) | [private, virtual] |
Definition at line 144 of file HtrXmlPattern.cc.
References CommonMethods::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().
{ HtrXmlPatternSet *hxps=m_tool->GetPatternSet(); for (int iCrate=0;iCrate<ChannelPattern::NUM_CRATES;iCrate++) { CrateData *cd=hxps->getCrate(iCrate); if (!cd) continue; for (int iSlot=0;iSlot<ChannelPattern::NUM_SLOTS;iSlot++) { for (int iTb=0;iTb<2;iTb++) { HalfHtrData* hhd=cd->getHalfHtrData(iSlot,iTb); if (!hhd) continue; for (int iChannel=1;iChannel<25;iChannel++) { ChannelPattern *cp=hhd->getPattern(iChannel); if (!cp) continue; cp->Fill_by_hand(emap,m_hand_pattern_number); } } } } }
void HtrXmlPattern::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 168 of file HtrXmlPattern.cc.
References HtrXmlPatternTool::createHists(), m_tool, m_toolparameters, m_write_root_file, HtrXmlPatternToolParameters::m_XML_file_mode, HtrXmlPatternTool::prepareDirs(), and HtrXmlPatternTool::writeXML().
{ bool modeg0=m_toolparameters->m_XML_file_mode>0; if (modeg0 || m_write_root_file) m_tool->prepareDirs(); if (modeg0) m_tool->writeXML(); if (m_write_root_file) m_tool->createHists(); }
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().
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().