CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
L1TRPCTPG Class Reference

Data Format. More...

#include <L1TRPCTPG.h>

Inheritance diagram for L1TRPCTPG:
edm::EDAnalyzer

Public Member Functions

std::map< std::string,
MonitorElement * > 
L1TRPCBookME (RPCDetId &detId)
 Booking of MonitoringElemnt for one RPCDetId (= roll) More...
 
 L1TRPCTPG (const edm::ParameterSet &ps)
 
virtual ~L1TRPCTPG ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob (void)
 
void endJob (void)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

DQMStoredbe
 
ofstream logFile_
 
MonitorElementm_digiBxCSC
 
MonitorElementm_digiBxDT
 
MonitorElementm_digiBxRPCBar
 
MonitorElementm_digiBxRPCEnd
 
bool monitorDaemon_
 
int nev_
 
std::string outputFile_
 
edm::InputTag rpctfSource_
 
MonitorElementrpctpgbx
 
std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
rpctpgmeCollection
 
MonitorElementrpctpgndigi [3]
 
edm::InputTag rpctpgSource_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Data Format.

Geometry

Definition at line 55 of file L1TRPCTPG.h.

Constructor & Destructor Documentation

L1TRPCTPG::L1TRPCTPG ( const edm::ParameterSet ps)

Definition at line 22 of file L1TRPCTPG.cc.

References gather_cfg::cout, dbe, edm::ParameterSet::getUntrackedParameter(), NULL, cppFunctionSkipper::operator, outputFile_, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), and verbose_.

23  : rpctpgSource_( ps.getParameter< InputTag >("rpctpgSource") ),
24  rpctfSource_( ps.getParameter< InputTag >("rpctfSource") )
25 {
26 
27  // verbosity switch
28  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
29 
30  if(verbose_) cout << "L1TRPCTPG: constructor...." << endl;
31 
32 
33  dbe = NULL;
34  if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
35  {
37  dbe->setVerbose(0);
38  }
39 
40  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
41  if ( outputFile_.size() != 0 ) {
42  cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
43  }
44 
45  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
46  if(disable){
47  outputFile_="";
48  }
49 
50 
51  if ( dbe !=NULL ) {
52  dbe->setCurrentFolder("L1T/L1TRPCTPG");
53  }
54 
55 
56 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define NULL
Definition: scimark2.h:8
std::string outputFile_
Definition: L1TRPCTPG.h:96
DQMStore * dbe
Definition: L1TRPCTPG.h:80
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
edm::InputTag rpctpgSource_
Definition: L1TRPCTPG.h:100
bool verbose_
Definition: L1TRPCTPG.h:97
edm::InputTag rpctfSource_
Definition: L1TRPCTPG.h:101
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
L1TRPCTPG::~L1TRPCTPG ( )
virtual

Definition at line 58 of file L1TRPCTPG.cc.

59 {
60 }

Member Function Documentation

void L1TRPCTPG::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

RPC Geometry

DIGI

RecHits, perhaps to add later

Implements edm::EDAnalyzer.

Definition at line 117 of file L1TRPCTPG.cc.

References gather_cfg::cout, MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByType(), L1MuGMTReadoutCollection::getRecords(), edm::ESHandleBase::isValid(), edm::HandleBase::isValid(), edm::InputTag::label(), m_digiBxCSC, m_digiBxDT, m_digiBxRPCBar, m_digiBxRPCEnd, nev_, edm::Handle< T >::product(), rpctfSource_, rpctpgbx, rpctpgndigi, rpctpgSource_, edm::second(), and verbose_.

118 {
119  nev_++;
120  if(verbose_) cout << "L1TRPCTPG: analyze...." << endl;
121 
122 
125  c.get<MuonGeometryRecord>().get(rpcGeo);
126  if (!rpcGeo.isValid()) {
127  edm::LogInfo("DataNotFound") << "can't find RPCGeometry" << endl;
128  return;
129  }
130 // char layerLabel[328];
131 // char meId [328];
132 
133 
136  e.getByLabel(rpctpgSource_,rpcdigis);
137 
138  if (!rpcdigis.isValid()) {
139  edm::LogInfo("DataNotFound") << "can't find RPCDigiCollection with label "<< rpctpgSource_ << endl;
140  return;
141  }
142 
143  // Calculate the number of DT and CSC cands present
145  e.getByLabel(rpctfSource_,pCollection);
146 
147  if (!pCollection.isValid()) {
148  edm::LogInfo("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "
149  << rpctfSource_.label() ;
150  return;
151  }
152 
153  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
154  vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
155  vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
156 
157  static int nRPCTrackBarrel, nRPCTrackEndcap , nDTTrack, nCSCTrack;
158  nRPCTrackBarrel = 0;
159  nRPCTrackEndcap = 0;
160  nDTTrack = 0;
161  nCSCTrack = 0;
162 
163  for( RRItr = gmt_records.begin() ;
164  RRItr != gmt_records.end() ;
165  RRItr++ )
166  {
167  // DTs
168  vector<L1MuRegionalCand> DTCands = RRItr->getDTBXCands();
169  for( vector<L1MuRegionalCand>::const_iterator
170  ECItr = DTCands.begin() ;
171  ECItr != DTCands.end() ;
172  ++ECItr )
173  {
174  if (!ECItr->empty()) { ++nDTTrack; }
175  }
176  // CSCs
177  vector<L1MuRegionalCand> CSCCands = RRItr->getCSCCands();
178  for( vector<L1MuRegionalCand>::const_iterator
179  ECItr = CSCCands.begin() ;
180  ECItr != CSCCands.end() ;
181  ++ECItr )
182  {
183  if (!ECItr->empty()) { ++nCSCTrack; }
184  }
185 
186  //RPC barrel
187  vector<L1MuRegionalCand> RPCBCands = RRItr->getBrlRPCCands();
188  for( vector<L1MuRegionalCand>::const_iterator
189  ECItr = RPCBCands.begin() ;
190  ECItr != RPCBCands.end() ;
191  ++ECItr )
192  {
193  if (!ECItr->empty()) { ++nRPCTrackBarrel; }
194  }
195 
196  //RPC endcap
197  vector<L1MuRegionalCand> RPCECands = RRItr->getFwdRPCCands();
198  for( vector<L1MuRegionalCand>::const_iterator
199  ECItr = RPCECands.begin() ;
200  ECItr != RPCECands.end() ;
201  ++ECItr )
202  {
203  if (!ECItr->empty()) { ++nRPCTrackEndcap; }
204  }
205  }
206 
207 
208 
210  if (0){
212  e.getByType(rpcHits);
213 
214  if (!rpcHits.isValid()) {
215  edm::LogInfo("DataNotFound") << "can't find RPCRecHitCollection of any type" << endl;
216  return;
217  }
218  }
219 
220  int numberofDigi[3] = {0,0,0};
221 
222 
224  for(collectionItr=rpcdigis->begin(); collectionItr!=rpcdigis->end(); ++collectionItr){
225 
226  /*RPCDetId detId=(*collectionItr ).first;
227 
228 
229  uint32_t id=detId();
230  char detUnitLabel[328];
231  RPCGeomServ RPCname(detId);
232  std::string nameRoll = RPCname.name();
233  sprintf(detUnitLabel ,"%s",nameRoll.c_str());
234  sprintf(layerLabel ,"%s",nameRoll.c_str());
235  std::map<uint32_t, std::map<std::string,MonitorElement*> >::iterator meItr = rpctpgmeCollection.find(id);
236  if (meItr == rpctpgmeCollection.end() || (rpctpgmeCollection.size()==0)) {
237  rpctpgmeCollection[id]=L1TRPCBookME(detId);
238  }
239  std::map<std::string, MonitorElement*> meMap=rpctpgmeCollection[id];*/
240 
241 
242 // std::vector<int> strips;
243 // std::vector<int> bxs;
244 // strips.clear();
245 // bxs.clear();
247  for (digiItr = ((*collectionItr ).second).first;
248  digiItr!=((*collectionItr).second).second; ++digiItr){
249 
250  // strips is a list of hit strips (regardless of bx) for this roll
251 // int strip= (*digiItr).strip();
252 // strips.push_back(strip);
253  int bx=(*digiItr).bx();
254  rpctpgbx->Fill(bx);
255  //
256 
257  if ( nRPCTrackBarrel == 0 && nDTTrack != 0) {
258  m_digiBxDT->Fill(bx);
259  } else if ( nRPCTrackBarrel != 0 && nDTTrack == 0) {
260  m_digiBxRPCBar->Fill(bx);
261  }
262 
263  if ( nRPCTrackEndcap == 0 && nCSCTrack != 0) {
264  m_digiBxCSC->Fill(bx);
265  } else if ( nRPCTrackEndcap != 0 && nCSCTrack == 0) {
266  m_digiBxRPCEnd->Fill(bx);
267  }
268 
269 
270 
271 
272 
273  if (bx == -1)
274  {
275  numberofDigi[0]++;
276  }
277  if (bx == 0)
278  {
279 // sprintf(meId,"Occupancy_%s",detUnitLabel);
280 // meMap[meId]->Fill(strip);
281  numberofDigi[1]++;
282  }
283  if (bx == 2)
284  {
285  numberofDigi[2]++;
286  }
287 
288 // sprintf(meId,"BXN_%s",detUnitLabel);
289 // meMap[meId]->Fill(bx);
290 // sprintf(meId,"BXN_vs_strip_%s",detUnitLabel);
291 // meMap[meId]->Fill(strip,bx);
292 
293  }
294  }
295 
296  rpctpgndigi[0]->Fill(numberofDigi[0]);
297  rpctpgndigi[1]->Fill(numberofDigi[1]);
298  rpctpgndigi[2]->Fill(numberofDigi[2]);
299 
300 }
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
MonitorElement * m_digiBxCSC
Definition: L1TRPCTPG.h:91
void Fill(long long x)
U second(std::pair< T, U > const &p)
int nev_
Definition: L1TRPCTPG.h:95
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * rpctpgndigi[3]
Definition: L1TRPCTPG.h:82
const T & get() const
Definition: EventSetup.h:55
std::vector< DigiType >::const_iterator const_iterator
edm::InputTag rpctpgSource_
Definition: L1TRPCTPG.h:100
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:25
MonitorElement * m_digiBxRPCBar
Definition: L1TRPCTPG.h:85
bool verbose_
Definition: L1TRPCTPG.h:97
MonitorElement * m_digiBxRPCEnd
Definition: L1TRPCTPG.h:87
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
edm::InputTag rpctfSource_
Definition: L1TRPCTPG.h:101
tuple cout
Definition: gather_cfg.py:121
MonitorElement * rpctpgbx
Definition: L1TRPCTPG.h:83
bool isValid() const
Definition: ESHandle.h:37
MonitorElement * m_digiBxDT
Definition: L1TRPCTPG.h:89
void L1TRPCTPG::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file L1TRPCTPG.cc.

References DQMStore::book1D(), dbe, m_digiBxCSC, m_digiBxDT, m_digiBxRPCBar, m_digiBxRPCEnd, nev_, cppFunctionSkipper::operator, DQMStore::rmdir(), rpctpgbx, rpctpgndigi, and DQMStore::setCurrentFolder().

63 {
64 
65  nev_ = 0;
66 
67  // get hold of back-end interface
68  DQMStore* dbe = 0;
69  dbe = Service<DQMStore>().operator->();
70 
71  if ( dbe ) {
72  dbe->setCurrentFolder("L1T/L1TRPCTPG");
73  dbe->rmdir("L1T/L1TRPCTPG");
74  }
75 
76 
77  if ( dbe )
78  {
79  dbe->setCurrentFolder("L1T/L1TRPCTPG");
80  rpctpgbx = dbe->book1D("RPCTPG_bx",
81  "RPC digis bx - all events", 9, -4.5, 4.5 ) ;
82 
83  rpctpgndigi[1] = dbe->book1D("RPCTPG_ndigi",
84  "RPCTPG nDigi bx 0", 100, -0.5, 99.5 ) ;
85  rpctpgndigi[2] = dbe->book1D("RPCTPG_ndigi_+1",
86  "RPCTPG nDigi bx +1", 100, -0.5, 99.5 ) ;
87  rpctpgndigi[0] = dbe->book1D("RPCTPG_ndigi_-1",
88  "RPCTPG nDigi bx -1", 100, -0.5, 99.5 ) ;
89 
90 
91 
92  m_digiBxRPCBar = dbe->book1D("RPCDigiRPCBmu_noDTmu_bx",
93  "RPC digis bx - RPC, !DT", 9, -4.5, 4.5 ) ;
94 
95  m_digiBxRPCEnd = dbe->book1D("RPCDigiRPCEmu_noCSCmu_bx",
96  "RPC digis bx - RPC, !CSC", 9, -4.5, 4.5 ) ;
97 
98  m_digiBxDT = dbe->book1D("RPCDigiDTmu_noRPCBmu_bx",
99  "RPC digis bx - !RPC, DT", 9, -4.5, 4.5 ) ;
100 
101  m_digiBxCSC = dbe->book1D("RPCDigiCSCmu_noRPCEmu_bx",
102  "RPC digis bx - !RPC, CSC", 9, -4.5, 4.5 ) ;
103  }
104 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
MonitorElement * m_digiBxCSC
Definition: L1TRPCTPG.h:91
int nev_
Definition: L1TRPCTPG.h:95
DQMStore * dbe
Definition: L1TRPCTPG.h:80
MonitorElement * rpctpgndigi[3]
Definition: L1TRPCTPG.h:82
MonitorElement * m_digiBxRPCBar
Definition: L1TRPCTPG.h:85
MonitorElement * m_digiBxRPCEnd
Definition: L1TRPCTPG.h:87
MonitorElement * rpctpgbx
Definition: L1TRPCTPG.h:83
MonitorElement * m_digiBxDT
Definition: L1TRPCTPG.h:89
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void L1TRPCTPG::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file L1TRPCTPG.cc.

References gather_cfg::cout, dbe, nev_, outputFile_, DQMStore::save(), and verbose_.

108 {
109  if(verbose_) cout << "L1TRPCTPG: end job...." << endl;
110  LogInfo("EndJob") << "analyzed " << nev_ << " events";
111 
112  if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
113 
114  return;
115 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
int nev_
Definition: L1TRPCTPG.h:95
std::string outputFile_
Definition: L1TRPCTPG.h:96
DQMStore * dbe
Definition: L1TRPCTPG.h:80
bool verbose_
Definition: L1TRPCTPG.h:97
tuple cout
Definition: gather_cfg.py:121
std::map< std::string, MonitorElement * > L1TRPCTPG::L1TRPCBookME ( RPCDetId detId)

Booking of MonitoringElemnt for one RPCDetId (= roll)

Name components common to current RPDDetId

Definition at line 23 of file L1TRPCBookME.cc.

References RPCGeomServ::name(), RPCDetId::region(), RPCDetId::ring(), RPCDetId::sector(), and RPCDetId::station().

23  {
24 
25  std::map<std::string, MonitorElement*> meMap;
26 
27 
28  std::string regionName;
29  std::string ringType;
30  if(detId.region() == 0) {
31  regionName="Barrel";
32  ringType="Wheel";
33  }else{
34  ringType="Disk";
35  if(detId.region() == -1) regionName="Encap-";
36  if(detId.region() == 1) regionName="Encap+";
37  }
38 
39  char folder[220];
40  sprintf(folder,"L1T/L1TRPCTPG/Strips/%s/%s_%d/station_%d/sector_%d",
41  regionName.c_str(),ringType.c_str(),
42  detId.ring(),detId.station(),detId.sector());
43  //cout << folder << endl;
44  dbe->setCurrentFolder(folder);
45 
47  char detUnitLabel[328];
48  char layerLabel[328];
49 
50  //sprintf(detUnitLabel ,"%d",detId());
51  RPCGeomServ RPCname(detId);
52  std::string nameRoll = RPCname.name();
53  sprintf(detUnitLabel ,"%s",nameRoll.c_str());
54  sprintf(layerLabel ,"%s",nameRoll.c_str());
55 
56  char meId [328];
57  char meTitle [328];
58 
59 
60  // Begin booking
61  sprintf(meId,"Occupancy_%s",detUnitLabel);
62  sprintf(meTitle,"Occupancy_for_%s",layerLabel);
63  // cout << meId << endl;
64  // cout << meTitle << endl;
65  meMap[meId] = dbe->book1D(meId, meTitle, 100, 0.5, 100.5);
66 
67  sprintf(meId,"BXN_%s",detUnitLabel);
68  sprintf(meTitle,"BXN_for_%s",layerLabel);
69  meMap[meId] = dbe->book1D(meId, meTitle, 11, -10.5, 10.5);
70 
71  sprintf(meId,"BXN_vs_strip_%s",detUnitLabel);
72  sprintf(meTitle,"BXN_vs_strip_for_%s",layerLabel);
73  meMap[meId] = dbe->book2D(meId, meTitle, 100, 0.5, 100.5, 11, -10.5, 10.5);
74 
75  return meMap;
76  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
DQMStore * dbe
Definition: L1TRPCTPG.h:80
int ring() const
Definition: RPCDetId.h:76
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:106
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:67
int station() const
Definition: RPCDetId.h:100

Member Data Documentation

DQMStore* L1TRPCTPG::dbe
private

Definition at line 80 of file L1TRPCTPG.h.

Referenced by beginJob(), endJob(), and L1TRPCTPG().

ofstream L1TRPCTPG::logFile_
private

Definition at line 99 of file L1TRPCTPG.h.

MonitorElement* L1TRPCTPG::m_digiBxCSC
private

Definition at line 91 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

MonitorElement* L1TRPCTPG::m_digiBxDT
private

Definition at line 89 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

MonitorElement* L1TRPCTPG::m_digiBxRPCBar
private

Definition at line 85 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

MonitorElement* L1TRPCTPG::m_digiBxRPCEnd
private

Definition at line 87 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

bool L1TRPCTPG::monitorDaemon_
private

Definition at line 98 of file L1TRPCTPG.h.

int L1TRPCTPG::nev_
private

Definition at line 95 of file L1TRPCTPG.h.

Referenced by analyze(), beginJob(), and endJob().

std::string L1TRPCTPG::outputFile_
private

Definition at line 96 of file L1TRPCTPG.h.

Referenced by endJob(), and L1TRPCTPG().

edm::InputTag L1TRPCTPG::rpctfSource_
private

Definition at line 101 of file L1TRPCTPG.h.

Referenced by analyze().

MonitorElement* L1TRPCTPG::rpctpgbx
private

Definition at line 83 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

std::map<uint32_t, std::map<std::string, MonitorElement*> > L1TRPCTPG::rpctpgmeCollection
private

Definition at line 93 of file L1TRPCTPG.h.

MonitorElement* L1TRPCTPG::rpctpgndigi[3]
private

Definition at line 82 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

edm::InputTag L1TRPCTPG::rpctpgSource_
private

Definition at line 100 of file L1TRPCTPG.h.

Referenced by analyze().

bool L1TRPCTPG::verbose_
private

Definition at line 97 of file L1TRPCTPG.h.

Referenced by analyze(), endJob(), and L1TRPCTPG().