CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
DBlmapReader.h File Reference
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include "OnlineDB/Oracle/interface/Oracle.h"
#include "CaloOnlineTools/HcalOnlineDb/interface/HCALConfigDB.h"
#include "CalibCalorimetry/HcalTPGAlgos/interface/XMLProcessor.h"
#include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabase.hh"
#include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImplOracle.hh"
#include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImplXMLFile.hh"
#include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationItemNotFoundException.hh"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"

Go to the source code of this file.

Classes

class  DBlmapReader
 
struct  VectorLMAP
 

Functions

void printEMAProw (int channel, FILE *emap, VectorLMAP *lmap)
 
void printHBHEHF (int channel, FILE *HBEFmap, VectorLMAP *lmap)
 
void printHO (int channel, FILE *HOmap, VectorLMAP *lmap)
 
VectorLMAPSortByGeometry (VectorLMAP *lmapHBEFO)
 
VectorLMAPSortByHardware (VectorLMAP *lmapHBEFO)
 
bool SortComp (int x, int y)
 

Function Documentation

void printEMAProw ( int  channel,
FILE *  emap,
VectorLMAP lmap 
)

Definition at line 207 of file DBlmapReader.cc.

References dtNoiseDBValidation_cfg::cerr, VectorLMAP::crateC, VectorLMAP::depthC, VectorLMAP::detC, VectorLMAP::etaC, VectorLMAP::fedidC, VectorLMAP::fi_chC, VectorLMAP::fpgaC, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, VectorLMAP::htr_fiC, VectorLMAP::htrC, j, VectorLMAP::phiC, VectorLMAP::sideC, and VectorLMAP::spigoC.

Referenced by DBlmapReader::PrintEMAPfromLMAP().

207  {
208  j = lmap -> orderC[channel];
209 
210  HcalSubdetector _subdet;
211  if ( lmap->detC[j] == "HB" ) _subdet = HcalBarrel;
212  else if ( lmap->detC[j] == "HE" ) _subdet = HcalEndcap;
213  else if ( lmap->detC[j] == "HO" ) _subdet = HcalOuter;
214  else if ( lmap->detC[j] == "HF" ) _subdet = HcalForward;
215  else{
216  _subdet = HcalBarrel;
217  std::cerr<<"Bad Subdet"<<std::endl;
218  }
219  HcalDetId _hcaldetid( _subdet, (lmap->sideC[j])*(lmap->etaC[j]), lmap->phiC[j], lmap->depthC[j] );
220  int hcalID = _hcaldetid . rawId();
221 
222  char tb = lmap->fpgaC[j][0];
223  fprintf(emap,"%10d %3d %3d %2c %4d %5d",hcalID, lmap->crateC[j], lmap->htrC[j], tb, (lmap->fedidC[j] - 700), lmap->spigoC[j]);
224  fprintf(emap,"%5d %8d %8s %5d %4d %6d\n", lmap->htr_fiC[j], lmap->fi_chC[j], lmap->detC[j].c_str(), (lmap->etaC[j]*lmap->sideC[j]), lmap->phiC[j], lmap->depthC[j]);
225 
226  return;
227 }
std::vector< int > spigoC
Definition: DBlmapReader.h:50
std::vector< int > etaC
Definition: DBlmapReader.h:26
std::vector< int > fedidC
Definition: DBlmapReader.h:62
std::vector< int > crateC
Definition: DBlmapReader.h:44
std::vector< int > htr_fiC
Definition: DBlmapReader.h:48
HcalSubdetector
Definition: HcalAssistant.h:31
int j
Definition: DBlmapReader.cc:9
std::vector< int > sideC
Definition: DBlmapReader.h:25
std::vector< int > depthC
Definition: DBlmapReader.h:30
std::vector< std::string > fpgaC
Definition: DBlmapReader.h:47
std::vector< int > phiC
Definition: DBlmapReader.h:27
std::vector< int > htrC
Definition: DBlmapReader.h:45
std::vector< std::string > detC
Definition: DBlmapReader.h:31
std::vector< int > fi_chC
Definition: DBlmapReader.h:42
void printHBHEHF ( int  channel,
FILE *  HBEFmap,
VectorLMAP lmap 
)

Definition at line 160 of file DBlmapReader.cc.

References VectorLMAP::adcC, VectorLMAP::crateC, VectorLMAP::dcc_slC, VectorLMAP::dccC, VectorLMAP::detC, VectorLMAP::dphiC, VectorLMAP::etaC, VectorLMAP::fedidC, VectorLMAP::fi_chC, VectorLMAP::fpgaC, VectorLMAP::htr_fiC, VectorLMAP::htrC, j, VectorLMAP::phiC, VectorLMAP::pixelC, VectorLMAP::qieC, VectorLMAP::rbxC, VectorLMAP::rctcarC, VectorLMAP::rctconC, VectorLMAP::rctcraC, VectorLMAP::rctnamC, VectorLMAP::rm_fiC, VectorLMAP::rmC, VectorLMAP::sideC, VectorLMAP::slbC, VectorLMAP::slbin2C, VectorLMAP::slbinC, VectorLMAP::slnamC, VectorLMAP::spigoC, and VectorLMAP::wedgeC.

Referenced by DBlmapReader::PrintLMAP().

160  {
161 
162  if (channel % 21 == 0){
163  fprintf(HBEFmap,"# side eta phi dphi depth det rbx wedge rm pixel qie adc");
164  fprintf(HBEFmap," rm_fi fi_ch crate htr fpga htr_fi dcc_sl spigo dcc slb slbin slbin2");
165  fprintf(HBEFmap," slnam rctcra rctcar rctcon rctnam fedid\n");
166  }
167 
168  j = lmap -> orderC[channel];
169 
170  fprintf(HBEFmap,"%6d %6d %6d %6d %6d ", lmap->sideC[j], lmap->etaC[j], lmap->phiC[j], lmap->dphiC[j], lmap -> depthC[j]);
171  fprintf(HBEFmap,"%6s %7s %6d %6d %6d", lmap->detC[j].c_str(), lmap->rbxC[j].c_str(), lmap->wedgeC[j], lmap->rmC[j], lmap->pixelC[j]);
172  fprintf(HBEFmap,"%6d %6d %6d %6d %6d ", lmap->qieC[j], lmap->adcC[j], lmap->rm_fiC[j], lmap->fi_chC[j], lmap->crateC[j]);
173  fprintf(HBEFmap,"%6d %6s%8d %7d ", lmap->htrC[j], lmap->fpgaC[j].c_str(), lmap->htr_fiC[j], lmap->dcc_slC[j]);
174  fprintf(HBEFmap,"%6d %6d %6d %6s", lmap->spigoC[j], lmap->dccC[j], lmap->slbC[j], lmap->slbinC[j].c_str());
175  fprintf(HBEFmap,"%8s %15s %6d %6d ", lmap->slbin2C[j].c_str(), lmap->slnamC[j].c_str(), lmap->rctcraC[j], lmap->rctcarC[j]);
176  fprintf(HBEFmap,"%6d %20s %6d\n", lmap->rctconC[j], lmap->rctnamC[j].c_str(), lmap->fedidC[j]);
177 }
std::vector< int > spigoC
Definition: DBlmapReader.h:50
std::vector< int > etaC
Definition: DBlmapReader.h:26
std::vector< int > wedgeC
Definition: DBlmapReader.h:33
std::vector< int > slbC
Definition: DBlmapReader.h:53
std::vector< int > fedidC
Definition: DBlmapReader.h:62
std::vector< int > crateC
Definition: DBlmapReader.h:44
std::vector< int > pixelC
Definition: DBlmapReader.h:37
std::vector< int > rmC
Definition: DBlmapReader.h:36
std::vector< int > htr_fiC
Definition: DBlmapReader.h:48
std::vector< std::string > rctnamC
Definition: DBlmapReader.h:61
std::vector< std::string > slbinC
Definition: DBlmapReader.h:54
int j
Definition: DBlmapReader.cc:9
std::vector< int > sideC
Definition: DBlmapReader.h:25
std::vector< std::string > rbxC
Definition: DBlmapReader.h:32
std::vector< int > qieC
Definition: DBlmapReader.h:38
std::vector< int > rm_fiC
Definition: DBlmapReader.h:41
std::vector< std::string > fpgaC
Definition: DBlmapReader.h:47
std::vector< int > dccC
Definition: DBlmapReader.h:51
std::vector< int > rctcraC
Definition: DBlmapReader.h:57
std::vector< int > rctcarC
Definition: DBlmapReader.h:59
std::vector< int > dphiC
Definition: DBlmapReader.h:29
std::vector< int > phiC
Definition: DBlmapReader.h:27
std::vector< int > htrC
Definition: DBlmapReader.h:45
std::vector< int > rctconC
Definition: DBlmapReader.h:60
std::vector< std::string > detC
Definition: DBlmapReader.h:31
std::vector< int > dcc_slC
Definition: DBlmapReader.h:49
std::vector< std::string > slnamC
Definition: DBlmapReader.h:56
std::vector< std::string > slbin2C
Definition: DBlmapReader.h:55
std::vector< int > adcC
Definition: DBlmapReader.h:39
std::vector< int > fi_chC
Definition: DBlmapReader.h:42
void printHO ( int  channel,
FILE *  HOmap,
VectorLMAP lmap 
)

Definition at line 179 of file DBlmapReader.cc.

References VectorLMAP::adcC, VectorLMAP::crateC, VectorLMAP::dcc_slC, VectorLMAP::dccC, VectorLMAP::detC, VectorLMAP::dphiC, VectorLMAP::etaC, VectorLMAP::fedidC, VectorLMAP::fi_chC, VectorLMAP::fpgaC, VectorLMAP::htr_fiC, VectorLMAP::htrC, j, VectorLMAP::let_codeC, VectorLMAP::phiC, VectorLMAP::pixelC, VectorLMAP::qieC, VectorLMAP::rbxC, VectorLMAP::rm_fiC, VectorLMAP::rmC, VectorLMAP::sectorC, VectorLMAP::sideC, and VectorLMAP::spigoC.

Referenced by DBlmapReader::PrintLMAP().

179  {
180  //HO goes last, after 6912 entries; 6912 % 21 = 3
181  if (channel % 21 == 3){
182  fprintf(HOmap,"# side eta phi dphi depth det rbx sector rm pixel qie adc");
183  fprintf(HOmap," rm_fi fi_ch let_code crate htr fpga htr_fi dcc_sl spigo dcc slb slbin slbin2");
184  fprintf(HOmap," slnam rctcra rctcar rctcon rctnam fedid\n");
185  }
186 
187  j = lmap -> orderC[channel];
188 
189  fprintf(HOmap,"%6d %6d %6d %6d %6d ", lmap->sideC[j], lmap->etaC[j], lmap->phiC[j], lmap->dphiC[j], lmap -> depthC[j]);
190  fprintf(HOmap,"%6s %7s %6d %6d %6d", lmap->detC[j].c_str(), lmap->rbxC[j].c_str(), lmap->sectorC[j], lmap->rmC[j], lmap->pixelC[j]);
191  fprintf(HOmap,"%6d %6d %6d ", lmap->qieC[j], lmap->adcC[j], lmap->rm_fiC[j]);
192  fprintf(HOmap,"%6d %8s %6d ", lmap->fi_chC[j], lmap->let_codeC[j].c_str(), lmap->crateC[j]);
193  fprintf(HOmap,"%6d %6s%8d %7d ", lmap->htrC[j], lmap->fpgaC[j].c_str(), lmap->htr_fiC[j], lmap->dcc_slC[j]);
194  fprintf(HOmap,"%6d %6d %6d\n", lmap->spigoC[j], lmap->dccC[j], lmap->fedidC[j]);
195 
196 
197  // New Format (will update as soon as database update is complete
198 
199 // fprintf(HOmap,"# side eta phi dphi depth det rbx sector rm pixel qie adc");
200 // fprintf(HOmap," rm_fi fi_ch let_code crate htr fpga htr_fi dcc_sl spigo dcc fedid geo block lc\n");
201 // fprintf(HOmap,"%6d %6d %6d %6d %6d %6s %7s %6d %6d %6d",iside,ieta,iphi,idphi,idepth,det.c_str(),rbx.c_str(),isector,irm,ipixel);
202 // fprintf(HOmap,"%6d %6d %6d %6d %8s %6d %6d %6s",iqie,iadc,irm_fi,ifi_ch,letter.c_str(),icrate,ihtr,fpga.c_str());
203 // fprintf(HOmap,"%8d %7d %6d %6d %6d %6d %6d %6d\n",ihtr_fi,idcc_sl,ispigot,idcc,ifed,geo,block,lc);
204 
205 }
std::vector< int > sectorC
Definition: DBlmapReader.h:35
std::vector< int > spigoC
Definition: DBlmapReader.h:50
std::vector< int > etaC
Definition: DBlmapReader.h:26
std::vector< int > fedidC
Definition: DBlmapReader.h:62
std::vector< int > crateC
Definition: DBlmapReader.h:44
std::vector< int > pixelC
Definition: DBlmapReader.h:37
std::vector< int > rmC
Definition: DBlmapReader.h:36
std::vector< int > htr_fiC
Definition: DBlmapReader.h:48
int j
Definition: DBlmapReader.cc:9
std::vector< int > sideC
Definition: DBlmapReader.h:25
std::vector< std::string > let_codeC
Definition: DBlmapReader.h:43
std::vector< std::string > rbxC
Definition: DBlmapReader.h:32
std::vector< int > qieC
Definition: DBlmapReader.h:38
std::vector< int > rm_fiC
Definition: DBlmapReader.h:41
std::vector< std::string > fpgaC
Definition: DBlmapReader.h:47
std::vector< int > dccC
Definition: DBlmapReader.h:51
std::vector< int > dphiC
Definition: DBlmapReader.h:29
std::vector< int > phiC
Definition: DBlmapReader.h:27
std::vector< int > htrC
Definition: DBlmapReader.h:45
std::vector< std::string > detC
Definition: DBlmapReader.h:31
std::vector< int > dcc_slC
Definition: DBlmapReader.h:49
std::vector< int > adcC
Definition: DBlmapReader.h:39
std::vector< int > fi_chC
Definition: DBlmapReader.h:42
VectorLMAP* SortByGeometry ( VectorLMAP lmapHBEFO)

Definition at line 286 of file DBlmapReader.cc.

References i, VectorLMAP::orderC, SortComp(), and tempVector.

Referenced by DBlmapReader::PrintEMAPfromLMAP(), and DBlmapReader::PrintLMAP().

286  {
287 
288  int CHAcount = lmapHBEFO->orderC.size();
289  tempVector.clear();
290 
291  //Sort by eta
292  for (i = 0; i < CHAcount; i++){
293  tempVector.push_back (lmapHBEFO -> etaC[i]);
294  }
295  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
296  tempVector.clear();
297 
298  //Sort by phi
299  for (i = 0; i < CHAcount; i++){
300  tempVector.push_back (lmapHBEFO -> phiC[i]);
301  }
302  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
303  tempVector.clear();
304 
305  //Sort by side
306  for (i = 0; i < CHAcount; i++){
307  tempVector.push_back (lmapHBEFO -> sideC[i]);
308  }
309  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
310  tempVector.clear();
311 
312  //Sort by subdetector
313  for (i = 0; i < CHAcount; i++){
314  if (lmapHBEFO -> detC[i] == "HB" || lmapHBEFO -> detC[i] == "HE") tempVector.push_back (0);
315  else if (lmapHBEFO -> detC[i] == "HF") tempVector.push_back (1);
316  else tempVector.push_back (2);
317  }
318  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
319  tempVector.clear();
320 
321  return lmapHBEFO;
322 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > orderC
Definition: DBlmapReader.h:68
bool SortComp(int x, int y)
vector< int > tempVector
Definition: DBlmapReader.cc:10
VectorLMAP* SortByHardware ( VectorLMAP lmapHBEFO)

Definition at line 233 of file DBlmapReader.cc.

References i, VectorLMAP::orderC, SortComp(), and tempVector.

Referenced by DBlmapReader::PrintEMAPfromLMAP(), and DBlmapReader::PrintLMAP().

233  {
234 
235  int CHAcount = lmapHBEFO->orderC.size();
236  tempVector.clear();
237 
238  //Sort by fiber channel
239  for (i = 0; i < CHAcount; i++){
240  tempVector.push_back (lmapHBEFO -> fi_chC[i]);
241  }
242  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
243  tempVector.clear();
244 
245  //Sort by HTR fiber
246  for (i = 0; i < CHAcount; i++){
247  tempVector.push_back (lmapHBEFO -> htr_fiC[i]);
248  }
249  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
250  tempVector.clear();
251 
252  //Sort by FPGA
253  for (i = 0; i < CHAcount; i++){
254  if (lmapHBEFO -> fpgaC[i] == "top") tempVector.push_back (0);
255  else tempVector.push_back (1);
256  }
257  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
258  tempVector.clear();
259 
260  //Sort by HTR
261  for (i = 0; i < CHAcount; i++){
262  tempVector.push_back (lmapHBEFO -> htrC[i]);
263  }
264  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
265  tempVector.clear();
266 
267  //Sort by crate
268  for (i = 0; i < CHAcount; i++){
269  tempVector.push_back (lmapHBEFO -> crateC[i]);
270  }
271  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
272  tempVector.clear();
273 
274  //Sort by subdetector
275  for (i = 0; i < CHAcount; i++){
276  if (lmapHBEFO -> detC[i] == "HB" || lmapHBEFO -> detC[i] == "HE") tempVector.push_back (0);
277  else if (lmapHBEFO -> detC[i] == "HF") tempVector.push_back (1);
278  else tempVector.push_back (2);
279  }
280  stable_sort(lmapHBEFO -> orderC.begin( ), lmapHBEFO -> orderC.end( ), SortComp);
281  tempVector.clear();
282 
283  return lmapHBEFO;
284 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > orderC
Definition: DBlmapReader.h:68
bool SortComp(int x, int y)
vector< int > tempVector
Definition: DBlmapReader.cc:10
bool SortComp ( int  x,
int  y 
)

Definition at line 229 of file DBlmapReader.cc.

References tempVector, x, and detailsBasic3DVector::y.

Referenced by SortByGeometry(), and SortByHardware().

229  {
230  return tempVector[x] < tempVector[y];
231 }
Definition: DDAxes.h:10
vector< int > tempVector
Definition: DBlmapReader.cc:10