Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023 #include <string>
00024
00025
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "FWCore/Framework/interface/EDAnalyzer.h"
00028
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/MakerMacros.h"
00031
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033
00034 #include "CaloOnlineTools/HcalOnlineDb/interface/HcalL1TriggerObjectsXml.h"
00035 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00036 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
00037 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00038 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00039 #include "FWCore/Framework/interface/ESHandle.h"
00040
00041
00042
00043
00044
00045 class WriteL1TriggerObjetsXml : public edm::EDAnalyzer {
00046 public:
00047 explicit WriteL1TriggerObjetsXml(const edm::ParameterSet&);
00048 ~WriteL1TriggerObjetsXml();
00049
00050
00051 private:
00052 virtual void beginJob() ;
00053 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00054 virtual void endJob() ;
00055
00056
00057 std::string tagname_;
00058 };
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 WriteL1TriggerObjetsXml::WriteL1TriggerObjetsXml(const edm::ParameterSet& iConfig) : tagname_(iConfig.getParameter<std::string>("TagName"))
00072 {
00073
00074
00075 }
00076
00077
00078 WriteL1TriggerObjetsXml::~WriteL1TriggerObjetsXml()
00079 {
00080
00081
00082
00083
00084 }
00085
00086
00087
00088
00089
00090
00091
00092 void
00093 WriteL1TriggerObjetsXml::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00094 {
00095 using namespace edm;
00096 edm::ESHandle<HcalDbService> conditions;
00097 iSetup.get<HcalDbRecord>().get(conditions);
00098
00099 HcalSubdetector subDet[3] = {HcalBarrel, HcalEndcap, HcalForward};
00100 std::string subDetName[3] = {"HB", "HE", "HF"};
00101
00102 HcalL1TriggerObjectsXml xml(tagname_);
00103 for (int isub = 0; isub < 3; ++isub){
00104 for (int ieta = -41; ieta <= 41; ++ieta){
00105 for (int iphi = 1; iphi <=72; ++iphi){
00106 for (int depth = 1; depth <= 3; ++depth){
00107 if (!HcalDetId::validDetId(subDet[isub], ieta, iphi, depth)) continue;
00108 HcalDetId id(subDet[isub], ieta, iphi, depth);
00109 HcalCalibrations calibrations = conditions->getHcalCalibrations(id);
00110 const HcalChannelStatus* channelStatus = conditions->getHcalChannelStatus(id);
00111 uint32_t status = channelStatus->getValue();
00112
00113 double gain = 0.0;
00114 double ped = 0.0;
00115
00116 for (int i=0; i<4; ++i) {
00117 gain += calibrations.LUTrespcorrgain(i);
00118 ped += calibrations.pedestal(i);
00119 }
00120 gain /= 4.;
00121 ped /= 4.;
00122
00123 xml.add_hcal_channel_dataset(ieta, iphi, depth, subDetName[isub], ped, gain, status);
00124 }
00125 }
00126 }
00127 }
00128
00129 std::string xmlOutputFileName(tagname_);
00130 xmlOutputFileName += ".xml";
00131 xml.write(xmlOutputFileName);
00132 }
00133
00134
00135 void
00136 WriteL1TriggerObjetsXml::beginJob()
00137 {
00138 }
00139
00140
00141 void
00142 WriteL1TriggerObjetsXml::endJob() {
00143 }
00144
00145
00146 DEFINE_FWK_MODULE(WriteL1TriggerObjetsXml);