35 std::cout <<
"--- Dumping PedestalWidths - update ---" << std::endl;
39 std::ofstream outStream2(
dumprefs.c_str());
40 std::cout <<
"--- Dumping PedestalWidths - reference ---" << std::endl;
51 std::vector<DetId>::iterator cell;
54 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
56 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
57 if (cell == listNewChan.end())
59 throw cms::Exception(
"DataDoesNotMatch") <<
"Value not found in reference" << std::endl;
64 const float* newwidth = first->
getValues();
65 const float* oldwidth = second->
getValues();
66 if ((*newwidth != *oldwidth) || (*(newwidth + 1) != *(oldwidth + 1)) || (*(newwidth + 2) != *(oldwidth + 2)) ||
67 (*(newwidth + 3) != *(oldwidth + 3)) || (*(newwidth + 4) != *(oldwidth + 4)) ||
68 (*(newwidth + 5) != *(oldwidth + 5)) || (*(newwidth + 6) != *(oldwidth + 6)) ||
69 (*(newwidth + 7) != *(oldwidth + 7)) || (*(newwidth + 8) != *(oldwidth + 8)) ||
70 (*(newwidth + 9) != *(oldwidth + 9))) {
71 throw cms::Exception(
"DataDoesNotMatch") <<
"Values are not identical" << std::endl;
73 listNewChan.erase(cell);
76 std::cout <<
"These are identical" << std::endl;
80 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
82 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
83 if (cell == listNewChan.end())
85 throw cms::Exception(
"DataDoesNotMatch") <<
"Value not found in reference" << std::endl;
90 const float* newwidth = first->
getValues();
91 const float* oldwidth = second->
getValues();
92 if (fabs(*newwidth - *oldwidth) >
epsilon || fabs(*(newwidth + 1) - *(oldwidth + 1)) >
epsilon ||
93 fabs(*(newwidth + 2) - *(oldwidth + 2)) >
epsilon || fabs(*(newwidth + 3) - *(oldwidth + 3)) >
epsilon ||
94 fabs(*(newwidth + 4) - *(oldwidth + 4)) >
epsilon || fabs(*(newwidth + 5) - *(oldwidth + 5)) >
epsilon ||
95 fabs(*(newwidth + 6) - *(oldwidth + 6)) >
epsilon || fabs(*(newwidth + 7) - *(oldwidth + 7)) >
epsilon ||
96 fabs(*(newwidth + 8) - *(oldwidth + 8)) >
epsilon || fabs(*(newwidth + 9) - *(oldwidth + 9)) >
epsilon) {
97 throw cms::Exception(
"DataDoesNotMatch") <<
"Values differ by more than deltaW" << std::endl;
99 listNewChan.erase(cell);
102 std::cout <<
"These are identical" << std::endl;
105 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
107 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
108 if (cell == listNewChan.end())
119 listNewChan.erase(cell);
123 for (std::vector<DetId>::iterator it = listNewChan.begin(); it != listNewChan.end(); it++)
131 std::ofstream outStream3(
outfile.c_str());
132 std::cout <<
"--- Dumping PedestalWidths - the combined ones ---" << std::endl;
139 std::vector<HcalGenericDetId> listEMap = myRefEMap->
allPrecisionId();
141 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++) {
143 if (
std::find(listResult.begin(), listResult.end(), mydetid) == listResult.end()) {
T getUntrackedParameter(std::string const &, T const &) const
const float * getValues() const
get value for all capId = 0..3, 10 values in total
const Item * getValues(DetId fId, bool throwOnFail=true) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
U second(std::pair< T, U > const &p)
#define DEFINE_FWK_MODULE(type)
std::vector< DetId > getAllChannels() const
std::vector< HcalGenericDetId > allPrecisionId() const
HcalPedestalWidthsCheck(edm::ParameterSet const &ps)
void analyze(const edm::Event &ev, const edm::EventSetup &es) override
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
bool addValues(const Item &myItem)
~HcalPedestalWidthsCheck() override
T const * product() const
const HcalTopology * topo() const