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 =
static_cast<TH1*
> (
static_cast<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( (
static_cast<TH1*
>(inputobject)->GetNbinsX() == nBinsX) &&
129 (
static_cast<TH1*
>(inputobject)->GetNbinsY() == nBinsY)) {
130 mask =
static_cast<TH1*
>(inputobject);
133 isSpecialParameter =
true;
137 tagType =
"Algorithm--BinsDiffByStrips";
138 if ( (stringPos =
tag.find(tagType)) != std::string::npos) {
139 if( inputobject->IsA()->InheritsFrom(
"TObjArray") ) {
140 binwiseStatHist =
static_cast<TH1*
> (
static_cast<TObjArray*
> (inputobject)->
First());
141 if( (binwiseStatHist->GetNbinsX() != nBinsX) || (binwiseStatHist->GetNbinsY() != nBinsY) ) {
145 isSpecialParameter =
true;
149 tagType =
"AndGroup";
150 if ( (stringPos =
tag.find(tagType)) != std::string::npos) {
151 andGroup = tagIter->second;
154 if( !isSpecialParameter ){
158 if( andGroup == -99999. ) {
159 if( binwiseStatHist != 0 ) {
160 std::pair<TH1*,float> binStatsPair ( binwiseStatHist,
weight );
161 binwiseStatHists.push_back(binStatsPair);
165 if( binwiseStatHist != 0 ) {
166 std::map<double,std::vector<std::pair<TH1*,float> > >
::iterator fitr = binwiseAndGroup.find(andGroup);
167 if( fitr == binwiseAndGroup.end() ) {
169 std::vector<std::pair<TH1*,float> > newAndGroup;
170 newAndGroup.push_back( std::make_pair( binwiseStatHist,
weight ) );
171 binwiseAndGroup.insert(std::make_pair(andGroup,newAndGroup));
172 setOfAndGroups.insert(andGroup);
175 fitr->second.push_back( std::make_pair( binwiseStatHist,
weight ) );
179 std::map<double,std::vector<std::pair<int,float> > >
::iterator fitr = standardAndGroup.find(andGroup);
180 if( fitr == standardAndGroup.end() ) {
182 std::vector<std::pair<int,float> > newAndGroup;
183 newAndGroup.push_back( std::make_pair( inputResult->status_,
weight ) );
184 standardAndGroup.insert( std::make_pair(andGroup, newAndGroup) );
185 setOfAndGroups.insert(andGroup);
188 fitr->second.push_back( std::make_pair( inputResult->status_,
weight ) );
198 while (setItr != setOfAndGroups.end()) {
199 std::map<double, std::vector<std::pair<TH1*,float> > >
::iterator findIter = binwiseAndGroup.find(*setItr);
200 if( findIter == binwiseAndGroup.end() ) {
201 std::map<double, std::vector<std::pair<int,float> > >
::iterator fsIter = standardAndGroup.find(*setItr);
202 if( fsIter != standardAndGroup.end() ) {
203 if( !fsIter->second.empty() ) {
205 float groupWeight = 0;
206 for( std::vector<std::pair<int,float> >::const_iterator sandItr = fsIter->second.begin();
207 sandItr != fsIter->second.end(); ++sandItr ) {
209 groupWeight += sandItr->second;
213 standardAndGroup.erase(fsIter);
215 setOfAndGroups.erase(setItr++);
220 if( (binwiseStatHists.size() == 0) && (setOfAndGroups.size() == 0) ) {
221 newresult->status_ =
status;
225 std::vector<std::pair<TH1*,float> >::const_iterator itr;
226 std::vector<std::pair<TH1*,float> >::const_iterator iBegin = binwiseStatHists.begin();
227 std::vector<std::pair<TH1*,float> >::const_iterator iEnd = binwiseStatHists.end();
230 for(
int ix = 1; ix <= nBinsX; ix++) {
231 for(
int iy = 1; iy <= nBinsY; iy++) {
232 int bin = firstBinwiseHist->GetBin(ix,iy);
234 double downWeight = 0;
235 if(
mask->GetBinContent(
bin) != 0) {
238 for( itr = iBegin; itr != iEnd; ++itr ) {
240 (itr->second - downWeight) );
243 for( std::map<
double, std::vector<std::pair<TH1*,float> > >::
iterator bItr = binwiseAndGroup.begin();
244 bItr != binwiseAndGroup.end(); ++ bItr ) {
246 float groupWeight = 0;
247 for( std::vector<std::pair<TH1*,float> >::const_iterator bandItr = bItr->second.begin();
248 bandItr != bItr->second.end(); ++bandItr ) {
250 (bandItr->second - downWeight) );
251 groupWeight += bandItr->second - downWeight;
253 std::map<double, std::vector<std::pair<int,float> > >
::iterator fsIter = standardAndGroup.find(bItr->first);
254 if( fsIter != standardAndGroup.end() ) {
255 for( std::vector<std::pair<int,float> >::const_iterator sandItr = fsIter->second.begin();
256 sandItr != fsIter->second.end(); ++sandItr ) {
258 groupWeight += sandItr->second;
268 for(
int ix = 1; ix <= nBinsX; ix++) {
269 for(
int iy = 1; iy <= nBinsY; iy++) {
271 if( ! binwiseStatHists.empty() ) {
272 bin = binwiseStatHists.front().first->GetBin(ix,iy);
275 bin = binwiseAndGroup.begin()->second.front().first->GetBin(ix,iy);
278 for( itr = iBegin; itr != iEnd; ++itr ) {
284 for( std::map<
double, std::vector<std::pair<TH1*,float> > >::
iterator bItr = binwiseAndGroup.begin();
285 bItr != binwiseAndGroup.end(); ++ bItr ) {
288 float groupWeight = 0;
289 for( std::vector<std::pair<TH1*,float> >::const_iterator bandItr = bItr->second.begin();
290 bandItr != bItr->second.end(); ++bandItr ) {
293 groupWeight += bandItr->second;
295 std::map<double, std::vector<std::pair<int,float> > >
::iterator fsIter = standardAndGroup.find(bItr->first);
296 if( fsIter != standardAndGroup.end() ) {
297 for( std::vector<std::pair<int,float> >::const_iterator sandItr = fsIter->second.begin();
298 sandItr != fsIter->second.end(); ++sandItr ) {
300 groupWeight += sandItr->second;
308 newresult->status_ =
status;