CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

popcon::EcalLaser_weekly_Linearization Class Reference

#include <EcalLaser_weekly_Linearization.h>

Inheritance diagram for popcon::EcalLaser_weekly_Linearization:
popcon::PopConSourceHandler< EcalTPGLinearizationConst >

List of all members.

Public Member Functions

 EcalLaser_weekly_Linearization (edm::ParameterSet const &)
void getNewObjects ()
std::string id () const
 ~EcalLaser_weekly_Linearization ()

Private Types

enum  { kEBChannels = 61200, kEEChannels = 14648, kGains = 3 }

Private Attributes

std::string m_name

Detailed Description

Definition at line 49 of file EcalLaser_weekly_Linearization.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kEBChannels 
kEEChannels 
kGains 

Definition at line 60 of file EcalLaser_weekly_Linearization.h.

{ kEBChannels = 61200, kEEChannels = 14648, kGains = 3};

Constructor & Destructor Documentation

popcon::EcalLaser_weekly_Linearization::~EcalLaser_weekly_Linearization ( )

Definition at line 18 of file EcalLaser_weekly_Linearization.cc.

                                                                      {
  // do nothing
}
popcon::EcalLaser_weekly_Linearization::EcalLaser_weekly_Linearization ( edm::ParameterSet const &  ps)

Definition at line 13 of file EcalLaser_weekly_Linearization.cc.

References gather_cfg::cout.

  : m_name(ps.getUntrackedParameter<std::string>("name","EcalLaser_weekly_Handler")) {
  std::cout << "EcalLaser Source handler constructor\n" << std::endl;
}

Member Function Documentation

void popcon::EcalLaser_weekly_Linearization::getNewObjects ( ) [virtual]

Implements popcon::PopConSourceHandler< EcalTPGLinearizationConst >.

Definition at line 22 of file EcalLaser_weekly_Linearization.cc.

References gather_cfg::cout, alignmentValidation::fname, i, EcalCondObjectContainer< T >::insert(), geometryCSVtoXML::line, VarParsing::mult, edm::shift, AlCaHLTBitMon_QueryRunRegistry::string, and create_public_lumi_plots::week.

                                                         {
  //  int file[1] = {190708};

  int iIov = 0;  

  std::cout << "------- Ecal -> getNewObjects\n";
  
  
  unsigned long long max_since= 1;
  Ref payload= lastPayload();
  
  // here popcon tells us which is the last since of the last object in the offline DB
  max_since=tagInfo().lastInterval.first;
  Tm max_since_tm(max_since);

  //  const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = 
  //    payload->getLaserMap(); 
  //  std::cout << "payload->getLaserMap():  OK " << std::endl;
  //  std::cout << "Its size is " << laserRatiosMap.size() << std::endl;
  //  const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = 
  //    payload->getTimeMap();
  //  std::cout << "payload->getTimeMap():  OK " << std::endl;
  //  std::cout << "Last Object in Offline DB has SINCE = "  << max_since
  //        << " -> " << max_since_tm.cmsNanoSeconds() 
  //        << " (" << max_since_tm << ")"
  //        << " and  SIZE = " << tagInfo().size
  //        << std::endl;

  for(int week = 0; week < 1; week++) {
    EcalTPGLinearizationConst *linC = new EcalTPGLinearizationConst;
    int fileIOV;
    std::cout << " which input IOV do you want " << std::endl;
    std::cin >> fileIOV; 
    std::ifstream fWeek;
    std::ostringstream oss;
    oss << fileIOV;
    std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
    /*
    oss << file[week];
    //    std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv5_trans_" + oss.str() + "_";
    std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_";
    oss.str("");
    //   if(week == 32) oss << 200000;
    //   else oss << file[week + 1] - 1;
    oss << 200000;
    fname += oss.str() + ".txt";
    */
    fWeek.open(fname.c_str());
    if(!fWeek.is_open()) {
      std::cout << "ERROR : can't open file '" << fname << std::endl;
      break;
    }
    std::cout << " file " << fname << " opened" << std::endl;
    //    int rawId;
    //    float corrp;
    std::string line;
    for(int i = 0; i < 85; i++) getline (fWeek, line);
    char cryst[10];
    uint32_t  ped[kGains], mult[kGains], shift[kGains];
    uint32_t id;
    for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
      getline (fWeek, line);
      //     std::cout << " line " << line << std::endl;
      //      fWeek >> cryst >> id;
      sscanf(line.c_str(), "%s %u", cryst, &id);
      //      std::cout << cryst << " id " << id << std::endl; 
      // EBDetId ebId = DetId(id);
      for (int gain = 0; gain < kGains; gain++) {
        //      fWeek >> std::hex >> ped[gain] >> mult[gain] >> shift[gain];
        getline (fWeek, line);
        //      std::cout << " line g " << line << std::endl;
        sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
        //      std::cout << " gain " << gain << " ped " << ped[gain] << " mult " << mult[gain] << " shift " << shift[gain]<< std::endl;
      }
      EcalTPGLinearizationConst::Item item;
      item.mult_x1   = mult[2];
      item.mult_x6   = mult[1];
      item.mult_x12  = mult[0];
      item.shift_x1  = shift[2];
      item.shift_x6  = shift[1];
      item.shift_x12 = shift[0];
          
      linC->insert(std::make_pair(id, item));
      //      corr.p1=corr.p2=corr.p3 = corrp;
      //      corrSet->setValue((int)ebId, corr );
      //      cryst ="";
    }   // end loop over EB channels
    getline (fWeek, line);  // cmment before EE crystals
    std::cout << " comment line " << line << std::endl;
    for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
      getline (fWeek, line);
      //      std::cout << " line " << line << std::endl;
      sscanf(line.c_str(), "%s %u", cryst, &id);
      //      std::cout << cryst << " id " << id << std::endl; 
      // EEDetId eeId = DetId(id);
      for (int gain =0; gain < kGains; gain++) {
        getline (fWeek, line);
        //      std::cout << " line g " << line << std::endl;
        sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
        //      std::cout << " gain " << gain << " ped " << ped[gain] << " mult " << mult[gain] << " shift " << shift[gain]<< std::endl;

      }      //      corr.p1=corr.p2=corr.p3 = corrp;
      //      corrSet->setValue((int)eeId, corr );
      EcalTPGLinearizationConst::Item item;
      item.mult_x1   = mult[2];
      item.mult_x6   = mult[1];
      item.mult_x12  = mult[0];
      item.shift_x1  = shift[2];
      item.shift_x6  = shift[1];
      item.shift_x12 = shift[0];
          
      linC->insert(std::make_pair(id, item));
    }   // end loop over EE channels
    fWeek.close();
    // special tag for Stephanie
    //    m_to_transfer.push_back(std::make_pair((EcalTPGLinearizationConst*)linC, file[week]));
    m_to_transfer.push_back(std::make_pair((EcalTPGLinearizationConst*)linC, fileIOV));
    // end special
    iIov++;
  }   // end loop over week
  std::cout << "Ecal -> end of getNewObjects -----------\n";    
}
std::string popcon::EcalLaser_weekly_Linearization::id ( void  ) const [inline, virtual]

Implements popcon::PopConSourceHandler< EcalTPGLinearizationConst >.

Definition at line 57 of file EcalLaser_weekly_Linearization.h.

References m_name.

{ return m_name;}

Member Data Documentation

Definition at line 62 of file EcalLaser_weekly_Linearization.h.

Referenced by id().