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_;
103 *
log_<<
"======Trigger Configuration Overview======\n";
107 for (
unsigned int t=0;
t<totaltrg;++
t){
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;
120 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";
147 std::vector<std::string> seeds=
splitpathstr(l1pathname,
" OR ");
150 *
log_<<
"\tskip:contain >1 OR\n";
154 for(std::vector<std::string>::iterator
i=seeds.begin();
i!=seeds.end();++
i){
156 if(
i==seeds.begin()){
161 }
else if (l1pathname.find(
"AND")!=std::string::npos){
163 *
log_<<
" L1SeedsLogicalExpression(ANDed)\t"<< l1pathname<<
"\n";
165 std::vector<std::string> seeds=
splitpathstr(l1pathname,
" AND ");
168 *
log_<<
"\tskip:contain >1 AND\n";
172 for(std::vector<std::string>::iterator
i=seeds.begin();
175 if(
i==seeds.begin()){
182 *
log_<<
" L1SeedsLogicalExpression(ONE)\t"<< l1pathname<<
"\n";
186 *
log_<<
"\tskip:contain NOT\n";
195 *
log_<<
"================\n";
208 lumiBlock.
getByLabel(
"lumiProducer", lumiSummary);
220 l.
intglumi=lumiSummary->avgInsDelLumi()*93.244;
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,std::multimap<std::string,std::string>::iterator > TRGMAPIT;
238 for(hltit=hltitBeg;hltit!=hltitEnd;++hltit){
240 *
log_<<c<<
" HLT path "<<hltname<<
" , prescale : "<<hltit->second.prescale<<
"\n";
243 if(ppp.first==ppp.second){
246 for(std::multimap<std::string,std::string>::iterator mit=ppp.first; mit!=ppp.second; ++mit){
248 *
log_<<
" L1 name : "<<l1name;
249 LumiSummary::L1 l1result = lumiSummary->l1info(lumiSummaryRH->getL1Index(l1name));
267 size_t n=lumiSummary->nTriggerLine();
268 for(
size_t i=0;
i<
n;++
i){
269 std::string l1bitname = lumiSummaryRH->getL1Name(lumiSummary->l1info(
i).triggernameidx);
272 t.
prescale=lumiSummary->l1info(
i).prescale;
273 l1map_.insert(std::make_pair(l1bitname,t));
302 std::vector<MyPerLumiInfo>::const_iterator lumiIt;
303 std::vector<MyPerLumiInfo>::const_iterator lumiItBeg=
perrunlumiinfo_.begin();
304 std::vector<MyPerLumiInfo>::const_iterator lumiItEnd=
perrunlumiinfo_.end();
307 *
log_<<
"================ Run Summary "<<run.
run()<<
"================\n";
308 for(lumiIt=lumiItBeg;lumiIt!=lumiItEnd;++lumiIt){
309 recorded += lumiIt->intglumi*lumiIt->livefraction;
311 *
log_<<
" CMS Recorded Lumi (e+27cm^-2) : "<<recorded<<
"\n";
312 *
log_<<
" Effective Lumi (e+27cm^-2) per trigger path: "<<
"\n\n";
313 std::multimap<std::string,std::string>::iterator it;
314 std::multimap<std::string,std::string>::iterator itBeg=
trgpathMmap_.begin();
315 std::multimap<std::string,std::string>::iterator itEnd=
trgpathMmap_.end();
317 for(it=itBeg;it!=itEnd;++it){
318 *
log_<<
" "<<cc<<
" "<<it->first<<
" - "<<it->second<<
" : ";
320 std::map<std::string,hltPerPathInfo>::const_iterator hltIt=
hltmap_.find(it->first);
322 std::cout<<
"HLT path "<<it->first<<
" not found"<<std::endl;
326 std::map<std::string,l1PerBitInfo>::const_iterator l1It=
l1map_.find(it->second);
328 std::cout<<
"L1 bit "<<it->second<<
" not found"<<std::endl;
332 unsigned int hltprescale=hltIt->second.prescale;
333 unsigned int l1prescale=l1It->second.prescale;
334 if( hltprescale!=0 && l1prescale!=0 ){
335 float effectiveLumi=recorded/(hltprescale*l1prescale);
336 *
log_<<effectiveLumi<<
"\n";
338 *
log_<<
"0 prescale exception\n";
350 std::vector<std::string>
352 std::vector<std::string> vecstrResult;
353 boost::regex re(separator);
354 boost::sregex_token_iterator
p(strValue.begin(),strValue.end(),re,-1);
355 boost::sregex_token_iterator
end;
357 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
const std::string moduleType(const std::string &module) const
C++ class name of module.
const std::string & triggerName(unsigned int triggerIndex) const
virtual void endRun(edm::Run const &, edm::EventSetup const &)
std::vector< std::string > splitpathstr(const std::string &strValue, const std::string separator)
unsigned int currentlumi_
#define DEFINE_FWK_MODULE(type)
const std::string & tableName() const
HLT ConfDB table name.
const edm::ParameterSet & modulePSet(const std::string &module) const
ParameterSet of module.
std::vector< MyPerLumiInfo > perrunlumiinfo_
bool getByLabel(std::string const &label, Handle< PROD > &result) const
virtual void analyze(edm::Event const &e, edm::EventSetup const &c)
virtual ~LumiCalculator()
LumiCalculator(edm::ParameterSet const &pset)
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
unsigned long long deadcount
HLTConfigProvider hltConfig_
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
std::map< std::string, hltPerPathInfo > hltmap_
tuple size
Write out results.
virtual void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
std::multimap< std::string, std::string > trgpathMmap_
Run const & getRun() const