38 m_inputCategories[
"IsoEG"] = Categories.getUntrackedParameter<
bool>(
"IsoEG");
39 m_inputCategories[
"Jet"] = Categories.getUntrackedParameter<
bool>(
"Jet");
40 m_inputCategories[
"CenJet"] = Categories.getUntrackedParameter<
bool>(
"CenJet");
41 m_inputCategories[
"ForJet"] = Categories.getUntrackedParameter<
bool>(
"ForJet");
42 m_inputCategories[
"TauJet"] = Categories.getUntrackedParameter<
bool>(
"TauJet");
43 m_inputCategories[
"ETM"] = Categories.getUntrackedParameter<
bool>(
"ETM");
44 m_inputCategories[
"ETT"] = Categories.getUntrackedParameter<
bool>(
"ETT");
45 m_inputCategories[
"HTT"] = Categories.getUntrackedParameter<
bool>(
"HTT");
46 m_inputCategories[
"HTM"] = Categories.getUntrackedParameter<
bool>(
"HTM");
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;
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 = ";
151 "Cross Sec. vs Deliv. Lumi: " + tTrigger + tErrorMessage,
153 minInstantLuminosity,
154 maxInstantLuminosity,
162 "Cross Sec. vs Recor. Lumi: " + tTrigger + tErrorMessage,
164 minInstantLuminosity,
165 maxInstantLuminosity,
173 "Cross Sec. vs Inst. Lumi Algo: " + tTrigger + tErrorMessage,
175 minInstantLuminosity,
176 maxInstantLuminosity,
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);
218 cout <<
"[L1TRate_Offline:] Called beginLuminosityBlock at LS=" << lumiBlock.
id().
luminosityBlock() << endl;
226 cout <<
"[L1TRate_Offline:] Called endLuminosityBlock at LS=" << eventLS << endl;
237 bool isDefLumi, isDefPrescaleIndex;
241 unsigned int prescalesIndex = 0;
244 map<TString, double>*
counts =
nullptr;
248 string tTrigger = (*i).second;
263 unsigned int lsOffline = (*j).first;
264 counts = &(*j).second;
267 unsigned int lsPreInd;
277 lsPreInd = lsOffline + 1;
280 isDefPrescaleIndex =
false;
282 isDefPrescaleIndex =
true;
286 if (isDefCount && isDefLumi && isDefPrescaleIndex && (prescalesIndex < m_listsPrescaleFactors->
size())) {
287 const vector<int>& currentPrescaleFactors = (*m_listsPrescaleFactors).at(prescalesIndex);
290 string tTrigger = (*j).second;
291 double trigCount = (*counts)[tTrigger];
294 TF1* tTestFunction =
m_algoFit[tTrigger];
297 if (tTrigger !=
"Undefined") {
298 unsigned int trigBit =
m_algoBit[tTrigger];
299 double trigPrescale = currentPrescaleFactors[trigBit];
301 if (lumi != 0 && trigCount != 0 && trigPrescale != 0) {
302 double RecLumi = lumi * (1. - deadtime / 100.);
304 double AlgoXSec = (trigPrescale * trigCount) / RecLumi;
305 double TemplateFunctionValue = tTestFunction->Eval(lumi);
354 int EventRun = iEvent.
id().
run();
358 if (triggerScalers.
isValid() && !triggerScalers->empty()) {
359 Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
368 const std::vector<unsigned int> gtAlgoCounts = itL1TScalers->gtAlgoCounts();
379 map<TString, double> bufferCount;
383 string tTrigger = (*i).second;
386 if (tTrigger !=
"Undefined") {
387 unsigned int trigBit =
m_algoBit[tTrigger];
388 double trigCount = gtAlgoCounts[trigBit];
390 bufferCount[tTrigger] = trigCount;
399 if (colLScal.
isValid() && !colLScal->empty()) {
400 LumiScalersCollection::const_iterator itLScal = colLScal->begin();
401 unsigned int scalLS = itLScal->sectionNumber();
406 cout <<
"[L1TRate_Offline:] Buffering SCAL-HF Lumi for LS=" << scalLS << endl;
409 itLScal->instantLumi();
410 double deadTimeNormHF = itLScal->deadTimeNormalization();
431 if (deadTimeNormHF == 0) {
434 instLumi = instLumi / deadTimeNormHF;
443 if (gtReadoutRecordData.
isValid()) {
447 cout <<
"[L1TRate_Offline:] Buffering Prescale Index for LS=" << eventLS << endl;
451 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->
gtFdlVector();
455 for (
unsigned int i = 0;
i < gtFdlVectorData.size();
i++) {
456 if (gtFdlVectorData[
i].bxInEvent() == 0) {
462 if (!gtFdlVectorData.empty()) {
463 int CurrentPrescalesIndex =
464 gtFdlVectorData[indexFDL].gtPrescaleFactorIndexAlgo();
485 std::vector<edm::ParameterSet> m_fitParameters = ps.
getParameter<vector<ParameterSet> >(
"fitParameters");
492 string tTrigger = (*a).second;
495 if (tTrigger !=
"Undefined") {
496 bool foundFit =
false;
498 for (
unsigned int b = 0;
b < m_fitParameters.size();
b++) {
499 if (tTrigger == m_fitParameters[
b].getParameter<string>(
"AlgoName")) {
500 TString tAlgoName = m_fitParameters[
b].getParameter<
string>(
"AlgoName");
501 TString tTemplateFunction = m_fitParameters[
b].getParameter<
string>(
"TemplateFunction");
502 vector<double> tParameters = m_fitParameters[
b].getParameter<vector<double> >(
"Parameters");
506 new TF1(
"FitParametrization_" + tAlgoName, tTemplateFunction, minInstantLuminosity, maxInstantLuminosity);
507 m_templateFunctions[tTrigger]->SetParameters(&tParameters[0]);
508 m_templateFunctions[tTrigger]->SetLineWidth(1);
509 m_templateFunctions[tTrigger]->SetLineColor(kRed);
LuminosityBlockID id() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource_L1TSCollection
MonitorElement * m_ErrorMonitor
std::map< int, double > m_lsDeadTime
std::map< TString, MonitorElement * > m_xSecObservedToExpected
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
std::map< int, int > m_lsPrescaleIndex
std::map< std::string, bool > m_inputCategories
std::map< std::string, std::string > m_selectedTriggers
LuminosityBlockNumber_t luminosityBlock() const
std::map< int, std::map< TString, double > > m_lsRates
bool getXSexFitsPython(const edm::ParameterSet &ps)
std::map< TString, MonitorElement * > m_xSecObservedVsLS
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
std::map< TString, MonitorElement * > m_xSecObservedVsDelivLumi
std::map< int, double > m_lsLuminosity
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
edm::ParameterSet m_parameters
#define DEFINE_FWK_MODULE(type)
std::map< TString, MonitorElement * > m_RecorLumiVsLS
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
std::map< TString, TF1 * > m_templateFunctions
L1TRate_Offline(const edm::ParameterSet &ps)
~L1TRate_Offline() override
std::map< TString, MonitorElement * > m_DelivLumiVsLS
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
virtual 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, int > m_algoBit
std::map< TString, TF1 * > m_algoFit
const std::vector< std::vector< int > > * m_listsPrescaleFactors
void analyze(const edm::Event &e, const edm::EventSetup &c) override
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
LuminosityBlockNumber_t luminosityBlock() const
double deadtimePercent() const
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
std::map< TString, MonitorElement * > m_CountsVsLS
edm::EDGetTokenT< LumiScalersCollection > m_scalersSource_LSCollection
std::map< TString, MonitorElement * > m_xSecObservedVsRecorLumi
T const * product() const