Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-28 03:10:06

0001 //-------------------------------------------------
0002 //
0003 //   Class: IOPrinter
0004 //
0005 //   IOPrinter
0006 //
0007 //
0008 //   Author :
0009 //   G. Flouris               U Ioannina    Feb. 2015
0010 //   modifications:  G Karathanasis    U Athens
0011 //--------------------------------------------------
0012 #include "L1Trigger/L1TTwinMux/interface/IOPrinter.h"
0013 #include "L1Trigger/L1TTwinMux/interface/L1MuTMChambPhContainer.h"
0014 #include "DataFormats/Common/interface/Handle.h"
0015 
0016 using namespace std;
0017 
0018 void IOPrinter::run(edm::Handle<L1MuDTChambPhContainer> inphiDigis,
0019                     const L1MuDTChambPhContainer& outphiDigis,
0020                     edm::Handle<RPCDigiCollection> rpcDigis,
0021                     const RPCGeometry& rpcGeometry) {
0022   cout << "======================================================" << endl;
0023   int bx = 0, wheel = 0, sector = 0, station = 1;
0024 
0025   ///Align track segments that are coming in bx-1.
0026   cout << "DT Inputs/RPCDT Inputs" << endl;
0027   cout << "bx\twheel\tsector\tstation\tphi\tphib\tcode\tts2tag\tbxcnt\trpcbit" << endl;
0028 
0029   for (bx = -2; bx <= 2; bx++) {
0030     for (wheel = -2; wheel <= 2; wheel++) {
0031       for (sector = 0; sector < 12; sector++) {
0032         for (station = 1; station <= 4; station++) {
0033           auto dtts1 = inphiDigis->chPhiSegm1(wheel, station, sector, bx);
0034           auto dtts2 = inphiDigis->chPhiSegm2(wheel, station, sector, bx - 1);
0035           if (dtts1 && dtts1->code() != 7) {
0036             L1MuDTChambPhDigi dt_ts1 = *dtts1;
0037             cout << dtts1->bxNum() << "\t" << dtts1->whNum() << "\t" << dtts1->scNum() << "\t" << dtts1->stNum() << "\t"
0038                  << dtts1->phi() << "\t" << dtts1->phiB() << "\t" << dtts1->code() << "\t" << dtts1->Ts2Tag() << "\t"
0039                  << dtts1->BxCnt() << "\t0" << endl;
0040           }
0041           if (dtts2 && dtts2->code() != 7) {
0042             L1MuDTChambPhDigi dt_ts2 = *dtts2;
0043             cout << dtts2->bxNum() << "\t" << dtts2->whNum() << "\t" << dtts2->scNum() << "\t" << dtts2->stNum() << "\t"
0044                  << dtts2->phi() << "\t" << dtts2->phiB() << "\t" << dtts2->code() << "\t" << dtts2->Ts2Tag() << "\t"
0045                  << dtts2->BxCnt() << "\t0" << endl;
0046           }
0047         }
0048       }
0049     }
0050   }
0051 
0052   cout << endl;
0053 
0054   cout << "RPC Inputs" << endl;
0055   cout << "bx\tring\tsector\tstation\troll\tlayer\tstrip\tphi\tlocalX" << endl;
0056   //cout<<"RPCHitCleaner"<<endl;
0057   for (auto chamber = rpcDigis->begin(); chamber != rpcDigis->end(); ++chamber) {
0058     RPCDetId detid = (*chamber).first;
0059     for (auto digi = (*chamber).second.first; digi != (*chamber).second.second; ++digi) {
0060       RPCDigi digi_out(digi->strip(), digi->bx());
0061       //if(digi->bx()!=0) continue;
0062       int phi = RPCtoDTTranslator::radialAngle(detid, rpcGeometry, digi->strip()) << 2;
0063       float localx = RPCtoDTTranslator::localX(detid, rpcGeometry, digi->strip());
0064       cout << digi->bx() << "\t" << detid.ring() << "\t" << detid.sector() - 1 << "\t" << detid.station() << "\t"
0065            << detid.roll() << "\t" << detid.layer() << "\t" << digi->strip() << "\t" << phi << "\t" << localx << endl;
0066     }  ///for digicout
0067   }    ///for chamber
0068   cout << endl;
0069 
0070   cout << "TwinMux Output" << endl;
0071   cout << "bx\twheel\tsector\tstation\tphi\tphib\tcode\tts2tag\tbxcnt\trpcbit" << endl;
0072 
0073   for (bx = -2; bx <= 2; bx++) {
0074     for (wheel = -2; wheel <= 2; wheel++) {
0075       for (sector = 0; sector < 12; sector++) {
0076         for (station = 1; station <= 4; station++) {
0077           auto dtts1 = outphiDigis.chPhiSegm1(wheel, station, sector, bx);
0078           auto dtts2 = outphiDigis.chPhiSegm2(wheel, station, sector, bx - 1);
0079           if (dtts1 && dtts1->code() != 7) {
0080             L1MuDTChambPhDigi dt_ts1 = *dtts1;
0081             cout << dtts1->bxNum() << "\t" << dtts1->whNum() << "\t" << dtts1->scNum() << "\t" << dtts1->stNum() << "\t"
0082                  << dtts1->phi() << "\t" << dtts1->phiB() << "\t" << dtts1->code() << "\t" << dtts1->Ts2Tag() << "\t"
0083                  << dtts1->BxCnt() << "\t" << dtts1->RpcBit() << endl;
0084           }
0085           if (dtts2 && dtts2->code() != 7) {
0086             L1MuDTChambPhDigi dt_ts2 = *dtts2;
0087             cout << dtts2->bxNum() << "\t" << dtts2->whNum() << "\t" << dtts2->scNum() << "\t" << dtts2->stNum() << "\t"
0088                  << dtts2->phi() << "\t" << dtts2->phiB() << "\t" << dtts2->code() << "\t" << dtts2->Ts2Tag() << "\t"
0089                  << dtts2->BxCnt() << "\t" << dtts2->RpcBit() << endl;
0090           }
0091         }
0092       }
0093     }
0094   }
0095 
0096   cout << "======================================================" << endl;
0097 }
0098 
0099 void IOPrinter::run(L1MuDTChambPhContainer const* inphiDigis,
0100                     const L1MuDTChambPhContainer& outphiDigis,
0101                     RPCDigiCollection const* rpcDigis,
0102                     const RPCGeometry& rpcGeometry) {
0103   cout << "======================================================" << endl;
0104   int bx = 0, wheel = 0, sector = 0, station = 1;
0105   L1MuTMChambPhContainer inphiDigis_tm;
0106   const std::vector<L1MuDTChambPhDigi>* vInCon = inphiDigis->getContainer();
0107   inphiDigis_tm.setContainer(*vInCon);
0108 
0109   ///Align track segments that are coming in bx-1.
0110   cout << "RPC->DT Inputs" << endl;
0111   cout << "bx\twheel\tsector\tstation\tphi\tphib\tcode\tts2tag\tbxcnt\trpcbit" << endl;
0112 
0113   for (bx = -2; bx <= 2; bx++) {
0114     for (wheel = -2; wheel <= 2; wheel++) {
0115       for (sector = 0; sector < 12; sector++) {
0116         for (station = 1; station <= 4; station++) {
0117           int nhits = DTRPCBxCorrection::nRPCHits(*inphiDigis, bx, wheel, sector, station);
0118           for (int hit = 0; hit < nhits; hit++) {
0119             auto dtts1 = inphiDigis_tm.chPhiSegm(wheel, station, sector, bx, hit);
0120             if (dtts1) {
0121               cout << dtts1->bxNum() << "\t" << dtts1->whNum() << "\t" << dtts1->scNum() << "\t" << dtts1->stNum()
0122                    << "\t" << dtts1->phi() << "\t" << dtts1->phiB() << "\t" << dtts1->code() << "\t" << dtts1->Ts2Tag()
0123                    << "\t" << dtts1->BxCnt() << "\t0" << endl;
0124             }
0125           }
0126         }
0127       }
0128     }
0129   }
0130 
0131   cout << endl;
0132 
0133   cout << "RPC Inputs" << endl;
0134   cout << "bx\tring\tsector\tstation\troll\tlayer\tstrip\tphi\tlocalX" << endl;
0135   //cout<<"RPCHitCleaner"<<endl;
0136   for (auto chamber = rpcDigis->begin(); chamber != rpcDigis->end(); ++chamber) {
0137     RPCDetId detid = (*chamber).first;
0138     for (auto digi = (*chamber).second.first; digi != (*chamber).second.second; ++digi) {
0139       RPCDigi digi_out(digi->strip(), digi->bx());
0140       //if(digi->bx()!=0) continue;
0141       int phi = RPCtoDTTranslator::radialAngle(detid, rpcGeometry, digi->strip()) << 2;
0142       float localx = RPCtoDTTranslator::localX(detid, rpcGeometry, digi->strip());
0143       cout << digi->bx() << "\t" << detid.ring() << "\t" << detid.sector() - 1 << "\t" << detid.station() << "\t"
0144            << detid.roll() << "\t" << detid.layer() << "\t" << digi->strip() << "\t" << phi << "\t" << localx << endl;
0145     }  ///for digicout
0146   }    ///for chamber
0147   cout << endl;
0148 
0149   cout << "TwinMux Output" << endl;
0150   cout << "bx\twheel\tsector\tstation\tphi\tphib\tcode\tts2tag\tbxcnt\trpcbit" << endl;
0151 
0152   for (bx = -2; bx <= 2; bx++) {
0153     for (wheel = -2; wheel <= 2; wheel++) {
0154       for (sector = 0; sector < 12; sector++) {
0155         for (station = 1; station <= 4; station++) {
0156           auto dtts1 = outphiDigis.chPhiSegm1(wheel, station, sector, bx);
0157           auto dtts2 = outphiDigis.chPhiSegm2(wheel, station, sector, bx - 1);
0158           if (dtts1 && dtts1->code() != 7) {
0159             L1MuDTChambPhDigi dt_ts1 = *dtts1;
0160             cout << dtts1->bxNum() << "\t" << dtts1->whNum() << "\t" << dtts1->scNum() << "\t" << dtts1->stNum() << "\t"
0161                  << dtts1->phi() << "\t" << dtts1->phiB() << "\t" << dtts1->code() << "\t" << dtts1->Ts2Tag() << "\t"
0162                  << dtts1->BxCnt() << "\t" << dtts1->RpcBit() << endl;
0163           }
0164           if (dtts2 && dtts2->code() != 7) {
0165             L1MuDTChambPhDigi dt_ts2 = *dtts2;
0166             cout << dtts2->bxNum() << "\t" << dtts2->whNum() << "\t" << dtts2->scNum() << "\t" << dtts2->stNum() << "\t"
0167                  << dtts2->phi() << "\t" << dtts2->phiB() << "\t" << dtts2->code() << "\t" << dtts2->Ts2Tag() << "\t"
0168                  << dtts2->BxCnt() << "\t" << dtts2->RpcBit() << endl;
0169           }
0170         }
0171       }
0172     }
0173   }
0174 
0175   cout << "======================================================" << endl;
0176 }