#include <PhysicsTools/UtilAlgos/interface/Selections.h>
Definition at line 110 of file Selections.h.
typedef const value_type& Selection< C, Selector, StoreContainer >::const_reference |
Definition at line 13 of file Selection.h.
typedef std::vector<Filter*>::iterator Selection< C, Selector, StoreContainer >::iterator |
Definition at line 112 of file Selections.h.
typedef value_type& Selection< C, Selector, StoreContainer >::reference |
Definition at line 12 of file Selection.h.
typedef C::size_type Selection< C, Selector, StoreContainer >::size_type |
Definition at line 11 of file Selection.h.
typedef C::value_type Selection< C, Selector, StoreContainer >::value_type |
Definition at line 10 of file Selection.h.
Selection< C, Selector, StoreContainer >::Selection | ( | std::string | name, | |
const edm::ParameterSet & | iConfig | |||
) | [inline] |
Definition at line 115 of file Selections.h.
References Selection< C, Selector, StoreContainer >::detailledPrintoutCategory_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), Selection< C, Selector, StoreContainer >::makeDetailledPrintout_, and Selection< C, Selector, StoreContainer >::nMonitor_.
00115 : 00116 name_(name), 00117 ntuplize_(iConfig.getParameter<bool>("ntuplize")), 00118 makeContentPlots_(iConfig.getParameter<bool>("makeContentPlots")), 00119 makeFinalPlots_(iConfig.getParameter<bool>("makeFinalPlots")), 00120 makeCumulativePlots_(iConfig.getParameter<bool>("makeCumulativePlots")), 00121 makeAllButOnePlots_(iConfig.getParameter<bool>("makeAllButOnePlots")), 00122 nSeen_(0), 00123 makeSummaryTable_(iConfig.getParameter<bool>("makeSummaryTable")), 00124 makeDetailledPrintout_(iConfig.exists("detailledPrintoutCategory")) 00125 { 00126 if (iConfig.exists("nMonitor")) 00127 nMonitor_=iConfig.getParameter<uint>("nMonitor"); 00128 else 00129 nMonitor_=0; 00130 00131 if (makeDetailledPrintout_) 00132 detailledPrintoutCategory_ = iConfig.getParameter<std::string>("detailledPrintoutCategory"); 00133 }
Selection< C, Selector, StoreContainer >::Selection | ( | const C & | c, | |
const Selector & | sel | |||
) | [inline] |
Definition at line 14 of file Selection.h.
References i, Selection< C, Selector, StoreContainer >::select_, and Selection< C, Selector, StoreContainer >::selected_.
00014 : 00015 select_( sel ) { 00016 for( typename C::const_iterator i = c.begin(); i != c.end(); ++i ) { 00017 if ( select_( *i ) ) selected_.push_back( & * i ); 00018 } 00019 }
std::map<std::string, bool> Selection< C, Selector, StoreContainer >::accept | ( | edm::Event & | iEvent | ) | [inline] |
Definition at line 139 of file Selections.h.
References Selection< C, Selector, StoreContainer >::begin(), count, Selection< C, Selector, StoreContainer >::counts_, Selection< C, Selector, StoreContainer >::detailledPrintoutCategory_, Selection< C, Selector, StoreContainer >::end(), filter, edm::Event::id(), Selection< C, Selector, StoreContainer >::makeDetailledPrintout_, Selection< C, Selector, StoreContainer >::name(), Selection< C, Selector, StoreContainer >::Count::nCumulative_, Selection< C, Selector, StoreContainer >::nMonitor_, Selection< C, Selector, StoreContainer >::Count::nPass_, Selection< C, Selector, StoreContainer >::Count::nSeen_, Selection< C, Selector, StoreContainer >::nSeen_, Selection< C, Selector, StoreContainer >::print(), and summary.
00139 { 00140 nSeen_++; 00141 if (nMonitor_!=0 && nSeen_%nMonitor_==0){ 00142 if (nSeen_==nMonitor_) print(); 00143 else print(false); 00144 } 00145 std::map<std::string, bool> ret; 00146 bool global=true; 00147 for (iterator filter=begin(); filter!=end();++filter){ 00148 const std::string & fName=(*filter)->name(); 00149 Count & count=counts_[fName]; 00150 count.nSeen_++; 00151 bool decision=(*filter)->accept(iEvent); 00152 ret[fName]=decision; 00153 if (decision) count.nPass_++; 00154 global=global && decision; 00155 if (global) count.nCumulative_++; 00156 } 00157 00158 if (makeDetailledPrintout_){ 00159 std::stringstream summary; 00160 summary<<std::setw(20)<<name().substr(0,19)<<" : " 00161 <<std::setw(10)<<iEvent.id().run()<<" : " 00162 <<std::setw(10)<<iEvent.id().event(); 00163 for (iterator filter=begin(); filter!=end();++filter){ 00164 const std::string & fName=(*filter)->name(); 00165 summary<<" : "<<std::setw(10)<<(ret[fName]?"pass":"reject"); 00166 } 00167 edm::LogVerbatim(detailledPrintoutCategory_)<<summary.str(); 00168 } 00169 00170 return ret; 00171 }
const_iterator Selection< C, Selector, StoreContainer >::begin | ( | void | ) | const [inline] |
Definition at line 48 of file Selection.h.
References Selection< C, Selector, StoreContainer >::selected_.
00048 { return const_iterator( selected_.begin() ); }
iterator Selection< C, Selector, StoreContainer >::begin | ( | void | ) | [inline] |
Definition at line 136 of file Selections.h.
References Selection< C, Selector, StoreContainer >::filters_.
Referenced by Selection< C, Selector, StoreContainer >::accept(), Selection< C, Selector, StoreContainer >::print(), and Selection< C, Selector, StoreContainer >::printDetailledPrintoutHeader().
00136 { return filters_.begin();}
bool Selection< C, Selector, StoreContainer >::empty | ( | void | ) | const [inline] |
Definition at line 51 of file Selection.h.
References Selection< C, Selector, StoreContainer >::selected_.
00051 { return selected_.empty(); }
const_iterator Selection< C, Selector, StoreContainer >::end | ( | void | ) | const [inline] |
Definition at line 49 of file Selection.h.
References Selection< C, Selector, StoreContainer >::selected_.
00049 { return const_iterator( selected_.end() ); }
iterator Selection< C, Selector, StoreContainer >::end | ( | void | ) | [inline] |
Definition at line 137 of file Selections.h.
References Selection< C, Selector, StoreContainer >::filters_.
Referenced by Selection< C, Selector, StoreContainer >::accept(), Selection< C, Selector, StoreContainer >::print(), and Selection< C, Selector, StoreContainer >::printDetailledPrintoutHeader().
00137 { return filters_.end();}
bool Selection< C, Selector, StoreContainer >::makeAllButOnePlots | ( | ) | [inline] |
Definition at line 242 of file Selections.h.
References Selection< C, Selector, StoreContainer >::makeAllButOnePlots_.
00242 { return makeAllButOnePlots_;}
bool Selection< C, Selector, StoreContainer >::makeContentPlots | ( | ) | [inline] |
Definition at line 239 of file Selections.h.
References Selection< C, Selector, StoreContainer >::makeContentPlots_.
00239 { return makeContentPlots_;}
bool Selection< C, Selector, StoreContainer >::makeCumulativePlots | ( | ) | [inline] |
Definition at line 241 of file Selections.h.
References Selection< C, Selector, StoreContainer >::makeCumulativePlots_.
00241 { return makeCumulativePlots_;}
bool Selection< C, Selector, StoreContainer >::makeFinalPlots | ( | ) | [inline] |
Definition at line 240 of file Selections.h.
References Selection< C, Selector, StoreContainer >::makeFinalPlots_.
00240 { return makeFinalPlots_;}
bool Selection< C, Selector, StoreContainer >::makeSummaryTable | ( | ) | [inline] |
Definition at line 243 of file Selections.h.
References Selection< C, Selector, StoreContainer >::makeSummaryTable_.
00243 { return makeSummaryTable_;}
const std::string& Selection< C, Selector, StoreContainer >::name | ( | void | ) | [inline] |
Definition at line 135 of file Selections.h.
References Selection< C, Selector, StoreContainer >::name_.
Referenced by Selection< C, Selector, StoreContainer >::accept(), and Selection< C, Selector, StoreContainer >::print().
00135 {return name_;}
bool Selection< C, Selector, StoreContainer >::ntuplize | ( | ) | [inline] |
Definition at line 238 of file Selections.h.
References Selection< C, Selector, StoreContainer >::ntuplize_.
00238 {return ntuplize_;}
const_reference Selection< C, Selector, StoreContainer >::operator[] | ( | size_type | i | ) | [inline] |
Definition at line 52 of file Selection.h.
References Selection< C, Selector, StoreContainer >::selected_.
void Selection< C, Selector, StoreContainer >::print | ( | bool | description = true |
) | [inline] |
Definition at line 186 of file Selections.h.
References Selection< C, Selector, StoreContainer >::begin(), category, count, Selection< C, Selector, StoreContainer >::counts_, GenMuonPlsPt100GeV_cfg::cout, description, Selection< C, Selector, StoreContainer >::end(), lat::endl(), filter, Selection< C, Selector, StoreContainer >::makeSummaryTable_, Selection< C, Selector, StoreContainer >::name(), Selection< C, Selector, StoreContainer >::Count::nCumulative_, Selection< C, Selector, StoreContainer >::Count::nPass_, Selection< C, Selector, StoreContainer >::Count::nSeen_, Selection< C, Selector, StoreContainer >::nSeen_, and summary.
Referenced by Selection< C, Selector, StoreContainer >::accept().
00186 { 00187 if (!makeSummaryTable_) return; 00188 00189 uint maxFnameSize = 20; 00190 for (iterator filter=begin(); filter!=end();++filter){ 00191 if ((*filter)->name().size() > maxFnameSize) maxFnameSize = (*filter)->name().size()+1; 00192 } 00193 00194 // const std::string category ="Selections|"+name(); 00195 const std::string category ="Selections"; 00196 std::stringstream summary; 00197 summary<<" Summary table for selection: "<<name()<<" with: "<<nSeen_<<" events run."<<std::endl; 00198 if (nSeen_==0) return; 00199 if (description){ 00200 for (iterator filter=begin(); filter!=end();++filter){ 00201 const std::string & fName=(*filter)->name(); 00202 summary<<"filter: "<<std::right<<std::setw(10)<<fName<<"\n" 00203 <<(*filter)->descriptionText()<<"\n"; 00204 } 00205 } 00206 summary<<" filter stand-alone pass: "<<std::endl; 00207 summary<<std::right<<std::setw(maxFnameSize)<<"total read"<<": " 00208 <<std::right<<std::setw(10)<<nSeen_<<std::endl; 00209 for (iterator filter=begin(); filter!=end();++filter){ 00210 const std::string & fName=(*filter)->name(); 00211 const Count & count=counts_[fName]; 00212 summary<<std::right<<std::setw(maxFnameSize)<<fName<<": " 00213 <<std::right<<std::setw(10)<<count.nPass_<<" passed events. " 00214 <<std::right<<std::setw(10)<<std::setprecision (5)<<(count.nPass_/(float)count.nSeen_)*100.<<" [%]"<<std::endl; 00215 } 00216 summary<<" filter cumulative pass:"<<std::endl; 00217 summary<<std::right<<std::setw(maxFnameSize)<<"total read"<<": " 00218 <<std::right<<std::setw(10)<<nSeen_<<std::endl; 00219 uint lastCount=nSeen_; 00220 for (iterator filter=begin(); filter!=end();++filter){ 00221 const std::string & fName=(*filter)->name(); 00222 const Count & count=counts_[fName]; 00223 summary<<std::right<<std::setw(maxFnameSize)<<fName<<": " 00224 <<std::right<<std::setw(10)<<count.nCumulative_<<" passed events. " 00225 <<std::right<<std::setw(10)<<std::setprecision (5)<<(count.nCumulative_/(float)count.nSeen_)*100.<<" [%]"; 00226 if (lastCount!=0) 00227 summary<<" (to previous count) "<<std::right<<std::setw(10)<<std::setprecision (5)<<(count.nCumulative_/(float)lastCount)*100.<<" [%]"; 00228 summary <<std::endl; 00229 00230 lastCount = count.nCumulative_; 00231 } 00232 summary<<"-------------------------------------\n"; 00233 edm::LogVerbatim(category)<<summary.str(); 00234 std::cout<<summary.str(); 00235 };
void Selection< C, Selector, StoreContainer >::printDetailledPrintoutHeader | ( | ) | [inline] |
Definition at line 173 of file Selections.h.
References Selection< C, Selector, StoreContainer >::begin(), Selection< C, Selector, StoreContainer >::detailledPrintoutCategory_, Selection< C, Selector, StoreContainer >::end(), filter, Selection< C, Selector, StoreContainer >::makeDetailledPrintout_, and summary.
00173 { 00174 if (makeDetailledPrintout_){ 00175 std::stringstream summary; 00176 summary<<std::setw(20)<<" selection name "<<" : " 00177 <<std::setw(10)<<" run "<<" : " 00178 <<std::setw(10)<<" event "; 00179 for (iterator filter=begin(); filter!=end();++filter){ 00180 summary<<" : "<<std::setw(10)<<(*filter)->name().substr(0,9); 00181 } 00182 edm::LogVerbatim(detailledPrintoutCategory_)<<summary.str(); 00183 } 00184 }
size_type Selection< C, Selector, StoreContainer >::size | ( | void | ) | const [inline] |
Definition at line 50 of file Selection.h.
References Selection< C, Selector, StoreContainer >::selected_.
00050 { return selected_.size(); }
friend class Selections [friend] |
Definition at line 113 of file Selections.h.
std::map<std::string, Count> Selection< C, Selector, StoreContainer >::counts_ [private] |
Definition at line 263 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::accept(), and Selection< C, Selector, StoreContainer >::print().
std::string Selection< C, Selector, StoreContainer >::detailledPrintoutCategory_ [private] |
Definition at line 266 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::accept(), Selection< C, Selector, StoreContainer >::printDetailledPrintoutHeader(), and Selection< C, Selector, StoreContainer >::Selection().
std::vector<Filter*> Selection< C, Selector, StoreContainer >::filters_ [private] |
Definition at line 247 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::begin(), Selection< C, Selector, StoreContainer >::end(), and Selections::Selections().
bool Selection< C, Selector, StoreContainer >::makeAllButOnePlots_ [private] |
Definition at line 253 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::makeAllButOnePlots().
bool Selection< C, Selector, StoreContainer >::makeContentPlots_ [private] |
Definition at line 250 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::makeContentPlots().
bool Selection< C, Selector, StoreContainer >::makeCumulativePlots_ [private] |
Definition at line 252 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::makeCumulativePlots().
bool Selection< C, Selector, StoreContainer >::makeDetailledPrintout_ [private] |
Definition at line 265 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::accept(), Selection< C, Selector, StoreContainer >::printDetailledPrintoutHeader(), and Selection< C, Selector, StoreContainer >::Selection().
bool Selection< C, Selector, StoreContainer >::makeFinalPlots_ [private] |
Definition at line 251 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::makeFinalPlots().
bool Selection< C, Selector, StoreContainer >::makeSummaryTable_ [private] |
Definition at line 264 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::makeSummaryTable(), and Selection< C, Selector, StoreContainer >::print().
std::string Selection< C, Selector, StoreContainer >::name_ [private] |
Definition at line 246 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::name().
uint Selection< C, Selector, StoreContainer >::nMonitor_ [private] |
Definition at line 256 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::accept(), and Selection< C, Selector, StoreContainer >::Selection().
uint Selection< C, Selector, StoreContainer >::nSeen_ [private] |
Definition at line 255 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::accept(), and Selection< C, Selector, StoreContainer >::print().
bool Selection< C, Selector, StoreContainer >::ntuplize_ [private] |
Definition at line 249 of file Selections.h.
Referenced by Selection< C, Selector, StoreContainer >::ntuplize().
Selector Selection< C, Selector, StoreContainer >::select_ [private] |
Definition at line 54 of file Selection.h.
Referenced by Selection< C, Selector, StoreContainer >::Selection().
StoreContainer Selection< C, Selector, StoreContainer >::selected_ [private] |
Definition at line 55 of file Selection.h.
Referenced by Selection< C, Selector, StoreContainer >::begin(), Selection< C, Selector, StoreContainer >::empty(), Selection< C, Selector, StoreContainer >::end(), Selection< C, Selector, StoreContainer >::operator[](), Selection< C, Selector, StoreContainer >::Selection(), and Selection< C, Selector, StoreContainer >::size().