CMS 3D CMS Logo

SiPixelFakeGainOfflineESSource Class Reference

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

#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().

00030                                                                                            :
00031   fp_(conf_.getParameter<edm::FileInPath>("file"))
00032 {
00033  edm::LogInfo("SiPixelFakeGainOfflineESSource::SiPixelFakeGainOfflineESSource");
00034   //the following line is needed to tell the framework what
00035   // data is being produced
00036   setWhatProduced(this);
00037   findingRecord<SiPixelGainCalibrationOfflineRcd>();
00038 }

SiPixelFakeGainOfflineESSource::~SiPixelFakeGainOfflineESSource (  ) 

Definition at line 40 of file SiPixelFakeGainOfflineESSource.cc.

00041 {
00042  
00043    // do anything here that needs to be done at desctruction time
00044    // (e.g. close files, deallocate resources etc.)
00045 
00046 }


Member Function Documentation

std::auto_ptr< SiPixelGainCalibrationOffline > SiPixelFakeGainOfflineESSource::produce ( const SiPixelGainCalibrationOfflineRcd  )  [virtual]

Definition at line 48 of file SiPixelFakeGainOfflineESSource.cc.

References lat::endl(), fp_, edm::FileInPath::fullPath(), i, j, VarParsing::obj, SiPixelGainCalibrationOffline::put(), range, SiPixelGainCalibrationOffline::setDataGain(), and SiPixelGainCalibrationOffline::setDataPedestal().

00049 {
00050 
00051    using namespace edm::es;
00052    unsigned int nmodules = 0;
00053    uint32_t nchannels = 0;
00054    SiPixelGainCalibrationOffline * obj = new SiPixelGainCalibrationOffline(25.,30., 2.,3.);
00055    SiPixelDetInfoFileReader reader(fp_.fullPath());
00056    const std::vector<uint32_t> DetIds = reader.getAllDetIds();
00057 
00058    // Loop over detectors
00059    for(std::vector<uint32_t>::const_iterator detit=DetIds.begin(); detit!=DetIds.end(); detit++) {
00060      nmodules++;
00061      std::vector<char> theSiPixelGainCalibrationOffline;
00062      const std::pair<int, int> & detUnitDimensions = reader.getDetUnitDimensions(*detit);
00063 
00064      // Loop over columns and rows
00065      for(int i=0; i<detUnitDimensions.first; i++) {
00066        float totalGain    = 0.0;
00067        float totalEntries = 0.0;
00068        for(int j=0; j<detUnitDimensions.second; j++) {
00069          nchannels++;
00070          totalGain  += 2.8;
00071          float ped  = 28.2;      
00072          totalEntries += 1.0;
00073          obj->setDataPedestal(ped, theSiPixelGainCalibrationOffline);    
00074          if ((j + 1) % 80 == 0) //compute the gain average after each ROC
00075          {
00076             float gain = totalGain/totalEntries;
00077             obj->setDataGain(gain, 80, theSiPixelGainCalibrationOffline);
00078             totalGain    = 0;
00079             totalEntries = 0.0;
00080          }
00081        }
00082      }
00083 
00084      //std::cout << "detid " << (*detit) << std::endl;
00085 
00086      SiPixelGainCalibrationOffline::Range range(theSiPixelGainCalibrationOffline.begin(),theSiPixelGainCalibrationOffline.end());
00087      // the 80 in the line below represents the number of columns averaged over.  
00088      if( !obj->put(*detit,range,detUnitDimensions.first) )
00089        edm::LogError("SiPixelFakeGainOfflineESSource")<<"[SiPixelFakeGainOfflineESSource::produce] detid already exists"<<std::endl;
00090    }
00091 
00092    //std::cout << "Modules = " << nmodules << " Channels " << nchannels << std::endl;
00093    
00094 
00095    // 
00096    return std::auto_ptr<SiPixelGainCalibrationOffline>(obj);
00097 
00098 
00099 }

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 101 of file SiPixelFakeGainOfflineESSource.cc.

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), and infinity.

00103                                                                                  {
00104   edm::ValidityInterval infinity( iosv.beginOfTime(), iosv.endOfTime() );
00105   oValidity = infinity;  
00106 }


Member Data Documentation

edm::FileInPath SiPixelFakeGainOfflineESSource::fp_ [private]

Definition at line 56 of file SiPixelFakeGainOfflineESSource.h.

Referenced by produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:58 2009 for CMSSW by  doxygen 1.5.4