ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/src/CutFlow.cc
(Generate patch)

Comparing UserCode/OSUT3Analysis/AnaTools/src/CutFlow.cc (file contents):
Revision 1.7 by ahart, Wed Feb 6 00:24:27 2013 UTC vs.
Revision 1.8 by lantonel, Tue Apr 9 16:09:25 2013 UTC

# Line 162 | Line 162 | CutFlow::outputCutFlow ()
162    clog << "=============================================" << endl;
163    clog << endl;
164  
165 +  clog.setf(std::ios::fixed);
166 +
167    if (prefix_ != "")
168      {
169        title[0] = toupper (title[0]);
# Line 169 | Line 171 | CutFlow::outputCutFlow ()
171        clog << title << endl;
172      }
173  
174 <  clog << setw (80) << setfill ('-') << '-' << setfill (' ') << endl;
175 <  clog << setw (15) << left << "Cut Name" << right << setw (16) << "Events" << setw (16) << "Cumulative Eff." << setw (16) << "Individual Eff." << setw (16) << "Minus One" << endl;
176 <  clog << setw (80) << setfill ('-') << '-' << setfill (' ') << endl;
174 >  uint longestCutName = 0;
175 >  for (vector<string>::const_iterator cut = cutNames_.begin (); cut != cutNames_.end (); cut++){
176 >    if((*cut).size() > longestCutName) longestCutName = (*cut).size();
177 >  }
178 >  longestCutName += 1;
179 >
180 >  clog << setw (58+longestCutName) << setfill ('-') << '-' << setfill (' ') << endl;
181 >  clog << setw (longestCutName) << left << "Cut Name" << right << setw (10) << setprecision(1) << "Events" << setw (16) << "Cumul. Eff." << setw (16) << "Indiv. Eff." << setw (16) << "Minus One" << endl;
182 >  clog << setw (58+longestCutName) << setfill ('-') << '-' << setfill (' ') << endl;
183    totalEvents = cutFlow_->GetBinContent (1);
184 <  clog << setw (15) << left << "Total:" << right << setw (16) << totalEvents << setw (16) << "100%" << setw (16) << "100%" << setw (16) << "0%" << endl;
184 >  clog << setw (longestCutName) << left << "Total:" << right << setw (10) << setprecision(1) << (double) totalEvents << setw (16) << "100%    " << setw (16) << "100%    " << setw (16) << "0%    " << endl;
185    for (vector<string>::const_iterator cut = cutNames_.begin (); cut != cutNames_.end (); cut++)
186      {
187        double cutFlow = cutFlow_->GetBinContent (cut - cutNames_.begin () + 2),
188               selection = selection_->GetBinContent (cut - cutNames_.begin () + 2),
189               minusOne = minusOne_->GetBinContent (cut - cutNames_.begin () + 2);
190  
191 <      clog << setw (15) << left << (*cut + ":") << right << setw (16) << cutFlow << setw (15) << 100.0 * (cutFlow / (double) totalEvents) << "%"
192 <                                                                                 << setw (15) << 100.0 * (selection / (double) totalEvents) << "%"
193 <                                                                                 << setw (15) << 100.0 * (minusOne / (double) totalEvents) << "%" << endl;
191 >      clog << setw (longestCutName) << left << (*cut + ":") << right << setw (10) << setprecision(1) << cutFlow << setw (15) << setprecision(3) << 100.0 * (cutFlow / (double) totalEvents) << "%"
192 >           << setw (15) << setprecision(3) << 100.0 * (selection / (double) totalEvents) << "%"
193 >           << setw (15) << setprecision(3) << 100.0 * (minusOne / (double) totalEvents) << "%" << endl;
194      }
195 <  clog << setw (80) << setfill ('-') << '-' << setfill (' ') << endl;
195 >  clog << setw (58+longestCutName) << setfill ('-') << '-' << setfill (' ') << endl;
196   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines