19 using namespace edm::eventsetup;
38 std::ofstream outStream(
dumprefs.c_str());
39 std::cout <<
"--- Dumping Pedestals - reference ---" << std::endl;
44 std::cout <<
"--- Dumping Pedestals - updated ---" << std::endl;
49 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
50 std::vector<DetId> listRefChan = myRefPeds->getAllChannels();
51 std::vector<DetId>::iterator cell;
52 bool failflag =
false;
53 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())
65 const float*
values = (myNewPeds->getValues( mydetid ))->getValues();
66 const float* oldvalue = (myRefPeds->getValues( mydetid ))->getValues();
67 if( (*oldvalue != *values) || (*(oldvalue + 1)!=*(values+1)) || (*(oldvalue + 2)!=*(values+2)) || (*(oldvalue + 3)!=*(values+3)) ){
68 throw cms::Exception(
"DataDoesNotMatch") <<
"Value does not match";
74 listNewChan.erase(cell);
77 if(!failflag)
std::cout <<
"These are identical" << std::endl;
81 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
82 std::vector<DetId> listRefChan = myRefPeds->getAllChannels();
83 std::vector<DetId>::iterator cell;
84 bool failflag =
false;
85 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++)
88 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
89 if (cell == listNewChan.end())
95 const float*
values = (myNewPeds->getValues( mydetid ))->getValues();
96 const float* oldvalue = (myRefPeds->getValues( mydetid ))->getValues();
97 if( (fabs(*oldvalue-*values)>
epsilon) || (fabs(*(oldvalue+1)-*(values+1))>
epsilon) || (fabs(*(oldvalue+2)-*(values+2))>
epsilon) || (fabs(*(oldvalue+3)-*(values+3))>
epsilon) ){
98 throw cms::Exception(
"DataDoesNotMatch") <<
"Values differ by more than deltaP";
102 listNewChan.erase(cell);
105 if(!failflag)
std::cout <<
"These are identical to within deltaP" << std::endl;
107 if(!(
outfile.compare(
"null")==0))
110 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
117 std::vector<DetId>::iterator cell;
118 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++)
121 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
122 if (cell == listNewChan.end())
135 listNewChan.erase(cell);
140 for (std::vector<DetId>::iterator it = listNewChan.begin(); it != listNewChan.end(); it++)
153 std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
156 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++)
161 if (
std::find(listResult.begin(), listResult.end(), mydetid ) == listResult.end())
169 std::ofstream outStream3(
outfile.c_str());
170 std::cout <<
"--- Dumping Pedestals - the combined ones ---" << std::endl;
HcalPedestalsCheck(edm::ParameterSet const &ps)
T getUntrackedParameter(std::string const &, T const &) const
bool addValues(const Item &myItem, bool h2mode_=false)
#define DEFINE_FWK_MODULE(type)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< DetId > getAllChannels() const
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
const float * getValues() const
get value for all capId = 0..3
bool validatepedestalsflag
void analyze(const edm::Event &ev, const edm::EventSetup &es)