CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

SiPixelFakeGainOfflineESSource Class Reference

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

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

List of all members.

Public Member Functions

virtual std::auto_ptr
< SiPixelGainCalibrationOffline
produce (const SiPixelGainCalibrationOfflineRcd &)
 SiPixelFakeGainOfflineESSource (const edm::ParameterSet &)
 ~SiPixelFakeGainOfflineESSource ()

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


Constructor & Destructor Documentation

SiPixelFakeGainOfflineESSource::SiPixelFakeGainOfflineESSource ( const edm::ParameterSet conf_)

Definition at line 30 of file SiPixelFakeGainOfflineESSource.cc.

References edm::ESProducer::setWhatProduced().

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

Definition at line 40 of file SiPixelFakeGainOfflineESSource.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< SiPixelGainCalibrationOffline > SiPixelFakeGainOfflineESSource::produce ( const SiPixelGainCalibrationOfflineRcd ) [virtual]

Definition at line 48 of file SiPixelFakeGainOfflineESSource.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;
   SiPixelGainCalibrationOffline * obj = new SiPixelGainCalibrationOffline(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> theSiPixelGainCalibrationOffline;
     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 totalEntries = 0.0;
       for(int j=0; j<detUnitDimensions.second; j++) {
         nchannels++;
         totalGain  += 2.8;
         float ped  = 28.2;      
         totalEntries += 1.0;
         obj->setDataPedestal(ped, theSiPixelGainCalibrationOffline);    
         if ((j + 1) % 80 == 0) //compute the gain average after each ROC
         {
            float gain = totalGain/totalEntries;
            obj->setDataGain(gain, 80, theSiPixelGainCalibrationOffline);
            totalGain    = 0;
            totalEntries = 0.0;
         }
       }
     }

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

     SiPixelGainCalibrationOffline::Range range(theSiPixelGainCalibrationOffline.begin(),theSiPixelGainCalibrationOffline.end());
     // the 80 in the line below represents the number of columns averaged over.  
     if( !obj->put(*detit,range,detUnitDimensions.first) )
       edm::LogError("SiPixelFakeGainOfflineESSource")<<"[SiPixelFakeGainOfflineESSource::produce] detid already exists"<<std::endl;
   }

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

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


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

Member Data Documentation

Definition at line 56 of file SiPixelFakeGainOfflineESSource.h.

Referenced by produce().