CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc

Go to the documentation of this file.
00001 #include <L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.h>
00002 #include <L1Trigger/DTTrackFinder/src/L1MuDTTFConfig.h>
00003 #include <L1TriggerConfig/DTTPGConfig/interface/DTConfigTraco.h>
00004 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
00005 #include <DataFormats/MuonDetId/interface/CSCTriggerNumbering.h>
00006 #include <DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h>
00007 #include <L1Trigger/CSCCommonTrigger/interface/CSCConstants.h>
00008 #include <DataFormats/MuonDetId/interface/DTChamberId.h>
00009 
00010 #include <L1Trigger/CSCTrackFinder/src/CSCTFDTReceiverLUT.h>
00011 
00012 CSCTriggerContainer<csctf::TrackStub> CSCTFDTReceiver::process(const L1MuDTChambPhContainer* dttrig)
00013 {
00014   dtstubs.clear();
00015   if( !dttrig ) return dtstubs;
00016 
00017   const int dt_minBX = L1MuDTTFConfig::getBxMin();
00018   const int dt_maxBX = L1MuDTTFConfig::getBxMax();
00019 
00020   const int dt_toffs = 0;// changed since DT tpg now centers around zero //abs(dt_maxBX - dt_minBX);
00021 
00022   // consider all BX
00023   for(int bx = dt_minBX + dt_toffs; bx <= dt_maxBX + dt_toffs; ++bx)
00024     for(int e = CSCDetId::minEndcapId(); e <= CSCDetId::maxEndcapId(); ++e)
00025       for(int s = CSCTriggerNumbering::minTriggerSectorId(); s <= CSCTriggerNumbering::maxTriggerSectorId(); ++s)
00026         {
00027           int wheel = (e == 1) ? 2 : -2;
00028           int sector = 2*s - 1;
00029           int csc_bx = bx + 6;//Delay DT stubs by 6 bx.
00030 
00031           // combine two 30 degree DT sectors into a 60 degree CSC
00032           // sector.
00033           for(int is = sector; is <= sector+1; ++is)
00034             {
00035               int iss = (is == 12) ? 0 : is;
00036               L1MuDTChambPhDigi* dtts[2];
00037 
00038               for(int stub = 0; stub < 2; ++stub)
00039                 {
00040                   dtts[stub] = (stub == 0) ? dttrig->chPhiSegm1(wheel,1,iss,bx) :
00041                                              dttrig->chPhiSegm2(wheel,1,iss,bx);
00042                   if(dtts[stub])
00043                     {
00044 
00045                       // --------------------------------------------------------------
00046                       // IKF: this code has been reformulated ...
00047                       // --------------------------------------------------------------
00048                       // // Convert stubs to CSC format (signed -> unsigned)
00049                       // // phi was 12 bits (signed) for pi radians = 57.3 deg
00050                       // // relative to center of 30 degree DT sector
00051                       // double tmp = static_cast<const double> (dtts[stub]->phi()) /
00052                       //        DTConfigTraco::RESOLPSIR * 180./M_PI + 15.;
00053                       // int phi = static_cast<int> (tmp/62. * (1<<(CSCBitWidths::kGlobalPhiDataBitWidth)));
00054                       // --------------------------------------------------------------
00055                       // IKF  ...and is now this line, actually works a tiny bit better.
00056                       // --------------------------------------------------------------
00057                       //                      float tmp = dtts[stub] -> phi() * 1.0;
00058                       //
00059                       //                      tmp *= 90.0;
00060                       //                      tmp /= 31.0;
00061                       //                      //                      tmp /= M_PI;
00062                       //                      tmp /= 3.1416;
00063                       //                      tmp += 1057.0;
00064                       //
00065                       //                      int phi = static_cast<int> (tmp);
00066 
00067                       // --------------------------------------------------------------
00068                       // IKF  ...and is now this line, actually works a tiny bit better.
00069                       // --------------------------------------------------------------
00070                       int phi = dtts[stub] -> phi();
00071 
00072                       if (phi < 0) phi += 4096;
00073 
00074                       if (phi > 4096)
00075                         { std::cout << "AAAAAAAAAAGH TOO BIG PHI:" << phi << std::endl;
00076                           continue; 
00077                         }
00078                       if (phi < 0){
00079                         std::cout << "AAAAAAAAH NEG PHI" << phi << std::endl;
00080                         continue;
00081                       }
00082 
00083                       phi = CSCTFDTReceiverLUT::lut[phi];
00084 
00085                       // --------------------------------------------------------------
00086 
00087                       // DT chambers may lie outside CSC sector boundary
00088                       // Eventually we need to extend CSC phi definition
00089                       // --------------------------------------------------------------
00090                       // IKF: this is a protection, physically can't happen in data (bus too narrow) - 
00091                       // - what really happens in data?
00092                       // --------------------------------------------------------------
00093 
00094                       phi = (phi>0) ? phi : 0;
00095                       phi = (phi<(1<<(CSCBitWidths::kGlobalPhiDataBitWidth))) ? phi :
00096                         (1<<(CSCBitWidths::kGlobalPhiDataBitWidth))-1;
00097 
00098 
00099                       // change phib from 10 bits to 5
00100                       int phib = ((dtts[stub]->phiB() & 0x3FF) >> 5) & 0x1F;// 0x3FF=1023, 0x1F=31
00101                       int qual = dtts[stub]->code();
00102                       // barrel allows quality=0!
00104                       qual = (qual + 1)%8;
00105 
00106                       CSCCorrelatedLCTDigi dtinfo(stub+1,1, qual, 0, stub, 0, phib, csc_bx+stub, 1+(is+1)%2);
00107                       DTChamberId dtid(wheel,1,iss+1);
00108                       csctf::TrackStub tsCSC(dtinfo,dtid, phi, 0);
00109 
00110                       dtstubs.push_back(tsCSC);
00111                     }
00112                 }
00113             }
00114         }
00115 
00116   return dtstubs;
00117 }
00118