CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

SiPixelFakeGainESSource Class Reference

#include <CalibTracker/SiPixelESProducer/src/SiPixelFakeGainESSource.cc>

Inheritance diagram for SiPixelFakeGainESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

virtual std::auto_ptr
< SiPixelGainCalibration
produce (const SiPixelGainCalibrationRcd &)
 SiPixelFakeGainESSource (const edm::ParameterSet &)
 ~SiPixelFakeGainESSource ()

Protected Member Functions

virtual void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)

Private Attributes

edm::FileInPath fp_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 37 of file SiPixelFakeGainESSource.h.


Constructor & Destructor Documentation

SiPixelFakeGainESSource::SiPixelFakeGainESSource ( const edm::ParameterSet conf_)

Definition at line 30 of file SiPixelFakeGainESSource.cc.

References edm::ESProducer::setWhatProduced().

                                                                             :
  fp_(conf_.getParameter<edm::FileInPath>("file"))
{
 edm::LogInfo("SiPixelFakeGainESSource::SiPixelFakeGainESSource");
  //the following line is needed to tell the framework what
  // data is being produced
  setWhatProduced(this);
  findingRecord<SiPixelGainCalibrationRcd>();
}
SiPixelFakeGainESSource::~SiPixelFakeGainESSource ( )

Definition at line 40 of file SiPixelFakeGainESSource.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

std::auto_ptr< SiPixelGainCalibration > SiPixelFakeGainESSource::produce ( const SiPixelGainCalibrationRcd ) [virtual]

Definition at line 48 of file SiPixelFakeGainESSource.cc.

References fp_, edm::FileInPath::fullPath(), i, j, getGTfromDQMFile::obj, and matplotRender::reader.

{

   using namespace edm::es;
   unsigned int nmodules = 0;
   uint32_t nchannels = 0;
   SiPixelGainCalibration * obj = new SiPixelGainCalibration(25.,30., 2.,3.);
   SiPixelDetInfoFileReader reader(fp_.fullPath());
   const std::vector<uint32_t> DetIds = reader.getAllDetIds();

   // Loop over detectors
   for(std::vector<uint32_t>::const_iterator detit=DetIds.begin(); detit!=DetIds.end(); detit++) {
     nmodules++;
     std::vector<char> theSiPixelGainCalibration;
     const std::pair<int, int> & detUnitDimensions = reader.getDetUnitDimensions(*detit);

     // Loop over columns and rows
     for(int i=0; i<detUnitDimensions.first; i++) {
       for(int j=0; j<detUnitDimensions.second; j++) {
         nchannels++;
         float gain =  2.8;
         float ped  = 28.2;      
         obj->setData(ped, gain , theSiPixelGainCalibration);    
       }
     }

     //std::cout << "detid " << (*detit) << std::endl;

     SiPixelGainCalibration::Range range(theSiPixelGainCalibration.begin(),theSiPixelGainCalibration.end());
     if( !obj->put(*detit,range,detUnitDimensions.first) )
       edm::LogError("SiPixelFakeGainESSource")<<"[SiPixelFakeGainESSource::produce] detid already exists"<<std::endl;
   }

   //std::cout << "Modules = " << nmodules << " Channels " << nchannels << std::endl;
   

   // 
   return std::auto_ptr<SiPixelGainCalibration>(obj);


}
void SiPixelFakeGainESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
) [protected, virtual]

Member Data Documentation

Definition at line 56 of file SiPixelFakeGainESSource.h.

Referenced by produce().