CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtVhdlWriterCore.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <iostream>
22 #include <fstream>
23 #include <map>
24 #include <string>
25 #include <sstream>
26 #include <vector>
27 #include <sys/stat.h>
28 #include <algorithm>
29 
30 // CMSSW headers
32 
35 
41 
43 
47 
49 
50 // constructor(s)
51 L1GtVhdlWriterCore::L1GtVhdlWriterCore(const std::string &templatesDirectory,
52  const std::string &outputDirectory, const bool &debug)
53 {
54 
55  // set templates directory
56  vhdlDir_=templatesDirectory;
57 
58  // set output directory
59  outputDir_=outputDirectory;
60 
61  // Get maps
63 
67 
68  // fill calo object vector
69  caloObjects_.push_back(IsoEG);
70  caloObjects_.push_back(NoIsoEG);
71  caloObjects_.push_back(CenJet);
72  caloObjects_.push_back(ForJet);
73  caloObjects_.push_back(TauJet);
74 
75  esumObjects_.push_back(HTT);
76  esumObjects_.push_back(ETT);
77  esumObjects_.push_back(ETM);
78 
79  // prepare number of condition vector with two empty string vectors for the two condition chips
80  std::vector<std::string> temp;
81  numberOfConditions_.push_back(temp);
82  numberOfConditions_.push_back(temp);
83 
84  // set debug mode
86 
87 }
88 
89 // destructor
91 {
92  // empty
93 }
94 
97  const L1GtObject &object,
98  const ConditionMap &map,
99  ConditionMap &outputMap)
100 {
101  bool status = false;
102 
103  ConditionMap::const_iterator condIter = map.begin();
104  while (condIter!=map.end())
105  {
106  if (condIter->second->condCategory()==category
107  && condIter->second->condType()==type && (condIter->second->objectType())[0]==object)
108  {
109  outputMap[condIter->first]=condIter->second;
110  status = true;
111  }
112  condIter++;
113  }
114 
115  return status;
116 }
117 
119  ConditionMap &map)
120 {
121  bool status = false;
122 
123  ConditionMap::iterator condIter = map.begin();
124  while (condIter!=map.end())
125  {
126  for (unsigned int i=0; i<(condIter->second->objectType()).size(); i++)
127  {
128  if (condIter->second->objectType()[i]==object)
129  {
130  status = true;
131  break;
132  }
133  }
134 
135  if (status)
136  break;
137  condIter++;
138  }
139 
140  return status;
141 }
142 
144  const unsigned short int &condChip,
145  std::map<std::string,std::string> &muonParameters)
146 {
147  // vector containing all relevant types for muon conditions
148  std::vector<L1GtConditionType> muonConditionTypes;
149 
150  muonConditionTypes.push_back(Type1s);
151  muonConditionTypes.push_back(Type2s);
152  muonConditionTypes.push_back(Type2wsc);
153  muonConditionTypes.push_back(Type3s);
154  muonConditionTypes.push_back(Type4s);
155 
156  for (unsigned int i = 0; i<muonConditionTypes.size(); i++)
157  {
158  //std::cout<<i<<std::endl;
159 
160  ConditionMap MuonConditions1s;
161 
162  countCondsAndAdd2NumberVec(muonConditionTypes.at(i), CondMuon, Mu,
163  (*conditionMap_).at(condChip-1), MuonConditions1s, condChip);
164 
165  /*
166  // Get the absoloute amount of conditions
167  std::string initstr="CONSTANT nr_"+objType2Str_[Mu]+"_"+condType2Str_[muonConditionTypes.at(i)]+" : integer := ";
168 
169  if (returnConditionsOfOneClass(muonConditionTypes.at(i),CondMuon,Mu,conditionMap_.at(condChip-1), MuonConditions1s))
170  initstr+=(int2str(MuonConditions1s.size())+";");
171  else
172  initstr+=("0;");
173 
174  numberOfConditions_.at(condChip-1).push_back(initstr);
175 
176  */
177 
178  //std::cout<< std::hex << (*myObjectParameter).at(0).etThreshold << std::endl;
179  unsigned int counter=0;
180 
181  for (ConditionMap::const_iterator iterCond = MuonConditions1s.begin(); iterCond
182  != MuonConditions1s.end(); iterCond++)
183  {
184 
185  // add this condition to name -> integer conversion map
186  conditionToIntegerMap_[iterCond->first]=counter;
187 
188  L1GtMuonTemplate* m_gtMuonTemplate =
189  static_cast<L1GtMuonTemplate*>(iterCond->second);
190  const std::vector<L1GtMuonTemplate::ObjectParameter>* op =
191  m_gtMuonTemplate->objectParameter();
192 
193  if (muonConditionTypes.at(i)==Type1s)
194  {
195 
196  // build eta
197  muonParameters["eta_1_s"] += (bm_.buildEtaMuon(op, 1, counter));
198 
199  // add the parameters to parameter map
200  muonParameters["phi_h_1_s"]+= bm_.buildPhiMuon(op, 1, counter,
201  true);
202  muonParameters["phi_l_1_s"]+=bm_.buildPhiMuon(op, 1, counter,
203  false);
204 
205  if (debugMode_)
206  {
207  muonParameters["phi_l_1_s"]+=("--"+iterCond->first+"\n");
208  muonParameters["phi_h_1_s"]+=("--"+iterCond->first+"\n");
209  muonParameters["eta_1_s"] +=("--"+iterCond->first+"\n");
210  }
211 
212  } else
213 
214  if (muonConditionTypes.at(i)==Type2s)
215  {
216 
217  // build eta
218  muonParameters["eta_2_s"] += (bm_.buildEtaMuon(op, 2, counter));
219 
220  // add the parameters to parameter map
221  muonParameters["phi_h_2_s"]+= bm_.buildPhiMuon(op, 2, counter,
222  true);
223  muonParameters["phi_l_2_s"]+=bm_.buildPhiMuon(op, 2, counter,
224  false);
225 
226  if (debugMode_)
227  {
228  muonParameters["phi_l_2_s"]+=("--"+iterCond->first+"\n");
229  muonParameters["phi_h_2_s"]+=("--"+iterCond->first+"\n");
230  muonParameters["eta_2_s"] +=("--"+iterCond->first+"\n");
231  }
232 
233  } else
234  //m_gtMuonTemplate->print(std::cout);
235 
236  if (muonConditionTypes.at(i)==Type3s)
237  {
238 
239  // build eta
240  muonParameters["eta_3"] += (bm_.buildEtaMuon(op, 3, counter));
241 
242  // add the parameters to parameter map
243  muonParameters["phi_h_3"]+= bm_.buildPhiMuon(op, 3, counter,
244  true);
245  muonParameters["phi_l_3"]+=bm_.buildPhiMuon(op, 3, counter,
246  false);
247 
248  if (debugMode_)
249  {
250  muonParameters["phi_l_3"]+=("--"+iterCond->first+"\n");
251  muonParameters["phi_h_3"]+=("--"+iterCond->first+"\n");
252  muonParameters["eta_3"] +=("--"+iterCond->first+"\n");
253  }
254 
255  }
256 
257  if (muonConditionTypes.at(i)==Type4s)
258  {
259 
260  // build eta
261  muonParameters["eta_4"] += (bm_.buildEtaMuon(op, 4, counter));
262 
263  // add the parameters to parameter map
264  muonParameters["phi_h_4"]+= bm_.buildPhiMuon(op, 4, counter,
265  true);
266  muonParameters["phi_l_4"]+=bm_.buildPhiMuon(op, 4, counter,
267  false);
268 
269  if (debugMode_)
270  {
271  muonParameters["phi_l_4"]+=("--"+iterCond->first+"\n");
272  muonParameters["phi_h_4"]+=("--"+iterCond->first+"\n");
273  muonParameters["eta_4"] +=("--"+iterCond->first+"\n");
274  }
275 
276  }
277 
278  if (muonConditionTypes.at(i)==Type2wsc)
279  {
281  m_gtMuonTemplate->correlationParameter();
282 
283  // build eta
284  muonParameters["eta_2_wsc"]
285  += (bm_.buildEtaMuon(op, 2, counter));
286 
287  // build phi
288  muonParameters["phi_h_2_wsc"]+= bm_.buildPhiMuon(op, 2,
289  counter, true);
290  muonParameters["phi_l_2_wsc"]+=bm_.buildPhiMuon(op, 2, counter,
291  false);
292 
293  // build delta_eta
294  std::ostringstream dEta;
295  muonParameters["delta_eta"] += bm_.buildDeltaEtaMuon(cp,
296  counter);
297 
298  // build delta_phi
299  muonParameters["delta_phi"] += bm_.buildDeltaPhiMuon(cp,
300  counter);
301 
302  if (debugMode_)
303  {
304  muonParameters["eta_2_wsc"]+=("--"+iterCond->first+"\n");
305  muonParameters["phi_h_2_wsc"]+=("--"+iterCond->first+"\n");
306  muonParameters["phi_l_2_wsc"] +=("--"+iterCond->first+"\n");
307  muonParameters["delta_eta"]+=("--"+iterCond->first+"\n");
308  muonParameters["delta_phi"] +=("--"+iterCond->first+"\n");
309  }
310 
311  }
312  counter++;
313  }
314  }
315 
316 }
317 
319  const unsigned short int &condChip,
320  std::map<std::string,std::string> &caloParameters,
321  const L1GtObject &caloObject)
322 {
323  // vector containing all relevant types for calo conditions
324  std::vector<L1GtConditionType> caloConditionTypes;
325 
326  caloConditionTypes.push_back(Type1s);
327  caloConditionTypes.push_back(Type2s);
328  caloConditionTypes.push_back(Type2wsc);
329  caloConditionTypes.push_back(Type4s);
330 
331  for (unsigned int i = 0; i<caloConditionTypes.size(); i++)
332  {
333  unsigned int counter=0;
334 
335  ConditionMap caloConditions;
336 
337  // stores all conditions of type given in the first three parameters
338  countCondsAndAdd2NumberVec(caloConditionTypes.at(i), CondCalo,
339  caloObject, (*conditionMap_).at(condChip-1), caloConditions,
340  condChip);
341 
342  for (ConditionMap::const_iterator iterCond = caloConditions.begin(); iterCond
343  != caloConditions.end(); iterCond++)
344  {
345 
346  // add this condition to name -> integer conversion map
347  conditionToIntegerMap_[iterCond->first]=counter;
348 
349  L1GtCaloTemplate* m_gtCaloTemplate =
350  static_cast<L1GtCaloTemplate*>(iterCond->second);
351  const std::vector<L1GtCaloTemplate::ObjectParameter>* op =
352  m_gtCaloTemplate->objectParameter();
353 
354  if (caloConditionTypes.at(i)==Type1s)
355  {
356 
357  //= static_cast<std::vector<L1GtCaloTemplate::ObjectPaenergySumParameter+=rameter*> >(op);
358 
359  // build eta
360  caloParameters["eta_1_s"] += (bm_.buildEtaCalo(op, 1, counter));
361 
362  caloParameters["phi_1_s"]+= bm_.buildPhiCalo(op, 1, counter);
363 
364  if (debugMode_)
365  {
366  caloParameters["eta_1_s"]+=("--"+iterCond->first+"\n");
367  caloParameters["phi_1_s"]+=("--"+iterCond->first+"\n");
368  }
369 
370  } else if (caloConditionTypes.at(i)==Type2s)
371  {
372 
373  // build eta
374  caloParameters["eta_2_s"] += (bm_.buildEtaCalo(op, 2, counter));
375 
376  // add the parameters to parameter map
377  caloParameters["phi_2_s"]+= bm_.buildPhiCalo(op, 2, counter);
378 
379  if (debugMode_)
380  {
381  caloParameters["eta_2_s"]+=("--"+iterCond->first+"\n");
382  caloParameters["phi_2_s"]+=("--"+iterCond->first+"\n");
383  }
384 
385  } else if (caloConditionTypes.at(i)==Type4s)
386  {
387  // build eta
388  caloParameters["eta_4"] += (bm_.buildEtaCalo(op, 4, counter));
389 
390  // add the parameters to parameter map
391  caloParameters["phi_4"]+= bm_.buildPhiCalo(op, 4, counter);
392 
393  if (debugMode_)
394  {
395  caloParameters["eta_4"]+=("--"+iterCond->first+"\n");
396  caloParameters["phi_4"]+=("--"+iterCond->first+"\n");
397  }
398 
399  } else if (caloConditionTypes.at(i)==Type2wsc)
400  {
402  m_gtCaloTemplate->correlationParameter();
403 
404  // build eta
405  caloParameters["eta_2_wsc"]
406  += (bm_.buildEtaCalo(op, 2, counter));
407 
408  // build phi
409  caloParameters["phi_2_wsc"]+= bm_.buildPhiCalo(op, 2, counter);
410 
411  // build delta_eta
412  caloParameters["delta_eta"] += bm_.buildDeltaEtaCalo(cp,
413  counter);
414 
415  // build delta_phi
416  caloParameters["delta_phi"] += bm_.buildDeltaPhiCalo(cp,
417  counter);
418 
419  if (debugMode_)
420  {
421  caloParameters["eta_2_wsc"]+=("--"+iterCond->first+"\n");
422  caloParameters["phi_2_wsc"]+=("--"+iterCond->first+"\n");
423  caloParameters["delta_eta"]+=("--"+iterCond->first+"\n");
424  caloParameters["delta_phi"]+=("--"+iterCond->first+"\n");
425  }
426 
427  }
428 
429  counter++;
430 
431  }
432 
433  }
434 
435  return true;
436 }
437 
439  const unsigned short int &condChip, const L1GtObject &object,
440  std::string &energySumParameter)
441 {
442 
444 
445  unsigned int counter=0;
446 
447  if (object==HTT)
448  type= TypeHTT;
449  else if (object==ETM)
450  type= TypeETM;
451  else if (object==ETT)
452  type= TypeETT;
453 
454  ConditionMap esumsConditions;
455  // stores all conditions of type given in the first three parameters
457  (*conditionMap_).at(condChip-1), esumsConditions, condChip);
458 
459  for (ConditionMap::const_iterator iterCond = esumsConditions.begin(); iterCond
460  != esumsConditions.end(); iterCond++)
461  {
462  L1GtEnergySumTemplate* energySumTempl =
463  static_cast<L1GtEnergySumTemplate*>(iterCond->second);
464  const std::vector<L1GtEnergySumTemplate::ObjectParameter>* op =
465  energySumTempl->objectParameter();
466 
467  if (bm_.buildPhiEnergySum(op, 1, counter)!="")
468  energySumParameter+=bm_.buildPhiEnergySum(op, 1, counter);
469 
470  if (debugMode_)
471  {
472  energySumParameter+=("--"+iterCond->first+"\n");
473  }
474 
475  conditionToIntegerMap_[(iterCond->first)]=counter;
476 
477  counter++;
478  }
479 
480  return true;
481 
482 }
483 
484 bool L1GtVhdlWriterCore::getSubstParamCommonFromTriggerMenu(const unsigned short int &condChip, L1GtVhdlTemplateFile &particle,
485  const L1GtObject &object, const L1GtConditionCategory &category,
486  std::string &parameterStr)
487 {
488 
489  std::map<L1GtConditionType,std::string> condType2Strcopy = condType2Str_;
490 
491  // make a copy since types will deleted later after they are processed
492  std::map<L1GtConditionType,std::string>::iterator typeIterator =
493  condType2Strcopy.begin();
494 
495  while (typeIterator != condType2Strcopy.end())
496  {
497 
498  ConditionMap outputMap;
499 
500  if (returnConditionsOfOneClass((*typeIterator).first, category, object, (*conditionMap_).at(condChip-1), outputMap))
501  {
502 
503  // special treatment for jet counts in buildCodChipParameters
504  if (object !=JetCounts)
505  {
506  std::string tempStr2 = particle.returnParameterMap()[stringConstantCommon_];
507  while (particle.findAndReplaceString(tempStr2,
509  ;
510  while (particle.findAndReplaceString(tempStr2,
511  sp(substParamType_), condType2Str_[(*typeIterator).first]))
512  ;
513  parameterStr+=(tempStr2+"\n\n");
514 
515  //parameterStr+=(tempStr2+"<= '0';\n");
516 
517  // remove this type since it was already processed
518  condType2Strcopy.erase(typeIterator);
519  }
520 
521  }
522 
523  typeIterator++;
524 
525  }
526 
527  return true;
528 }
529 
531  const unsigned short int &condChip,
532  std::map<std::string, L1GtVhdlTemplateFile> &templates,
533  std::map<std::string, std::string> &commonParams)
534 {
535 
536  // open the necessary internal templates
537  L1GtVhdlTemplateFile muon, calo, esums, jet;
538 
539  muon.open(vhdlDir_+"InternalTemplates/muon", true);
540  muon.substitute("particle", "muon");
541 
542  calo.open(vhdlDir_+"InternalTemplates/calo", true);
543  esums.open(vhdlDir_+"InternalTemplates/esums", true);
544  jet.open(vhdlDir_+"InternalTemplates/jet_cnts", true);
545 
546  /*
547  charge1s.open(vhdlDir_+"InternalTemplates/charge_1s",false);
548  charge2s.open(vhdlDir_+"InternalTemplates/charge_2s",false);
549  charge2wsc.open(vhdlDir_+"InternalTemplates/charge_2_wsc",false);
550  charge3s.open(vhdlDir_+"InternalTemplates/charge_3",false);
551  charge4s.open(vhdlDir_+"InternalTemplates/charge_4",false);
552  */
553 
554  // only for jet_cnts common parameter relevant since common parameter is build in this routine
555  std::vector<unsigned int> processedTypes;
556 
557  //-------------------------------------build the common parameters-------------------------------------------
558 
559  // build $(muon_common)
560  getSubstParamCommonFromTriggerMenu(condChip,muon, Mu, CondMuon, commonParams["muon_common"]);
561 
562  // build $(calo_common) - loop over all calo objects
563  std::vector<L1GtObject>::iterator caloObjIter = caloObjects_.begin();
564 
565  while (caloObjIter != caloObjects_.end())
566  {
567 
568  getSubstParamCommonFromTriggerMenu(condChip, muon, (*caloObjIter), CondCalo,
569  commonParams["calo_common"]);
570  caloObjIter++;
571 
572  }
573 
574  // build $(esums_common) - loop over all esums objects
575  std::vector<L1GtObject>::iterator esumObjIter = esumObjects_.begin();
576 
577  while (esumObjIter != esumObjects_.end())
578  {
579 
580  getSubstParamCommonFromTriggerMenu(condChip, esums, (*esumObjIter), CondEnergySum,
581  commonParams["esums_common"]);
582  esumObjIter++;
583 
584  }
585 
586  //--------------------------------------build the parameter maps----------------------------------------------
587 
588  // loop over condition map
589  for (ConditionMap::const_iterator iterCond = (*conditionMap_).at(condChip-1).begin(); iterCond != (*conditionMap_).at(condChip-1).end(); iterCond++)
590  {
591 
592  switch ((iterCond->second)->condCategory())
593  {
594 
595  case CondMuon:
596  {
597 
598  int cond2int;
599  if (!getIntVal(conditionToIntegerMap_, (iterCond->first), cond2int))
600  {
601  msg("Panik! Condition "+(iterCond->first)
602  +" does not have a integer equivalent!");
603  break;
604  }
605 
606  std::string intVal = index4CondChipVhd(cond2int);
607 
608  L1GtVhdlTemplateFile muoncopy = muon;
609 
610  muoncopy.substitute("type", condType2Str_[(iterCond->second)->condType()]);
611 
612  muoncopy.substitute("ser_no", intVal);
613 
614  muoncopy.substitute("name", iterCond->first);
615 
616  if ((iterCond->second)->condType() == Type1s)
617  {
618  muoncopy.substitute(substParamCharge_,
620  } else if ((iterCond->second)->condType() == Type2s)
621  {
622  muoncopy.substitute(substParamCharge_,
624  } else if ((iterCond->second)->condType() == Type2wsc)
625  {
626  muoncopy.substitute(substParamCharge_,
628  } else if ((iterCond->second)->condType() == Type3s)
629  {
630  muoncopy.substitute(substParamCharge_,
632  } else if ((iterCond->second)->condType() == Type4s)
633  {
634  muoncopy.substitute(substParamCharge_,
636  }
637 
638  std::string tempStr = muoncopy.returnParameterMap()["PREALGO"];
639 
640  muoncopy.findAndReplaceString(tempStr, "$(particle)", "muon");
641  muoncopy.findAndReplaceString(tempStr, "$(ser_no)", intVal);
642  muoncopy.findAndReplaceString(tempStr, "$(type)", condType2Str_[(iterCond->second)->condType()]);
643 
644  muoncopy.append(tempStr);
645 
646  muoncopy.removeEmptyLines();
647 
648  // add the processed internal template to parameter map
649  templates["muon"].append(muoncopy);
650 
651  }
652  break;
653 
654  case CondCalo:
655  {
656  int cond2int;
657 
658  if (!getIntVal(conditionToIntegerMap_, (iterCond->first), cond2int))
659  {
660  msg("Panik! Condition "+(iterCond->first)
661  +" does not have a integer equivalent!");
662  break;
663  }
664 
665  std::string intVal = index4CondChipVhd(cond2int);
666 
667  L1GtVhdlTemplateFile calocopy = calo;
668 
669  calocopy.substitute("type", condType2Str_[(iterCond->second)->condType()]);
670  calocopy.substitute("particle", objType2Str_[((iterCond->second)->objectType()).at(0)]);
671  calocopy.substitute("name", iterCond->first);
672  calocopy.substitute("ser_no", intVal);
673  calocopy.substitute("calo_nr", caloType2Int_[((iterCond->second)->objectType()).at(0)]);
674 
675  // builds something like tau_1_s(20));
676  calocopy.append(objType2Str_[((iterCond->second)->objectType()).at(0)] +"_"+condType2Str_[(iterCond->second)->condType()]+"("+intVal+"));");
677 
678  templates["calo"].append(calocopy);
679 
680  }
681  break;
682 
683  case CondEnergySum:
684  {
685 
686  int cond2int;
687 
688  if (!getIntVal(conditionToIntegerMap_, (iterCond->first), cond2int))
689  {
690  msg("Panik! Condition "+(iterCond->first)
691  +" does not have a integer equivalent!");
692  break;
693  }
694 
695  std::string intVal = index4CondChipVhd(cond2int);
696 
697  L1GtVhdlTemplateFile esumscopy = esums;
698 
699  esumscopy.substitute("type", condType2Str_[(iterCond->second)->condType()]);
700  esumscopy.substitute("particle", objType2Str_[((iterCond->second)->objectType()).at(0)]);
701  esumscopy.substitute("name", iterCond->first);
702  esumscopy.substitute("ser_no", intVal);
703 
704  if (((iterCond->second)->objectType()).at(0)==ETM)
705  esumscopy.substitute("if_etm_then_1_else_0", "1");
706  else
707  esumscopy.substitute("if_etm_then_1_else_0", "0");
708 
709  // builds something like htt_cond(4));
710  esumscopy.append(objType2Str_[((iterCond->second)->objectType()).at(0)] +"_"+condType2Str_[(iterCond->second)->condType()]+"("+ intVal+"));");
711 
712  templates["esums"].append(esumscopy);
713  }
714 
715  break;
716 
717  case CondJetCounts:
718  {
719 
720  // build the common parameter for the jet counts
721 
722  L1GtJetCountsTemplate* jetsTemplate =
723  static_cast<L1GtJetCountsTemplate*>(iterCond->second);
724 
725  int nObjects = iterCond->second->nrObjects();
726 
727  const std::vector<L1GtJetCountsTemplate::ObjectParameter>* op =
728  jetsTemplate->objectParameter();
729 
730  for (int i = 0; i < nObjects; i++)
731  {
732 
733  std::vector<unsigned int>::iterator p = find(
734  processedTypes.begin(), processedTypes.end(), (*op)[i].countIndex);
735 
736  // check, weather this count index was already processed
737  // and process it if not
738  if (p==processedTypes.end())
739  {
740  std::ostringstream indStr;
741  indStr<<(*op)[i].countIndex;
742 
743  std::string tempStr2 = jet.returnParameterMap()[stringConstantCommon_];
744  while (jet.findAndReplaceString(tempStr2,
746  ;
747  while (jet.findAndReplaceString(tempStr2,
748  sp(substParamType_), indStr.str()))
749  ;
750  commonParams[substParamJetCntsCommon_]+=tempStr2+"\n"; // +"<= '0';\n");
751  processedTypes.push_back((*op)[i].countIndex);
752  }
753 
754  }
755 
756  int cond2int;
757 
758  if (!getIntVal(conditionToIntegerMap_, (iterCond->first), cond2int))
759  {
760  msg("Panik! Condition "+(iterCond->first)
761  +" does not have a integer equivalent!");
762  break;
763  }
764 
765  std::string intVal = index4CondChipVhd(cond2int);
766 
767  L1GtVhdlTemplateFile jetcopy = jet;
768 
769  jetcopy.substitute("particle", condType2Str_[(iterCond->second)->condType()]);
770  jetcopy.substitute("type", int2str((*op)[0].countIndex));
771  jetcopy.substitute("name", iterCond->first);
772 
773  jetcopy.substitute("ser_no", intVal);
774 
775  // builds the final string
776  std::string tempStr = jetcopy.returnParameterMap()["PREALGO"];
777 
778  jetcopy.findAndReplaceString(tempStr, "$(particle)", "jet_cnt");
779  jetcopy.findAndReplaceString(tempStr, "$(ser_no)", intVal);
780  jetcopy.findAndReplaceString(tempStr, "$(type)", int2str((*op)[0].countIndex));
781 
782  jetcopy.append(tempStr);
783  jetcopy.removeEmptyLines();
784 
785  templates["jet_cnts"].append(jetcopy);
786  }
787 
788  break;
789 
790  case CondCorrelation:
791  {
792  //empty
793  }
794  break;
795 
796  case CondNull:
797  {
798  //empty
799  }
800  break;
801 
802  default:
803  {
804  //empty
805  }
806  break;
807  }
808  }
809 
810  // delete superfluous newlines at the end of common parameters
811  std::map<std::string,std::string>::iterator pIt = commonParams.begin();
812 
813  while (pIt!=commonParams.end())
814  {
815  if ((pIt->second)[((pIt->second).length()-1)] == '\n')
816  (pIt->second) = (pIt->second).substr(0, (pIt->second).length()-1);
817  pIt++;
818  }
819 
820  return true;
821 
822 }
823 
824 bool L1GtVhdlWriterCore::processAlgorithmMap(std::vector< std::map<int, std::string> > &algoStrings)
825 {
826  std::map<int, std::string> algorithmsChip1;
827  std::map<int, std::string> algorithmsChip2;
828 
829  AlgorithmMap::const_iterator algoIter=(*algorithmMap_).begin();
830 
831  // loop over algorithm map
832  while (algoIter!=(*algorithmMap_).end())
833  {
834  // msg(algoIter->first);
835 
836  L1GtVhdlTemplateFile dummy;
837 
838  // get the logical expression
839  std::string logicalExpr = (algoIter->second).algoLogicalExpression();
840  std::vector<std::string> conditions;
841 
842  dummy.getConditionsFromAlgo(logicalExpr, conditions);
843 
844  std::string logicalExprCopy= logicalExpr;
845 
846  // loop over all condition names appearing in algorithm and replace them by type and integer value
847  for (unsigned int i=0; i<conditions.size(); i++)
848  {
849  std::ostringstream newExpr;
850 
851  // look for the condition on correct chip
852 
853  std::vector<ConditionMap> * conditionMapCp = const_cast< std::vector<ConditionMap>* >(conditionMap_);
854 
855  L1GtCondition* cond = (*conditionMapCp).at((algoIter->second).algoChipNumber())[conditions.at(i)];
856 
857  // check weather condition exists
858  if (cond!=NULL)
859  {
860  newExpr<<objType2Str_[(cond->objectType()).at(0)];
861 
862  newExpr <<"_" << condType2Str_[cond->condType()] << "(";
863 
864  newExpr << conditionToIntegerMap_[conditions.at(i)] << ")";
865  dummy.findAndReplaceString(logicalExpr, conditions.at(i),
866  newExpr.str());
867  } else
868  msg("Panik! Didn't find Condition "+conditions.at(i));
869  }
870 
871  // has to be checked!
872  std::vector<int> orderConditionChip;
873  orderConditionChip.push_back(2);
874  orderConditionChip.push_back(1);
875 
876  int pin = (algoIter->second).algoOutputPin(2, 96, orderConditionChip);
877 
878  //msg(int2str(pin));
879 
880  if (pin<0)
881  pin*=-1;
882 
883  if ((algoIter->second).algoChipNumber()==0)
884  {
885  algorithmsChip1[pin]=logicalExpr;
886  if (debugMode_)
887  algorithmsChip1[pin]+=("-- "+logicalExprCopy);
888  } else if ((algoIter->second).algoChipNumber()==1)
889  {
890  algorithmsChip2[pin]=logicalExpr;
891  if (debugMode_)
892  algorithmsChip2[pin]+=("-- "+logicalExprCopy);
893  } else
894  ;
895 
896  algoIter++;
897  }
898 
899  algoStrings.push_back(algorithmsChip1);
900  algoStrings.push_back(algorithmsChip2);
901 
902  return true;
903 
904 }
905 
906 std::string L1GtVhdlWriterCore::chip2OutputSubDir(const int &chip)
907 {
908  if (chip==1)
909  return outputDir_+"/"+outputSubDir1_+"/";
910  if (chip==2)
911  return outputDir_+"/"+outputSubDir2_+"/";
912 
913  return "";
914 }
915 
916 
917 bool L1GtVhdlWriterCore::makeFirmware(const std::vector<ConditionMap> &conditionMap,
918  const AlgorithmMap &algorithmMap)
919 {
920  conditionMap_ = &conditionMap;
921 
922  algorithmMap_ = &algorithmMap;
923 
924  std::string subDir1 = outputDir_+outputSubDir1_;
925  std::string subDir2 = outputDir_+outputSubDir2_;
926 
927  if (!mkdir(subDir1.c_str(), 666));
928  if (!mkdir(subDir2.c_str(), 666));
929 
930  chmod(subDir1.c_str(), 0777);
931  chmod(subDir2.c_str(), 0777);
932 
933  /*
934  subDirs_.push_back(subDir1);
935  subDirs_.push_back(subDir2);
936  */
937 
939 
940 
941  //--------------------------------------build setups-------------------------------------------------------
942 
943  // loop over the two condition chips
944  for (unsigned short int i =1; i<=2; i++)
945  {
946  // ----------------------- muon setup -------------------------------------------------------
947 
948  std::map<std::string,std::string> muonParameters;
949  getMuonSetupContentFromTriggerMenu(i, muonParameters);
950  writeMuonSetupVhdl(muonParameters, "muon", i);
951 
952  // ----------------------- calo setup -------------------------------------------------------
953 
954  // map containing all calo object types correlated with the strings
955  // under which they appear in the firmware
956  std::vector<L1GtObject>::iterator caloObjIter = caloObjects_.begin();
957 
958  // loop over all calo objectsbuildMuonSetupVhdl
959  while (caloObjIter != caloObjects_.end())
960  {
961  std::map<std::string,std::string> caloParameters;
962  getCaloSetupContentFromTriggerMenu(i, caloParameters,
963  (*caloObjIter));
964  writeMuonSetupVhdl(caloParameters, objType2Str_[(*caloObjIter)], i);
965 
966  caloObjIter++;
967  }
968 
969  // ----------------------- etm setup ---------------------------------------------------------
970 
971  // map containing all calo object types correlated with the strings
972  // under which they appear in the firmware
973  std::vector<L1GtObject>::iterator esumObjIter = esumObjects_.begin();
974 
975  while (esumObjIter != esumObjects_.end())
976  {
977  std::string etmParameter;
978 
979  getEsumsSetupContentFromTriggerMenu(i, (*esumObjIter),
980  etmParameter);
981  writeEtmSetup(etmParameter, i);
982 
983  esumObjIter++;
984 
985  }
986 
987  // add jet counts to condition 2 integer map
989 
990  // --------------------cond chip setup---------------------------------------------------------
991  // Important: all other setups have to be build BEFORE this one because it needs a
992  // complete condition2integer map !!!
993 
994  std::map<std::string, L1GtVhdlTemplateFile> templates;
995  std::map<std::string, std::string> common;
996  getCondChipVhdContentFromTriggerMenu(i, templates, common);
997  writeConditionChipSetup(templates, common, i);
998 
999  // despite yet not existing they have to appear in cond_chip_pkg vhds
1001 
1002  // --------------------cond chip pkg------------------------------------------------------------
1003 
1005 
1006  // -----------------------def val pkg -------------------------------------------------
1007 
1009 
1010  // debug
1011  if (debugMode_)
1012  {
1013  //printConditionsOfCategory(CondEnergySum, (*conditionMap_).at(i-1));
1014  }
1015 
1016  }
1017 
1018  if (debugMode_)
1020 
1021  //-------------------------------process algorithms----------------------------------------------------------
1022 
1023  std::vector< std::map<int, std::string> > algoStrings;
1024 
1025  processAlgorithmMap(algoStrings);
1026 
1027  writeAlgoSetup(algoStrings);
1028 
1029  return true;
1030 }
1031 
1033 {
1034  return vhdlDir_;
1035 }
1036 
1037 std::string L1GtVhdlWriterCore::int2str(const int &integerValue)
1038 {
1039  std::ostringstream oss;
1040  oss<<integerValue;
1041  return oss.str();
1042 
1043 }
1044 
1046  std::map<std::string,std::string> &headerParameters,
1047  const std::vector<std::string> &connectedChannels)
1048 {
1049  commonHeader_.open(vhdlDir_+"InternalTemplates/header");
1050 
1051  std::map<std::string,std::string>::iterator iter = headerParameters.begin();
1052 
1053  // loop over the header parameter map and replace all subsitution
1054  // parameters with their values
1055  while (iter != headerParameters.end() )
1056  {
1057  commonHeader_.substitute((*iter).first, (*iter).second);
1058  iter++;
1059  }
1060 
1061  commonHeader_.insert("$(connected_channels_1)", connectedChannels);
1062  commonHeader_.insert("$(connected_channels_2)", connectedChannels);
1063 
1064  //---------------------build the Quartus configuration files----------------------------------------
1065 
1066  //writeQsfSetupFiles(headerParameters["version"]);
1067 
1068  version_=headerParameters["version"];
1069 
1070  msg("Build Common header and Quartus setup files sucessuflly!");
1071 
1072 }
1073 
1075  const std::string &filename, const std::string &outputFilename)
1076 {
1077  L1GtVhdlTemplateFile commonHeaderCp;
1078  commonHeaderCp = commonHeader_;
1079 
1080  commonHeaderCp.substitute("vhdl_file_name", outputFilename);
1081 
1082  L1GtVhdlTemplateFile myTemplate(vhdlDir_+"Templates/"+filename);
1083  myTemplate.insert("$(header)", commonHeaderCp);
1084 
1085  return myTemplate;
1086 }
1087 
1089  std::map<std::string,std::string> &muonParameters,
1090  const std::string &particle, unsigned short int &condChip)
1091 {
1092  std::string filename;
1093 
1094  L1GtVhdlTemplateFile muonTemplate, internalTemplate, internalTemplateCopy;
1095 
1096  // choose the correct template file name
1097  if (particle=="muon")
1098  {
1099  filename = vhdlTemplateMuonSetup_;
1100  internalTemplate.open(vhdlDir_+"InternalTemplates/muonsetup", true);
1101  } else
1102  {
1103  filename = vhdlTemplateCaloSetup_;
1104  internalTemplate.open(vhdlDir_+"InternalTemplates/calosetup", true);
1105  }
1106 
1107  std::string outputFile;
1108  outputFile = filename;
1109 
1110  // modify filename
1111  if (particle!="muon")
1112  muonTemplate.findAndReplaceString(outputFile, "calo", particle);
1113 
1114  // add condition chip index to output filename
1115  //muonTemplate.findAndReplaceString(outputFile, ".", int2str(condChip)+".");
1116 
1117  // open the template file and insert header
1118  muonTemplate = openVhdlFileWithCommonHeader(filename, outputFile);
1119 
1120  std::map<std::string,std::string> parameterMap =
1121  internalTemplate.returnParameterMap();
1122 
1123  std::vector<std::string> substitutionParameters;
1124 
1125  // fills the map with all substitution parameters of the template file
1126  substitutionParameters=muonTemplate.getSubstitutionParametersFromTemplate();
1127 
1128  // insert a emty line at the end of each block
1129  internalTemplate.append("");
1130 
1131  std::map<std::string, std::string>::iterator iter;
1132 
1133  // loop over all substitution parameters that have been extracted from the template file
1134  for (unsigned int i=0; i<substitutionParameters.size(); i++)
1135  {
1136  // make a working copy of the template file
1137  internalTemplateCopy = internalTemplate;
1138 
1139  // choose which of the three constant template strings to take - only for calo!
1140  if (particle!="muon")
1141  {
1142 
1143  if (substitutionParameters.at(i).substr(0, 3) == "eta")
1144  internalTemplateCopy.substitute("constant", parameterMap["eta"]);
1145  else if (substitutionParameters.at(i).substr(0, 3) == "phi")
1146  internalTemplateCopy.substitute("constant", parameterMap["phi"]);
1147  else if (substitutionParameters.at(i).substr(0, 3) == "del"/*ta*/)
1148  {
1149  internalTemplateCopy.substitute("constant",
1150  parameterMap["delta"]);
1151  while (internalTemplateCopy.substitute("delta",
1152  substitutionParameters[i]))
1153  internalTemplateCopy.substitute("delta",
1154  substitutionParameters[i]);
1155 
1156  }
1157  }
1158 
1159  if (particle=="muon")
1160  {
1161  // final preparation of the internal template before it is inserted in the actual template file
1162  internalTemplateCopy.substitute("type", substitutionParameters[i]);
1163  } else
1164 
1165  {
1166  internalTemplateCopy.substitute("type", substitutionParameters[i].substr(4));
1167  }
1168 
1169  // subsitute the second occurance of type without "_l" and "_h"
1170 
1171  std::string paramCopy = substitutionParameters[i];
1172 
1173  internalTemplateCopy.findAndReplaceString(paramCopy, "_l", "");
1174  internalTemplateCopy.findAndReplaceString(paramCopy, "_h", "");
1175 
1176  internalTemplateCopy.substitute("type2", paramCopy);
1177 
1178  internalTemplateCopy.substitute("others",
1179  parameterMap[substitutionParameters[i]]);
1180 
1181  // replace all the occurances of "particle"
1182  while (muonTemplate.substitute("particle", particle))
1183  muonTemplate.substitute("particle", particle);
1184 
1185  // remove the the parameter $(content) if its empty
1186  iter=muonParameters.find(substitutionParameters[i]);
1187 
1188  // check weather this parameter exists
1189  if (iter!=muonParameters.end())
1190  {
1191  if ((*iter).second[(*iter).second.length()-1]=='\n')
1192  (*iter).second[(*iter).second.length()-1]=' ';
1193  internalTemplateCopy.substitute("content", (*iter).second);
1194  } else
1195  internalTemplateCopy.removeLineWithContent("$(content)");
1196 
1197  // insert the processed internal template in the muon template file
1198  muonTemplate.insert("$("+substitutionParameters[i]+")",
1199  internalTemplateCopy);
1200  }
1201 
1202  // save the muon template file
1203  muonTemplate.save(chip2OutputSubDir(condChip)+outputFile);
1204  chmod((chip2OutputSubDir(condChip)+outputFile).c_str(), 0666);
1205 
1206 }
1207 
1209  std::map<std::string, L1GtVhdlTemplateFile> templates,
1210  const std::map<std::string, std::string> &common,
1211  const unsigned short int &chip)
1212 {
1213 
1214  // get filename
1215  std::string filename = vhdlTemplateCondChip_;
1216 
1217  // build output filename
1218  std::string outputFileName = filename;
1219  L1GtVhdlTemplateFile::findAndReplaceString(outputFileName, ".",
1220  int2str(chip)+".");
1221 
1222  L1GtVhdlTemplateFile myTemplate = openVhdlFileWithCommonHeader(filename,
1223  outputFileName);
1224 
1225  // map containing the subsitution parameters with their content (as L1GtVhdlTemplateFile file object)
1226  std::map<std::string, L1GtVhdlTemplateFile>::iterator iter=
1227  templates.begin();
1228 
1229  while (iter != templates.end())
1230  {
1231 
1232  myTemplate.insert("$("+(iter->first)+")", iter->second);
1233 
1234  iter++;
1235  }
1236 
1237  // subsitutes common parameters
1238  std::map<std::string, std::string>::const_iterator iter2= common.begin();
1239 
1240  while (iter2 != common.end())
1241  {
1242 
1243  myTemplate.substitute((iter2->first), iter2->second);
1244 
1245  iter2++;
1246  }
1247 
1248  myTemplate.save(chip2OutputSubDir(chip)+filename);
1249  chmod((chip2OutputSubDir(chip)+filename).c_str(), 0666);
1250 
1251 }
1252 
1253 void L1GtVhdlWriterCore::writeAlgoSetup(std::vector< std::map<int, std::string> > &algoStrings)
1254 {
1255  // loop over the two condition chips
1256  for (unsigned int i=1; i<=2; i++)
1257  {
1258  std::string filename=vhdlTemplateAlgoAndOr_;
1259 
1260  // output file name
1261  std::string outputFileName = filename;
1262  L1GtVhdlTemplateFile::findAndReplaceString(outputFileName, ".",
1263  int2str(i)+".");
1264 
1266  filename, outputFileName);
1267 
1268  std::ostringstream buffer;
1269 
1270  unsigned int algoPinsPerChip = 96;
1271 
1272  for (unsigned int k=1; k<=algoPinsPerChip; k++)
1273  {
1274 
1275  buffer<< stringConstantAlgo_<<"("<<k<<")";
1276  if (algoStrings.at(i-1)[k]!="")
1277  buffer<<" <= "<<algoStrings.at(i-1)[k]<<";"<<std::endl;
1278  else
1279  buffer<<" <= '0';"<<std::endl;
1280  }
1281 
1282  templateFile.substitute(substParamAlgos_, buffer.str());
1283  templateFile.save(chip2OutputSubDir(i)+filename);
1284  chmod((chip2OutputSubDir(i)+filename).c_str(), 0666);
1285  }
1286 
1287 }
1288 
1289 void L1GtVhdlWriterCore::writeEtmSetup(std::string &etmString,
1290  const int &condChip)
1291 {
1292 
1293  // get filename
1294  std::string filename= vhdlTemplateEtmSetup_;
1295  std::string outputFile = filename;
1296 
1297  L1GtVhdlTemplateFile myTemplate;
1298 
1299  // modify output filename
1300  myTemplate.findAndReplaceString(outputFile, ".", int2str(condChip)+".");
1301 
1302  myTemplate = openVhdlFileWithCommonHeader(filename, filename);
1303 
1304  // replace all occurances of $(particle)
1305  while (myTemplate.substitute("particle", "etm"))
1306  while (myTemplate.substitute("particle", "etm"))
1307  ;
1308 
1309  // delete last char if it is \n
1310  if (etmString[etmString.length()-1] == '\n')
1311  etmString = etmString.substr(0, etmString.length()-1);
1312 
1313  myTemplate.substitute("phi", etmString);
1314 
1315  myTemplate.save(chip2OutputSubDir(condChip)+filename);
1316  chmod((chip2OutputSubDir(condChip)+filename).c_str(), 0666);
1317 
1318 }
1319 
1321 {
1322  commonHeader_.print();
1323 }
1324 
1326 {
1327  return commonHeader_;
1328 }
1329 
1331 {
1332 
1333  std::vector<std::string> filenames;
1334  filenames.push_back(quartusSetupFileChip1_);
1335  filenames.push_back(quartusSetupFileChip2_);
1336 
1337  for (unsigned int i=0; i<filenames.size(); i++)
1338  {
1339  L1GtVhdlTemplateFile myTemplate;
1340 
1341  myTemplate.open(vhdlDir_+"Templates/"+filenames.at(i));
1342  myTemplate.substitute("version", version);
1343 
1344  std::string tempStr = filenames.at(i);
1345 
1346  if (i==0)
1347  L1GtVhdlTemplateFile::findAndReplaceString(tempStr , "cond1","cond");
1348  if (i==1)
1349  L1GtVhdlTemplateFile::findAndReplaceString(tempStr , "cond2","cond");
1350 
1351  myTemplate.save(chip2OutputSubDir(i+1)+tempStr);
1352  chmod((chip2OutputSubDir(i+1)+tempStr).c_str(), 0666);
1353  }
1354 
1355 }
1356 
1357 void L1GtVhdlWriterCore::msg(const std::string &message)
1358 {
1359  internMessageBuf_.push_back(message);
1360 }
1361 
1362 std::vector<std::string> L1GtVhdlWriterCore::getMsgBuf()
1363 {
1364  return internMessageBuf_;
1365 }
1366 
1367 bool L1GtVhdlWriterCore::getIntVal(const std::map<std::string,int> &map,
1368  const std::string &searchValue, int &intVal)
1369 {
1370  std::map<std::string,int>::const_iterator iter = map.find(searchValue);
1371  if (iter == map.end() )
1372  return false;
1373  intVal = (*iter).second;
1374  return true;
1375 }
1376 
1378 {
1379  intval++;
1380  return int2str(intval);
1381 }
1382 
1384  const std::vector<ConditionMap> &conditionMap,
1385  std::map<std::string,int> &conditionToIntegerMap_)
1386 {
1387  ConditionMap jetConditions;
1388 
1390  conditionMap.at(chip-1), jetConditions);
1391  /*
1392  int counter = 0;
1393 
1394  for (ConditionMap::const_iterator iterCond = jetConditions.begin(); iterCond != jetConditions.end(); iterCond++)
1395  {
1396  conditionToIntegerMap_[iterCond->first]=counter;
1397  counter++;
1398  msg(iterCond->first);
1399  }
1400 
1401  */
1402 
1403  unsigned int maxJetsCountsIndex = 11;
1404 
1405  for (unsigned int i= 0; i<=maxJetsCountsIndex; i++)
1406  {
1407  int counter = 0;
1408 
1409  for (ConditionMap::const_iterator iterCond = jetConditions.begin(); iterCond
1410  != jetConditions.end(); iterCond++)
1411  {
1412 
1413  L1GtJetCountsTemplate* jetsTemplate =
1414  static_cast<L1GtJetCountsTemplate*>(iterCond->second);
1415  const std::vector<L1GtJetCountsTemplate::ObjectParameter>* op =
1416  jetsTemplate->objectParameter();
1417 
1418  conditionToIntegerMap_[iterCond->first]=counter;
1419  if ((*op)[0].countIndex==i)
1420  counter++;
1421 
1422  //msg(int2str((*op)[0].countIndex));
1423 
1424  }
1425 
1426  numberOfConditions_.at(chip-1).push_back(retNumberOfConditionsString("jet_cnts_"
1427  +int2str(i)+"_cond", counter));
1428 
1429  }
1430 
1431 }
1432 
1434 {
1435 
1436 
1437  for (unsigned int i=0; i<=1;i++)
1438  {
1439  ConditionMap::const_iterator iterCond =
1440  conditionMap_->at(i).begin();
1441 
1442  std::string filename=chip2OutputSubDir(i+1)+"cond_names_integer.txt";
1443 
1444  std::ofstream outputFile(filename.c_str());
1445 
1446  while (iterCond!=conditionMap_->at(i).end())
1447  {
1448  conditionToIntegerMap_[(*iterCond).first];
1449 
1450  outputFile<<(iterCond->first)<<": "<<conditionToIntegerMap_[(*iterCond).first]<<std::endl;
1451  iterCond++;
1452  }
1453 
1454  outputFile.close();
1455 
1456  chmod(filename.c_str(), 0666);
1457 
1458 
1459  }
1460 
1461  /*
1462 
1463 
1464  const std::vector<ConditionMap> * conditionMap_;
1465 
1466  std::string filename=outputDir_+"cond_names_integer.txt";
1467  std::ofstream outputFile(filename.c_str());
1468 
1469  for (std::map<std::string,int>::const_iterator iterCond =
1470  conditionToIntegerMap_.begin(); iterCond
1471  != conditionToIntegerMap_.end(); iterCond++)
1472  {
1473  outputFile<<(iterCond->first)<<": "<<(iterCond->second)<<std::endl;
1474  }
1475 
1476  */
1477 
1478 }
1479 
1480 std:: string L1GtVhdlWriterCore::buildDefValString(const int &conditionIndex,
1481  const std::vector<int> &values)
1482 {
1483  // has to produce something like 1 => ("00000000", "00000000")
1484 
1485  return "1 => (\"00000000\", \"00000000\")";
1486 }
1487 
1489  const L1GtConditionType &type, const L1GtObject &object,
1490  const VmeRegister &reg)
1491 {
1493 
1494  // get condition category from object
1495 
1496  category = getCategoryFromObject(object);
1497 
1498  ConditionMap conditions;
1499  returnConditionsOfOneClass(type, category, object, (*conditionMap_).at(0),
1500  conditions);
1501 
1502  std::string result;
1503 
1504  if (category==CondCalo)
1505  {
1506  for (ConditionMap::const_iterator iterCond =conditions.begin(); iterCond
1507  != conditions.end(); iterCond++)
1508  {
1509  L1GtCaloTemplate* caloTemplate =
1510  static_cast<L1GtCaloTemplate*>(iterCond->second);
1511  const std::vector<L1GtCaloTemplate::ObjectParameter>* op =
1512  caloTemplate->objectParameter();
1513 
1514  unsigned int nObjects = iterCond->second->nrObjects();
1515 
1516  for (unsigned int i =0; i<nObjects; i++)
1517  {
1518  if (i==0)
1519  result+="(";
1520  result +="\"";
1521  result += int2str((*op).at(i).etThreshold);
1522  result +="\"";
1523  if (i!=nObjects-1)
1524  result +=",";
1525  else
1526  result+=")\n";
1527 
1528  }
1529  }
1530  }
1531 
1532  return "-- 0 => (\"00000000\", \"00000000\" ... )";
1533  return result;
1534 }
1535 
1537  const std::vector<ConditionMap> &conditionMap, const int &chip)
1538 {
1539  // open internal template file
1540  L1GtVhdlTemplateFile internalTemplate;
1541  internalTemplate.open(vhdlDir_+"InternalTemplates/defvalpkg", true);
1542 
1543  // to write the def_value_pkg file it has to be looped over all POSSIBLE types of conditions
1544  // POSSIBLE: calo_3 eg. does not exist and therefore makes no sense..
1545 
1546  // Process muon conditions first
1547 
1548  // temporary buffers for the default value blocks (see internal templates) of the different types.
1549  // in the end those buffers are simply appended to the actual template!
1550  L1GtVhdlTemplateFile muonDefValuesBuffer, caloDefValuesBuffer,
1551  jetCountsDefValuesBuffer, esumsDefValBuffer;
1552 
1553  // Get the default value type strings from internal template
1554  std::vector<std::string> muonDefValTypes;
1555  muonDefValTypes.push_back(internalTemplate.getInternalParameter(stringConstantPtl_));
1556  muonDefValTypes.push_back(internalTemplate.getInternalParameter(stringConstantPth_));
1557  muonDefValTypes.push_back(internalTemplate.getInternalParameter(stringConstantQuality_));
1558  muonDefValTypes.push_back(internalTemplate.getInternalParameter(substParamCharge_));
1559 
1560  int jetCountsMaxIndex = 11;
1561 
1562  // fill jet counts vector (from 1 to 11)
1563  std::vector<std::string> jetCountsDefValTypes;
1564  for (int i = 0; i<=jetCountsMaxIndex; i++)
1565  {
1566  jetCountsDefValTypes.push_back(int2str(i));
1567  }
1568 
1569  // only one default value for calo objects therefore only a empty string
1570  std::vector<std::string> caloDefValTypes;
1571  caloDefValTypes.push_back("");
1572 
1573  // get types of esums defvalues (as firmware strings) from the internal templates
1574  std::vector<std::string> esumsDefValTypes;
1575  esumsDefValTypes.push_back(internalTemplate.getInternalParameter(stringConstantEsumsLow_));
1576  esumsDefValTypes.push_back(internalTemplate.getInternalParameter(stringConstantEsumsHigh_));
1577 
1578  std::map<L1GtConditionType,std::string>::iterator typeIter;
1579 
1580  // prepare a map with all muon relevant types by removing
1581  // obsolete types from a copy of condType2Str_ map
1582  // should be improved
1583  std::map<L1GtConditionType,std::string> muonTypes = condType2Str_;
1584 
1585  typeIter=muonTypes.find(Type2cor);
1586  muonTypes.erase(typeIter);
1587  typeIter=muonTypes.find(TypeETM);
1588  muonTypes.erase(typeIter);
1589  typeIter=muonTypes.find(TypeETT);
1590  muonTypes.erase(typeIter);
1591  typeIter=muonTypes.find(TypeHTT);
1592  muonTypes.erase(typeIter);
1593  typeIter=muonTypes.find(TypeJetCounts);
1594  muonTypes.erase(typeIter);
1595 
1596  std::map<L1GtConditionType,std::string> caloTypes = muonTypes;
1597  typeIter=caloTypes.find(Type3s);
1598  caloTypes.erase(typeIter);
1599 
1600  // dummy type in order to be able to use the same code as for calo and muon
1601  // this map is also used for esums since there is no difference in treatment
1602  std::map<L1GtConditionType,std::string> jetCountsTypes;
1603  jetCountsTypes[TypeJetCounts] = "";
1604 
1605  // here the DefValuesBuffer are build (=objects of the class L1GtVhdlTemplateFile
1606  // that are containing all default values and finally can be inserted into the
1607  // def_val_pkg.vhd template
1608 
1609  buildDefValuesBuffer(muonDefValuesBuffer, muonTypes, muonDefValTypes, Mu);
1610 
1611  // loop over all possible calo objects here
1612  for (unsigned int i=0; i<caloObjects_.size(); i++)
1613  {
1614  buildDefValuesBuffer(caloDefValuesBuffer, caloTypes, caloDefValTypes,
1615  caloObjects_.at(i));
1616  }
1617 
1618  // loop over all possible esums objects here
1619  for (unsigned int i=0; i<esumObjects_.size(); i++)
1620  {
1621  buildDefValuesBuffer(esumsDefValBuffer, jetCountsTypes,
1622  esumsDefValTypes, esumObjects_.at(i));
1623  }
1624 
1625  // same procedure for jet counts
1626  buildDefValuesBuffer(esumsDefValBuffer, jetCountsTypes,
1627  jetCountsDefValTypes, JetCounts);
1628 
1629  //----------------------In this section the actual output file is written----------------
1630 
1631  // now open the actual template file:
1632 
1633  std::string filename = vhdlTemplateDefValPkg_;
1634 
1635  std::string outputFile = filename;
1636 
1637  // modify output filename
1639  +".");
1641  filename, outputFile);
1642 
1643  // insert the temporary buffers to the template
1644 
1645  // muon default values
1646  defValTemplate.insert(sp(substParamMuonDefVals_), muonDefValuesBuffer);
1647 
1648  // calo default values
1649  defValTemplate.insert(sp(substParamCaloDefVals_), caloDefValuesBuffer);
1650 
1651  // esums default values
1652  defValTemplate.insert(sp(substParamEsumsDefVals_), esumsDefValBuffer);
1653 
1654  // jet counts default values
1655  defValTemplate.insert(sp(substParamJetsDefVals_), jetCountsDefValuesBuffer);
1656 
1657  // close and save the file
1658 
1659  L1GtVhdlTemplateFile::findAndReplaceString(outputFile, "1","");
1660  L1GtVhdlTemplateFile::findAndReplaceString(outputFile, "2","");
1661 
1662  defValTemplate.save(chip2OutputSubDir(chip)+outputFile);
1663  chmod((chip2OutputSubDir(chip)+outputFile).c_str(), 0666);
1664 
1665 }
1666 
1668  const std::map<L1GtConditionType,std::string> &typeList,
1669  const std::vector<std::string> &defValuesList, const L1GtObject &object)
1670 {
1671  // type iterator
1672  std::map<L1GtConditionType,std::string>::const_iterator typeIter;
1673 
1674  for (typeIter=typeList.begin(); typeIter!=typeList.end(); typeIter++)
1675  {
1676 
1677  for (unsigned int i = 0; i<defValuesList.size(); i++)
1678  {
1679 
1680  // open a new internale template
1681  L1GtVhdlTemplateFile internalTemplate;
1682  internalTemplate.open(vhdlDir_+"InternalTemplates/defvalpkg", true);
1683 
1684  std::string
1685  idString =
1687 
1688  // The following three steps convert "$(particle)_$(type)_$(defvaltype)_def_val"
1689  // to e.g. "muon_1s_et_def_val"
1690 
1691  // replace the substiution parameter particle with muon - thereby parameterString is a
1692  // reference and therefore changed.
1694  sp(substParamParticle_), objType2Str_[object]);
1695 
1696  // replace the substiution parameter particle with muon
1698  sp(substParamType_), typeIter->second);
1699 
1700  // replace the substiution parameter defvaltype with muon
1702  sp(substParamDefValType_), defValuesList.at(i));
1703 
1704  // usage of the subsitute routine:
1705  // first the substitution parameter, then the content
1706  internalTemplate.substitute(substParamDefValId_, idString);
1707 
1708  // !here the body of the internale template is build - almost done!
1709 
1710  // The body looks as follows $(def_val), $(max_nr), $(content) and
1711  // $(others) have to be subsituted
1712 
1713  /*
1714  * CONSTANT $(def_val) : $(calo_or_muon)_maxnr$(max_nr)vector8_arr :=
1715  * (
1716  * $(content)
1717  * $(others)
1718  * );
1719  */
1720 
1721  // substitute the particle
1722  internalTemplate.substitute(substParamParticle_,
1723  objType2Str_[object]);
1724 
1725  // go on with max number - get the correct expression for max number from the internal template
1726  internalTemplate.substitute(substParamMaxNr_,
1727  internalTemplate.getInternalParameter(substParamMaxNr_+"_"
1728  +condType2Str_[typeIter->first]));
1729 
1730  // now we have to choose the correct OTHERS string for the
1731  // internal template. The identifier for the OTHERS string
1732  // is the condition type (as firmware string) therefore:
1733 
1734  // we get it as follows
1735  std::string othersString;
1736 
1737  // jet_cnts are a special case
1738  if (object==JetCounts || object==HTT || object==ETM || object==ETT )
1739  othersString
1740  = internalTemplate.getInternalParameter(objType2Str_[JetCounts]);
1741  else
1742  othersString
1743  = internalTemplate.getInternalParameter(typeIter->second);
1744 
1745  internalTemplate.substitute(substParamOthers_, othersString);
1746 
1747  // the actual content, taken from the trigger menu
1748 
1749  std::string content = getDefValsFromTriggerMenu(typeIter->first,
1750  object, RegEtThreshold);
1751 
1752  internalTemplate.substitute(substParamContent_, content);
1753 
1754  // Finally the parameter $(calo_or_muon) is left open
1755  std::string caloOrMuonStr = stringConstantCalo_;
1756 
1757  if (object == Mu)
1758  caloOrMuonStr = objType2Str_[Mu];
1759 
1760  internalTemplate.substitute(substParamCaloOrMuon_, caloOrMuonStr);
1761 
1762  // The internal template has been processed and now can be added to the buffer..
1763  buffer.append(internalTemplate);
1764 
1765  }
1766 
1767  }
1768 
1769  return true;
1770 }
1771 
1774  const L1GtObject &object, const ConditionMap &map,
1775  ConditionMap &outputMap, const int &condChip)
1776 {
1777 
1778  // Get the absoloute amount of conditions
1779 
1780  int number;
1781 
1782  if (returnConditionsOfOneClass(type, category, object, map, outputMap))
1783  number=outputMap.size();
1784  else
1785  number=0;
1786 
1787  std::string initstr = retNumberOfConditionsString(objType2Str_[object]+"_"
1788  +condType2Str_[type], number);
1789 
1790  numberOfConditions_.at(condChip-1).push_back(initstr);
1791 
1792 }
1793 
1795 {
1796 
1797  for (unsigned int k=0; k<=1; k++)
1798  {
1799 
1800  // combine muon with calo particles
1801  for (unsigned int i=0; i<caloObjects_.size(); i++)
1802  {
1804  +"_"+objType2Str_[caloObjects_.at(i)], 0));
1805  }
1806 
1807  // combine etm with muon
1809  +objType2Str_[Mu], 0));
1810 
1811  // combine etm with calo particles
1812  for (unsigned int i=0; i<caloObjects_.size(); i++)
1813  {
1815  +"_"+objType2Str_[caloObjects_.at(i)], 0));
1816  }
1817 
1818  std::vector<L1GtObject> caloObjectsCp = caloObjects_;
1819 
1820  while (caloObjectsCp.size()>0)
1821  {
1822  std::vector<L1GtObject>::iterator iter=caloObjectsCp.begin();
1823  L1GtObject firstPartner = (*iter);
1824  caloObjectsCp.erase(iter);
1825 
1826  iter=caloObjectsCp.begin();
1827  while (iter!=caloObjectsCp.end())
1828  {
1830  objType2Str_[firstPartner]+"_"+objType2Str_[(*iter)], 0));
1831  iter++;
1832  }
1833 
1834  }
1835 
1836  }
1837 }
1838 
1840  const L1GtObject &object)
1841 {
1842 
1844 
1845  if (object==Mu)
1846  category = CondMuon;
1847  else if (object==ETM || object==HTT || object==ETT)
1848  category = CondEnergySum;
1849  else if (object==IsoEG|| object==NoIsoEG || object==CenJet || object
1850  ==ForJet || object==TauJet)
1851  category = CondCalo;
1852  else if (object==IsoEG|| object==NoIsoEG || object==CenJet || object
1853  ==ForJet || object==TauJet)
1854  category = CondCalo;
1855  else if (object==JetCounts)
1856  category = CondJetCounts;
1857  else
1858  category=CondNull;
1859 
1860  return category;
1861 
1862 }
1863 
1866 {
1867  int counter =0;
1868  for (ConditionMap::const_iterator iterCond = map.begin(); iterCond
1869  != map.end(); iterCond++)
1870  {
1871  msg(iterCond->first);
1872  counter++;
1873  }
1874 
1875  msg("Total Occurances: "+int2str(counter));
1876 
1877 }
1878 
1880 {
1881 
1882  // build filename
1883 
1884  std::string filename;
1885 
1886  if (chip==1)
1887  filename = vhdlTemplateCondChipPkg1_;
1888  else if (chip==2)
1889  filename = vhdlTemplateCondChipPkg2_;
1890 
1891  // write the output
1892  L1GtVhdlTemplateFile myTemplate = openVhdlFileWithCommonHeader(filename,
1893  filename);
1894 
1895  myTemplate.substitute("version",version_);
1896 
1897  myTemplate.insert("$(conditions_nr)", numberOfConditions_.at(chip-1));
1898 
1901 
1902  myTemplate.save(chip2OutputSubDir(chip)+filename);
1903  chmod((chip2OutputSubDir(chip)+filename).c_str(), 0666);
1904 }
1905 
1907  const std::string &typeStr, const int &number)
1908 {
1909  std::string initstr=stringConstantConstantNr_+typeStr+" : integer := "+int2str(number)
1910  +";";
1911 
1912  return initstr;
1913 }
1914 
1915 std::map<std::string,int> L1GtVhdlWriterCore::getCond2IntMap()
1916 {
1917  return conditionToIntegerMap_;
1918 }
1919 
1920 std::string L1GtVhdlWriterCore::sp(const std::string &name)
1921 {
1922  return "$("+name+")";
1923 }
1924 
static const std::string substParamMuonDefVals_
std::map< std::string, std::string > returnParameterMap()
returns parameter map
static const std::string vhdlTemplateAlgoAndOr_
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
std::string vhdlDir_
templates directory
void writeConditionChipSetup(std::map< std::string, L1GtVhdlTemplateFile > templates, const std::map< std::string, std::string > &common, const unsigned short int &chip)
builds cond_chip.vhds
std::string sp(const std::string &name)
converts string name to substiution parameter synthax; name –&gt;
static const bool findAndReplaceString(std::string &paramString, const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString at it&#39;s first occurance in string
std::string buildEtaCalo(const std::vector< L1GtCaloTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
static const std::string substParamCaloDefVals_
const int nrObjects() const
get number of trigger objects
bool substitute(const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString
static const std::string stringConstantCharge2wsc_
const std::map< L1GtConditionType, std::string > getCond2StrMap()
const CorrelationParameter * correlationParameter() const
static const std::string quartusSetupFileChip2_
static const std::string stringConstantDefValId_
void writeQsfSetupFiles(const std::string &version)
builds the two quartus setup files. This routine is called in buildCommonHeader!
std::vector< L1GtObject > esumObjects_
list of all possible esums objects
bool save(const std::string &fileName)
saves the content of the template file to a local file (the content of parameterMap_ will not be save...
static const std::string stringConstantEsumsLow_
std::map< L1GtObject, std::string > caloType2Int_
converts L1GtObject to calo_nr
std::map< std::string, L1GtCondition * > ConditionMap
map containing the conditions
Definition: L1GtObject.h:38
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
void writeDefValPkg(const std::vector< ConditionMap > &conditionMap, const int &chip)
writes def_val_pkg.vhd
std::map< L1GtConditionType, std::string > condType2Str_
converts L1GtConditionType to firmware string
static const std::string substParamJetsDefVals_
string templateFile
Definition: indexGen.py:50
bool getCaloSetupContentFromTriggerMenu(const unsigned short int &condChip, std::map< std::string, std::string > &caloParameters, const L1GtObject &caloObject)
L1GtVhdlWriterBitManager bm_
bit manager for bit operations
std::string getDefValsFromTriggerMenu(const L1GtConditionType &type, const L1GtObject &object, const VmeRegister &reg)
std::string buildDeltaEtaCalo(const L1GtCaloTemplate::CorrelationParameter *&cp, const unsigned int &counter)
L1GtVhdlWriterCore(const std::string &templatesDirectory, const std::string &outputDirectory, const bool &debug)
constructor
static const std::string substParamDefValType_
#define NULL
Definition: scimark2.h:8
std::vector< L1GtObject > caloObjects_
list of all possible calo objects
static const std::string substParamJetCntsCommon_
std::string index4CondChipVhd(int intval)
L1GtConditionType
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static const std::string stringConstantCommon_
std::vector< std::vector< std::string > > numberOfConditions_
vector containing the initialization of all conditions
bool getIntVal(const std::map< std::string, int > &map, const std::string &searchValue, int &intVal)
checks weather value searchValue exists in a &lt;string,int&gt; map, saves it in &amp;intVal if it exists and r...
static std::string int2str(const int &integerValue)
converts a integer into a string
bool returnConditionsOfOneClass(const L1GtConditionType &type, const L1GtConditionCategory &category, const L1GtObject &object, const ConditionMap &map, ConditionMap &outputMap)
bool getEsumsSetupContentFromTriggerMenu(const unsigned short int &condChip, const L1GtObject &object, std::string &energySumParameter)
contains only one subsitution parameter which is stored in reference energySumParameter ...
bool removeLineWithContent(const std::string &str)
removes all lines that contain the str
L1GtConditionCategory getCategoryFromObject(const L1GtObject &object)
gets condition category from object
static const std::string substParamAlgos_
static const std::string vhdlTemplateCondChipPkg2_
std::string buildDeltaPhiCalo(const L1GtCaloTemplate::CorrelationParameter *&cp, const unsigned int &counter)
const AlgorithmMap * algorithmMap_
algorithm map
Definition: L1GtObject.h:40
~L1GtVhdlWriterCore()
destructor
static const std::string stringConstantCharge4s_
std::vector< std::string > getMsgBuf()
returns intern message buffer
static const std::string stringConstantAlgo_
void writeEtmSetup(std::string &etmString, const int &condChip)
builds etm setup files
static const std::string stringConstantEsumsHigh_
bool insert(const std::string &atLine, std::vector< std::string > content)
replaces the whole line containing atLine and inserts content instead of it
bool makeFirmware(const std::vector< ConditionMap > &conditionMap, const AlgorithmMap &algorithmMap)
produces the firmware code
const std::vector< ObjectParameter > * objectParameter() const
std::string buildPhiCalo(const std::vector< L1GtCaloTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
const std::vector< ObjectParameter > * objectParameter() const
static const std::string substParamType_
void writeCond2intMap2File()
produces a control output file for condition to integer conversion
bool getSubstParamCommonFromTriggerMenu(const unsigned short int &condChip, L1GtVhdlTemplateFile &particle, const L1GtObject &object, const L1GtConditionCategory &category, std::string &parameterStr)
builds the parameters particle_common for the cond_chip.vhd&#39;s
void printCommonHeader()
prints the common header
static const std::string vhdlTemplateCaloSetup_
L1GtVhdlTemplateFile commonHeader_
common header for all files
tuple result
Definition: query.py:137
void append(const std::string &str)
adds a line at the end of the the file with the content of str
static const std::string substParamDefValId_
const std::vector< ObjectParameter > * objectParameter() const
L1GtConditionCategory
condition categories
void print()
prints the content of the VHDL File (only lines_)
std::string buildDeltaPhiMuon(const L1GtMuonTemplate::CorrelationParameter *&cp, const unsigned int &counter)
typedef for correlation parameters
std::string getInternalParameter(const std::string &indentifier)
returns a parameter of a internal template file
void writeCondChipPkg(const int &chip)
static const std::string vhdlTemplateEtmSetup_
static const std::string stringConstantCharge3s_
static const std::string vhdlTemplateMuonSetup_
L1GtVhdlTemplateFile retrunCommonHeader()
returns the common header
static const std::string vhdlTemplateCondChipPkg1_
void countCondsAndAdd2NumberVec(const L1GtConditionType &type, const L1GtConditionCategory &category, const L1GtObject &object, const ConditionMap &map, ConditionMap &outputMap, const int &condChip)
const std::vector< ConditionMap > * conditionMap_
condition map
std::string retNumberOfConditionsString(const std::string &typeStr, const int &number)
std::string gtTemplatesPath()
returns the templates path
int k[5][pyjets_maxn]
std::string buildDeltaEtaMuon(const L1GtMuonTemplate::CorrelationParameter *&cp, const unsigned int &counter)
static const std::string quartusSetupFileChip1_
static const std::string outputSubDir1_
void getMuonSetupContentFromTriggerMenu(const unsigned short int &condChip, std::map< std::string, std::string > &muonParameters)
void msg(const std::string &message)
adds a string to intern message buffer
Definition: L1GtObject.h:32
static const std::string stringConstantCalo_
std::vector< std::string > internMessageBuf_
static const std::string outputSubDir2_
std::string outputDir_
output directory
static const std::string stringConstantPth_
bool getCondChipVhdContentFromTriggerMenu(const unsigned short int &condChip, std::map< std::string, L1GtVhdlTemplateFile > &templates, std::map< std::string, std::string > &commonParams)
void getConditionsFromAlgo(std::string condString, std::vector< std::string > &result)
extracts all conditions from a algorithm
static const std::string substParamContent_
static const std::string substParamParticle_
std::map< std::string, int > getCond2IntMap()
list object
Definition: dbtoconf.py:77
const CorrelationParameter * correlationParameter() const
std::string chip2OutputSubDir(const int &chip)
std::string buildDefValString(const int &conditionIndex, const std::vector< int > &values)
Definition: L1GtObject.h:39
static const std::string stringConstantPtl_
static const std::string substParamOthers_
static const std::string vhdlTemplateDefValPkg_
void addJetCountsToCond2IntMap(const int chip, const std::vector< ConditionMap > &conditionMap, std::map< std::string, int > &conditionToIntegerMap)
static const std::string substParamCaloOrMuon_
L1GtVhdlTemplateFile openVhdlFileWithCommonHeader(const std::string &filename, const std::string &outputFilename)
opens a new template file and inserts the common header
void writeMuonSetupVhdl(std::map< std::string, std::string > &muonParameters, const std::string &particle, unsigned short int &condChip)
builds muon setup files
tuple filename
Definition: lut2db_cfg.py:20
std::string buildPhiEnergySum(const std::vector< L1GtEnergySumTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
std::map< std::string, int > conditionToIntegerMap_
stores to condition name to integer conversion table
static const std::string stringConstantQuality_
static const std::string substParamMaxNr_
std::string buildEtaMuon(const std::vector< L1GtMuonTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
void printConditionsOfCategory(const L1GtConditionCategory &category, const ConditionMap &map)
for debuggin
bool findObjectType(const L1GtObject &object, ConditionMap &map)
std::string buildPhiMuon(const std::vector< L1GtMuonTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter, bool high)
static const std::string stringConstantCharge1s_
const std::vector< ObjectParameter > * objectParameter() const
const std::map< L1GtObject, std::string > getObj2StrMap()
void buildCommonHeader(std::map< std::string, std::string > &headerParameters, const std::vector< std::string > &connectedChannels)
builds the common header for all files
tuple status
Definition: ntuplemaker.py:245
#define debug
Definition: MEtoEDMFormat.h:34
void writeAlgoSetup(std::vector< std::map< int, std::string > > &algoStrings)
builds the prealgo_and_or setup
static const std::string substParamCharge_
static const std::string stringConstantConstantNr_
bool processAlgorithmMap(std::vector< std::map< int, std::string > > &algoStrings)
bool removeEmptyLines()
deletes all empty lines in a template file
std::map< L1GtObject, std::string > objType2Str_
converts L1GtObject to string
static const std::string vhdlTemplateCondChip_
bool buildDefValuesBuffer(L1GtVhdlTemplateFile &buffer, const std::map< L1GtConditionType, std::string > &typeList, const std::vector< std::string > &defValuesList, const L1GtObject &object)
tuple size
Write out results.
bool open(const std::string &fileName, bool internal=false)
opens a template file. If the header information shall be parsed intern has to be set to true ...
bool debugMode_
class will produce some additional debugging output if set
static const std::string stringConstantCharge2s_
std::vector< std::string > getSubstitutionParametersFromTemplate()
returns a vector with all substitution parameters that are found in the template file ...
list at
Definition: asciidump.py:428
static const std::string substParamEsumsDefVals_
const std::map< L1GtObject, std::string > getCalo2IntMap()