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 // $Id: WriteL1TriggerObjetsXml.cc,v 1.2 2012/11/12 20:49:45 dlange Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include <string>
24 
25 // user include files
28 
31 
33 
41 
42 //
43 // class decleration
44 //
45 
47  public:
50 
51 
52  private:
53  virtual void beginJob() ;
54  virtual void analyze(const edm::Event&, const edm::EventSetup&);
55  virtual void endJob() ;
56 
57  // ----------member data ---------------------------
59 };
60 
61 //
62 // constants, enums and typedefs
63 //
64 
65 //
66 // static data member definitions
67 //
68 
69 //
70 // constructors and destructor
71 //
72 WriteL1TriggerObjetsXml::WriteL1TriggerObjetsXml(const edm::ParameterSet& iConfig) : tagname_(iConfig.getParameter<std::string>("TagName"))
73 {
74  //now do what ever initialization is needed
75 
76 }
77 
78 
80 {
81 
82  // do anything here that needs to be done at desctruction time
83  // (e.g. close files, deallocate resources etc.)
84 
85 }
86 
87 
88 //
89 // member functions
90 //
91 
92 // ------------ method called to for each event ------------
93 void
95 {
96  using namespace edm;
98  iSetup.get<HcalDbRecord>().get(conditions);
99  const HcalTopology* topo=conditions->getTopologyUsed();
100 
102  std::string subDetName[3] = {"HB", "HE", "HF"};
103 
105  for (int isub = 0; isub < 3; ++isub){
106  for (int ieta = -41; ieta <= 41; ++ieta){
107  for (int iphi = 1; iphi <=72; ++iphi){
108  for (int depth = 1; depth <= 3; ++depth){
109  HcalDetId id(subDet[isub], ieta, iphi, depth);
110 
111  if (!topo->valid(id)) continue;
112  HcalCalibrations calibrations = conditions->getHcalCalibrations(id);
113  const HcalChannelStatus* channelStatus = conditions->getHcalChannelStatus(id);
114  uint32_t status = channelStatus->getValue();
115 
116  double gain = 0.0;
117  double ped = 0.0;
118 
119  for (int i=0; i<4; ++i) {
120  gain += calibrations.LUTrespcorrgain(i);
121  ped += calibrations.pedestal(i);
122  }
123  gain /= 4.;
124  ped /= 4.;
125 
126  xml.add_hcal_channel_dataset(ieta, iphi, depth, subDetName[isub], ped, gain, status);
127  }// for depth
128  }// for iphi
129  }// for ieta
130  }// for subdet
131 
132  std::string xmlOutputFileName(tagname_);
133  xmlOutputFileName += ".xml";
134  xml.write(xmlOutputFileName);
135 }
136 
137 // ------------ method called once each job just before starting event loop ------------
138 void
140 {
141 }
142 
143 // ------------ method called once each job just after ending the event loop ------------
144 void
146 }
147 
148 //define this as a plug-in
int i
Definition: DBlmapReader.cc:9
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:323
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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
HcalSubdetector
Definition: HcalAssistant.h:32
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
tuple status
Definition: ntuplemaker.py:245
uint32_t getValue() const