CMS 3D CMS Logo

CSCDigiToPattern.cc
Go to the documentation of this file.
1 
6 #include <iostream>
7 
17 
19 public:
20  explicit CSCDigiToPattern(edm::ParameterSet const& conf);
21  void analyze(edm::Event const& e, edm::EventSetup const& iSetup) override;
22 
23  //virtual void endJob();
24 private:
25  // variables persistent across events should be declared here.
27  //
28 };
29 
31  d_token = consumes<CSCCorrelatedLCTDigiCollection>(conf.getParameter<edm::InputTag>("corrlctDigiTag"));
32 }
33 
35  // These declarations create handles to the types of records that you want
36  // to retrieve from event "e".
37  //
39  e.getByToken(d_token, correlatedlcts);
40 
41  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j = correlatedlcts->begin(); j != correlatedlcts->end(); j++) {
42  CSCDetId id = (*j).first;
43  std::cout << id << std::endl;
44  std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
45  std::vector<CSCCorrelatedLCTDigi>::const_iterator last = (*j).second.second;
46  for (; digiIt != last; ++digiIt) {
47  uint16_t wire = digiIt->getKeyWG(); // 7 bits
48  uint16_t pattern = digiIt->getPattern(); // 4 bits
49  uint16_t quality = digiIt->getQuality(); // 4 bits
50  uint16_t valid = digiIt->isValid(); // 1 bit
51  uint16_t strip = digiIt->getStrip(); // 8 bits
52  uint16_t bend = digiIt->getBend(); // 1 bit
53  uint16_t syncErr = digiIt->getSyncErr(); // 1 bit
54  uint16_t bx = digiIt->getBX(); // 1 bit
55  uint16_t bx0 = digiIt->getBX0(); // 1 bit
56  uint16_t cscId = digiIt->getCSCID(); // 4 bits
57  // __
58  // 32 bits in total
59  long unsigned int mpc = ((cscId & 0xF) << 28) | ((bx0 & 0x1) << 27) | ((bx & 0x1) << 26) |
60  ((syncErr & 0x1) << 25) | ((bend & 0x1) << 24) | ((strip & 0xFF) << 16) |
61  ((valid & 0x1) << 15) | ((quality & 0xF) << 11) | ((pattern & 0xF) << 7) | (wire & 0x7F);
62  std::cout << "MPC" << digiIt->getTrknmb() << " " << std::hex << mpc << std::dec << std::endl;
63  }
64  }
65 }
66 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCDigiToPattern(edm::ParameterSet const &conf)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(edm::Event const &e, edm::EventSetup const &iSetup) override
string quality
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > d_token