#include <IORawData/CaloPatterns/src/HtrXmlPattern.h>
Public Member Functions | |
HtrXmlPattern (const edm::ParameterSet &) | |
~HtrXmlPattern () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
Private Attributes | |
int | m_sets_to_show |
HtrXmlPatternTool * | m_tool |
HtrXmlPatternToolParameters * | m_toolparameters |
bool | m_write_root_file |
bool | m_write_XML |
Definition at line 20 of file HtrXmlPattern.h.
HtrXmlPattern::HtrXmlPattern | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 14 of file HtrXmlPattern.cc.
References edm::ParameterSet::getUntrackedParameter(), m_sets_to_show, HtrXmlPatternToolParameters::m_show_errors, m_tool, m_toolparameters, m_write_root_file, and m_write_XML.
00015 { 00016 m_sets_to_show = iConfig.getUntrackedParameter<int> ("sets_to_show"); 00017 m_write_XML = iConfig.getUntrackedParameter<bool>("write_XML"); 00018 m_write_root_file = iConfig.getUntrackedParameter<bool>("write_root_file"); 00019 00020 m_toolparameters = new HtrXmlPatternToolParameters; 00021 m_toolparameters->m_show_errors = iConfig.getUntrackedParameter<bool> ("show_errors"); 00022 m_toolparameters->m_presamples_per_event = iConfig.getUntrackedParameter<int> ("presamples_per_event"); 00023 m_toolparameters->m_samples_per_event = iConfig.getUntrackedParameter<int> ("samples_per_event"); 00024 m_toolparameters->m_single_XML_file = iConfig.getUntrackedParameter<bool> ("single_XML_file"); 00025 m_toolparameters->m_file_tag = iConfig.getUntrackedParameter<std::string>("file_tag"); 00026 m_toolparameters->m_user_output_directory = iConfig.getUntrackedParameter<std::string>("user_output_directory"); 00027 00028 std::string out_dir=m_toolparameters->m_user_output_directory; 00029 while (out_dir.find_last_of('/')==out_dir.length()-1) out_dir.erase(out_dir.find_last_of('/')); 00030 m_toolparameters->m_output_directory=out_dir+"/"+(m_toolparameters->m_file_tag)+"/"; 00031 00032 m_tool = new HtrXmlPatternTool(m_toolparameters); 00033 }
HtrXmlPattern::~HtrXmlPattern | ( | ) |
Definition at line 36 of file HtrXmlPattern.cc.
References m_tool, and m_toolparameters.
00037 { 00038 delete m_tool; 00039 delete m_toolparameters; 00040 }
void HtrXmlPattern::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 44 of file HtrXmlPattern.cc.
References edm::SortedCollection< T, SORT >::begin(), c, count, GenMuonPlsPt100GeV_cfg::cout, edm::SortedCollection< T, SORT >::end(), lat::endl(), HtrXmlPatternTool::Fill(), edm::Event::getManyByType(), hh, i, j, HcalElectronicsMap::lookup(), m_sets_to_show, m_tool, HcalDbHardcode::makeHardcodeMap(), and std.
00045 { 00046 using namespace std; 00047 00048 std::vector<edm::Handle<HBHEDigiCollection> > hbhe; 00049 std::vector<edm::Handle<HODigiCollection> > ho; 00050 std::vector<edm::Handle<HFDigiCollection> > hf; 00051 std::vector<edm::Handle<ZDCDigiCollection> > zdc; 00052 std::vector<edm::Handle<HcalCalibDigiCollection> > hc; 00053 std::vector<edm::Handle<HcalTrigPrimDigiCollection> > htp; 00054 std::vector<edm::Handle<HcalHistogramDigiCollection> > hh; 00055 00057 //edm::ESHandle<HcalDbService> pSetup; 00058 //iSetup.get<HcalDbRecord>().get( pSetup ); 00059 //const HcalElectronicsMap* readoutMap=pSetup->getHcalMapping(); 00060 00061 //use this until CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc is fixed 00062 HcalElectronicsMap map2; 00063 HcalDbHardcode::makeHardcodeMap(map2); 00064 00065 try { 00066 iEvent.getManyByType(hbhe); 00067 std::vector<edm::Handle<HBHEDigiCollection> >::iterator i; 00068 for (i=hbhe.begin(); i!=hbhe.end(); i++) { 00069 const HBHEDigiCollection& c=*(*i); 00070 00071 int count=0; 00072 for (HBHEDigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) { 00073 00074 //const HcalElectronicsId HEID = readoutMap->lookup(j->id()); 00075 const HcalElectronicsId HEID = map2.lookup(j->id()); 00076 m_tool->Fill(HEID,j); 00077 00078 if ( count++<m_sets_to_show || m_sets_to_show<0 ) { 00079 cout << *j << std::endl; 00080 cout << HEID << endl; 00081 cout << "count: " << count << endl; 00082 } 00083 } 00084 if (m_sets_to_show!=0) cout << "HB/HE count: " << count << endl; 00085 } 00086 } catch (...) { 00087 cout << "No HB/HE Digis." << endl; 00088 } 00089 00090 try { 00091 iEvent.getManyByType(hf); 00092 std::vector<edm::Handle<HFDigiCollection> >::iterator i; 00093 for (i=hf.begin(); i!=hf.end(); i++) { 00094 const HFDigiCollection& c=*(*i); 00095 00096 int count=0; 00097 for (HFDigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) { 00098 //const HcalElectronicsId HEID = readoutMap->lookup(j->id()); 00099 const HcalElectronicsId HEID = map2.lookup(j->id()); 00100 m_tool->Fill(HEID,j); 00101 00102 if ( count++<m_sets_to_show || m_sets_to_show<0 ) { 00103 cout << *j << std::endl; 00104 cout << HEID << endl; 00105 cout << "count: " << count << endl; 00106 } 00107 } 00108 if (m_sets_to_show!=0) cout << "HF count: " << count << endl; 00109 } 00110 } catch (...) { 00111 cout << "No HF Digis." << endl; 00112 } 00113 00114 try { 00115 iEvent.getManyByType(ho); 00116 std::vector<edm::Handle<HODigiCollection> >::iterator i; 00117 for (i=ho.begin(); i!=ho.end(); i++) { 00118 const HODigiCollection& c=*(*i); 00119 00120 int count=0; 00121 for (HODigiCollection::const_iterator j=c.begin(); j!=c.end(); j++) { 00122 //const HcalElectronicsId HEID = readoutMap->lookup(j->id()); 00123 const HcalElectronicsId HEID = map2.lookup(j->id()); 00124 m_tool->Fill(HEID,j); 00125 00126 if ( count++<m_sets_to_show || m_sets_to_show<0 ) { 00127 cout << *j << std::endl; 00128 cout << HEID << endl; 00129 cout << "count: " << count << endl; 00130 } 00131 } 00132 if (m_sets_to_show!=0) cout << "HO count: " << count << endl; 00133 } 00134 } catch (...) { 00135 cout << "No HO Digis." << endl; 00136 } 00137 00138 cout << endl; 00139 00140 }
void HtrXmlPattern::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 150 of file HtrXmlPattern.cc.
References HtrXmlPatternTool::createHists(), m_tool, m_write_root_file, m_write_XML, HtrXmlPatternTool::prepareDirs(), and HtrXmlPatternTool::writeXML().
00150 { 00151 if (m_write_XML || m_write_root_file) m_tool->prepareDirs(); 00152 if (m_write_XML) m_tool->writeXML(); 00153 if (m_write_root_file) m_tool->createHists(); 00154 }
int HtrXmlPattern::m_sets_to_show [private] |
HtrXmlPatternTool* HtrXmlPattern::m_tool [private] |
Definition at line 29 of file HtrXmlPattern.h.
Referenced by analyze(), endJob(), HtrXmlPattern(), and ~HtrXmlPattern().
bool HtrXmlPattern::m_write_root_file [private] |
bool HtrXmlPattern::m_write_XML [private] |