CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WriteL1TriggerObjetsXml.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: WriteL1TriggerObjetsXml
4 // Class: WriteL1TriggerObjetsXml
5 //
13 //
14 // Original Author: Ka Vang TSANG
15 // Created: Fri Jul 31 15:18:53 CEST 2009
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 #include <string>
23 
24 // user include files
27 
30 
32 
40 
41 //
42 // class decleration
43 //
44 
46  public:
49 
50 
51  private:
52  virtual void beginJob() override ;
53  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
54  virtual void endJob() override ;
55 
56  // ----------member data ---------------------------
58 };
59 
60 //
61 // constants, enums and typedefs
62 //
63 
64 //
65 // static data member definitions
66 //
67 
68 //
69 // constructors and destructor
70 //
71 WriteL1TriggerObjetsXml::WriteL1TriggerObjetsXml(const edm::ParameterSet& iConfig) : tagname_(iConfig.getParameter<std::string>("TagName"))
72 {
73  //now do what ever initialization is needed
74 
75 }
76 
77 
79 {
80 
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83 
84 }
85 
86 
87 //
88 // member functions
89 //
90 
91 // ------------ method called to for each event ------------
92 void
94 {
95  using namespace edm;
97  iSetup.get<HcalDbRecord>().get(conditions);
98  const HcalTopology* topo=conditions->getTopologyUsed();
99 
101  std::string subDetName[3] = {"HB", "HE", "HF"};
102 
104  for (int isub = 0; isub < 3; ++isub){
105  for (int ieta = -41; ieta <= 41; ++ieta){
106  for (int iphi = 1; iphi <=72; ++iphi){
107  for (int depth = 1; depth <= 3; ++depth){
108  HcalDetId id(subDet[isub], ieta, iphi, depth);
109 
110  if (!topo->valid(id)) continue;
111  HcalCalibrations calibrations = conditions->getHcalCalibrations(id);
112  const HcalChannelStatus* channelStatus = conditions->getHcalChannelStatus(id);
113  uint32_t status = channelStatus->getValue();
114 
115  double gain = 0.0;
116  double ped = 0.0;
117 
118  for (int i=0; i<4; ++i) {
119  gain += calibrations.LUTrespcorrgain(i);
120  ped += calibrations.pedestal(i);
121  }
122  gain /= 4.;
123  ped /= 4.;
124 
125  xml.add_hcal_channel_dataset(ieta, iphi, depth, subDetName[isub], ped, gain, status);
126  }// for depth
127  }// for iphi
128  }// for ieta
129  }// for subdet
130 
131  std::string xmlOutputFileName(tagname_);
132  xmlOutputFileName += ".xml";
133  xml.write(xmlOutputFileName);
134 }
135 
136 // ------------ method called once each job just before starting event loop ------------
137 void
139 {
140 }
141 
142 // ------------ method called once each job just after ending the event loop ------------
143 void
145 }
146 
147 //define this as a plug-in
int i
Definition: DBlmapReader.cc:9
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:322
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
double pedestal(int fCapId) const
get pedestal for capid=0..3
DOMNode * add_hcal_channel_dataset(int ieta, int iphi, int depth, std::string subdetector, double ped, double gain, int flag)
int iEvent
Definition: GenABIO.cc:243
virtual void endJob() override
HcalSubdetector
Definition: HcalAssistant.h:31
double LUTrespcorrgain(int fCapId) const
get LUT corrected and response corrected gain for capid=0..3
WriteL1TriggerObjetsXml(const edm::ParameterSet &)
const T & get() const
Definition: EventSetup.h:55
virtual void beginJob() override
tuple status
Definition: ntuplemaker.py:245
uint32_t getValue() const