19 using namespace edm::eventsetup;
40 std::cout <<
"--- Dumping PedestalWidths - update ---" << std::endl;
44 std::ofstream outStream2(
dumprefs.c_str());
45 std::cout <<
"--- Dumping PedestalWidths - reference ---" << std::endl;
49 std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
56 std::vector<DetId>::iterator cell;
59 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++)
62 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
63 if (cell == listNewChan.end())
65 throw cms::Exception(
"DataDoesNotMatch")<<
"Value not found in reference" << std::endl;
71 const float* newwidth = first->
getValues();
72 const float* oldwidth = second->
getValues();
73 if( (*newwidth != *oldwidth) || (*(newwidth+1)!=*(oldwidth+1)) || (*(newwidth+2)!=*(oldwidth+2)) || (*(newwidth+3)!=*(oldwidth+3)) || (*(newwidth+4)!=*(oldwidth+4)) || (*(newwidth+5)!=*(oldwidth+5)) || (*(newwidth+6)!=*(oldwidth+6)) || (*(newwidth+7)!=*(oldwidth+7)) || (*(newwidth+8)!=*(oldwidth+8)) || (*(newwidth+9)!=*(oldwidth+9))){
74 throw cms::Exception(
"DataDoesNotMatch") <<
"Values are not identical" << std::endl;
76 listNewChan.erase(cell);
79 std::cout <<
"These are identical" << std::endl;
86 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++)
89 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
90 if (cell == listNewChan.end())
92 throw cms::Exception(
"DataDoesNotMatch")<<
"Value not found in reference" << std::endl;
98 const float* newwidth = first->
getValues();
99 const float* oldwidth = second->
getValues();
100 if( fabs(*newwidth-*oldwidth)>
epsilon || fabs(*(newwidth+1)-*(oldwidth+1))>
epsilon || fabs(*(newwidth+2)-*(oldwidth+2))>
epsilon || fabs(*(newwidth+3)-*(oldwidth+3))>
epsilon || fabs(*(newwidth+4)-*(oldwidth+4))>
epsilon || fabs(*(newwidth+5)-*(oldwidth+5))>
epsilon || fabs(*(newwidth+6)-*(oldwidth+6))>
epsilon || fabs(*(newwidth+7)-*(oldwidth+7))>
epsilon || fabs(*(newwidth+8)-*(oldwidth+8))>
epsilon || fabs(*(newwidth+9)-*(oldwidth+9))>
epsilon){
101 throw cms::Exception(
"DataDoesNotMatch") <<
"Values differ by more than deltaW" << std::endl;
103 listNewChan.erase(cell);
106 std::cout <<
"These are identical" << std::endl;
108 if(
outfile.compare(
"null")!=0){
109 for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++)
112 cell =
std::find(listNewChan.begin(), listNewChan.end(), mydetid);
113 if (cell == listNewChan.end())
117 resultPeds->addValues( *mywidth );
123 resultPeds->addValues( *mywidth );
125 listNewChan.erase(cell);
129 for (std::vector<DetId>::iterator it = listNewChan.begin(); it != listNewChan.end(); it++)
134 resultPeds->addValues( *mywidth );
137 std::ofstream outStream3(
outfile.c_str());
138 std::cout <<
"--- Dumping PedestalWidths - the combined ones ---" << std::endl;
146 std::vector<DetId> listResult = resultPeds->getAllChannels();
148 std::vector<HcalGenericDetId> listEMap = myRefEMap->allPrecisionId();
150 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++)
153 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
void analyze(const edm::Event &ev, const edm::EventSetup &es)
#define DEFINE_FWK_MODULE(type)
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)
std::vector< DetId > getAllChannels() const
HcalPedestalWidthsCheck(edm::ParameterSet const &ps)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
~HcalPedestalWidthsCheck()