18 using namespace edm::eventsetup;
31 std::ofstream outStream(
dumprefs.c_str());
32 std::cout <<
"--- Dumping Pedestals - reference ---" << std::endl;
37 std::cout <<
"--- Dumping Pedestals - updated ---" << std::endl;
42 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
43 std::vector<DetId> listRefChan = myRefPeds->getAllChannels();
44 std::vector<DetId>::iterator cell;
45 bool failflag =
false;
46 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
48 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
49 if (cell == listNewChan.end())
56 const float*
values = (myNewPeds->getValues(mydetid))->getValues();
57 const float* oldvalue = (myRefPeds->getValues(mydetid))->getValues();
58 if ((*oldvalue != *values) || (*(oldvalue + 1) != *(values + 1)) || (*(oldvalue + 2) != *(values + 2)) ||
59 (*(oldvalue + 3) != *(values + 3))) {
60 throw cms::Exception(
"DataDoesNotMatch") <<
"Value does not match";
66 listNewChan.erase(cell);
70 std::cout <<
"These are identical" << std::endl;
74 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
75 std::vector<DetId> listRefChan = myRefPeds->getAllChannels();
76 std::vector<DetId>::iterator cell;
77 bool failflag =
false;
78 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
80 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
81 if (cell == listNewChan.end()) {
84 const float*
values = (myNewPeds->getValues(mydetid))->getValues();
85 const float* oldvalue = (myRefPeds->getValues(mydetid))->getValues();
86 if ((fabs(*oldvalue - *values) >
epsilon) || (fabs(*(oldvalue + 1) - *(values + 1)) >
epsilon) ||
87 (fabs(*(oldvalue + 2) - *(values + 2)) >
epsilon) || (fabs(*(oldvalue + 3) - *(values + 3)) >
epsilon)) {
88 throw cms::Exception(
"DataDoesNotMatch") <<
"Values differ by more than deltaP";
92 listNewChan.erase(cell);
96 std::cout <<
"These are identical to within deltaP" << std::endl;
100 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
107 std::vector<DetId>::iterator cell;
108 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
110 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
111 if (cell == listNewChan.end())
123 listNewChan.erase(cell);
127 for (std::vector<DetId>::iterator it = listNewChan.begin(); it != listNewChan.end(); it++)
139 std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
142 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++) {
146 if (
std::find(listResult.begin(), listResult.end(), mydetid) == listResult.end()) {
153 std::ofstream outStream3(
outfile.c_str());
154 std::cout <<
"--- Dumping Pedestals - the combined ones ---" << std::endl;
HcalPedestalsCheck(edm::ParameterSet const &ps)
T getUntrackedParameter(std::string const &, T const &) const
~HcalPedestalsCheck() override
#define DEFINE_FWK_MODULE(type)
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > m_tok2
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
edm::ESGetToken< HcalElectronicsMap, HcalElectronicsMapRcd > m_tokmap
void analyze(const edm::Event &ev, const edm::EventSetup &es) override
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > m_tok1
bool validatepedestalsflag
bool addValues(const Item &myItem)