CMS 3D CMS Logo

CSCTFValidator Class Reference

#include <EventFilter/CSCTFRawToDigi/old/CSCTFValidator.h>

Inheritance diagram for CSCTFValidator:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (edm::Event const &e, edm::EventSetup const &iSetup)
 CSCTFValidator (edm::ParameterSet const &conf)
 Demo analyzer for reading digis.

Private Attributes

int eventNumber
std::string mapPath
int TBendcap
int TBFEDid
int TBsector
bool testBeam
CSCTriggerMappingFromFileTFMapping


Detailed Description

Definition at line 21 of file CSCTFValidator.h.


Constructor & Destructor Documentation

CSCTFValidator::CSCTFValidator ( edm::ParameterSet const &  conf  )  [explicit]

Demo analyzer for reading digis.

Validates against raw data unpack. author L. Gray 2/26/06 ripped from Jeremy's and Rick's analyzers

Definition at line 30 of file CSCTFValidator.cc.

References eventNumber, edm::ParameterSet::getUntrackedParameter(), mapPath, TBendcap, TBFEDid, TBsector, testBeam, and TFMapping.

00030                                                           {
00031 
00032   // If your module takes parameters, here is where you would define
00033   // their names and types, and access them to initialize internal
00034   // variables. Example as follows:
00035   //
00036   testBeam = conf.getUntrackedParameter<bool>("TestBeam",true);
00037   std::string mapPath = "/" + conf.getUntrackedParameter<std::string>("MappingFile","");
00038 
00039   if(testBeam)
00040     {
00041       TBFEDid = conf.getUntrackedParameter<int>("TBFedId");
00042       TBendcap = conf.getUntrackedParameter<int>("TBEndcap");
00043       TBsector = conf.getUntrackedParameter<int>("TBSector");
00044     }
00045   else
00046     {
00047       TBFEDid = 0;
00048       TBsector = 0;
00049       TBendcap = 0;
00050     }
00051 
00052   TFMapping = new CSCTriggerMappingFromFile(getenv("CMSSW_BASE") + mapPath);
00053 
00054   eventNumber = 0;
00055 }


Member Function Documentation

void CSCTFValidator::analyze ( edm::Event const &  e,
edm::EventSetup const &  iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 57 of file CSCTFValidator.cc.

References GenMuonPlsPt100GeV_cfg::cout, CSCTriggerMapping::detId(), GeomDetEnumerators::endcap, lat::endl(), eventNumber, first, edm::Event::getByLabel(), FEDNumbering::getCSCTFFEDIds(), j, LogDebug, NULL, range, testBeam, TFMapping, and tracks.

00057                                                                            {
00058 
00059   // These declarations create handles to the types of records that you want
00060   // to retrieve from event "e".
00061   //
00062   edm::Handle<CSCCorrelatedLCTDigiCollection> corrlcts;
00063   edm::Handle<L1CSCTrackCollection> tracks;
00064   edm::Handle<FEDRawDataCollection> rawdata;
00065 
00066   // Pass the handle to the method "getByType", which is used to retrieve
00067   // one and only one instance of the type in question out of event "e". If
00068   // zero or more than one instance exists in the event an exception is thrown.
00069   //
00070 
00071   e.getByLabel("csctfunpacker","MuonCSCTFCorrelatedLCTDigi",corrlcts);
00072   e.getByLabel("csctfunpacker","MuonL1CSCTrackCollection",tracks);
00073   //e.getByLabel("DaqSource",rawdata);
00074 
00075   // read digi collections and print digis
00076   // compare to raw data
00077   CSCTFTBEventData *tbdata = NULL;
00078 
00079   for(int fedid = FEDNumbering::getCSCTFFEDIds().first;
00080       fedid <= ((testBeam) ? (FEDNumbering::getCSCTFFEDIds().first) : (FEDNumbering::getCSCTFFEDIds().second));
00081       ++fedid)
00082     {
00083 /*      const FEDRawData& fedData = rawdata->FEDData(fedid);
00084       if(fedData.size())
00085         {
00086       if(testBeam){
00087             CSCTFTBEventData *tbdata = new CSCTFTBEventData(reinterpret_cast<unsigned short*>(fedData.data()));
00088 
00089                 eventNumber = tbdata->eventHeader().getLvl1num();
00090 
00091             CSCTFTBFrontBlock aFB;
00092             CSCTFTBSPBlock aSPB;
00093             CSCTFTBSPData aSPD;
00094 
00095             for(int BX = 1; BX <= tbdata->eventHeader().numBX(); ++BX)
00096               {
00097                 if(testBeam) aFB = tbdata->frontDatum(BX);
00098                 else edm::LogInfo("CSCTFValidator|analyze") << "Not implemented yet\n";
00099                 for(int FPGA = 1; FPGA <= 5; ++FPGA)
00100                   {
00101                   for(int MPClink = 1; MPClink <= 3; ++MPClink)
00102                     {
00103                           int subsector = 0;
00104                           int station = 0;
00105 
00106                           if(FPGA == 1) subsector = 1;
00107                           if(FPGA == 2) subsector = 1;
00108                           station = (((FPGA - 1)==0) ? 1 : FPGA - 1);
00109 
00110                           int cscid = aFB.frontData(FPGA,MPClink).CSCIDPacked();
00111                           if(cscid)
00112                             {
00113                               try
00114                                 {
00115                                   CSCDetId id = TFMapping->detId(TBendcap,station,TBsector,subsector,cscid,3);
00116                                   int match = 0;
00117 
00118                                   CSCCorrelatedLCTDigiCollection::Range range = corrlcts->get(id);
00119                                   for(CSCCorrelatedLCTDigiCollection::const_iterator j = range.first;
00120                                       j != range.second; j++)
00121                                     if(j->getTrknmb() == aFB.frontDigiData(FPGA,MPClink).getTrknmb() &&
00122                                        j->isValid() == aFB.frontDigiData(FPGA,MPClink).isValid() &&
00123                                        j->getQuality() == aFB.frontDigiData(FPGA,MPClink).getQuality() &&
00124                                        j->getKeyWG() == aFB.frontDigiData(FPGA,MPClink).getKeyWG() &&
00125                                        j->getStrip() == aFB.frontDigiData(FPGA,MPClink).getStrip() &&
00126                                        j->getCLCTPattern() == aFB.frontDigiData(FPGA,MPClink).getCLCTPattern() &&
00127                                        j->getStripType() == aFB.frontDigiData(FPGA,MPClink).getStripType() &&
00128                                        j->getBend() == aFB.frontDigiData(FPGA,MPClink).getBend() &&
00129                                        j->getBX() == aFB.frontDigiData(FPGA,MPClink).getBX()) ++match;
00130 
00131 
00132                                   if(match < 1)
00133                                     {
00134                                       edm::LogError("CSCTFBValidator|analyze") << "NO DIGI IN DET\n";
00135                                       assert(1==0);
00136                                     }
00137                                 }
00138                               catch (cms::Exception &e)
00139                                 {
00140                                   edm::LogInfo("CSCTFValidator|analyze") << e.what() << "\ndigi not processed.";
00141                                 }
00142                             }
00143                   }
00144               }
00145             }
00146           }
00147       delete tbdata;
00148 
00149         } else { // Not a Test Beam
00150 */              for(unsigned int FPGA=0; FPGA<5; FPGA++){
00151                         int station = ( FPGA ? FPGA : 1 );
00152                         int subsector = ( FPGA>1 ? 0 : FPGA+1 );
00153 
00154                         for(int endcap=1; endcap<=2; endcap++)
00155                                 for(int sector=1; sector<=6; sector++)
00156                                         for(int cscid=1; cscid<10; cscid++){
00157 
00158                                                 try {
00159                                                         CSCDetId id = TFMapping->detId(endcap,station,sector,subsector,cscid,0);
00160                                                         CSCCorrelatedLCTDigiCollection::Range range = corrlcts->get(id);
00161                                                         for(CSCCorrelatedLCTDigiCollection::const_iterator j=range.first; j!=range.second; j++)
00162                                                                 std::cout<<"Trk: "<<j->getTrknmb()<<" valid: "<<j->isValid()<<" quality: "<<j->getQuality()
00163                                                                         <<" WG: "<<j->getKeyWG()<<" strip: "<<j->getStrip()<<" CLCT: "<<j->getCLCTPattern()
00164                                                                         <<" type: "<<j->getStripType()<<" bend: "<<j->getBend()<<" BX: "<<j->getBX()<<std::endl;
00165 
00166                                                 } catch (cms::Exception &e) {}
00167                                         }
00168 
00169                         for(L1CSCTrackCollection::const_iterator trk=tracks->begin(); trk<tracks->end(); trk++)
00170                                 std::cout<<"Trk: "<<trk->first.endcap()<<" endcap: "<<trk->first.endcap()<<" sector: "<<trk->first.sector()<<" BX: "<<trk->first.BX()<<std::endl;
00171                 }
00172 /*      }
00173 
00174 */
00175 
00176         }
00177 
00178   LogDebug ("CSCTFValidator::analyze")  << "end of event number " << eventNumber;
00179 }


Member Data Documentation

int CSCTFValidator::eventNumber [private]

Definition at line 33 of file CSCTFValidator.h.

Referenced by analyze(), and CSCTFValidator().

std::string CSCTFValidator::mapPath [private]

Definition at line 31 of file CSCTFValidator.h.

Referenced by CSCTFValidator().

int CSCTFValidator::TBendcap [private]

Definition at line 30 of file CSCTFValidator.h.

Referenced by CSCTFValidator().

int CSCTFValidator::TBFEDid [private]

Definition at line 30 of file CSCTFValidator.h.

Referenced by CSCTFValidator().

int CSCTFValidator::TBsector [private]

Definition at line 30 of file CSCTFValidator.h.

Referenced by CSCTFValidator().

bool CSCTFValidator::testBeam [private]

Definition at line 29 of file CSCTFValidator.h.

Referenced by analyze(), and CSCTFValidator().

CSCTriggerMappingFromFile* CSCTFValidator::TFMapping [private]

Definition at line 32 of file CSCTFValidator.h.

Referenced by analyze(), and CSCTFValidator().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:30 2009 for CMSSW by  doxygen 1.5.4