18 using namespace edm::eventsetup;
32 std::cout <<
"--- Dumping PedestalWidths - update ---" << std::endl;
36 std::ofstream outStream2(
dumprefs.c_str());
37 std::cout <<
"--- Dumping PedestalWidths - reference ---" << std::endl;
41 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
48 std::vector<DetId>::iterator cell;
51 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
53 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
54 if (cell == listNewChan.end())
56 throw cms::Exception(
"DataDoesNotMatch") <<
"Value not found in reference" << std::endl;
61 const float* newwidth = first->
getValues();
62 const float* oldwidth = second->
getValues();
63 if ((*newwidth != *oldwidth) || (*(newwidth + 1) != *(oldwidth + 1)) || (*(newwidth + 2) != *(oldwidth + 2)) ||
64 (*(newwidth + 3) != *(oldwidth + 3)) || (*(newwidth + 4) != *(oldwidth + 4)) ||
65 (*(newwidth + 5) != *(oldwidth + 5)) || (*(newwidth + 6) != *(oldwidth + 6)) ||
66 (*(newwidth + 7) != *(oldwidth + 7)) || (*(newwidth + 8) != *(oldwidth + 8)) ||
67 (*(newwidth + 9) != *(oldwidth + 9))) {
68 throw cms::Exception(
"DataDoesNotMatch") <<
"Values are not identical" << std::endl;
70 listNewChan.erase(cell);
73 std::cout <<
"These are identical" << std::endl;
77 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
79 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
80 if (cell == listNewChan.end())
82 throw cms::Exception(
"DataDoesNotMatch") <<
"Value not found in reference" << std::endl;
87 const float* newwidth = first->
getValues();
88 const float* oldwidth = second->
getValues();
89 if (fabs(*newwidth - *oldwidth) >
epsilon || fabs(*(newwidth + 1) - *(oldwidth + 1)) >
epsilon ||
90 fabs(*(newwidth + 2) - *(oldwidth + 2)) >
epsilon || fabs(*(newwidth + 3) - *(oldwidth + 3)) >
epsilon ||
91 fabs(*(newwidth + 4) - *(oldwidth + 4)) >
epsilon || fabs(*(newwidth + 5) - *(oldwidth + 5)) >
epsilon ||
92 fabs(*(newwidth + 6) - *(oldwidth + 6)) >
epsilon || fabs(*(newwidth + 7) - *(oldwidth + 7)) >
epsilon ||
93 fabs(*(newwidth + 8) - *(oldwidth + 8)) >
epsilon || fabs(*(newwidth + 9) - *(oldwidth + 9)) >
epsilon) {
94 throw cms::Exception(
"DataDoesNotMatch") <<
"Values differ by more than deltaW" << std::endl;
96 listNewChan.erase(cell);
99 std::cout <<
"These are identical" << std::endl;
102 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
104 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
105 if (cell == listNewChan.end())
109 resultPeds->addValues(*mywidth);
114 resultPeds->addValues(*mywidth);
116 listNewChan.erase(cell);
120 for (std::vector<DetId>::iterator it = listNewChan.begin(); it != listNewChan.end(); it++)
125 resultPeds->addValues(*mywidth);
128 std::ofstream outStream3(
outfile.c_str());
129 std::cout <<
"--- Dumping PedestalWidths - the combined ones ---" << std::endl;
134 std::vector<DetId> listResult = resultPeds->getAllChannels();
136 std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
138 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++) {
140 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
#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
U second(std::pair< T, U > const &p)
std::vector< DetId > getAllChannels() const
edm::ESGetToken< HcalPedestalWidths, HcalPedestalWidthsRcd > m_tok2
edm::ESGetToken< HcalPedestalWidths, HcalPedestalWidthsRcd > m_tok1
HcalPedestalWidthsCheck(edm::ParameterSet const &ps)
void analyze(const edm::Event &ev, const edm::EventSetup &es) override
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
edm::ESGetToken< HcalElectronicsMap, HcalElectronicsMapRcd > m_tokmap
~HcalPedestalWidthsCheck() override