CMS 3D CMS Logo

L1TCSCTPG.cc
Go to the documentation of this file.
1 /*
2  * \file L1TCSCTPG.cc
3  *
4  * \author J. Berryhill
5  *
6  */
7 
9 
10 using namespace std;
11 using namespace edm;
12 
14  : csctpgSource_(ps.getParameter<InputTag>("csctpgSource")),
15  csctpgSource_token_(consumes<CSCCorrelatedLCTDigiCollection>(ps.getParameter<InputTag>("csctpgSource"))) {
16  // verbosity switch
17  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
18 
19  if (verbose_)
20  cout << "L1TCSCTPG: constructor...." << endl;
21 
22  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
23  if (!outputFile_.empty()) {
24  cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
25  }
26 
27  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
28  if (disable) {
29  outputFile_ = "";
30  }
31 }
32 
34 
35 void L1TCSCTPG::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
36  nev_ = 0;
37  ibooker.setCurrentFolder("L1T/L1TCSCTPG");
38 
39  csctpgpattern = ibooker.book1D("CSC TPG hit pattern", "CSC TPG hit pattern", 8, -0.5, 7.5);
40  csctpgquality = ibooker.book1D("CSC TPG quality", "CSC TPG quality", 16, 0.5, 16.5);
41  csctpgwg = ibooker.book1D("CSC TPG wire group", "CSC TPG wire group", 116, -0.5, 115.5);
42  csctpgstrip = ibooker.book1D("CSC TPG strip", "CSC TPG strip", 160, -0.5, 159.5);
43  csctpgstriptype = ibooker.book1D("CSC TPG strip type", "CSC TPG strip type", 2, 0.5, 1.5);
44  csctpgbend = ibooker.book1D("CSC TPG bend", "CSC TPG bend", 3, 0.5, 2.5);
45  csctpgbx = ibooker.book1D("CSC TPG bx", "CSC TPG bx", 20, -0.5, 19.5);
46 }
47 
49 
50 void L1TCSCTPG::analyze(const Event& e, const EventSetup& c) {
51  nev_++;
52  if (verbose_)
53  cout << "L1TCSCTPG: analyze...." << endl;
54 
56  e.getByToken(csctpgSource_token_, pCSCTPGcorrlcts);
57 
58  if (!pCSCTPGcorrlcts.isValid()) {
59  edm::LogInfo("DataNotFound") << "can't find CSCCorrelatedLCTDigiCollection with label " << csctpgSource_.label();
60  return;
61  }
62 
63  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator cscItr1 = pCSCTPGcorrlcts->begin();
64  cscItr1 != pCSCTPGcorrlcts->end();
65  cscItr1++) {
66  CSCCorrelatedLCTDigiCollection::Range range1 = pCSCTPGcorrlcts->get((*cscItr1).first);
67  for (CSCCorrelatedLCTDigiCollection::const_iterator lctItr1 = range1.first; lctItr1 != range1.second; lctItr1++) {
68  csctpgpattern->Fill(lctItr1->getCLCTPattern());
69  if (verbose_) {
70  std::cout << "CSC TPG CLCT pattern " << lctItr1->getCLCTPattern() << std::endl;
71  }
72 
73  csctpgquality->Fill(lctItr1->getQuality());
74  if (verbose_) {
75  std::cout << "CSC LCT quality " << lctItr1->getQuality() << std::endl;
76  }
77 
78  csctpgwg->Fill(lctItr1->getKeyWG());
79  if (verbose_) {
80  std::cout << "CSC LCT wire group " << lctItr1->getKeyWG() << std::endl;
81  }
82 
83  csctpgstrip->Fill(lctItr1->getStrip());
84  if (verbose_) {
85  std::cout << "CSC LCT strip " << lctItr1->getStrip() << std::endl;
86  }
87 
88  csctpgstriptype->Fill(lctItr1->getStripType());
89  if (verbose_) {
90  std::cout << "CSC LCT strip type" << lctItr1->getStripType() << std::endl;
91  }
92 
93  csctpgbend->Fill(lctItr1->getBend());
94  if (verbose_) {
95  std::cout << "CSC LCT bend " << lctItr1->getBend() << std::endl;
96  }
97 
98  csctpgbx->Fill(lctItr1->getBX());
99  if (verbose_) {
100  std::cout << "CSC LCT bx " << lctItr1->getBX() << std::endl;
101  }
102  }
103  }
104 }
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * csctpgwg
Definition: L1TCSCTPG.h:60
L1TCSCTPG(const edm::ParameterSet &ps)
Definition: L1TCSCTPG.cc:13
MonitorElement * csctpgstrip
Definition: L1TCSCTPG.h:61
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
~L1TCSCTPG() override
Definition: L1TCSCTPG.cc:33
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: L1TCSCTPG.cc:48
void Fill(long long x)
edm::InputTag csctpgSource_
Definition: L1TCSCTPG.h:71
MonitorElement * csctpgbend
Definition: L1TCSCTPG.h:63
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * csctpgbx
Definition: L1TCSCTPG.h:64
int nev_
Definition: L1TCSCTPG.h:66
MonitorElement * csctpgquality
Definition: L1TCSCTPG.h:59
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TCSCTPG.cc:50
bool verbose_
Definition: L1TCSCTPG.h:68
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
Definition: L1TCSCTPG.cc:35
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > csctpgSource_token_
Definition: L1TCSCTPG.h:72
MonitorElement * csctpgstriptype
Definition: L1TCSCTPG.h:62
std::string outputFile_
Definition: L1TCSCTPG.h:67
MonitorElement * csctpgpattern
Definition: L1TCSCTPG.h:58
Definition: Run.h:45