Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:53

0001 
0002 #include "L1Trigger/L1TMuonBarrel/interface/L1TMuonBarrelKalmanStubProcessor.h"
0003 #include <cmath>
0004 #include "CondFormats/L1TObjects/interface/L1MuDTTFParameters.h"
0005 #include "CondFormats/DataRecord/interface/L1MuDTTFParametersRcd.h"
0006 #include "CondFormats/L1TObjects/interface/L1MuDTTFMasks.h"
0007 #include "CondFormats/DataRecord/interface/L1MuDTTFMasksRcd.h"
0008 
0009 #include <iostream>
0010 #include <string>
0011 #include <sstream>
0012 
0013 L1TMuonBarrelKalmanStubProcessor::L1TMuonBarrelKalmanStubProcessor() : minPhiQuality_(0), minBX_(-3), maxBX_(3) {}
0014 
0015 L1TMuonBarrelKalmanStubProcessor::L1TMuonBarrelKalmanStubProcessor(const edm::ParameterSet& iConfig)
0016     : minPhiQuality_(iConfig.getParameter<int>("minPhiQuality")),
0017       minBX_(iConfig.getParameter<int>("minBX")),
0018       maxBX_(iConfig.getParameter<int>("maxBX")),
0019       eta1_(iConfig.getParameter<std::vector<int> >("cotTheta_1")),
0020       eta2_(iConfig.getParameter<std::vector<int> >("cotTheta_2")),
0021       eta3_(iConfig.getParameter<std::vector<int> >("cotTheta_3")),
0022       disableMasks_(iConfig.getParameter<bool>("disableMasks")),
0023       verbose_(iConfig.getParameter<int>("verbose")) {}
0024 
0025 L1TMuonBarrelKalmanStubProcessor::~L1TMuonBarrelKalmanStubProcessor() {}
0026 
0027 bool L1TMuonBarrelKalmanStubProcessor::isGoodPhiStub(const L1MuDTChambPhDigi* stub) {
0028   if (stub->code() < minPhiQuality_)
0029     return false;
0030   return true;
0031 }
0032 
0033 L1MuKBMTCombinedStub L1TMuonBarrelKalmanStubProcessor::buildStub(const L1MuDTChambPhDigi& phiS,
0034                                                                  const L1MuDTChambThDigi* etaS) {
0035   int wheel = phiS.whNum();
0036   int sector = phiS.scNum();
0037   int station = phiS.stNum();
0038   int phi = phiS.phi();
0039   int phiB = phiS.phiB();
0040   bool tag = (phiS.Ts2Tag() == 1);
0041   int bx = phiS.bxNum();
0042   int quality = phiS.code();
0043 
0044   //Now full eta
0045   int qeta1 = 0;
0046   int qeta2 = 0;
0047   int eta1 = 255;
0048   int eta2 = 255;
0049 
0050   bool hasEta = false;
0051   for (uint i = 0; i < 7; ++i) {
0052     if (etaS->position(i) == 0)
0053       continue;
0054     if (!hasEta) {
0055       hasEta = true;
0056       eta1 = calculateEta(i, etaS->whNum(), etaS->scNum(), etaS->stNum());
0057       if (etaS->quality(i) == 1)
0058         qeta1 = 2;
0059       else
0060         qeta1 = 1;
0061     } else {
0062       eta2 = calculateEta(i, etaS->whNum(), etaS->scNum(), etaS->stNum());
0063       if (etaS->quality(i) == 1)
0064         qeta2 = 2;
0065       else
0066         qeta2 = 1;
0067     }
0068   }
0069   L1MuKBMTCombinedStub stub(wheel, sector, station, phi, phiB, tag, bx, quality, eta1, eta2, qeta1, qeta2);
0070 
0071   return stub;
0072 }
0073 
0074 L1MuKBMTCombinedStub L1TMuonBarrelKalmanStubProcessor::buildStubNoEta(const L1MuDTChambPhDigi& phiS) {
0075   int wheel = phiS.whNum();
0076   int sector = phiS.scNum();
0077   int station = phiS.stNum();
0078   int phi = phiS.phi();
0079   int phiB = phiS.phiB();
0080   bool tag = (phiS.Ts2Tag() == 1);
0081   int bx = phiS.bxNum();
0082   int quality = phiS.code();
0083 
0084   //Now full eta
0085   int qeta1 = 0;
0086   int qeta2 = 0;
0087   int eta1 = 7;
0088   int eta2 = 7;
0089   L1MuKBMTCombinedStub stub(wheel, sector, station, phi, phiB, tag, bx, quality, eta1, eta2, qeta1, qeta2);
0090 
0091   return stub;
0092 }
0093 
0094 L1MuKBMTCombinedStubCollection L1TMuonBarrelKalmanStubProcessor::makeStubs(const L1MuDTChambPhContainer* phiContainer,
0095                                                                            const L1MuDTChambThContainer* etaContainer,
0096                                                                            const L1TMuonBarrelParams& params) {
0097   //get the masks from th standard BMTF setup!
0098   //    const L1TMuonBarrelParamsRcd& bmtfParamsRcd = setup.get<L1TMuonBarrelParamsRcd>();
0099   //  bmtfParamsRcd.get(bmtfParamsHandle);
0100   //  const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product();
0101   //  masks_ =  bmtfParams.l1mudttfmasks;
0102 
0103   //get the masks!
0104   L1MuDTTFMasks msks = params.l1mudttfmasks;
0105 
0106   L1MuKBMTCombinedStubCollection out;
0107   for (int bx = minBX_; bx <= maxBX_; bx++) {
0108     for (int wheel = -2; wheel <= 2; wheel++) {
0109       for (uint sector = 0; sector < 12; sector++) {
0110         for (uint station = 1; station < 5; station++) {
0111           //Have to cook up something for the fact that KMTF doesnt use 2 SP at whel=0
0112           int lwheel1;
0113           int lwheel2;
0114           if (wheel < 0) {
0115             lwheel1 = wheel - 1;
0116             lwheel2 = wheel - 1;
0117           } else if (wheel > 0) {
0118             lwheel1 = wheel + 1;
0119             lwheel2 = wheel + 1;
0120           } else {
0121             lwheel1 = -1;
0122             lwheel2 = +1;
0123           }
0124 
0125           bool phiMask = false;
0126           bool etaMask = false;
0127           if (station == 1) {
0128             phiMask = msks.get_inrec_chdis_st1(lwheel1, sector) || msks.get_inrec_chdis_st1(lwheel2, sector);
0129             etaMask = msks.get_etsoc_chdis_st1(lwheel1, sector) || msks.get_etsoc_chdis_st1(lwheel2, sector);
0130           }
0131           if (station == 2) {
0132             phiMask = msks.get_inrec_chdis_st2(lwheel1, sector) || msks.get_inrec_chdis_st2(lwheel2, sector);
0133             etaMask = msks.get_etsoc_chdis_st2(lwheel1, sector) || msks.get_etsoc_chdis_st2(lwheel2, sector);
0134           }
0135           if (station == 3) {
0136             phiMask = msks.get_inrec_chdis_st3(lwheel1, sector) || msks.get_inrec_chdis_st3(lwheel2, sector);
0137             etaMask = msks.get_etsoc_chdis_st3(lwheel1, sector) || msks.get_etsoc_chdis_st3(lwheel2, sector);
0138           }
0139           if (station == 4) {
0140             phiMask = msks.get_inrec_chdis_st4(lwheel1, sector) || msks.get_inrec_chdis_st4(lwheel2, sector);
0141           }
0142 
0143           if (disableMasks_) {
0144             phiMask = false;
0145             etaMask = false;
0146           }
0147 
0148           bool hasEta = false;
0149           L1MuDTChambThDigi const* tseta = etaContainer->chThetaSegm(wheel, station, sector, bx);
0150           if (tseta && (!etaMask)) {
0151             hasEta = true;
0152           }
0153 
0154           //      printf("Wheel=%d LWheel=%d,%d sector=%d station=%d phiMask=%d etaMask=%d\n",wheel,lwheel1,lwheel2,sector,station,phiMask,etaMask);
0155           //      if (abs(wheel)==2 && station==1)
0156           //        continue;
0157 
0158           L1MuDTChambPhDigi const* high = phiContainer->chPhiSegm1(wheel, station, sector, bx);
0159           if (high && (!phiMask)) {
0160             if (high->code() >= minPhiQuality_) {
0161               const L1MuDTChambPhDigi& stubPhi = *high;
0162               if (hasEta) {
0163                 out.push_back(buildStub(stubPhi, tseta));
0164               } else {
0165                 out.push_back(buildStubNoEta(stubPhi));
0166               }
0167             }
0168           }
0169 
0170           L1MuDTChambPhDigi const* low = phiContainer->chPhiSegm2(wheel, station, sector, bx - 1);
0171           if (low && !(phiMask)) {
0172             if (low->code() >= minPhiQuality_) {
0173               const L1MuDTChambPhDigi& stubPhi = *low;
0174               if (hasEta) {
0175                 out.push_back(buildStub(stubPhi, tseta));
0176               } else {
0177                 out.push_back(buildStubNoEta(stubPhi));
0178               }
0179             }
0180           }
0181         }
0182       }
0183     }
0184   }
0185 
0186   return out;
0187 }
0188 
0189 int L1TMuonBarrelKalmanStubProcessor::calculateEta(uint i, int wheel, uint sector, uint station) {
0190   int eta = 0;
0191   if (wheel > 0) {
0192     eta = 7 * wheel + 3 - i;
0193   } else if (wheel < 0) {
0194     eta = 7 * wheel + i - 3;
0195   } else {
0196     if (sector == 0 || sector == 3 || sector == 4 || sector == 7 || sector == 8 || sector == 11)
0197       eta = i - 3;
0198     else
0199       eta = 3 - i;
0200   }
0201 
0202   if (station == 1)
0203     eta = -eta1_[eta + 17];
0204   else if (station == 2)
0205     eta = -eta2_[eta + 17];
0206   else
0207     eta = -eta3_[eta + 17];
0208 
0209   return eta;
0210 }
0211 
0212 void L1TMuonBarrelKalmanStubProcessor::makeInputPattern(const L1MuDTChambPhContainer* phiContainer,
0213                                                         const L1MuDTChambThContainer* etaContainer,
0214                                                         int sector) {
0215   int previousSector;
0216   int nextSector;
0217 
0218   if (sector == 11)
0219     nextSector = 0;
0220   else
0221     nextSector = sector + 1;
0222 
0223   if (sector == 0)
0224     previousSector = 11;
0225   else
0226     previousSector = sector - 1;
0227 
0228   ostringstream os;
0229   os << "I " << sector << " ";
0230 
0231   bool hasStub = false;
0232 
0233   //start by previous sector
0234   for (int wheel = -2; wheel < 3; ++wheel) {
0235     const L1MuDTChambPhDigi* seg1 = phiContainer->chPhiSegm1(wheel, 1, previousSector, 0);
0236     if (seg1 && seg1->phi() > 111) {
0237       os << seg1->phi() - 2144 << " " << seg1->phiB() << " " << seg1->code() << " 1 4 ";
0238     } else {
0239       os << "-2048 0 0 0 15 ";
0240     }
0241     const L1MuDTChambPhDigi* seg2 = phiContainer->chPhiSegm1(wheel, 2, previousSector, 0);
0242     if (seg2 && seg2->phi() > 111) {
0243       os << seg2->phi() - 2144 << " " << seg2->phiB() << " " << seg2->code() << " 1 4 ";
0244     } else {
0245       os << "-2048 0 0 0 15 ";
0246     }
0247     const L1MuDTChambPhDigi* seg3 = phiContainer->chPhiSegm1(wheel, 3, previousSector, 0);
0248     if (seg3 && seg3->phi() > 111) {
0249       os << seg3->phi() - 2144 << " " << seg3->phiB() << " " << seg3->code() << " 1 4 ";
0250     } else {
0251       os << "-2048 0 0 0 15 ";
0252     }
0253     const L1MuDTChambPhDigi* seg4 = phiContainer->chPhiSegm1(wheel, 4, previousSector, 0);
0254     if (seg4 && seg4->phi() > 111) {
0255       os << seg4->phi() - 2144 << " " << seg4->phiB() << " " << seg4->code() << " 1 4 ";
0256     } else {
0257       os << "-2048 0 0 0 15 ";
0258     }
0259 
0260     const L1MuDTChambThDigi* eta1 = etaContainer->chThetaSegm(wheel, 1, previousSector, 0);
0261     if (eta1) {
0262       int etaPos = eta1->position(0) + (eta1->position(1) << 1) + (eta1->position(2) << 2) + (eta1->position(3) << 3) +
0263                    (eta1->position(4) << 4) + (eta1->position(5) << 5) + (eta1->position(6) << 6);
0264       os << etaPos << " ";
0265     } else {
0266       os << " 0 ";
0267     }
0268     const L1MuDTChambThDigi* eta2 = etaContainer->chThetaSegm(wheel, 2, previousSector, 0);
0269     if (eta2) {
0270       int etaPos = eta2->position(0) + (eta2->position(1) << 1) + (eta2->position(2) << 2) + (eta2->position(3) << 3) +
0271                    (eta2->position(4) << 4) + (eta2->position(5) << 5) + (eta2->position(6) << 6);
0272       os << etaPos << " ";
0273     } else {
0274       os << " 0 ";
0275     }
0276 
0277     const L1MuDTChambThDigi* eta3 = etaContainer->chThetaSegm(wheel, 3, previousSector, 0);
0278     if (eta3) {
0279       int etaPos = eta3->position(0) + (eta3->position(1) << 1) + (eta3->position(2) << 2) + (eta3->position(3) << 3) +
0280                    (eta3->position(4) << 4) + (eta3->position(5) << 5) + (eta3->position(6) << 6);
0281       os << etaPos << " ";
0282     } else {
0283       os << " 0 ";
0284     }
0285     const L1MuDTChambPhDigi* seg5 = phiContainer->chPhiSegm2(wheel, 1, previousSector, -1);
0286     if (seg5 && seg5->phi() > 111) {
0287       os << seg5->phi() - 2144 << " " << seg5->phiB() << " " << seg5->code() << " 1 5 ";
0288     } else {
0289       os << "-2048 0 0 0 15 ";
0290     }
0291 
0292     const L1MuDTChambPhDigi* seg6 = phiContainer->chPhiSegm2(wheel, 2, previousSector, -1);
0293     if (seg6 && seg6->phi() > 111) {
0294       os << seg6->phi() - 2144 << " " << seg6->phiB() << " " << seg6->code() << " 1 5 ";
0295     } else {
0296       os << "-2048 0 0 0 15 ";
0297     }
0298     const L1MuDTChambPhDigi* seg7 = phiContainer->chPhiSegm2(wheel, 3, previousSector, -1);
0299     if (seg7 && seg7->phi() > 111) {
0300       os << seg7->phi() - 2144 << " " << seg7->phiB() << " " << seg7->code() << " 1 5 ";
0301     } else {
0302       os << "-2048 0 0 0 15 ";
0303     }
0304     //const L1MuDTChambPhDigi* seg8 = phiContainer->chPhiSegm2(wheel, 4, previousSector, 1);
0305     const L1MuDTChambPhDigi* seg8 = phiContainer->chPhiSegm2(wheel, 4, previousSector, -1);
0306     if (seg8 && seg8->phi() > 111) {
0307       os << seg8->phi() - 2144 << " " << seg8->phiB() << " " << seg8->code() << " 1 5 ";
0308     } else {
0309       os << "-2048 0 0 0 15 ";
0310     }
0311     if (eta1) {
0312       int etaPos = eta1->quality(0) + (eta1->quality(1) << 1) + (eta1->quality(2) << 2) + (eta1->quality(3) << 3) +
0313                    (eta1->quality(4) << 4) + (eta1->quality(5) << 5) + (eta1->quality(6) << 6);
0314       os << etaPos << " ";
0315     } else {
0316       os << " 0 ";
0317     }
0318     if (eta2) {
0319       int etaPos = eta2->quality(0) + (eta2->quality(1) << 1) + (eta2->quality(2) << 2) + (eta2->quality(3) << 3) +
0320                    (eta2->quality(4) << 4) + (eta2->quality(5) << 5) + (eta2->quality(6) << 6);
0321       os << etaPos << " ";
0322     } else {
0323       os << " 0 ";
0324     }
0325     if (eta3) {
0326       int etaPos = eta3->quality(0) + (eta3->quality(1) << 1) + (eta3->quality(2) << 2) + (eta3->quality(3) << 3) +
0327                    (eta3->quality(4) << 4) + (eta3->quality(5) << 5) + (eta3->quality(6) << 6);
0328       os << etaPos << " ";
0329     } else {
0330       os << " 0 ";
0331     }
0332 
0333     //////////////////////CENTRAL SECTOR
0334     const L1MuDTChambPhDigi* seg9 = phiContainer->chPhiSegm1(wheel, 1, sector, 0);
0335     if (seg9) {
0336       os << seg9->phi() << " " << seg9->phiB() << " " << seg9->code() << " 1 0 ";
0337     } else {
0338       os << "-2048 0 0 0 15 ";
0339     }
0340     const L1MuDTChambPhDigi* seg10 = phiContainer->chPhiSegm1(wheel, 2, sector, 0);
0341     if (seg10) {
0342       hasStub = true;
0343       os << seg10->phi() << " " << seg10->phiB() << " " << seg10->code() << " 1 0 ";
0344     } else {
0345       os << "-2048 0 0 0 15 ";
0346     }
0347     const L1MuDTChambPhDigi* seg11 = phiContainer->chPhiSegm1(wheel, 3, sector, 0);
0348     if (seg11) {
0349       hasStub = true;
0350       os << seg11->phi() << " " << seg11->phiB() << " " << seg11->code() << " 1 0 ";
0351     } else {
0352       os << "-2048 0 0 0 15 ";
0353     }
0354     const L1MuDTChambPhDigi* seg12 = phiContainer->chPhiSegm1(wheel, 4, sector, 0);
0355     if (seg12) {
0356       hasStub = true;
0357       os << seg12->phi() << " " << seg12->phiB() << " " << seg12->code() << " 1 2 ";
0358     } else {
0359       os << "-2048 0 0 0 15 ";
0360     }
0361     const L1MuDTChambThDigi* eta4 = etaContainer->chThetaSegm(wheel, 1, sector, 0);
0362     if (eta4) {
0363       int etaPos = eta4->position(0) + (eta4->position(1) << 1) + (eta4->position(2) << 2) + (eta4->position(3) << 3) +
0364                    (eta4->position(4) << 4) + (eta4->position(5) << 5) + (eta4->position(6) << 6);
0365       os << etaPos << " ";
0366     } else {
0367       os << " 0 ";
0368     }
0369 
0370     const L1MuDTChambThDigi* eta5 = etaContainer->chThetaSegm(wheel, 2, sector, 0);
0371     if (eta5) {
0372       int etaPos = eta5->position(0) + (eta5->position(1) << 1) + (eta5->position(2) << 2) + (eta5->position(3) << 3) +
0373                    (eta5->position(4) << 4) + (eta5->position(5) << 5) + (eta5->position(6) << 6);
0374       os << etaPos << " ";
0375     } else {
0376       os << " 0 ";
0377     }
0378     const L1MuDTChambThDigi* eta6 = etaContainer->chThetaSegm(wheel, 3, sector, 0);
0379     if (eta6) {
0380       int etaPos = eta6->position(0) + (eta6->position(1) << 1) + (eta6->position(2) << 2) + (eta6->position(3) << 3) +
0381                    (eta6->position(4) << 4) + (eta6->position(5) << 5) + (eta6->position(6) << 6);
0382       os << etaPos << " ";
0383     } else {
0384       os << " 0 ";
0385     }
0386 
0387     const L1MuDTChambPhDigi* seg13 = phiContainer->chPhiSegm2(wheel, 1, sector, -1);
0388     if (seg13) {
0389       os << seg13->phi() << " " << seg13->phiB() << " " << seg13->code() << " 1 1 ";
0390     } else {
0391       os << "-2048 0 0 0 15 ";
0392     }
0393 
0394     const L1MuDTChambPhDigi* seg14 = phiContainer->chPhiSegm2(wheel, 2, sector, -1);
0395     if (seg14) {
0396       hasStub = true;
0397 
0398       os << seg14->phi() << " " << seg14->phiB() << " " << seg14->code() << " 1 1 ";
0399     } else {
0400       os << "-2048 0 0 0 15 ";
0401     }
0402 
0403     const L1MuDTChambPhDigi* seg15 = phiContainer->chPhiSegm2(wheel, 3, sector, -1);
0404     if (seg15) {
0405       hasStub = true;
0406 
0407       os << seg15->phi() << " " << seg15->phiB() << " " << seg15->code() << " 1 1 ";
0408     } else {
0409       os << "-2048 0 0 0 15 ";
0410     }
0411     const L1MuDTChambPhDigi* seg16 = phiContainer->chPhiSegm2(wheel, 4, sector, -1);
0412     if (seg16) {
0413       hasStub = true;
0414 
0415       os << seg16->phi() << " " << seg16->phiB() << " " << seg16->code() << " 1 1 ";
0416     } else {
0417       os << "-2048 0 0 0 15 ";
0418     }
0419 
0420     if (eta4) {
0421       int etaPos = eta4->quality(0) + (eta4->quality(1) << 1) + (eta4->quality(2) << 2) + (eta4->quality(3) << 3) +
0422                    (eta4->quality(4) << 4) + (eta4->quality(5) << 5) + (eta4->quality(6) << 6);
0423       os << etaPos << " ";
0424     } else {
0425       os << " 0 ";
0426     }
0427 
0428     if (eta5) {
0429       int etaPos = eta5->quality(0) + (eta5->quality(1) << 1) + (eta5->quality(2) << 2) + (eta5->quality(3) << 3) +
0430                    (eta5->quality(4) << 4) + (eta5->quality(5) << 5) + (eta5->quality(6) << 6);
0431       os << etaPos << " ";
0432     } else {
0433       os << " 0 ";
0434     }
0435     if (eta6) {
0436       int etaPos = eta6->quality(0) + (eta6->quality(1) << 1) + (eta6->quality(2) << 2) + (eta6->quality(3) << 3) +
0437                    (eta6->quality(4) << 4) + (eta6->quality(5) << 5) + (eta6->quality(6) << 6);
0438       os << etaPos << " ";
0439     } else {
0440       os << " 0 ";
0441     }
0442     /////NEXT SECTOR/////
0443     const L1MuDTChambPhDigi* seg17 = phiContainer->chPhiSegm1(wheel, 1, nextSector, 0);
0444     if (seg17 && seg17->phi() < -112) {
0445       os << seg17->phi() + 2144 << " " << seg17->phiB() << " " << seg17->code() << " 1 2 ";
0446     } else {
0447       os << "-2048 0 0 0 15 ";
0448     }
0449     const L1MuDTChambPhDigi* seg18 = phiContainer->chPhiSegm1(wheel, 2, nextSector, 0);
0450     if (seg18 && seg18->phi() < -112) {
0451       os << seg18->phi() + 2144 << " " << seg18->phiB() << " " << seg18->code() << " 1 2 ";
0452     } else {
0453       os << "-2048 0 0 0 15 ";
0454     }
0455     const L1MuDTChambPhDigi* seg19 = phiContainer->chPhiSegm1(wheel, 3, nextSector, 0);
0456     if (seg19 && seg19->phi() < -112) {
0457       os << seg19->phi() + 2144 << " " << seg19->phiB() << " " << seg19->code() << " 1 2 ";
0458     } else {
0459       os << "-2048 0 0 0 15 ";
0460     }
0461     const L1MuDTChambPhDigi* seg20 = phiContainer->chPhiSegm1(wheel, 4, nextSector, 0);
0462     if (seg20 && seg20->phi() < -112) {
0463       os << seg20->phi() + 2144 << " " << seg20->phiB() << " " << seg20->code() << " 1 2 ";
0464     } else {
0465       os << "-2048 0 0 0 15 ";
0466     }
0467     const L1MuDTChambThDigi* eta7 = etaContainer->chThetaSegm(wheel, 1, nextSector, 0);
0468     if (eta7) {
0469       int etaPos = eta7->position(0) + (eta7->position(1) << 1) + (eta7->position(2) << 2) + (eta7->position(3) << 3) +
0470                    (eta7->position(4) << 4) + (eta7->position(5) << 5) + (eta7->position(6) << 6);
0471       os << etaPos << " ";
0472     } else {
0473       os << " 0 ";
0474     }
0475     const L1MuDTChambThDigi* eta8 = etaContainer->chThetaSegm(wheel, 2, nextSector, 0);
0476     if (eta8) {
0477       int etaPos = eta8->position(0) + (eta8->position(1) << 1) + (eta8->position(2) << 2) + (eta8->position(3) << 3) +
0478                    (eta8->position(4) << 4) + (eta8->position(5) << 5) + (eta8->position(6) << 6);
0479       os << etaPos << " ";
0480     } else {
0481       os << " 0 ";
0482     }
0483     const L1MuDTChambThDigi* eta9 = etaContainer->chThetaSegm(wheel, 3, nextSector, 0);
0484     if (eta9) {
0485       int etaPos = eta9->position(0) + (eta9->position(1) << 1) + (eta9->position(2) << 2) + (eta9->position(3) << 3) +
0486                    (eta9->position(4) << 4) + (eta9->position(5) << 5) + (eta9->position(6) << 6);
0487       os << etaPos << " ";
0488     } else {
0489       os << " 0 ";
0490     }
0491     const L1MuDTChambPhDigi* seg21 = phiContainer->chPhiSegm2(wheel, 1, nextSector, -1);
0492     if (seg21 && seg21->phi() < -112) {
0493       os << seg21->phi() + 2144 << " " << seg21->phiB() << " " << seg21->code() << " 1 3 ";
0494     } else {
0495       os << "-2048 0 0 0 15 ";
0496     }
0497 
0498     const L1MuDTChambPhDigi* seg22 = phiContainer->chPhiSegm2(wheel, 2, nextSector, -1);
0499     if (seg22 && seg22->phi() < -112) {
0500       os << seg22->phi() + 2144 << " " << seg22->phiB() << " " << seg22->code() << " 1 3 ";
0501     } else {
0502       os << "-2048 0 0 0 15 ";
0503     }
0504     const L1MuDTChambPhDigi* seg23 = phiContainer->chPhiSegm2(wheel, 3, nextSector, -1);
0505     if (seg23 && seg23->phi() < -112) {
0506       os << seg23->phi() + 2144 << " " << seg23->phiB() << " " << seg23->code() << " 1 3 ";
0507     } else {
0508       os << "-2048 0 0 0 15 ";
0509     }
0510     const L1MuDTChambPhDigi* seg24 = phiContainer->chPhiSegm2(wheel, 4, nextSector, -1);
0511     if (seg24 && seg24->phi() < -112) {
0512       os << seg24->phi() + 2144 << " " << seg24->phiB() << " " << seg24->code() << " 1 3 ";
0513     } else {
0514       os << "-2048 0 0 0 15 ";
0515     }
0516     if (eta7) {
0517       int etaPos = eta7->quality(0) + (eta7->quality(1) << 1) + (eta7->quality(2) << 2) + (eta7->quality(3) << 3) +
0518                    (eta7->quality(4) << 4) + (eta7->quality(5) << 5) + (eta7->quality(6) << 6);
0519       os << etaPos << " ";
0520     } else {
0521       os << " 0 ";
0522     }
0523     if (eta8) {
0524       int etaPos = eta8->quality(0) + (eta8->quality(1) << 1) + (eta8->quality(2) << 2) + (eta8->quality(3) << 3) +
0525                    (eta8->quality(4) << 4) + (eta8->quality(5) << 5) + (eta8->quality(6) << 6);
0526       os << etaPos << " ";
0527     } else {
0528       os << " 0 ";
0529     }
0530     if (eta9) {
0531       int etaPos = eta9->quality(0) + (eta9->quality(1) << 1) + (eta9->quality(2) << 2) + (eta9->quality(3) << 3) +
0532                    (eta9->quality(4) << 4) + (eta9->quality(5) << 5) + (eta9->quality(6) << 6);
0533       os << etaPos << " ";
0534     } else {
0535       os << " 0 ";
0536     }
0537   }
0538   if (hasStub) {
0539     std::cout << os.str() << std::endl;
0540   }
0541 }