41{
43
44 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
46 } else {
47 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
48 }
49
51
52 if (
histogram->GetEffectiveEntries() < minstat ) {
53 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
54 result->tags_[
"InsufficientEffectiveEntries"] =
histogram->GetEffectiveEntries();
57 }
58
60
61 TObject* ro =
config.getReference();
62 const TObject* firstReference = 0;
63 TObject* secondReference= 0;
64 try {
66 }
67 catch ( dqm_core::Exception& ex ) {
68 throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
69 }
70
71 const TH1* refhist = dynamic_cast<const TH1*>(firstReference);
72 if ( refhist == 0 )
73 {
74 throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
75 }
76
77if ((
histogram->GetDimension() != refhist->GetDimension()) ||
78 (
histogram->GetNbinsX() != refhist->GetNbinsX()) ||
79 (
histogram->GetNbinsY() != refhist->GetNbinsY()) ||
80 refhist->GetNbinsZ() !=
histogram->GetNbinsZ() ) {
81 throw dqm_core::BadRefHist( ERS_HERE, "number of bins", name );
82 }
83 ERS_DEBUG(2,"Doing: histogram + ("<<coeff<<")*reference");
85
86
87 ERS_DEBUG(2,
"Running algorithm: "<<
m_name);
88 dqm_core::Algorithm* subalgorithm;
89 try {
90 subalgorithm = dqm_core::AlgorithmManager::instance().getAlgorithm(
m_name );
91 }
92 catch ( dqm_core::AlgorithmNotFound& ex )
93 {
94 ERS_DEBUG(2,
"Cannot find algorithm:"+
m_name);
95 throw dqm_core::BadConfig(ERS_HERE,name,
"Cannot Find sub-algorithm:"+
m_name);
96 }
97 dqm_core::Result*
result = subalgorithm->execute( name , *
histogram , config);
98 ERS_DEBUG(2,"Sub algorithm returns:"<<*result);
99
100 TObject* robject =
result->getObject();
101 if ( !robject )
102 {
103 ERS_DEBUG(2,"Adding modified histogram in result");
105 }
106 else
107 {
108 ERS_DEBUG(2,"Result already have an associated TObject, appending modified histogram");
109 if ( robject->IsA()->InheritsFrom("TObjArray") )
110 {
111 static_cast<TObjArray*
>(robject)->Add(
histogram );
112
113 result->object_.reset( robject );
114 }
115 else
116 {
117 TObjArray*
array =
new TObjArray( 2 );
118 array->AddAt( robject , 0 );
120
121 result->object_.reset( array );
122 }
123 ERS_DEBUG(2,
"Result now have a TObjArray of size:"<<
static_cast<TObjArray*
>(
result->getObject())->GetEntries());
124 }
126}
#define IsA
Declare the TObject style functions.