Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:48

0001 #include "L1Trigger/CSCTrackFinder/test/src/RunSRLUTs.h"
0002 
0003 #include <vector>
0004 #include <string>
0005 #include <string.h>
0006 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0007 #include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h"
0008 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
0009 
0010 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0011 
0012 #include "L1Trigger/CSCTrackFinder/interface/CSCTrackFinderDataTypes.h"
0013 
0014 namespace csctf_analysis
0015 {
0016 RunSRLUTs::RunSRLUTs()
0017 {
0018 
0019     //Set up SRLUTs
0020     bool TMB07 = true;
0021     edm::ParameterSet srLUTset;
0022     srLUTset.addUntrackedParameter<bool>("Binary",false);
0023     srLUTset.addUntrackedParameter<bool>("ReadLUTs",false);
0024     srLUTset.addUntrackedParameter<std::string>("LUTPath","./");
0025     srLUTset.addUntrackedParameter<bool>("UseMiniLUTs",true);
0026     int endcap=1;
0027     int sector=1;
0028 
0029   for(int station=1,fpga=0; station<=4 && fpga<5; station++)
0030   {
0031     if(station==1)
0032             for(int subSector=0; subSector<2 && fpga<5; subSector++)
0033             srLUTs_[fpga++] = new CSCSectorReceiverLUT(endcap, sector, subSector+1, station, srLUTset, TMB07);
0034     else
0035             srLUTs_[fpga++] = new CSCSectorReceiverLUT(endcap, sector, 0, station, srLUTset, TMB07);
0036   }
0037 
0038 
0039 }
0040 
0041 RunSRLUTs::~RunSRLUTs()
0042 {
0043 }
0044 
0045 void RunSRLUTs::run(std::vector<csctf::TrackStub> *stub_list)
0046 {
0047 
0048     //Assigning (global) eta and phi packed
0049     for(std::vector<csctf::TrackStub>::iterator itr=stub_list->begin(); itr!=stub_list->end(); itr++)
0050     {
0051       if(itr->station() != 5)
0052       {
0053         CSCDetId id(itr->getDetId().rawId());
0054         unsigned fpga = (id.station() == 1) ? CSCTriggerNumbering::triggerSubSectorFromLabels(id) - 1 : id.station();
0055 
0056             lclphidat lclPhi;
0057             try
0058         {
0059                     lclPhi = srLUTs_[fpga]->localPhi(itr->getStrip(), itr->getPattern(), itr->getQuality(), itr->getBend());
0060             }
0061         catch( cms::Exception &e )
0062         {
0063                     bzero(&lclPhi,sizeof(lclPhi));
0064             }
0065 
0066             gblphidat gblPhi;
0067             try
0068         {
0069                 gblPhi = srLUTs_[fpga]->globalPhiME(lclPhi.phi_local, itr->getKeyWG(), itr->cscid());
0070         }
0071         catch( cms::Exception &e )
0072         {
0073                 bzero(&gblPhi,sizeof(gblPhi));
0074             }
0075 
0076             gbletadat gblEta;
0077             try
0078         {
0079                 gblEta = srLUTs_[fpga]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, itr->getKeyWG(), itr->cscid());
0080             }
0081         catch( cms::Exception &e )
0082         {
0083                 bzero(&gblEta,sizeof(gblEta));
0084             }
0085 
0086             itr->setEtaPacked(gblEta.global_eta);
0087             itr->setPhiPacked(gblPhi.global_phi);
0088       }
0089     }
0090 }
0091 
0092 void RunSRLUTs::makeTrackStubs(const CSCCorrelatedLCTDigiCollection * inClcts,std::vector<csctf::TrackStub> *outStubVec)
0093 {
0094 
0095     // Making a list of track stubs from lct collection
0096     CSCCorrelatedLCTDigiCollection::DigiRangeIterator Citer;
0097     for(Citer = inClcts->begin(); Citer != inClcts->end(); Citer++)
0098     {
0099         CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
0100         CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
0101 
0102         for(; Diter != Dend; Diter++)
0103         {
0104             csctf::TrackStub theStub((*Diter),(*Citer).first);
0105             outStubVec->push_back(theStub);
0106         }
0107         }
0108 
0109     run(outStubVec);
0110 }
0111 
0112 void RunSRLUTs::makeAssociatedTrackStubs(const L1CSCTrackCollection * inTrackColl,TrackAndAssociatedStubsCollection *outTrkStubCol)
0113 {
0114   L1CSCTrackCollection::const_iterator l1CSCTrack;
0115   for (l1CSCTrack = inTrackColl->begin(); l1CSCTrack != inTrackColl->end(); l1CSCTrack++)
0116   {
0117     std::vector<csctf::TrackStub> stubList;
0118 
0119     csc::L1Track track = l1CSCTrack->first;
0120     CSCCorrelatedLCTDigiCollection clctDigiCol = l1CSCTrack->second;
0121 
0122     makeTrackStubs(&clctDigiCol,&stubList);
0123 
0124     //Addding Stubs and Track to l1TrackAndEasyStubs
0125     TrackAndAssociatedStubs tempTrackAndStubs;
0126     tempTrackAndStubs.first = track;
0127     tempTrackAndStubs.second = stubList;
0128     outTrkStubCol->push_back(tempTrackAndStubs);
0129   }
0130 
0131 }
0132 }