CMS 3D CMS Logo

CSCTFAnalyzer.cc

Go to the documentation of this file.
00001 #include "EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h"
00002 #include "DataFormats/Common/interface/Handle.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 
00005 
00006 #include <strings.h>
00007 #include <errno.h>
00008 #include <iostream>
00009 #include <iomanip>
00010 
00011 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00012 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
00013 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCStatusDigiCollection.h"
00014 
00015 CSCTFAnalyzer::CSCTFAnalyzer(const edm::ParameterSet &conf):edm::EDAnalyzer(){
00016         lctProducer   = conf.getUntrackedParameter<edm::InputTag>("lctProducer",edm::InputTag("cscTrackFinderDigis"));
00017         trackProducer = conf.getUntrackedParameter<edm::InputTag>("trackProducer",edm::InputTag("cscTrackFinderDigis"));
00018         statusProducer= conf.getUntrackedParameter<edm::InputTag>("statusProducer",edm::InputTag("cscTrackFinderDigis"));
00019 }
00020 
00021 void CSCTFAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c){
00022 /*      edm::Handle<FEDRawDataCollection> rawdata;
00023         e.getByLabel("source","",rawdata);
00024 
00025         const FEDRawData& fedData = rawdata->FEDData(750);
00026         if( fedData.size()==0 ) return;
00027         unsigned short *data = (unsigned short *)fedData.data();
00028         unsigned int    size = fedData.size()/2;
00029         std::cout<<"New event:"<<std::endl;
00030         for(unsigned i=0; i<size/4; i++)
00031                 std::cout<<std::hex<<" "<<std::setw(6)<<data[i*4+0]<<" "<<std::setw(6)<<data[i*4+1]<<" "<<std::setw(6)<<data[i*4+2]<<" "<<std::setw(6)<<data[i*4+3]<<std::dec<<std::endl;
00032         std::cout<<"End of event"<<std::endl;
00033         return;
00034 */
00035         if( statusProducer.label() != "null" ){
00036                 edm::Handle<L1CSCStatusDigiCollection> status;
00037                 e.getByLabel(statusProducer.label(),statusProducer.instance(),status);
00038 
00039                 edm::LogInfo("CSCTFAnalyzer|print") << "  Unpacking Errors: "<<status->first;
00040                 for(std::vector<L1CSCSPStatusDigi>::const_iterator stat=status->second.begin();
00041                         stat!=status->second.end(); stat++){
00042                         edm::LogInfo("CSCTFAnalyzer|print") << "   Status: SP in slot "<<stat->slot()<<"  FMM: "<<stat->FMM()<<" SE: 0x"<<std::hex<<stat->SEs()<<" VP: 0x"<<stat->VPs()<<std::dec;
00043                 }
00044         }
00045 
00046         if( lctProducer.label() != "null" ){
00047                 edm::Handle<CSCCorrelatedLCTDigiCollection> corrlcts;
00048                 e.getByLabel(lctProducer.label(),lctProducer.instance(),corrlcts);
00049 
00050                 for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator csc=corrlcts.product()->begin(); csc!=corrlcts.product()->end(); csc++){
00051                         int lctId=0;
00052 
00053                         CSCCorrelatedLCTDigiCollection::Range range1 = corrlcts.product()->get((*csc).first);
00054                         for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range1.first; lct!=range1.second; lct++,lctId++){
00055                                 int station = (*csc).first.station()-1;
00056                                 int cscId   = (*csc).first.triggerCscId()-1;
00057                                 int sector  = (*csc).first.triggerSector()-1;// + ( (*csc).first.endcap()==1 ? 0 : 6 );
00058                                 int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
00059                                 int tbin    = lct->getBX();
00060                                 int fpga    = ( subSector ? subSector-1 : station+1 );
00061 
00062                                 // If Det Id is within range
00063                                 if( sector<0 || sector>11 || station<0 || station>3 || cscId<0 || cscId>8 || lctId<0 || lctId>1){
00064                                         edm::LogInfo("CSCTFAnalyzer: CSC digi are out of range: ");
00065                                         continue;
00066                                 }
00067 
00068                                 edm::LogInfo("CSCTFAnalyzer|print") << "  Front data   endcap: "<<(*csc).first.endcap()<<"  station: "<<(station+1)<<"  sector: "<<(sector+1)<<"  subSector: "<<subSector<<"  tbin: "<<tbin<<"  cscId: "<<(cscId+1)<<"  fpga: "<<(fpga+1)<<" "<<
00069                                         "LCT(vp="<<lct->isValid()<<",qual="<<lct->getQuality()<<",wg="<<lct->getKeyWG()<<",strip="<<lct->getStrip()<<")";
00070                         }
00071                 }
00072         }
00073 
00074         if( trackProducer.label() != "null" ){
00075                 edm::Handle<L1CSCTrackCollection> tracks;
00076                 e.getByLabel(trackProducer.label(),trackProducer.instance(),tracks);
00077 
00078                 int nTrk=0;
00079                 for(L1CSCTrackCollection::const_iterator trk=tracks->begin(); trk<tracks->end(); trk++,nTrk++){
00080                         int sector = 6*(trk->first.endcap()-1)+trk->first.sector()-1;
00081                         int tbin   = trk->first.BX();
00082                         edm::LogInfo("CSCTFAnalyzer|print") << "   Track sector: "<<(sector+1)<<"  tbin: "<<tbin<<" "<<
00083                                 "TRK(mode="<<((trk->first.ptLUTAddress()>>16)&0xF)<<",eta="<<trk->first.eta_packed()<<",phi="<<trk->first.phi_packed()<<")";
00084                 }
00085         }
00086 }

Generated on Tue Jun 9 17:34:27 2009 for CMSSW by  doxygen 1.5.4