Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:36

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