CMS 3D CMS Logo

Public Member Functions

DBlmapReader Class Reference

#include <DBlmapReader.h>

List of all members.

Public Member Functions

 DBlmapReader ()
VectorLMAPGetLMAP (int version)
void lrTestFunction (void)
void PrintEMAPfromLMAP (FILE *emap, VectorLMAP *lmapHBEFO)
void PrintLMAP (FILE *HBEFmap, FILE *HOmap, VectorLMAP *lmapHBEFO)

Detailed Description

Definition at line 80 of file DBlmapReader.h.


Constructor & Destructor Documentation

DBlmapReader::DBlmapReader ( ) [inline]

Definition at line 82 of file DBlmapReader.h.

{ };

Member Function Documentation

VectorLMAP * DBlmapReader::GetLMAP ( int  version = 30)

Definition at line 19 of file DBlmapReader.cc.

References convertSQLitetoXML_cfg::connect, gather_cfg::cout, EcalCondDB::db, alignCSCRings::e, getInt(), o2o::query, sstemp, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                   {
  HCALConfigDB * db = new HCALConfigDB();
  const std::string _accessor = "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22";
  db -> connect( _accessor );
  
  oracle::occi::Connection * myConn = db -> getConnection();

  int CHAcount = 0; 
  VectorLMAP* lmapHBEFO = new VectorLMAP();
  
  sstemp.str("");
  sstemp<<"'"<<LMversion<<"'";
  std::string verstring = sstemp.str();
  sstemp.str("");

  try {
    Statement* stmt = myConn -> createStatement();

    std::string query = (" SELECT C.VERSION, ");
    query += " H.SIDE, H.ETA, H.PHI, ";
    query += " H.DELTA_PHI, H.DEPTH, H.SUBDETECTOR, H.RBX, H.WEDGE, ";
    query += " H.SECTOR, H.RM_SLOT, H.HPD_PIXEL, H.QIE_SLOT, H.ADC, ";
    query += " H.RM_FIBER, H.FIBER_CHANNEL, H.LETTER_CODE, H.CRATE, H.HTR_SLOT, ";
    query += " H.HTR_FPGA, H.HTR_FIBER, H.DCC_SL, H.SPIGOT, H.DCC_SLOT, ";
    query += " H.SLB_SITE, H.SLB_CHANNEL, H.SLB_CHANNEL2, H.SLB_CABLE, H.RCT_CRATE, ";
    query += " H.RCT_CARD, H.RCT_CONNECTOR, H.RCT_NAME, H.FED_ID ";
    query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.HCAL_HARDWARE_LOGICAL_MAPS_V3 H inner join ";
    query += " CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS C ";
    query += " on C.CONDITION_DATA_SET_ID=H.CONDITION_DATA_SET_ID ";
    query += " inner join CMS_HCL_CORE_CONDITION_OWNER.KINDS_OF_CONDITIONS K ";
    query += " on K.KIND_OF_CONDITION_ID=C.KIND_OF_CONDITION_ID ";
    query += " where C.IS_RECORD_DELETED='F' and K.IS_RECORD_DELETED='F' ";
    query += " and K.NAME='HCAL hardware logical channel maps v3' ";
    query += " and C.VERSION=";
    query += verstring;
    
    //SELECT
    ResultSet *rs = stmt->executeQuery(query.c_str());

    while (rs->next() && CHAcount < 10000) {

      lmapHBEFO -> versionC . push_back( rs -> getInt(1) );
      lmapHBEFO -> sideC    . push_back( rs -> getInt(2) );
      lmapHBEFO -> etaC     . push_back( rs -> getInt(3) );
      lmapHBEFO -> phiC     . push_back( rs -> getInt(4) );
      lmapHBEFO -> dphiC    . push_back( rs -> getInt(5) );
      
      lmapHBEFO -> depthC  . push_back( rs -> getInt(6) );
      lmapHBEFO -> detC    . push_back( rs -> getString(7) );
      lmapHBEFO -> rbxC    . push_back( rs -> getString(8) );
      lmapHBEFO -> wedgeC  . push_back( rs -> getInt(9) );
      lmapHBEFO -> sectorC . push_back( rs -> getInt(10) );

      lmapHBEFO -> rmC    . push_back( rs -> getInt(11) );
      lmapHBEFO -> pixelC . push_back( rs -> getInt(12) );
      lmapHBEFO -> qieC   . push_back( rs -> getInt(13) );
      lmapHBEFO -> adcC   . push_back( rs -> getInt(14) );
      lmapHBEFO -> rm_fiC . push_back( rs -> getInt(15) );

      lmapHBEFO -> fi_chC    . push_back( rs -> getInt(16) );
      lmapHBEFO -> let_codeC . push_back( rs -> getString(17) );
      lmapHBEFO -> crateC    . push_back( rs -> getInt(18) );
      lmapHBEFO -> htrC      . push_back( rs -> getInt(19) );
      lmapHBEFO -> fpgaC     . push_back( rs -> getString(20) );

      lmapHBEFO -> htr_fiC . push_back( rs -> getInt(21) );
      lmapHBEFO -> dcc_slC . push_back( rs -> getInt(22) );
      lmapHBEFO -> spigoC  . push_back( rs -> getInt(23) );
      lmapHBEFO -> dccC    . push_back( rs -> getInt(24) );
      lmapHBEFO -> slbC    . push_back( rs -> getInt(25) );

      lmapHBEFO -> slbinC  . push_back( rs -> getString(26) );
      lmapHBEFO -> slbin2C . push_back( rs -> getString(27) );
      lmapHBEFO -> slnamC  . push_back( rs -> getString(28) );
      lmapHBEFO -> rctcraC . push_back( rs -> getInt(29) );
      lmapHBEFO -> rctcarC . push_back( rs -> getInt(30) );
    
      lmapHBEFO -> rctconC . push_back( rs -> getInt(31) );
      lmapHBEFO -> rctnamC . push_back( rs -> getString(32) );
      lmapHBEFO -> fedidC  . push_back( rs -> getInt(33) );

      lmapHBEFO -> orderC . push_back( CHAcount );
      
      CHAcount++;
    }
    //Always terminate statement
    myConn -> terminateStatement(stmt);
  }
  catch (SQLException& e) {
    std::cout<<"Couldn't get statement"<<std::endl;
  }
  db -> disconnect();
  
  return lmapHBEFO;
}
void DBlmapReader::lrTestFunction ( void  )

Definition at line 13 of file DBlmapReader.cc.

References gather_cfg::cout.

                                     {
  
  std::cout<<"Hello"<<std::endl;
  return;
}
void DBlmapReader::PrintEMAPfromLMAP ( FILE *  emap,
VectorLMAP lmapHBEFO 
)

Definition at line 142 of file DBlmapReader.cc.

References i, VectorLMAP::orderC, printEMAProw(), SortByGeometry(), and SortByHardware().

                                                                     {

  int CHAcount = lmapHBEFO->orderC.size();

  lmapHBEFO = SortByHardware(lmapHBEFO);
  for (i = 0; i < CHAcount; i++){
     if (lmapHBEFO ->detC[lmapHBEFO -> orderC[i]] != "HO") printEMAProw(i, emap, lmapHBEFO);
  }

  lmapHBEFO = SortByGeometry(lmapHBEFO);
  for (i = 0; i < CHAcount; i++){
     if (lmapHBEFO -> detC[lmapHBEFO -> orderC[i]] == "HO") printEMAProw(i, emap, lmapHBEFO);
  }
  
  return;
}
void DBlmapReader::PrintLMAP ( FILE *  HBEFmap,
FILE *  HOmap,
VectorLMAP lmapHBEFO 
)

Definition at line 115 of file DBlmapReader.cc.

References gather_cfg::cout, i, VectorLMAP::orderC, printHBHEHF(), printHO(), SortByGeometry(), and SortByHardware().

                                                                             {

  int CHAcount = lmapHBEFO->orderC.size();

  lmapHBEFO = SortByHardware(lmapHBEFO);
  for (i = 0; i < CHAcount; i++){
    if (lmapHBEFO -> orderC[i] >= CHAcount){
      std::cout<<"Bad order vector";
      break;
    }
    
    if (lmapHBEFO -> detC[lmapHBEFO -> orderC[i]] != "HO") printHBHEHF(i, HBEFmap, lmapHBEFO);
  }
  
  lmapHBEFO = SortByGeometry(lmapHBEFO);
  for (i = 0; i < CHAcount; i++){
    if (lmapHBEFO -> orderC[i] >= CHAcount){
      std::cout<<"Bad order vector";
      break;
    }
    if (lmapHBEFO -> detC[lmapHBEFO -> orderC[i]] == "HO") printHO(i, HOmap, lmapHBEFO);
  }  
  
  std::cout<<CHAcount<<std::endl;
  return;
}