Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:02

0001 #include "L1Trigger/TrackFindingTracklet/interface/TrackletCalculator.h"
0002 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0003 #include "L1Trigger/TrackFindingTracklet/interface/Globals.h"
0004 #include "L1Trigger/TrackFindingTracklet/interface/TrackletProjectionsMemory.h"
0005 #include "L1Trigger/TrackFindingTracklet/interface/AllStubsMemory.h"
0006 #include "L1Trigger/TrackFindingTracklet/interface/StubPairsMemory.h"
0007 #include "L1Trigger/TrackFindingTracklet/interface/IMATH_TrackletCalculator.h"
0008 #include "L1Trigger/TrackFindingTracklet/interface/IMATH_TrackletCalculatorDisk.h"
0009 #include "L1Trigger/TrackFindingTracklet/interface/IMATH_TrackletCalculatorOverlap.h"
0010 
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "FWCore/Utilities/interface/Exception.h"
0013 
0014 using namespace std;
0015 using namespace trklet;
0016 
0017 TrackletCalculator::TrackletCalculator(string name, Settings const& settings, Globals* globals)
0018     : TrackletCalculatorBase(name, settings, globals) {
0019   for (unsigned int ilayer = 0; ilayer < N_LAYER; ilayer++) {
0020     vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(ilayer), nullptr);
0021     trackletprojlayers_.push_back(tmp);
0022   }
0023 
0024   for (unsigned int idisk = 0; idisk < N_DISK; idisk++) {
0025     vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(idisk + N_LAYER), nullptr);
0026     trackletprojdisks_.push_back(tmp);
0027   }
0028 
0029   initLayerDisksandISeed(layerdisk1_, layerdisk2_, iSeed_);
0030 
0031   // set TC index
0032   iTC_ = name_[7] - 'A';
0033 
0034   TCIndex_ = (iSeed_ << 4) + iTC_;
0035   assert(TCIndex_ >= 0 && TCIndex_ <= (int)settings_.ntrackletmax());
0036 
0037   if (settings_.usephicritapprox()) {
0038     double phicritFactor =
0039         0.5 * settings_.rcrit() * globals_->ITC_L1L2()->rinv_final.K() / globals_->ITC_L1L2()->phi0_final.K();
0040     if (std::abs(phicritFactor - 2.) > 0.25)
0041       edm::LogPrint("Tracklet")
0042           << "TrackletCalculator::TrackletCalculator phicrit approximation may be invalid! Please check.";
0043   }
0044 
0045   // reduced config has only one TC, so this must be the first
0046   const bool isFirstTC = (iTC_ == 0 || settings_.reduced());
0047 
0048   // write the drinv and invt inverse tables
0049   if ((settings_.writeInvTable() || settings_.writeHLSInvTable() || settings_.writeTable()) && isFirstTC) {
0050     void (*writeLUT)(const VarInv&, const string&) = nullptr;
0051     if (settings.writeInvTable()) {  // Verilog version
0052       writeLUT = [](const VarInv& x, const string& basename) -> void {
0053         ofstream fs(basename + ".tab");
0054         return x.writeLUT(fs, VarBase::verilog);
0055       };
0056     } else {  // HLS version
0057       writeLUT = [](const VarInv& x, const string& basename) -> void {
0058         ofstream fs(basename + ".tab");
0059         return x.writeLUT(fs, VarBase::hls);
0060       };
0061     }
0062     writeInvTable(writeLUT);
0063   }
0064 
0065   // write the firmware design for the calculation of the tracklet parameters
0066   // and projections
0067   if ((settings_.writeVerilog() || settings_.writeHLS()) && isFirstTC) {
0068     void (*writeDesign)(const vector<VarBase*>&, const string&) = nullptr;
0069     if (settings.writeVerilog()) {  // Verilog version
0070       writeDesign = [](const vector<VarBase*>& v, const string& basename) -> void {
0071         ofstream fs(basename + ".v");
0072         return VarBase::verilog_print(v, fs);
0073       };
0074     } else {  // HLS version
0075       writeDesign = [](const vector<VarBase*>& v, const string& basename) -> void {
0076         ofstream fs(basename + ".cpp");
0077         return VarBase::hls_print(v, fs);
0078       };
0079     }
0080     writeFirmwareDesign(writeDesign);
0081   }
0082 }
0083 
0084 void TrackletCalculator::addOutputProjection(TrackletProjectionsMemory*& outputProj, MemoryBase* memory) {
0085   outputProj = dynamic_cast<TrackletProjectionsMemory*>(memory);
0086   assert(outputProj != nullptr);
0087 }
0088 
0089 void TrackletCalculator::addOutput(MemoryBase* memory, string output) {
0090   if (settings_.writetrace()) {
0091     edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
0092                                  << output;
0093   }
0094   if (output == "trackpar") {
0095     auto* tmp = dynamic_cast<TrackletParametersMemory*>(memory);
0096     assert(tmp != nullptr);
0097     trackletpars_ = tmp;
0098     return;
0099   }
0100 
0101   if (output.substr(0, 7) == "projout") {
0102     //output is on the form 'projoutL2PHIC' or 'projoutD3PHIB'
0103     auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
0104     assert(tmp != nullptr);
0105 
0106     unsigned int layerdisk = output[8] - '1';   //layer or disk counting from 0
0107     unsigned int phiregion = output[12] - 'A';  //phiregion counting from 0
0108 
0109     if (output[7] == 'L') {
0110       assert(layerdisk < N_LAYER);
0111       assert(phiregion < trackletprojlayers_[layerdisk].size());
0112       //check that phiregion not already initialized
0113       assert(trackletprojlayers_[layerdisk][phiregion] == nullptr);
0114       trackletprojlayers_[layerdisk][phiregion] = tmp;
0115       return;
0116     }
0117 
0118     if (output[7] == 'D') {
0119       assert(layerdisk < N_DISK);
0120       assert(phiregion < trackletprojdisks_[layerdisk].size());
0121       //check that phiregion not already initialized
0122       assert(trackletprojdisks_[layerdisk][phiregion] == nullptr);
0123       trackletprojdisks_[layerdisk][phiregion] = tmp;
0124       return;
0125     }
0126   }
0127 
0128   throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
0129 }
0130 
0131 void TrackletCalculator::addInput(MemoryBase* memory, string input) {
0132   if (settings_.writetrace()) {
0133     edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
0134                                  << input;
0135   }
0136   if (input == "innerallstubin") {
0137     auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
0138     assert(tmp != nullptr);
0139     innerallstubs_.push_back(tmp);
0140     return;
0141   }
0142   if (input == "outerallstubin") {
0143     auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
0144     assert(tmp != nullptr);
0145     outerallstubs_.push_back(tmp);
0146     return;
0147   }
0148   if (input.substr(0, 8) == "stubpair") {
0149     auto* tmp = dynamic_cast<StubPairsMemory*>(memory);
0150     assert(tmp != nullptr);
0151     stubpairs_.push_back(tmp);
0152     return;
0153   }
0154   throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find intput : " << input;
0155 }
0156 
0157 void TrackletCalculator::execute(unsigned int iSector, double phimin, double phimax) {
0158   unsigned int countall = 0;
0159   unsigned int countsel = 0;
0160 
0161   phimin_ = phimin;
0162   phimax_ = phimax;
0163   iSector_ = iSector;
0164 
0165   //Helpfull to have for debugging the HLS code - will keep here for now.
0166   //bool print = (iSector == 3) && (getName() == "TC_L1L2G");
0167   //print = false;
0168 
0169   for (auto& stubpair : stubpairs_) {
0170     if (trackletpars_->nTracklets() >= settings_.ntrackletmax()) {
0171       edm::LogVerbatim("Tracklet") << "Will break on too many tracklets in " << getName();
0172       break;
0173     }
0174     for (unsigned int i = 0; i < stubpair->nStubPairs(); i++) {
0175       countall++;
0176       const Stub* innerFPGAStub = stubpair->getVMStub1(i).stub();
0177       const L1TStub* innerStub = innerFPGAStub->l1tstub();
0178 
0179       const Stub* outerFPGAStub = stubpair->getVMStub2(i).stub();
0180       const L1TStub* outerStub = outerFPGAStub->l1tstub();
0181 
0182       if (settings_.debugTracklet()) {
0183         edm::LogVerbatim("Tracklet") << "TrackletCalculator execute " << getName() << "[" << iSector << "]";
0184       }
0185 
0186       if (innerFPGAStub->layerdisk() < N_LAYER && (getName() != "TC_D1L2A" && getName() != "TC_D1L2B")) {
0187         if (outerFPGAStub->layerdisk() >= N_LAYER) {
0188           //overlap seeding
0189           bool accept = overlapSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub);
0190           if (accept)
0191             countsel++;
0192         } else {
0193           //barrel+barrel seeding
0194           bool accept = barrelSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
0195           if (accept)
0196             countsel++;
0197         }
0198       } else {
0199         if (outerFPGAStub->layerdisk() >= N_LAYER) {
0200           //disk+disk seeding
0201           bool accept = diskSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
0202           if (accept)
0203             countsel++;
0204         } else if (innerFPGAStub->layerdisk() >= N_LAYER) {
0205           //layer+disk seeding
0206           bool accept = overlapSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
0207           if (accept)
0208             countsel++;
0209         } else {
0210           throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " invalid seeding";
0211         }
0212       }
0213 
0214       if (trackletpars_->nTracklets() >= settings_.ntrackletmax()) {
0215         edm::LogVerbatim("Tracklet") << "Will break on number of tracklets in " << getName();
0216         break;
0217       }
0218 
0219       if (countall >= settings_.maxStep("TC")) {
0220         if (settings_.debugTracklet())
0221           edm::LogVerbatim("Tracklet") << "Will break on MAXTC 1";
0222         break;
0223       }
0224       if (settings_.debugTracklet()) {
0225         edm::LogVerbatim("Tracklet") << "TrackletCalculator execute done";
0226       }
0227     }
0228     if (countall >= settings_.maxStep("TC")) {
0229       if (settings_.debugTracklet())
0230         edm::LogVerbatim("Tracklet") << "Will break on MAXTC 2";
0231       break;
0232     }
0233   }
0234 
0235   if (settings_.writeMonitorData("TC")) {
0236     globals_->ofstream("trackletcalculator.txt") << getName() << " " << countall << " " << countsel << endl;
0237   }
0238 }
0239 
0240 void TrackletCalculator::writeInvTable(void (*writeLUT)(const VarInv&, const string&)) {
0241   switch (iSeed_) {
0242     case 0:  // L1L2
0243       writeLUT(globals_->ITC_L1L2()->drinv, settings_.tablePath() + "TC_L1L2_drinv");
0244       writeLUT(globals_->ITC_L1L2()->invt, settings_.tablePath() + "TC_L1L2_invt");
0245       break;
0246     case 1:  // L2L3
0247       writeLUT(globals_->ITC_L2L3()->drinv, settings_.tablePath() + "TC_L2L3_drinv");
0248       writeLUT(globals_->ITC_L2L3()->invt, settings_.tablePath() + "TC_L2L3_invt");
0249       break;
0250     case 2:  // L3L4
0251       writeLUT(globals_->ITC_L3L4()->drinv, settings_.tablePath() + "TC_L3L4_drinv");
0252       writeLUT(globals_->ITC_L3L4()->invt, settings_.tablePath() + "TC_L3L4_invt");
0253       break;
0254     case 3:  // L5L6
0255       writeLUT(globals_->ITC_L5L6()->drinv, settings_.tablePath() + "TC_L5L6_drinv");
0256       writeLUT(globals_->ITC_L5L6()->invt, settings_.tablePath() + "TC_L5L6_invt");
0257       break;
0258     case 4:  // D1D2
0259       writeLUT(globals_->ITC_F1F2()->drinv, settings_.tablePath() + "TC_F1F2_drinv");
0260       writeLUT(globals_->ITC_F1F2()->invt, settings_.tablePath() + "TC_F1F2_invt");
0261       writeLUT(globals_->ITC_B1B2()->drinv, settings_.tablePath() + "TC_B1B2_drinv");
0262       writeLUT(globals_->ITC_B1B2()->invt, settings_.tablePath() + "TC_B1B2_invt");
0263       break;
0264     case 5:  // D3D4
0265       writeLUT(globals_->ITC_F3F4()->drinv, settings_.tablePath() + "TC_F3F4_drinv");
0266       writeLUT(globals_->ITC_F3F4()->invt, settings_.tablePath() + "TC_F3F4_invt");
0267       writeLUT(globals_->ITC_B3B4()->drinv, settings_.tablePath() + "TC_B3B4_drinv");
0268       writeLUT(globals_->ITC_B3B4()->invt, settings_.tablePath() + "TC_B3B4_invt");
0269       break;
0270     case 6:  // L1D1
0271       writeLUT(globals_->ITC_L1F1()->drinv, settings_.tablePath() + "TC_L1F1_drinv");
0272       writeLUT(globals_->ITC_L1F1()->invt, settings_.tablePath() + "TC_L1F1_invt");
0273       writeLUT(globals_->ITC_L1B1()->drinv, settings_.tablePath() + "TC_L1B1_drinv");
0274       writeLUT(globals_->ITC_L1B1()->invt, settings_.tablePath() + "TC_L1B1_invt");
0275       break;
0276     case 7:  // L2D1
0277       writeLUT(globals_->ITC_L2F1()->drinv, settings_.tablePath() + "TC_L2F1_drinv");
0278       writeLUT(globals_->ITC_L2F1()->invt, settings_.tablePath() + "TC_L2F1_invt");
0279       writeLUT(globals_->ITC_L2B1()->drinv, settings_.tablePath() + "TC_L2B1_drinv");
0280       writeLUT(globals_->ITC_L2B1()->invt, settings_.tablePath() + "TC_L2B1_invt");
0281       break;
0282   }
0283 }
0284 
0285 void TrackletCalculator::writeFirmwareDesign(void (*writeDesign)(const vector<VarBase*>&, const string&)) {
0286   switch (iSeed_) {
0287     case 0:  // L1L2
0288     {
0289       const vector<VarBase*> v = {&globals_->ITC_L1L2()->rinv_final,     &globals_->ITC_L1L2()->phi0_final,
0290                                   &globals_->ITC_L1L2()->t_final,        &globals_->ITC_L1L2()->z0_final,
0291                                   &globals_->ITC_L1L2()->phiL_0_final,   &globals_->ITC_L1L2()->phiL_1_final,
0292                                   &globals_->ITC_L1L2()->phiL_2_final,   &globals_->ITC_L1L2()->phiL_3_final,
0293                                   &globals_->ITC_L1L2()->zL_0_final,     &globals_->ITC_L1L2()->zL_1_final,
0294                                   &globals_->ITC_L1L2()->zL_2_final,     &globals_->ITC_L1L2()->zL_3_final,
0295                                   &globals_->ITC_L1L2()->der_phiL_final, &globals_->ITC_L1L2()->der_zL_final,
0296                                   &globals_->ITC_L1L2()->phiD_0_final,   &globals_->ITC_L1L2()->phiD_1_final,
0297                                   &globals_->ITC_L1L2()->phiD_2_final,   &globals_->ITC_L1L2()->phiD_3_final,
0298                                   &globals_->ITC_L1L2()->phiD_4_final,   &globals_->ITC_L1L2()->rD_0_final,
0299                                   &globals_->ITC_L1L2()->rD_1_final,     &globals_->ITC_L1L2()->rD_2_final,
0300                                   &globals_->ITC_L1L2()->rD_3_final,     &globals_->ITC_L1L2()->rD_4_final,
0301                                   &globals_->ITC_L1L2()->der_phiD_final, &globals_->ITC_L1L2()->der_rD_final};
0302       writeDesign(v, "TC_L1L2");
0303     } break;
0304     case 1:  // L2L3
0305     {
0306       const vector<VarBase*> v = {&globals_->ITC_L2L3()->rinv_final,     &globals_->ITC_L2L3()->phi0_final,
0307                                   &globals_->ITC_L2L3()->t_final,        &globals_->ITC_L2L3()->z0_final,
0308                                   &globals_->ITC_L2L3()->phiL_0_final,   &globals_->ITC_L2L3()->phiL_1_final,
0309                                   &globals_->ITC_L2L3()->phiL_2_final,   &globals_->ITC_L2L3()->phiL_3_final,
0310                                   &globals_->ITC_L2L3()->zL_0_final,     &globals_->ITC_L2L3()->zL_1_final,
0311                                   &globals_->ITC_L2L3()->zL_2_final,     &globals_->ITC_L2L3()->zL_3_final,
0312                                   &globals_->ITC_L2L3()->der_phiL_final, &globals_->ITC_L2L3()->der_zL_final,
0313                                   &globals_->ITC_L2L3()->phiD_0_final,   &globals_->ITC_L2L3()->phiD_1_final,
0314                                   &globals_->ITC_L2L3()->phiD_2_final,   &globals_->ITC_L2L3()->phiD_3_final,
0315                                   &globals_->ITC_L2L3()->phiD_4_final,   &globals_->ITC_L2L3()->rD_0_final,
0316                                   &globals_->ITC_L2L3()->rD_1_final,     &globals_->ITC_L2L3()->rD_2_final,
0317                                   &globals_->ITC_L2L3()->rD_3_final,     &globals_->ITC_L2L3()->rD_4_final,
0318                                   &globals_->ITC_L2L3()->der_phiD_final, &globals_->ITC_L2L3()->der_rD_final};
0319       writeDesign(v, "TC_L2L3");
0320     } break;
0321     case 2:  // L3L4
0322     {
0323       const vector<VarBase*> v = {&globals_->ITC_L3L4()->rinv_final,     &globals_->ITC_L3L4()->phi0_final,
0324                                   &globals_->ITC_L3L4()->t_final,        &globals_->ITC_L3L4()->z0_final,
0325                                   &globals_->ITC_L3L4()->phiL_0_final,   &globals_->ITC_L3L4()->phiL_1_final,
0326                                   &globals_->ITC_L3L4()->phiL_2_final,   &globals_->ITC_L3L4()->phiL_3_final,
0327                                   &globals_->ITC_L3L4()->zL_0_final,     &globals_->ITC_L3L4()->zL_1_final,
0328                                   &globals_->ITC_L3L4()->zL_2_final,     &globals_->ITC_L3L4()->zL_3_final,
0329                                   &globals_->ITC_L3L4()->der_phiL_final, &globals_->ITC_L3L4()->der_zL_final,
0330                                   &globals_->ITC_L3L4()->phiD_0_final,   &globals_->ITC_L3L4()->phiD_1_final,
0331                                   &globals_->ITC_L3L4()->phiD_2_final,   &globals_->ITC_L3L4()->phiD_3_final,
0332                                   &globals_->ITC_L3L4()->phiD_4_final,   &globals_->ITC_L3L4()->rD_0_final,
0333                                   &globals_->ITC_L3L4()->rD_1_final,     &globals_->ITC_L3L4()->rD_2_final,
0334                                   &globals_->ITC_L3L4()->rD_3_final,     &globals_->ITC_L3L4()->rD_4_final,
0335                                   &globals_->ITC_L3L4()->der_phiD_final, &globals_->ITC_L3L4()->der_rD_final};
0336       writeDesign(v, "TC_L3L4");
0337     } break;
0338     case 3:  // L5L6
0339     {
0340       const vector<VarBase*> v = {&globals_->ITC_L5L6()->rinv_final,     &globals_->ITC_L5L6()->phi0_final,
0341                                   &globals_->ITC_L5L6()->t_final,        &globals_->ITC_L5L6()->z0_final,
0342                                   &globals_->ITC_L5L6()->phiL_0_final,   &globals_->ITC_L5L6()->phiL_1_final,
0343                                   &globals_->ITC_L5L6()->phiL_2_final,   &globals_->ITC_L5L6()->phiL_3_final,
0344                                   &globals_->ITC_L5L6()->zL_0_final,     &globals_->ITC_L5L6()->zL_1_final,
0345                                   &globals_->ITC_L5L6()->zL_2_final,     &globals_->ITC_L5L6()->zL_3_final,
0346                                   &globals_->ITC_L5L6()->der_phiL_final, &globals_->ITC_L5L6()->der_zL_final,
0347                                   &globals_->ITC_L5L6()->phiD_0_final,   &globals_->ITC_L5L6()->phiD_1_final,
0348                                   &globals_->ITC_L5L6()->phiD_2_final,   &globals_->ITC_L5L6()->phiD_3_final,
0349                                   &globals_->ITC_L5L6()->phiD_4_final,   &globals_->ITC_L5L6()->rD_0_final,
0350                                   &globals_->ITC_L5L6()->rD_1_final,     &globals_->ITC_L5L6()->rD_2_final,
0351                                   &globals_->ITC_L5L6()->rD_3_final,     &globals_->ITC_L5L6()->rD_4_final,
0352                                   &globals_->ITC_L5L6()->der_phiD_final, &globals_->ITC_L5L6()->der_rD_final};
0353       writeDesign(v, "TC_L5L6");
0354     } break;
0355     case 4:  // D1D2
0356     {
0357       const vector<VarBase*> v = {&globals_->ITC_F1F2()->rinv_final,     &globals_->ITC_F1F2()->phi0_final,
0358                                   &globals_->ITC_F1F2()->t_final,        &globals_->ITC_F1F2()->z0_final,
0359                                   &globals_->ITC_F1F2()->phiL_0_final,   &globals_->ITC_F1F2()->phiL_1_final,
0360                                   &globals_->ITC_F1F2()->phiL_2_final,   &globals_->ITC_F1F2()->zL_0_final,
0361                                   &globals_->ITC_F1F2()->zL_1_final,     &globals_->ITC_F1F2()->zL_2_final,
0362                                   &globals_->ITC_F1F2()->der_phiL_final, &globals_->ITC_F1F2()->der_zL_final,
0363                                   &globals_->ITC_F1F2()->phiD_0_final,   &globals_->ITC_F1F2()->phiD_1_final,
0364                                   &globals_->ITC_F1F2()->phiD_2_final,   &globals_->ITC_F1F2()->rD_0_final,
0365                                   &globals_->ITC_F1F2()->rD_1_final,     &globals_->ITC_F1F2()->rD_2_final,
0366                                   &globals_->ITC_F1F2()->der_phiD_final, &globals_->ITC_F1F2()->der_rD_final};
0367       writeDesign(v, "TC_F1F2");
0368     }
0369       {
0370         const vector<VarBase*> v = {&globals_->ITC_B1B2()->rinv_final,     &globals_->ITC_B1B2()->phi0_final,
0371                                     &globals_->ITC_B1B2()->t_final,        &globals_->ITC_B1B2()->z0_final,
0372                                     &globals_->ITC_B1B2()->phiL_0_final,   &globals_->ITC_B1B2()->phiL_1_final,
0373                                     &globals_->ITC_B1B2()->phiL_2_final,   &globals_->ITC_B1B2()->zL_0_final,
0374                                     &globals_->ITC_B1B2()->zL_1_final,     &globals_->ITC_B1B2()->zL_2_final,
0375                                     &globals_->ITC_B1B2()->der_phiL_final, &globals_->ITC_B1B2()->der_zL_final,
0376                                     &globals_->ITC_B1B2()->phiD_0_final,   &globals_->ITC_B1B2()->phiD_1_final,
0377                                     &globals_->ITC_B1B2()->phiD_2_final,   &globals_->ITC_B1B2()->rD_0_final,
0378                                     &globals_->ITC_B1B2()->rD_1_final,     &globals_->ITC_B1B2()->rD_2_final,
0379                                     &globals_->ITC_B1B2()->der_phiD_final, &globals_->ITC_B1B2()->der_rD_final};
0380         writeDesign(v, "TC_B1B2");
0381       }
0382       break;
0383     case 5:  // D3D4
0384     {
0385       const vector<VarBase*> v = {&globals_->ITC_F3F4()->rinv_final,     &globals_->ITC_F3F4()->phi0_final,
0386                                   &globals_->ITC_F3F4()->t_final,        &globals_->ITC_F3F4()->z0_final,
0387                                   &globals_->ITC_F3F4()->phiL_0_final,   &globals_->ITC_F3F4()->phiL_1_final,
0388                                   &globals_->ITC_F3F4()->phiL_2_final,   &globals_->ITC_F3F4()->zL_0_final,
0389                                   &globals_->ITC_F3F4()->zL_1_final,     &globals_->ITC_F3F4()->zL_2_final,
0390                                   &globals_->ITC_F3F4()->der_phiL_final, &globals_->ITC_F3F4()->der_zL_final,
0391                                   &globals_->ITC_F3F4()->phiD_0_final,   &globals_->ITC_F3F4()->phiD_1_final,
0392                                   &globals_->ITC_F3F4()->phiD_2_final,   &globals_->ITC_F3F4()->rD_0_final,
0393                                   &globals_->ITC_F3F4()->rD_1_final,     &globals_->ITC_F3F4()->rD_2_final,
0394                                   &globals_->ITC_F3F4()->der_phiD_final, &globals_->ITC_F3F4()->der_rD_final};
0395       writeDesign(v, "TC_F3F4");
0396     }
0397       {
0398         const vector<VarBase*> v = {&globals_->ITC_B3B4()->rinv_final,     &globals_->ITC_B3B4()->phi0_final,
0399                                     &globals_->ITC_B3B4()->t_final,        &globals_->ITC_B3B4()->z0_final,
0400                                     &globals_->ITC_B3B4()->phiL_0_final,   &globals_->ITC_B3B4()->phiL_1_final,
0401                                     &globals_->ITC_B3B4()->phiL_2_final,   &globals_->ITC_B3B4()->zL_0_final,
0402                                     &globals_->ITC_B3B4()->zL_1_final,     &globals_->ITC_B3B4()->zL_2_final,
0403                                     &globals_->ITC_B3B4()->der_phiL_final, &globals_->ITC_B3B4()->der_zL_final,
0404                                     &globals_->ITC_B3B4()->phiD_0_final,   &globals_->ITC_B3B4()->phiD_1_final,
0405                                     &globals_->ITC_B3B4()->phiD_2_final,   &globals_->ITC_B3B4()->rD_0_final,
0406                                     &globals_->ITC_B3B4()->rD_1_final,     &globals_->ITC_B3B4()->rD_2_final,
0407                                     &globals_->ITC_B3B4()->der_phiD_final, &globals_->ITC_B3B4()->der_rD_final};
0408         writeDesign(v, "TC_B3B4");
0409       }
0410       break;
0411     case 6:  // L1D1
0412     {
0413       const vector<VarBase*> v = {&globals_->ITC_L1F1()->rinv_final,     &globals_->ITC_L1F1()->phi0_final,
0414                                   &globals_->ITC_L1F1()->t_final,        &globals_->ITC_L1F1()->z0_final,
0415                                   &globals_->ITC_L1F1()->phiL_0_final,   &globals_->ITC_L1F1()->phiL_1_final,
0416                                   &globals_->ITC_L1F1()->phiL_2_final,   &globals_->ITC_L1F1()->zL_0_final,
0417                                   &globals_->ITC_L1F1()->zL_1_final,     &globals_->ITC_L1F1()->zL_2_final,
0418                                   &globals_->ITC_L1F1()->der_phiL_final, &globals_->ITC_L1F1()->der_zL_final,
0419                                   &globals_->ITC_L1F1()->phiD_0_final,   &globals_->ITC_L1F1()->phiD_1_final,
0420                                   &globals_->ITC_L1F1()->phiD_2_final,   &globals_->ITC_L1F1()->phiD_3_final,
0421                                   &globals_->ITC_L1F1()->rD_0_final,     &globals_->ITC_L1F1()->rD_1_final,
0422                                   &globals_->ITC_L1F1()->rD_2_final,     &globals_->ITC_L1F1()->rD_3_final,
0423                                   &globals_->ITC_L1F1()->der_phiD_final, &globals_->ITC_L1F1()->der_rD_final};
0424       writeDesign(v, "TC_L1F1");
0425     }
0426       {
0427         const vector<VarBase*> v = {&globals_->ITC_L1B1()->rinv_final,     &globals_->ITC_L1B1()->phi0_final,
0428                                     &globals_->ITC_L1B1()->t_final,        &globals_->ITC_L1B1()->z0_final,
0429                                     &globals_->ITC_L1B1()->phiL_0_final,   &globals_->ITC_L1B1()->phiL_1_final,
0430                                     &globals_->ITC_L1B1()->phiL_2_final,   &globals_->ITC_L1B1()->zL_0_final,
0431                                     &globals_->ITC_L1B1()->zL_1_final,     &globals_->ITC_L1B1()->zL_2_final,
0432                                     &globals_->ITC_L1B1()->der_phiL_final, &globals_->ITC_L1B1()->der_zL_final,
0433                                     &globals_->ITC_L1B1()->phiD_0_final,   &globals_->ITC_L1B1()->phiD_1_final,
0434                                     &globals_->ITC_L1B1()->phiD_2_final,   &globals_->ITC_L1B1()->phiD_3_final,
0435                                     &globals_->ITC_L1B1()->rD_0_final,     &globals_->ITC_L1B1()->rD_1_final,
0436                                     &globals_->ITC_L1B1()->rD_2_final,     &globals_->ITC_L1B1()->rD_3_final,
0437                                     &globals_->ITC_L1B1()->der_phiD_final, &globals_->ITC_L1B1()->der_rD_final};
0438         writeDesign(v, "TC_L1B1");
0439       }
0440       break;
0441     case 7:  // L2D1
0442     {
0443       const vector<VarBase*> v = {&globals_->ITC_L2F1()->rinv_final,     &globals_->ITC_L2F1()->phi0_final,
0444                                   &globals_->ITC_L2F1()->t_final,        &globals_->ITC_L2F1()->z0_final,
0445                                   &globals_->ITC_L2F1()->phiL_0_final,   &globals_->ITC_L2F1()->phiL_1_final,
0446                                   &globals_->ITC_L2F1()->phiL_2_final,   &globals_->ITC_L2F1()->zL_0_final,
0447                                   &globals_->ITC_L2F1()->zL_1_final,     &globals_->ITC_L2F1()->zL_2_final,
0448                                   &globals_->ITC_L2F1()->der_phiL_final, &globals_->ITC_L2F1()->der_zL_final,
0449                                   &globals_->ITC_L2F1()->phiD_0_final,   &globals_->ITC_L2F1()->phiD_1_final,
0450                                   &globals_->ITC_L2F1()->phiD_2_final,   &globals_->ITC_L2F1()->phiD_3_final,
0451                                   &globals_->ITC_L2F1()->rD_0_final,     &globals_->ITC_L2F1()->rD_1_final,
0452                                   &globals_->ITC_L2F1()->rD_2_final,     &globals_->ITC_L2F1()->rD_3_final,
0453                                   &globals_->ITC_L2F1()->der_phiD_final, &globals_->ITC_L2F1()->der_rD_final};
0454       writeDesign(v, "TC_L2F1");
0455     }
0456       {
0457         const vector<VarBase*> v = {&globals_->ITC_L2B1()->rinv_final,     &globals_->ITC_L2B1()->phi0_final,
0458                                     &globals_->ITC_L2B1()->t_final,        &globals_->ITC_L2B1()->z0_final,
0459                                     &globals_->ITC_L2B1()->phiL_0_final,   &globals_->ITC_L2B1()->phiL_1_final,
0460                                     &globals_->ITC_L2B1()->phiL_2_final,   &globals_->ITC_L2B1()->zL_0_final,
0461                                     &globals_->ITC_L2B1()->zL_1_final,     &globals_->ITC_L2B1()->zL_2_final,
0462                                     &globals_->ITC_L2B1()->der_phiL_final, &globals_->ITC_L2B1()->der_zL_final,
0463                                     &globals_->ITC_L2B1()->phiD_0_final,   &globals_->ITC_L2B1()->phiD_1_final,
0464                                     &globals_->ITC_L2B1()->phiD_2_final,   &globals_->ITC_L2B1()->phiD_3_final,
0465                                     &globals_->ITC_L2B1()->rD_0_final,     &globals_->ITC_L2B1()->rD_1_final,
0466                                     &globals_->ITC_L2B1()->rD_2_final,     &globals_->ITC_L2B1()->rD_3_final,
0467                                     &globals_->ITC_L2B1()->der_phiD_final, &globals_->ITC_L2B1()->der_rD_final};
0468         writeDesign(v, "TC_L2B1");
0469       }
0470       break;
0471   }
0472 }