CMS 3D CMS Logo

L1TdeGEMTPG.cc
Go to the documentation of this file.
1 #include <string>
2 
4 
6  : data_token_(consumes<GEMPadDigiClusterCollection>(ps.getParameter<edm::InputTag>("data"))),
7  emul_token_(consumes<GEMPadDigiClusterCollection>(ps.getParameter<edm::InputTag>("emul"))),
8  monitorDir_(ps.getParameter<std::string>("monitorDir")),
9  verbose_(ps.getParameter<bool>("verbose")),
10 
11  chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
12  dataEmul_(ps.getParameter<std::vector<std::string>>("dataEmul")),
13 
14  // variables
15  clusterVars_(ps.getParameter<std::vector<std::string>>("clusterVars")),
16 
17  // binning
18  clusterNBin_(ps.getParameter<std::vector<unsigned>>("clusterNBin")),
19  clusterMinBin_(ps.getParameter<std::vector<double>>("clusterMinBin")),
20  clusterMaxBin_(ps.getParameter<std::vector<double>>("clusterMaxBin")),
21  useDataClustersOnlyInBX0_(ps.getParameter<bool>("useDataClustersOnlyInBX0")) {}
22 
24 
27 
28  // chamber type
29  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
30  // data vs emulator
31  for (unsigned iData = 0; iData < dataEmul_.size(); iData++) {
32  // cluster variable
33  for (unsigned iVar = 0; iVar < clusterVars_.size(); iVar++) {
34  const std::string key("cluster_" + clusterVars_[iVar] + "_" + dataEmul_[iData]);
35  const std::string histName(key + "_" + chambers_[iType]);
36  const std::string histTitle(chambers_[iType] + " Cluster " + clusterVars_[iVar] + " (" + dataEmul_[iData] +
37  ")");
38  chamberHistos[iType][key] =
39  iBooker.book1D(histName, histTitle, clusterNBin_[iVar], clusterMinBin_[iVar], clusterMaxBin_[iVar]);
40  chamberHistos[iType][key]->getTH1()->SetMinimum(0);
41  }
42  }
43  }
44 }
45 
47  if (verbose_)
48  edm::LogInfo("L1TdeGEMTPG") << "L1TdeGEMTPG: analyzing collections" << std::endl;
49 
50  // handles
53  e.getByToken(data_token_, dataClusters);
54  e.getByToken(emul_token_, emulClusters);
55 
56  for (auto it = dataClusters->begin(); it != dataClusters->end(); it++) {
57  auto range = dataClusters->get((*it).first);
58  const int type = ((*it).first).station() - 1;
59  for (auto cluster = range.first; cluster != range.second; cluster++) {
60  if (cluster->isValid()) {
61  // ignore data clusters in BX's other than BX0
62  if (useDataClustersOnlyInBX0_ and cluster->bx() != 0)
63  continue;
64 
65  chamberHistos[type]["cluster_size_data"]->Fill(cluster->pads().size());
66  chamberHistos[type]["cluster_pad_data"]->Fill(cluster->pads().front());
67  chamberHistos[type]["cluster_bx_data"]->Fill(cluster->bx());
68  }
69  }
70  }
71 
72  for (auto it = emulClusters->begin(); it != emulClusters->end(); it++) {
73  auto range = emulClusters->get((*it).first);
74  const int type = ((*it).first).station() - 1;
75  for (auto cluster = range.first; cluster != range.second; cluster++) {
76  if (cluster->isValid()) {
77  chamberHistos[type]["cluster_size_emul"]->Fill(cluster->pads().size());
78  chamberHistos[type]["cluster_pad_emul"]->Fill(cluster->pads().front());
79  chamberHistos[type]["cluster_bx_emul"]->Fill(cluster->bx());
80  }
81  }
82  }
83 }
std::vector< unsigned > clusterNBin_
Definition: L1TdeGEMTPG.h:32
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< std::string > chambers_
Definition: L1TdeGEMTPG.h:28
std::vector< std::string > dataEmul_
Definition: L1TdeGEMTPG.h:29
std::vector< double > clusterMinBin_
Definition: L1TdeGEMTPG.h:33
bool useDataClustersOnlyInBX0_
Definition: L1TdeGEMTPG.h:36
L1TdeGEMTPG(const edm::ParameterSet &ps)
Definition: L1TdeGEMTPG.cc:5
std::string monitorDir_
Definition: L1TdeGEMTPG.h:25
std::vector< std::string > clusterVars_
Definition: L1TdeGEMTPG.h:31
bool verbose_
Definition: L1TdeGEMTPG.h:26
std::vector< double > clusterMaxBin_
Definition: L1TdeGEMTPG.h:34
~L1TdeGEMTPG() override
Definition: L1TdeGEMTPG.cc:23
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: L1TdeGEMTPG.cc:46
Log< level::Info, false > LogInfo
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
Definition: L1TdeGEMTPG.cc:25
edm::EDGetTokenT< GEMPadDigiClusterCollection > emul_token_
Definition: L1TdeGEMTPG.h:24
HLT enums.
edm::EDGetTokenT< GEMPadDigiClusterCollection > data_token_
Definition: L1TdeGEMTPG.h:23
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
Definition: L1TdeGEMTPG.h:40
Definition: Run.h:45