CMS 3D CMS Logo

L1TObjectsTiming.cc
Go to the documentation of this file.
2 
3 
5  : ugmtMuonToken_(consumes<l1t::MuonBxCollection>(ps.getParameter<edm::InputTag>("muonProducer"))),
6  stage2CaloLayer2JetToken_(consumes<l1t::JetBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2JetProducer"))),
7  stage2CaloLayer2EGammaToken_(consumes<l1t::EGammaBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2EGammaProducer"))),
8  stage2CaloLayer2TauToken_(consumes<l1t::TauBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2TauProducer"))),
9  stage2CaloLayer2EtSumToken_(consumes<l1t::EtSumBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2EtSumProducer"))),
10  l1tStage2uGtProducer_(consumes<GlobalAlgBlkBxCollection>(ps.getParameter<edm::InputTag>("ugtProducer"))),
11  monitorDir_(ps.getUntrackedParameter<std::string>("monitorDir")),
12  verbose_(ps.getUntrackedParameter<bool>("verbose")),
13  gtUtil_(new l1t::L1TGlobalUtil(ps, consumesCollector(), *this, ps.getParameter<edm::InputTag>("ugtProducer"), ps.getParameter<edm::InputTag>("ugtProducer"))),
14  algoBitFirstBxInTrain_(-1),
15  algoBitLastBxInTrain_(-1),
16  algoBitIsoBx_(-1),
17  algoNameFirstBxInTrain_(ps.getUntrackedParameter<std::string>("firstBXInTrainAlgo","")),
18  algoNameLastBxInTrain_(ps.getUntrackedParameter<std::string>("lastBXInTrainAlgo","")),
19  algoNameIsoBx_(ps.getUntrackedParameter<std::string>("isoBXAlgo","")),
20  bxrange_(5),
21  egammaPtCuts_(ps.getUntrackedParameter<std::vector<double>>("egammaPtCuts")),
22  jetPtCut_(ps.getUntrackedParameter<double>("jetPtCut")),
23  egammaPtCut_(0.),
24  tauPtCut_(ps.getUntrackedParameter<double>("tauPtCut")),
25  etsumPtCut_(ps.getUntrackedParameter<double>("etsumPtCut")),
26  muonPtCut_(ps.getUntrackedParameter<double>("muonPtCut")),
27  muonQualCut_(ps.getUntrackedParameter<int>("muonQualCut"))
28 {
29  if (ps.getUntrackedParameter<std::string>("useAlgoDecision").find("final") == 0) {
30  useAlgoDecision_ = 2;
31  } else if (ps.getUntrackedParameter<std::string>("useAlgoDecision").find("intermediate") == 0) {
32  useAlgoDecision_ = 1;
33  } else {
34  useAlgoDecision_ = 0;
35  }
36 
37  // Take the first element of the cuts vector as the one to use for the all bunches histograms
38  if (not egammaPtCuts_.empty()) {
40  }
41 }
42 
44 
47  desc.add<edm::InputTag>("muonProducer")->setComment("L1T muons");;
48  desc.add<edm::InputTag>("stage2CaloLayer2JetProducer")->setComment("L1T jets");
49  desc.add<edm::InputTag>("stage2CaloLayer2EGammaProducer")->setComment("L1T egamma");
50  desc.add<edm::InputTag>("stage2CaloLayer2TauProducer")->setComment("L1T taus");
51  desc.add<edm::InputTag>("stage2CaloLayer2EtSumProducer")->setComment("L1T etsums");
52  desc.add<edm::InputTag>("ugtProducer")->setComment("uGT output");
53  desc.addUntracked<std::string>("monitorDir", "")->setComment("Target directory in the DQM file. Will be created if not existing.");
54  desc.addUntracked<bool>("verbose", false);
55  desc.addUntracked<std::string>("firstBXInTrainAlgo", "")->setComment("Pick the right algo name for L1 First Collision In Train");
56  desc.addUntracked<std::string>("lastBXInTrainAlgo", "")->setComment("Pick the right algo name for L1 Last Collision In Train");
57  desc.addUntracked<std::string>("isoBXAlgo", "")->setComment("Pick the right algo name for L1 Isolated Bunch");
58  desc.addUntracked<std::string>("useAlgoDecision", "initial")->setComment("Which algo decision should be checked [initial, intermediate, final].");
59  desc.addUntracked<std::vector<double>>("egammaPtCuts", {20., 10., 30.})->setComment("List if min egamma pT vaules");
60  desc.addUntracked<double>("jetPtCut", 20.)->setComment("Min jet pT");
61  desc.addUntracked<double>("tauPtCut", 20.)->setComment("Min tau pT");
62  desc.addUntracked<double>("etsumPtCut", 20.)->setComment("Min etsum pT");
63  desc.addUntracked<double>("muonPtCut", 8.)->setComment("Min muon pT");
64  desc.addUntracked<int>("muonQualCut", 12)->setComment("Min muon quality");
65  descriptions.add("l1tObjectsTiming", desc);
66 }
67 
69  // Get the trigger menu information
70  gtUtil_->retrieveL1Setup(c);
71 
72  // Get the algo bits needed for the timing histograms
73  if (!gtUtil_->getAlgBitFromName(algoNameFirstBxInTrain_, algoBitFirstBxInTrain_)) {
74  edm::LogWarning("L1TObjectsTiming") << "Algo \"" << algoNameFirstBxInTrain_ << "\" not found in the trigger menu " << gtUtil_->gtTriggerMenuName() << ". Could not retrieve algo bit number.";
75  }
76 
77  if (!gtUtil_->getAlgBitFromName(algoNameLastBxInTrain_, algoBitLastBxInTrain_)) {
78  edm::LogWarning("L1TObjectsTiming") << "Algo \"" << algoNameLastBxInTrain_ << "\" not found in the trigger menu " << gtUtil_->gtTriggerMenuName() << ". Could not retrieve algo bit number.";
79  }
80 
81  if (!gtUtil_->getAlgBitFromName(algoNameIsoBx_, algoBitIsoBx_)) {
82  edm::LogWarning("L1TObjectsTiming") << "Algo \"" << algoNameIsoBx_ << "\" not found in the trigger menu " << gtUtil_->gtTriggerMenuName() << ". Could not retrieve algo bit number.";
83  }
84 }
85 
86 
88 
89  std::array<std::string, 5> bx_obj { {"minus2", "minus1", "0", "plus1", "plus2"} };
90 
91  // generate cut value strings for the histogram titles
92  auto muonQualCutStr = std::to_string(muonQualCut_);
93  auto muonPtCutStr = std::to_string(muonPtCut_);
94  muonPtCutStr.resize(muonPtCutStr.size()-5); // cut some decimal digits
95 
96  auto jetPtCutStr = std::to_string(jetPtCut_);
97  jetPtCutStr.resize(jetPtCutStr.size()-5); // cut some decimal digits
98 
99  auto egammaPtCutStr = std::to_string(egammaPtCut_);
100  egammaPtCutStr.resize(egammaPtCutStr.size()-5); // cut some decimal digits
101 
102  auto tauPtCutStr = std::to_string(tauPtCut_);
103  tauPtCutStr.resize(tauPtCutStr.size()-5); // cut some decimal digits
104 
105  auto etsumPtCutStr = std::to_string(etsumPtCut_);
106  etsumPtCutStr.resize(etsumPtCutStr.size()-5); // cut some decimal digits
107 
108  // all bunches
109  ibooker.setCurrentFolder(monitorDir_+"/L1TMuon/timing");
110  for(unsigned int i=0; i<bxrange_; ++i) {
111  muons_eta_phi.push_back(ibooker.book2D("muons_eta_phi_bx_"+bx_obj[i],"L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr+" #eta vs #phi BX="+bx_obj[i]+";#eta;#phi", 25, -2.5, 2.5, 25, -3.2, 3.2));
112  }
113  denominator_muons = ibooker.book2D("denominator_muons","Denominator for L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr+";#eta;#phi", 25, -2.5, 2.5, 25, -3.2, 3.2);
114 
115  ibooker.setCurrentFolder(monitorDir_+"/L1TJet/timing");
116  for(unsigned int i=0; i<bxrange_; ++i) {
117  jet_eta_phi.push_back(ibooker.book2D("jet_eta_phi_bx_"+bx_obj[i],"L1T Jet p_{T}#geq"+jetPtCutStr+" GeV #eta vs #phi BX="+bx_obj[i]+";#eta;#phi", 50, -5., 5., 25, -3.2, 3.2));
118  }
119  denominator_jet = ibooker.book2D("denominator_jet","Denominator for L1T Jet p_{T}#geq"+jetPtCutStr+" GeV;#eta;#phi", 50, -5., 5., 25, -3.2, 3.2);
120 
121  ibooker.setCurrentFolder(monitorDir_+"/L1TEGamma/timing");
122  for(unsigned int i=0; i<bxrange_; ++i) {
123  egamma_eta_phi.push_back(ibooker.book2D("egamma_eta_phi_bx_"+bx_obj[i],"L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV #eta vs #phi BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
124  }
125  denominator_egamma = ibooker.book2D("denominator_egamma","Denominator for L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2);
126 
127  ibooker.setCurrentFolder(monitorDir_+"/L1TTau/timing");
128  for(unsigned int i=0; i<bxrange_; ++i) {
129  tau_eta_phi.push_back(ibooker.book2D("tau_eta_phi_bx_"+bx_obj[i],"L1T Tau p_{T}#geq"+tauPtCutStr+" GeV #eta vs #phi BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
130  }
131  denominator_tau = ibooker.book2D("denominator_tau","Denominator for L1T Tau p_{T}#geq"+tauPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2);
132 
133  ibooker.setCurrentFolder(monitorDir_+"/L1TEtSum/timing");
134  for(unsigned int i=0; i<bxrange_; ++i) {
135  etsum_eta_phi_MET.push_back(ibooker.book1D("etsum_phi_bx_MET_"+bx_obj[i],"L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV #phi BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
136  etsum_eta_phi_METHF.push_back(ibooker.book1D("etsum_phi_bx_METHF_"+bx_obj[i],"L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV #phi BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
137  etsum_eta_phi_MHT.push_back(ibooker.book1D("etsum_phi_bx_MHT_"+bx_obj[i],"L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV #phi BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
138  etsum_eta_phi_MHTHF.push_back(ibooker.book1D("etsum_phi_bx_MHTHF_"+bx_obj[i],"L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV #phi BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
139  }
140  denominator_etsum_MET = ibooker.book1D("denominator_etsum_MET","Denominator for L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
141  denominator_etsum_METHF = ibooker.book1D("denominator_etsum_METHF","Denominator for L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
142  denominator_etsum_MHT = ibooker.book1D("denominator_etsum_MHT","Denominator for L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
143  denominator_etsum_MHTHF = ibooker.book1D("denominator_etsum_MHTHF","Denominator for L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
144 
145  // isolated bunch
146  if(algoBitIsoBx_ > -1) {
147  ibooker.setCurrentFolder(monitorDir_+"/L1TMuon/timing/Isolated_bunch");
148  for(unsigned int i=0; i<bxrange_; ++i) {
149  muons_eta_phi_isolated.push_back(ibooker.book2D("muons_eta_phi_bx_isolated_"+bx_obj[i],"L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr+" #eta vs #phi for isolated bunch BX="+bx_obj[i]+";#eta;#phi", 25, -2.5, 2.5, 25, -3.2, 3.2));
150  }
151  denominator_muons_isolated = ibooker.book2D("denominator_muons_isolated","Denominator for Isolated Bunch for L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr, 25, -2.5, 2.5, 25, -3.2, 3.2);
152 
153  ibooker.setCurrentFolder(monitorDir_+"/L1TJet/timing/Isolated_bunch");
154  for(unsigned int i=0; i<bxrange_; ++i) {
155  jet_eta_phi_isolated.push_back(ibooker.book2D("jet_eta_phi_bx_isolated_"+bx_obj[i],"L1T Jet p_{T}#geq"+jetPtCutStr+" GeV #eta vs #phi for isolated bunch BX="+bx_obj[i]+";#eta;#phi", 50, -5., 5., 25, -3.2, 3.2));
156  }
157  denominator_jet_isolated = ibooker.book2D("denominator_jet_isolated","Denominator for Isolated Bunch for L1T Jet p_{T}#geq"+jetPtCutStr+" GeV;#eta;#phi", 50, -5., 5., 25, -3.2, 3.2);
158 
159  for (const auto egammaPtCut : egammaPtCuts_) {
160  auto egammaPtCutStr = std::to_string(egammaPtCut);
161  egammaPtCutStr.resize(egammaPtCutStr.size()-5); // cut some decimal digits
162  auto egammaPtCutStrAlpha = egammaPtCutStr;
163  std::replace(egammaPtCutStrAlpha.begin(), egammaPtCutStrAlpha.end(), '.', 'p'); // replace the decimal dot with a 'p' to please the DQMStore
164 
165  ibooker.setCurrentFolder(monitorDir_+"/L1TEGamma/timing/Isolated_bunch/ptmin_"+egammaPtCutStrAlpha+"_gev");
166  std::vector<MonitorElement*> vHelper;
167  for(unsigned int i=0; i<bxrange_; ++i) {
168  vHelper.push_back(ibooker.book2D("egamma_eta_phi_bx_isolated_"+bx_obj[i], "L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV #eta vs #phi for first bunch BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
169  }
170  egamma_eta_phi_isolated.push_back(vHelper);
171 
172  denominator_egamma_isolated.push_back(ibooker.book2D("denominator_egamma_isolated", "Denominator for Isolated Bunch for L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
173 
174  egamma_iso_bx_ieta_isolated.push_back(ibooker.book2D("egamma_iso_bx_ieta_isolated_ptmin"+egammaPtCutStrAlpha, "L1T EGamma iso with pT#geq"+egammaPtCutStr+" GeV BX vs. i#eta for first bunch in train;BX in event (corrected);i#eta", 5, -2.5, 2.5, 70, -70, 70));
175 
176  egamma_noniso_bx_ieta_isolated.push_back(ibooker.book2D("egamma_noniso_bx_ieta_isolated_ptmin"+egammaPtCutStrAlpha, "L1T EGamma non iso with pT#geq"+egammaPtCutStr+" GeV BX vs. i#eta for first bunch in train;BX in event (corrected);i#eta", 5, -2.5, 2.5, 70, -70, 70));
177  }
178 
179  ibooker.setCurrentFolder(monitorDir_+"/L1TTau/timing/Isolated_bunch");
180  for(unsigned int i=0; i<bxrange_; ++i) {
181  tau_eta_phi_isolated.push_back(ibooker.book2D("tau_eta_phi_bx_isolated_"+bx_obj[i],"L1T Tau p_{T}#geq"+tauPtCutStr+" GeV #eta vs #phi for isolated bunch BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
182  }
183  denominator_tau_isolated = ibooker.book2D("denominator_tau_isolated","Denominator for Isolated Bunch for L1T Tau p_{T}#geq"+tauPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2);
184 
185  ibooker.setCurrentFolder(monitorDir_+"/L1TEtSum/timing/Isolated_bunch");
186  for(unsigned int i=0; i<bxrange_; ++i) {
187  etsum_eta_phi_MET_isolated.push_back(ibooker.book1D("etsum_phi_bx_MET_isolated_"+bx_obj[i],"L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV #phi for isolated bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
188  etsum_eta_phi_METHF_isolated.push_back(ibooker.book1D("etsum_phi_bx_METHF_isolated_"+bx_obj[i],"L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV #phi for isolated bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
189  etsum_eta_phi_MHT_isolated.push_back(ibooker.book1D("etsum_phi_bx_MHT_isolated_"+bx_obj[i],"L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV #phi for isolated bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
190  etsum_eta_phi_MHTHF_isolated.push_back(ibooker.book1D("etsum_phi_bx_MHTHF_isolated_"+bx_obj[i],"L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV #phi for isolated bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
191  }
192  denominator_etsum_isolated_MET = ibooker.book1D("denominator_etsum_isolated_MET","Denominator for Isolated Bunch for L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
193  denominator_etsum_isolated_METHF = ibooker.book1D("denominator_etsum_isolated_METHF","Denominator for Isolated Bunch for L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
194  denominator_etsum_isolated_MHT = ibooker.book1D("denominator_etsum_isolated_MHT","Denominator for Isolated Bunch for L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
195  denominator_etsum_isolated_MHTHF = ibooker.book1D("denominator_etsum_isolated_MHTHF","Denominator for Isolated Bunch for L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
196  }
197 
198  if(algoBitFirstBxInTrain_ > -1) {
199  // first bunch in train
200  ibooker.setCurrentFolder(monitorDir_+"/L1TMuon/timing/First_bunch");
201  for(unsigned int i=0; i<bxrange_-2; ++i) {
202  muons_eta_phi_firstbunch.push_back(ibooker.book2D("muons_eta_phi_bx_firstbunch_"+bx_obj[i],"L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr+" #eta vs #phi for first bunch BX="+bx_obj[i]+";#eta;#phi", 25, -2.5, 2.5, 25, -3.2, 3.2));
203  }
204  denominator_muons_firstbunch = ibooker.book2D("denominator_muons_firstbunch","Denominator for First Bunch for L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr, 25, -2.5, 2.5, 25, -3.2, 3.2);
205 
206  ibooker.setCurrentFolder(monitorDir_+"/L1TJet/timing/First_bunch");
207  for(unsigned int i=0; i<bxrange_-2; ++i) {
208  jet_eta_phi_firstbunch.push_back(ibooker.book2D("jet_eta_phi_bx_firstbunch_"+bx_obj[i],"L1T Jet p_{T}#geq"+jetPtCutStr+" GeV #eta vs #phi for first bunch BX="+bx_obj[i]+";#eta;#phi", 50, -5., 5., 25, -3.2, 3.2));
209  }
210  denominator_jet_firstbunch = ibooker.book2D("denominator_jet_firstbunch","Denominator for First Bunch for L1T Jet p_{T}#geq"+jetPtCutStr+" GeV;#eta;#phi", 50, -5., 5., 25, -3.2, 3.2);
211 
212  for (const auto egammaPtCut : egammaPtCuts_) {
213  auto egammaPtCutStr = std::to_string(egammaPtCut);
214  egammaPtCutStr.resize(egammaPtCutStr.size()-5); // cut some decimal digits
215  auto egammaPtCutStrAlpha = egammaPtCutStr;
216  std::replace(egammaPtCutStrAlpha.begin(), egammaPtCutStrAlpha.end(), '.', 'p'); // replace the decimal dot with a 'p' to please the DQMStore
217 
218  ibooker.setCurrentFolder(monitorDir_+"/L1TEGamma/timing/First_bunch/ptmin_"+egammaPtCutStrAlpha+"_gev");
219  std::vector<MonitorElement*> vHelper;
220  for(unsigned int i=0; i<bxrange_-2; ++i) {
221  vHelper.push_back(ibooker.book2D("egamma_eta_phi_bx_firstbunch_"+bx_obj[i], "L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV #eta vs #phi for first bunch BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
222  }
223  egamma_eta_phi_firstbunch.push_back(vHelper);
224 
225  denominator_egamma_firstbunch.push_back(ibooker.book2D("denominator_egamma_firstbunch", "Denominator for First Bunch for L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
226 
227  egamma_iso_bx_ieta_firstbunch.push_back(ibooker.book2D("egamma_iso_bx_ieta_firstbunch_ptmin"+egammaPtCutStrAlpha, "L1T EGamma iso with pT#geq"+egammaPtCutStr+" GeV BX vs. i#eta for first bunch in train;BX in event (corrected);i#eta", 5, -2.5, 2.5, 70, -70, 70));
228 
229  egamma_noniso_bx_ieta_firstbunch.push_back(ibooker.book2D("egamma_noniso_bx_ieta_firstbunch_ptmin"+egammaPtCutStrAlpha, "L1T EGamma non iso with pT#geq"+egammaPtCutStr+" GeV BX vs. i#eta for first bunch in train;BX in event (corrected);i#eta", 5, -2.5, 2.5, 70, -70, 70));
230  }
231 
232  ibooker.setCurrentFolder(monitorDir_+"/L1TTau/timing/First_bunch");
233  for(unsigned int i=0; i<bxrange_-2; ++i) {
234  tau_eta_phi_firstbunch.push_back(ibooker.book2D("tau_eta_phi_bx_firstbunch_"+bx_obj[i],"L1T Tau p_{T}#geq"+tauPtCutStr+" GeV #eta vs #phi for first bunch BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
235  }
236  denominator_tau_firstbunch = ibooker.book2D("denominator_tau_firstbunch","Denominator for First Bunch for L1T Tau p_{T}#geq"+tauPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2);
237 
238  ibooker.setCurrentFolder(monitorDir_+"/L1TEtSum/timing/First_bunch");
239  for(unsigned int i=0; i<bxrange_-2; ++i) {
240  etsum_eta_phi_MET_firstbunch.push_back(ibooker.book1D("etsum_phi_bx_MET_firstbunch_"+bx_obj[i],"L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV #phi for firstbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
241  etsum_eta_phi_METHF_firstbunch.push_back(ibooker.book1D("etsum_phi_bx_METHF_firstbunch_"+bx_obj[i],"L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV #phi for firstbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
242  etsum_eta_phi_MHT_firstbunch.push_back(ibooker.book1D("etsum_phi_bx_MHT_firstbunch_"+bx_obj[i],"L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV #phi for firstbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
243  etsum_eta_phi_MHTHF_firstbunch.push_back(ibooker.book1D("etsum_phi_bx_MHTHF_firstbunch_"+bx_obj[i],"L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV #phi for firstbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
244  }
245  denominator_etsum_firstbunch_MET = ibooker.book1D("denominator_etsum_firstbunch_MET","Denominator for First Bunch for L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
246  denominator_etsum_firstbunch_METHF = ibooker.book1D("denominator_etsum_firstbunch_METHF","Denominator for First Bunch for L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
247  denominator_etsum_firstbunch_MHT = ibooker.book1D("denominator_etsum_firstbunch_MHT","Denominator for First Bunch for L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
248  denominator_etsum_firstbunch_MHTHF = ibooker.book1D("denominator_etsum_firstbunch_MHTHF","Denominator for First Bunch for L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
249  }
250 
251  // last bunch in train
252  if(algoBitLastBxInTrain_ > -1) {
253  ibooker.setCurrentFolder(monitorDir_+"/L1TMuon/timing/Last_bunch");
254  for(unsigned int i=0; i<bxrange_-2; ++i) {
255  muons_eta_phi_lastbunch.push_back(ibooker.book2D("muons_eta_phi_bx_lastbunch_"+bx_obj[i+2],"L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr+" #eta vs #phi for last bunch BX="+bx_obj[i]+";#eta;#phi", 25, -2.5, 2.5, 25, -3.2, 3.2));
256  }
257  denominator_muons_lastbunch = ibooker.book2D("denominator_muons_lastbunch","Denominator for Last Bunch for L1T Muon p_{T}#geq"+muonPtCutStr+" GeV qual#geq"+muonQualCutStr, 25, -2.5, 2.5, 25, -3.2, 3.2);
258 
259  ibooker.setCurrentFolder(monitorDir_+"/L1TJet/timing/Last_bunch");
260  for(unsigned int i=0; i<bxrange_-2; ++i) {
261  jet_eta_phi_lastbunch.push_back(ibooker.book2D("jet_eta_phi_bx_lastbunch_"+bx_obj[i+2],"L1T Jet p_{T}#geq"+jetPtCutStr+" GeV #eta vs #phi for last bunch BX="+bx_obj[i]+";#eta;#phi", 50, -5., 5., 25, -3.2, 3.2));
262  }
263  denominator_jet_lastbunch = ibooker.book2D("denominator_jet_lastbunch","Denominator for Last Bunch for L1T Jet p_{T}#geq"+jetPtCutStr+" GeV;#eta;#phi", 50, -5., 5., 25, -3.2, 3.2);
264 
265  for (const auto egammaPtCut : egammaPtCuts_) {
266  auto egammaPtCutStr = std::to_string(egammaPtCut);
267  egammaPtCutStr.resize(egammaPtCutStr.size()-5); // cut some decimal digits
268  auto egammaPtCutStrAlpha = egammaPtCutStr;
269  std::replace(egammaPtCutStrAlpha.begin(), egammaPtCutStrAlpha.end(), '.', 'p'); // replace the decimal dot with a 'p' to please the DQMStore
270 
271  ibooker.setCurrentFolder(monitorDir_+"/L1TEGamma/timing/Last_bunch/ptmin_"+egammaPtCutStrAlpha+"_gev");
272  std::vector<MonitorElement*> vHelper;
273  for(unsigned int i=0; i<bxrange_-2; ++i) {
274  vHelper.push_back(ibooker.book2D("egamma_eta_phi_bx_lastbunch_"+bx_obj[i+2], "L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV #eta vs #phi for first bunch BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
275  }
276  egamma_eta_phi_lastbunch.push_back(vHelper);
277 
278  denominator_egamma_lastbunch.push_back(ibooker.book2D("denominator_egamma_lastbunch", "Denominator for Last Bunch for L1T EGamma p_{T}#geq"+egammaPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
279 
280  egamma_iso_bx_ieta_lastbunch.push_back(ibooker.book2D("egamma_iso_bx_ieta_lastbunch_ptmin"+egammaPtCutStrAlpha, "L1T EGamma iso with pT#geq"+egammaPtCutStr+" GeV BX vs. i#eta for first bunch in train;BX in event (corrected);i#eta", 5, -2.5, 2.5, 70, -70, 70));
281 
282  egamma_noniso_bx_ieta_lastbunch.push_back(ibooker.book2D("egamma_noniso_bx_ieta_lastbunch_ptmin"+egammaPtCutStrAlpha, "L1T EGamma non iso with pT#geq"+egammaPtCutStr+" GeV BX vs. i#eta for first bunch in train;BX in event (corrected);i#eta", 5, -2.5, 2.5, 70, -70, 70));
283  }
284 
285  ibooker.setCurrentFolder(monitorDir_+"/L1TTau/timing/Last_bunch");
286  for(unsigned int i=0; i<bxrange_-2; ++i) {
287  tau_eta_phi_lastbunch.push_back(ibooker.book2D("tau_eta_phi_bx_lastbunch_"+bx_obj[i+2],"L1T Tau p_{T}#geq"+tauPtCutStr+" GeV #eta vs #phi for last bunch BX="+bx_obj[i]+";#eta;#phi", 30, -3., 3., 25, -3.2, 3.2));
288  }
289  denominator_tau_lastbunch = ibooker.book2D("denominator_tau_lastbunch","Denominator for Last Bunch for L1T Tau p_{T}#geq"+tauPtCutStr+" GeV;#eta;#phi", 30, -3., 3., 25, -3.2, 3.2);
290 
291  ibooker.setCurrentFolder(monitorDir_+"/L1TEtSum/timing/Last_bunch");
292  for(unsigned int i=0; i<bxrange_-2; ++i) {
293  etsum_eta_phi_MET_lastbunch.push_back(ibooker.book1D("etsum_phi_bx_MET_lastbunch_"+bx_obj[i+2],"L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV #phi for lastbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
294  etsum_eta_phi_METHF_lastbunch.push_back(ibooker.book1D("etsum_phi_bx_METHF_lastbunch_"+bx_obj[i+2],"L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV #phi for lastbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
295  etsum_eta_phi_MHT_lastbunch.push_back(ibooker.book1D("etsum_phi_bx_MHT_lastbunch_"+bx_obj[i+2],"L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV #phi for lastbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
296  etsum_eta_phi_MHTHF_lastbunch.push_back(ibooker.book1D("etsum_phi_bx_MHTHF_lastbunch_"+bx_obj[i+2],"L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV #phi for lastbunch bunch BX="+bx_obj[i]+";#phi", 25, -3.2, 3.2));
297  }
298  denominator_etsum_lastbunch_MET = ibooker.book1D("denominator_etsum_lastbunch_MET","Denominator for Last Bunch for L1T EtSum MET p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
299  denominator_etsum_lastbunch_METHF = ibooker.book1D("denominator_etsum_lastbunch_METHF","Denominator for Last Bunch for L1T EtSum METHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
300  denominator_etsum_lastbunch_MHT = ibooker.book1D("denominator_etsum_lastbunch_MHT","Denominator for Last Bunch for L1T EtSum MHT p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
301  denominator_etsum_lastbunch_MHTHF = ibooker.book1D("denominator_etsum_lastbunch_MHTHF","Denominator for Last Bunch for L1T EtSum MHTHF p_{T}#geq"+etsumPtCutStr+" GeV;#phi", 25, -3.2, 3.2);
302  }
303 }
304 
306 
307  if (verbose_) edm::LogInfo("L1TObjectsTiming") << "L1TObjectsTiming: analyze..." << std::endl;
308 
309  // Muon Collection
311  e.getByToken(ugmtMuonToken_, MuonBxCollection);
312  // Jet Collection
314  e.getByToken(stage2CaloLayer2JetToken_, JetBxCollection);
315  // EGamma Collection
317  e.getByToken(stage2CaloLayer2EGammaToken_, EGammaBxCollection);
318  // Tau Collection
320  e.getByToken(stage2CaloLayer2TauToken_, TauBxCollection);
321  // EtSum Collection
323  e.getByToken(stage2CaloLayer2EtSumToken_, EtSumBxCollection);
324 
325  // Open uGT readout record
327  e.getByToken(l1tStage2uGtProducer_, uGtAlgs);
328 
329  // Filling eta-phi map for muons for BX=-2,-1,0,+1,+2
330  for (int itBX = MuonBxCollection->getFirstBX(); itBX <= MuonBxCollection->getLastBX(); ++itBX) {
331  for (l1t::MuonBxCollection::const_iterator Muon = MuonBxCollection->begin(itBX); Muon != MuonBxCollection->end(itBX); ++Muon) {
332  if (Muon->pt() >= muonPtCut_ and Muon->hwQual() >= muonQualCut_) {
333  denominator_muons->Fill(Muon->eta(), Muon->phi());
334  int index = (int)itBX - std::min(0, 1 - (int)bxrange_%2 - (int)std::floor(bxrange_/2.)); // the correlation from itBX to respective index of the vector
335  muons_eta_phi.at(index)->Fill(Muon->eta(), Muon->phi());
336  }
337  }
338  }
339 
340  // Filling eta-phi map for jets for BX=-2,-1,0,+1,+2
341  for (int itBX = JetBxCollection->getFirstBX(); itBX <= JetBxCollection->getLastBX(); ++itBX) {
342  for (l1t::JetBxCollection::const_iterator jet = JetBxCollection->begin(itBX); jet != JetBxCollection->end(itBX); ++jet) {
343  if (jet->pt() >= jetPtCut_) {
344  denominator_jet->Fill(jet->eta(), jet->phi());
345  int index = itBX - std::min(0, 1 - (int)bxrange_%2 - (int)std::floor(bxrange_/2.)); // the correlation from itBX to respective index of the vector
346  jet_eta_phi.at(index)->Fill(jet->eta(), jet->phi());
347  }
348  }
349  }
350 
351  // Filling eta-phi map for egamma for BX=-2,-1,0,+1,+2
352  for (int itBX = EGammaBxCollection->getFirstBX(); itBX <= EGammaBxCollection->getLastBX(); ++itBX) {
353  for (l1t::EGammaBxCollection::const_iterator egamma = EGammaBxCollection->begin(itBX); egamma != EGammaBxCollection->end(itBX); ++egamma) {
354  if (egamma->pt() >= egammaPtCut_) {
355  denominator_egamma->Fill(egamma->eta(), egamma->phi());
356  int index = itBX - std::min(0, 1 - (int)bxrange_%2 - (int)std::floor(bxrange_/2.)); // the correlation from itBX to respective index of the vector
357  egamma_eta_phi.at(index)->Fill(egamma->eta(), egamma->phi());
358  }
359  }
360  }
361 
362  // Filling eta-phi map for tau for BX=-2,-1,0,+1,+2
363  for (int itBX = TauBxCollection->getFirstBX(); itBX <= TauBxCollection->getLastBX(); ++itBX) {
364  for (l1t::TauBxCollection::const_iterator tau = TauBxCollection->begin(itBX); tau != TauBxCollection->end(itBX); ++tau) {
365  if (tau->pt() >= tauPtCut_) {
366  denominator_tau->Fill(tau->eta(), tau->phi());
367  int index = itBX - std::min(0, 1 - (int)bxrange_%2 - (int)std::floor(bxrange_/2.)); // the correlation from itBX to respective index of the vector
368  tau_eta_phi.at(index)->Fill(tau->eta(), tau->phi());
369  }
370  }
371  }
372 
373  // Filling eta-phi map for etsum for BX=-2,-1,0,+1,+2
374  for (int itBX = EtSumBxCollection->getFirstBX(); itBX <= EtSumBxCollection->getLastBX(); ++itBX) {
375  for (l1t::EtSumBxCollection::const_iterator EtSum = EtSumBxCollection->begin(itBX); EtSum != EtSumBxCollection->end(itBX); ++EtSum) {
376  if (EtSum->pt() >= etsumPtCut_) {
377  int index = itBX - std::min(0, 1 - (int)bxrange_%2 - (int)std::floor(bxrange_/2.)); // the correlation from itBX to respective index of the vector
378  if (l1t::EtSum::EtSumType::kMissingEt == EtSum->getType()) {
379  etsum_eta_phi_MET.at(index)->Fill(EtSum->phi());
380  denominator_etsum_MET->Fill(EtSum->phi());
381  }
382  else if (l1t::EtSum::EtSumType::kMissingEtHF == EtSum->getType()) {
383  etsum_eta_phi_METHF.at(index)->Fill(EtSum->phi());
384  denominator_etsum_METHF->Fill(EtSum->phi());
385 
386  }
387  else if(l1t::EtSum::EtSumType::kMissingHt == EtSum->getType()) {
388  etsum_eta_phi_MHT.at(index)->Fill(EtSum->phi());
389  denominator_etsum_MHT->Fill(EtSum->phi());
390 
391  }
392  else if(l1t::EtSum::EtSumType::kMissingHtHF == EtSum->getType()) {
393  etsum_eta_phi_MHTHF.at(index)->Fill(EtSum->phi());
394  denominator_etsum_MHTHF->Fill(EtSum->phi());
395  }
396  }
397  }
398  }
399 
400  // Find out in which BX the first collision in train, isolated bunch, and last collision in train have fired.
401  // In case of pre firing it will be in BX 1 or BX 2 and this will determine the BX shift that
402  // will be applied to the timing histogram later.
403  int bxShiftFirst = -999;
404  int bxShiftIso = -999;
405  int bxShiftLast = -999;
406  for (int bx = uGtAlgs->getFirstBX(); bx <= uGtAlgs->getLastBX(); ++bx) {
407  for (GlobalAlgBlkBxCollection::const_iterator itr = uGtAlgs->begin(bx); itr != uGtAlgs->end(bx); ++itr) {
408  // first bunch in train
409  if (algoBitFirstBxInTrain_ != -1) {
410  bool bit = false;
411  switch (useAlgoDecision_) {
412  case 0:
413  bit = itr->getAlgoDecisionInitial(algoBitFirstBxInTrain_);
414  break;
415  case 1:
416  bit = itr->getAlgoDecisionInterm(algoBitFirstBxInTrain_);
417  break;
418  case 2:
419  bit = itr->getAlgoDecisionFinal(algoBitFirstBxInTrain_);
420  break;
421  }
422  if (bit) {
423  bxShiftFirst = bx;
424  }
425  }
426  // last bunch in train
427  if(algoBitLastBxInTrain_ != -1) {
428  bool bit = false;
429  switch (useAlgoDecision_) {
430  case 0:
431  bit = itr->getAlgoDecisionInitial(algoBitLastBxInTrain_);
432  break;
433  case 1:
434  bit = itr->getAlgoDecisionInterm(algoBitLastBxInTrain_);
435  break;
436  case 2:
437  bit = itr->getAlgoDecisionFinal(algoBitLastBxInTrain_);
438  break;
439  }
440  if (bit) {
441  bxShiftLast = bx;
442  }
443  }
444  // isolated bunch
445  if (algoBitIsoBx_ != -1) {
446  bool bit = false;
447  switch (useAlgoDecision_) {
448  case 0:
449  bit = itr->getAlgoDecisionInitial(algoBitIsoBx_);
450  break;
451  case 1:
452  bit = itr->getAlgoDecisionInterm(algoBitIsoBx_);
453  break;
454  case 2:
455  bit = itr->getAlgoDecisionFinal(algoBitIsoBx_);
456  break;
457  }
458  if (bit) {
459  bxShiftIso = bx;
460  }
461  }
462  }
463  }
464 
465  // fill the first bunch in train maps
466  if (bxShiftFirst > -999) {
467  // muons
468  for (int itBX = std::max(MuonBxCollection->getFirstBX(), MuonBxCollection->getFirstBX() + bxShiftFirst); itBX <= std::min(MuonBxCollection->getLastBX(), MuonBxCollection->getLastBX() + bxShiftFirst); ++itBX) {
469  int index = itBX - bxShiftFirst - uGtAlgs->getFirstBX();
470  if (index >= 0 and index < (int)muons_eta_phi_firstbunch.size()) {
471  for (l1t::MuonBxCollection::const_iterator muon = MuonBxCollection->begin(itBX); muon != MuonBxCollection->end(itBX); ++muon) { // Starting with Muons
472  if (muon->pt() >= muonPtCut_ and muon->hwQual() >= muonQualCut_) {
473  denominator_muons_firstbunch->Fill(muon->eta(), muon->phi());
474  muons_eta_phi_firstbunch.at(index)->Fill(muon->eta(), muon->phi());
475  }
476  }
477  }
478  }
479  // jets
480  for (int itBX = std::max(JetBxCollection->getFirstBX(), JetBxCollection->getFirstBX() + bxShiftFirst); itBX <= std::min(JetBxCollection->getLastBX(), JetBxCollection->getLastBX() + bxShiftFirst); ++itBX) {
481  int index = itBX - bxShiftFirst - uGtAlgs->getFirstBX();
482  if (index >= 0 and index < (int)jet_eta_phi_firstbunch.size()) {
483  for (l1t::JetBxCollection::const_iterator jet = JetBxCollection->begin(itBX); jet != JetBxCollection->end(itBX); ++jet) {
484  if (jet->pt() >= jetPtCut_) {
485  denominator_jet_firstbunch->Fill(jet->eta(), jet->phi());
486  jet_eta_phi_firstbunch.at(index)->Fill(jet->eta(), jet->phi());
487  }
488  }
489  }
490  }
491  // egammas
492  for (int itBX = std::max(EGammaBxCollection->getFirstBX(), EGammaBxCollection->getFirstBX() + bxShiftFirst); itBX <= std::min(EGammaBxCollection->getLastBX(), EGammaBxCollection->getLastBX() + bxShiftFirst); ++itBX) {
493  int index = itBX - bxShiftFirst - uGtAlgs->getFirstBX();
494  for (l1t::EGammaBxCollection::const_iterator egamma = EGammaBxCollection->begin(itBX); egamma != EGammaBxCollection->end(itBX); ++egamma) {
495  for (size_t i = 0; i < egammaPtCuts_.size(); ++i) {
496  if (egamma->pt() >= egammaPtCuts_.at(i)) {
497  if (index >= 0 and index < (int)egamma_eta_phi_firstbunch.size()) {
498  denominator_egamma_firstbunch.at(i)->Fill(egamma->eta(), egamma->phi());
499  egamma_eta_phi_firstbunch.at(i).at(index)->Fill(egamma->eta(), egamma->phi());
500  }
501  if ((bool)egamma->hwIso()) {
502  egamma_iso_bx_ieta_firstbunch.at(i)->Fill(itBX - bxShiftFirst, egamma->hwEta());
503  }
504  egamma_noniso_bx_ieta_firstbunch.at(i)->Fill(itBX - bxShiftFirst, egamma->hwEta());
505  }
506  }
507  }
508  }
509  // taus
510  for (int itBX = std::max(TauBxCollection->getFirstBX(), TauBxCollection->getFirstBX() + bxShiftFirst); itBX <= std::min(TauBxCollection->getLastBX(), TauBxCollection->getLastBX() + bxShiftFirst); ++itBX) {
511  int index = itBX - bxShiftFirst - uGtAlgs->getFirstBX();
512  if (index >= 0 and index < (int)tau_eta_phi_firstbunch.size()) {
513  for (l1t::TauBxCollection::const_iterator tau = TauBxCollection->begin(itBX); tau != TauBxCollection->end(itBX); ++tau) {
514  if (tau->pt() >= tauPtCut_) {
515  denominator_tau_firstbunch->Fill(tau->eta(), tau->phi());
516  tau_eta_phi_firstbunch.at(index)->Fill(tau->eta(), tau->phi());
517  }
518  }
519  }
520  }
521  // etsums
522  for (int itBX = std::max(EtSumBxCollection->getFirstBX(), EtSumBxCollection->getFirstBX() + bxShiftFirst); itBX <= std::min(EtSumBxCollection->getLastBX(), EtSumBxCollection->getLastBX() + bxShiftFirst); ++itBX) {
523  int index = itBX - bxShiftFirst - uGtAlgs->getFirstBX();
524  if (index >= 0) {
525  for (l1t::EtSumBxCollection::const_iterator EtSum = EtSumBxCollection->begin(itBX); EtSum != EtSumBxCollection->end(itBX); ++EtSum) {
526  if (EtSum->pt() >= etsumPtCut_) {
527  if (l1t::EtSum::EtSumType::kMissingEt == EtSum->getType()) {
528  if (index < (int)etsum_eta_phi_MET_firstbunch.size()) {
529  denominator_etsum_firstbunch_MET->Fill(EtSum->phi());
530  etsum_eta_phi_MET_firstbunch.at(index)->Fill(EtSum->phi());
531  }
532  }
533  else if (l1t::EtSum::EtSumType::kMissingEtHF == EtSum->getType()) {
534  if (index < (int)etsum_eta_phi_METHF_firstbunch.size()) {
536  etsum_eta_phi_METHF_firstbunch.at(index)->Fill(EtSum->phi());
537  }
538  }
539  else if(l1t::EtSum::EtSumType::kMissingHt == EtSum->getType()) {
540  if (index < (int)etsum_eta_phi_MHT_firstbunch.size()) {
541  denominator_etsum_firstbunch_MHT->Fill(EtSum->phi());
542  etsum_eta_phi_MHT_firstbunch.at(index)->Fill(EtSum->phi());
543  }
544  }
545  else if(l1t::EtSum::EtSumType::kMissingHtHF == EtSum->getType()) {
546  if (index < (int)etsum_eta_phi_MHTHF_firstbunch.size()) {
548  etsum_eta_phi_MHTHF_firstbunch.at(index)->Fill(EtSum->phi());
549  }
550  }
551  }
552  }
553  }
554  }
555  }
556 
557  // fill the last bunch in train maps
558  if (bxShiftLast > -999) {
559  // muons
560  for (int itBX = std::max(MuonBxCollection->getFirstBX(), MuonBxCollection->getFirstBX() + bxShiftLast); itBX <= std::min(MuonBxCollection->getLastBX(), MuonBxCollection->getLastBX() + bxShiftLast); ++itBX) {
561  auto correctedBx = itBX - bxShiftLast;
562  if (correctedBx >= 0 and correctedBx < (int)muons_eta_phi_lastbunch.size()) {
563  for (l1t::MuonBxCollection::const_iterator muon = MuonBxCollection->begin(itBX); muon != MuonBxCollection->end(itBX); ++muon) { // Starting with Muons
564  if (muon->pt() >= muonPtCut_ and muon->hwQual() >= muonQualCut_) {
565  denominator_muons_lastbunch->Fill(muon->eta(), muon->phi());
566  muons_eta_phi_lastbunch.at(correctedBx)->Fill(muon->eta(), muon->phi());
567  }
568  }
569  }
570  }
571  // jets
572  for (int itBX = std::max(JetBxCollection->getFirstBX(), JetBxCollection->getFirstBX() + bxShiftLast); itBX <= std::min(JetBxCollection->getLastBX(), JetBxCollection->getLastBX() + bxShiftLast); ++itBX) {
573  auto correctedBx = itBX - bxShiftLast;
574  if (correctedBx >= 0 and correctedBx < (int)jet_eta_phi_lastbunch.size()) {
575  for (l1t::JetBxCollection::const_iterator jet = JetBxCollection->begin(itBX); jet != JetBxCollection->end(itBX); ++jet) {
576  if (jet->pt() >= jetPtCut_) {
577  denominator_jet_lastbunch->Fill(jet->eta(), jet->phi());
578  jet_eta_phi_lastbunch.at(correctedBx)->Fill(jet->eta(), jet->phi());
579  }
580  }
581  }
582  }
583  // egammas
584  for (int itBX = std::max(EGammaBxCollection->getFirstBX(), EGammaBxCollection->getFirstBX() + bxShiftLast); itBX <= std::min(EGammaBxCollection->getLastBX(), EGammaBxCollection->getLastBX() + bxShiftLast); ++itBX) {
585  auto correctedBx = itBX - bxShiftLast;
586  for (l1t::EGammaBxCollection::const_iterator egamma = EGammaBxCollection->begin(itBX); egamma != EGammaBxCollection->end(itBX); ++egamma) {
587  for (size_t i = 0; i < egammaPtCuts_.size(); ++i) {
588  if (egamma->pt() >= egammaPtCuts_.at(i)) {
589  if (correctedBx >= 0 and correctedBx < (int)egamma_eta_phi_lastbunch.size()) {
590  denominator_egamma_lastbunch.at(i)->Fill(egamma->eta(), egamma->phi());
591  egamma_eta_phi_lastbunch.at(i).at(correctedBx)->Fill(egamma->eta(), egamma->phi());
592  }
593  if ((bool)egamma->hwIso()) {
594  egamma_iso_bx_ieta_lastbunch.at(i)->Fill(correctedBx, egamma->hwEta());
595  }
596  egamma_noniso_bx_ieta_lastbunch.at(i)->Fill(correctedBx, egamma->hwEta());
597  }
598  }
599  }
600  }
601  // taus
602  for (int itBX = std::max(TauBxCollection->getFirstBX(), TauBxCollection->getFirstBX() + bxShiftLast); itBX <= std::min(TauBxCollection->getLastBX(), TauBxCollection->getLastBX() + bxShiftLast); ++itBX) {
603  auto correctedBx = itBX - bxShiftLast;
604  if (correctedBx >= 0 and correctedBx < (int)tau_eta_phi_lastbunch.size()) {
605  for (l1t::TauBxCollection::const_iterator tau = TauBxCollection->begin(itBX); tau != TauBxCollection->end(itBX); ++tau) {
606  if (tau->pt() >= tauPtCut_) {
607  denominator_tau_lastbunch->Fill(tau->eta(), tau->phi());
608  tau_eta_phi_lastbunch.at(correctedBx)->Fill(tau->eta(), tau->phi());
609  }
610  }
611  }
612  }
613  // etsums
614  for (int itBX = std::max(EtSumBxCollection->getFirstBX(), EtSumBxCollection->getFirstBX() + bxShiftLast); itBX <= std::min(EtSumBxCollection->getLastBX(), EtSumBxCollection->getLastBX() + bxShiftLast); ++itBX) {
615  auto correctedBx = itBX - bxShiftLast;
616  if (correctedBx >= 0) {
617  for (l1t::EtSumBxCollection::const_iterator EtSum = EtSumBxCollection->begin(itBX); EtSum != EtSumBxCollection->end(itBX); ++EtSum) {
618  if (EtSum->pt() >= etsumPtCut_) {
619  if (l1t::EtSum::EtSumType::kMissingEt == EtSum->getType()) {
620  if (correctedBx < (int)etsum_eta_phi_MET_lastbunch.size()) {
621  denominator_etsum_lastbunch_MET->Fill(EtSum->phi());
622  etsum_eta_phi_MET_lastbunch.at(correctedBx)->Fill(EtSum->phi());
623  }
624  }
625  else if (l1t::EtSum::EtSumType::kMissingEtHF == EtSum->getType()) {
626  if (correctedBx < (int)etsum_eta_phi_METHF_lastbunch.size()) {
628  etsum_eta_phi_METHF_lastbunch.at(correctedBx)->Fill(EtSum->phi());
629  }
630  }
631  else if(l1t::EtSum::EtSumType::kMissingHt == EtSum->getType()) {
632  if (correctedBx < (int)etsum_eta_phi_MHT_lastbunch.size()) {
633  denominator_etsum_lastbunch_MHT->Fill(EtSum->phi());
634  etsum_eta_phi_MHT_lastbunch.at(correctedBx)->Fill(EtSum->phi());
635  }
636  }
637  else if(l1t::EtSum::EtSumType::kMissingHtHF == EtSum->getType()) {
638  if (correctedBx < (int)etsum_eta_phi_MHTHF_lastbunch.size()) {
640  etsum_eta_phi_MHTHF_lastbunch.at(correctedBx)->Fill(EtSum->phi());
641  }
642  }
643  }
644  }
645  }
646  }
647  }
648 
649  // fill the isolated bunch
650  if (bxShiftIso > -999) {
651  // muons
652  for (int itBX = std::max(MuonBxCollection->getFirstBX(), MuonBxCollection->getFirstBX() + bxShiftIso); itBX <= std::min(MuonBxCollection->getLastBX(), MuonBxCollection->getLastBX() + bxShiftIso); ++itBX) {
653  int index = itBX - bxShiftIso - uGtAlgs->getFirstBX();
654  if (index >= 0 and index < (int)muons_eta_phi_isolated.size()) {
655  for (l1t::MuonBxCollection::const_iterator muon = MuonBxCollection->begin(itBX); muon != MuonBxCollection->end(itBX); ++muon) { // Starting with Muons
656  if (muon->pt() >= muonPtCut_ and muon->hwQual() >= muonQualCut_) {
657  denominator_muons_isolated->Fill(muon->eta(), muon->phi());
658  muons_eta_phi_isolated.at(index)->Fill(muon->eta(), muon->phi());
659  }
660  }
661  }
662  }
663  // jets
664  for (int itBX = std::max(JetBxCollection->getFirstBX(), JetBxCollection->getFirstBX() + bxShiftIso); itBX <= std::min(JetBxCollection->getLastBX(), JetBxCollection->getLastBX() + bxShiftIso); ++itBX) {
665  int index = itBX - bxShiftIso - uGtAlgs->getFirstBX();
666  if (index >= 0 and index < (int)jet_eta_phi_isolated.size()) {
667  for (l1t::JetBxCollection::const_iterator jet = JetBxCollection->begin(itBX); jet != JetBxCollection->end(itBX); ++jet) {
668  if (jet->pt() >= jetPtCut_) {
669  denominator_jet_isolated->Fill(jet->eta(), jet->phi());
670  jet_eta_phi_isolated.at(index)->Fill(jet->eta(), jet->phi());
671  }
672  }
673  }
674  }
675  // egammas
676  for (int itBX = std::max(EGammaBxCollection->getFirstBX(), EGammaBxCollection->getFirstBX() + bxShiftIso); itBX <= std::min(EGammaBxCollection->getLastBX(), EGammaBxCollection->getLastBX() + bxShiftIso); ++itBX) {
677  int index = itBX - bxShiftIso - uGtAlgs->getFirstBX();
678  for (l1t::EGammaBxCollection::const_iterator egamma = EGammaBxCollection->begin(itBX); egamma != EGammaBxCollection->end(itBX); ++egamma) {
679  for (size_t i = 0; i < egammaPtCuts_.size(); ++i) {
680  if (egamma->pt() >= egammaPtCuts_.at(i)) {
681  if (index >= 0 and index < (int)egamma_eta_phi_isolated.size()) {
682  denominator_egamma_isolated.at(i)->Fill(egamma->eta(), egamma->phi());
683  egamma_eta_phi_isolated.at(i).at(index)->Fill(egamma->eta(), egamma->phi());
684  }
685  if ((bool)egamma->hwIso()) {
686  egamma_iso_bx_ieta_isolated.at(i)->Fill(itBX - bxShiftIso, egamma->hwEta());
687  }
688  egamma_noniso_bx_ieta_isolated.at(i)->Fill(itBX - bxShiftIso, egamma->hwEta());
689  }
690  }
691  }
692  }
693  // taus
694  for (int itBX = std::max(TauBxCollection->getFirstBX(), TauBxCollection->getFirstBX() + bxShiftIso); itBX <= std::min(TauBxCollection->getLastBX(), TauBxCollection->getLastBX() + bxShiftIso); ++itBX) {
695  int index = itBX - bxShiftIso - uGtAlgs->getFirstBX();
696  if (index >= 0 and index < (int)tau_eta_phi_isolated.size()) {
697  for (l1t::TauBxCollection::const_iterator tau = TauBxCollection->begin(itBX); tau != TauBxCollection->end(itBX); ++tau) {
698  if (tau->pt() >= tauPtCut_) {
699  denominator_tau_isolated->Fill(tau->eta(), tau->phi());
700  tau_eta_phi_isolated.at(index)->Fill(tau->eta(), tau->phi());
701  }
702  }
703  }
704  }
705  // etsums
706  for (int itBX = std::max(EtSumBxCollection->getFirstBX(), EtSumBxCollection->getFirstBX() + bxShiftIso); itBX <= std::min(EtSumBxCollection->getLastBX(), EtSumBxCollection->getLastBX() + bxShiftIso); ++itBX) {
707  int index = itBX - bxShiftIso - uGtAlgs->getFirstBX();
708  if (index >= 0) {
709  for (l1t::EtSumBxCollection::const_iterator EtSum = EtSumBxCollection->begin(itBX); EtSum != EtSumBxCollection->end(itBX); ++EtSum) {
710  if (EtSum->pt() >= etsumPtCut_) {
711  if (l1t::EtSum::EtSumType::kMissingEt == EtSum->getType()) {
712  if (index < (int)etsum_eta_phi_MET_isolated.size()) {
713  denominator_etsum_isolated_MET->Fill(EtSum->phi());
714  etsum_eta_phi_MET_isolated.at(index)->Fill(EtSum->phi());
715  }
716  }
717  else if (l1t::EtSum::EtSumType::kMissingEtHF == EtSum->getType()) {
718  if (index < (int)etsum_eta_phi_METHF_isolated.size()) {
719  denominator_etsum_isolated_METHF->Fill(EtSum->phi());
720  etsum_eta_phi_METHF_isolated.at(index)->Fill(EtSum->phi());
721  }
722  }
723  else if(l1t::EtSum::EtSumType::kMissingHt == EtSum->getType()) {
724  if (index < (int)etsum_eta_phi_MHT_isolated.size()) {
725  denominator_etsum_isolated_MHT->Fill(EtSum->phi());
726  etsum_eta_phi_MHT_isolated.at(index)->Fill(EtSum->phi());
727  }
728  }
729  else if(l1t::EtSum::EtSumType::kMissingHtHF == EtSum->getType()) {
730  if (index < (int)etsum_eta_phi_MHTHF_isolated.size()) {
731  denominator_etsum_isolated_MHTHF->Fill(EtSum->phi());
732  etsum_eta_phi_MHTHF_isolated.at(index)->Fill(EtSum->phi());
733  }
734  }
735  }
736  }
737  }
738  }
739  }
740 }
741 
MonitorElement * denominator_etsum_METHF
BXVector< EGamma > EGammaBxCollection
Definition: EGamma.h:11
const_iterator end(int bx) const
std::vector< MonitorElement * > jet_eta_phi_firstbunch
void setComment(std::string const &value)
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * denominator_etsum_lastbunch_MHT
edm::EDGetTokenT< l1t::EGammaBxCollection > stage2CaloLayer2EGammaToken_
MonitorElement * denominator_muons_isolated
edm::EDGetTokenT< GlobalAlgBlkBxCollection > l1tStage2uGtProducer_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< MonitorElement * > etsum_eta_phi_MET_isolated
std::vector< MonitorElement * > etsum_eta_phi_METHF_isolated
std::vector< MonitorElement * > muons_eta_phi_isolated
MonitorElement * denominator_etsum_MET
std::vector< MonitorElement * > egamma_eta_phi
std::vector< std::vector< MonitorElement * > > egamma_eta_phi_lastbunch
MonitorElement * denominator_etsum_isolated_MHTHF
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
MonitorElement * denominator_muons_firstbunch
std::vector< MonitorElement * > jet_eta_phi_lastbunch
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
std::vector< MonitorElement * > tau_eta_phi_lastbunch
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< MonitorElement * > denominator_egamma_isolated
MonitorElement * denominator_etsum_MHT
const unsigned int bxrange_
def replace(string, replacements)
delete x;
Definition: CaloConfig.h:22
BXVector< Tau > TauBxCollection
Definition: Tau.h:11
std::vector< MonitorElement * > etsum_eta_phi_MET_firstbunch
MonitorElement * denominator_etsum_isolated_METHF
std::vector< std::vector< MonitorElement * > > egamma_eta_phi_isolated
std::vector< MonitorElement * > egamma_iso_bx_ieta_firstbunch
MonitorElement * denominator_tau_isolated
std::vector< MonitorElement * > etsum_eta_phi_MHT_lastbunch
MonitorElement * denominator_etsum_firstbunch_MET
void Fill(long long x)
MonitorElement * denominator_etsum_firstbunch_MHT
std::vector< MonitorElement * > muons_eta_phi_lastbunch
MonitorElement * denominator_etsum_MHTHF
std::vector< MonitorElement * > etsum_eta_phi_MHT
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
BXVector< EtSum > EtSumBxCollection
Definition: EtSum.h:11
MonitorElement * denominator_egamma
std::vector< MonitorElement * > etsum_eta_phi_MET_lastbunch
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
Definition: Muon.py:1
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< MonitorElement * > denominator_egamma_firstbunch
MonitorElement * denominator_tau_lastbunch
std::vector< MonitorElement * > jet_eta_phi
std::vector< MonitorElement * > etsum_eta_phi_METHF_firstbunch
std::vector< MonitorElement * > etsum_eta_phi_MHTHF_isolated
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
L1TObjectsTiming(const edm::ParameterSet &ps)
edm::EDGetTokenT< l1t::MuonBxCollection > ugmtMuonToken_
MonitorElement * denominator_tau_firstbunch
std::vector< std::vector< MonitorElement * > > egamma_eta_phi_firstbunch
const std::string algoNameIsoBx_
MonitorElement * denominator_etsum_lastbunch_MHTHF
MonitorElement * denominator_muons
std::vector< MonitorElement * > muons_eta_phi_firstbunch
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< MonitorElement * > egamma_noniso_bx_ieta_lastbunch
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< MonitorElement * > etsum_eta_phi_MHTHF_lastbunch
edm::EDGetTokenT< l1t::EtSumBxCollection > stage2CaloLayer2EtSumToken_
unsigned int useAlgoDecision_
edm::EDGetTokenT< l1t::JetBxCollection > stage2CaloLayer2JetToken_
edm::EDGetTokenT< l1t::TauBxCollection > stage2CaloLayer2TauToken_
std::vector< MonitorElement * > egamma_noniso_bx_ieta_firstbunch
std::vector< MonitorElement * > tau_eta_phi_isolated
std::vector< MonitorElement * > etsum_eta_phi_METHF
std::vector< MonitorElement * > etsum_eta_phi_MHTHF
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
std::vector< MonitorElement * > etsum_eta_phi_MHTHF_firstbunch
std::vector< MonitorElement * > tau_eta_phi
int getFirstBX() const
BXVector< Jet > JetBxCollection
Definition: Jet.h:11
MonitorElement * denominator_etsum_firstbunch_METHF
MonitorElement * denominator_jet_lastbunch
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::string monitorDir_
MonitorElement * denominator_jet
std::vector< double > egammaPtCuts_
std::vector< MonitorElement * > egamma_noniso_bx_ieta_isolated
std::vector< MonitorElement * > etsum_eta_phi_MHT_isolated
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< MonitorElement * > etsum_eta_phi_METHF_lastbunch
std::vector< MonitorElement * > egamma_iso_bx_ieta_lastbunch
MonitorElement * denominator_muons_lastbunch
const std::string algoNameLastBxInTrain_
std::vector< MonitorElement * > etsum_eta_phi_MET
MonitorElement * denominator_tau
~L1TObjectsTiming() override
std::vector< MonitorElement * > jet_eta_phi_isolated
std::vector< MonitorElement * > egamma_iso_bx_ieta_isolated
HLT enums.
MonitorElement * denominator_etsum_isolated_MET
MonitorElement * denominator_etsum_firstbunch_MHTHF
int getLastBX() const
std::vector< MonitorElement * > denominator_egamma_lastbunch
std::vector< MonitorElement * > muons_eta_phi
MonitorElement * denominator_etsum_lastbunch_METHF
MonitorElement * denominator_etsum_isolated_MHT
const std::string algoNameFirstBxInTrain_
std::vector< MonitorElement * > etsum_eta_phi_MHT_firstbunch
const_iterator begin(int bx) const
std::shared_ptr< l1t::L1TGlobalUtil > gtUtil_
MonitorElement * denominator_jet_firstbunch
MonitorElement * denominator_jet_isolated
Definition: Run.h:45
MonitorElement * denominator_etsum_lastbunch_MET
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:20
std::vector< MonitorElement * > tau_eta_phi_firstbunch