CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h

Go to the documentation of this file.
00001 //
00002 // $Id: EcalTrivialConditionRetriever.h,v 1.27 2010/05/19 09:38:13 fra Exp $
00003 // Created: 2 Mar 2006
00004 //          Shahram Rahatlou, University of Rome & INFN
00005 //
00006 #ifndef CalibCalorimetry_EcalPlugins_EcalTrivialConditionRetriever_H
00007 #define CalibCalorimetry_EcalPlugins_EcalTrivialConditionRetriever_H
00008 // system include files
00009 #include <string>
00010 #include <vector>
00011 
00012 // user include files
00013 #include "FWCore/Framework/interface/ESProducer.h"
00014 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00015 
00016 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
00017 #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
00018 
00019 #include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h"
00020 #include "CondFormats/DataRecord/interface/EcalDCSTowerStatusRcd.h"
00021 #include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h"
00022 #include "CondFormats/DataRecord/interface/EcalDAQTowerStatusRcd.h"
00023 
00024 #include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h"
00025 #include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h"
00026 #include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h"
00027 
00028 #include "CondFormats/EcalObjects/interface/EcalWeight.h"
00029 #include "CondFormats/EcalObjects/interface/EcalWeightSet.h"
00030 #include "CondFormats/EcalObjects/interface/EcalTBWeights.h"
00031 #include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h"
00032 
00033 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
00034 #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h"
00035 
00036 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h"
00037 #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h"
00038 
00039 #include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h"
00040 #include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h"
00041 
00042 #include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h"
00043 #include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h"
00044 
00045 #include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h"
00046 #include "CondFormats/DataRecord/interface/EcalTimeCalibErrorsRcd.h"
00047 
00048 #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h"
00049 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h"
00050 #include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h"
00051 
00052 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
00053 #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
00054 
00055 #include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h"
00056 #include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h"
00057  
00058 #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h"
00059 #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h"
00060  
00061 #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h"
00062 #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h"
00063 
00064 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
00065 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
00066 
00067 #include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h"
00068 #include "CondFormats/DataRecord/interface/EcalDQMChannelStatusRcd.h"
00069 #include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h"
00070 #include "CondFormats/DataRecord/interface/EcalDQMTowerStatusRcd.h"
00071 
00072 #include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h"
00073 #include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h"
00074 #include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h"
00075 #include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h"
00076 #include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h"
00077 #include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h"
00078 #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h"
00079 #include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h"
00080 #include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h"
00081 #include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h"
00082 #include "CondFormats/EcalObjects/interface/EcalMappingElectronics.h"
00083 #include "CondFormats/DataRecord/interface/EcalMappingElectronicsRcd.h"
00084 
00085 #include "FWCore/Framework/interface/IOVSyncValue.h"
00086 
00087 // forward declarations
00088 
00089 namespace edm{
00090   class ParameterSet;
00091 }
00092 
00093 class EcalTrivialConditionRetriever : public edm::ESProducer, 
00094                                       public edm::EventSetupRecordIntervalFinder
00095 {
00096 
00097 public:
00098   EcalTrivialConditionRetriever(const edm::ParameterSet&  pset);
00099   virtual ~EcalTrivialConditionRetriever();
00100 
00101   // ---------- member functions ---------------------------
00102   virtual std::auto_ptr<EcalPedestals> produceEcalPedestals( const EcalPedestalsRcd& );
00103   virtual std::auto_ptr<EcalWeightXtalGroups> produceEcalWeightXtalGroups( const EcalWeightXtalGroupsRcd& );
00104   virtual std::auto_ptr<EcalIntercalibConstants> produceEcalIntercalibConstants( const EcalIntercalibConstantsRcd& );
00105   virtual std::auto_ptr<EcalIntercalibConstantsMC> produceEcalIntercalibConstantsMC( const EcalIntercalibConstantsMCRcd& );
00106   virtual std::auto_ptr<EcalIntercalibErrors> produceEcalIntercalibErrors( const EcalIntercalibErrorsRcd& );
00107   virtual std::auto_ptr<EcalTimeCalibConstants> produceEcalTimeCalibConstants( const EcalTimeCalibConstantsRcd& );
00108   virtual std::auto_ptr<EcalTimeCalibErrors> produceEcalTimeCalibErrors( const EcalTimeCalibErrorsRcd& );
00109   virtual std::auto_ptr<EcalGainRatios> produceEcalGainRatios( const EcalGainRatiosRcd& );
00110   virtual std::auto_ptr<EcalADCToGeVConstant> produceEcalADCToGeVConstant( const EcalADCToGeVConstantRcd& );
00111   virtual std::auto_ptr<EcalTBWeights> produceEcalTBWeights( const EcalTBWeightsRcd& );
00112   virtual std::auto_ptr<EcalIntercalibConstants>  getIntercalibConstantsFromConfiguration ( const EcalIntercalibConstantsRcd& ) ;
00113   virtual std::auto_ptr<EcalIntercalibErrors>  getIntercalibErrorsFromConfiguration ( const EcalIntercalibErrorsRcd& ) ;
00114   virtual std::auto_ptr<EcalTimeCalibConstants>  getTimeCalibConstantsFromConfiguration ( const EcalTimeCalibConstantsRcd& ) ;
00115   virtual std::auto_ptr<EcalTimeCalibErrors>  getTimeCalibErrorsFromConfiguration ( const EcalTimeCalibErrorsRcd& ) ;
00116 
00117   virtual std::auto_ptr<EcalLaserAlphas> produceEcalLaserAlphas( const EcalLaserAlphasRcd& );
00118   virtual std::auto_ptr<EcalLaserAPDPNRatiosRef> produceEcalLaserAPDPNRatiosRef( const EcalLaserAPDPNRatiosRefRcd& );
00119   virtual std::auto_ptr<EcalLaserAPDPNRatios> produceEcalLaserAPDPNRatios( const EcalLaserAPDPNRatiosRcd& );
00120 
00121   virtual std::auto_ptr<EcalClusterLocalContCorrParameters> produceEcalClusterLocalContCorrParameters( const EcalClusterLocalContCorrParametersRcd& );
00122   virtual std::auto_ptr<EcalClusterCrackCorrParameters> produceEcalClusterCrackCorrParameters( const EcalClusterCrackCorrParametersRcd& );
00123   virtual std::auto_ptr<EcalClusterEnergyCorrectionParameters> produceEcalClusterEnergyCorrectionParameters( const EcalClusterEnergyCorrectionParametersRcd& );
00124   virtual std::auto_ptr<EcalClusterEnergyUncertaintyParameters> produceEcalClusterEnergyUncertaintyParameters( const EcalClusterEnergyUncertaintyParametersRcd& );
00125 
00126   virtual std::auto_ptr<EcalChannelStatus> produceEcalChannelStatus( const EcalChannelStatusRcd& );
00127   virtual std::auto_ptr<EcalChannelStatus> getChannelStatusFromConfiguration( const EcalChannelStatusRcd& );
00128 
00129   virtual std::auto_ptr<EcalTPGCrystalStatus> produceEcalTrgChannelStatus( const EcalTPGCrystalStatusRcd& );
00130   virtual std::auto_ptr<EcalTPGCrystalStatus> getTrgChannelStatusFromConfiguration( const EcalTPGCrystalStatusRcd& );
00131 
00132   virtual std::auto_ptr<EcalDCSTowerStatus> produceEcalDCSTowerStatus( const EcalDCSTowerStatusRcd& );
00133   virtual std::auto_ptr<EcalDAQTowerStatus> produceEcalDAQTowerStatus( const EcalDAQTowerStatusRcd& );
00134   virtual std::auto_ptr<EcalDQMTowerStatus> produceEcalDQMTowerStatus( const EcalDQMTowerStatusRcd& );
00135   virtual std::auto_ptr<EcalDQMChannelStatus> produceEcalDQMChannelStatus( const EcalDQMChannelStatusRcd& );
00136 
00137   virtual std::auto_ptr<EcalMappingElectronics> produceEcalMappingElectronics( const EcalMappingElectronicsRcd& );
00138   virtual std::auto_ptr<EcalMappingElectronics> getMappingFromConfiguration( const EcalMappingElectronicsRcd& );
00139 
00140 protected:
00141   //overriding from ContextRecordIntervalFinder
00142   virtual void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&,
00143                                const edm::IOVSyncValue& ,
00144                                edm::ValidityInterval& ) ;
00145 private:
00146   EcalTrivialConditionRetriever( const EcalTrivialConditionRetriever& ); // stop default
00147   const  EcalTrivialConditionRetriever& operator=( const EcalTrivialConditionRetriever& ); // stop default
00148 
00149   void getWeightsFromConfiguration(const edm::ParameterSet& ps);
00150 
00151   // data members
00152   double adcToGeVEBConstant_;      // ADC -> GeV scale for barrel
00153   double adcToGeVEEConstant_;      // ADC -> GeV scale for endcap
00154 
00155   double intercalibConstantMean_;  // mean of intercalib constant. default: 1.0
00156   double intercalibConstantSigma_; // sigma of intercalib constant
00157 
00158   double intercalibConstantMeanMC_;  // mean of intercalib constant. default: 1.0
00159   double intercalibConstantSigmaMC_; // sigma of intercalib constant
00160                                   // Gaussian used to generate intercalib constants for
00161                                   // each channel. no smearing if sigma=0.0 (default)
00162   double intercalibErrorMean_;  // mean of intercalib constant error
00163 
00164   double timeCalibConstantMean_;
00165   double timeCalibConstantSigma_;
00166   double timeCalibErrorMean_;
00167 
00168   // cluster corrections
00169   std::vector<double> localContCorrParameters_;
00170   std::vector<double> crackCorrParameters_;
00171   std::vector<double> energyCorrectionParameters_;
00172   std::vector<double> energyUncertaintyParameters_;
00173 
00174   // laser
00175   double laserAlphaMean_;  
00176   double laserAlphaSigma_;  
00177   double laserAPDPNRefMean_;  
00178   double laserAPDPNRefSigma_;  
00179   double laserAPDPNMean_;  
00180   double laserAPDPNSigma_;  
00181   unsigned long laserAPDPNTime1_;
00182   unsigned long laserAPDPNTime2_;
00183   unsigned long laserAPDPNTime3_;
00184 
00185   double EBpedMeanX12_;              // pedestal mean pedestal at gain 12
00186   double EBpedRMSX12_;               // pedestal rms at gain 12
00187   double EBpedMeanX6_;               // pedestal mean pedestal at gain 6
00188   double EBpedRMSX6_;                // pedestal rms at gain 6
00189   double EBpedMeanX1_;               // pedestal mean pedestal at gain 1
00190   double EBpedRMSX1_;                // pedestal rms at gain 1
00191 
00192   double EEpedMeanX12_;              // pedestal mean pedestal at gain 12
00193   double EEpedRMSX12_;               // pedestal rms at gain 12
00194   double EEpedMeanX6_;               // pedestal mean pedestal at gain 6
00195   double EEpedRMSX6_;                // pedestal rms at gain 6
00196   double EEpedMeanX1_;               // pedestal mean pedestal at gain 1
00197   double EEpedRMSX1_;                // pedestal rms at gain 1
00198 
00199   double gainRatio12over6_;        // ratio of MGPA gain12 / gain6
00200   double gainRatio6over1_;         // ratio of MGPA gain6 / gain1
00201 
00202   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > amplWeights_;  // weights to compute amplitudes after ped subtraction
00203   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > amplWeightsAft_;  // weights to compute amplitudes after ped subtraction
00204 
00205   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > pedWeights_;  // weights to compute amplitudes w/o ped subtraction
00206   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > pedWeightsAft_;  // weights to compute amplitudes w/o ped subtraction
00207 
00208   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > jittWeights_;  // weights to compute jitter
00209   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > jittWeightsAft_;  // weights to compute jitter
00210 
00211   std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2Matrix_;
00212   std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2MatrixAft_;
00213 
00214   std::string amplWeightsFile_;
00215   std::string amplWeightsAftFile_;
00216   std::string pedWeightsFile_;
00217   std::string pedWeightsAftFile_;
00218   std::string jittWeightsFile_; 
00219   std::string jittWeightsAftFile_; 
00220   std::string chi2MatrixFile_;
00221   std::string chi2MatrixAftFile_;
00222   std::string intercalibConstantsFile_ ;
00223   std::string intercalibErrorsFile_ ;
00224   std::string timeCalibConstantsFile_ ;
00225   std::string timeCalibErrorsFile_ ;
00226   std::string channelStatusFile_ ;
00227   std::string trgChannelStatusFile_ ;
00228   std::string mappingFile_ ;
00229 
00230   int nTDCbins_;
00231 
00232   bool getWeightsFromFile_;
00233   bool weightsForAsynchronousRunning_;
00234   bool producedEcalPedestals_;
00235   bool producedEcalWeights_;
00236   bool producedEcalIntercalibConstants_;
00237   bool producedEcalIntercalibConstantsMC_;
00238   bool producedEcalIntercalibErrors_;
00239   bool producedEcalTimeCalibConstants_;
00240   bool producedEcalTimeCalibErrors_;
00241   bool producedEcalGainRatios_;
00242   bool producedEcalADCToGeVConstant_;
00243   bool producedEcalLaserCorrection_;
00244   bool producedEcalChannelStatus_;
00245   bool producedEcalDQMTowerStatus_;
00246   bool producedEcalDQMChannelStatus_;
00247   bool producedEcalDCSTowerStatus_;
00248   bool producedEcalDAQTowerStatus_;
00249   bool producedEcalTrgChannelStatus_;
00250   bool producedEcalClusterLocalContCorrParameters_;
00251   bool producedEcalClusterCrackCorrParameters_;
00252   bool producedEcalClusterEnergyCorrectionParameters_;
00253   bool producedEcalClusterEnergyUncertaintyParameters_;
00254   bool producedEcalMappingElectronics_;
00255 
00256   int    verbose_; // verbosity
00257 
00258 };
00259 #endif