22 m_l1GtUtils(ps, consumesCollector(),
false, *this) {
39 m_inputCategories[
"IsoEG"] = Categories.getUntrackedParameter<
bool>(
"IsoEG");
40 m_inputCategories[
"Jet"] = Categories.getUntrackedParameter<
bool>(
"Jet");
41 m_inputCategories[
"CenJet"] = Categories.getUntrackedParameter<
bool>(
"CenJet");
42 m_inputCategories[
"ForJet"] = Categories.getUntrackedParameter<
bool>(
"ForJet");
43 m_inputCategories[
"TauJet"] = Categories.getUntrackedParameter<
bool>(
"TauJet");
44 m_inputCategories[
"ETM"] = Categories.getUntrackedParameter<
bool>(
"ETM");
45 m_inputCategories[
"ETT"] = Categories.getUntrackedParameter<
bool>(
"ETT");
46 m_inputCategories[
"HTT"] = Categories.getUntrackedParameter<
bool>(
"HTT");
47 m_inputCategories[
"HTM"] = Categories.getUntrackedParameter<
bool>(
"HTM");
51 cout <<
"[L1TRate_Offline:] ____________ Storage initialization ____________ " << endl;
52 cout <<
"[L1TRate_Offline:] Setting up dbe folder: L1T/L1TRate" << endl;
64 if (
m_verbose) {
cout <<
"[L1TRate_Offline:] Called beginRun." << endl;}
104 TString tCategory = (*i).first;
105 TString tTrigger = (*i).second;
107 TString tErrorMessage =
"";
113 else if(tTrigger ==
"Undefined"){
114 TString tFunc =
"-1";
115 tTestFunction =
new TF1(
"FitParametrization_"+tTrigger,tFunc,0,
double(
m_maxNbins)-0.5);
118 TString tFunc =
"-1";
119 tTestFunction =
new TF1(
"FitParametrization_"+tTrigger,tFunc,0,
double(
m_maxNbins)-0.5);
120 tErrorMessage =
" (Undefined Test Function)";
123 TString tFunc =
"-1";
124 tTestFunction =
new TF1(
"FitParametrization_"+tTrigger,tFunc,0,
double(
m_maxNbins)-0.5);
127 if(tTrigger !=
"Undefined"){
130 tErrorMessage +=
" WARNING: Default Prescale = ";
134 if (tCategory ==
"Mu" && myMenuHelper.
getEtaRangeByAlias(tCategory,tTrigger) != 4294967295){
135 tErrorMessage +=
" WARNING: Eta Range = ";
138 else if(tCategory ==
"EG" && myMenuHelper.
getEtaRangeByAlias(tCategory,tTrigger) != 32639){
139 tErrorMessage +=
" WARNING: Eta Range = ";
142 else if(tCategory ==
"IsoEG" && myMenuHelper.
getEtaRangeByAlias(tCategory,tTrigger) != 32639){
143 tErrorMessage +=
" WARNING: Eta Range = ";
147 if(tCategory ==
"Mu" && myMenuHelper.
getQualityAlias(tCategory,tTrigger) != 240){
148 tErrorMessage +=
" WARNING: Quality = ";
156 "Cross Sec. vs Deliv. Lumi: "+tTrigger+tErrorMessage,
158 minInstantLuminosity,
159 maxInstantLuminosity,0,500);
165 "Cross Sec. vs Recor. Lumi: "+tTrigger+tErrorMessage,
167 minInstantLuminosity,
168 maxInstantLuminosity,0,500);
174 "Cross Sec. vs Inst. Lumi Algo: "+tTrigger+tErrorMessage,
176 minInstantLuminosity,
177 maxInstantLuminosity,0,500);
178 m_CountsVsLS[tTrigger] ->setAxisTitle(
"Instantaneous Luminosity [10^{30}cm^{-2}s^{-1}]" ,1);
179 m_CountsVsLS[tTrigger] ->setAxisTitle(
"Algorithm #sigma [#mu b]" ,2);
180 m_CountsVsLS[tTrigger] ->getTProfile()->GetListOfFunctions()->Add(tTestFunction);
181 m_CountsVsLS[tTrigger] ->getTProfile()->SetMarkerStyle(23);
183 m_algoFit[tTrigger] = (TF1*) tTestFunction->Clone(
"Fit_"+tTrigger);
223 if (
m_verbose) {
cout <<
"[L1TRate_Offline:] Called endLuminosityBlock at LS=" << eventLS << endl;}
233 bool isDefLumi,isDefPrescaleIndex;
237 unsigned int prescalesIndex=0;
240 map<TString,double>* counts=0;
244 string tTrigger = (*i).second;
261 unsigned int lsOffline = (*j).first;
262 counts = &(*j).second;
265 unsigned int lsPreInd;
274 lsPreInd = lsOffline + 1;
278 isDefPrescaleIndex=
true;
282 if(isDefCount && isDefLumi && isDefPrescaleIndex && (prescalesIndex < m_listsPrescaleFactors->
size())){
284 const vector<int>& currentPrescaleFactors = (*m_listsPrescaleFactors).at(prescalesIndex);
288 string tTrigger = (*j).second;
289 double trigCount = (*counts)[tTrigger];
292 TF1* tTestFunction =
m_algoFit[tTrigger];
296 if(tTrigger !=
"Undefined"){
298 unsigned int trigBit =
m_algoBit[tTrigger];
299 double trigPrescale = currentPrescaleFactors[trigBit];
301 if(lumi!=0 && trigCount!=0 && trigPrescale!=0){
303 double RecLumi = lumi*(1. - deadtime/100.);
305 double AlgoXSec = (trigPrescale*trigCount)/RecLumi;
306 double TemplateFunctionValue = tTestFunction->Eval(lumi);
360 int EventRun = iEvent.
id().
run();
364 if(triggerScalers.
isValid() && triggerScalers->size()){
366 Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
375 const std::vector<unsigned int> gtAlgoCounts = itL1TScalers->gtAlgoCounts();
387 map<TString,double> bufferCount;
392 string tTrigger = (*i).second;
395 if(tTrigger !=
"Undefined"){
397 unsigned int trigBit =
m_algoBit[tTrigger];
398 double trigCount = gtAlgoCounts[trigBit];
400 bufferCount[tTrigger] = trigCount;
411 if(colLScal.
isValid() && colLScal->size()){
413 LumiScalersCollection::const_iterator itLScal = colLScal->begin();
414 unsigned int scalLS = itLScal->sectionNumber();
419 if (
m_verbose) {
cout <<
"[L1TRate_Offline:] Buffering SCAL-HF Lumi for LS=" << scalLS << endl;}
420 double instLumi = itLScal->instantLumi();
421 double deadTimeNormHF = itLScal->deadTimeNormalization();
444 if(deadTimeNormHF==0){instLumi = 0;}
445 else {instLumi = instLumi/deadTimeNormHF;}
453 if(gtReadoutRecordData.
isValid()){
458 if (
m_verbose) {
cout <<
"[L1TRate_Offline:] Buffering Prescale Index for LS=" << eventLS << endl;}
461 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
465 for(
unsigned int i=0;
i<gtFdlVectorData.size();
i++){
466 if(gtFdlVectorData[
i].bxInEvent()==0){indexFDL=
i;
break;}
469 if(gtFdlVectorData.size() != 0)
471 int CurrentPrescalesIndex = gtFdlVectorData[indexFDL].gtPrescaleFactorIndexAlgo();
495 std::vector<edm::ParameterSet> m_fitParameters = ps.
getParameter< vector<ParameterSet> >(
"fitParameters");
503 string tTrigger = (*a).second;
506 if(tTrigger !=
"Undefined"){
508 bool foundFit =
false;
510 for(
unsigned int b=0 ;
b<m_fitParameters.size() ;
b++){
512 if(tTrigger == m_fitParameters[
b].getParameter<string>(
"AlgoName")){
514 TString tAlgoName = m_fitParameters[
b].getParameter<
string > (
"AlgoName");
515 TString tTemplateFunction = m_fitParameters[
b].getParameter<
string > (
"TemplateFunction");
516 vector<double> tParameters = m_fitParameters[
b].getParameter< vector<double> >(
"Parameters");
520 minInstantLuminosity,maxInstantLuminosity);
521 m_templateFunctions[tTrigger] ->SetParameters(&tParameters[0]);
522 m_templateFunctions[tTrigger] ->SetLineWidth(1);
523 m_templateFunctions[tTrigger] ->SetLineColor(kRed);
LuminosityBlockID id() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource_L1TSCollection
MonitorElement * m_ErrorMonitor
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< std::string, std::string > m_selectedTriggers
#define DEFINE_FWK_MODULE(type)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::map< TString, MonitorElement * > m_RecorLumiVsLS
std::map< TString, TF1 * > m_templateFunctions
LuminosityBlockNumber_t luminosityBlock() const
bool getXSexFitsPython(const edm::ParameterSet &ps)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
virtual void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
std::map< int, double > m_lsLuminosity
edm::ParameterSet m_parameters
virtual ~L1TRate_Offline()
L1TRate_Offline(const edm::ParameterSet &ps)
MonitorElement * book1D(Args &&...args)
std::map< TString, MonitorElement * > m_xSecObservedVsDelivLumi
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
std::map< TString, MonitorElement * > m_xSecObservedVsLS
std::map< TString, MonitorElement * > m_xSecObservedToExpected
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void setCurrentFolder(const std::string &fullpath)
std::map< int, int > m_lsPrescaleIndex
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
std::map< std::string, bool > m_inputCategories
T const * product() const
LuminosityBlockNumber_t luminosityBlock() const
std::map< int, double > m_lsDeadTime
double deadtimePercent() const
std::map< TString, MonitorElement * > m_CountsVsLS
virtual void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
const std::vector< std::vector< int > > * m_listsPrescaleFactors
edm::EDGetTokenT< LumiScalersCollection > m_scalersSource_LSCollection
std::map< int, std::map< TString, double > > m_lsRates
std::map< TString, int > m_algoBit
volatile std::atomic< bool > shutdown_flag false
std::map< TString, MonitorElement * > m_DelivLumiVsLS
std::map< TString, MonitorElement * > m_xSecObservedVsRecorLumi
tuple size
Write out results.
std::map< TString, TF1 * > m_algoFit