CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h

Go to the documentation of this file.
00001 //
00002 // $Id: EcalTrivialConditionRetriever.h,v 1.36 2013/04/28 05:49:04 davidlt 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/EcalLinearCorrections.h"
00034 #include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h"
00035 
00036 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
00037 #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h"
00038 
00039 
00040 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h"
00041 #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h"
00042 
00043 #include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h"
00044 #include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h"
00045 
00046 #include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h"
00047 #include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h"
00048 
00049 #include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h"
00050 #include "CondFormats/DataRecord/interface/EcalTimeCalibErrorsRcd.h"
00051 
00052 #include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h"
00053 #include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h"
00054 
00055 #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h"
00056 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h"
00057 #include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h"
00058 
00059 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
00060 #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
00061 
00062 #include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h"
00063 #include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h"
00064  
00065 #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h"
00066 #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h"
00067  
00068 #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h"
00069 #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h"
00070 
00071 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
00072 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
00073 
00074 #include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h"
00075 #include "CondFormats/DataRecord/interface/EcalDQMChannelStatusRcd.h"
00076 #include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h"
00077 #include "CondFormats/DataRecord/interface/EcalDQMTowerStatusRcd.h"
00078 
00079 #include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h"
00080 #include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h"
00081 #include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h"
00082 #include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h"
00083 #include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h"
00084 #include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h"
00085 #include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h"
00086 #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h"
00087 #include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h"
00088 #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h"
00089 #include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h"
00090 #include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h"
00091 #include "CondFormats/EcalObjects/interface/EcalMappingElectronics.h"
00092 #include "CondFormats/DataRecord/interface/EcalMappingElectronicsRcd.h"
00093 
00094 #include "FWCore/Framework/interface/IOVSyncValue.h"
00095 
00096 #include "CondFormats/Alignment/interface/Alignments.h"
00097 #include "CondFormats/AlignmentRecord/interface/EBAlignmentRcd.h"
00098 #include "CondFormats/AlignmentRecord/interface/EEAlignmentRcd.h"
00099 #include "CondFormats/AlignmentRecord/interface/ESAlignmentRcd.h"
00100 
00101 #include "CondFormats/EcalObjects/interface/EcalSampleMask.h"
00102 #include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h"
00103 
00104 
00105 #include "SimG4CMS/Calo/interface/EnergyResolutionVsLumi.h"
00106 #include "SimG4CMS/Calo/interface/EvolutionECAL.h"
00107 
00108 // forward declarations
00109 
00110 namespace edm{
00111   class ParameterSet;
00112 }
00113 
00114 class EcalTrivialConditionRetriever : public edm::ESProducer, 
00115                                       public edm::EventSetupRecordIntervalFinder
00116 {
00117 
00118 public:
00119   EcalTrivialConditionRetriever(const edm::ParameterSet&  pset);
00120   virtual ~EcalTrivialConditionRetriever();
00121 
00122   // ---------- member functions ---------------------------
00123   virtual std::auto_ptr<EcalPedestals> produceEcalPedestals( const EcalPedestalsRcd& );
00124   virtual std::auto_ptr<EcalWeightXtalGroups> produceEcalWeightXtalGroups( const EcalWeightXtalGroupsRcd& );
00125   virtual std::auto_ptr<EcalLinearCorrections> produceEcalLinearCorrections( const EcalLinearCorrectionsRcd& );
00126   virtual std::auto_ptr<EcalIntercalibConstants> produceEcalIntercalibConstants( const EcalIntercalibConstantsRcd& );
00127   virtual std::auto_ptr<EcalIntercalibConstantsMC> produceEcalIntercalibConstantsMC( const EcalIntercalibConstantsMCRcd& );
00128   virtual std::auto_ptr<EcalIntercalibErrors> produceEcalIntercalibErrors( const EcalIntercalibErrorsRcd& );
00129   virtual std::auto_ptr<EcalTimeCalibConstants> produceEcalTimeCalibConstants( const EcalTimeCalibConstantsRcd& );
00130   virtual std::auto_ptr<EcalTimeCalibErrors> produceEcalTimeCalibErrors( const EcalTimeCalibErrorsRcd& );
00131   virtual std::auto_ptr<EcalGainRatios> produceEcalGainRatios( const EcalGainRatiosRcd& );
00132   virtual std::auto_ptr<EcalADCToGeVConstant> produceEcalADCToGeVConstant( const EcalADCToGeVConstantRcd& );
00133   virtual std::auto_ptr<EcalTBWeights> produceEcalTBWeights( const EcalTBWeightsRcd& );
00134   virtual std::auto_ptr<EcalIntercalibConstants>  getIntercalibConstantsFromConfiguration ( const EcalIntercalibConstantsRcd& ) ;
00135   virtual std::auto_ptr<EcalIntercalibConstantsMC>  getIntercalibConstantsMCFromConfiguration ( const EcalIntercalibConstantsMCRcd& ) ;
00136   virtual std::auto_ptr<EcalIntercalibErrors>  getIntercalibErrorsFromConfiguration ( const EcalIntercalibErrorsRcd& ) ;
00137   virtual std::auto_ptr<EcalTimeCalibConstants>  getTimeCalibConstantsFromConfiguration ( const EcalTimeCalibConstantsRcd& ) ;
00138   virtual std::auto_ptr<EcalTimeCalibErrors>  getTimeCalibErrorsFromConfiguration ( const EcalTimeCalibErrorsRcd& ) ;
00139   virtual std::auto_ptr<EcalTimeOffsetConstant> produceEcalTimeOffsetConstant( const EcalTimeOffsetConstantRcd& );
00140 
00141 
00142   virtual std::auto_ptr<EcalLaserAlphas> produceEcalLaserAlphas( const EcalLaserAlphasRcd& );
00143   virtual std::auto_ptr<EcalLaserAPDPNRatiosRef> produceEcalLaserAPDPNRatiosRef( const EcalLaserAPDPNRatiosRefRcd& );
00144   virtual std::auto_ptr<EcalLaserAPDPNRatios> produceEcalLaserAPDPNRatios( const EcalLaserAPDPNRatiosRcd& );
00145 
00146   virtual std::auto_ptr<EcalClusterLocalContCorrParameters> produceEcalClusterLocalContCorrParameters( const EcalClusterLocalContCorrParametersRcd& );
00147   virtual std::auto_ptr<EcalClusterCrackCorrParameters> produceEcalClusterCrackCorrParameters( const EcalClusterCrackCorrParametersRcd& );
00148   virtual std::auto_ptr<EcalClusterEnergyCorrectionParameters> produceEcalClusterEnergyCorrectionParameters( const EcalClusterEnergyCorrectionParametersRcd& );
00149   virtual std::auto_ptr<EcalClusterEnergyUncertaintyParameters> produceEcalClusterEnergyUncertaintyParameters( const EcalClusterEnergyUncertaintyParametersRcd& );
00150   virtual std::auto_ptr<EcalClusterEnergyCorrectionObjectSpecificParameters> produceEcalClusterEnergyCorrectionObjectSpecificParameters( const EcalClusterEnergyCorrectionObjectSpecificParametersRcd& );
00151 
00152   virtual std::auto_ptr<EcalChannelStatus> produceEcalChannelStatus( const EcalChannelStatusRcd& );
00153   virtual std::auto_ptr<EcalChannelStatus> getChannelStatusFromConfiguration( const EcalChannelStatusRcd& );
00154 
00155   virtual std::auto_ptr<EcalTPGCrystalStatus> produceEcalTrgChannelStatus( const EcalTPGCrystalStatusRcd& );
00156   virtual std::auto_ptr<EcalTPGCrystalStatus> getTrgChannelStatusFromConfiguration( const EcalTPGCrystalStatusRcd& );
00157 
00158   virtual std::auto_ptr<EcalDCSTowerStatus> produceEcalDCSTowerStatus( const EcalDCSTowerStatusRcd& );
00159   virtual std::auto_ptr<EcalDAQTowerStatus> produceEcalDAQTowerStatus( const EcalDAQTowerStatusRcd& );
00160   virtual std::auto_ptr<EcalDQMTowerStatus> produceEcalDQMTowerStatus( const EcalDQMTowerStatusRcd& );
00161   virtual std::auto_ptr<EcalDQMChannelStatus> produceEcalDQMChannelStatus( const EcalDQMChannelStatusRcd& );
00162 
00163   virtual std::auto_ptr<EcalMappingElectronics> produceEcalMappingElectronics( const EcalMappingElectronicsRcd& );
00164   virtual std::auto_ptr<EcalMappingElectronics> getMappingFromConfiguration( const EcalMappingElectronicsRcd& );
00165 
00166   //  virtual std::auto_ptr<EcalAlignmentEB> produceEcalAlignmentEB( const EcalAlignmentEBRcd& );
00167   //  virtual std::auto_ptr<EcalAlignmentEE> produceEcalAlignmentEE( const EcalAlignmentEERcd& );
00168   //  virtual std::auto_ptr<EcalAlignmentES> produceEcalAlignmentES( const EcalAlignmentESRcd& );
00169   virtual std::auto_ptr<Alignments> produceEcalAlignmentEB( const EBAlignmentRcd& );
00170   virtual std::auto_ptr<Alignments> produceEcalAlignmentEE( const EEAlignmentRcd& );
00171   virtual std::auto_ptr<Alignments> produceEcalAlignmentES( const ESAlignmentRcd& );
00172 
00173   virtual std::auto_ptr<EcalSampleMask> produceEcalSampleMask( const EcalSampleMaskRcd& );
00174 
00175 protected:
00176   //overriding from ContextRecordIntervalFinder
00177   virtual void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&,
00178                                const edm::IOVSyncValue& ,
00179                                edm::ValidityInterval& ) ;
00180 private:
00181   EcalTrivialConditionRetriever( const EcalTrivialConditionRetriever& ); // stop default
00182   const  EcalTrivialConditionRetriever& operator=( const EcalTrivialConditionRetriever& ); // stop default
00183 
00184   void getWeightsFromConfiguration(const edm::ParameterSet& ps);
00185 
00186   // data members
00187   double adcToGeVEBConstant_;      // ADC -> GeV scale for barrel
00188   double adcToGeVEEConstant_;      // ADC -> GeV scale for endcap
00189 
00190 
00191   double intercalibConstantMean_;  // mean of intercalib constant. default: 1.0
00192   double intercalibConstantSigma_; // sigma of intercalib constant
00193 
00194   double intercalibConstantMeanMC_;  // mean of intercalib constant. default: 1.0
00195   double intercalibConstantSigmaMC_; // sigma of intercalib constant
00196                                   // Gaussian used to generate intercalib constants for
00197                                   // each channel. no smearing if sigma=0.0 (default)
00198   double intercalibErrorMean_;  // mean of intercalib constant error
00199 
00200   double timeCalibConstantMean_;
00201   double timeCalibConstantSigma_;
00202   double timeCalibErrorMean_;
00203 
00204   double timeOffsetEBConstant_;    
00205   double timeOffsetEEConstant_;    
00206 
00207   // cluster corrections
00208   std::vector<double> localContCorrParameters_;
00209   std::vector<double> crackCorrParameters_;
00210   std::vector<double> energyCorrectionParameters_;
00211   std::vector<double> energyUncertaintyParameters_;
00212   std::vector<double> energyCorrectionObjectSpecificParameters_;
00213 
00214   // ageing parameters 
00215   double totLumi_;
00216   double instLumi_;
00217 
00218   // laser
00219   double laserAlphaMean_;  
00220   double laserAlphaSigma_;  
00221   double laserAPDPNRefMean_;  
00222   double laserAPDPNRefSigma_;  
00223   double laserAPDPNMean_;  
00224   double laserAPDPNSigma_;  
00225   unsigned long laserAPDPNTime1_;
00226   unsigned long laserAPDPNTime2_;
00227   unsigned long laserAPDPNTime3_;
00228 
00229   double linCorrMean_;  // mean of lin corr
00230   double linCorrSigma_; // sigma of lin corr
00231 
00232   unsigned long linearTime1_;
00233   unsigned long linearTime2_;
00234   unsigned long linearTime3_;
00235 
00236   double EBpedMeanX12_;              // pedestal mean pedestal at gain 12
00237   double EBpedRMSX12_;               // pedestal rms at gain 12
00238   double EBpedMeanX6_;               // pedestal mean pedestal at gain 6
00239   double EBpedRMSX6_;                // pedestal rms at gain 6
00240   double EBpedMeanX1_;               // pedestal mean pedestal at gain 1
00241   double EBpedRMSX1_;                // pedestal rms at gain 1
00242 
00243   double EEpedMeanX12_;              // pedestal mean pedestal at gain 12
00244   double EEpedRMSX12_;               // pedestal rms at gain 12
00245   double EEpedMeanX6_;               // pedestal mean pedestal at gain 6
00246   double EEpedRMSX6_;                // pedestal rms at gain 6
00247   double EEpedMeanX1_;               // pedestal mean pedestal at gain 1
00248   double EEpedRMSX1_;                // pedestal rms at gain 1
00249 
00250   double gainRatio12over6_;        // ratio of MGPA gain12 / gain6
00251   double gainRatio6over1_;         // ratio of MGPA gain6 / gain1
00252 
00253   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > amplWeights_;  // weights to compute amplitudes after ped subtraction
00254   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > amplWeightsAft_;  // weights to compute amplitudes after ped subtraction
00255 
00256   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > pedWeights_;  // weights to compute amplitudes w/o ped subtraction
00257   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > pedWeightsAft_;  // weights to compute amplitudes w/o ped subtraction
00258 
00259   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > jittWeights_;  // weights to compute jitter
00260   std::vector< ROOT::Math::SVector<double,EcalDataFrame::MAXSAMPLES> > jittWeightsAft_;  // weights to compute jitter
00261 
00262   std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2Matrix_;
00263   std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2MatrixAft_;
00264 
00265   std::string amplWeightsFile_;
00266   std::string amplWeightsAftFile_;
00267   std::string pedWeightsFile_;
00268   std::string pedWeightsAftFile_;
00269   std::string jittWeightsFile_; 
00270   std::string jittWeightsAftFile_; 
00271   std::string chi2MatrixFile_;
00272   std::string chi2MatrixAftFile_;
00273   std::string linearCorrectionsFile_ ;
00274   std::string intercalibConstantsFile_ ;
00275   std::string intercalibConstantsMCFile_ ;
00276   std::string intercalibErrorsFile_ ;
00277   std::string timeCalibConstantsFile_ ;
00278   std::string timeCalibErrorsFile_ ;
00279   std::string channelStatusFile_ ;
00280   std::string trgChannelStatusFile_ ;
00281   std::string mappingFile_ ;
00282   std::string EBAlignmentFile_;
00283   std::string EEAlignmentFile_;
00284   std::string ESAlignmentFile_;
00285   std::string EBLaserAlphaFile_;
00286   std::string EELaserAlphaFile_;
00287   unsigned int sampleMaskEB_;      // Mask to discard sample in barrel
00288   unsigned int sampleMaskEE_;      // Mask to discard sample in endcaps
00289 
00290   int nTDCbins_;
00291 
00292   bool getWeightsFromFile_;
00293   bool weightsForAsynchronousRunning_;
00294   bool producedEcalPedestals_;
00295   bool producedEcalWeights_;
00296   bool producedEcalLinearCorrections_;
00297   bool producedEcalIntercalibConstants_;
00298   bool producedEcalIntercalibConstantsMC_;
00299   bool producedEcalIntercalibErrors_;
00300   bool producedEcalTimeCalibConstants_;
00301   bool producedEcalTimeCalibErrors_;
00302   bool producedEcalTimeOffsetConstant_;
00303   bool producedEcalGainRatios_;
00304   bool producedEcalADCToGeVConstant_;
00305   bool producedEcalLaserCorrection_;
00306   bool producedEcalChannelStatus_;
00307   bool producedEcalDQMTowerStatus_;
00308   bool producedEcalDQMChannelStatus_;
00309   bool producedEcalDCSTowerStatus_;
00310   bool producedEcalDAQTowerStatus_;
00311   bool producedEcalTrgChannelStatus_;
00312   bool producedEcalClusterLocalContCorrParameters_;
00313   bool producedEcalClusterCrackCorrParameters_;
00314   bool producedEcalClusterEnergyCorrectionParameters_;
00315   bool producedEcalClusterEnergyUncertaintyParameters_;
00316   bool producedEcalClusterEnergyCorrectionObjectSpecificParameters_;
00317   bool producedEcalMappingElectronics_;
00318   bool producedEcalAlignmentEB_;
00319   bool producedEcalAlignmentEE_;
00320   bool producedEcalAlignmentES_;
00321   bool getEBAlignmentFromFile_;
00322   bool getEEAlignmentFromFile_;
00323   bool getESAlignmentFromFile_;
00324   bool getLaserAlphaFromFile_;
00325   bool producedEcalSampleMask_;
00326 
00327   int    verbose_; // verbosity
00328 
00329 };
00330 #endif