CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/EventFilter/CSCRawToDigi/plugins/CSCDigiToPattern.cc

Go to the documentation of this file.
00001 #include "EventFilter/CSCRawToDigi/src/CSCDigiToPattern.h"
00002 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
00003 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00004 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00005 
00006 CSCDigiToPattern::CSCDigiToPattern(edm::ParameterSet const& conf) {
00007 
00008   // If your module takes parameters, here is where you would define
00009   // their names and types, and access them to initialize internal
00010   // variables. Example as follows:
00011   //
00012 }
00013 
00014 void CSCDigiToPattern::analyze(edm::Event const& e, edm::EventSetup const& iSetup) {
00015 
00016   // These declarations create handles to the types of records that you want
00017   // to retrieve from event "e".
00018   //
00019   edm::Handle<CSCCorrelatedLCTDigiCollection> correlatedlcts;
00020   e.getByLabel("muonCSCDigis","MuonCSCCorrelatedLCTDigi",correlatedlcts);  
00021   for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j=correlatedlcts->begin(); j!=correlatedlcts->end(); j++) { 
00022     CSCDetId id=(*j).first;
00023     std::cout<<id<<std::endl;
00024     std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
00025     std::vector<CSCCorrelatedLCTDigi>::const_iterator last = (*j).second.second;
00026     for( ; digiIt != last; ++digiIt) {
00027       uint16_t wire       = digiIt->getKeyWG();    // 7 bits
00028       uint16_t pattern    = digiIt->getPattern();  // 4 bits
00029       uint16_t quality    = digiIt->getQuality();  // 4 bits
00030       uint16_t valid      = digiIt->isValid();     // 1 bit
00031       uint16_t strip      = digiIt->getStrip();    // 8 bits
00032       uint16_t bend       = digiIt->getBend();     // 1 bit
00033       uint16_t syncErr    = digiIt->getSyncErr();  // 1 bit
00034       uint16_t bx         = digiIt->getBX();       // 1 bit
00035       uint16_t bx0        = digiIt->getBX0();      // 1 bit
00036       uint16_t cscId      = digiIt->getCSCID();    // 4 bits
00037       //                                             __
00038       //                                             32 bits in total
00039       long unsigned int mpc =
00040         ((cscId&0xF)<<28) | ((bx0&0x1)<<27) | ((bx&0x1)<<26) |
00041         ((syncErr&0x1)<<25) | ((bend&0x1)<<24) | ((strip&0xFF)<<16) |
00042         ((valid&0x1)<<15) | ((quality&0xF)<<11) | ((pattern&0xF)<<7) |
00043         (wire&0x7F);
00044       std::cout <<"MPC"<<digiIt->getTrknmb()<< " " << std::hex << mpc <<std::dec <<std::endl;
00045     }
00046   }
00047 }
00048 
00049 
00050 
00051