1 #ifndef RecoLuminosity_LumiProducer_LumiCalculator_h 2 #define RecoLuminosity_LumiProducer_LumiCalculator_h 14 #include <boost/regex.hpp> 47 void endJob()
override;
51 std::map<std::string,hltPerPathInfo>
hltmap_;
52 std::map<std::string,l1PerBitInfo>
l1map_;
64 consumes<LumiSummary,edm::InLumi>(
edm::InputTag(
"lumiProducer",
""));
65 consumes<LumiSummaryRunHeader,edm::InRun>(
edm::InputTag(
"lumiProducer",
""));
107 *
log_<<
"======Trigger Configuration Overview======\n";
111 for (
unsigned int t=0;
t<totaltrg;++
t){
120 std::vector<std::string>::iterator hltpathBeg=numpathmodules.begin();
121 std::vector<std::string>::iterator hltpathEnd=numpathmodules.end();
122 unsigned int mycounter=0;
123 for(std::vector<std::string>::iterator numpathmodule = hltpathBeg;
124 numpathmodule!=hltpathEnd; ++numpathmodule ) {
135 *
log_<<
"\tskip and erase previous seeds : multiple L1SeedsLogicalExpressions per hlt path\n";
141 if(l1pathname.find(
"(")!=std::string::npos){
143 *
log_<<
" L1SeedsLogicalExpression(Complex)\t"<<l1pathname<<
"\n";
144 *
log_<<
"\tskip:contain complex logic\n";
147 }
else if(l1pathname.find(
"OR")!=std::string::npos){
149 *
log_<<
" L1SeedsLogicalExpression(ORed)\t"<<l1pathname<<
"\n";
151 std::vector<std::string> seeds=
splitpathstr(l1pathname,
" OR ");
154 *
log_<<
"\tskip:contain >1 OR\n";
158 for(std::vector<std::string>::iterator
i=seeds.begin();
i!=seeds.end();++
i){
160 if(
i==seeds.begin()){
165 }
else if (l1pathname.find(
"AND")!=std::string::npos){
167 *
log_<<
" L1SeedsLogicalExpression(ANDed)\t"<< l1pathname<<
"\n";
169 std::vector<std::string> seeds=
splitpathstr(l1pathname,
" AND ");
172 *
log_<<
"\tskip:contain >1 AND\n";
176 for(std::vector<std::string>::iterator
i=seeds.begin();
179 if(
i==seeds.begin()){
186 *
log_<<
" L1SeedsLogicalExpression(ONE)\t"<< l1pathname<<
"\n";
190 *
log_<<
"\tskip:contain NOT\n";
199 *
log_<<
"================\n";
212 lumiBlock.
getByLabel(
"lumiProducer", lumiSummary);
236 std::map<std::string,hltPerPathInfo>::iterator hltit;
237 std::map<std::string,hltPerPathInfo>::iterator hltitBeg=
hltmap_.begin();
238 std::map<std::string,hltPerPathInfo>::iterator hltitEnd=
hltmap_.end();
240 typedef std::pair< std::multimap<std::string,std::string>::iterator,std::multimap<std::string,std::string>::iterator > TRGMAPIT;
242 for(hltit=hltitBeg;hltit!=hltitEnd;++hltit){
244 *
log_<<c<<
" HLT path "<<hltname<<
" , prescale : "<<hltit->second.prescale<<
"\n";
247 if(ppp.first==ppp.second){
250 for(std::multimap<std::string,std::string>::iterator mit=ppp.first; mit!=ppp.second; ++mit){
252 *
log_<<
" L1 name : "<<l1name;
272 for(
size_t i=0;
i<
n;++
i){
277 l1map_.insert(std::make_pair(l1bitname,t));
306 std::vector<MyPerLumiInfo>::const_iterator lumiIt;
307 std::vector<MyPerLumiInfo>::const_iterator lumiItBeg=
perrunlumiinfo_.begin();
308 std::vector<MyPerLumiInfo>::const_iterator lumiItEnd=
perrunlumiinfo_.end();
311 *
log_<<
"================ Run Summary "<<run.
run()<<
"================\n";
312 for(lumiIt=lumiItBeg;lumiIt!=lumiItEnd;++lumiIt){
313 recorded += lumiIt->intglumi*lumiIt->livefraction;
315 *
log_<<
" CMS Recorded Lumi (e+27cm^-2) : "<<recorded<<
"\n";
316 *
log_<<
" Effective Lumi (e+27cm^-2) per trigger path: "<<
"\n\n";
317 std::multimap<std::string,std::string>::iterator it;
318 std::multimap<std::string,std::string>::iterator itBeg=
trgpathMmap_.begin();
319 std::multimap<std::string,std::string>::iterator itEnd=
trgpathMmap_.end();
321 for(it=itBeg;it!=itEnd;++it){
322 *
log_<<
" "<<cc<<
" "<<it->first<<
" - "<<it->second<<
" : ";
324 std::map<std::string,hltPerPathInfo>::const_iterator hltIt=
hltmap_.find(it->first);
326 std::cout<<
"HLT path "<<it->first<<
" not found"<<std::endl;
330 std::map<std::string,l1PerBitInfo>::const_iterator l1It=
l1map_.find(it->second);
332 std::cout<<
"L1 bit "<<it->second<<
" not found"<<std::endl;
336 unsigned int hltprescale=hltIt->second.prescale;
337 unsigned int l1prescale=l1It->second.prescale;
338 if( hltprescale!=0 && l1prescale!=0 ){
339 float effectiveLumi=recorded/(hltprescale*l1prescale);
340 *
log_<<effectiveLumi<<
"\n";
342 *
log_<<
"0 prescale exception\n";
354 std::vector<std::string>
356 std::vector<std::string> vecstrResult;
357 boost::regex re(separator);
358 boost::sregex_token_iterator
p(strValue.begin(),strValue.end(),re,-1);
359 boost::sregex_token_iterator
end;
361 vecstrResult.push_back(*
p++);
std::map< std::string, l1PerBitInfo > l1map_
unsigned int size() const
number of trigger paths in trigger table
LuminosityBlockID id() const
T getParameter(std::string const &) const
bool getByLabel(std::string const &label, Handle< PROD > &result) const
T getUntrackedParameter(std::string const &, T const &) const
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
const std::string moduleType(const std::string &module) const
C++ class name of module.
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< std::string > splitpathstr(const std::string &strValue, const std::string separator)
L1 l1info(unsigned int idx) const
unsigned int currentlumi_
#define DEFINE_FWK_MODULE(type)
~LumiCalculator() override
const std::string & tableName() const
HLT ConfDB table name.
const edm::ParameterSet & modulePSet(const std::string &module) const
ParameterSet of module.
unsigned long long deadcount() const
std::vector< MyPerLumiInfo > perrunlumiinfo_
bool getByLabel(std::string const &label, Handle< PROD > &result) const
void endRun(edm::Run const &, edm::EventSetup const &) override
LumiCalculator(edm::ParameterSet const &pset)
def lumiSummary(schema, nlumils)
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
unsigned long long deadcount
HLTConfigProvider hltConfig_
float avgInsDelLumi() const
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
LuminosityBlockNumber_t luminosityBlock() const
size_t nTriggerLine() const
std::map< std::string, hltPerPathInfo > hltmap_
void analyze(edm::Event const &e, edm::EventSetup const &c) override
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
std::multimap< std::string, std::string > trgpathMmap_
Run const & getRun() const