14 #include <TObjArray.h>
15 #include <dqm_core/AlgorithmManager.h>
47 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
50 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
55 if (
histogram->GetEffectiveEntries() < minstat ) {
57 result->tags_[
"InsufficientEffectiveEntries"] =
histogram->GetEffectiveEntries();
63 TObject* ro =
config.getReference();
64 const TObject* firstReference=0;
65 TObject* secondReference=0;
69 catch ( dqm_core::Exception & ex ) {
70 throw dqm_core::BadRefHist(ERS_HERE,
name,
" Could not retreive reference");
73 const TH1* refhist =
dynamic_cast<const TH1*
>(firstReference);
76 throw dqm_core::BadRefHist( ERS_HERE,
"Dimension",
name );
78 if ((
histogram->GetDimension() != refhist->GetDimension()) ||
79 (
histogram->GetNbinsX() != refhist->GetNbinsX()) ||
80 (
histogram->GetNbinsY() != refhist->GetNbinsY()) ||
81 refhist->GetNbinsZ() !=
histogram->GetNbinsZ() )
83 throw dqm_core::BadRefHist( ERS_HERE,
"number of bins",
name );
88 ERS_DEBUG(2,
"Running algorithm: "<<m_name);
89 dqm_core::Algorithm* subalgorithm;
93 catch ( dqm_core::AlgorithmNotFound& ex )
95 ERS_DEBUG(2,
"Cannot find algorithm:"+m_name);
96 throw dqm_core::BadConfig(ERS_HERE,
name,
"Cannot Find sub-algorithm:"+m_name);
102 ERS_DEBUG(2,
"Sub algorithm returns:"<<*
result);
104 TObject* robject =
result->getObject();
107 ERS_DEBUG(2,
"Adding modified histogram in result");
112 ERS_DEBUG(2,
"Result already have an associated TObject, appending modified histogram");
113 if ( robject->IsA()->InheritsFrom(
"TCollection") )
115 static_cast<TCollection*
>(robject)->Add(
histogram );
119 TObjArray*
array =
new TObjArray( 2 );
120 array->AddAt( robject->Clone() , 0 );
125 ERS_DEBUG(2,
"Result now have a TObjArray of size:"<<
static_cast<TObjArray*
>(
result->getObject())->GetEntries());
132 out<<
"DivideReference_"+m_name+
" : Performs the "+m_name+
" algorithm after dividing the input histogram by the reference. I.e. performing: histogram /= Reference (see TH1::Divide). Adds to the output TObject list the modified input histogram."<<std::endl;
133 out<<
"Optional Parameter : MinStat : Minimum histogram statistics needed to perform Algorithm"<<std::endl;