00001
00002
00003
00004
00005
00006 #include <iostream>
00007 #include <fstream>
00008
00009 #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 #include "FWCore/Utilities/interface/Exception.h"
00012
00013 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00014 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00015 #include "DataFormats/EcalDetId/interface/ESDetId.h"
00016 #include "DataFormats/EcalDetId/interface/EcalElectronicsId.h"
00017 #include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h"
00018 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00019
00020
00021
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023
00024
00025 using namespace edm;
00026
00027 EcalTrivialConditionRetriever::EcalTrivialConditionRetriever( const edm::ParameterSet& ps)
00028 {
00029
00030 adcToGeVEBConstant_ = ps.getUntrackedParameter<double>("adcToGeVEBConstant",0.035);
00031 adcToGeVEEConstant_ = ps.getUntrackedParameter<double>("adcToGeVEEConstant",0.060);
00032
00033 intercalibConstantMeanMC_ = ps.getUntrackedParameter<double>("intercalibConstantMeanMC",1.0);
00034 intercalibConstantSigmaMC_ = ps.getUntrackedParameter<double>("intercalibConstantSigmaMC",0.0);
00035
00036 intercalibConstantMean_ = ps.getUntrackedParameter<double>("intercalibConstantMean",1.0);
00037 intercalibConstantSigma_ = ps.getUntrackedParameter<double>("intercalibConstantSigma",0.0);
00038 intercalibErrorMean_ = ps.getUntrackedParameter<double>("IntercalibErrorMean",0.0);
00039
00040 timeCalibConstantMean_ = ps.getUntrackedParameter<double>("timeCalibConstantMean",0.0);
00041 timeCalibConstantSigma_ = ps.getUntrackedParameter<double>("timeCalibConstantSigma",0.0);
00042 timeCalibErrorMean_ = ps.getUntrackedParameter<double>("timeCalibErrorMean",0.0);
00043
00044 timeOffsetEBConstant_ = ps.getUntrackedParameter<double>("timeOffsetEBConstant",0.0);
00045 timeOffsetEEConstant_ = ps.getUntrackedParameter<double>("timeOffsetEEConstant",0.0);
00046
00047 laserAlphaMean_ = ps.getUntrackedParameter<double>("laserAlphaMean",1.55);
00048 laserAlphaSigma_ = ps.getUntrackedParameter<double>("laserAlphaSigma",0);
00049
00050 laserAPDPNTime1_ = (unsigned long)atoi( ps.getUntrackedParameter<std::string>("laserAPDPNTime1","1").c_str());
00051 laserAPDPNTime2_= (unsigned long)atoi( ps.getUntrackedParameter<std::string>("laserAPDPNTime2","0").c_str());
00052 laserAPDPNTime3_= (unsigned long)atoi( ps.getUntrackedParameter<std::string>("laserAPDPNTime3","0").c_str());
00053
00054 laserAPDPNRefMean_ = ps.getUntrackedParameter<double>("laserAPDPNRefMean",1.0);
00055 laserAPDPNRefSigma_ = ps.getUntrackedParameter<double>("laserAPDPNRefSigma",0.0);
00056
00057 laserAPDPNMean_ = ps.getUntrackedParameter<double>("laserAPDPNMean",1.0);
00058 laserAPDPNSigma_ = ps.getUntrackedParameter<double>("laserAPDPNSigma",0.0);
00059
00060 localContCorrParameters_ = ps.getUntrackedParameter< std::vector<double> >("localContCorrParameters", std::vector<double>(0) );
00061 crackCorrParameters_ = ps.getUntrackedParameter< std::vector<double> >("crackCorrParameters", std::vector<double>(0) );
00062 energyCorrectionParameters_ = ps.getUntrackedParameter< std::vector<double> >("energyCorrectionParameters", std::vector<double>(0) );
00063 energyUncertaintyParameters_ = ps.getUntrackedParameter< std::vector<double> >("energyUncertaintyParameters", std::vector<double>(0) );
00064 energyCorrectionObjectSpecificParameters_ = ps.getUntrackedParameter< std::vector<double> >("energyCorrectionObjectSpecificParameters", std::vector<double>(0) );
00065
00066 EBpedMeanX12_ = ps.getUntrackedParameter<double>("EBpedMeanX12", 200.);
00067 EBpedRMSX12_ = ps.getUntrackedParameter<double>("EBpedRMSX12", 1.10);
00068 EBpedMeanX6_ = ps.getUntrackedParameter<double>("EBpedMeanX6", 200.);
00069 EBpedRMSX6_ = ps.getUntrackedParameter<double>("EBpedRMSX6", 0.90);
00070 EBpedMeanX1_ = ps.getUntrackedParameter<double>("EBpedMeanX1", 200.);
00071 EBpedRMSX1_ = ps.getUntrackedParameter<double>("EBpedRMSX1", 0.62);
00072
00073 EEpedMeanX12_ = ps.getUntrackedParameter<double>("EEpedMeanX12", 200.);
00074 EEpedRMSX12_ = ps.getUntrackedParameter<double>("EEpedRMSX12", 2.50);
00075 EEpedMeanX6_ = ps.getUntrackedParameter<double>("EEpedMeanX6", 200.);
00076 EEpedRMSX6_ = ps.getUntrackedParameter<double>("EEpedRMSX6", 2.00);
00077 EEpedMeanX1_ = ps.getUntrackedParameter<double>("EEpedMeanX1", 200.);
00078 EEpedRMSX1_ = ps.getUntrackedParameter<double>("EEpedRMSX1", 1.40);
00079
00080 gainRatio12over6_ = ps.getUntrackedParameter<double>("gainRatio12over6", 2.0);
00081 gainRatio6over1_ = ps.getUntrackedParameter<double>("gainRatio6over1", 6.0);
00082
00083 getWeightsFromFile_ = ps.getUntrackedParameter<bool>("getWeightsFromFile",false);
00084
00085 nTDCbins_ = 1;
00086
00087 std::cout << " EcalTrivialConditionRetriever " << std::endl;
00088 weightsForAsynchronousRunning_ = ps.getUntrackedParameter<bool>("weightsForTB",false);
00089
00090 if (weightsForAsynchronousRunning_)
00091 {
00092 getWeightsFromFile_ = true;
00093
00094 nTDCbins_ = 50;
00095 }
00096
00097 std::string path="CalibCalorimetry/EcalTrivialCondModules/data/";
00098 std::string weightType;
00099 std::ostringstream str;
00100
00101 if (!weightsForAsynchronousRunning_)
00102 str << "_CMS.txt" ;
00103 else
00104 str << "_TB.txt" ;
00105
00106 weightType = str.str();
00107
00108 amplWeightsFile_ = ps.getUntrackedParameter<std::string>("amplWeightsFile",path+"ampWeights"+weightType);
00109 amplWeightsAftFile_ = ps.getUntrackedParameter<std::string>("amplWeightsAftFile",path+"ampWeightsAfterGainSwitch"+weightType);
00110 pedWeightsFile_ = ps.getUntrackedParameter<std::string>("pedWeightsFile",path+"pedWeights"+weightType);
00111 pedWeightsAftFile_ = ps.getUntrackedParameter<std::string>("pedWeightsAftFile",path+"pedWeightsAfterGainSwitch"+weightType);
00112 jittWeightsFile_ = ps.getUntrackedParameter<std::string>("jittWeightsFile",path+"timeWeights"+weightType);
00113 jittWeightsAftFile_ = ps.getUntrackedParameter<std::string>("jittWeightsAftFile",path+"timeWeightsAfterGainSwitch"+weightType);
00114 chi2MatrixFile_ = ps.getUntrackedParameter<std::string>("chi2MatrixFile",path+"chi2Matrix"+weightType);
00115 chi2MatrixAftFile_ = ps.getUntrackedParameter<std::string>("chi2MatrixAftFile",path+"chi2MatrixAfterGainSwitch"+weightType);
00116
00117 amplWeights_.resize(nTDCbins_);
00118 amplWeightsAft_.resize(nTDCbins_);
00119 pedWeights_.resize(nTDCbins_);
00120 pedWeightsAft_.resize(nTDCbins_);
00121 jittWeights_.resize(nTDCbins_);
00122 jittWeightsAft_.resize(nTDCbins_);
00123 chi2Matrix_.resize(nTDCbins_);
00124 chi2MatrixAft_.resize(nTDCbins_);
00125
00126
00127 getWeightsFromConfiguration(ps);
00128
00129 producedEcalPedestals_ = ps.getUntrackedParameter<bool>("producedEcalPedestals",true);
00130 producedEcalWeights_ = ps.getUntrackedParameter<bool>("producedEcalWeights",true);
00131
00132 producedEcalGainRatios_ = ps.getUntrackedParameter<bool>("producedEcalGainRatios",true);
00133 producedEcalADCToGeVConstant_ = ps.getUntrackedParameter<bool>("producedEcalADCToGeVConstant",true);
00134
00135 producedEcalMappingElectronics_ = ps.getUntrackedParameter<bool>("producedEcalMappingElectronics",true);
00136 mappingFile_ = ps.getUntrackedParameter<std::string>("mappingFile","");
00137
00138 if ( producedEcalMappingElectronics_ ) {
00139 if ( mappingFile_ != "" ) {
00140 setWhatProduced( this, &EcalTrivialConditionRetriever::getMappingFromConfiguration );
00141 } else {
00142 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalMappingElectronics );
00143 }
00144 findingRecord<EcalMappingElectronicsRcd>();
00145 }
00146
00147 getEBAlignmentFromFile_ = ps.getUntrackedParameter<bool>("getEBAlignmentFromFile",false);
00148 if(getEBAlignmentFromFile_) {
00149 EBAlignmentFile_ = ps.getUntrackedParameter<std::string>("EBAlignmentFile",path+"EBAlignment.txt");
00150 }
00151
00152 getEEAlignmentFromFile_ = ps.getUntrackedParameter<bool>("getEEAlignmentFromFile",false);
00153 if(getEEAlignmentFromFile_) {
00154 EEAlignmentFile_ = ps.getUntrackedParameter<std::string>("EEAlignmentFile",path+"EEAlignment.txt");
00155 }
00156
00157 getESAlignmentFromFile_ = ps.getUntrackedParameter<bool>("getESAlignmentFromFile",false);
00158 if(getESAlignmentFromFile_)
00159 ESAlignmentFile_ = ps.getUntrackedParameter<std::string>("ESAlignmentFile",path+"ESAlignment.txt");
00160
00161 verbose_ = ps.getUntrackedParameter<int>("verbose", 0);
00162
00163
00164
00165 if (producedEcalPedestals_)
00166 setWhatProduced(this, &EcalTrivialConditionRetriever::produceEcalPedestals );
00167
00168 if (producedEcalWeights_) {
00169 setWhatProduced(this, &EcalTrivialConditionRetriever::produceEcalWeightXtalGroups );
00170 setWhatProduced(this, &EcalTrivialConditionRetriever::produceEcalTBWeights );
00171 }
00172
00173 if (producedEcalGainRatios_)
00174 setWhatProduced(this, &EcalTrivialConditionRetriever::produceEcalGainRatios );
00175
00176 if (producedEcalADCToGeVConstant_)
00177 setWhatProduced(this, &EcalTrivialConditionRetriever::produceEcalADCToGeVConstant );
00178
00179
00180 producedEcalTimeOffsetConstant_ = ps.getUntrackedParameter<bool>("producedEcalTimeOffsetConstant",true);
00181
00182 if (producedEcalTimeOffsetConstant_) {
00183 setWhatProduced(this, &EcalTrivialConditionRetriever::produceEcalTimeOffsetConstant );
00184 findingRecord<EcalTimeOffsetConstantRcd>();
00185 }
00186
00187
00188 producedEcalIntercalibConstants_ = ps.getUntrackedParameter<bool>("producedEcalIntercalibConstants",true);
00189 intercalibConstantsFile_ = ps.getUntrackedParameter<std::string>("intercalibConstantsFile","") ;
00190
00191 if (producedEcalIntercalibConstants_) {
00192 if(intercalibConstantsFile_ != "") {
00193 setWhatProduced (this, &EcalTrivialConditionRetriever::getIntercalibConstantsFromConfiguration ) ;
00194 } else {
00195 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalIntercalibConstants ) ;
00196 }
00197 findingRecord<EcalIntercalibConstantsRcd> () ;
00198 }
00199
00200 producedEcalIntercalibConstantsMC_ = ps.getUntrackedParameter<bool>("producedEcalIntercalibConstantsMC",true);
00201
00202 if (producedEcalIntercalibConstantsMC_) {
00203 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalIntercalibConstantsMC ) ;
00204 findingRecord<EcalIntercalibConstantsMCRcd> () ;
00205 }
00206
00207
00208 producedEcalIntercalibErrors_ = ps.getUntrackedParameter<bool>("producedEcalIntercalibErrors",true);
00209 intercalibErrorsFile_ = ps.getUntrackedParameter<std::string>("intercalibErrorsFile","") ;
00210
00211 if (producedEcalIntercalibErrors_) {
00212 if(intercalibErrorsFile_ != "") {
00213 setWhatProduced (this, &EcalTrivialConditionRetriever::getIntercalibErrorsFromConfiguration ) ;
00214 } else {
00215 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalIntercalibErrors ) ;
00216 }
00217 findingRecord<EcalIntercalibErrorsRcd> () ;
00218 }
00219
00220
00221 producedEcalTimeCalibConstants_ = ps.getUntrackedParameter<bool>("producedEcalTimeCalibConstants",true);
00222 timeCalibConstantsFile_ = ps.getUntrackedParameter<std::string>("timeCalibConstantsFile","") ;
00223
00224 if (producedEcalTimeCalibConstants_) {
00225 if(timeCalibConstantsFile_ != "") {
00226 setWhatProduced (this, &EcalTrivialConditionRetriever::getTimeCalibConstantsFromConfiguration ) ;
00227 } else {
00228 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalTimeCalibConstants ) ;
00229 }
00230 findingRecord<EcalTimeCalibConstantsRcd> () ;
00231 }
00232
00233
00234 producedEcalTimeCalibErrors_ = ps.getUntrackedParameter<bool>("producedEcalTimeCalibErrors",true);
00235 timeCalibErrorsFile_ = ps.getUntrackedParameter<std::string>("timeCalibErrorsFile","") ;
00236
00237 if (producedEcalTimeCalibErrors_) {
00238 if(timeCalibErrorsFile_ != "") {
00239 setWhatProduced (this, &EcalTrivialConditionRetriever::getTimeCalibErrorsFromConfiguration ) ;
00240 } else {
00241 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalTimeCalibErrors ) ;
00242 }
00243 findingRecord<EcalTimeCalibErrorsRcd> () ;
00244 }
00245
00246
00247 producedEcalClusterLocalContCorrParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterLocalContCorrParameters", false);
00248 producedEcalClusterCrackCorrParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterCrackCorrParameters", false);
00249 producedEcalClusterEnergyCorrectionParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterEnergyCorrectionParameters", false);
00250 producedEcalClusterEnergyUncertaintyParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterEnergyUncertaintyParameters", false);
00251 producedEcalClusterEnergyCorrectionObjectSpecificParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterEnergyCorrectionObjectSpecificParameters", false);
00252 if ( producedEcalClusterLocalContCorrParameters_ ) {
00253 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalClusterLocalContCorrParameters );
00254 findingRecord<EcalClusterLocalContCorrParametersRcd>();
00255 }
00256 if ( producedEcalClusterCrackCorrParameters_ ) {
00257 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalClusterCrackCorrParameters );
00258 findingRecord<EcalClusterCrackCorrParametersRcd>();
00259 }
00260 if ( producedEcalClusterEnergyCorrectionParameters_ ) {
00261 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalClusterEnergyCorrectionParameters );
00262 findingRecord<EcalClusterEnergyCorrectionParametersRcd>();
00263 }
00264 if ( producedEcalClusterEnergyUncertaintyParameters_ ) {
00265 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalClusterEnergyUncertaintyParameters );
00266 findingRecord<EcalClusterEnergyUncertaintyParametersRcd>();
00267 }
00268 if ( producedEcalClusterEnergyCorrectionObjectSpecificParameters_ ) {
00269 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalClusterEnergyCorrectionObjectSpecificParameters );
00270 findingRecord<EcalClusterEnergyCorrectionObjectSpecificParametersRcd>();
00271 }
00272
00273
00274 producedEcalLaserCorrection_ = ps.getUntrackedParameter<bool>("producedEcalLaserCorrection",true);
00275 if (producedEcalLaserCorrection_) {
00276
00277 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalLaserAlphas ) ;
00278 findingRecord<EcalLaserAlphasRcd> () ;
00279 getLaserAlphaFromFile_ = ps.getUntrackedParameter<bool>("getLaserAlphaFromFile",false);
00280 std::cout << " getLaserAlphaFromFile_ " << getLaserAlphaFromFile_ << std::endl;
00281 if(getLaserAlphaFromFile_) {
00282 EBLaserAlphaFile_ = ps.getUntrackedParameter<std::string>("EBLaserAlphaFile",path+"EBLaserAlpha.txt");
00283 EELaserAlphaFile_ = ps.getUntrackedParameter<std::string>("EELaserAlphaFile",path+"EELaserAlpha.txt");
00284 std::cout << " EELaserAlphaFile_ " << EELaserAlphaFile_.c_str() << std::endl;
00285 }
00286 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalLaserAPDPNRatiosRef ) ;
00287 findingRecord<EcalLaserAPDPNRatiosRefRcd> () ;
00288 setWhatProduced (this, &EcalTrivialConditionRetriever::produceEcalLaserAPDPNRatios) ;
00289 findingRecord<EcalLaserAPDPNRatiosRcd> () ;
00290 }
00291
00292
00293 producedEcalChannelStatus_ = ps.getUntrackedParameter<bool>("producedEcalChannelStatus",true);
00294 channelStatusFile_ = ps.getUntrackedParameter<std::string>("channelStatusFile","");
00295
00296 if ( producedEcalChannelStatus_ ) {
00297 if ( channelStatusFile_ != "" ) {
00298 setWhatProduced( this, &EcalTrivialConditionRetriever::getChannelStatusFromConfiguration );
00299 } else {
00300 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalChannelStatus );
00301 }
00302 findingRecord<EcalChannelStatusRcd>();
00303 }
00304
00305 producedEcalDQMChannelStatus_ = ps.getUntrackedParameter<bool>("producedEcalDQMChannelStatus",true);
00306 if ( producedEcalDQMChannelStatus_ ) {
00307 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalDQMChannelStatus );
00308 findingRecord<EcalDQMChannelStatusRcd>();
00309 }
00310
00311 producedEcalDCSTowerStatus_ = ps.getUntrackedParameter<bool>("producedEcalDCSTowerStatus",true);
00312 if ( producedEcalDCSTowerStatus_ ) {
00313 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalDCSTowerStatus );
00314 findingRecord<EcalDCSTowerStatusRcd>();
00315 }
00316
00317 producedEcalDAQTowerStatus_ = ps.getUntrackedParameter<bool>("producedEcalDAQTowerStatus",true);
00318 if ( producedEcalDAQTowerStatus_ ) {
00319 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalDAQTowerStatus );
00320 findingRecord<EcalDAQTowerStatusRcd>();
00321 }
00322
00323 producedEcalDQMTowerStatus_ = ps.getUntrackedParameter<bool>("producedEcalDQMTowerStatus",true);
00324 if ( producedEcalDQMTowerStatus_ ) {
00325 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalDQMTowerStatus );
00326 findingRecord<EcalDQMTowerStatusRcd>();
00327 }
00328
00329
00330 producedEcalTrgChannelStatus_ = ps.getUntrackedParameter<bool>("producedEcalTrgChannelStatus",true);
00331 trgChannelStatusFile_ = ps.getUntrackedParameter<std::string>("trgChannelStatusFile","");
00332
00333 if ( producedEcalTrgChannelStatus_ ) {
00334 if ( trgChannelStatusFile_ != "" ) {
00335 setWhatProduced( this, &EcalTrivialConditionRetriever::getTrgChannelStatusFromConfiguration );
00336 } else {
00337 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalTrgChannelStatus );
00338 }
00339 findingRecord<EcalTPGCrystalStatusRcd>();
00340 }
00341
00342
00343 producedEcalAlignmentEB_ = ps.getUntrackedParameter<bool>("producedEcalAlignmentEB",true);
00344 if ( producedEcalAlignmentEB_ ) {
00345 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalAlignmentEB );
00346 findingRecord<EBAlignmentRcd>();
00347 }
00348 producedEcalAlignmentEE_ = ps.getUntrackedParameter<bool>("producedEcalAlignmentEE",true);
00349 if ( producedEcalAlignmentEE_ ) {
00350 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalAlignmentEE );
00351 findingRecord<EEAlignmentRcd>();
00352 }
00353 producedEcalAlignmentES_ = ps.getUntrackedParameter<bool>("producedEcalAlignmentES",true);
00354 if ( producedEcalAlignmentES_ ) {
00355 setWhatProduced( this, &EcalTrivialConditionRetriever::produceEcalAlignmentES );
00356 findingRecord<ESAlignmentRcd>();
00357 }
00358
00359 if (producedEcalPedestals_) findingRecord<EcalPedestalsRcd>();
00360
00361 if (producedEcalWeights_) {
00362 findingRecord<EcalWeightXtalGroupsRcd>();
00363 findingRecord<EcalTBWeightsRcd>();
00364 }
00365
00366 if (producedEcalGainRatios_) findingRecord<EcalGainRatiosRcd>();
00367
00368 if (producedEcalADCToGeVConstant_) findingRecord<EcalADCToGeVConstantRcd>();
00369
00370 }
00371
00372 EcalTrivialConditionRetriever::~EcalTrivialConditionRetriever()
00373 {
00374 }
00375
00376
00377
00378
00379 void
00380 EcalTrivialConditionRetriever::setIntervalFor( const edm::eventsetup::EventSetupRecordKey& rk,
00381 const edm::IOVSyncValue& iTime,
00382 edm::ValidityInterval& oValidity)
00383 {
00384 if(verbose_>=1) std::cout << "EcalTrivialConditionRetriever::setIntervalFor(): record key = " << rk.name() << "\ttime: " << iTime.time().value() << std::endl;
00385
00386 oValidity = edm::ValidityInterval( edm::IOVSyncValue::beginOfTime(),edm::IOVSyncValue::endOfTime() );
00387 }
00388
00389
00390 std::auto_ptr<EcalPedestals>
00391 EcalTrivialConditionRetriever::produceEcalPedestals( const EcalPedestalsRcd& ) {
00392 std::auto_ptr<EcalPedestals> peds = std::auto_ptr<EcalPedestals>( new EcalPedestals() );
00393 EcalPedestals::Item EBitem;
00394 EcalPedestals::Item EEitem;
00395
00396 EBitem.mean_x1 = EBpedMeanX1_;
00397 EBitem.rms_x1 = EBpedRMSX1_;
00398 EBitem.mean_x6 = EBpedMeanX6_;
00399 EBitem.rms_x6 = EBpedRMSX6_;
00400 EBitem.mean_x12 = EBpedMeanX12_;
00401 EBitem.rms_x12 = EBpedRMSX12_;
00402
00403 EEitem.mean_x1 = EEpedMeanX1_;
00404 EEitem.rms_x1 = EEpedRMSX1_;
00405 EEitem.mean_x6 = EEpedMeanX6_;
00406 EEitem.rms_x6 = EEpedRMSX6_;
00407 EEitem.mean_x12 = EEpedMeanX12_;
00408 EEitem.rms_x12 = EEpedRMSX12_;
00409
00410 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
00411 if(iEta==0) continue;
00412 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
00413
00414 if (EBDetId::validDetId(iEta,iPhi))
00415 {
00416 EBDetId ebdetid(iEta,iPhi);
00417 peds->insert(std::make_pair(ebdetid.rawId(),EBitem));
00418 }
00419 }
00420 }
00421
00422 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00423 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00424
00425 if (EEDetId::validDetId(iX,iY,1))
00426 {
00427 EEDetId eedetidpos(iX,iY,1);
00428 peds->insert(std::make_pair(eedetidpos.rawId(),EEitem));
00429 }
00430 if(EEDetId::validDetId(iX,iY,-1))
00431 {
00432 EEDetId eedetidneg(iX,iY,-1);
00433 peds->insert(std::make_pair(eedetidneg.rawId(),EEitem));
00434 }
00435 }
00436 }
00437
00438
00439 return peds;
00440 }
00441
00442 std::auto_ptr<EcalWeightXtalGroups>
00443 EcalTrivialConditionRetriever::produceEcalWeightXtalGroups( const EcalWeightXtalGroupsRcd& )
00444 {
00445 std::auto_ptr<EcalWeightXtalGroups> xtalGroups = std::auto_ptr<EcalWeightXtalGroups>( new EcalWeightXtalGroups() );
00446 EcalXtalGroupId defaultGroupId(1);
00447 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
00448 if(ieta==0) continue;
00449 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00450
00451 if (EBDetId::validDetId(ieta,iphi))
00452 {
00453 EBDetId ebid(ieta,iphi);
00454
00455 xtalGroups->setValue(ebid.rawId(), defaultGroupId );
00456 }
00457 }
00458 }
00459
00460 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00461 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00462
00463 if (EEDetId::validDetId(iX,iY,1))
00464 {
00465 EEDetId eedetidpos(iX,iY,1);
00466 xtalGroups->setValue(eedetidpos.rawId(), defaultGroupId );
00467 }
00468 if(EEDetId::validDetId(iX,iY,-1))
00469 {
00470 EEDetId eedetidneg(iX,iY,-1);
00471 xtalGroups->setValue(eedetidneg.rawId(), defaultGroupId );
00472 }
00473 }
00474 }
00475 return xtalGroups;
00476 }
00477
00478 std::auto_ptr<EcalIntercalibConstants>
00479 EcalTrivialConditionRetriever::produceEcalIntercalibConstants( const EcalIntercalibConstantsRcd& )
00480 {
00481 std::auto_ptr<EcalIntercalibConstants> ical = std::auto_ptr<EcalIntercalibConstants>( new EcalIntercalibConstants() );
00482
00483 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
00484 if(ieta==0) continue;
00485 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00486
00487 if (EBDetId::validDetId(ieta,iphi))
00488 {
00489 EBDetId ebid(ieta,iphi);
00490 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00491 ical->setValue( ebid.rawId(), intercalibConstantMean_ + r*intercalibConstantSigma_ );
00492 }
00493 }
00494 }
00495
00496 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00497 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00498
00499 if (EEDetId::validDetId(iX,iY,1))
00500 {
00501 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00502 EEDetId eedetidpos(iX,iY,1);
00503 ical->setValue( eedetidpos.rawId(), intercalibConstantMean_ + r*intercalibConstantSigma_ );
00504 }
00505 if(EEDetId::validDetId(iX,iY,-1))
00506 {
00507 double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
00508 EEDetId eedetidneg(iX,iY,-1);
00509 ical->setValue( eedetidneg.rawId(), intercalibConstantMean_ + r1*intercalibConstantSigma_ );
00510 }
00511 }
00512 }
00513
00514 return ical;
00515 }
00516
00517 std::auto_ptr<EcalIntercalibConstantsMC>
00518 EcalTrivialConditionRetriever::produceEcalIntercalibConstantsMC( const EcalIntercalibConstantsMCRcd& )
00519 {
00520 std::auto_ptr<EcalIntercalibConstantsMC> ical = std::auto_ptr<EcalIntercalibConstantsMC>( new EcalIntercalibConstantsMC() );
00521
00522 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
00523 if(ieta==0) continue;
00524 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00525
00526 if (EBDetId::validDetId(ieta,iphi))
00527 {
00528 EBDetId ebid(ieta,iphi);
00529 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00530 ical->setValue( ebid.rawId(), intercalibConstantMeanMC_ + r*intercalibConstantSigmaMC_ );
00531 }
00532 }
00533 }
00534
00535 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00536 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00537
00538 if (EEDetId::validDetId(iX,iY,1))
00539 {
00540 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00541 EEDetId eedetidpos(iX,iY,1);
00542 ical->setValue( eedetidpos.rawId(), intercalibConstantMeanMC_ + r*intercalibConstantSigmaMC_ );
00543 }
00544 if(EEDetId::validDetId(iX,iY,-1))
00545 {
00546 double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
00547 EEDetId eedetidneg(iX,iY,-1);
00548 ical->setValue( eedetidneg.rawId(), intercalibConstantMeanMC_ + r1*intercalibConstantSigmaMC_ );
00549 }
00550 }
00551 }
00552
00553 return ical;
00554 }
00555
00556 std::auto_ptr<EcalIntercalibErrors>
00557 EcalTrivialConditionRetriever::produceEcalIntercalibErrors( const EcalIntercalibErrorsRcd& )
00558 {
00559 std::auto_ptr<EcalIntercalibErrors> ical = std::auto_ptr<EcalIntercalibErrors>( new EcalIntercalibErrors() );
00560
00561 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
00562 if(ieta==0) continue;
00563 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00564
00565 if (EBDetId::validDetId(ieta,iphi))
00566 {
00567 EBDetId ebid(ieta,iphi);
00568 ical->setValue( ebid.rawId(), intercalibErrorMean_);
00569 }
00570 }
00571 }
00572
00573 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00574 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00575
00576 if (EEDetId::validDetId(iX,iY,1))
00577 {
00578 EEDetId eedetidpos(iX,iY,1);
00579 ical->setValue( eedetidpos.rawId(), intercalibErrorMean_ );
00580 }
00581 if(EEDetId::validDetId(iX,iY,-1))
00582 {
00583 EEDetId eedetidneg(iX,iY,-1);
00584 ical->setValue( eedetidneg.rawId(), intercalibErrorMean_ );
00585 }
00586 }
00587 }
00588
00589 return ical;
00590 }
00591
00592 std::auto_ptr<EcalTimeCalibConstants>
00593 EcalTrivialConditionRetriever::produceEcalTimeCalibConstants( const EcalTimeCalibConstantsRcd& )
00594 {
00595 std::auto_ptr<EcalTimeCalibConstants> ical = std::auto_ptr<EcalTimeCalibConstants>( new EcalTimeCalibConstants() );
00596
00597 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
00598 if(ieta==0) continue;
00599 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00600
00601 if (EBDetId::validDetId(ieta,iphi))
00602 {
00603 EBDetId ebid(ieta,iphi);
00604 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00605 ical->setValue( ebid.rawId(), timeCalibConstantMean_ + r*timeCalibConstantSigma_ );
00606 }
00607 }
00608 }
00609
00610 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00611 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00612
00613 if (EEDetId::validDetId(iX,iY,1))
00614 {
00615 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00616 EEDetId eedetidpos(iX,iY,1);
00617 ical->setValue( eedetidpos.rawId(), timeCalibConstantMean_ + r*timeCalibConstantSigma_ );
00618 }
00619 if(EEDetId::validDetId(iX,iY,-1))
00620 {
00621 double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
00622 EEDetId eedetidneg(iX,iY,-1);
00623 ical->setValue( eedetidneg.rawId(), timeCalibConstantMean_ + r1*timeCalibConstantSigma_ );
00624 }
00625 }
00626 }
00627
00628 return ical;
00629 }
00630
00631 std::auto_ptr<EcalTimeCalibErrors>
00632 EcalTrivialConditionRetriever::produceEcalTimeCalibErrors( const EcalTimeCalibErrorsRcd& )
00633 {
00634 std::auto_ptr<EcalTimeCalibErrors> ical = std::auto_ptr<EcalTimeCalibErrors>( new EcalTimeCalibErrors() );
00635
00636 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
00637 if(ieta==0) continue;
00638 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00639
00640 if (EBDetId::validDetId(ieta,iphi))
00641 {
00642 EBDetId ebid(ieta,iphi);
00643 ical->setValue( ebid.rawId(), timeCalibErrorMean_);
00644 }
00645 }
00646 }
00647
00648 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00649 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00650
00651 if (EEDetId::validDetId(iX,iY,1))
00652 {
00653 EEDetId eedetidpos(iX,iY,1);
00654 ical->setValue( eedetidpos.rawId(), timeCalibErrorMean_ );
00655 }
00656 if(EEDetId::validDetId(iX,iY,-1))
00657 {
00658 EEDetId eedetidneg(iX,iY,-1);
00659 ical->setValue( eedetidneg.rawId(), timeCalibErrorMean_ );
00660 }
00661 }
00662 }
00663
00664 return ical;
00665 }
00666
00667 std::auto_ptr<EcalTimeOffsetConstant>
00668 EcalTrivialConditionRetriever::produceEcalTimeOffsetConstant( const EcalTimeOffsetConstantRcd& )
00669 {
00670 std::cout << " produceEcalTimeOffsetConstant: " << std::endl;
00671 std::cout << " EB " << timeOffsetEBConstant_ << " EE " << timeOffsetEEConstant_<< std::endl;
00672 return std::auto_ptr<EcalTimeOffsetConstant>( new EcalTimeOffsetConstant(timeOffsetEBConstant_,timeOffsetEEConstant_) );
00673 }
00674
00675 std::auto_ptr<EcalGainRatios>
00676 EcalTrivialConditionRetriever::produceEcalGainRatios( const EcalGainRatiosRcd& )
00677 {
00678 std::auto_ptr<EcalGainRatios> gratio = std::auto_ptr<EcalGainRatios>( new EcalGainRatios() );
00679 EcalMGPAGainRatio gr;
00680 gr.setGain12Over6( gainRatio12over6_ );
00681 gr.setGain6Over1( gainRatio6over1_ );
00682
00683 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
00684 if(ieta==0) continue;
00685 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00686 if (EBDetId::validDetId(ieta,iphi))
00687 {
00688 EBDetId ebid(ieta,iphi);
00689 gratio->setValue( ebid.rawId(), gr );
00690 }
00691 }
00692 }
00693
00694 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00695 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00696
00697 if (EEDetId::validDetId(iX,iY,1))
00698 {
00699 EEDetId eedetidpos(iX,iY,1);
00700 gratio->setValue( eedetidpos.rawId(), gr );
00701 }
00702 if (EEDetId::validDetId(iX,iY,-1))
00703 {
00704 EEDetId eedetidneg(iX,iY,-1);
00705 gratio->setValue( eedetidneg.rawId(), gr );
00706 }
00707 }
00708 }
00709
00710 return gratio;
00711 }
00712
00713 std::auto_ptr<EcalADCToGeVConstant>
00714 EcalTrivialConditionRetriever::produceEcalADCToGeVConstant( const EcalADCToGeVConstantRcd& )
00715 {
00716 return std::auto_ptr<EcalADCToGeVConstant>( new EcalADCToGeVConstant(adcToGeVEBConstant_,adcToGeVEEConstant_) );
00717 }
00718
00719 std::auto_ptr<EcalTBWeights>
00720 EcalTrivialConditionRetriever::produceEcalTBWeights( const EcalTBWeightsRcd& )
00721 {
00722
00723 std::auto_ptr<EcalTBWeights> tbwgt = std::auto_ptr<EcalTBWeights>( new EcalTBWeights() );
00724
00725
00726
00727
00728
00729 int igrp=1;
00730 for(int itdc=1; itdc<=nTDCbins_; ++itdc) {
00731
00732
00733
00734
00735 EcalWeightSet wgt;
00736
00737 EcalWeightSet::EcalWeightMatrix& mat1 = wgt.getWeightsBeforeGainSwitch();
00738 EcalWeightSet::EcalWeightMatrix& mat2 = wgt.getWeightsAfterGainSwitch();
00739
00740
00741
00742
00743
00744
00745
00760
00761 mat1.Place_in_row(amplWeights_[itdc-1],0,0);
00762 mat1.Place_in_row(pedWeights_[itdc-1],1,0);
00763 mat1.Place_in_row(jittWeights_[itdc-1],2,0);
00764
00765
00766 mat2.Place_in_row(amplWeightsAft_[itdc-1],0,0);
00767 mat2.Place_in_row(pedWeightsAft_[itdc-1],1,0);
00768 mat2.Place_in_row(jittWeightsAft_[itdc-1],2,0);
00769
00770
00771
00772 EcalWeightSet::EcalChi2WeightMatrix& mat3 = wgt.getChi2WeightsBeforeGainSwitch();
00773 EcalWeightSet::EcalChi2WeightMatrix& mat4 = wgt.getChi2WeightsAfterGainSwitch();
00774 mat3=chi2Matrix_[itdc-1];
00775 mat4=chi2MatrixAft_[itdc-1];
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800 tbwgt->setValue(std::make_pair(igrp,itdc), wgt);
00801 }
00802
00803 return tbwgt;
00804 }
00805
00806
00807
00808 std::auto_ptr<EcalClusterLocalContCorrParameters>
00809 EcalTrivialConditionRetriever::produceEcalClusterLocalContCorrParameters( const EcalClusterLocalContCorrParametersRcd &)
00810 {
00811 std::auto_ptr<EcalClusterLocalContCorrParameters> ipar = std::auto_ptr<EcalClusterLocalContCorrParameters>( new EcalClusterLocalContCorrParameters() );
00812 for (size_t i = 0; i < localContCorrParameters_.size(); ++i ) {
00813 ipar->params().push_back( localContCorrParameters_[i] );
00814 }
00815 return ipar;
00816 }
00817 std::auto_ptr<EcalClusterCrackCorrParameters>
00818 EcalTrivialConditionRetriever::produceEcalClusterCrackCorrParameters( const EcalClusterCrackCorrParametersRcd &)
00819 {
00820 std::auto_ptr<EcalClusterCrackCorrParameters> ipar = std::auto_ptr<EcalClusterCrackCorrParameters>( new EcalClusterCrackCorrParameters() );
00821 for (size_t i = 0; i < crackCorrParameters_.size(); ++i ) {
00822 ipar->params().push_back( crackCorrParameters_[i] );
00823 }
00824 return ipar;
00825 }
00826 std::auto_ptr<EcalClusterEnergyCorrectionParameters>
00827 EcalTrivialConditionRetriever::produceEcalClusterEnergyCorrectionParameters( const EcalClusterEnergyCorrectionParametersRcd &)
00828 {
00829 std::auto_ptr<EcalClusterEnergyCorrectionParameters> ipar = std::auto_ptr<EcalClusterEnergyCorrectionParameters>( new EcalClusterEnergyCorrectionParameters() );
00830 for (size_t i = 0; i < energyCorrectionParameters_.size(); ++i ) {
00831 ipar->params().push_back( energyCorrectionParameters_[i] );
00832 }
00833 return ipar;
00834 }
00835 std::auto_ptr<EcalClusterEnergyUncertaintyParameters>
00836 EcalTrivialConditionRetriever::produceEcalClusterEnergyUncertaintyParameters( const EcalClusterEnergyUncertaintyParametersRcd &)
00837 {
00838 std::auto_ptr<EcalClusterEnergyUncertaintyParameters> ipar = std::auto_ptr<EcalClusterEnergyUncertaintyParameters>( new EcalClusterEnergyUncertaintyParameters() );
00839 for (size_t i = 0; i < energyUncertaintyParameters_.size(); ++i ) {
00840 ipar->params().push_back( energyUncertaintyParameters_[i] );
00841 }
00842 return ipar;
00843 }
00844 std::auto_ptr<EcalClusterEnergyCorrectionObjectSpecificParameters>
00845 EcalTrivialConditionRetriever::produceEcalClusterEnergyCorrectionObjectSpecificParameters( const EcalClusterEnergyCorrectionObjectSpecificParametersRcd &)
00846 {
00847 std::auto_ptr<EcalClusterEnergyCorrectionObjectSpecificParameters> ipar = std::auto_ptr<EcalClusterEnergyCorrectionObjectSpecificParameters>( new EcalClusterEnergyCorrectionObjectSpecificParameters() );
00848 for (size_t i = 0; i < energyCorrectionObjectSpecificParameters_.size(); ++i ) {
00849 ipar->params().push_back( energyCorrectionObjectSpecificParameters_[i] );
00850 }
00851 return ipar;
00852 }
00853
00854
00855
00856 std::auto_ptr<EcalLaserAlphas>
00857 EcalTrivialConditionRetriever::produceEcalLaserAlphas( const EcalLaserAlphasRcd& )
00858 {
00859
00860 std::cout << " produceEcalLaserAlphas " << std::endl;
00861 std::auto_ptr<EcalLaserAlphas> ical = std::auto_ptr<EcalLaserAlphas>( new EcalLaserAlphas() );
00862 if(getLaserAlphaFromFile_) {
00863 std::ifstream fEB(edm::FileInPath(EBLaserAlphaFile_).fullPath().c_str());
00864 int SMpos[36] = {-10, 4, -7, -16, 6, -9, 11, -17, 5, 18, 3, -8, 1, -3, -13, 14, -6, 2,
00865 15, -18, 8, 17, -2, 9, -1, 10, -5, 7, -12, -11, 16, -4, -15, -14, 12, 13};
00866
00867 int SMCal[36] = {12,17,10, 1, 8, 4,27,20,23,25, 6,34,35,15,18,30,21, 9,
00868 24,22,13,31,26,16, 2,11, 5, 0,29,28,14,33,32, 3, 7,19};
00869
00870
00871
00872
00873
00874
00875 for(int SMcons = 0; SMcons < 36; SMcons++) {
00876 int SM = SMpos[SMcons];
00877 if(SM < 0) SM = 17 + abs(SM);
00878 else SM--;
00879 if(SMCal[SM] != SMcons)
00880 std::cout << " SM pb : read SM " << SMcons<< " SMpos " << SM
00881 << " SMCal " << SMCal[SM] << std::endl;
00882 }
00883
00884 std::string type, batch;
00885 int readSM, pos, bar, bar2;
00886 float alpha = 0;
00887 for(int SMcons = 0; SMcons < 36; SMcons++) {
00888 int SM = SMpos[SMcons];
00889 for(int ic = 0; ic < 1700; ic++) {
00890 fEB >> readSM >> pos >> bar >> bar2 >> type >> batch;
00891
00892
00893 if(readSM != SMcons || pos != ic + 1)
00894 std::cout << " barrel read pb read SM " << readSM << " const SM " << SMcons
00895 << " read pos " << pos << " ic " << ic << std::endl;
00896 if(SM < 0) SM = 18 + abs(SM);
00897 EBDetId ebdetid(SM, pos, EBDetId::SMCRYSTALMODE);
00898 if(bar == 33101 || bar == 30301 )
00899 alpha = 1.52;
00900 else if(bar == 33106) {
00901 if(bar2 <= 2000)
00902 alpha = 1.0;
00903 else {
00904 std::cout << " problem with barcode first " << bar << " last " << bar2
00905 << " read SM " << readSM << " read pos " << pos << std::endl;
00906 alpha = 0.0;
00907 }
00908 }
00909 ical->setValue( ebdetid, alpha );
00910 }
00911 }
00912 }
00913 else {
00914 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
00915 if(ieta==0) continue;
00916 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00917 if (EBDetId::validDetId(ieta,iphi)) {
00918 EBDetId ebid(ieta,iphi);
00919 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00920 ical->setValue( ebid, laserAlphaMean_ + r*laserAlphaSigma_ );
00921 }
00922 }
00923 }
00924 }
00925
00926 std::cout << " produceEcalLaserAlphas EE" << std::endl;
00927 if(getLaserAlphaFromFile_) {
00928 std::ifstream fEE(edm::FileInPath(EELaserAlphaFile_).fullPath().c_str());
00929 int check[101][101];
00930 for(int x = 1; x < 101; x++)
00931 for(int y = 1; y < 101; y++)
00932 check[x][y] = -1;
00933 for(int crystal = 0; crystal < 14648; crystal++) {
00934 int x, y ,z, bid, bar, bar2;
00935 float LY, alpha = 0;
00936 fEE >> z >> x >> y >> LY >> bid >> bar >> bar2;
00937 if(x < 1 || x > 100 || y < 1 || y > 100)
00938 std::cout << " wrong coordinates for barcode " << bar
00939 << " x " << x << " y " << y << " z " << z << std::endl;
00940 else {
00941 if(z == 1) check[x][y] = 1;
00942 else check[x][y] = 0;
00943 if(bar == 33201 || (bar == 30399 && bar2 < 568))
00944 alpha = 1.52;
00945 else if((bar == 33106 && bar2 > 2000 && bar2 < 4669)
00946 || (bar == 30399 && bar2 > 567))
00947 alpha = 1.0;
00948 else {
00949 std::cout << " problem with barcode " << bar << " " << bar2
00950 << " x " << x << " y " << y << " z " << z << std::endl;
00951 alpha = 0.0;
00952 }
00953 }
00954 if (EEDetId::validDetId(x, y, z)) {
00955 EEDetId eedetidpos(x, y, z);
00956 ical->setValue( eedetidpos, alpha );
00957 }
00958 else
00959 std::cout << " problem with EEDetId " << " x " << x << " y " << y << " z " << z << std::endl;
00960 }
00961 for(int x = 1; x < 101; x++)
00962 for(int y = 1; y < 101; y++)
00963 if(check[x][y] == 1) std::cout << " missing x " << x << " y " << y << std::endl;
00964 }
00965 else {
00966 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00967 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00968
00969 if (EEDetId::validDetId(iX,iY,1)) {
00970 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00971 EEDetId eedetidpos(iX,iY,1);
00972 ical->setValue( eedetidpos, laserAlphaMean_ + r*laserAlphaSigma_ );
00973 }
00974
00975 if (EEDetId::validDetId(iX,iY,-1)) {
00976 double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
00977 EEDetId eedetidneg(iX,iY,-1);
00978 ical->setValue( eedetidneg, laserAlphaMean_ + r1*laserAlphaSigma_ );
00979 }
00980 }
00981 }
00982 }
00983
00984 return ical;
00985 }
00986
00987
00988 std::auto_ptr<EcalLaserAPDPNRatiosRef>
00989 EcalTrivialConditionRetriever::produceEcalLaserAPDPNRatiosRef( const EcalLaserAPDPNRatiosRefRcd& )
00990 {
00991 std::auto_ptr<EcalLaserAPDPNRatiosRef> ical = std::auto_ptr<EcalLaserAPDPNRatiosRef>( new EcalLaserAPDPNRatiosRef() );
00992 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
00993 if(ieta==0) continue;
00994 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
00995 if (EBDetId::validDetId(ieta,iphi)) {
00996 EBDetId ebid(ieta,iphi);
00997 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
00998 ical->setValue( ebid, laserAPDPNRefMean_ + r*laserAPDPNRefSigma_ );
00999 }
01000 }
01001 }
01002
01003 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
01004 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
01005
01006 if (EEDetId::validDetId(iX,iY,1)) {
01007 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
01008 EEDetId eedetidpos(iX,iY,1);
01009 ical->setValue( eedetidpos, laserAPDPNRefMean_ + r*laserAPDPNRefSigma_ );
01010 }
01011
01012 if (EEDetId::validDetId(iX,iY,-1)) {
01013 double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
01014 EEDetId eedetidneg(iX,iY,-1);
01015 ical->setValue( eedetidneg, laserAPDPNRefMean_ + r1*laserAPDPNRefSigma_ );
01016 }
01017 }
01018 }
01019
01020 return ical;
01021 }
01022
01023
01024 std::auto_ptr<EcalLaserAPDPNRatios>
01025 EcalTrivialConditionRetriever::produceEcalLaserAPDPNRatios( const EcalLaserAPDPNRatiosRcd& )
01026 {
01027
01028 std::auto_ptr<EcalLaserAPDPNRatios> ical = std::auto_ptr<EcalLaserAPDPNRatios>( new EcalLaserAPDPNRatios() );
01029 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
01030 if(ieta==0) continue;
01031 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
01032 if (EBDetId::validDetId(ieta,iphi)) {
01033 EBDetId ebid(ieta,iphi);
01034 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
01035
01036 EcalLaserAPDPNRatios::EcalLaserAPDPNpair pairAPDPN;
01037 pairAPDPN.p1 = laserAPDPNMean_ + r*laserAPDPNSigma_;
01038 pairAPDPN.p2 = laserAPDPNMean_ + r*laserAPDPNSigma_;
01039 pairAPDPN.p3 = laserAPDPNMean_ + r*laserAPDPNSigma_;
01040 ical->setValue( ebid, pairAPDPN );
01041 }
01042 }
01043 }
01044
01045 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
01046 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
01047
01048 if (EEDetId::validDetId(iX,iY,1)) {
01049 double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
01050 EEDetId eedetidpos(iX,iY,1);
01051
01052 EcalLaserAPDPNRatios::EcalLaserAPDPNpair pairAPDPN;
01053 pairAPDPN.p1 = laserAPDPNMean_ + r*laserAPDPNSigma_;
01054 pairAPDPN.p2 = laserAPDPNMean_ + r*laserAPDPNSigma_;
01055 pairAPDPN.p3 = laserAPDPNMean_ + r*laserAPDPNSigma_;
01056 ical->setValue( eedetidpos, pairAPDPN );
01057 }
01058
01059 if (EEDetId::validDetId(iX,iY,-1)) {
01060 double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
01061 EEDetId eedetidneg(iX,iY,-1);
01062
01063 EcalLaserAPDPNRatios::EcalLaserAPDPNpair pairAPDPN;
01064 pairAPDPN.p1 = laserAPDPNMean_ + r1*laserAPDPNSigma_;
01065 pairAPDPN.p2 = laserAPDPNMean_ + r1*laserAPDPNSigma_;
01066 pairAPDPN.p3 = laserAPDPNMean_ + r1*laserAPDPNSigma_;
01067 ical->setValue( eedetidneg, pairAPDPN );
01068 }
01069 }
01070 }
01071
01072 EcalLaserAPDPNRatios::EcalLaserTimeStamp TimeStamp;
01073
01074 for(int i=0; i<92; i++){
01075 TimeStamp.t1 = Timestamp(laserAPDPNTime1_);
01076 if(laserAPDPNTime2_ == 0 ){
01077 TimeStamp.t2 = Timestamp(edm::Timestamp::endOfTime().value());
01078 } else {
01079 TimeStamp.t2 = Timestamp(laserAPDPNTime2_);
01080 }
01081 if(laserAPDPNTime3_ == 0 ){
01082 TimeStamp.t3 = Timestamp(edm::Timestamp::endOfTime().value());
01083 } else {
01084 TimeStamp.t3 = Timestamp(laserAPDPNTime3_);
01085 }
01086
01087 ical->setTime( i, TimeStamp );
01088 }
01089
01090 return ical;
01091
01092 }
01093
01094
01095 void EcalTrivialConditionRetriever::getWeightsFromConfiguration(const edm::ParameterSet& ps)
01096 {
01097
01098 std::vector < std::vector<double> > amplwgtv(nTDCbins_);
01099
01100 if (!getWeightsFromFile_ && nTDCbins_ == 1)
01101 {
01102 std::vector<double> vampl;
01103
01104 vampl.push_back( -0.33333 );
01105 vampl.push_back( -0.33333 );
01106 vampl.push_back( -0.33333 );
01107 vampl.push_back( 0. );
01108 vampl.push_back( 0. );
01109 vampl.push_back( 1. );
01110 vampl.push_back( 0. );
01111 vampl.push_back( 0. );
01112 vampl.push_back( 0. );
01113 vampl.push_back( 0. );
01114 amplwgtv[0]= ps.getUntrackedParameter< std::vector<double> >("amplWeights", vampl);
01115 }
01116 else if (getWeightsFromFile_)
01117 {
01118 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading amplitude weights from file " << edm::FileInPath(amplWeightsFile_).fullPath().c_str() ;
01119 std::ifstream amplFile(edm::FileInPath(amplWeightsFile_).fullPath().c_str());
01120 int tdcBin=0;
01121 while (!amplFile.eof() && tdcBin < nTDCbins_)
01122 {
01123 for(int j = 0; j < 10; ++j) {
01124 float ww;
01125 amplFile >> ww;
01126 amplwgtv[tdcBin].push_back(ww);
01127 }
01128 ++tdcBin;
01129 }
01130 assert (tdcBin == nTDCbins_);
01131
01132 }
01133 else
01134 {
01135
01136 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01137 throw cms::Exception("WrongConfig");
01138 }
01139
01140
01141 for (int i=0;i<nTDCbins_;i++)
01142 {
01143 assert(amplwgtv[i].size() == 10);
01144 int j=0;
01145 for(std::vector<double>::const_iterator it = amplwgtv[i].begin(); it != amplwgtv[i].end(); ++it)
01146 {
01147 (amplWeights_[i])[j]=*it;
01148 j++;
01149 }
01150 }
01151
01152
01153 std::vector < std::vector<double> > amplwgtvAftGain(nTDCbins_);
01154
01155 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
01156 {
01157 std::vector<double> vamplAftGain;
01158 vamplAftGain.push_back( 0. );
01159 vamplAftGain.push_back( 0. );
01160 vamplAftGain.push_back( 0. );
01161 vamplAftGain.push_back( 0. );
01162 vamplAftGain.push_back( 0. );
01163 vamplAftGain.push_back( 1. );
01164 vamplAftGain.push_back( 0. );
01165 vamplAftGain.push_back( 0. );
01166 vamplAftGain.push_back( 0. );
01167 vamplAftGain.push_back( 0. );
01168 amplwgtvAftGain[0] = ps.getUntrackedParameter< std::vector<double> >("amplWeightsAftGain", vamplAftGain);
01169 }
01170 else if (getWeightsFromFile_)
01171 {
01172
01173 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading amplitude weights aftre gain switch from file " << edm::FileInPath(amplWeightsAftFile_).fullPath().c_str() ;
01174 std::ifstream amplFile(edm::FileInPath(amplWeightsAftFile_).fullPath().c_str());
01175 int tdcBin=0;
01176 while (!amplFile.eof() && tdcBin < nTDCbins_)
01177 {
01178 for(int j = 0; j < 10; ++j) {
01179 float ww;
01180 amplFile >> ww;
01181 amplwgtvAftGain[tdcBin].push_back(ww);
01182 }
01183 ++tdcBin;
01184 }
01185 assert (tdcBin == nTDCbins_);
01186 }
01187 else
01188 {
01189
01190 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01191 throw cms::Exception("WrongConfig");
01192 }
01193
01194 for (int i=0;i<nTDCbins_;i++)
01195 {
01196 assert(amplwgtvAftGain[i].size() == 10);
01197 int j=0;
01198 for(std::vector<double>::const_iterator it = amplwgtvAftGain[i].begin(); it != amplwgtvAftGain[i].end(); ++it) {
01199 (amplWeightsAft_[i])[j]=*it;
01200 j++;
01201 }
01202 }
01203
01204
01205
01206 std::vector< std::vector<double> > pedwgtv(nTDCbins_);
01207
01208 if (!getWeightsFromFile_ && nTDCbins_ == 1)
01209 {
01210 std::vector<double> vped;
01211 vped.push_back( 0.33333 );
01212 vped.push_back( 0.33333 );
01213 vped.push_back( 0.33333 );
01214 vped.push_back( 0. );
01215 vped.push_back( 0. );
01216 vped.push_back( 0. );
01217 vped.push_back( 0. );
01218 vped.push_back( 0. );
01219 vped.push_back( 0. );
01220 vped.push_back( 0. );
01221 pedwgtv[0] = ps.getUntrackedParameter< std::vector<double> >("pedWeights", vped);
01222 }
01223 else if (getWeightsFromFile_)
01224 {
01225
01226 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading pedestal weights from file " << edm::FileInPath(pedWeightsFile_).fullPath().c_str() ;
01227 std::ifstream pedFile(edm::FileInPath(pedWeightsFile_).fullPath().c_str());
01228 int tdcBin=0;
01229 while (!pedFile.eof() && tdcBin < nTDCbins_)
01230 {
01231 for(int j = 0; j < 10; ++j) {
01232 float ww;
01233 pedFile >> ww;
01234 pedwgtv[tdcBin].push_back(ww);
01235 }
01236 ++tdcBin;
01237 }
01238 assert (tdcBin == nTDCbins_);
01239 }
01240 else
01241 {
01242
01243 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01244 throw cms::Exception("WrongConfig");
01245 }
01246
01247 for (int i=0;i<nTDCbins_;i++)
01248 {
01249 assert(pedwgtv[i].size() == 10);
01250 int j=0;
01251 for(std::vector<double>::const_iterator it = pedwgtv[i].begin(); it != pedwgtv[i].end(); ++it) {
01252 (pedWeights_[i])[j] = *it;
01253 j++;
01254 }
01255 }
01256
01257 std::vector< std::vector<double> > pedwgtvaft(nTDCbins_);
01258
01259 if (!getWeightsFromFile_ && nTDCbins_ == 1)
01260 {
01261 std::vector<double> vped;
01262 vped.push_back( 0. );
01263 vped.push_back( 0. );
01264 vped.push_back( 0. );
01265 vped.push_back( 0. );
01266 vped.push_back( 0. );
01267 vped.push_back( 0. );
01268 vped.push_back( 0. );
01269 vped.push_back( 0. );
01270 vped.push_back( 0. );
01271 vped.push_back( 0. );
01272 pedwgtvaft[0] = ps.getUntrackedParameter< std::vector<double> >("pedWeightsAft", vped);
01273 }
01274 else if (getWeightsFromFile_)
01275 {
01276
01277 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading pedestal after gain switch weights from file " << edm::FileInPath(pedWeightsAftFile_).fullPath().c_str() ;
01278 std::ifstream pedFile(edm::FileInPath(pedWeightsAftFile_).fullPath().c_str());
01279 int tdcBin=0;
01280 while (!pedFile.eof() && tdcBin < nTDCbins_)
01281 {
01282 for(int j = 0; j < 10; ++j) {
01283 float ww;
01284 pedFile >> ww;
01285 pedwgtvaft[tdcBin].push_back(ww);
01286 }
01287 ++tdcBin;
01288 }
01289 assert (tdcBin == nTDCbins_);
01290 }
01291 else
01292 {
01293
01294 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01295 throw cms::Exception("WrongConfig");
01296 }
01297
01298 for (int i=0;i<nTDCbins_;i++)
01299 {
01300 assert(pedwgtvaft[i].size() == 10);
01301 int j=0;
01302 for(std::vector<double>::const_iterator it = pedwgtvaft[i].begin(); it != pedwgtvaft[i].end(); ++it) {
01303 (pedWeightsAft_[i])[j]=*it;
01304 j++;
01305 }
01306 }
01307
01308
01309
01310
01311
01312 std::vector< std::vector<double> > jittwgtv(nTDCbins_);
01313
01314 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
01315 {
01316 std::vector<double> vjitt;
01317 vjitt.push_back( 0.04066309 );
01318 vjitt.push_back( 0.04066309 );
01319 vjitt.push_back( 0.04066309 );
01320 vjitt.push_back( 0.000 );
01321 vjitt.push_back( 1.325176 );
01322 vjitt.push_back( -0.04997078 );
01323 vjitt.push_back( -0.504338 );
01324 vjitt.push_back( -0.5024844 );
01325 vjitt.push_back( -0.3903718 );
01326 vjitt.push_back( 0.000 );
01327 jittwgtv[0] = ps.getUntrackedParameter< std::vector<double> >("jittWeights", vjitt);
01328 }
01329 else if (getWeightsFromFile_)
01330 {
01331
01332 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading jitter weights from file " << edm::FileInPath(jittWeightsFile_).fullPath().c_str() ;
01333 std::ifstream jittFile(edm::FileInPath(jittWeightsFile_).fullPath().c_str());
01334 int tdcBin=0;
01335 while (!jittFile.eof() && tdcBin < nTDCbins_)
01336 {
01337 for(int j = 0; j < 10; ++j) {
01338 float ww;
01339 jittFile >> ww;
01340 jittwgtv[tdcBin].push_back(ww);
01341 }
01342 ++tdcBin;
01343 }
01344 assert (tdcBin == nTDCbins_);
01345 }
01346 else
01347 {
01348
01349 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01350 throw cms::Exception("WrongConfig");
01351 }
01352
01353 for (int i=0;i<nTDCbins_;i++)
01354 {
01355 assert(jittwgtv[i].size() == 10);
01356 int j=0;
01357 for(std::vector<double>::const_iterator it = jittwgtv[i].begin(); it != jittwgtv[i].end(); ++it) {
01358 (jittWeights_[i])[j]= *it;
01359 j++;
01360 }
01361 }
01362
01363 std::vector< std::vector<double> > jittwgtvaft(nTDCbins_);
01364
01365 if (!getWeightsFromFile_ && nTDCbins_ == 1)
01366 {
01367 std::vector<double> vjitt;
01368 vjitt.push_back( 0. );
01369 vjitt.push_back( 0. );
01370 vjitt.push_back( 0. );
01371 vjitt.push_back( 0. );
01372 vjitt.push_back( 1.097871 );
01373 vjitt.push_back( -0.04551035 );
01374 vjitt.push_back( -0.4159156 );
01375 vjitt.push_back( -0.4185352 );
01376 vjitt.push_back( -0.3367127 );
01377 vjitt.push_back( 0. );
01378 jittwgtvaft[0] = ps.getUntrackedParameter< std::vector<double> >("jittWeightsAft", vjitt);
01379 }
01380 else if (getWeightsFromFile_)
01381 {
01382
01383 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading jitter after gain switch weights from file " << edm::FileInPath(jittWeightsAftFile_).fullPath().c_str() ;
01384 std::ifstream jittFile(edm::FileInPath(jittWeightsAftFile_).fullPath().c_str());
01385 int tdcBin=0;
01386 while (!jittFile.eof() && tdcBin < nTDCbins_)
01387 {
01388 for(int j = 0; j < 10; ++j) {
01389 float ww;
01390 jittFile >> ww;
01391 jittwgtvaft[tdcBin].push_back(ww);
01392 }
01393 ++tdcBin;
01394 }
01395 assert (tdcBin == nTDCbins_);
01396 }
01397 else
01398 {
01399
01400 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01401 throw cms::Exception("WrongConfig");
01402 }
01403
01404 for (int i=0;i<nTDCbins_;i++)
01405 {
01406 assert(jittwgtvaft[i].size() == 10);
01407 int j=0;
01408 for(std::vector<double>::const_iterator it = jittwgtvaft[i].begin(); it != jittwgtvaft[i].end(); ++it) {
01409 (jittWeightsAft_[i])[j]= *it;
01410 j++;
01411 }
01412 }
01413
01414
01415 std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2Matrix(nTDCbins_);
01416 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
01417 {
01418
01419
01420
01421
01422 chi2Matrix[0](0,0) = 0.694371;
01423 chi2Matrix[0](0,1) = -0.305629;
01424 chi2Matrix[0](0,2) = -0.305629;
01425 chi2Matrix[0](0,3) = 0.;
01426 chi2Matrix[0](0,4) = 0.;
01427 chi2Matrix[0](0,5) = 0.;
01428 chi2Matrix[0](0,6) = 0.;
01429 chi2Matrix[0](0,7) = 0.;
01430 chi2Matrix[0](0,8) = 0.;
01431 chi2Matrix[0](0,9) = 0.;
01432 chi2Matrix[0](1,0) = -0.305629;
01433 chi2Matrix[0](1,1) = 0.694371;
01434 chi2Matrix[0](1,2) = -0.305629;
01435 chi2Matrix[0](1,3) = 0.;
01436 chi2Matrix[0](1,4) = 0.;
01437 chi2Matrix[0](1,5) = 0.;
01438 chi2Matrix[0](1,6) = 0.;
01439 chi2Matrix[0](1,7) = 0.;
01440 chi2Matrix[0](1,8) = 0.;
01441 chi2Matrix[0](1,9) = 0.;
01442 chi2Matrix[0](2,0) = -0.305629;
01443 chi2Matrix[0](2,1) = -0.305629;
01444 chi2Matrix[0](2,2) = 0.694371;
01445 chi2Matrix[0](2,3) = 0.;
01446 chi2Matrix[0](2,4) = 0.;
01447 chi2Matrix[0](2,5) = 0.;
01448 chi2Matrix[0](2,6) = 0.;
01449 chi2Matrix[0](2,7) = 0.;
01450 chi2Matrix[0](2,8) = 0.;
01451 chi2Matrix[0](2,9) = 0.;
01452 chi2Matrix[0](3,0) = 0.;
01453 chi2Matrix[0](3,1) = 0.;
01454 chi2Matrix[0](3,2) = 0.;
01455 chi2Matrix[0](3,3) = 0.;
01456 chi2Matrix[0](3,4) = 0.;
01457 chi2Matrix[0](3,5) = 0.;
01458 chi2Matrix[0](3,6) = 0.;
01459 chi2Matrix[0](3,7) = 0.;
01460 chi2Matrix[0](3,8) = 0.;
01461 chi2Matrix[0](3,9) = 0.;
01462 chi2Matrix[0](4,0) = 0.;
01463 chi2Matrix[0](4,1) = 0.;
01464 chi2Matrix[0](4,2) = 0.;
01465 chi2Matrix[0](4,3) = 0.;
01466 chi2Matrix[0](4,4) = 0.8027116;
01467 chi2Matrix[0](4,5) = -0.2517103;
01468 chi2Matrix[0](4,6) = -0.2232882;
01469 chi2Matrix[0](4,7) = -0.1716192;
01470 chi2Matrix[0](4,8) = -0.1239006;
01471 chi2Matrix[0](4,9) = 0.;
01472 chi2Matrix[0](5,0) = 0.;
01473 chi2Matrix[0](5,1) = 0.;
01474 chi2Matrix[0](5,2) = 0.;
01475 chi2Matrix[0](5,3) = 0.;
01476 chi2Matrix[0](5,4) = -0.2517103;
01477 chi2Matrix[0](5,5) = 0.6528964;
01478 chi2Matrix[0](5,6) = -0.2972839;
01479 chi2Matrix[0](5,7) = -0.2067162;
01480 chi2Matrix[0](5,8) = -0.1230729;
01481 chi2Matrix[0](5,9) = 0.;
01482 chi2Matrix[0](6,0) = 0.;
01483 chi2Matrix[0](6,1) = 0.;
01484 chi2Matrix[0](6,2) = 0.;
01485 chi2Matrix[0](6,3) = 0.;
01486 chi2Matrix[0](6,4) = -0.2232882;
01487 chi2Matrix[0](6,5) = -0.2972839;
01488 chi2Matrix[0](6,6) = 0.7413607;
01489 chi2Matrix[0](6,7) = -0.1883866;
01490 chi2Matrix[0](6,8) = -0.1235052;
01491 chi2Matrix[0](6,9) = 0.;
01492 chi2Matrix[0](7,0) = 0.;
01493 chi2Matrix[0](7,1) = 0.;
01494 chi2Matrix[0](7,2) = 0.;
01495 chi2Matrix[0](7,3) = 0.;
01496 chi2Matrix[0](7,4) = -0.1716192;
01497 chi2Matrix[0](7,5) = -0.2067162;
01498 chi2Matrix[0](7,6) = -0.1883866;
01499 chi2Matrix[0](7,7) = 0.844935;
01500 chi2Matrix[0](7,8) = -0.124291;
01501 chi2Matrix[0](7,9) = 0.;
01502 chi2Matrix[0](8,0) = 0.;
01503 chi2Matrix[0](8,1) = 0.;
01504 chi2Matrix[0](8,2) = 0.;
01505 chi2Matrix[0](8,3) = 0.;
01506 chi2Matrix[0](8,4) = -0.1239006;
01507 chi2Matrix[0](8,5) = -0.1230729;
01508 chi2Matrix[0](8,6) = -0.1235052;
01509 chi2Matrix[0](8,7) = -0.124291;
01510 chi2Matrix[0](8,8) = 0.8749833;
01511 chi2Matrix[0](8,9) = 0.;
01512 chi2Matrix[0](9,0) = 0.;
01513 chi2Matrix[0](9,1) = 0.;
01514 chi2Matrix[0](9,2) = 0.;
01515 chi2Matrix[0](9,3) = 0.;
01516 chi2Matrix[0](9,4) = 0.;
01517 chi2Matrix[0](9,5) = 0.;
01518 chi2Matrix[0](9,6) = 0.;
01519 chi2Matrix[0](9,7) = 0.;
01520 chi2Matrix[0](9,8) = 0.;
01521 chi2Matrix[0](9,9) = 0.;
01522 }
01523 else if (getWeightsFromFile_)
01524 {
01525
01526 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading chi2Matrix from file " << edm::FileInPath(chi2MatrixFile_).fullPath().c_str() ;
01527 std::ifstream chi2MatrixFile(edm::FileInPath(chi2MatrixFile_).fullPath().c_str());
01528 int tdcBin=0;
01529 while (!chi2MatrixFile.eof() && tdcBin < nTDCbins_)
01530 {
01531
01532 for(int j = 0; j < 10; ++j) {
01533 for(int l = 0; l < 10; ++l) {
01534 float ww;
01535 chi2MatrixFile >> ww;
01536 chi2Matrix[tdcBin](j,l)=ww;
01537 }
01538 }
01539 ++tdcBin;
01540 }
01541 assert (tdcBin == nTDCbins_);
01542 }
01543 else
01544 {
01545
01546 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01547 throw cms::Exception("WrongConfig");
01548 }
01549
01550
01551
01552
01553 chi2Matrix_ = chi2Matrix;
01554
01555
01556 std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2MatrixAft(nTDCbins_);
01557 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
01558 {
01559
01560
01561
01562
01563 chi2MatrixAft[0](0,0) = 0.;
01564 chi2MatrixAft[0](0,1) = 0.;
01565 chi2MatrixAft[0](0,2) = 0.;
01566 chi2MatrixAft[0](0,3) = 0.;
01567 chi2MatrixAft[0](0,4) = 0.;
01568 chi2MatrixAft[0](0,5) = 0.;
01569 chi2MatrixAft[0](0,6) = 0.;
01570 chi2MatrixAft[0](0,7) = 0.;
01571 chi2MatrixAft[0](0,8) = 0.;
01572 chi2MatrixAft[0](0,9) = 0.;
01573 chi2MatrixAft[0](1,0) = 0.;
01574 chi2MatrixAft[0](1,1) = 0.;
01575 chi2MatrixAft[0](1,2) = 0.;
01576 chi2MatrixAft[0](1,3) = 0.;
01577 chi2MatrixAft[0](1,4) = 0.;
01578 chi2MatrixAft[0](1,5) = 0.;
01579 chi2MatrixAft[0](1,6) = 0.;
01580 chi2MatrixAft[0](1,7) = 0.;
01581 chi2MatrixAft[0](1,8) = 0.;
01582 chi2MatrixAft[0](1,9) = 0.;
01583 chi2MatrixAft[0](2,0) = 0.;
01584 chi2MatrixAft[0](2,1) = 0.;
01585 chi2MatrixAft[0](2,2) = 0.;
01586 chi2MatrixAft[0](2,3) = 0.;
01587 chi2MatrixAft[0](2,4) = 0.;
01588 chi2MatrixAft[0](2,5) = 0.;
01589 chi2MatrixAft[0](2,6) = 0.;
01590 chi2MatrixAft[0](2,7) = 0.;
01591 chi2MatrixAft[0](2,8) = 0.;
01592 chi2MatrixAft[0](2,9) = 0.;
01593 chi2MatrixAft[0](3,0) = 0.;
01594 chi2MatrixAft[0](3,1) = 0.;
01595 chi2MatrixAft[0](3,2) = 0.;
01596 chi2MatrixAft[0](3,3) = 0.;
01597 chi2MatrixAft[0](3,4) = 0.;
01598 chi2MatrixAft[0](3,5) = 0.;
01599 chi2MatrixAft[0](3,6) = 0.;
01600 chi2MatrixAft[0](3,7) = 0.;
01601 chi2MatrixAft[0](3,8) = 0.;
01602 chi2MatrixAft[0](3,9) = 0.;
01603 chi2MatrixAft[0](4,0) = 0.;
01604 chi2MatrixAft[0](4,1) = 0.;
01605 chi2MatrixAft[0](4,2) = 0.;
01606 chi2MatrixAft[0](4,3) = 0.;
01607 chi2MatrixAft[0](4,4) = 0.8030884;
01608 chi2MatrixAft[0](4,5) = -0.2543541;
01609 chi2MatrixAft[0](4,6) = -0.2243544;
01610 chi2MatrixAft[0](4,7) = -0.1698177;
01611 chi2MatrixAft[0](4,8) = -0.1194506;
01612 chi2MatrixAft[0](4,9) = 0.;
01613 chi2MatrixAft[0](5,0) = 0.;
01614 chi2MatrixAft[0](5,1) = 0.;
01615 chi2MatrixAft[0](5,2) = 0.;
01616 chi2MatrixAft[0](5,3) = 0.;
01617 chi2MatrixAft[0](5,4) = -0.2543541;
01618 chi2MatrixAft[0](5,5) = 0.6714465;
01619 chi2MatrixAft[0](5,6) = -0.2898025;
01620 chi2MatrixAft[0](5,7) = -0.2193564;
01621 chi2MatrixAft[0](5,8) = -0.1542964;
01622 chi2MatrixAft[0](5,9) = 0.;
01623 chi2MatrixAft[0](6,0) = 0.;
01624 chi2MatrixAft[0](6,1) = 0.;
01625 chi2MatrixAft[0](6,2) = 0.;
01626 chi2MatrixAft[0](6,3) = 0.;
01627 chi2MatrixAft[0](6,4) = -0.2243544;
01628 chi2MatrixAft[0](6,5) = -0.2898025;
01629 chi2MatrixAft[0](6,6) = 0.7443781;
01630 chi2MatrixAft[0](6,7) = -0.1934846;
01631 chi2MatrixAft[0](6,8) = -0.136098;
01632 chi2MatrixAft[0](6,9) = 0.;
01633 chi2MatrixAft[0](7,0) = 0.;
01634 chi2MatrixAft[0](7,1) = 0.;
01635 chi2MatrixAft[0](7,2) = 0.;
01636 chi2MatrixAft[0](7,3) = 0.;
01637 chi2MatrixAft[0](7,4) = -0.1698177;
01638 chi2MatrixAft[0](7,5) = -0.2193564;
01639 chi2MatrixAft[0](7,6) = -0.1934846;
01640 chi2MatrixAft[0](7,7) = 0.8535482;
01641 chi2MatrixAft[0](7,8) = -0.1030149;
01642 chi2MatrixAft[0](7,9) = 0.;
01643 chi2MatrixAft[0](8,0) = 0.;
01644 chi2MatrixAft[0](8,1) = 0.;
01645 chi2MatrixAft[0](8,2) = 0.;
01646 chi2MatrixAft[0](8,3) = 0.;
01647 chi2MatrixAft[0](8,4) = -0.1194506;
01648 chi2MatrixAft[0](8,5) = -0.1542964;
01649 chi2MatrixAft[0](8,6) = -0.136098;
01650 chi2MatrixAft[0](8,7) = -0.1030149;
01651 chi2MatrixAft[0](8,8) = 0.9275388;
01652 chi2MatrixAft[0](8,9) = 0.;
01653 chi2MatrixAft[0](9,0) = 0.;
01654 chi2MatrixAft[0](9,1) = 0.;
01655 chi2MatrixAft[0](9,2) = 0.;
01656 chi2MatrixAft[0](9,3) = 0.;
01657 chi2MatrixAft[0](9,4) = 0.;
01658 chi2MatrixAft[0](9,5) = 0.;
01659 chi2MatrixAft[0](9,6) = 0.;
01660 chi2MatrixAft[0](9,7) = 0.;
01661 chi2MatrixAft[0](9,8) = 0.;
01662 chi2MatrixAft[0](9,9) = 0.;
01663 }
01664 else if (getWeightsFromFile_)
01665 {
01666
01667 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading chi2MatrixAft from file " << edm::FileInPath(chi2MatrixAftFile_).fullPath().c_str() ;
01668 std::ifstream chi2MatrixAftFile(edm::FileInPath(chi2MatrixAftFile_).fullPath().c_str());
01669 int tdcBin=0;
01670 while (!chi2MatrixAftFile.eof() && tdcBin < nTDCbins_)
01671 {
01672
01673 for(int j = 0; j < 10; ++j) {
01674 for(int l = 0; l < 10; ++l) {
01675 float ww;
01676 chi2MatrixAftFile >> ww;
01677 chi2MatrixAft[tdcBin](j,l)=ww;
01678 }
01679 }
01680 ++tdcBin;
01681 }
01682 assert (tdcBin == nTDCbins_);
01683 }
01684 else
01685 {
01686
01687 edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
01688 throw cms::Exception("WrongConfig");
01689 }
01690
01691
01692
01693
01694 chi2MatrixAft_ = chi2MatrixAft;
01695
01696
01697 }
01698
01699
01700
01701
01702 std::auto_ptr<EcalChannelStatus>
01703 EcalTrivialConditionRetriever::getChannelStatusFromConfiguration (const EcalChannelStatusRcd&)
01704 {
01705 std::auto_ptr<EcalChannelStatus> ecalStatus = std::auto_ptr<EcalChannelStatus>( new EcalChannelStatus() );
01706
01707
01708
01709
01710
01711 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
01712 if(ieta==0) continue;
01713 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
01714 if (EBDetId::validDetId(ieta,iphi)) {
01715 EBDetId ebid(ieta,iphi);
01716 ecalStatus->setValue( ebid, 0 );
01717 }
01718 }
01719 }
01720
01721 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
01722 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
01723
01724 if (EEDetId::validDetId(iX,iY,1)) {
01725 EEDetId eedetidpos(iX,iY,1);
01726 ecalStatus->setValue( eedetidpos, 0 );
01727 }
01728 if (EEDetId::validDetId(iX,iY,-1)) {
01729 EEDetId eedetidneg(iX,iY,-1);
01730 ecalStatus->setValue( eedetidneg, 0 );
01731 }
01732 }
01733 }
01734
01735
01736
01737
01738
01739 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading channel statuses from file " << edm::FileInPath(channelStatusFile_).fullPath().c_str() ;
01740 std::ifstream statusFile(edm::FileInPath(channelStatusFile_).fullPath().c_str());
01741 if ( !statusFile.good() ) {
01742 edm::LogError ("EcalTrivialConditionRetriever")
01743 << "*** Problems opening file: " << channelStatusFile_ ;
01744 throw cms::Exception ("Cannot open ECAL channel status file") ;
01745 }
01746
01747 std::string EcalSubDet;
01748 std::string str;
01749 int hashIndex(0);
01750 int status(0);
01751
01752 while (!statusFile.eof())
01753 {
01754 statusFile >> EcalSubDet;
01755 if (EcalSubDet!=std::string("EB") && EcalSubDet!=std::string("EE"))
01756 {
01757 std::getline(statusFile,str);
01758 continue;
01759 }
01760 else
01761 {
01762 statusFile>> hashIndex >> status;
01763 }
01764
01765
01766 if(EcalSubDet==std::string("EB"))
01767 {
01768 EBDetId ebid = EBDetId::unhashIndex(hashIndex);
01769 ecalStatus->setValue( ebid, status );
01770 }
01771 else if(EcalSubDet==std::string("EE"))
01772 {
01773 EEDetId eedetid = EEDetId::unhashIndex(hashIndex);
01774 ecalStatus->setValue( eedetid, status );
01775 }
01776 else
01777 {
01778 edm::LogError ("EcalTrivialConditionRetriever")
01779 << " *** " << EcalSubDet << " is neither EB nor EE ";
01780 }
01781
01782 }
01783
01784
01785
01786 statusFile.close();
01787 return ecalStatus;
01788 }
01789
01790
01791
01792 std::auto_ptr<EcalChannelStatus>
01793 EcalTrivialConditionRetriever::produceEcalChannelStatus( const EcalChannelStatusRcd& )
01794 {
01795
01796 std::auto_ptr<EcalChannelStatus> ical = std::auto_ptr<EcalChannelStatus>( new EcalChannelStatus() );
01797
01798 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
01799 if(ieta==0) continue;
01800 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
01801 if (EBDetId::validDetId(ieta,iphi)) {
01802 EBDetId ebid(ieta,iphi);
01803 ical->setValue( ebid, 0 );
01804 }
01805 }
01806 }
01807
01808 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
01809 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
01810
01811 if (EEDetId::validDetId(iX,iY,1)) {
01812 EEDetId eedetidpos(iX,iY,1);
01813 ical->setValue( eedetidpos, 0 );
01814 }
01815 if (EEDetId::validDetId(iX,iY,-1)) {
01816 EEDetId eedetidneg(iX,iY,-1);
01817 ical->setValue( eedetidneg, 0 );
01818 }
01819 }
01820 }
01821 return ical;
01822 }
01823
01824
01825 std::auto_ptr<EcalDQMChannelStatus>
01826 EcalTrivialConditionRetriever::produceEcalDQMChannelStatus( const EcalDQMChannelStatusRcd& )
01827 {
01828 uint32_t sta(0);
01829
01830 std::auto_ptr<EcalDQMChannelStatus> ical = std::auto_ptr<EcalDQMChannelStatus>( new EcalDQMChannelStatus() );
01831
01832 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
01833 if(ieta==0) continue;
01834 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
01835 if (EBDetId::validDetId(ieta,iphi)) {
01836 EBDetId ebid(ieta,iphi);
01837 ical->setValue( ebid, sta );
01838 }
01839 }
01840 }
01841
01842 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
01843 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
01844
01845 if (EEDetId::validDetId(iX,iY,1)) {
01846 EEDetId eedetidpos(iX,iY,1);
01847 ical->setValue( eedetidpos, sta );
01848 }
01849 if (EEDetId::validDetId(iX,iY,-1)) {
01850 EEDetId eedetidneg(iX,iY,-1);
01851 ical->setValue( eedetidneg, sta );
01852 }
01853 }
01854 }
01855 return ical;
01856 }
01857
01858
01859 std::auto_ptr<EcalDQMTowerStatus>
01860 EcalTrivialConditionRetriever::produceEcalDQMTowerStatus( const EcalDQMTowerStatusRcd& )
01861 {
01862
01863 std::auto_ptr<EcalDQMTowerStatus> ical = std::auto_ptr<EcalDQMTowerStatus>( new EcalDQMTowerStatus() );
01864
01865 uint32_t sta(0);
01866
01867
01868 int iz=0;
01869 for(int k=0 ; k<2; k++ ) {
01870 if(k==0) iz=-1;
01871 if(k==1) iz=+1;
01872 for(int i=1 ; i<73; i++) {
01873 for(int j=1 ; j<18; j++) {
01874 if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,j,i )){
01875 EcalTrigTowerDetId ebid(iz,EcalBarrel,j,i);
01876
01877 ical->setValue( ebid, sta );
01878 }
01879 }
01880 }
01881 }
01882
01883
01884
01885 for(int k=0 ; k<2; k++ ) {
01886 if(k==0) iz=-1;
01887 if(k==1) iz=+1;
01888 for(int i=1 ; i<21; i++) {
01889 for(int j=1 ; j<21; j++) {
01890 if (EcalScDetId::validDetId(i,j,iz )){
01891 EcalScDetId eeid(i,j,iz);
01892 ical->setValue( eeid, sta );
01893 }
01894 }
01895 }
01896 }
01897
01898 return ical;
01899 }
01900
01901
01902 std::auto_ptr<EcalDCSTowerStatus>
01903 EcalTrivialConditionRetriever::produceEcalDCSTowerStatus( const EcalDCSTowerStatusRcd& )
01904 {
01905
01906 std::auto_ptr<EcalDCSTowerStatus> ical = std::auto_ptr<EcalDCSTowerStatus>( new EcalDCSTowerStatus() );
01907
01908 int status(0);
01909
01910
01911 int iz=0;
01912 for(int k=0 ; k<2; k++ ) {
01913 if(k==0) iz=-1;
01914 if(k==1) iz=+1;
01915 for(int i=1 ; i<73; i++) {
01916 for(int j=1 ; j<18; j++) {
01917 if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,j,i )){
01918 EcalTrigTowerDetId ebid(iz,EcalBarrel,j,i);
01919
01920 ical->setValue( ebid, status );
01921 }
01922 }
01923 }
01924 }
01925
01926
01927
01928 for(int k=0 ; k<2; k++ ) {
01929 if(k==0) iz=-1;
01930 if(k==1) iz=+1;
01931 for(int i=1 ; i<21; i++) {
01932 for(int j=1 ; j<21; j++) {
01933 if (EcalScDetId::validDetId(i,j,iz )){
01934 EcalScDetId eeid(i,j,iz);
01935 ical->setValue( eeid, status );
01936 }
01937 }
01938 }
01939 }
01940
01941 return ical;
01942 }
01943
01944
01945 std::auto_ptr<EcalDAQTowerStatus>
01946 EcalTrivialConditionRetriever::produceEcalDAQTowerStatus( const EcalDAQTowerStatusRcd& )
01947 {
01948
01949 std::auto_ptr<EcalDAQTowerStatus> ical = std::auto_ptr<EcalDAQTowerStatus>( new EcalDAQTowerStatus() );
01950
01951 int status(0);
01952
01953
01954 int iz=0;
01955 for(int k=0 ; k<2; k++ ) {
01956 if(k==0) iz=-1;
01957 if(k==1) iz=+1;
01958 for(int i=1 ; i<73; i++) {
01959 for(int j=1 ; j<18; j++) {
01960 if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,j,i )){
01961 EcalTrigTowerDetId ebid(iz,EcalBarrel,j,i);
01962
01963 ical->setValue( ebid, status );
01964 }
01965 }
01966 }
01967 }
01968
01969
01970
01971 for(int k=0 ; k<2; k++ ) {
01972 if(k==0) iz=-1;
01973 if(k==1) iz=+1;
01974 for(int i=1 ; i<21; i++) {
01975 for(int j=1 ; j<21; j++) {
01976 if (EcalScDetId::validDetId(i,j,iz )){
01977 EcalScDetId eeid(i,j,iz);
01978 ical->setValue( eeid, status );
01979 }
01980 }
01981 }
01982 }
01983
01984 return ical;
01985 }
01986
01987
01988 std::auto_ptr<EcalTPGCrystalStatus>
01989 EcalTrivialConditionRetriever::getTrgChannelStatusFromConfiguration (const EcalTPGCrystalStatusRcd&)
01990 {
01991 std::auto_ptr<EcalTPGCrystalStatus> ecalStatus = std::auto_ptr<EcalTPGCrystalStatus>( new EcalTPGCrystalStatus() );
01992
01993
01994
01995
01996
01997 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
01998 if(ieta==0) continue;
01999 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
02000 if (EBDetId::validDetId(ieta,iphi)) {
02001 EBDetId ebid(ieta,iphi);
02002 ecalStatus->setValue( ebid, 0 );
02003 }
02004 }
02005 }
02006
02007 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
02008 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
02009
02010 if (EEDetId::validDetId(iX,iY,1)) {
02011 EEDetId eedetidpos(iX,iY,1);
02012 ecalStatus->setValue( eedetidpos, 0 );
02013 }
02014 if (EEDetId::validDetId(iX,iY,-1)) {
02015 EEDetId eedetidneg(iX,iY,-1);
02016 ecalStatus->setValue( eedetidneg, 0 );
02017 }
02018 }
02019 }
02020
02021
02022
02023
02024
02025 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading channel statuses from file " << edm::FileInPath(channelStatusFile_).fullPath().c_str() ;
02026 std::ifstream statusFile(edm::FileInPath(channelStatusFile_).fullPath().c_str());
02027 if ( !statusFile.good() ) {
02028 edm::LogError ("EcalTrivialConditionRetriever")
02029 << "*** Problems opening file: " << channelStatusFile_ ;
02030 throw cms::Exception ("Cannot open ECAL channel status file") ;
02031 }
02032
02033 std::string EcalSubDet;
02034 std::string str;
02035 int hashIndex(0);
02036 int status(0);
02037
02038 while (!statusFile.eof())
02039 {
02040 statusFile >> EcalSubDet;
02041 if (EcalSubDet!=std::string("EB") && EcalSubDet!=std::string("EE"))
02042 {
02043 std::getline(statusFile,str);
02044 continue;
02045 }
02046 else
02047 {
02048 statusFile>> hashIndex >> status;
02049 }
02050
02051
02052 if(EcalSubDet==std::string("EB"))
02053 {
02054 EBDetId ebid = EBDetId::unhashIndex(hashIndex);
02055 ecalStatus->setValue( ebid, status );
02056 }
02057 else if(EcalSubDet==std::string("EE"))
02058 {
02059 EEDetId eedetid = EEDetId::unhashIndex(hashIndex);
02060 ecalStatus->setValue( eedetid, status );
02061 }
02062 else
02063 {
02064 edm::LogError ("EcalTrivialConditionRetriever")
02065 << " *** " << EcalSubDet << " is neither EB nor EE ";
02066 }
02067
02068 }
02069
02070
02071
02072 statusFile.close();
02073 return ecalStatus;
02074 }
02075
02076
02077
02078 std::auto_ptr<EcalTPGCrystalStatus>
02079 EcalTrivialConditionRetriever::produceEcalTrgChannelStatus( const EcalTPGCrystalStatusRcd& )
02080 {
02081
02082 std::auto_ptr<EcalTPGCrystalStatus> ical = std::auto_ptr<EcalTPGCrystalStatus>( new EcalTPGCrystalStatus() );
02083
02084 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
02085 if(ieta==0) continue;
02086 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
02087 if (EBDetId::validDetId(ieta,iphi)) {
02088 EBDetId ebid(ieta,iphi);
02089 ical->setValue( ebid, 0 );
02090 }
02091 }
02092 }
02093
02094 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
02095 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
02096
02097 if (EEDetId::validDetId(iX,iY,1)) {
02098 EEDetId eedetidpos(iX,iY,1);
02099 ical->setValue( eedetidpos, 0 );
02100 }
02101 if (EEDetId::validDetId(iX,iY,-1)) {
02102 EEDetId eedetidneg(iX,iY,-1);
02103 ical->setValue( eedetidneg, 0 );
02104 }
02105 }
02106 }
02107 return ical;
02108 }
02109
02110
02111
02112
02113
02114
02115 std::auto_ptr<EcalIntercalibConstants>
02116 EcalTrivialConditionRetriever::getIntercalibConstantsFromConfiguration
02117 ( const EcalIntercalibConstantsRcd& )
02118 {
02119 std::auto_ptr<EcalIntercalibConstants> ical =
02120 std::auto_ptr<EcalIntercalibConstants>( new EcalIntercalibConstants() );
02121
02122
02123
02124
02125 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading intercalibration constants from file "
02126 << intercalibConstantsFile_.c_str() ;
02127
02128 FILE *inpFile ;
02129 inpFile = fopen (intercalibConstantsFile_.c_str (),"r") ;
02130 if (!inpFile)
02131 {
02132 edm::LogError ("EcalTrivialConditionRetriever")
02133 << "*** Can not open file: " << intercalibConstantsFile_ ;
02134 throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
02135 }
02136
02137 char line[256] ;
02138 std::ostringstream str ;
02139 fgets (line,255,inpFile) ;
02140 int sm_number=atoi (line) ;
02141 str << "sm: " << sm_number ;
02142
02143 fgets (line,255,inpFile) ;
02144
02145
02146 fgets (line,255,inpFile) ;
02147 std::string gen_tag = line ;
02148 str << "gen tag: " << gen_tag ;
02149
02150 fgets (line,255,inpFile) ;
02151 std::string cali_method = line ;
02152 str << "cali method: " << cali_method << std::endl ;
02153
02154 fgets (line,255,inpFile) ;
02155 std::string cali_version = line ;
02156 str << "cali version: " << cali_version << std::endl ;
02157
02158 fgets (line,255,inpFile) ;
02159 std::string cali_type = line ;
02160 str << "cali type: " << cali_type ;
02161
02162 edm::LogInfo("EcalTrivialConditionRetriever")
02163 << "[PIETRO] Intercalibration file - "
02164 << str.str () << std::endl ;
02165
02166 float calib[1700]={1} ;
02167 int calib_status[1700]={0} ;
02168
02169 int ii = 0 ;
02170
02171 while (fgets (line,255,inpFile))
02172 {
02173 ii++;
02174 int dmy_num = 0 ;
02175 float dmy_calib = 0. ;
02176 float dmy_RMS = 0. ;
02177 int dmy_events = 0 ;
02178 int dmy_status = 0 ;
02179 sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
02180 &dmy_RMS, &dmy_events,
02181 &dmy_status) ;
02182 assert (dmy_num >= 1) ;
02183 assert (dmy_num <= 1700) ;
02184 calib[dmy_num-1] = dmy_calib ;
02185 calib_status[dmy_num-1] = dmy_status ;
02186
02187
02188
02189
02190
02191
02192
02193
02194 }
02195
02196 fclose (inpFile) ;
02197 edm::LogInfo ("EcalTrivialConditionRetriever") << "Read intercalibrations for " << ii << " xtals " ;
02198 if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
02199 << "Some crystals missing, set to 1" << std::endl ;
02200
02201
02202
02203
02204
02205 int sm_db=1 ;
02206
02207 for (int i=0 ; i<1700 ; i++)
02208 {
02209
02210
02211
02212
02213
02214
02215
02216 if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
02217 EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
02218 if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
02219 else ical->setValue (ebid.rawId (), 1.) ;
02220 }
02221
02222 }
02223
02224
02225 return ical;
02226 }
02227
02228
02229 std::auto_ptr<EcalIntercalibErrors>
02230 EcalTrivialConditionRetriever::getIntercalibErrorsFromConfiguration
02231 ( const EcalIntercalibErrorsRcd& )
02232 {
02233 std::auto_ptr<EcalIntercalibErrors> ical =
02234 std::auto_ptr<EcalIntercalibErrors>( new EcalIntercalibErrors() );
02235
02236
02237
02238
02239 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading intercalibration constants from file "
02240 << intercalibErrorsFile_.c_str() ;
02241
02242 FILE *inpFile ;
02243 inpFile = fopen (intercalibErrorsFile_.c_str (),"r") ;
02244 if (!inpFile)
02245 {
02246 edm::LogError ("EcalTrivialConditionRetriever")
02247 << "*** Can not open file: " << intercalibErrorsFile_ ;
02248 throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
02249 }
02250
02251 char line[256] ;
02252 std::ostringstream str ;
02253 fgets (line,255,inpFile) ;
02254 int sm_number=atoi (line) ;
02255 str << "sm: " << sm_number ;
02256
02257 fgets (line,255,inpFile) ;
02258
02259
02260 fgets (line,255,inpFile) ;
02261 std::string gen_tag = line ;
02262 str << "gen tag: " << gen_tag ;
02263
02264 fgets (line,255,inpFile) ;
02265 std::string cali_method = line ;
02266 str << "cali method: " << cali_method << std::endl ;
02267
02268 fgets (line,255,inpFile) ;
02269 std::string cali_version = line ;
02270 str << "cali version: " << cali_version << std::endl ;
02271
02272 fgets (line,255,inpFile) ;
02273 std::string cali_type = line ;
02274 str << "cali type: " << cali_type ;
02275
02276 edm::LogInfo("EcalTrivialConditionRetriever")
02277 << "[PIETRO] Intercalibration file - "
02278 << str.str () << std::endl ;
02279
02280 float calib[1700]={1} ;
02281 int calib_status[1700]={0} ;
02282
02283 int ii = 0 ;
02284
02285 while (fgets (line,255,inpFile))
02286 {
02287 ii++;
02288 int dmy_num = 0 ;
02289 float dmy_calib = 0. ;
02290 float dmy_RMS = 0. ;
02291 int dmy_events = 0 ;
02292 int dmy_status = 0 ;
02293 sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
02294 &dmy_RMS, &dmy_events,
02295 &dmy_status) ;
02296 assert (dmy_num >= 1) ;
02297 assert (dmy_num <= 1700) ;
02298 calib[dmy_num-1] = dmy_calib ;
02299 calib_status[dmy_num-1] = dmy_status ;
02300
02301
02302
02303
02304
02305
02306
02307
02308 }
02309
02310 fclose (inpFile) ;
02311 edm::LogInfo ("EcalTrivialConditionRetriever") << "Read intercalibrations for " << ii << " xtals " ;
02312 if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
02313 << "Some crystals missing, set to 1" << std::endl ;
02314
02315
02316
02317
02318
02319 int sm_db=1 ;
02320
02321 for (int i=0 ; i<1700 ; i++)
02322 {
02323
02324
02325
02326
02327
02328
02329
02330 if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
02331 EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
02332 if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
02333 else ical->setValue (ebid.rawId (), 1.) ;
02334 }
02335
02336 }
02337
02338
02339 return ical;
02340 }
02341
02342
02343
02344
02345 std::auto_ptr<EcalTimeCalibConstants>
02346 EcalTrivialConditionRetriever::getTimeCalibConstantsFromConfiguration
02347 ( const EcalTimeCalibConstantsRcd& )
02348 {
02349 std::auto_ptr<EcalTimeCalibConstants> ical =
02350 std::auto_ptr<EcalTimeCalibConstants>( new EcalTimeCalibConstants() );
02351
02352
02353
02354
02355 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading time calibration constants from file "
02356 << timeCalibConstantsFile_.c_str() ;
02357
02358 FILE *inpFile ;
02359 inpFile = fopen (timeCalibConstantsFile_.c_str (),"r") ;
02360 if (!inpFile)
02361 {
02362 edm::LogError ("EcalTrivialConditionRetriever")
02363 << "*** Can not open file: " << timeCalibConstantsFile_ ;
02364 throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
02365 }
02366
02367 char line[256] ;
02368 std::ostringstream str ;
02369 fgets (line,255,inpFile) ;
02370 int sm_number=atoi (line) ;
02371 str << "sm: " << sm_number ;
02372
02373 fgets (line,255,inpFile) ;
02374
02375
02376 fgets (line,255,inpFile) ;
02377 std::string gen_tag = line ;
02378 str << "gen tag: " << gen_tag ;
02379
02380 fgets (line,255,inpFile) ;
02381 std::string cali_method = line ;
02382 str << "cali method: " << cali_method << std::endl ;
02383
02384 fgets (line,255,inpFile) ;
02385 std::string cali_version = line ;
02386 str << "cali version: " << cali_version << std::endl ;
02387
02388 fgets (line,255,inpFile) ;
02389 std::string cali_type = line ;
02390 str << "cali type: " << cali_type ;
02391
02392 edm::LogInfo("EcalTrivialConditionRetriever")
02393 << "TimeCalibration file - "
02394 << str.str () << std::endl ;
02395
02396 float calib[1700]={1} ;
02397 int calib_status[1700]={0} ;
02398
02399 int ii = 0 ;
02400
02401 while (fgets (line,255,inpFile))
02402 {
02403 ii++;
02404 int dmy_num = 0 ;
02405 float dmy_calib = 0. ;
02406 float dmy_RMS = 0. ;
02407 int dmy_events = 0 ;
02408 int dmy_status = 0 ;
02409 sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
02410 &dmy_RMS, &dmy_events,
02411 &dmy_status) ;
02412 assert (dmy_num >= 1) ;
02413 assert (dmy_num <= 1700) ;
02414 calib[dmy_num-1] = dmy_calib ;
02415 calib_status[dmy_num-1] = dmy_status ;
02416
02417
02418
02419
02420
02421
02422
02423
02424 }
02425
02426 fclose (inpFile) ;
02427 edm::LogInfo ("EcalTrivialConditionRetriever") << "Read timeCalibrations for " << ii << " xtals " ;
02428 if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
02429 << "Some crystals missing, set to 1" << std::endl ;
02430
02431
02432
02433
02434
02435 int sm_db=1 ;
02436
02437 for (int i=0 ; i<1700 ; i++)
02438 {
02439
02440
02441
02442
02443
02444
02445
02446 if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
02447 EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
02448 if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
02449 else ical->setValue (ebid.rawId (), 1.) ;
02450 }
02451
02452 }
02453
02454
02455 return ical;
02456 }
02457
02458
02459 std::auto_ptr<EcalTimeCalibErrors>
02460 EcalTrivialConditionRetriever::getTimeCalibErrorsFromConfiguration
02461 ( const EcalTimeCalibErrorsRcd& )
02462 {
02463 std::auto_ptr<EcalTimeCalibErrors> ical =
02464 std::auto_ptr<EcalTimeCalibErrors>( new EcalTimeCalibErrors() );
02465
02466
02467
02468
02469 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading timeCalibration constants from file "
02470 << timeCalibErrorsFile_.c_str() ;
02471
02472 FILE *inpFile ;
02473 inpFile = fopen (timeCalibErrorsFile_.c_str (),"r") ;
02474 if (!inpFile)
02475 {
02476 edm::LogError ("EcalTrivialConditionRetriever")
02477 << "*** Can not open file: " << timeCalibErrorsFile_ ;
02478 throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
02479 }
02480
02481 char line[256] ;
02482 std::ostringstream str ;
02483 fgets (line,255,inpFile) ;
02484 int sm_number=atoi (line) ;
02485 str << "sm: " << sm_number ;
02486
02487 fgets (line,255,inpFile) ;
02488
02489
02490 fgets (line,255,inpFile) ;
02491 std::string gen_tag = line ;
02492 str << "gen tag: " << gen_tag ;
02493
02494 fgets (line,255,inpFile) ;
02495 std::string cali_method = line ;
02496 str << "cali method: " << cali_method << std::endl ;
02497
02498 fgets (line,255,inpFile) ;
02499 std::string cali_version = line ;
02500 str << "cali version: " << cali_version << std::endl ;
02501
02502 fgets (line,255,inpFile) ;
02503 std::string cali_type = line ;
02504 str << "cali type: " << cali_type ;
02505
02506 edm::LogInfo("EcalTrivialConditionRetriever")
02507 << "TimeCalibration file - "
02508 << str.str () << std::endl ;
02509
02510 float calib[1700]={1} ;
02511 int calib_status[1700]={0} ;
02512
02513 int ii = 0 ;
02514
02515 while (fgets (line,255,inpFile))
02516 {
02517 ii++;
02518 int dmy_num = 0 ;
02519 float dmy_calib = 0. ;
02520 float dmy_RMS = 0. ;
02521 int dmy_events = 0 ;
02522 int dmy_status = 0 ;
02523 sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
02524 &dmy_RMS, &dmy_events,
02525 &dmy_status) ;
02526 assert (dmy_num >= 1) ;
02527 assert (dmy_num <= 1700) ;
02528 calib[dmy_num-1] = dmy_calib ;
02529 calib_status[dmy_num-1] = dmy_status ;
02530
02531
02532
02533
02534
02535
02536
02537
02538 }
02539
02540 fclose (inpFile) ;
02541 edm::LogInfo ("EcalTrivialConditionRetriever") << "Read time calibrations for " << ii << " xtals " ;
02542 if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
02543 << "Some crystals missing, set to 1" << std::endl ;
02544
02545
02546
02547
02548
02549 int sm_db=1 ;
02550
02551 for (int i=0 ; i<1700 ; i++)
02552 {
02553
02554
02555
02556
02557
02558
02559
02560 if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
02561 EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
02562 if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
02563 else ical->setValue (ebid.rawId (), 1.) ;
02564 }
02565
02566 }
02567
02568
02569 return ical;
02570 }
02571
02572
02573
02574 std::auto_ptr<EcalMappingElectronics>
02575 EcalTrivialConditionRetriever::getMappingFromConfiguration (const EcalMappingElectronicsRcd&)
02576 {
02577 std::auto_ptr<EcalMappingElectronics> mapping = std::auto_ptr<EcalMappingElectronics>( new EcalMappingElectronics() );
02578 edm::LogInfo("EcalTrivialConditionRetriever") << "Reading mapping from file " << edm::FileInPath(mappingFile_).fullPath().c_str() ;
02579
02580 std::ifstream f(edm::FileInPath(mappingFile_).fullPath().c_str());
02581 if (!f.good())
02582 {
02583 edm::LogError("EcalTrivialConditionRetriever") << "File not found";
02584 throw cms::Exception("FileNotFound");
02585 }
02586
02587
02588
02589 int ix, iy, iz, CL;
02590
02591
02592 int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
02593 int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
02594
02595 while ( ! f.eof())
02596 {
02597
02598 f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >> tower >>
02599 pseudostrip_in_TCC >> pseudostrip_in_TT ;
02600
02601
02602
02603
02604 EEDetId detid(ix,iy,iz,EEDetId::XYMODE);
02605
02606 EcalElectronicsId elecid(dccid,towerid, pseudostrip_in_SC, xtal_in_pseudostrip);
02607
02608 EcalTriggerElectronicsId triggerid(tccid, tower, pseudostrip_in_TT, xtal_in_pseudostrip);
02609 EcalMappingElement aElement;
02610 aElement.electronicsid = elecid.rawId();
02611 aElement.triggerid = triggerid.rawId();
02612 (*mapping).setValue(detid, aElement);
02613 }
02614
02615 f.close();
02616 return mapping;
02617 }
02618
02619
02620
02621 std::auto_ptr<EcalMappingElectronics>
02622 EcalTrivialConditionRetriever::produceEcalMappingElectronics( const EcalMappingElectronicsRcd& )
02623 {
02624
02625 std::auto_ptr<EcalMappingElectronics> ical = std::auto_ptr<EcalMappingElectronics>( new EcalMappingElectronics() );
02626 return ical;
02627 }
02628
02629
02630
02631 std::auto_ptr<Alignments>
02632 EcalTrivialConditionRetriever::produceEcalAlignmentEB( const EBAlignmentRcd& ) {
02633 double mytrans[3] = {0., 0., 0.};
02634 double myeuler[3] = {0., 0., 0.};
02635 std::ifstream f(edm::FileInPath(EBAlignmentFile_).fullPath().c_str());
02636 std::vector<AlignTransform> my_align;
02637 int ieta = 1;
02638 int iphi = 0;
02639 for(int SM = 1 ; SM < 37; SM++ ) {
02640
02641 if(SM > 18) {
02642 iphi = 1 + (SM - 19) * 20;
02643 ieta = -1;
02644 }
02645 else
02646 iphi = SM * 20;
02647 EBDetId ebdetId(ieta,iphi);
02648 if(getEBAlignmentFromFile_) {
02649 f >> myeuler[0] >> myeuler[1] >> myeuler[2] >> mytrans[0] >> mytrans[1] >> mytrans[2];
02650 std::cout << " translation " << mytrans[0] << " " << mytrans[1] << " " << mytrans[2] << "\n"
02651 << " euler " << myeuler[0] << " " << myeuler[1] << " " << myeuler[2] << std::endl;
02652 }
02653 CLHEP::Hep3Vector translation( mytrans[0], mytrans[1], mytrans[2]);
02654 CLHEP::HepEulerAngles euler( myeuler[0], myeuler[1], myeuler[2]);
02655 AlignTransform transform( translation, euler, ebdetId );
02656 my_align.push_back(transform);
02657 }
02658
02659
02660
02661
02662
02663
02664
02665
02666
02667
02668
02669
02670
02671
02672
02673
02674
02675
02676
02677
02678
02679 Alignments a;
02680 a.m_align = my_align;
02681
02682 std::auto_ptr<Alignments> ical = std::auto_ptr<Alignments>( new Alignments(a) );
02683 return ical;
02684 }
02685
02686 std::auto_ptr<Alignments>
02687 EcalTrivialConditionRetriever::produceEcalAlignmentEE( const EEAlignmentRcd& ) {
02688 double mytrans[3] = {0., 0., 0.};
02689 double myeuler[3] = {0., 0., 0.};
02690 std::ifstream f(edm::FileInPath(EEAlignmentFile_).fullPath().c_str());
02691 std::vector<AlignTransform> my_align;
02692 int ix = 20;
02693 int iy = 50;
02694 int side = -1;
02695 for(int Dee = 0 ; Dee < 4; Dee++ ) {
02696
02697 if(Dee == 1 || Dee == 3)
02698 ix = 70;
02699 else ix = 20;
02700 if(Dee == 2)
02701 side = 1;
02702 EEDetId eedetId(ix, iy, side);
02703 if(getEEAlignmentFromFile_) {
02704 f >> myeuler[0] >> myeuler[1] >> myeuler[2] >> mytrans[0] >> mytrans[1] >> mytrans[2];
02705 std::cout << " translation " << mytrans[0] << " " << mytrans[1] << " " << mytrans[2] << "\n"
02706 << " euler " << myeuler[0] << " " << myeuler[1] << " " << myeuler[2] << std::endl;
02707 }
02708 CLHEP::Hep3Vector translation( mytrans[0], mytrans[1], mytrans[2]);
02709 CLHEP::HepEulerAngles euler( myeuler[0], myeuler[1], myeuler[2]);
02710 AlignTransform transform( translation, euler, eedetId );
02711 my_align.push_back(transform);
02712 }
02713 Alignments a;
02714 a.m_align = my_align;
02715 std::auto_ptr<Alignments> ical = std::auto_ptr<Alignments>( new Alignments(a) );
02716 return ical;
02717 }
02718
02719 std::auto_ptr<Alignments>
02720 EcalTrivialConditionRetriever::produceEcalAlignmentES( const ESAlignmentRcd& ) {
02721 double mytrans[3] = {0., 0., 0.};
02722 double myeuler[3] = {0., 0., 0.};
02723 std::ifstream f(edm::FileInPath(ESAlignmentFile_).fullPath().c_str());
02724 std::vector<AlignTransform> my_align;
02725
02726 int pl_vect[10] = {2, 2, 1, 1, 1, 1, 2, 2};
02727 int iy = 10;
02728 int side = -1;
02729 int strip = 1;
02730 for(int layer = 0 ; layer < 8; layer++ ) {
02731
02732 int ix = 10 + (layer%2) * 20;
02733 int plane = pl_vect[layer];
02734 if(layer > 3) side = 1;
02735 ESDetId esdetId(strip, ix, iy, plane, side);
02736 if(getESAlignmentFromFile_) {
02737 f >> myeuler[0] >> myeuler[1] >> myeuler[2] >> mytrans[0] >> mytrans[1] >> mytrans[2];
02738 std::cout << " translation " << mytrans[0] << " " << mytrans[1] << " " << mytrans[2] << "\n"
02739 << " euler " << myeuler[0] << " " << myeuler[1] << " " << myeuler[2] << std::endl;
02740 }
02741 CLHEP::Hep3Vector translation( mytrans[0], mytrans[1], mytrans[2]);
02742 CLHEP::HepEulerAngles euler( myeuler[0], myeuler[1], myeuler[2]);
02743 AlignTransform transform( translation, euler, esdetId );
02744 my_align.push_back(transform);
02745 }
02746 Alignments a;
02747 a.m_align = my_align;
02748 std::auto_ptr<Alignments> ical = std::auto_ptr<Alignments>( new Alignments(a) );
02749 return ical;
02750 }