1 #ifndef RecoLuminosity_LumiProducer_LumiCalculator_h 2 #define RecoLuminosity_LumiProducer_LumiCalculator_h 14 #include <boost/regex.hpp> 50 std::map<std::string, hltPerPathInfo>
hltmap_;
51 std::map<std::string, l1PerBitInfo>
l1map_;
64 consumes<LumiSummary, edm::InLumi>(
edm::InputTag(
"lumiProducer",
""));
65 consumes<LumiSummaryRunHeader, edm::InRun>(
edm::InputTag(
"lumiProducer",
""));
104 *
log_ <<
"======Trigger Configuration Overview======\n";
108 for (
unsigned int t = 0;
t < totaltrg; ++
t) {
112 *
log_ <<
t <<
" HLT path\t" << hltname <<
"\n";
117 std::vector<std::string>::iterator hltpathBeg = numpathmodules.begin();
118 std::vector<std::string>::iterator hltpathEnd = numpathmodules.end();
119 unsigned int mycounter = 0;
120 for (std::vector<std::string>::iterator numpathmodule = hltpathBeg; numpathmodule != hltpathEnd; ++numpathmodule) {
131 *
log_ <<
"\tskip and erase previous seeds : multiple L1SeedsLogicalExpressions per hlt path\n";
137 if (l1pathname.find(
'(') != std::string::npos) {
139 *
log_ <<
" L1SeedsLogicalExpression(Complex)\t" << l1pathname <<
"\n";
140 *
log_ <<
"\tskip:contain complex logic\n";
143 }
else if (l1pathname.find(
"OR") != std::string::npos) {
145 *
log_ <<
" L1SeedsLogicalExpression(ORed)\t" << l1pathname <<
"\n";
148 if (
seeds.size() > 2) {
150 *
log_ <<
"\tskip:contain >1 OR\n";
154 for (std::vector<std::string>::iterator
i =
seeds.begin();
i !=
seeds.end(); ++
i) {
156 *
log_ <<
"\t\tseed: " << *
i <<
"\n";
162 }
else if (l1pathname.find(
"AND") != std::string::npos) {
164 *
log_ <<
" L1SeedsLogicalExpression(ANDed)\t" << l1pathname <<
"\n";
167 if (
seeds.size() > 2) {
169 *
log_ <<
"\tskip:contain >1 AND\n";
173 for (std::vector<std::string>::iterator
i =
seeds.begin();
i !=
seeds.end(); ++
i) {
175 *
log_ <<
"\t\tseed: " << *
i <<
"\n";
183 *
log_ <<
" L1SeedsLogicalExpression(ONE)\t" << l1pathname <<
"\n";
187 *
log_ <<
"\tskip:contain NOT\n";
191 trgpathMmap_.insert(std::make_pair(hltname, l1pathname));
196 *
log_ <<
"================\n";
224 *
log_ <<
"\t Luminosity " <<
l.intglumi <<
"\n";
225 *
log_ <<
"\t Dead count " <<
l.deadcount <<
"\n";
226 *
log_ <<
"\t Deadtime corrected Luminosity " <<
l.intglumi *
l.livefraction <<
"\n";
232 std::map<std::string, hltPerPathInfo>::iterator hltit;
233 std::map<std::string, hltPerPathInfo>::iterator hltitBeg =
hltmap_.begin();
234 std::map<std::string, hltPerPathInfo>::iterator hltitEnd =
hltmap_.end();
236 typedef std::pair<std::multimap<std::string, std::string>::iterator,
237 std::multimap<std::string, std::string>::iterator>
240 for (hltit = hltitBeg; hltit != hltitEnd; ++hltit) {
242 *
log_ <<
c <<
" HLT path " << hltname <<
" , prescale : " << hltit->second.prescale <<
"\n";
245 if (ppp.first == ppp.second) {
248 for (std::multimap<std::string, std::string>::iterator mit = ppp.first; mit != ppp.second; ++mit) {
250 *
log_ <<
" L1 name : " << l1name;
270 for (
size_t i = 0;
i <
n; ++
i) {
275 l1map_.insert(std::make_pair(l1bitname,
t));
304 std::vector<MyPerLumiInfo>::const_iterator lumiIt;
305 std::vector<MyPerLumiInfo>::const_iterator lumiItBeg =
perrunlumiinfo_.begin();
306 std::vector<MyPerLumiInfo>::const_iterator lumiItEnd =
perrunlumiinfo_.end();
309 *
log_ <<
"================ Run Summary " <<
run.run() <<
"================\n";
310 for (lumiIt = lumiItBeg; lumiIt != lumiItEnd; ++lumiIt) {
311 recorded += lumiIt->intglumi * lumiIt->livefraction;
313 *
log_ <<
" CMS Recorded Lumi (e+27cm^-2) : " <<
recorded <<
"\n";
314 *
log_ <<
" Effective Lumi (e+27cm^-2) per trigger path: " 316 std::multimap<std::string, std::string>::iterator
it;
317 std::multimap<std::string, std::string>::iterator itBeg =
trgpathMmap_.begin();
318 std::multimap<std::string, std::string>::iterator itEnd =
trgpathMmap_.end();
320 for (
it = itBeg;
it != itEnd; ++
it) {
321 *
log_ <<
" " <<
cc <<
" " <<
it->first <<
" - " <<
it->second <<
" : ";
323 std::map<std::string, hltPerPathInfo>::const_iterator hltIt =
hltmap_.find(
it->first);
325 std::cout <<
"HLT path " <<
it->first <<
" not found" << std::endl;
329 std::map<std::string, l1PerBitInfo>::const_iterator l1It =
l1map_.find(
it->second);
330 if (l1It ==
l1map_.end()) {
331 std::cout <<
"L1 bit " <<
it->second <<
" not found" << std::endl;
335 unsigned int hltprescale = hltIt->second.prescale;
336 unsigned int l1prescale = l1It->second.prescale;
337 if (hltprescale != 0 && l1prescale != 0) {
338 float effectiveLumi =
recorded / (hltprescale * l1prescale);
339 *
log_ << effectiveLumi <<
"\n";
341 *
log_ <<
"0 prescale exception\n";
352 std::vector<std::string> vecstrResult;
354 boost::sregex_token_iterator
p(strValue.begin(), strValue.end(), re, -1);
355 boost::sregex_token_iterator
end;
357 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
uint32_t cc[maxCellsPerHit]
~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
#define DEFINE_FWK_MODULE(type)
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
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override