34{
36
37 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
39 } else {
40 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
41 }
42
44
45 if (
histogram->GetEffectiveEntries() < minstat ) {
46 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
47 result->tags_[
"InsufficientEffectiveEntries"] =
histogram->GetEffectiveEntries();
50 }
51
53
54 TH1* refhist;
55 try {
56 refhist =
static_cast<TH1 *
>(
config.getReference() );
57 }
58 catch ( dqm_core::Exception & ex ) {
59 throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
60 }
61 if (
histogram->GetDimension() != refhist->GetDimension() ) {
62 throw dqm_core::BadRefHist( ERS_HERE, "Dimension", name );
63 }
64 if ((
histogram->GetNbinsX() != refhist->GetNbinsX()) || (
histogram->GetNbinsY() != refhist->GetNbinsY()) || refhist->GetNbinsZ() !=
histogram->GetNbinsZ() ) {
65 throw dqm_core::BadRefHist( ERS_HERE, "number of bins", name );
66 }
67 ERS_DEBUG(2,"Masking bins according to reference. Will set content to"<<coeff);
68
69 for ( Int_t binx=
histogram->GetXaxis()->GetFirst() ; binx<=histogram->GetXaxis()->GetLast();++binx)
70 {
71 for ( Int_t biny=
histogram->GetYaxis()->GetFirst() ; biny<=histogram->GetYaxis()->GetLast();++biny)
72 {
73 for ( Int_t binz=
histogram->GetZaxis()->GetFirst() ; binz<=histogram->GetZaxis()->GetLast();++binz)
74 {
75 if ( refhist->GetBinContent(binx,biny,binz) != 0 )
76 {
77 ERS_DEBUG(3,"Found a bin in reference with entries !=0, set content of bin ("<<binx<<","<<biny<<","<<binz<<") with "<<coeff);
78 histogram->SetBinContent( binx , biny, binz , coeff );
79 }
80 }
81 }
82 }
83
84
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.