CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.h

Go to the documentation of this file.
00001 #ifndef CALIBTRACKER_SIPIXELCALIBDIGIPRODUCER_H
00002 #define CALIBTRACKER_SIPIXELCALIBDIGIPRODUCER_H
00003 
00004 //
00005 // Package:    SiPixelCalibDigiProducer
00006 // Class:      SiPixelCalibDigiProducer
00007 // 
00015 //
00016 // Original Author:  Freya Blekman
00017 //         Created:  Wed Oct 31 15:28:52 CET 2007
00018 // $Id: SiPixelCalibDigiProducer.h,v 1.12 2010/02/11 00:10:31 wmtan Exp $
00019 //
00020 //
00021 
00022 // system include files
00023 #include <memory>
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "FWCore/Framework/interface/EDProducer.h"
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030 #include "FWCore/Framework/interface/ESHandle.h"
00031 
00032 #include "FWCore/ServiceRegistry/interface/Service.h"
00033 
00034 #include "FWCore/Utilities/interface/InputTag.h"
00035 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00036 
00037 #include "DataFormats/Common/interface/DetSetVector.h"
00038 
00039 #include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigifwd.h"
00040 #include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigi.h"
00041 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
00042 #include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigiError.h"
00043 
00044 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00045 #include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h"
00046 #include "CondFormats/DataRecord/interface/SiPixelCalibConfigurationRcd.h"
00047 #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
00048 
00049 #include <map>
00050 #include <vector>
00051 #include <iostream>
00052 //
00053 // class decleration
00054 //
00055 
00056 class SiPixelCalibDigiProducer : public edm::EDProducer {
00057    public:
00058       explicit SiPixelCalibDigiProducer(const edm::ParameterSet& iConfig);
00059       ~SiPixelCalibDigiProducer();
00060 
00061    private:
00062 
00063       virtual void beginJob(){}
00064       virtual void beginRun(const edm::Run &, const edm::EventSetup &);
00065       virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
00066       virtual bool store();
00067       virtual void setPattern();
00068       virtual void fill(edm::Event &iEvent, const edm::EventSetup& iSetup);
00069       virtual void fillPixel(uint32_t detid, short row, short col,short ipoint, short adc);
00070       virtual bool checkPixel(uint32_t detid, short row, short col);
00071       virtual bool checkFED(uint32_t detid);
00072       virtual void clear();
00073       virtual void endJob() ;
00074       typedef std::pair<uint32_t,std::pair<short,short> >  pixelstruct;
00075       // ----------member data ---------------------------
00076       edm::InputTag src_;
00077       uint32_t iEventCounter_;
00078       
00079       bool ignore_non_pattern_;
00080       bool control_pattern_size_;
00081       bool includeErrors_;
00082       int errorType;
00083       edm::ParameterSet conf_;
00084       std::string label_;
00085       std::string instance_;
00086       uint32_t number_of_pixels_per_pattern_;
00087       bool use_realeventnumber_;
00088       
00089       edm::ESHandle<SiPixelCalibConfiguration> calib_; // keeps track of the calibration constants
00090       edm::ESHandle<TrackerGeometry> theGeometry_; // the tracker geometry
00091       edm::ESHandle<SiPixelFedCablingMap> theCablingMap_;
00092 
00093       // worker variables
00094       std::map<pixelstruct,SiPixelCalibDigi> intermediate_data_; // data container, copied over into the event every pattern_repeat_ events
00095       std::map<pixelstruct,SiPixelCalibDigiError> error_data_;
00096       //      std::vector<SiPixelCalibDigi> intermediate_data_; // data container, copied over into the event every pattern_repeat_ events
00097       std::vector<pixelstruct> detPixelMap_;// map to keep track of which pixels are filled where in intermediate_data_
00098       uint32_t pattern_repeat_; // keeps track of when the pattern should change
00099       std::map<uint32_t,uint32_t> detid_to_fedid_; // keeps track in which fed each detid is present.
00100 
00101       std::vector<std::pair<short,short> > currentpattern_;// keeps track of which pattern we are at
00102       std::pair<short,short> currentpair_;//worker class to keep track of pairs
00103 };
00104 
00105 
00106 #endif