17 f =
new TFile(
rootfile.c_str(),
"RECREATE");
20 ocMapUp =
new TH2F(
"ocMapUp",
"occupancy_map_updated_gains", 83, -41.5, 41.5, 72, 0.5, 72.5);
21 ocMapRef =
new TH2F(
"ocMapRef",
"occupancy_map_updated_gains", 83, -41.5, 41.5, 72, 0.5, 72.5);
25 diffUpRefCap0 =
new TH1F(
"diffUpRefCap0",
"difference_update_reference_Cap0", 100, -0.5, 0.5);
26 ratioUpRefCap0 =
new TH1F(
"ratioUpRefCap0",
"ration_update_reference_Cap0", 100, 0.5, 1.5);
27 gainsUpCap0 =
new TH1F(
"gainsUpCap0",
"gains_update_Cap0", 100, 0.0, 0.6);
28 gainsRefCap0 =
new TH1F(
"gainsRefCap0",
"gains_reference_Cap0", 100, 0.0, 0.6);
30 diffUpRefCap1 =
new TH1F(
"diffUpRefCap1",
"difference_update_reference_Cap1", 100, -0.5, 0.5);
31 ratioUpRefCap1 =
new TH1F(
"ratioUpRefCap1",
"ration_update_reference_Cap1", 100, 0.5, 1.5);
32 gainsUpCap1 =
new TH1F(
"gainsUpCap1",
"gains_update_Cap1", 100, 0.0, 0.6);
33 gainsRefCap1 =
new TH1F(
"gainsRefCap1",
"gains_reference_Cap1", 100, 0.0, 0.6);
35 diffUpRefCap2 =
new TH1F(
"diffUpRefCap2",
"difference_update_reference_Cap2", 100, -0.5, 0.5);
36 ratioUpRefCap2 =
new TH1F(
"ratioUpRefCap2",
"ration_update_reference_Cap2", 100, 0.5, 1.5);
37 gainsUpCap2 =
new TH1F(
"gainsUpCap2",
"gains_update_Cap2", 100, 0.0, 0.6);
38 gainsRefCap2 =
new TH1F(
"gainsRefCap2",
"gains_reference_Cap2", 100, 0.0, 0.6);
40 diffUpRefCap3 =
new TH1F(
"diffUpRefCap3",
"difference_update_reference_Cap3", 100, -0.5, 0.5);
41 ratioUpRefCap3 =
new TH1F(
"ratioUpRefCap3",
"ration_update_reference_Cap3", 100, 0.5, 1.5);
42 gainsUpCap3 =
new TH1F(
"gainsUpCap3",
"gains_update_Cap3", 100, 0.0, 0.6);
43 gainsRefCap3 =
new TH1F(
"gainsRefCap3",
"gains_reference_Cap3", 100, 0.0, 0.6);
50 using namespace edm::eventsetup;
51 bool epsilonflag =
false;
52 bool notequalsflag =
false;
65 std::cout <<
"--- Dumping Gains - update ---" << std::endl;
69 std::ofstream outStream2(
dumprefs.c_str());
70 std::cout <<
"--- Dumping Gains - reference ---" << std::endl;
74 std::vector<DetId> listNewChan = myNewGains->getAllChannels();
75 std::vector<DetId> listRefChan = myRefGains->getAllChannels();
77 std::vector<DetId>::const_iterator cell;
80 for (std::vector<DetId>::const_iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
84 float valCap0 = myRefGains->getValues(*it)->getValue(0);
85 float valCap1 = myRefGains->getValues(*it)->getValue(1);
86 float valCap2 = myRefGains->getValues(*it)->getValue(2);
87 float valCap3 = myRefGains->getValues(*it)->getValue(3);
94 cell =
std::find(listNewChan.begin(), listNewChan.end(), (*it));
95 if (cell != listNewChan.end())
97 float valCap0up = myNewGains->getValues(*it)->getValue(0);
98 float valCap1up = myNewGains->getValues(*it)->getValue(1);
99 float valCap2up = myNewGains->getValues(*it)->getValue(2);
100 float valCap3up = myNewGains->getValues(*it)->getValue(3);
107 if (fabs(valCap0up - valCap0) >
epsilon)
109 if (fabs(valCap1up - valCap1) >
epsilon)
111 if (fabs(valCap2up - valCap2) >
epsilon)
113 if (fabs(valCap3up - valCap3) >
epsilon)
116 if (valCap0up != valCap0)
117 notequalsflag =
true;
118 if (valCap1up != valCap1)
119 notequalsflag =
true;
120 if (valCap2up != valCap2)
121 notequalsflag =
true;
122 if (valCap3up != valCap3)
123 notequalsflag =
true;
131 for (std::vector<DetId>::const_iterator it = listNewChan.begin(); it != listNewChan.end(); it++) {
132 float valCap0 = myNewGains->getValues(*it)->getValue(0);
133 float valCap1 = myNewGains->getValues(*it)->getValue(1);
134 float valCap2 = myNewGains->getValues(*it)->getValue(2);
135 float valCap3 = myNewGains->getValues(*it)->getValue(3);
145 throw cms::Exception(
"DataDoesNotMatch") <<
"Values differ by more than deltaG" << std::endl;
147 std::cout <<
"These gains do not differ by more than deltaG" << std::endl;
152 throw cms::Exception(
"DataDoesNotMatch") <<
"Values do not match" << std::endl;
154 std::cout <<
"These gains are identical" << std::endl;
163 for (std::vector<DetId>::const_iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
166 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
167 if (cell == listNewChan.end())
184 std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
186 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++) {
188 if (
std::find(listResult.begin(), listResult.end(), mydetid) == listResult.end()) {
197 std::ofstream outStream3(
outfile.c_str());
198 std::cout <<
"--- Dumping Gains - the combined ones ---" << std::endl;
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< HcalElectronicsMap, HcalElectronicsMapRcd > m_tokmap
#define DEFINE_FWK_MODULE(type)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool getData(T &iHolder) const
std::vector< DetId > getAllChannels() const
void analyze(const edm::Event &ev, const edm::EventSetup &es) override
HcalGainsCheck(edm::ParameterSet const &ps)
edm::ESGetToken< HcalGains, HcalGainsRcd > m_tok1
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
bool addValues(const Item &myItem)
edm::ESGetToken< HcalGains, HcalGainsRcd > m_tok2