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$
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include <string>
24 
25 // user include files
28 
31 
33 
40 
41 //
42 // class decleration
43 //
44 
46  public:
49 
50 
51  private:
52  virtual void beginJob() ;
53  virtual void analyze(const edm::Event&, const edm::EventSetup&);
54  virtual void endJob() ;
55 
56  // ----------member data ---------------------------
57  std::string tagname_;
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 
100  std::string subDetName[3] = {"HB", "HE", "HF"};
101 
103  for (int isub = 0; isub < 3; ++isub){
104  for (int ieta = -41; ieta <= 41; ++ieta){
105  for (int iphi = 1; iphi <=72; ++iphi){
106  for (int depth = 1; depth <= 3; ++depth){
107  if (!HcalDetId::validDetId(subDet[isub], ieta, iphi, depth)) continue;
108  HcalDetId id(subDet[isub], ieta, iphi, depth);
109  HcalCalibrations calibrations = conditions->getHcalCalibrations(id);
110  const HcalChannelStatus* channelStatus = conditions->getHcalChannelStatus(id);
111  uint32_t status = channelStatus->getValue();
112 
113  double gain = 0.0;
114  double ped = 0.0;
115 
116  for (int i=0; i<4; ++i) {
117  gain += calibrations.LUTrespcorrgain(i);
118  ped += calibrations.pedestal(i);
119  }
120  gain /= 4.;
121  ped /= 4.;
122 
123  xml.add_hcal_channel_dataset(ieta, iphi, depth, subDetName[isub], ped, gain, status);
124  }// for depth
125  }// for iphi
126  }// for ieta
127  }// for subdet
128 
129  std::string xmlOutputFileName(tagname_);
130  xmlOutputFileName += ".xml";
131  xml.write(xmlOutputFileName);
132 }
133 
134 // ------------ method called once each job just before starting event loop ------------
135 void
137 {
138 }
139 
140 // ------------ method called once each job just after ending the event loop ------------
141 void
143 }
144 
145 //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
static bool validDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth)
Definition: HcalDetId.cc:70
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