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 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00041
00042
00043
00044
00045
00046 class WriteL1TriggerObjetsXml : public edm::EDAnalyzer {
00047 public:
00048 explicit WriteL1TriggerObjetsXml(const edm::ParameterSet&);
00049 ~WriteL1TriggerObjetsXml();
00050
00051
00052 private:
00053 virtual void beginJob() ;
00054 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00055 virtual void endJob() ;
00056
00057
00058 std::string tagname_;
00059 };
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 WriteL1TriggerObjetsXml::WriteL1TriggerObjetsXml(const edm::ParameterSet& iConfig) : tagname_(iConfig.getParameter<std::string>("TagName"))
00073 {
00074
00075
00076 }
00077
00078
00079 WriteL1TriggerObjetsXml::~WriteL1TriggerObjetsXml()
00080 {
00081
00082
00083
00084
00085 }
00086
00087
00088
00089
00090
00091
00092
00093 void
00094 WriteL1TriggerObjetsXml::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00095 {
00096 using namespace edm;
00097 edm::ESHandle<HcalDbService> conditions;
00098 iSetup.get<HcalDbRecord>().get(conditions);
00099 const HcalTopology* topo=conditions->getTopologyUsed();
00100
00101 HcalSubdetector subDet[3] = {HcalBarrel, HcalEndcap, HcalForward};
00102 std::string subDetName[3] = {"HB", "HE", "HF"};
00103
00104 HcalL1TriggerObjectsXml xml(tagname_);
00105 for (int isub = 0; isub < 3; ++isub){
00106 for (int ieta = -41; ieta <= 41; ++ieta){
00107 for (int iphi = 1; iphi <=72; ++iphi){
00108 for (int depth = 1; depth <= 3; ++depth){
00109 HcalDetId id(subDet[isub], ieta, iphi, depth);
00110
00111 if (!topo->valid(id)) continue;
00112 HcalCalibrations calibrations = conditions->getHcalCalibrations(id);
00113 const HcalChannelStatus* channelStatus = conditions->getHcalChannelStatus(id);
00114 uint32_t status = channelStatus->getValue();
00115
00116 double gain = 0.0;
00117 double ped = 0.0;
00118
00119 for (int i=0; i<4; ++i) {
00120 gain += calibrations.LUTrespcorrgain(i);
00121 ped += calibrations.pedestal(i);
00122 }
00123 gain /= 4.;
00124 ped /= 4.;
00125
00126 xml.add_hcal_channel_dataset(ieta, iphi, depth, subDetName[isub], ped, gain, status);
00127 }
00128 }
00129 }
00130 }
00131
00132 std::string xmlOutputFileName(tagname_);
00133 xmlOutputFileName += ".xml";
00134 xml.write(xmlOutputFileName);
00135 }
00136
00137
00138 void
00139 WriteL1TriggerObjetsXml::beginJob()
00140 {
00141 }
00142
00143
00144 void
00145 WriteL1TriggerObjetsXml::endJob() {
00146 }
00147
00148
00149 DEFINE_FWK_MODULE(WriteL1TriggerObjetsXml);