CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h

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