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