62 TH1* firstBinwiseHist = 0;
66 for (dqm_core::ParametersMap::const_iterator paramIter=map.begin();paramIter!=map.end();++paramIter){
67 if ( paramIter->second->getWeight() == 0 ) {
71 TObject* inputobject = inputResult->getObject();
72 if (inputobject == 0) {
75 for (std::map<std::string,double>::const_iterator tagIter=inputResult->tags_.begin();
76 tagIter != inputResult->tags_.end(); ++tagIter ) {
77 if( tagIter->first.find(
"Algorithm--BinsDiffByStrips") != std::string::npos) {
78 if( inputobject->IsA()->InheritsFrom(
"TObjArray") ) {
79 firstBinwiseHist = (TH1*) ((TObjArray*)inputobject)->
First();
80 nBinsX = firstBinwiseHist->GetNbinsX();
81 nBinsY = firstBinwiseHist->GetNbinsY();
86 if( (nBinsX != 0) || (nBinsY != 0) ) {
91 std::vector<std::pair<TH1*,float> > binwiseStatHists;
94 std::map<double,std::vector<std::pair<int,float> > > standardAndGroup;
95 std::map<double,std::vector<std::pair<TH1*,float> > > binwiseAndGroup;
96 std::set<double> setOfAndGroups;
100 for (dqm_core::ParametersMap::const_iterator paramIter=map.begin();paramIter!=map.end();++paramIter){
103 float weight = paramIter->second->getWeight();
105 ERS_DEBUG(2,
"Skip result (weight 0): "<<paramIter->first);
109 TObject* inputobject = inputResult->getObject();
110 if (inputobject == 0) {
111 ERS_DEBUG(2,
"Empty input object, "<<paramIter->first);
117 bool isSpecialParameter =
false;
118 double andGroup = -99999.;
119 TH1* binwiseStatHist = 0;
120 for (std::map<std::string,double>::const_iterator tagIter=inputResult->tags_.begin();
121 tagIter != inputResult->tags_.end(); ++tagIter ) {
123 std::string
tag = tagIter->first;
125 std::string tagType =
"ConfParameter--Role--Mask";
126 if ( (stringPos =
tag.find(tagType)) != std::string::npos) {
127 if ( inputobject->IsA()->InheritsFrom(
"TH1") ) {
128 if( (((TH1*)inputobject)->GetNbinsX() == nBinsX) && (((TH1*)inputobject)->GetNbinsY() == nBinsY)) {
129 mask = (TH1*)inputobject;
132 isSpecialParameter =
true;
136 tagType =
"Algorithm--BinsDiffByStrips";
137 if ( (stringPos =
tag.find(tagType)) != std::string::npos) {
138 if( inputobject->IsA()->InheritsFrom(
"TObjArray") ) {
139 binwiseStatHist = (TH1*) ((TObjArray*) inputobject)->
First();
140 if( (binwiseStatHist->GetNbinsX() != nBinsX) || (binwiseStatHist->GetNbinsY() != nBinsY) ) {
144 isSpecialParameter =
true;
148 tagType =
"AndGroup";
149 if ( (stringPos =
tag.find(tagType)) != std::string::npos) {
150 andGroup = tagIter->second;
153 if( !isSpecialParameter ){
157 if( andGroup == -99999. ) {
158 if( binwiseStatHist != 0 ) {
159 std::pair<TH1*,float> binStatsPair ( binwiseStatHist,
weight );
160 binwiseStatHists.push_back(binStatsPair);
164 if( binwiseStatHist != 0 ) {
165 std::map<double,std::vector<std::pair<TH1*,float> > >
::iterator fitr = binwiseAndGroup.find(andGroup);
166 if( fitr == binwiseAndGroup.end() ) {
168 std::vector<std::pair<TH1*,float> > newAndGroup;
169 newAndGroup.push_back( std::make_pair( binwiseStatHist,
weight ) );
170 binwiseAndGroup.insert(std::make_pair(andGroup,newAndGroup));
171 setOfAndGroups.insert(andGroup);
174 fitr->second.push_back( std::make_pair( binwiseStatHist,
weight ) );
178 std::map<double,std::vector<std::pair<int,float> > >
::iterator fitr = standardAndGroup.find(andGroup);
179 if( fitr == standardAndGroup.end() ) {
181 std::vector<std::pair<int,float> > newAndGroup;
182 newAndGroup.push_back( std::make_pair( inputResult->status_,
weight ) );
183 standardAndGroup.insert( std::make_pair(andGroup, newAndGroup) );
184 setOfAndGroups.insert(andGroup);
187 fitr->second.push_back( std::make_pair( inputResult->status_,
weight ) );
197 while (setItr != setOfAndGroups.end()) {
198 std::map<double, std::vector<std::pair<TH1*,float> > >
::iterator findIter = binwiseAndGroup.find(*setItr);
199 if( findIter == binwiseAndGroup.end() ) {
200 std::map<double, std::vector<std::pair<int,float> > >
::iterator fsIter = standardAndGroup.find(*setItr);
201 if( fsIter != standardAndGroup.end() ) {
202 if( !fsIter->second.empty() ) {
204 float groupWeight = 0;
205 for( std::vector<std::pair<int,float> >::const_iterator sandItr = fsIter->second.begin();
206 sandItr != fsIter->second.end(); ++sandItr ) {
208 groupWeight += sandItr->second;
212 standardAndGroup.erase(fsIter);
214 setOfAndGroups.erase(setItr++);
219 if( (binwiseStatHists.size() == 0) && (setOfAndGroups.size() == 0) ) {
220 newresult->status_ =
status;
224 std::vector<std::pair<TH1*,float> >::const_iterator itr;
225 std::vector<std::pair<TH1*,float> >::const_iterator iBegin = binwiseStatHists.begin();
226 std::vector<std::pair<TH1*,float> >::const_iterator iEnd = binwiseStatHists.end();
229 for(
int ix = 1; ix <= nBinsX; ix++) {
230 for(
int iy = 1; iy <= nBinsY; iy++) {
231 int bin = firstBinwiseHist->GetBin(ix,iy);
233 double downWeight = 0;
234 if(
mask->GetBinContent(
bin) != 0) {
237 for( itr = iBegin; itr != iEnd; ++itr ) {
239 (itr->second - downWeight) );
242 for( std::map<
double, std::vector<std::pair<TH1*,float> > >::
iterator bItr = binwiseAndGroup.begin();
243 bItr != binwiseAndGroup.end(); ++ bItr ) {
245 float groupWeight = 0;
246 for( std::vector<std::pair<TH1*,float> >::const_iterator bandItr = bItr->second.begin();
247 bandItr != bItr->second.end(); ++bandItr ) {
249 (bandItr->second - downWeight) );
250 groupWeight += bandItr->second - downWeight;
252 std::map<double, std::vector<std::pair<int,float> > >
::iterator fsIter = standardAndGroup.find(bItr->first);
253 if( fsIter != standardAndGroup.end() ) {
254 for( std::vector<std::pair<int,float> >::const_iterator sandItr = fsIter->second.begin();
255 sandItr != fsIter->second.end(); ++sandItr ) {
257 groupWeight += sandItr->second;
267 for(
int ix = 1; ix <= nBinsX; ix++) {
268 for(
int iy = 1; iy <= nBinsY; iy++) {
270 if( ! binwiseStatHists.empty() ) {
271 bin = binwiseStatHists.front().first->GetBin(ix,iy);
274 bin = binwiseAndGroup.begin()->second.front().first->GetBin(ix,iy);
277 for( itr = iBegin; itr != iEnd; ++itr ) {
283 for( std::map<
double, std::vector<std::pair<TH1*,float> > >::
iterator bItr = binwiseAndGroup.begin();
284 bItr != binwiseAndGroup.end(); ++ bItr ) {
287 float groupWeight = 0;
288 for( std::vector<std::pair<TH1*,float> >::const_iterator bandItr = bItr->second.begin();
289 bandItr != bItr->second.end(); ++bandItr ) {
292 groupWeight += bandItr->second;
294 std::map<double, std::vector<std::pair<int,float> > >
::iterator fsIter = standardAndGroup.find(bItr->first);
295 if( fsIter != standardAndGroup.end() ) {
296 for( std::vector<std::pair<int,float> >::const_iterator sandItr = fsIter->second.begin();
297 sandItr != fsIter->second.end(); ++sandItr ) {
299 groupWeight += sandItr->second;
307 newresult->status_ =
status;