51 using namespace edm::eventsetup;
52 bool epsilonflag =
false;
53 bool notequalsflag =
false;
57 const HcalGains* myNewGains = newGains.product();
62 const HcalGains* myRefGains = refGains.product();
73 std::cout <<
"--- Dumping Gains - update ---" << std::endl;
77 std::ofstream outStream2(
dumprefs.c_str());
78 std::cout <<
"--- Dumping Gains - reference ---" << std::endl;
82 std::vector<DetId> listNewChan = myNewGains->getAllChannels();
83 std::vector<DetId> listRefChan = myRefGains->getAllChannels();
85 std::vector<DetId>::const_iterator cell;
88 for (std::vector<DetId>::const_iterator it = listRefChan.begin(); it!=listRefChan.end(); it++)
93 float valCap0 = myRefGains->getValues(*it)->getValue(0);
94 float valCap1 = myRefGains->getValues(*it)->getValue(1);
95 float valCap2 = myRefGains->getValues(*it)->getValue(2);
96 float valCap3 = myRefGains->getValues(*it)->getValue(3);
103 cell =
std::find(listNewChan.begin(), listNewChan.end(), (*it));
104 if (cell != listNewChan.end() )
106 float valCap0up = myNewGains->getValues(*it)->getValue(0);
107 float valCap1up = myNewGains->getValues(*it)->getValue(1);
108 float valCap2up = myNewGains->getValues(*it)->getValue(2);
109 float valCap3up = myNewGains->getValues(*it)->getValue(3);
116 if(fabs(valCap0up - valCap0) >
epsilon) epsilonflag =
true;
117 if(fabs(valCap1up - valCap1) >
epsilon) epsilonflag =
true;
118 if(fabs(valCap2up - valCap2) >
epsilon) epsilonflag =
true;
119 if(fabs(valCap3up - valCap3) >
epsilon) epsilonflag =
true;
121 if(valCap0up != valCap0) notequalsflag =
true;
122 if(valCap1up != valCap1) notequalsflag =
true;
123 if(valCap2up != valCap2) notequalsflag =
true;
124 if(valCap3up != valCap3) notequalsflag =
true;
132 for (std::vector<DetId>::const_iterator it = listNewChan.begin(); it!=listNewChan.end(); it++)
134 float valCap0 = myNewGains->getValues(*it)->getValue(0);
135 float valCap1 = myNewGains->getValues(*it)->getValue(1);
136 float valCap2 = myNewGains->getValues(*it)->getValue(2);
137 float valCap3 = myNewGains->getValues(*it)->getValue(3);
146 if(epsilonflag)
throw cms::Exception(
"DataDoesNotMatch") <<
"Values differ by more than deltaG" << std::endl;
148 std::cout <<
"These gains do not differ by more than deltaG" << std::endl;
152 if(notequalsflag)
throw cms::Exception(
"DataDoesNotMatch") <<
"Values do not match" << std::endl;
154 std::cout <<
"These gains are identical" << std::endl;
161 if(
outfile.compare(
"null")!=0){
163 for (std::vector<DetId>::const_iterator it = listRefChan.begin(); it != listRefChan.end(); it++)
167 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
168 if (cell == listNewChan.end())
186 std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
188 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++)
191 if (
std::find(listResult.begin(), listResult.end(), mydetid ) == listResult.end() )
201 std::ofstream outStream3(
outfile.c_str());
202 std::cout <<
"--- Dumping Gains - the combined ones ---" << std::endl;
bool addValues(const Item &myItem, bool h2mode_=false)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< DetId > getAllChannels() const
const float * getValues() const
get value for all capId = 0..3
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)