File indexing completed on 2024-09-07 04:36:00
0001 #ifndef DPGAnalysis_SiStripTools_DigiBXCorrHistogramMaker_H
0002 #define DPGAnalysis_SiStripTools_DigiBXCorrHistogramMaker_H
0003
0004 #include <map>
0005 #include <string>
0006 #include "FWCore/Framework/interface/ConsumesCollector.h"
0007 #include "DPGAnalysis/SiStripTools/interface/RunHistogramManager.h"
0008
0009 #include "TH2F.h"
0010 #include "TH3F.h"
0011 #include "TProfile.h"
0012 #include "TProfile2D.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "DataFormats/Common/interface/Handle.h"
0018 #include "DPGAnalysis/SiStripTools/interface/APVCyclePhaseCollection.h"
0019
0020 #include "DPGAnalysis/SiStripTools/interface/SiStripTKNumbers.h"
0021
0022 template <class T>
0023 class DigiBXCorrHistogramMaker {
0024 public:
0025 DigiBXCorrHistogramMaker(edm::ConsumesCollector&& iC, const int ncorbins = 1000);
0026 DigiBXCorrHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC);
0027
0028 ~DigiBXCorrHistogramMaker() {}
0029
0030 void book(const char* dirname, const std::map<int, std::string>& labels);
0031 void beginRun(const unsigned int nrun);
0032 void fill(const T& he, const std::map<int, int>& ndigi, const edm::Handle<APVCyclePhaseCollection>& phase);
0033 void fillcorr(const T& he1, const T& he2, const std::map<int, int>& ndigi);
0034
0035 private:
0036 int m_ncorbins;
0037 std::string m_hitname;
0038 const bool m_dbx3Histo;
0039 const bool m_dbx3Histo3D;
0040 const bool m_runHisto;
0041
0042 std::map<int, std::string> m_labels;
0043 std::map<unsigned int, int> m_binmax;
0044 std::map<int, std::string> m_phasepart;
0045 std::vector<int> m_scalefact;
0046 const int m_nbins;
0047
0048 RunHistogramManager m_rhm;
0049
0050 std::map<int, TProfile*> m_ndigivsdbx;
0051 std::map<int, TProfile*> m_ndigivsdbxzoom2;
0052 std::map<int, TProfile*> m_ndigivsdbxzoom;
0053
0054 std::map<int, TProfile*> m_ndigivsdbxincycle;
0055 std::map<int, TH2F*> m_ndigivsdbxincycle2D;
0056
0057 std::map<int, TProfile*> m_nmeandigivscycle;
0058
0059 std::map<int, TH2F*> m_ndigivscycle;
0060 std::map<int, TH2F*> m_ndigivscyclezoom;
0061 std::map<int, TH2F*> m_ndigivscyclezoom2;
0062
0063 std::map<int, TProfile*> m_ndigivsbx;
0064 std::map<int, TH2F*> m_ndigivsbx2D;
0065 std::map<int, TH2F*> m_ndigivsbx2Dzoom;
0066 std::map<int, TH2F*> m_ndigivsbx2Dzoom2;
0067
0068 std::map<int, TProfile2D*> m_ndigivscycledbx;
0069
0070 std::map<int, TProfile2D*> m_ndigivscycle2dbx;
0071
0072 std::map<int, TProfile2D**> m_ndigivscycletime;
0073
0074 std::map<int, TH2F*> m_ndigivsdbx2D;
0075 std::map<int, TH2F*> m_ndigivsdbx2Dzoom2;
0076 std::map<int, TH2F*> m_ndigivsdbx2Dzoom;
0077
0078 std::map<int, TProfile2D*> m_ndigivsdbx3zoom;
0079 std::map<int, TProfile2D*> m_ndigivsdbxincycle3;
0080 std::map<int, TH3F*> m_ndigivsdbxincycle33D;
0081
0082 std::map<int, TProfile*> m_digicorr;
0083 };
0084
0085 template <class T>
0086 DigiBXCorrHistogramMaker<T>::DigiBXCorrHistogramMaker(edm::ConsumesCollector&& iC, const int ncorbins)
0087 : m_ncorbins(ncorbins),
0088 m_hitname("digi"),
0089 m_dbx3Histo(false),
0090 m_dbx3Histo3D(false),
0091 m_runHisto(true),
0092 m_labels(),
0093 m_binmax(),
0094 m_phasepart(),
0095 m_scalefact(),
0096 m_nbins(200),
0097 m_rhm(iC) {}
0098
0099 template <class T>
0100 DigiBXCorrHistogramMaker<T>::DigiBXCorrHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC)
0101 : m_ncorbins(iConfig.getUntrackedParameter<int>("corrNbins")),
0102 m_hitname(iConfig.getUntrackedParameter<std::string>("hitName", "digi")),
0103 m_dbx3Histo(iConfig.getUntrackedParameter<bool>("dbx3Histo", false)),
0104 m_dbx3Histo3D(iConfig.getUntrackedParameter<bool>("dbx3Histo3D", false)),
0105 m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto", true)),
0106 m_labels(),
0107 m_scalefact(iConfig.getUntrackedParameter<std::vector<int> >("scaleFactors", std::vector<int>(1, 5))),
0108 m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins", 200)),
0109 m_rhm(iC) {
0110 std::vector<edm::ParameterSet> wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >(
0111 "wantedSubDets", std::vector<edm::ParameterSet>()));
0112
0113 for (std::vector<edm::ParameterSet>::iterator ps = wantedsubds.begin(); ps != wantedsubds.end(); ++ps) {
0114 m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
0115 m_phasepart[ps->getParameter<unsigned int>("detSelection")] =
0116 ps->getUntrackedParameter<std::string>("phasePartition", "None");
0117 }
0118 }
0119
0120 template <class T>
0121 void DigiBXCorrHistogramMaker<T>::book(const char* dirname, const std::map<int, std::string>& labels) {
0122 m_labels = labels;
0123
0124 edm::Service<TFileService> tfserv;
0125 TFileDirectory subev = tfserv->mkdir(dirname);
0126
0127 SiStripTKNumbers trnumb;
0128
0129 edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
0130 edm::LogInfo("ScaleFactors") << "x-axis range scale factors: ";
0131 for (std::vector<int>::const_iterator sf = m_scalefact.begin(); sf != m_scalefact.end(); ++sf) {
0132 edm::LogVerbatim("ScaleFactors") << *sf;
0133 }
0134 edm::LogInfo("BinMaxValue") << "Setting bin max values";
0135
0136 for (std::map<int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
0137 const int i = lab->first;
0138 const std::string slab = lab->second;
0139 const unsigned int ui = i;
0140
0141 if (m_binmax.find(ui) == m_binmax.end()) {
0142 edm::LogVerbatim("NotConfiguredBinMax")
0143 << "Bin max for " << lab->second << " not configured: " << trnumb.nstrips(i) << " used";
0144 m_binmax[ui] = trnumb.nstrips(i);
0145 }
0146
0147 edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[ui];
0148 }
0149
0150 edm::LogInfo("PhasePartitions") << "Partitions for APV Cycle Phase";
0151
0152 for (std::map<int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
0153 const int i = lab->first;
0154 const std::string slab = lab->second;
0155 const unsigned int ui = i;
0156 edm::LogVerbatim("PhasePartitions") << "Partition for " << lab->second << " is "
0157 << ((m_phasepart.find(ui) != m_phasepart.end()) ? m_phasepart[ui]
0158 : "not found");
0159 }
0160
0161 for (std::map<int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
0162 const int i = lab->first;
0163 const std::string slab = lab->second;
0164 const unsigned int ui = i;
0165
0166 char name[200];
0167 char title[500];
0168
0169
0170
0171 if (!m_scalefact.empty()) {
0172 sprintf(title, "%s %s multiplicity vs BX separation", slab.c_str(), m_hitname.c_str());
0173 sprintf(name, "n%sdigivsdbx2D", slab.c_str());
0174 m_ndigivsdbx2D[i] = subev.make<TH2F>(
0175 name, title, 1000, -0.5, 500000 - 0.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[0] * m_nbins)) * m_nbins);
0176 sprintf(name, "n%sdigivsdbx2Dzoom2", slab.c_str());
0177 m_ndigivsdbx2Dzoom2[i] = subev.make<TH2F>(
0178 name, title, 1000, -0.5, 50000 - 0.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[0] * m_nbins)) * m_nbins);
0179 sprintf(name, "n%sdigivsdbx2Dzoom", slab.c_str());
0180 m_ndigivsdbx2Dzoom[i] = subev.make<TH2F>(
0181 name, title, 1000, -0.5, 999.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[0] * m_nbins)) * m_nbins);
0182
0183 m_ndigivsdbx2D[i]->GetXaxis()->SetTitle("#DeltaBX");
0184 m_ndigivsdbx2D[i]->GetYaxis()->SetTitle("Number of Hits");
0185 m_ndigivsdbx2Dzoom2[i]->GetXaxis()->SetTitle("#DeltaBX");
0186 m_ndigivsdbx2Dzoom2[i]->GetYaxis()->SetTitle("Number of Hits");
0187 m_ndigivsdbx2Dzoom[i]->GetXaxis()->SetTitle("#DeltaBX");
0188 m_ndigivsdbx2Dzoom[i]->GetYaxis()->SetTitle("Number of Hits");
0189 }
0190
0191 sprintf(title, "%s %s multiplicity vs BX separation", slab.c_str(), m_hitname.c_str());
0192 sprintf(name, "n%sdigivsdbx", slab.c_str());
0193 m_ndigivsdbx[i] = subev.make<TProfile>(name, title, 1000, -0.5, 500000. - 0.5);
0194 sprintf(name, "n%sdigivsdbxzoom2", slab.c_str());
0195 m_ndigivsdbxzoom2[i] = subev.make<TProfile>(name, title, 1000, -0.5, 50000. - 0.5);
0196 sprintf(name, "n%sdigivsdbxzoom", slab.c_str());
0197 m_ndigivsdbxzoom[i] = subev.make<TProfile>(name, title, 1000, -0.5, 999.5);
0198 m_ndigivsdbx[i]->GetXaxis()->SetTitle("#DeltaBX");
0199 m_ndigivsdbx[i]->GetYaxis()->SetTitle("Number of Hits");
0200 m_ndigivsdbxzoom2[i]->GetXaxis()->SetTitle("#DeltaBX");
0201 m_ndigivsdbxzoom2[i]->GetYaxis()->SetTitle("Number of Hits");
0202 m_ndigivsdbxzoom[i]->GetXaxis()->SetTitle("#DeltaBX");
0203 m_ndigivsdbxzoom[i]->GetYaxis()->SetTitle("Number of Hits");
0204
0205 sprintf(name, "n%sdigivsdbx3zoom", slab.c_str());
0206 sprintf(title, "%s %s multiplicity vs Triplets BX separation", slab.c_str(), m_hitname.c_str());
0207 m_ndigivsdbx3zoom[i] = subev.make<TProfile2D>(name, title, 100, -0.5, 999.5, 100, -0.5, 999.5);
0208 m_ndigivsdbx3zoom[i]->GetXaxis()->SetTitle("#DeltaBX(n,n-1)");
0209 m_ndigivsdbx3zoom[i]->GetYaxis()->SetTitle("#DeltaBX(n,n-2)");
0210
0211 sprintf(name, "%sdigicorr", slab.c_str());
0212 sprintf(title, "%s %s DBX correlation", slab.c_str(), m_hitname.c_str());
0213 m_digicorr[i] = subev.make<TProfile>(name, title, m_ncorbins, -0.5, m_ncorbins - 0.5);
0214 m_digicorr[i]->GetXaxis()->SetTitle("#DeltaBX");
0215 m_digicorr[i]->GetYaxis()->SetTitle("Number of Hits");
0216
0217
0218
0219 if (!m_scalefact.empty()) {
0220 if (m_phasepart.find(ui) != m_phasepart.end() && m_phasepart[ui] != "None") {
0221 sprintf(name, "n%sdigivsdbxincycle", slab.c_str());
0222 sprintf(title, "%s %s multiplicity vs BX separation w.r.t. cycle", slab.c_str(), m_hitname.c_str());
0223 m_ndigivsdbxincycle[i] = subev.make<TProfile>(name, title, 1000, -0.5, 999.5);
0224 m_ndigivsdbxincycle[i]->GetXaxis()->SetTitle("#DeltaBX w.r.t. cycle");
0225 m_ndigivsdbxincycle[i]->GetYaxis()->SetTitle("Number of Hits");
0226
0227 sprintf(name, "n%sdigivsdbxincycle2D", slab.c_str());
0228 sprintf(title, "%s %s multiplicity vs BX separation w.r.t. cycle", slab.c_str(), m_hitname.c_str());
0229 m_ndigivsdbxincycle2D[i] = subev.make<TH2F>(
0230 name, title, 1000, -0.5, 999.5, m_nbins, 0., (1 + m_binmax[ui] / (m_scalefact[0] * m_nbins)) * m_nbins);
0231 m_ndigivsdbxincycle2D[i]->GetXaxis()->SetTitle("#DeltaBX w.r.t. cycle");
0232 m_ndigivsdbxincycle2D[i]->GetYaxis()->SetTitle("Number of Hits");
0233
0234 if (m_dbx3Histo) {
0235 sprintf(name, "n%sdigivsdbxincycle3", slab.c_str());
0236 sprintf(title, "%s %s multiplicity vs Triplets BX separation w.r.t. cycle", slab.c_str(), m_hitname.c_str());
0237 m_ndigivsdbxincycle3[i] = subev.make<TProfile2D>(name, title, 2000, -0.5, 1999.5, 30, -0.5, 2099.5);
0238 m_ndigivsdbxincycle3[i]->GetXaxis()->SetTitle("#DeltaBX(n,n-1)");
0239 m_ndigivsdbxincycle3[i]->GetYaxis()->SetTitle("#DeltaBX(n,n-2)-#DeltaBX(n,n-1)");
0240
0241 if (m_dbx3Histo3D) {
0242 sprintf(name, "n%sdigivsdbxincycle33D", slab.c_str());
0243 sprintf(
0244 title, "%s %s multiplicity vs Triplets BX separation w.r.t. cycle", slab.c_str(), m_hitname.c_str());
0245 m_ndigivsdbxincycle33D[i] = subev.make<TH3F>(name,
0246 title,
0247 2000,
0248 -0.5,
0249 1999.5,
0250 30,
0251 -0.5,
0252 2099.5,
0253 50,
0254 0.,
0255 (1 + m_binmax[ui] / (m_scalefact[0] * 50)) * 50);
0256 m_ndigivsdbxincycle33D[i]->GetXaxis()->SetTitle("#DeltaBX(n,n-1)");
0257 m_ndigivsdbxincycle33D[i]->GetYaxis()->SetTitle("#DeltaBX(n,n-2)-#DeltaBX(n,n-1)");
0258 }
0259 }
0260 }
0261 }
0262
0263
0264
0265 if (m_phasepart.find(ui) != m_phasepart.end() && m_phasepart[ui] != "None") {
0266 sprintf(title, "%s Mean %s multiplicity vs BX mod(70)", slab.c_str(), m_hitname.c_str());
0267 sprintf(name, "n%smeandigivscycle", slab.c_str());
0268 m_nmeandigivscycle[i] = subev.make<TProfile>(name, title, 70, -0.5, 69.5);
0269 m_nmeandigivscycle[i]->GetXaxis()->SetTitle("absolute BX mod(70)");
0270 m_nmeandigivscycle[i]->GetYaxis()->SetTitle("Mean number of Hits");
0271
0272 sprintf(title, "%s %s multiplicity vs BX mod(70)", slab.c_str(), m_hitname.c_str());
0273
0274 if (!m_scalefact.empty()) {
0275 sprintf(name, "n%sdigivscycle", slab.c_str());
0276 m_ndigivscycle[i] = subev.make<TH2F>(
0277 name, title, 70, -0.5, 69.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[0] * m_nbins)) * m_nbins);
0278 m_ndigivscycle[i]->GetXaxis()->SetTitle("absolute BX mod(70)");
0279 m_ndigivscycle[i]->GetYaxis()->SetTitle("Number of Hits");
0280 }
0281 if (m_scalefact.size() >= 2) {
0282 sprintf(name, "n%sdigivscyclezoom", slab.c_str());
0283 m_ndigivscyclezoom[i] = subev.make<TH2F>(
0284 name, title, 70, -0.5, 69.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[1] * m_nbins)) * m_nbins);
0285 m_ndigivscyclezoom[i]->GetXaxis()->SetTitle("absolute BX mod(70)");
0286 m_ndigivscyclezoom[i]->GetYaxis()->SetTitle("Number of Hits");
0287 }
0288 if (m_scalefact.size() >= 3) {
0289 sprintf(name, "n%sdigivscyclezoom2", slab.c_str());
0290 m_ndigivscyclezoom2[i] = subev.make<TH2F>(
0291 name, title, 70, -0.5, 69.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[2] * m_nbins)) * m_nbins);
0292 m_ndigivscyclezoom2[i]->GetXaxis()->SetTitle("absolute BX mod(70)");
0293 m_ndigivscyclezoom2[i]->GetYaxis()->SetTitle("Number of Hits");
0294 }
0295
0296 sprintf(name, "n%sdigivscycledbx", slab.c_str());
0297 sprintf(title, "%s %s multiplicity vs BX mod(70) and DBX", slab.c_str(), m_hitname.c_str());
0298 m_ndigivscycledbx[i] = subev.make<TProfile2D>(name, title, 70, -0.5, 69.5, 1000, -0.5, 999.5);
0299 m_ndigivscycledbx[i]->GetXaxis()->SetTitle("Event 1 BX mod(70)");
0300 m_ndigivscycledbx[i]->GetYaxis()->SetTitle("#DeltaBX event 2-1");
0301
0302 sprintf(name, "n%sdigivscycle2dbx", slab.c_str());
0303 sprintf(title, "%s %s multiplicity vs BX mod(70) and DBX", slab.c_str(), m_hitname.c_str());
0304 m_ndigivscycle2dbx[i] = subev.make<TProfile2D>(name, title, 70, -0.5, 69.5, 1000, -0.5, 999.5);
0305 m_ndigivscycle2dbx[i]->GetXaxis()->SetTitle("Event 2 BX mod(70)");
0306 m_ndigivscycle2dbx[i]->GetYaxis()->SetTitle("#DeltaBX event 2-1");
0307 }
0308
0309
0310
0311 if (m_runHisto) {
0312 sprintf(name, "n%sdigivscycletime", slab.c_str());
0313 sprintf(title, "%s %s multiplicity vs BX mod(70) and Orbit", slab.c_str(), m_hitname.c_str());
0314 m_ndigivscycletime[i] = m_rhm.makeTProfile2D(name, title, 70, -0.5, 69.5, 90, 0., 90 * 262144);
0315
0316
0317 }
0318
0319
0320
0321 sprintf(title, "%s %s mean multiplicity vs BX", slab.c_str(), m_hitname.c_str());
0322 sprintf(name, "n%sdigivsbx", slab.c_str());
0323 m_ndigivsbx[i] = subev.make<TProfile>(name, title, 3564, -0.5, 3563.5);
0324 m_ndigivsbx[i]->GetXaxis()->SetTitle("BX#");
0325 m_ndigivsbx[i]->GetYaxis()->SetTitle("Mean Number of Hits");
0326
0327 sprintf(title, "%s %s multiplicity vs BX", slab.c_str(), m_hitname.c_str());
0328
0329 if (!m_scalefact.empty()) {
0330 sprintf(name, "n%sdigivsbx2D", slab.c_str());
0331 m_ndigivsbx2D[i] = subev.make<TH2F>(
0332 name, title, 3564, -0.5, 3563.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[0] * m_nbins)) * m_nbins);
0333 m_ndigivsbx2D[i]->GetXaxis()->SetTitle("BX#");
0334 m_ndigivsbx2D[i]->GetYaxis()->SetTitle("Number of Hits");
0335 }
0336 if (m_scalefact.size() >= 2) {
0337 sprintf(name, "n%sdigivsbx2Dzoom", slab.c_str());
0338 m_ndigivsbx2Dzoom[i] = subev.make<TH2F>(
0339 name, title, 3564, -0.5, 3563.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[1] * m_nbins)) * m_nbins);
0340 m_ndigivsbx2Dzoom[i]->GetXaxis()->SetTitle("BX#");
0341 m_ndigivsbx2Dzoom[i]->GetYaxis()->SetTitle("Number of Hits");
0342 }
0343 if (m_scalefact.size() >= 3) {
0344 sprintf(name, "n%sdigivsbx2Dzoom2", slab.c_str());
0345 m_ndigivsbx2Dzoom2[i] = subev.make<TH2F>(
0346 name, title, 3564, -0.5, 3563.5, m_nbins, 0, (1 + m_binmax[ui] / (m_scalefact[2] * m_nbins)) * m_nbins);
0347 m_ndigivsbx2Dzoom2[i]->GetXaxis()->SetTitle("BX#");
0348 m_ndigivsbx2Dzoom2[i]->GetYaxis()->SetTitle("Number of Hits");
0349 }
0350 }
0351 }
0352
0353 template <class T>
0354 void DigiBXCorrHistogramMaker<T>::beginRun(const unsigned int nrun) {
0355 m_rhm.beginRun(nrun);
0356
0357 for (std::map<int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
0358 const int i = lab->first;
0359 if (m_runHisto) {
0360 if (m_ndigivscycletime[i]) {
0361 (*m_ndigivscycletime[i])->GetXaxis()->SetTitle("Event 1 BX mod(70)");
0362 (*m_ndigivscycletime[i])->GetYaxis()->SetTitle("time [Orb#]");
0363 (*m_ndigivscycletime[i])->SetCanExtend(TH1::kAllAxes);
0364 }
0365 }
0366 }
0367 }
0368
0369 template <class T>
0370 void DigiBXCorrHistogramMaker<T>::fill(const T& he,
0371 const std::map<int, int>& ndigi,
0372 const edm::Handle<APVCyclePhaseCollection>& phase) {
0373 for (std::map<int, int>::const_iterator digi = ndigi.begin(); digi != ndigi.end(); digi++) {
0374 if (m_labels.find(digi->first) != m_labels.end()) {
0375 const int i = digi->first;
0376 const unsigned int ui = i;
0377
0378 int thephase = APVCyclePhaseCollection::invalid;
0379 if (m_phasepart.find(ui) != m_phasepart.end() && m_phasepart[ui] != "None") {
0380 if (!phase.failedToGet() && phase.isValid()) {
0381 thephase = phase->getPhase(m_phasepart[ui]);
0382 }
0383 }
0384
0385 long long tbx = he.absoluteBX();
0386 if (thephase != APVCyclePhaseCollection::nopartition && thephase != APVCyclePhaseCollection::multiphase &&
0387 thephase != APVCyclePhaseCollection::invalid) {
0388 tbx -= thephase;
0389
0390 if (m_nmeandigivscycle.find(i) != m_nmeandigivscycle.end())
0391 m_nmeandigivscycle[i]->Fill(tbx % 70, digi->second);
0392
0393 if (m_ndigivscycle.find(i) != m_ndigivscycle.end())
0394 m_ndigivscycle[i]->Fill(tbx % 70, digi->second);
0395 if (m_ndigivscyclezoom.find(i) != m_ndigivscyclezoom.end())
0396 m_ndigivscyclezoom[i]->Fill(tbx % 70, digi->second);
0397 if (m_ndigivscyclezoom2.find(i) != m_ndigivscyclezoom2.end())
0398 m_ndigivscyclezoom2[i]->Fill(tbx % 70, digi->second);
0399 }
0400
0401 if (m_runHisto) {
0402 if (m_ndigivscycletime.find(i) != m_ndigivscycletime.end()) {
0403 if (m_ndigivscycletime[i] != nullptr && (*m_ndigivscycletime[i]) != nullptr)
0404 (*m_ndigivscycletime[i])->Fill(tbx % 70, (int)he._orbit, digi->second);
0405 }
0406 }
0407
0408 m_ndigivsbx[i]->Fill(he.bx() % 3564, digi->second);
0409 if (m_ndigivsbx2D.find(i) != m_ndigivsbx2D.end())
0410 m_ndigivsbx2D[i]->Fill(he.bx() % 3564, digi->second);
0411 if (m_ndigivsbx2Dzoom.find(i) != m_ndigivsbx2Dzoom.end())
0412 m_ndigivsbx2Dzoom[i]->Fill(he.bx() % 3564, digi->second);
0413 if (m_ndigivsbx2Dzoom2.find(i) != m_ndigivsbx2Dzoom2.end())
0414 m_ndigivsbx2Dzoom2[i]->Fill(he.bx() % 3564, digi->second);
0415
0416 if (he.depth() > 0) {
0417 long long dbx = he.deltaBX();
0418
0419 m_ndigivsdbx[i]->Fill(dbx, digi->second);
0420 m_ndigivsdbxzoom[i]->Fill(dbx, digi->second);
0421 m_ndigivsdbxzoom2[i]->Fill(dbx, digi->second);
0422
0423 if (m_ndigivsdbx2D.find(i) != m_ndigivsdbx2D.end())
0424 m_ndigivsdbx2D[i]->Fill(dbx, digi->second);
0425 if (m_ndigivsdbx2Dzoom.find(i) != m_ndigivsdbx2Dzoom.end())
0426 m_ndigivsdbx2Dzoom[i]->Fill(dbx, digi->second);
0427 if (m_ndigivsdbx2Dzoom2.find(i) != m_ndigivsdbx2Dzoom2.end())
0428 m_ndigivsdbx2Dzoom2[i]->Fill(dbx, digi->second);
0429
0430 long long prevtbx = he.absoluteBX(1);
0431 if (thephase != APVCyclePhaseCollection::nopartition && thephase != APVCyclePhaseCollection::multiphase &&
0432 thephase != APVCyclePhaseCollection::invalid) {
0433 long long dbxincycle = he.deltaBXinCycle(thephase);
0434 if (m_ndigivsdbxincycle2D.find(i) != m_ndigivsdbxincycle2D.end())
0435 m_ndigivsdbxincycle2D[i]->Fill(dbxincycle, digi->second);
0436 if (m_ndigivsdbxincycle.find(i) != m_ndigivsdbxincycle.end())
0437 m_ndigivsdbxincycle[i]->Fill(dbxincycle, digi->second);
0438
0439 prevtbx -= thephase;
0440 if (m_ndigivscycledbx.find(i) != m_ndigivscycledbx.end())
0441 m_ndigivscycledbx[i]->Fill(prevtbx % 70, dbx, digi->second);
0442 if (m_ndigivscycle2dbx.find(i) != m_ndigivscycle2dbx.end())
0443 m_ndigivscycle2dbx[i]->Fill(tbx % 70, dbx, digi->second);
0444 }
0445
0446 if (he.depth() > 1) {
0447 long long dbx2 = he.deltaBX(2);
0448 m_ndigivsdbx3zoom[i]->Fill(dbx2, dbx, digi->second);
0449
0450 if (thephase != APVCyclePhaseCollection::nopartition && thephase != APVCyclePhaseCollection::multiphase &&
0451 thephase != APVCyclePhaseCollection::invalid) {
0452 long long dbxincycle = he.deltaBXinCycle(thephase);
0453 long long dbxincycle2 = he.deltaBXinCycle(2, thephase);
0454 if (m_dbx3Histo) {
0455 if (m_ndigivsdbxincycle3.find(i) != m_ndigivsdbxincycle3.end())
0456 m_ndigivsdbxincycle3[i]->Fill(dbxincycle, dbxincycle2 - dbxincycle, digi->second);
0457 if (m_dbx3Histo3D) {
0458 if (m_ndigivsdbxincycle33D.find(i) != m_ndigivsdbxincycle33D.end())
0459 m_ndigivsdbxincycle33D[i]->Fill(dbxincycle, dbxincycle2 - dbxincycle, digi->second);
0460 }
0461 }
0462 }
0463 }
0464 }
0465
0466 } else {
0467 edm::LogWarning("MissingKey") << " Key " << digi->first << " is missing ";
0468 }
0469 }
0470 }
0471
0472 template <class T>
0473 void DigiBXCorrHistogramMaker<T>::fillcorr(const T& he1, const T& he2, const std::map<int, int>& ndigi) {
0474 for (std::map<int, int>::const_iterator digi = ndigi.begin(); digi != ndigi.end(); digi++) {
0475 if (m_labels.find(digi->first) != m_labels.end()) {
0476 const int i = digi->first;
0477
0478 long long dbx = he2.deltaBX(he1);
0479 m_digicorr[i]->Fill(dbx, digi->second);
0480
0481 } else {
0482 edm::LogWarning("MissingKey") << " Key " << digi->first << " is missing ";
0483 }
0484 }
0485 }
0486
0487 #endif