50 cout <<
"[L1TRate_Offline:] ____________ Storage initialization ____________ " << endl;
51 cout <<
"[L1TRate_Offline:] Setting up dbe folder: L1T/L1TRate" << endl;
63 cout <<
"[L1TRate_Offline:] Called beginRun." << endl;
76 ibooker.setCurrentFolder(
"L1T/L1TRate");
77 m_ErrorMonitor = ibooker.book1D(
"ErrorMonitor",
"ErrorMonitor", 2, 0, 2);
105 TString tCategory = (*i).first;
106 TString tTrigger = (*i).second;
108 TString tErrorMessage =
"";
113 }
else if (tTrigger ==
"Undefined") {
114 TString tFunc =
"-1";
115 tTestFunction =
new TF1(
"FitParametrization_" + tTrigger, tFunc, 0,
double(
m_maxNbins) - 0.5);
117 TString tFunc =
"-1";
118 tTestFunction =
new TF1(
"FitParametrization_" + tTrigger, tFunc, 0,
double(
m_maxNbins) - 0.5);
119 tErrorMessage =
" (Undefined Test Function)";
121 TString tFunc =
"-1";
122 tTestFunction =
new TF1(
"FitParametrization_" + tTrigger, tFunc, 0,
double(
m_maxNbins) - 0.5);
125 if (tTrigger !=
"Undefined") {
127 tErrorMessage +=
" WARNING: Default Prescale = ";
131 if (tCategory ==
"Mu" &&
133 tErrorMessage +=
" WARNING: Eta Range = ";
135 }
else if (tCategory ==
"EG" && myMenuHelper.
getEtaRangeByAlias(tCategory, tTrigger) != 32639) {
136 tErrorMessage +=
" WARNING: Eta Range = ";
138 }
else if (tCategory ==
"IsoEG" && myMenuHelper.
getEtaRangeByAlias(tCategory, tTrigger) != 32639) {
139 tErrorMessage +=
" WARNING: Eta Range = ";
143 if (tCategory ==
"Mu" && myMenuHelper.
getQualityAlias(tCategory, tTrigger) != 240) {
144 tErrorMessage +=
" WARNING: Quality = ";
149 ibooker.setCurrentFolder(
"L1T/L1TRate/xSecDelivLumi");
151 "Cross Sec. vs Deliv. Lumi: " + tTrigger + tErrorMessage,
160 ibooker.setCurrentFolder(
"L1T/L1TRate/xSecRecorLumi");
162 "Cross Sec. vs Recor. Lumi: " + tTrigger + tErrorMessage,
171 ibooker.setCurrentFolder(
"L1T/L1TRate/TriggerCounts");
173 "Cross Sec. vs Inst. Lumi Algo: " + tTrigger + tErrorMessage,
179 m_CountsVsLS[tTrigger]->setAxisTitle(
"Instantaneous Luminosity [10^{30}cm^{-2}s^{-1}]", 1);
180 m_CountsVsLS[tTrigger]->setAxisTitle(
"Algorithm #sigma [#mu b]", 2);
181 m_CountsVsLS[tTrigger]->getTProfile()->GetListOfFunctions()->Add(tTestFunction);
182 m_CountsVsLS[tTrigger]->getTProfile()->SetMarkerStyle(23);
184 m_algoFit[tTrigger] = (
TF1*)tTestFunction->Clone(
"Fit_" + tTrigger);
186 ibooker.setCurrentFolder(
"L1T/L1TRate/xSecObs");
188 ibooker.book1D(tCategory,
"Algo: " + tTrigger + tErrorMessage,
m_maxNbins, -0.5,
double(
m_maxNbins) - 0.5);
192 ibooker.setCurrentFolder(
"L1T/L1TRate/Delivered");
194 ibooker.book1D(tCategory,
"Algo: " + tTrigger + tErrorMessage,
m_maxNbins, -0.5,
double(
m_maxNbins) - 0.5);
198 ibooker.setCurrentFolder(
"L1T/L1TRate/Recorded");
200 ibooker.book1D(tCategory,
"Algo: " + tTrigger + tErrorMessage,
m_maxNbins, -0.5,
double(
m_maxNbins) - 0.5);
204 ibooker.setCurrentFolder(
"L1T/L1TRate/Ratio");
206 ibooker.book1D(tCategory,
"Algo: " + tTrigger + tErrorMessage,
m_maxNbins, -0.5,
double(
m_maxNbins) - 0.5);
215 cout <<
"[L1TRate_Offline:] Called beginLuminosityBlock at LS=" << lumiBlock.
id().
luminosityBlock() << endl;
223 cout <<
"[L1TRate_Offline:] Called endLuminosityBlock at LS=" << eventLS << endl;
234 bool isDefLumi, isDefPrescaleIndex;
238 unsigned int prescalesIndex = 0;
241 map<TString, double>*
counts =
nullptr;
245 string tTrigger = (*i).second;
260 unsigned int lsOffline = (*j).first;
264 unsigned int lsPreInd;
274 lsPreInd = lsOffline + 1;
277 isDefPrescaleIndex =
false;
279 isDefPrescaleIndex =
true;
283 if (isDefCount && isDefLumi && isDefPrescaleIndex && (prescalesIndex < m_listsPrescaleFactors->
size())) {
284 const vector<int>& currentPrescaleFactors = (*m_listsPrescaleFactors).at(prescalesIndex);
287 string tTrigger = (*j).second;
288 double trigCount = (*counts)[tTrigger];
294 if (tTrigger !=
"Undefined") {
295 unsigned int trigBit =
m_algoBit[tTrigger];
296 double trigPrescale = currentPrescaleFactors[trigBit];
298 if (
lumi != 0 && trigCount != 0 && trigPrescale != 0) {
299 double RecLumi =
lumi * (1. - deadtime / 100.);
301 double AlgoXSec = (trigPrescale * trigCount) / RecLumi;
302 double TemplateFunctionValue = tTestFunction->Eval(
lumi);
351 int EventRun =
iEvent.id().run();
352 unsigned int eventLS =
iEvent.id().luminosityBlock();
355 if (triggerScalers.
isValid() && !triggerScalers->empty()) {
356 Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
365 const std::vector<unsigned int> gtAlgoCounts = itL1TScalers->gtAlgoCounts();
376 map<TString, double> bufferCount;
380 string tTrigger = (*i).second;
383 if (tTrigger !=
"Undefined") {
384 unsigned int trigBit =
m_algoBit[tTrigger];
385 double trigCount = gtAlgoCounts[trigBit];
387 bufferCount[tTrigger] = trigCount;
396 if (colLScal.
isValid() && !colLScal->empty()) {
397 LumiScalersCollection::const_iterator itLScal = colLScal->begin();
398 unsigned int scalLS = itLScal->sectionNumber();
403 cout <<
"[L1TRate_Offline:] Buffering SCAL-HF Lumi for LS=" << scalLS << endl;
406 itLScal->instantLumi();
407 double deadTimeNormHF = itLScal->deadTimeNormalization();
428 if (deadTimeNormHF == 0) {
440 if (gtReadoutRecordData.
isValid()) {
444 cout <<
"[L1TRate_Offline:] Buffering Prescale Index for LS=" << eventLS << endl;
448 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->
gtFdlVector();
452 for (
unsigned int i = 0;
i < gtFdlVectorData.size();
i++) {
453 if (gtFdlVectorData[
i].bxInEvent() == 0) {
459 if (!gtFdlVectorData.empty()) {
460 int CurrentPrescalesIndex =
461 gtFdlVectorData[indexFDL].gtPrescaleFactorIndexAlgo();
482 std::vector<edm::ParameterSet> m_fitParameters = ps.
getParameter<vector<ParameterSet> >(
"fitParameters");
489 string tTrigger = (*a).second;
492 if (tTrigger !=
"Undefined") {
493 bool foundFit =
false;
495 for (
unsigned int b = 0;
b < m_fitParameters.size();
b++) {
496 if (tTrigger == m_fitParameters[
b].getParameter<string>(
"AlgoName")) {
497 TString tAlgoName = m_fitParameters[
b].getParameter<
string>(
"AlgoName");
498 TString tTemplateFunction = m_fitParameters[
b].getParameter<
string>(
"TemplateFunction");
499 vector<double> tParameters = m_fitParameters[
b].getParameter<vector<double> >(
"Parameters");