1 #ifndef RecoLuminosity_LumiProducer_LumiCalculator_h 2 #define RecoLuminosity_LumiProducer_LumiCalculator_h 14 #include <boost/regex.hpp> 49 std::map<std::string, hltPerPathInfo>
hltmap_;
50 std::map<std::string, l1PerBitInfo>
l1map_;
63 consumes<LumiSummary, edm::InLumi>(
edm::InputTag(
"lumiProducer",
""));
64 consumes<LumiSummaryRunHeader, edm::InRun>(
edm::InputTag(
"lumiProducer",
""));
103 *
log_ <<
"======Trigger Configuration Overview======\n";
107 for (
unsigned int t = 0;
t < totaltrg; ++
t) {
111 *
log_ <<
t <<
" HLT path\t" << hltname <<
"\n";
116 std::vector<std::string>::iterator hltpathBeg = numpathmodules.begin();
117 std::vector<std::string>::iterator hltpathEnd = numpathmodules.end();
118 unsigned int mycounter = 0;
119 for (std::vector<std::string>::iterator numpathmodule = hltpathBeg; numpathmodule != hltpathEnd; ++numpathmodule) {
130 *
log_ <<
"\tskip and erase previous seeds : multiple L1SeedsLogicalExpressions per hlt path\n";
136 if (l1pathname.find(
'(') != std::string::npos) {
138 *
log_ <<
" L1SeedsLogicalExpression(Complex)\t" << l1pathname <<
"\n";
139 *
log_ <<
"\tskip:contain complex logic\n";
142 }
else if (l1pathname.find(
"OR") != std::string::npos) {
144 *
log_ <<
" L1SeedsLogicalExpression(ORed)\t" << l1pathname <<
"\n";
147 if (
seeds.size() > 2) {
149 *
log_ <<
"\tskip:contain >1 OR\n";
153 for (std::vector<std::string>::iterator
i =
seeds.begin();
i !=
seeds.end(); ++
i) {
155 *
log_ <<
"\t\tseed: " << *
i <<
"\n";
161 }
else if (l1pathname.find(
"AND") != std::string::npos) {
163 *
log_ <<
" L1SeedsLogicalExpression(ANDed)\t" << l1pathname <<
"\n";
166 if (
seeds.size() > 2) {
168 *
log_ <<
"\tskip:contain >1 AND\n";
172 for (std::vector<std::string>::iterator
i =
seeds.begin();
i !=
seeds.end(); ++
i) {
174 *
log_ <<
"\t\tseed: " << *
i <<
"\n";
182 *
log_ <<
" L1SeedsLogicalExpression(ONE)\t" << l1pathname <<
"\n";
186 *
log_ <<
"\tskip:contain NOT\n";
190 trgpathMmap_.insert(std::make_pair(hltname, l1pathname));
195 *
log_ <<
"================\n";
223 *
log_ <<
"\t Luminosity " <<
l.intglumi <<
"\n";
224 *
log_ <<
"\t Dead count " <<
l.deadcount <<
"\n";
225 *
log_ <<
"\t Deadtime corrected Luminosity " <<
l.intglumi *
l.livefraction <<
"\n";
231 std::map<std::string, hltPerPathInfo>::iterator hltit;
232 std::map<std::string, hltPerPathInfo>::iterator hltitBeg =
hltmap_.begin();
233 std::map<std::string, hltPerPathInfo>::iterator hltitEnd =
hltmap_.end();
235 typedef std::pair<std::multimap<std::string, std::string>::iterator,
236 std::multimap<std::string, std::string>::iterator>
239 for (hltit = hltitBeg; hltit != hltitEnd; ++hltit) {
241 *
log_ <<
c <<
" HLT path " << hltname <<
" , prescale : " << hltit->second.prescale <<
"\n";
244 if (ppp.first == ppp.second) {
247 for (std::multimap<std::string, std::string>::iterator mit = ppp.first; mit != ppp.second; ++mit) {
249 *
log_ <<
" L1 name : " << l1name;
269 for (
size_t i = 0;
i <
n; ++
i) {
274 l1map_.insert(std::make_pair(l1bitname,
t));
303 std::vector<MyPerLumiInfo>::const_iterator lumiIt;
304 std::vector<MyPerLumiInfo>::const_iterator lumiItBeg =
perrunlumiinfo_.begin();
305 std::vector<MyPerLumiInfo>::const_iterator lumiItEnd =
perrunlumiinfo_.end();
308 *
log_ <<
"================ Run Summary " <<
run.run() <<
"================\n";
309 for (lumiIt = lumiItBeg; lumiIt != lumiItEnd; ++lumiIt) {
310 recorded += lumiIt->intglumi * lumiIt->livefraction;
312 *
log_ <<
" CMS Recorded Lumi (e+27cm^-2) : " <<
recorded <<
"\n";
313 *
log_ <<
" Effective Lumi (e+27cm^-2) per trigger path: " 315 std::multimap<std::string, std::string>::iterator it;
316 std::multimap<std::string, std::string>::iterator itBeg =
trgpathMmap_.begin();
317 std::multimap<std::string, std::string>::iterator itEnd =
trgpathMmap_.end();
319 for (it = itBeg; it != itEnd; ++it) {
320 *
log_ <<
" " << cc <<
" " << it->first <<
" - " << it->second <<
" : ";
322 std::map<std::string, hltPerPathInfo>::const_iterator hltIt =
hltmap_.find(it->first);
324 std::cout <<
"HLT path " << it->first <<
" not found" << std::endl;
328 std::map<std::string, l1PerBitInfo>::const_iterator l1It =
l1map_.find(it->second);
329 if (l1It ==
l1map_.end()) {
330 std::cout <<
"L1 bit " << it->second <<
" not found" << std::endl;
334 unsigned int hltprescale = hltIt->second.prescale;
335 unsigned int l1prescale = l1It->second.prescale;
336 if (hltprescale != 0 && l1prescale != 0) {
337 float effectiveLumi =
recorded / (hltprescale * l1prescale);
338 *
log_ << effectiveLumi <<
"\n";
340 *
log_ <<
"0 prescale exception\n";
351 std::vector<std::string> vecstrResult;
353 boost::sregex_token_iterator
p(strValue.begin(), strValue.end(), re, -1);
354 boost::sregex_token_iterator
end;
356 vecstrResult.push_back(*
p++);
const std::string & triggerName(unsigned int triggerIndex) const
LuminosityBlockNumber_t luminosityBlock() const
T getParameter(std::string const &) const
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
std::vector< std::string > splitpathstr(const std::string &strValue, const std::string separator)
unsigned int currentlumi_
Run const & getRun() const
#define DEFINE_FWK_MODULE(type)
~LumiCalculator() override
const std::string moduleType(const std::string &module) const
C++ class name of module.
std::vector< MyPerLumiInfo > perrunlumiinfo_
std::map< std::string, l1PerBitInfo > l1map_
unsigned int size() const
number of trigger paths in trigger table
void endRun(edm::Run const &, edm::EventSetup const &) override
const edm::ParameterSet & modulePSet(const std::string &module) const
ParameterSet of module.
LumiCalculator(edm::ParameterSet const &pset)
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
bool getByLabel(std::string const &label, Handle< PROD > &result) const
unsigned long long deadcount
HLTConfigProvider hltConfig_
Log< level::Info, false > LogInfo
bool getByLabel(std::string const &label, Handle< PROD > &result) const
LuminosityBlockID id() const
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::multimap< std::string, std::string > trgpathMmap_
const std::string & tableName() const
HLT ConfDB table name.
std::map< std::string, hltPerPathInfo > hltmap_
void analyze(edm::Event const &e, edm::EventSetup const &c) override