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