9 #ifndef DQM_ALGORITHMS_SUMMARY_DIVIDEBYHIST_CXX
10 #define DQM_ALGORITHMS_SUMMARY_DIVIDEBYHIST_CXX
12 #include <dqm_core/AlgorithmConfig.h>
14 #include <dqm_core/AlgorithmManager.h>
16 #include <dqm_core/Result.h>
17 #include <dqm_core/Parameter.h>
27 #ifndef DQM_ALGORITHMS_MULTIALGORITHMTEST
29 #endif //#ifndef DQM_ALGORITHMS_MULTIALGORITHMTEST
50 const dqm_core::ParametersMap & map)
55 std::multimap<std::string,TObject*>
inputs;
61 for (dqm_core::ParametersMap::const_iterator iter=map.begin();iter!=map.end();++iter){
64 if ( iter->second->getWeight() == 0 ) {
65 ERS_DEBUG(2,
"Skip result (weight 0): "<<iter->first);
68 TObject* inputobject = iter->second->getResult().get()->getObject();
69 if (inputobject == 0) {
72 newresult->status_ = lastResult.status_;
78 for (std::map<std::string,double>::const_iterator tagIter=iter->second->getResult().get()->tags_.begin();
79 tagIter != iter->second->getResult().get()->tags_.end(); ++tagIter ) {
80 std::string
tag = tagIter->first;
82 std::string tagType =
"ConfParameter--Role--";
83 if ( (stringPos =
tag.find(tagType)) != std::string::npos) {
84 stringPos += tagType.length();
85 role =
tag.substr(stringPos);
90 if(role.size() != 0) {
91 inputs.insert(std::pair<std::string,TObject*>(role,inputobject));
97 newresult->status_ = lastResult.status_;
104 std::map<std::string,double > paramVecMap;
105 for (dqm_core::ParametersMap::const_reverse_iterator rIter=map.rbegin() ; rIter!=map.rend();++rIter) {
106 if( rIter->second->getResult().get()->tags_.empty() ){
109 for (std::map<std::string,double>::const_iterator tagIter=rIter->second->getResult().get()->tags_.begin();
110 tagIter != rIter->second->getResult().get()->tags_.end(); ++tagIter ) {
111 std::string
tag = tagIter->first;
115 tagType =
"ConfParameter--Role--";
116 if (
tag.find(tagType) != std::string::npos ){
120 tagType =
"ConfParameter--OverWrite";
121 if (
tag.find(tagType) != std::string::npos ){
123 overWriteResult = rIter->second->getResult().get();
128 tagType =
"ConfParameter--";
129 if ( (stringPos =
tag.find(tagType)) != std::string::npos ){
131 stringPos += tagType.length();
135 tagType =
"GThreshold--";
136 if ( (stringPos =
tag.find(tagType)) != std::string::npos ){
138 stringPos += tagType.length();
142 tagType =
"RThreshold--";
143 if ( (stringPos =
tag.find(tagType)) != std::string::npos ){
145 stringPos += tagType.length();
149 if (
tag.find(
"ConfParameter[") != std::string::npos ){
150 std::cerr<<
"MULTIOPTION PARAMETERS NO LONGER SUPPORTED; IGNORING" << std::endl;
160 for ( std::map<std::string,double>::const_iterator pvIter=paramVecMap.begin(); pvIter!=paramVecMap.end();++pvIter){
161 algConfig.
addParameter( pvIter->first, pvIter->second );
168 if ((overWriteResult != 0) && (newresult->getObject() != 0) ) {
171 overWriteResult->status_ = newresult->status_;
172 overWriteResult->tags_ = newresult->tags_;
174 TObject* overWriteObject = overWriteResult->getObject();
175 if ( (!overWriteObject->IsA()->InheritsFrom(
"TH1")) || (!newresult->getObject()->IsA()->InheritsFrom(
"TH1")) ) {
180 TH1* hOverW = (TH1*) overWriteObject;
181 TH1* hResult = (TH1*) newresult->getObject();
183 if (hOverW->GetDimension() == hResult->GetDimension()) {
185 hOverW->Add(hResult);
195 const std::multimap<std::string,TObject*> &
inputs,
196 const dqm_core::AlgorithmConfig&
config)
201 TH1 * hNumerator = 0;
202 TH1 * hDenominator = 0;
205 TObject * numero = 0;
206 TObject * denomino = 0;
209 throw dqm_core::BadConfig( ERS_HERE,
name ,
"incorrect number of arguements, number of inputs for division must be at least two");
213 std::multimap<std::string,TObject*>::const_iterator mmItr;
215 mmItr =
inputs.find(
"Numerator");
216 if ( mmItr !=
inputs.end() ) {
217 numero = mmItr->second;
220 throw dqm_core::BadConfig( ERS_HERE,
name,
"no object with 'Role--Numerator' was specified.");
222 mmItr =
inputs.find(
"Denominator");
223 if ( mmItr !=
inputs.end() ) {
224 denomino = mmItr->second;
227 throw dqm_core::BadConfig( ERS_HERE,
name,
"no object with 'Role--Denominator' was specified.");
230 if( numero->IsA()->InheritsFrom(
"TH1") ){
231 hNumerator = (TH1*) numero;
235 sprintf(
errorStr,
"%s does not inherit from TH1",numero->GetName());
238 if( denomino->IsA()->InheritsFrom(
"TH1") ){
239 hDenominator = (TH1*) denomino;
243 sprintf(
errorStr,
"%s does not inherit from TH1",denomino->GetName());
260 newresult->object_ = (boost::shared_ptr<TObject>)(TObject*)hQuotient;
265 #endif // #ifndef DQM_ALGORITHMS_SUMMARY_DIVIDEBYHIST_CXX