22 m_l1GtUtils(ps, consumesCollector(),
false, *this) {
53 cout <<
"[L1TRate_Offline:] ____________ Storage initialization ____________ " << endl;
54 cout <<
"[L1TRate_Offline:] Setting up dbe folder: L1T/L1TRate" << endl;
66 cout <<
"[L1TRate_Offline:] Called beginRun." << endl;
93 for (
const auto&
algo :
menu.gtAlgorithmMap()) {
102 TString tCategory = (*i).first;
103 TString tTrigger = (*i).second;
105 TString tErrorMessage =
"";
110 }
else if (tTrigger ==
"Undefined") {
111 TString tFunc =
"-1";
112 tTestFunction =
new TF1(
"FitParametrization_" + tTrigger, tFunc, 0,
double(
m_maxNbins) - 0.5);
114 TString tFunc =
"-1";
115 tTestFunction =
new TF1(
"FitParametrization_" + tTrigger, tFunc, 0,
double(
m_maxNbins) - 0.5);
116 tErrorMessage =
" (Undefined Test Function)";
118 TString tFunc =
"-1";
119 tTestFunction =
new TF1(
"FitParametrization_" + tTrigger, tFunc, 0,
double(
m_maxNbins) - 0.5);
122 if (tTrigger !=
"Undefined") {
124 tErrorMessage +=
" WARNING: Default Prescale = ";
128 if (tCategory ==
"Mu" &&
130 tErrorMessage +=
" WARNING: Eta Range = ";
132 }
else if (tCategory ==
"EG" && myMenuHelper.
getEtaRangeByAlias(tCategory, tTrigger) != 32639) {
133 tErrorMessage +=
" WARNING: Eta Range = ";
135 }
else if (tCategory ==
"IsoEG" && myMenuHelper.
getEtaRangeByAlias(tCategory, tTrigger) != 32639) {
136 tErrorMessage +=
" WARNING: Eta Range = ";
140 if (tCategory ==
"Mu" && myMenuHelper.
getQualityAlias(tCategory, tTrigger) != 240) {
141 tErrorMessage +=
" WARNING: Quality = ";
148 "Cross Sec. vs Deliv. Lumi: " + tTrigger + tErrorMessage,
159 "Cross Sec. vs Recor. Lumi: " + tTrigger + tErrorMessage,
170 "Cross Sec. vs Inst. Lumi Algo: " + tTrigger + tErrorMessage,
176 m_CountsVsLS[tTrigger]->setAxisTitle(
"Instantaneous Luminosity [10^{30}cm^{-2}s^{-1}]", 1);
177 m_CountsVsLS[tTrigger]->setAxisTitle(
"Algorithm #sigma [#mu b]", 2);
178 m_CountsVsLS[tTrigger]->getTProfile()->GetListOfFunctions()->Add(tTestFunction);
179 m_CountsVsLS[tTrigger]->getTProfile()->SetMarkerStyle(23);
181 m_algoFit[tTrigger] = (TF1*)tTestFunction->Clone(
"Fit_" + tTrigger);
212 cout <<
"[L1TRate_Offline:] Called beginLuminosityBlock at LS=" << lumiBlock.
id().
luminosityBlock() << endl;
220 cout <<
"[L1TRate_Offline:] Called endLuminosityBlock at LS=" << eventLS << endl;
231 bool isDefLumi, isDefPrescaleIndex;
235 unsigned int prescalesIndex = 0;
238 map<TString, double>*
counts =
nullptr;
242 string tTrigger = (*i).second;
257 unsigned int lsOffline = (*j).first;
261 unsigned int lsPreInd;
271 lsPreInd = lsOffline + 1;
274 isDefPrescaleIndex =
false;
276 isDefPrescaleIndex =
true;
280 if (isDefCount && isDefLumi && isDefPrescaleIndex && (prescalesIndex < m_listsPrescaleFactors->
size())) {
281 const vector<int>& currentPrescaleFactors = (*m_listsPrescaleFactors).at(prescalesIndex);
284 string tTrigger = (*j).second;
285 double trigCount = (*counts)[tTrigger];
288 TF1* tTestFunction =
m_algoFit[tTrigger];
291 if (tTrigger !=
"Undefined") {
292 unsigned int trigBit =
m_algoBit[tTrigger];
293 double trigPrescale = currentPrescaleFactors[trigBit];
295 if (
lumi != 0 && trigCount != 0 && trigPrescale != 0) {
296 double RecLumi =
lumi * (1. - deadtime / 100.);
298 double AlgoXSec = (trigPrescale * trigCount) / RecLumi;
299 double TemplateFunctionValue = tTestFunction->Eval(
lumi);
348 int EventRun =
iEvent.id().run();
349 unsigned int eventLS =
iEvent.id().luminosityBlock();
352 if (triggerScalers.
isValid() && !triggerScalers->empty()) {
353 Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
362 const std::vector<unsigned int> gtAlgoCounts = itL1TScalers->gtAlgoCounts();
373 map<TString, double> bufferCount;
377 string tTrigger = (*i).second;
380 if (tTrigger !=
"Undefined") {
381 unsigned int trigBit =
m_algoBit[tTrigger];
382 double trigCount = gtAlgoCounts[trigBit];
384 bufferCount[tTrigger] = trigCount;
393 if (colLScal.
isValid() && !colLScal->empty()) {
394 LumiScalersCollection::const_iterator itLScal = colLScal->begin();
395 unsigned int scalLS = itLScal->sectionNumber();
400 cout <<
"[L1TRate_Offline:] Buffering SCAL-HF Lumi for LS=" << scalLS << endl;
403 itLScal->instantLumi();
404 double deadTimeNormHF = itLScal->deadTimeNormalization();
425 if (deadTimeNormHF == 0) {
437 if (gtReadoutRecordData.
isValid()) {
441 cout <<
"[L1TRate_Offline:] Buffering Prescale Index for LS=" << eventLS << endl;
445 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->
gtFdlVector();
449 for (
unsigned int i = 0;
i < gtFdlVectorData.size();
i++) {
450 if (gtFdlVectorData[
i].bxInEvent() == 0) {
456 if (!gtFdlVectorData.empty()) {
457 int CurrentPrescalesIndex =
458 gtFdlVectorData[indexFDL].gtPrescaleFactorIndexAlgo();
479 std::vector<edm::ParameterSet> m_fitParameters = ps.
getParameter<vector<ParameterSet> >(
"fitParameters");
486 string tTrigger = (*a).second;
489 if (tTrigger !=
"Undefined") {
490 bool foundFit =
false;
492 for (
unsigned int b = 0;
b < m_fitParameters.size();
b++) {
493 if (tTrigger == m_fitParameters[
b].getParameter<string>(
"AlgoName")) {
494 TString tAlgoName = m_fitParameters[
b].getParameter<
string>(
"AlgoName");
495 TString tTemplateFunction = m_fitParameters[
b].getParameter<
string>(
"TemplateFunction");
496 vector<double> tParameters = m_fitParameters[
b].getParameter<vector<double> >(
"Parameters");