CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

SiPixelFakeGainForHLTESSource Class Reference

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

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

List of all members.

Public Member Functions

virtual std::auto_ptr
< SiPixelGainCalibrationForHLT
produce (const SiPixelGainCalibrationForHLTRcd &)
 SiPixelFakeGainForHLTESSource (const edm::ParameterSet &)
 ~SiPixelFakeGainForHLTESSource ()

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 SiPixelFakeGainForHLTESSource.h.


Constructor & Destructor Documentation

SiPixelFakeGainForHLTESSource::SiPixelFakeGainForHLTESSource ( const edm::ParameterSet conf_)

Definition at line 30 of file SiPixelFakeGainForHLTESSource.cc.

References edm::ESProducer::setWhatProduced().

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

Definition at line 40 of file SiPixelFakeGainForHLTESSource.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< SiPixelGainCalibrationForHLT > SiPixelFakeGainForHLTESSource::produce ( const SiPixelGainCalibrationForHLTRcd ) [virtual]

Definition at line 48 of file SiPixelFakeGainForHLTESSource.cc.

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

{

   using namespace edm::es;
   unsigned int nmodules = 0;
   uint32_t nchannels = 0;
   SiPixelGainCalibrationForHLT * obj = new SiPixelGainCalibrationForHLT(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++) {
       float totalGain  = 0.0;
       float totalPed   = 0.0; 
       float totalEntries=0.0;
       for(int j=0; j<detUnitDimensions.second; j++) {
         nchannels++;
         totalGain      += 2.8;
         totalPed       += 28.2;
         totalEntries   ++;
         if((j+1)%80==0){
           float gain       = totalGain/totalEntries;
           float ped        = totalPed/totalEntries;
           
           obj->setData(ped,gain, theSiPixelGainCalibration);    
           totalGain=0.;
           totalPed=0.;
           totalEntries=0.;
         }
       }
     }

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

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

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

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


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

Member Data Documentation

Definition at line 56 of file SiPixelFakeGainForHLTESSource.h.

Referenced by produce().