141 edm::LogError(
"ProductNotFound")<<
"MEtoMEComparitor did not find his products.";
147 const std::vector<MEtoEDMObject> & metoedmobject_ref = metoedm_ref->getMEtoEdmObject();
148 const std::vector<MEtoEDMObject> & metoedmobject_new = metoedm_new->getMEtoEdmObject();
150 typedef std::map<std::string, std::pair<const MEtoEDMObject*, const MEtoEDMObject*> > Mapping;
151 typedef typename std::map<std::string, std::pair<const MEtoEDMObject*, const MEtoEDMObject*> >::iterator Mapping_iterator;
155 LogDebug(
"MEtoMEComparitor")<<
"going to do the mapping from "<<metoedmobject_ref.size()<<
" x "<<metoedmobject_new.size();
156 unsigned int countMe=0;
157 for (
unsigned int i_new=0; i_new!= metoedmobject_new.size(); ++i_new){
158 const std::string & pathname = metoedmobject_new[i_new].name;
159 if (metoedmobject_new[i_new].
object.GetEntries()==0 ||
160 metoedmobject_new[i_new].object.Integral()==0){
164 mapping[pathname]=std::make_pair(&metoedmobject_new[i_new],(
const MEtoEDMObject*)0);
166 for (
unsigned int i_ref=0; i_ref!= metoedmobject_ref.size() ; ++i_ref){
167 const std::string & pathname = metoedmobject_ref[i_ref].name;
168 Mapping_iterator there = mapping.find(pathname);
169 if (there != mapping.end()){
170 there->second.second = &metoedmobject_ref[i_ref];
174 LogDebug(
"MEtoMEComparitor")<<
"found "<<mapping.size()<<
" pairs of plots";
177 unsigned int nNoMatch=0;
178 unsigned int nEmpty=0;
179 unsigned int nHollow=0;
180 unsigned int nGoodKS=0;
181 unsigned int nBadKS=0;
182 unsigned int nBadDiff=0;
183 unsigned int nGoodDiff=0;
185 typedef std::map<std::string, std::pair<unsigned int,unsigned int> > Subs;
188 for (Mapping_iterator it = mapping.begin();
191 if (!it->second.second){
196 const T * h_ref = &it->second.second->object;
197 const T * h_new = &it->second.first->object;
202 for (
unsigned int iD=1;iD!=
_dirDepth;++iD) subsystem+=
"/"+dir[iD];
205 if (h_ref->GetEntries()!=0 && h_ref->Integral()!=0){
207 bool cannotComputeKS=
false;
209 KS = h_new->KolmogorovTest(h_ref);
212 cannotComputeKS=
true;
216 unsigned int total_ref=0;
217 unsigned int absdiff=0;
218 for (
unsigned int iBin=0;
219 iBin!=(
unsigned int)h_new->GetNbinsX()+1 ;
221 total_ref+=h_ref->GetBinContent(iBin);
222 absdiff=
std::abs(h_new->GetBinContent(iBin) - h_ref->GetBinContent(iBin));
224 double relativediff=1;
226 relativediff=absdiff / (double) total_ref;
231 <<
" the KS is "<<KS*100.<<
" %"
232 <<
" and the relative diff is: "<<relativediff*100.<<
" %"
233 <<
" KS"<<((cannotComputeKS)?
" not valid":
" is valid");
249 if (h_ref->GetEntries()==0)
253 LogDebug(
"MEtoMEComparitor")<<h_new->GetName() <<
" in "<<it->first <<
" is empty";
259 if (mapping.size()!=0){
261 summary<<
" Summary :"
262 <<
"\n not matched : "<<nNoMatch
263 <<
"\n empty : "<<nEmpty
264 <<
"\n integral zero : "<<nHollow
265 <<
"\n good KS : "<<nGoodKS
266 <<
"\n bad KS : "<<nBadKS
267 <<
"\n bad diff : "<<nBadDiff
268 <<
"\n godd diff : "<<nGoodDiff;
270 for (Subs::iterator iSub=subSystems.begin();
271 iSub!=subSystems.end();++iSub){
272 double fraction = 1-(iSub->second.second / (double)iSub->second.first);
273 summary<<std::endl<<
"Subsytem: "<<iSub->first<<
" has "<< fraction*100<<
" % goodness";
void keepBadHistograms(const std::string &directory, const T *h_new, const T *h_ref)