CMS 3D CMS Logo

GEMPackingTester.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <iostream>
3 #include <TTree.h>
4 
9 
12 
19 
20 using namespace std;
21 class GEMPackingTester : public edm::one::EDAnalyzer<edm::one::SharedResources> {
22 public:
23  explicit GEMPackingTester(const edm::ParameterSet&);
24  ~GEMPackingTester() override;
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28 private:
29  void beginJob() override;
30  void analyze(const edm::Event&, const edm::EventSetup&) override;
31  void endJob() override;
32 
37 
38  TTree* tree_;
39  int b_ge0, b_ge1, b_ge2;
40 };
41 
43  : fedToken_(consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("fed"))),
44  gemDigiToken_(consumes<GEMDigiCollection>(iConfig.getParameter<edm::InputTag>("gemDigi"))),
45  gemSimDigiToken_(consumes<GEMDigiCollection>(iConfig.getParameter<edm::InputTag>("gemSimDigi"))),
46  readMultiBX_(iConfig.getParameter<bool>("readMultiBX")) {
47  usesResource("TFileService");
49  tree_ = fs->make<TTree>("fed", "fed");
50  tree_->Branch("ge0", &b_ge0, "ge0/I");
51  tree_->Branch("ge1", &b_ge1, "ge1/I");
52  tree_->Branch("ge2", &b_ge2, "ge2/I");
53 }
54 
56 
58  using namespace edm;
59 
60  b_ge0 = 0;
61  b_ge1 = 0;
62  b_ge2 = 0;
63 
64  auto const& fed_buffers = iEvent.get(fedToken_);
65 
67  const FEDRawData& fedData = fed_buffers.FEDData(fedId);
68 
69  if (fedId == 1473 or fedId == 1474)
70  b_ge0 += fedData.size();
71  if (fedId == 1467 or fedId == 1468)
72  b_ge1 += fedData.size();
73  if (fedId == 1469 or fedId == 1470)
74  b_ge2 += fedData.size();
75  }
76 
77  auto const& gemDigis = iEvent.get(gemDigiToken_);
78  auto const& gemSimDigis = iEvent.get(gemSimDigiToken_);
79 
80  for (auto const& simDigi : gemSimDigis) {
81  const GEMDetId& gemId = simDigi.first;
82  const GEMDigiCollection::Range& sim = simDigi.second;
83  const GEMDigiCollection::Range& packed = gemDigis.get(gemId);
84 
85  for (auto digi = sim.first; digi != sim.second; ++digi) {
86  if (!readMultiBX_ && digi->bx() != 0)
87  continue;
88 
89  bool foundDigi = false;
90  for (auto unpackeddigi = packed.first; unpackeddigi != packed.second; ++unpackeddigi) {
91  if ((digi->strip() == unpackeddigi->strip()) && (digi->bx() == unpackeddigi->bx()))
92  foundDigi = true;
93  }
94  if (!foundDigi) {
95  edm::LogInfo("GEMPackingTester") << "simMuonGEMDigi NOT found " << gemId << " " << digi->strip() << " "
96  << digi->bx();
97  for (auto unpackeddigi = packed.first; unpackeddigi != packed.second; ++unpackeddigi) {
98  edm::LogInfo("GEMPackingTester") << "rec " << unpackeddigi->strip() << " " << unpackeddigi->bx();
99  }
100  }
101  }
102  }
103 
104  tree_->Fill();
105 }
106 
108 
110 
113  desc.add<edm::InputTag>("fed", edm::InputTag("rawDataCollector"));
114  desc.add<edm::InputTag>("gemDigi", edm::InputTag("muonGEMDigis"));
115  desc.add<edm::InputTag>("gemSimDigi", edm::InputTag("simMuonGEMDigis"));
116  desc.add<bool>("readMultiBX", false);
117  descriptions.add("GEMPackingTester", desc);
118 }
119 
FEDNumbering.h
bk::beginJob
void beginJob()
Definition: Breakpoints.cc:14
electrons_cff.bool
bool
Definition: electrons_cff.py:366
EDAnalyzer.h
FEDNumbering::MAXGEMFEDID
Definition: FEDNumbering.h:126
GEMPackingTester::gemSimDigiToken_
edm::EDGetTokenT< GEMDigiCollection > gemSimDigiToken_
Definition: GEMPackingTester.cc:35
GEMPackingTester::~GEMPackingTester
~GEMPackingTester() override
Definition: GEMPackingTester.cc:55
edm::EDGetTokenT< FEDRawDataCollection >
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
FEDRawData
Definition: FEDRawData.h:19
GEMPackingTester::tree_
TTree * tree_
Definition: GEMPackingTester.cc:38
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
Service.h
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
GEMPackingTester::endJob
void endJob() override
Definition: GEMPackingTester.cc:109
GEMPackingTester::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMPackingTester.cc:111
GEMPackingTester::beginJob
void beginJob() override
Definition: GEMPackingTester.cc:107
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
TFileService.h
GEMPackingTester::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: GEMPackingTester.cc:57
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
sim
Definition: GeometryProducer.h:20
GEMDetId
Definition: GEMDetId.h:18
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
FEDRawDataCollection.h
GEMPackingTester::b_ge0
int b_ge0
Definition: GEMPackingTester.cc:39
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
GEMPackingTester
Definition: GEMPackingTester.cc:21
edm::EventSetup
Definition: EventSetup.h:58
GEMPackingTester::readMultiBX_
bool readMultiBX_
Definition: GEMPackingTester.cc:36
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:89
GEMPackingTester::b_ge1
int b_ge1
Definition: GEMPackingTester.cc:39
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
GEMPackingTester::b_ge2
int b_ge2
Definition: GEMPackingTester.cc:39
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
GEMDigiCollection
GEMPackingTester::GEMPackingTester
GEMPackingTester(const edm::ParameterSet &)
Definition: GEMPackingTester.cc:42
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
FEDNumbering::MINGEMFEDID
Definition: FEDNumbering.h:123
GEMDigiCollection.h
ParameterSet.h
GEMPackingTester::gemDigiToken_
edm::EDGetTokenT< GEMDigiCollection > gemDigiToken_
Definition: GEMPackingTester.cc:34
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
GEMPackingTester::fedToken_
edm::EDGetTokenT< FEDRawDataCollection > fedToken_
Definition: GEMPackingTester.cc:33
FEDTrailer.h