CMS 3D CMS Logo

L1TRPCTPG.cc
Go to the documentation of this file.
1 /*
2  * \file L1TRPCTPG.cc
3  *
4  * \author J. Berryhill
5  *
6  */
7 
9 
10 using namespace std;
11 using namespace edm;
12 
14  : rpctpgSource_(ps.getParameter<InputTag>("rpctpgSource")),
15  rpctpgSource_token_(consumes<RPCDigiCollection>(ps.getParameter<InputTag>("rpctpgSource"))),
16  rpctfSource_(ps.getParameter<InputTag>("rpctfSource")),
17  rpctfSource_token_(consumes<L1MuGMTReadoutCollection>(ps.getParameter<InputTag>("rpctfSource"))) {
18  // verbosity switch
19  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
20 
21  if (verbose_)
22  cout << "L1TRPCTPG: constructor...." << endl;
23 
24  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
25  if (!outputFile_.empty()) {
26  cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
27  }
28 
29  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
30  if (disable) {
31  outputFile_ = "";
32  }
33 }
34 
36 
38  //
39 }
40 
42  nev_ = 0;
43 
44  ibooker.setCurrentFolder("L1T/L1TRPCTPG");
45 
46  rpctpgbx = ibooker.book1D("RPCTPG_bx", "RPC digis bx - all events", 9, -4.5, 4.5);
47 
48  rpctpgndigi[1] = ibooker.book1D("RPCTPG_ndigi", "RPCTPG nDigi bx 0", 100, -0.5, 99.5);
49  rpctpgndigi[2] = ibooker.book1D("RPCTPG_ndigi_+1", "RPCTPG nDigi bx +1", 100, -0.5, 99.5);
50  rpctpgndigi[0] = ibooker.book1D("RPCTPG_ndigi_-1", "RPCTPG nDigi bx -1", 100, -0.5, 99.5);
51 
52  m_digiBxRPCBar = ibooker.book1D("RPCDigiRPCBmu_noDTmu_bx", "RPC digis bx - RPC, !DT", 9, -4.5, 4.5);
53 
54  m_digiBxRPCEnd = ibooker.book1D("RPCDigiRPCEmu_noCSCmu_bx", "RPC digis bx - RPC, !CSC", 9, -4.5, 4.5);
55 
56  m_digiBxDT = ibooker.book1D("RPCDigiDTmu_noRPCBmu_bx", "RPC digis bx - !RPC, DT", 9, -4.5, 4.5);
57 
58  m_digiBxCSC = ibooker.book1D("RPCDigiCSCmu_noRPCEmu_bx", "RPC digis bx - !RPC, CSC", 9, -4.5, 4.5);
59 }
60 
61 void L1TRPCTPG::analyze(const Event& e, const EventSetup& c) {
62  nev_++;
63  if (verbose_)
64  cout << "L1TRPCTPG: analyze...." << endl;
65 
68  c.get<MuonGeometryRecord>().get(rpcGeo);
69  if (!rpcGeo.isValid()) {
70  edm::LogInfo("DataNotFound") << "can't find RPCGeometry" << endl;
71  return;
72  }
73  // char layerLabel[328];
74  // char meId [328];
75 
78  e.getByToken(rpctpgSource_token_, rpcdigis);
79 
80  if (!rpcdigis.isValid()) {
81  edm::LogInfo("DataNotFound") << "can't find RPCDigiCollection with label " << rpctpgSource_ << endl;
82  return;
83  }
84 
85  // Calculate the number of DT and CSC cands present
87  e.getByToken(rpctfSource_token_, pCollection);
88 
89  if (!pCollection.isValid()) {
90  edm::LogInfo("DataNotFound") << "can't find L1MuGMTReadoutCollection with label " << rpctfSource_.label();
91  return;
92  }
93 
94  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
95  vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
96  vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
97 
98  int nRPCTrackBarrel, nRPCTrackEndcap, nDTTrack, nCSCTrack;
99  nRPCTrackBarrel = 0;
100  nRPCTrackEndcap = 0;
101  nDTTrack = 0;
102  nCSCTrack = 0;
103 
104  for (RRItr = gmt_records.begin(); RRItr != gmt_records.end(); RRItr++) {
105  // DTs
106  vector<L1MuRegionalCand> DTCands = RRItr->getDTBXCands();
107  for (vector<L1MuRegionalCand>::const_iterator ECItr = DTCands.begin(); ECItr != DTCands.end(); ++ECItr) {
108  if (!ECItr->empty()) {
109  ++nDTTrack;
110  }
111  }
112  // CSCs
113  vector<L1MuRegionalCand> CSCCands = RRItr->getCSCCands();
114  for (vector<L1MuRegionalCand>::const_iterator ECItr = CSCCands.begin(); ECItr != CSCCands.end(); ++ECItr) {
115  if (!ECItr->empty()) {
116  ++nCSCTrack;
117  }
118  }
119 
120  //RPC barrel
121  vector<L1MuRegionalCand> RPCBCands = RRItr->getBrlRPCCands();
122  for (vector<L1MuRegionalCand>::const_iterator ECItr = RPCBCands.begin(); ECItr != RPCBCands.end(); ++ECItr) {
123  if (!ECItr->empty()) {
124  ++nRPCTrackBarrel;
125  }
126  }
127 
128  //RPC endcap
129  vector<L1MuRegionalCand> RPCECands = RRItr->getFwdRPCCands();
130  for (vector<L1MuRegionalCand>::const_iterator ECItr = RPCECands.begin(); ECItr != RPCECands.end(); ++ECItr) {
131  if (!ECItr->empty()) {
132  ++nRPCTrackEndcap;
133  }
134  }
135  }
136 
137  int numberofDigi[3] = {0, 0, 0};
138 
140  for (collectionItr = rpcdigis->begin(); collectionItr != rpcdigis->end(); ++collectionItr) {
142  for (digiItr = ((*collectionItr).second).first; digiItr != ((*collectionItr).second).second; ++digiItr) {
143  // strips is a list of hit strips (regardless of bx) for this roll
144  // int strip= (*digiItr).strip();
145  // strips.push_back(strip);
146  int bx = (*digiItr).bx();
147  rpctpgbx->Fill(bx);
148  //
149 
150  if (nRPCTrackBarrel == 0 && nDTTrack != 0) {
151  m_digiBxDT->Fill(bx);
152  } else if (nRPCTrackBarrel != 0 && nDTTrack == 0) {
154  }
155 
156  if (nRPCTrackEndcap == 0 && nCSCTrack != 0) {
157  m_digiBxCSC->Fill(bx);
158  } else if (nRPCTrackEndcap != 0 && nCSCTrack == 0) {
160  }
161 
162  if (bx == -1) {
163  numberofDigi[0]++;
164  }
165  if (bx == 0) {
166  // sprintf(meId,"Occupancy_%s",detUnitLabel);
167  // meMap[meId]->Fill(strip);
168  numberofDigi[1]++;
169  }
170  if (bx == 2) {
171  numberofDigi[2]++;
172  }
173 
174  // sprintf(meId,"BXN_%s",detUnitLabel);
175  // meMap[meId]->Fill(bx);
176  // sprintf(meId,"BXN_vs_strip_%s",detUnitLabel);
177  // meMap[meId]->Fill(strip,bx);
178  }
179  }
180 
181  rpctpgndigi[0]->Fill(numberofDigi[0]);
182  rpctpgndigi[1]->Fill(numberofDigi[1]);
183  rpctpgndigi[2]->Fill(numberofDigi[2]);
184 
185  if (verbose_)
186  cout << "L1TRPCTPG: end job...." << endl;
187  LogInfo("EndJob") << "analyzed " << nev_ << " events";
188 }
L1TRPCTPG::rpctpgSource_token_
edm::EDGetTokenT< RPCDigiCollection > rpctpgSource_token_
Definition: L1TRPCTPG.h:90
L1TRPCTPG::outputFile_
std::string outputFile_
Definition: L1TRPCTPG.h:85
L1TRPCTPG::rpctpgbx
MonitorElement * rpctpgbx
Definition: L1TRPCTPG.h:76
L1TRPCTPG::bookHistograms
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
Definition: L1TRPCTPG.cc:41
L1TRPCTPG::m_digiBxCSC
MonitorElement * m_digiBxCSC
Definition: L1TRPCTPG.h:80
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1TRPCTPG::verbose_
bool verbose_
Definition: L1TRPCTPG.h:86
edm::LogInfo
Definition: MessageLogger.h:254
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
L1TRPCTPG::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TRPCTPG.cc:61
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
L1TRPCTPG::m_digiBxDT
MonitorElement * m_digiBxDT
Definition: L1TRPCTPG.h:79
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle< RPCDigiCollection >
MuonDigiCollection< RPCDetId, RPCDigi >::const_iterator
std::vector< RPCDigi >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
RPCDigiCollection
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
L1TRPCTPG::m_digiBxRPCBar
MonitorElement * m_digiBxRPCBar
Definition: L1TRPCTPG.h:77
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
edm::ESHandle< RPCGeometry >
edm::ParameterSet
Definition: ParameterSet.h:36
L1MuGMTReadoutCollection::getRecords
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
Definition: L1MuGMTReadoutCollection.h:52
L1TRPCTPG::rpctpgndigi
MonitorElement * rpctpgndigi[3]
Definition: L1TRPCTPG.h:75
L1TRPCTPG::dqmBeginRun
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: L1TRPCTPG.cc:37
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1TRPCTPG.h
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
L1TRPCTPG::~L1TRPCTPG
~L1TRPCTPG() override
Definition: L1TRPCTPG.cc:35
alignCSCRings.r
r
Definition: alignCSCRings.py:93
L1MuGMTReadoutCollection
Definition: L1MuGMTReadoutCollection.h:39
std
Definition: JetResolutionObject.h:76
L1TRPCTPG::nev_
int nev_
Definition: L1TRPCTPG.h:84
L1TRPCTPG::L1TRPCTPG
L1TRPCTPG(const edm::ParameterSet &ps)
Definition: L1TRPCTPG.cc:13
dqm::implementation::IBooker
Definition: DQMStore.h:43
L1TRPCTPG::rpctfSource_
edm::InputTag rpctfSource_
Definition: L1TRPCTPG.h:91
L1TRPCTPG::rpctfSource_token_
edm::EDGetTokenT< L1MuGMTReadoutCollection > rpctfSource_token_
Definition: L1TRPCTPG.h:92
L1TRPCTPG::rpctpgSource_
edm::InputTag rpctpgSource_
Definition: L1TRPCTPG.h:89
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
DigiContainerIterator
Definition: MuonDigiCollection.h:30
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
L1TRPCTPG::m_digiBxRPCEnd
MonitorElement * m_digiBxRPCEnd
Definition: L1TRPCTPG.h:78
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37