47 laserAPDPNTime1_ = (
unsigned long)atoi( ps.
getUntrackedParameter<std::string>(
"laserAPDPNTime1",
"1").c_str());
48 laserAPDPNTime2_= (
unsigned long)atoi( ps.
getUntrackedParameter<std::string>(
"laserAPDPNTime2",
"0").c_str());
49 laserAPDPNTime3_= (
unsigned long)atoi( ps.
getUntrackedParameter<std::string>(
"laserAPDPNTime3",
"0").c_str());
57 localContCorrParameters_ = ps.
getUntrackedParameter< std::vector<double> >(
"localContCorrParameters", std::vector<double>(0) );
58 crackCorrParameters_ = ps.
getUntrackedParameter< std::vector<double> >(
"crackCorrParameters", std::vector<double>(0) );
59 energyCorrectionParameters_ = ps.
getUntrackedParameter< std::vector<double> >(
"energyCorrectionParameters", std::vector<double>(0) );
60 energyUncertaintyParameters_ = ps.
getUntrackedParameter< std::vector<double> >(
"energyUncertaintyParameters", std::vector<double>(0) );
85 if (weightsForAsynchronousRunning_)
87 getWeightsFromFile_ =
true;
92 std::string
path=
"CalibCalorimetry/EcalTrivialCondModules/data/";
93 std::string weightType;
94 std::ostringstream str;
96 if (!weightsForAsynchronousRunning_)
101 weightType = str.str();
103 amplWeightsFile_ = ps.
getUntrackedParameter<std::string>(
"amplWeightsFile",path+
"ampWeights"+weightType);
104 amplWeightsAftFile_ = ps.
getUntrackedParameter<std::string>(
"amplWeightsAftFile",path+
"ampWeightsAfterGainSwitch"+weightType);
105 pedWeightsFile_ = ps.
getUntrackedParameter<std::string>(
"pedWeightsFile",path+
"pedWeights"+weightType);
106 pedWeightsAftFile_ = ps.
getUntrackedParameter<std::string>(
"pedWeightsAftFile",path+
"pedWeightsAfterGainSwitch"+weightType);
107 jittWeightsFile_ = ps.
getUntrackedParameter<std::string>(
"jittWeightsFile",path+
"timeWeights"+weightType);
108 jittWeightsAftFile_ = ps.
getUntrackedParameter<std::string>(
"jittWeightsAftFile",path+
"timeWeightsAfterGainSwitch"+weightType);
109 chi2MatrixFile_ = ps.
getUntrackedParameter<std::string>(
"chi2MatrixFile",path+
"chi2Matrix"+weightType);
110 chi2MatrixAftFile_ = ps.
getUntrackedParameter<std::string>(
"chi2MatrixAftFile",path+
"chi2MatrixAfterGainSwitch"+weightType);
112 amplWeights_.resize(nTDCbins_);
113 amplWeightsAft_.resize(nTDCbins_);
114 pedWeights_.resize(nTDCbins_);
115 pedWeightsAft_.resize(nTDCbins_);
116 jittWeights_.resize(nTDCbins_);
117 jittWeightsAft_.resize(nTDCbins_);
118 chi2Matrix_.resize(nTDCbins_);
119 chi2MatrixAft_.resize(nTDCbins_);
122 getWeightsFromConfiguration(ps);
130 producedEcalMappingElectronics_ = ps.
getUntrackedParameter<
bool>(
"producedEcalMappingElectronics",
true);
133 if ( producedEcalMappingElectronics_ ) {
134 if ( mappingFile_ !=
"" ) {
139 findingRecord<EcalMappingElectronicsRcd>();
146 if (producedEcalPedestals_)
149 if (producedEcalWeights_) {
154 if (producedEcalGainRatios_)
157 if (producedEcalADCToGeVConstant_)
161 producedEcalIntercalibConstants_ = ps.
getUntrackedParameter<
bool>(
"producedEcalIntercalibConstants",
true);
164 if (producedEcalIntercalibConstants_) {
165 if(intercalibConstantsFile_ !=
"") {
170 findingRecord<EcalIntercalibConstantsRcd> () ;
173 producedEcalIntercalibConstantsMC_ = ps.
getUntrackedParameter<
bool>(
"producedEcalIntercalibConstantsMC",
true);
175 if (producedEcalIntercalibConstantsMC_) {
177 findingRecord<EcalIntercalibConstantsMCRcd> () ;
184 if (producedEcalIntercalibErrors_) {
185 if(intercalibErrorsFile_ !=
"") {
190 findingRecord<EcalIntercalibErrorsRcd> () ;
194 producedEcalTimeCalibConstants_ = ps.
getUntrackedParameter<
bool>(
"producedEcalTimeCalibConstants",
true);
197 if (producedEcalTimeCalibConstants_) {
198 if(timeCalibConstantsFile_ !=
"") {
203 findingRecord<EcalTimeCalibConstantsRcd> () ;
210 if (producedEcalTimeCalibErrors_) {
211 if(timeCalibErrorsFile_ !=
"") {
216 findingRecord<EcalTimeCalibErrorsRcd> () ;
220 producedEcalClusterLocalContCorrParameters_ = ps.
getUntrackedParameter<
bool>(
"producedEcalClusterLocalContCorrParameters",
true);
221 producedEcalClusterCrackCorrParameters_ = ps.
getUntrackedParameter<
bool>(
"producedEcalClusterCrackCorrParameters",
true);
222 producedEcalClusterEnergyCorrectionParameters_ = ps.
getUntrackedParameter<
bool>(
"producedEcalClusterEnergyCorrectionParameters",
true);
223 producedEcalClusterEnergyUncertaintyParameters_ = ps.
getUntrackedParameter<
bool>(
"producedEcalClusterEnergyUncertaintyParameters",
true);
224 if ( producedEcalClusterLocalContCorrParameters_ ) {
226 findingRecord<EcalClusterLocalContCorrParametersRcd>();
228 if ( producedEcalClusterCrackCorrParameters_ ) {
230 findingRecord<EcalClusterCrackCorrParametersRcd>();
232 if ( producedEcalClusterEnergyCorrectionParameters_ ) {
234 findingRecord<EcalClusterEnergyCorrectionParametersRcd>();
236 if ( producedEcalClusterEnergyUncertaintyParameters_ ) {
238 findingRecord<EcalClusterEnergyUncertaintyParametersRcd>();
243 if (producedEcalLaserCorrection_) {
246 findingRecord<EcalLaserAlphasRcd> () ;
248 findingRecord<EcalLaserAPDPNRatiosRefRcd> () ;
250 findingRecord<EcalLaserAPDPNRatiosRcd> () ;
257 if ( producedEcalChannelStatus_ ) {
258 if ( channelStatusFile_ !=
"" ) {
263 findingRecord<EcalChannelStatusRcd>();
267 if ( producedEcalDQMChannelStatus_ ) {
269 findingRecord<EcalDQMChannelStatusRcd>();
273 if ( producedEcalDCSTowerStatus_ ) {
275 findingRecord<EcalDCSTowerStatusRcd>();
279 if ( producedEcalDAQTowerStatus_ ) {
281 findingRecord<EcalDAQTowerStatusRcd>();
285 if ( producedEcalDQMTowerStatus_ ) {
287 findingRecord<EcalDQMTowerStatusRcd>();
294 if ( producedEcalTrgChannelStatus_ ) {
295 if ( trgChannelStatusFile_ !=
"" ) {
300 findingRecord<EcalTPGCrystalStatusRcd>();
304 if (producedEcalPedestals_) findingRecord<EcalPedestalsRcd>();
306 if (producedEcalWeights_) {
307 findingRecord<EcalWeightXtalGroupsRcd>();
308 findingRecord<EcalTBWeightsRcd>();
311 if (producedEcalGainRatios_) findingRecord<EcalGainRatiosRcd>();
313 if (producedEcalADCToGeVConstant_) findingRecord<EcalADCToGeVConstantRcd>();
329 if(verbose_>=1)
std::cout <<
"EcalTrivialConditionRetriever::setIntervalFor(): record key = " << rk.
name() <<
"\ttime: " << iTime.
time().
value() << std::endl;
335 std::auto_ptr<EcalPedestals>
337 std::auto_ptr<EcalPedestals> peds = std::auto_ptr<EcalPedestals>(
new EcalPedestals() );
341 EBitem.mean_x1 = EBpedMeanX1_;
342 EBitem.rms_x1 = EBpedRMSX1_;
343 EBitem.mean_x6 = EBpedMeanX6_;
344 EBitem.rms_x6 = EBpedRMSX6_;
345 EBitem.mean_x12 = EBpedMeanX12_;
346 EBitem.rms_x12 = EBpedRMSX12_;
348 EEitem.mean_x1 = EEpedMeanX1_;
349 EEitem.rms_x1 = EEpedRMSX1_;
350 EEitem.mean_x6 = EEpedMeanX6_;
351 EEitem.rms_x6 = EEpedRMSX6_;
352 EEitem.mean_x12 = EEpedMeanX12_;
353 EEitem.rms_x12 = EEpedRMSX12_;
356 if(iEta==0)
continue;
362 peds->insert(std::make_pair(ebdetid.
rawId(),EBitem));
373 peds->insert(std::make_pair(eedetidpos.
rawId(),EEitem));
378 peds->insert(std::make_pair(eedetidneg.
rawId(),EEitem));
387 std::auto_ptr<EcalWeightXtalGroups>
390 std::auto_ptr<EcalWeightXtalGroups> xtalGroups = std::auto_ptr<EcalWeightXtalGroups>(
new EcalWeightXtalGroups() );
393 if(ieta==0)
continue;
400 xtalGroups->setValue(ebid.
rawId(), defaultGroupId );
411 xtalGroups->setValue(eedetidpos.
rawId(), defaultGroupId );
416 xtalGroups->setValue(eedetidneg.
rawId(), defaultGroupId );
423 std::auto_ptr<EcalIntercalibConstants>
426 std::auto_ptr<EcalIntercalibConstants> ical = std::auto_ptr<EcalIntercalibConstants>(
new EcalIntercalibConstants() );
429 if(ieta==0)
continue;
435 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
436 ical->setValue( ebid.
rawId(), intercalibConstantMean_ + r*intercalibConstantSigma_ );
446 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
448 ical->setValue( eedetidpos.
rawId(), intercalibConstantMean_ + r*intercalibConstantSigma_ );
452 double r1 = (double)
std::rand()/( double(RAND_MAX)+double(1) );
454 ical->setValue( eedetidneg.
rawId(), intercalibConstantMean_ + r1*intercalibConstantSigma_ );
462 std::auto_ptr<EcalIntercalibConstantsMC>
465 std::auto_ptr<EcalIntercalibConstantsMC> ical = std::auto_ptr<EcalIntercalibConstantsMC>(
new EcalIntercalibConstantsMC() );
468 if(ieta==0)
continue;
474 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
475 ical->setValue( ebid.
rawId(), intercalibConstantMeanMC_ + r*intercalibConstantSigmaMC_ );
485 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
487 ical->setValue( eedetidpos.
rawId(), intercalibConstantMeanMC_ + r*intercalibConstantSigmaMC_ );
491 double r1 = (double)
std::rand()/( double(RAND_MAX)+double(1) );
493 ical->setValue( eedetidneg.
rawId(), intercalibConstantMeanMC_ + r1*intercalibConstantSigmaMC_ );
501 std::auto_ptr<EcalIntercalibErrors>
504 std::auto_ptr<EcalIntercalibErrors> ical = std::auto_ptr<EcalIntercalibErrors>(
new EcalIntercalibErrors() );
507 if(ieta==0)
continue;
513 ical->setValue( ebid.
rawId(), intercalibErrorMean_);
524 ical->setValue( eedetidpos.
rawId(), intercalibErrorMean_ );
529 ical->setValue( eedetidneg.
rawId(), intercalibErrorMean_ );
537 std::auto_ptr<EcalTimeCalibConstants>
540 std::auto_ptr<EcalTimeCalibConstants> ical = std::auto_ptr<EcalTimeCalibConstants>(
new EcalTimeCalibConstants() );
543 if(ieta==0)
continue;
549 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
550 ical->setValue( ebid.
rawId(), timeCalibConstantMean_ + r*timeCalibConstantSigma_ );
560 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
562 ical->setValue( eedetidpos.
rawId(), timeCalibConstantMean_ + r*timeCalibConstantSigma_ );
566 double r1 = (double)
std::rand()/( double(RAND_MAX)+double(1) );
568 ical->setValue( eedetidneg.
rawId(), timeCalibConstantMean_ + r1*timeCalibConstantSigma_ );
576 std::auto_ptr<EcalTimeCalibErrors>
579 std::auto_ptr<EcalTimeCalibErrors> ical = std::auto_ptr<EcalTimeCalibErrors>(
new EcalTimeCalibErrors() );
582 if(ieta==0)
continue;
588 ical->setValue( ebid.
rawId(), timeCalibErrorMean_);
599 ical->setValue( eedetidpos.
rawId(), timeCalibErrorMean_ );
604 ical->setValue( eedetidneg.
rawId(), timeCalibErrorMean_ );
612 std::auto_ptr<EcalGainRatios>
615 std::auto_ptr<EcalGainRatios> gratio = std::auto_ptr<EcalGainRatios>(
new EcalGainRatios() );
618 gr.setGain6Over1( gainRatio6over1_ );
621 if(ieta==0)
continue;
626 gratio->setValue( ebid.
rawId(), gr );
637 gratio->setValue( eedetidpos.
rawId(), gr );
642 gratio->setValue( eedetidneg.
rawId(), gr );
650 std::auto_ptr<EcalADCToGeVConstant>
653 return std::auto_ptr<EcalADCToGeVConstant>(
new EcalADCToGeVConstant(adcToGeVEBConstant_,adcToGeVEEConstant_) );
656 std::auto_ptr<EcalTBWeights>
660 std::auto_ptr<EcalTBWeights> tbwgt = std::auto_ptr<EcalTBWeights>(
new EcalTBWeights() );
667 for(
int itdc=1; itdc<=nTDCbins_; ++itdc) {
698 mat1.Place_in_row(amplWeights_[itdc-1],0,0);
699 mat1.Place_in_row(pedWeights_[itdc-1],1,0);
700 mat1.Place_in_row(jittWeights_[itdc-1],2,0);
703 mat2.Place_in_row(amplWeightsAft_[itdc-1],0,0);
704 mat2.Place_in_row(pedWeightsAft_[itdc-1],1,0);
705 mat2.Place_in_row(jittWeightsAft_[itdc-1],2,0);
711 mat3=chi2Matrix_[itdc-1];
712 mat4=chi2MatrixAft_[itdc-1];
737 tbwgt->setValue(std::make_pair(igrp,itdc), wgt);
745 std::auto_ptr<EcalClusterLocalContCorrParameters>
749 for (
size_t i = 0;
i < localContCorrParameters_.size(); ++
i ) {
750 ipar->params().push_back( localContCorrParameters_[
i] );
754 std::auto_ptr<EcalClusterCrackCorrParameters>
758 for (
size_t i = 0;
i < crackCorrParameters_.size(); ++
i ) {
759 ipar->params().push_back( crackCorrParameters_[
i] );
763 std::auto_ptr<EcalClusterEnergyCorrectionParameters>
767 for (
size_t i = 0;
i < energyCorrectionParameters_.size(); ++
i ) {
768 ipar->params().push_back( energyCorrectionParameters_[
i] );
772 std::auto_ptr<EcalClusterEnergyUncertaintyParameters>
776 for (
size_t i = 0;
i < energyUncertaintyParameters_.size(); ++
i ) {
777 ipar->params().push_back( energyUncertaintyParameters_[
i] );
784 std::auto_ptr<EcalLaserAlphas>
787 std::auto_ptr<EcalLaserAlphas> ical = std::auto_ptr<EcalLaserAlphas>(
new EcalLaserAlphas() );
789 if(ieta==0)
continue;
793 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
794 ical->setValue( ebid, laserAlphaMean_ + r*laserAlphaSigma_ );
803 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
805 ical->setValue( eedetidpos, laserAlphaMean_ + r*laserAlphaSigma_ );
809 double r1 = (double)
std::rand()/( double(RAND_MAX)+double(1) );
811 ical->setValue( eedetidneg, laserAlphaMean_ + r1*laserAlphaSigma_ );
820 std::auto_ptr<EcalLaserAPDPNRatiosRef>
823 std::auto_ptr<EcalLaserAPDPNRatiosRef> ical = std::auto_ptr<EcalLaserAPDPNRatiosRef>(
new EcalLaserAPDPNRatiosRef() );
825 if(ieta==0)
continue;
829 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
830 ical->setValue( ebid, laserAPDPNRefMean_ + r*laserAPDPNRefSigma_ );
839 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
841 ical->setValue( eedetidpos, laserAPDPNRefMean_ + r*laserAPDPNRefSigma_ );
845 double r1 = (double)
std::rand()/( double(RAND_MAX)+double(1) );
847 ical->setValue( eedetidneg, laserAPDPNRefMean_ + r1*laserAPDPNRefSigma_ );
856 std::auto_ptr<EcalLaserAPDPNRatios>
860 std::auto_ptr<EcalLaserAPDPNRatios> ical = std::auto_ptr<EcalLaserAPDPNRatios>(
new EcalLaserAPDPNRatios() );
862 if(ieta==0)
continue;
866 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
869 pairAPDPN.
p1 = laserAPDPNMean_ + r*laserAPDPNSigma_;
870 pairAPDPN.
p2 = laserAPDPNMean_ + r*laserAPDPNSigma_;
871 pairAPDPN.
p3 = laserAPDPNMean_ + r*laserAPDPNSigma_;
872 ical->setValue( ebid, pairAPDPN );
881 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
885 pairAPDPN.
p1 = laserAPDPNMean_ + r*laserAPDPNSigma_;
886 pairAPDPN.
p2 = laserAPDPNMean_ + r*laserAPDPNSigma_;
887 pairAPDPN.
p3 = laserAPDPNMean_ + r*laserAPDPNSigma_;
888 ical->setValue( eedetidpos, pairAPDPN );
892 double r1 = (double)
std::rand()/( double(RAND_MAX)+double(1) );
896 pairAPDPN.
p1 = laserAPDPNMean_ + r1*laserAPDPNSigma_;
897 pairAPDPN.
p2 = laserAPDPNMean_ + r1*laserAPDPNSigma_;
898 pairAPDPN.
p3 = laserAPDPNMean_ + r1*laserAPDPNSigma_;
899 ical->setValue( eedetidneg, pairAPDPN );
906 for(
int i=0;
i<92;
i++){
908 if(laserAPDPNTime2_ == 0 ){
913 if(laserAPDPNTime3_ == 0 ){
919 ical->setTime(
i, TimeStamp );
930 std::vector < std::vector<double> > amplwgtv(nTDCbins_);
932 if (!getWeightsFromFile_ && nTDCbins_ == 1)
934 std::vector<double> vampl;
936 vampl.push_back( -0.33333 );
937 vampl.push_back( -0.33333 );
938 vampl.push_back( -0.33333 );
939 vampl.push_back( 0. );
940 vampl.push_back( 0. );
941 vampl.push_back( 1. );
942 vampl.push_back( 0. );
943 vampl.push_back( 0. );
944 vampl.push_back( 0. );
945 vampl.push_back( 0. );
948 else if (getWeightsFromFile_)
951 std::ifstream amplFile(
edm::FileInPath(amplWeightsFile_).fullPath().c_str());
953 while (!amplFile.eof() && tdcBin < nTDCbins_)
955 for(
int j = 0;
j < 10; ++
j) {
958 amplwgtv[tdcBin].push_back(ww);
962 assert (tdcBin == nTDCbins_);
968 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
973 for (
int i=0;
i<nTDCbins_;
i++)
975 assert(amplwgtv[
i].
size() == 10);
977 for(std::vector<double>::const_iterator it = amplwgtv[
i].
begin(); it != amplwgtv[
i].end(); ++it)
979 (amplWeights_[
i])[j]=*it;
985 std::vector < std::vector<double> > amplwgtvAftGain(nTDCbins_);
987 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
989 std::vector<double> vamplAftGain;
990 vamplAftGain.push_back( 0. );
991 vamplAftGain.push_back( 0. );
992 vamplAftGain.push_back( 0. );
993 vamplAftGain.push_back( 0. );
994 vamplAftGain.push_back( 0. );
995 vamplAftGain.push_back( 1. );
996 vamplAftGain.push_back( 0. );
997 vamplAftGain.push_back( 0. );
998 vamplAftGain.push_back( 0. );
999 vamplAftGain.push_back( 0. );
1000 amplwgtvAftGain[0] = ps.
getUntrackedParameter< std::vector<double> >(
"amplWeightsAftGain", vamplAftGain);
1002 else if (getWeightsFromFile_)
1006 std::ifstream amplFile(
edm::FileInPath(amplWeightsAftFile_).fullPath().c_str());
1008 while (!amplFile.eof() && tdcBin < nTDCbins_)
1010 for(
int j = 0;
j < 10; ++
j) {
1013 amplwgtvAftGain[tdcBin].push_back(ww);
1017 assert (tdcBin == nTDCbins_);
1022 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
1026 for (
int i=0;
i<nTDCbins_;
i++)
1028 assert(amplwgtvAftGain[
i].
size() == 10);
1030 for(std::vector<double>::const_iterator it = amplwgtvAftGain[
i].
begin(); it != amplwgtvAftGain[
i].end(); ++it) {
1031 (amplWeightsAft_[
i])[j]=*it;
1038 std::vector< std::vector<double> > pedwgtv(nTDCbins_);
1040 if (!getWeightsFromFile_ && nTDCbins_ == 1)
1042 std::vector<double> vped;
1043 vped.push_back( 0.33333 );
1044 vped.push_back( 0.33333 );
1045 vped.push_back( 0.33333 );
1046 vped.push_back( 0. );
1047 vped.push_back( 0. );
1048 vped.push_back( 0. );
1049 vped.push_back( 0. );
1050 vped.push_back( 0. );
1051 vped.push_back( 0. );
1052 vped.push_back( 0. );
1055 else if (getWeightsFromFile_)
1059 std::ifstream pedFile(
edm::FileInPath(pedWeightsFile_).fullPath().c_str());
1061 while (!pedFile.eof() && tdcBin < nTDCbins_)
1063 for(
int j = 0;
j < 10; ++
j) {
1066 pedwgtv[tdcBin].push_back(ww);
1070 assert (tdcBin == nTDCbins_);
1075 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
1079 for (
int i=0;
i<nTDCbins_;
i++)
1081 assert(pedwgtv[
i].
size() == 10);
1083 for(std::vector<double>::const_iterator it = pedwgtv[
i].
begin(); it != pedwgtv[
i].end(); ++it) {
1084 (pedWeights_[
i])[j] = *it;
1089 std::vector< std::vector<double> > pedwgtvaft(nTDCbins_);
1091 if (!getWeightsFromFile_ && nTDCbins_ == 1)
1093 std::vector<double> vped;
1094 vped.push_back( 0. );
1095 vped.push_back( 0. );
1096 vped.push_back( 0. );
1097 vped.push_back( 0. );
1098 vped.push_back( 0. );
1099 vped.push_back( 0. );
1100 vped.push_back( 0. );
1101 vped.push_back( 0. );
1102 vped.push_back( 0. );
1103 vped.push_back( 0. );
1106 else if (getWeightsFromFile_)
1110 std::ifstream pedFile(
edm::FileInPath(pedWeightsAftFile_).fullPath().c_str());
1112 while (!pedFile.eof() && tdcBin < nTDCbins_)
1114 for(
int j = 0;
j < 10; ++
j) {
1117 pedwgtvaft[tdcBin].push_back(ww);
1121 assert (tdcBin == nTDCbins_);
1126 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
1130 for (
int i=0;
i<nTDCbins_;
i++)
1132 assert(pedwgtvaft[
i].
size() == 10);
1134 for(std::vector<double>::const_iterator it = pedwgtvaft[
i].
begin(); it != pedwgtvaft[
i].end(); ++it) {
1135 (pedWeightsAft_[
i])[j]=*it;
1144 std::vector< std::vector<double> > jittwgtv(nTDCbins_);
1146 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
1148 std::vector<double> vjitt;
1149 vjitt.push_back( 0.04066309 );
1150 vjitt.push_back( 0.04066309 );
1151 vjitt.push_back( 0.04066309 );
1152 vjitt.push_back( 0.000 );
1153 vjitt.push_back( 1.325176 );
1154 vjitt.push_back( -0.04997078 );
1155 vjitt.push_back( -0.504338 );
1156 vjitt.push_back( -0.5024844 );
1157 vjitt.push_back( -0.3903718 );
1158 vjitt.push_back( 0.000 );
1161 else if (getWeightsFromFile_)
1165 std::ifstream jittFile(
edm::FileInPath(jittWeightsFile_).fullPath().c_str());
1167 while (!jittFile.eof() && tdcBin < nTDCbins_)
1169 for(
int j = 0;
j < 10; ++
j) {
1172 jittwgtv[tdcBin].push_back(ww);
1176 assert (tdcBin == nTDCbins_);
1181 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
1185 for (
int i=0;
i<nTDCbins_;
i++)
1187 assert(jittwgtv[
i].
size() == 10);
1189 for(std::vector<double>::const_iterator it = jittwgtv[
i].
begin(); it != jittwgtv[
i].end(); ++it) {
1190 (jittWeights_[
i])[j]= *it;
1195 std::vector< std::vector<double> > jittwgtvaft(nTDCbins_);
1197 if (!getWeightsFromFile_ && nTDCbins_ == 1)
1199 std::vector<double> vjitt;
1200 vjitt.push_back( 0. );
1201 vjitt.push_back( 0. );
1202 vjitt.push_back( 0. );
1203 vjitt.push_back( 0. );
1204 vjitt.push_back( 1.097871 );
1205 vjitt.push_back( -0.04551035 );
1206 vjitt.push_back( -0.4159156 );
1207 vjitt.push_back( -0.4185352 );
1208 vjitt.push_back( -0.3367127 );
1209 vjitt.push_back( 0. );
1212 else if (getWeightsFromFile_)
1216 std::ifstream jittFile(
edm::FileInPath(jittWeightsAftFile_).fullPath().c_str());
1218 while (!jittFile.eof() && tdcBin < nTDCbins_)
1220 for(
int j = 0;
j < 10; ++
j) {
1223 jittwgtvaft[tdcBin].push_back(ww);
1227 assert (tdcBin == nTDCbins_);
1232 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
1236 for (
int i=0;
i<nTDCbins_;
i++)
1238 assert(jittwgtvaft[
i].
size() == 10);
1240 for(std::vector<double>::const_iterator it = jittwgtvaft[
i].
begin(); it != jittwgtvaft[
i].end(); ++it) {
1241 (jittWeightsAft_[
i])[j]= *it;
1247 std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2Matrix(nTDCbins_);
1248 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
1254 chi2Matrix[0](0,0) = 0.694371;
1255 chi2Matrix[0](0,1) = -0.305629;
1256 chi2Matrix[0](0,2) = -0.305629;
1257 chi2Matrix[0](0,3) = 0.;
1258 chi2Matrix[0](0,4) = 0.;
1259 chi2Matrix[0](0,5) = 0.;
1260 chi2Matrix[0](0,6) = 0.;
1261 chi2Matrix[0](0,7) = 0.;
1262 chi2Matrix[0](0,8) = 0.;
1263 chi2Matrix[0](0,9) = 0.;
1264 chi2Matrix[0](1,0) = -0.305629;
1265 chi2Matrix[0](1,1) = 0.694371;
1266 chi2Matrix[0](1,2) = -0.305629;
1267 chi2Matrix[0](1,3) = 0.;
1268 chi2Matrix[0](1,4) = 0.;
1269 chi2Matrix[0](1,5) = 0.;
1270 chi2Matrix[0](1,6) = 0.;
1271 chi2Matrix[0](1,7) = 0.;
1272 chi2Matrix[0](1,8) = 0.;
1273 chi2Matrix[0](1,9) = 0.;
1274 chi2Matrix[0](2,0) = -0.305629;
1275 chi2Matrix[0](2,1) = -0.305629;
1276 chi2Matrix[0](2,2) = 0.694371;
1277 chi2Matrix[0](2,3) = 0.;
1278 chi2Matrix[0](2,4) = 0.;
1279 chi2Matrix[0](2,5) = 0.;
1280 chi2Matrix[0](2,6) = 0.;
1281 chi2Matrix[0](2,7) = 0.;
1282 chi2Matrix[0](2,8) = 0.;
1283 chi2Matrix[0](2,9) = 0.;
1284 chi2Matrix[0](3,0) = 0.;
1285 chi2Matrix[0](3,1) = 0.;
1286 chi2Matrix[0](3,2) = 0.;
1287 chi2Matrix[0](3,3) = 0.;
1288 chi2Matrix[0](3,4) = 0.;
1289 chi2Matrix[0](3,5) = 0.;
1290 chi2Matrix[0](3,6) = 0.;
1291 chi2Matrix[0](3,7) = 0.;
1292 chi2Matrix[0](3,8) = 0.;
1293 chi2Matrix[0](3,9) = 0.;
1294 chi2Matrix[0](4,0) = 0.;
1295 chi2Matrix[0](4,1) = 0.;
1296 chi2Matrix[0](4,2) = 0.;
1297 chi2Matrix[0](4,3) = 0.;
1298 chi2Matrix[0](4,4) = 0.8027116;
1299 chi2Matrix[0](4,5) = -0.2517103;
1300 chi2Matrix[0](4,6) = -0.2232882;
1301 chi2Matrix[0](4,7) = -0.1716192;
1302 chi2Matrix[0](4,8) = -0.1239006;
1303 chi2Matrix[0](4,9) = 0.;
1304 chi2Matrix[0](5,0) = 0.;
1305 chi2Matrix[0](5,1) = 0.;
1306 chi2Matrix[0](5,2) = 0.;
1307 chi2Matrix[0](5,3) = 0.;
1308 chi2Matrix[0](5,4) = -0.2517103;
1309 chi2Matrix[0](5,5) = 0.6528964;
1310 chi2Matrix[0](5,6) = -0.2972839;
1311 chi2Matrix[0](5,7) = -0.2067162;
1312 chi2Matrix[0](5,8) = -0.1230729;
1313 chi2Matrix[0](5,9) = 0.;
1314 chi2Matrix[0](6,0) = 0.;
1315 chi2Matrix[0](6,1) = 0.;
1316 chi2Matrix[0](6,2) = 0.;
1317 chi2Matrix[0](6,3) = 0.;
1318 chi2Matrix[0](6,4) = -0.2232882;
1319 chi2Matrix[0](6,5) = -0.2972839;
1320 chi2Matrix[0](6,6) = 0.7413607;
1321 chi2Matrix[0](6,7) = -0.1883866;
1322 chi2Matrix[0](6,8) = -0.1235052;
1323 chi2Matrix[0](6,9) = 0.;
1324 chi2Matrix[0](7,0) = 0.;
1325 chi2Matrix[0](7,1) = 0.;
1326 chi2Matrix[0](7,2) = 0.;
1327 chi2Matrix[0](7,3) = 0.;
1328 chi2Matrix[0](7,4) = -0.1716192;
1329 chi2Matrix[0](7,5) = -0.2067162;
1330 chi2Matrix[0](7,6) = -0.1883866;
1331 chi2Matrix[0](7,7) = 0.844935;
1332 chi2Matrix[0](7,8) = -0.124291;
1333 chi2Matrix[0](7,9) = 0.;
1334 chi2Matrix[0](8,0) = 0.;
1335 chi2Matrix[0](8,1) = 0.;
1336 chi2Matrix[0](8,2) = 0.;
1337 chi2Matrix[0](8,3) = 0.;
1338 chi2Matrix[0](8,4) = -0.1239006;
1339 chi2Matrix[0](8,5) = -0.1230729;
1340 chi2Matrix[0](8,6) = -0.1235052;
1341 chi2Matrix[0](8,7) = -0.124291;
1342 chi2Matrix[0](8,8) = 0.8749833;
1343 chi2Matrix[0](8,9) = 0.;
1344 chi2Matrix[0](9,0) = 0.;
1345 chi2Matrix[0](9,1) = 0.;
1346 chi2Matrix[0](9,2) = 0.;
1347 chi2Matrix[0](9,3) = 0.;
1348 chi2Matrix[0](9,4) = 0.;
1349 chi2Matrix[0](9,5) = 0.;
1350 chi2Matrix[0](9,6) = 0.;
1351 chi2Matrix[0](9,7) = 0.;
1352 chi2Matrix[0](9,8) = 0.;
1353 chi2Matrix[0](9,9) = 0.;
1355 else if (getWeightsFromFile_)
1359 std::ifstream chi2MatrixFile(
edm::FileInPath(chi2MatrixFile_).fullPath().c_str());
1361 while (!chi2MatrixFile.eof() && tdcBin < nTDCbins_)
1364 for(
int j = 0;
j < 10; ++
j) {
1365 for(
int l = 0;
l < 10; ++
l) {
1367 chi2MatrixFile >> ww;
1368 chi2Matrix[tdcBin](
j,
l)=ww;
1373 assert (tdcBin == nTDCbins_);
1378 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
1385 chi2Matrix_ = chi2Matrix;
1388 std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2MatrixAft(nTDCbins_);
1389 if (!getWeightsFromFile_ && nTDCbins_ == 1 )
1395 chi2MatrixAft[0](0,0) = 0.;
1396 chi2MatrixAft[0](0,1) = 0.;
1397 chi2MatrixAft[0](0,2) = 0.;
1398 chi2MatrixAft[0](0,3) = 0.;
1399 chi2MatrixAft[0](0,4) = 0.;
1400 chi2MatrixAft[0](0,5) = 0.;
1401 chi2MatrixAft[0](0,6) = 0.;
1402 chi2MatrixAft[0](0,7) = 0.;
1403 chi2MatrixAft[0](0,8) = 0.;
1404 chi2MatrixAft[0](0,9) = 0.;
1405 chi2MatrixAft[0](1,0) = 0.;
1406 chi2MatrixAft[0](1,1) = 0.;
1407 chi2MatrixAft[0](1,2) = 0.;
1408 chi2MatrixAft[0](1,3) = 0.;
1409 chi2MatrixAft[0](1,4) = 0.;
1410 chi2MatrixAft[0](1,5) = 0.;
1411 chi2MatrixAft[0](1,6) = 0.;
1412 chi2MatrixAft[0](1,7) = 0.;
1413 chi2MatrixAft[0](1,8) = 0.;
1414 chi2MatrixAft[0](1,9) = 0.;
1415 chi2MatrixAft[0](2,0) = 0.;
1416 chi2MatrixAft[0](2,1) = 0.;
1417 chi2MatrixAft[0](2,2) = 0.;
1418 chi2MatrixAft[0](2,3) = 0.;
1419 chi2MatrixAft[0](2,4) = 0.;
1420 chi2MatrixAft[0](2,5) = 0.;
1421 chi2MatrixAft[0](2,6) = 0.;
1422 chi2MatrixAft[0](2,7) = 0.;
1423 chi2MatrixAft[0](2,8) = 0.;
1424 chi2MatrixAft[0](2,9) = 0.;
1425 chi2MatrixAft[0](3,0) = 0.;
1426 chi2MatrixAft[0](3,1) = 0.;
1427 chi2MatrixAft[0](3,2) = 0.;
1428 chi2MatrixAft[0](3,3) = 0.;
1429 chi2MatrixAft[0](3,4) = 0.;
1430 chi2MatrixAft[0](3,5) = 0.;
1431 chi2MatrixAft[0](3,6) = 0.;
1432 chi2MatrixAft[0](3,7) = 0.;
1433 chi2MatrixAft[0](3,8) = 0.;
1434 chi2MatrixAft[0](3,9) = 0.;
1435 chi2MatrixAft[0](4,0) = 0.;
1436 chi2MatrixAft[0](4,1) = 0.;
1437 chi2MatrixAft[0](4,2) = 0.;
1438 chi2MatrixAft[0](4,3) = 0.;
1439 chi2MatrixAft[0](4,4) = 0.8030884;
1440 chi2MatrixAft[0](4,5) = -0.2543541;
1441 chi2MatrixAft[0](4,6) = -0.2243544;
1442 chi2MatrixAft[0](4,7) = -0.1698177;
1443 chi2MatrixAft[0](4,8) = -0.1194506;
1444 chi2MatrixAft[0](4,9) = 0.;
1445 chi2MatrixAft[0](5,0) = 0.;
1446 chi2MatrixAft[0](5,1) = 0.;
1447 chi2MatrixAft[0](5,2) = 0.;
1448 chi2MatrixAft[0](5,3) = 0.;
1449 chi2MatrixAft[0](5,4) = -0.2543541;
1450 chi2MatrixAft[0](5,5) = 0.6714465;
1451 chi2MatrixAft[0](5,6) = -0.2898025;
1452 chi2MatrixAft[0](5,7) = -0.2193564;
1453 chi2MatrixAft[0](5,8) = -0.1542964;
1454 chi2MatrixAft[0](5,9) = 0.;
1455 chi2MatrixAft[0](6,0) = 0.;
1456 chi2MatrixAft[0](6,1) = 0.;
1457 chi2MatrixAft[0](6,2) = 0.;
1458 chi2MatrixAft[0](6,3) = 0.;
1459 chi2MatrixAft[0](6,4) = -0.2243544;
1460 chi2MatrixAft[0](6,5) = -0.2898025;
1461 chi2MatrixAft[0](6,6) = 0.7443781;
1462 chi2MatrixAft[0](6,7) = -0.1934846;
1463 chi2MatrixAft[0](6,8) = -0.136098;
1464 chi2MatrixAft[0](6,9) = 0.;
1465 chi2MatrixAft[0](7,0) = 0.;
1466 chi2MatrixAft[0](7,1) = 0.;
1467 chi2MatrixAft[0](7,2) = 0.;
1468 chi2MatrixAft[0](7,3) = 0.;
1469 chi2MatrixAft[0](7,4) = -0.1698177;
1470 chi2MatrixAft[0](7,5) = -0.2193564;
1471 chi2MatrixAft[0](7,6) = -0.1934846;
1472 chi2MatrixAft[0](7,7) = 0.8535482;
1473 chi2MatrixAft[0](7,8) = -0.1030149;
1474 chi2MatrixAft[0](7,9) = 0.;
1475 chi2MatrixAft[0](8,0) = 0.;
1476 chi2MatrixAft[0](8,1) = 0.;
1477 chi2MatrixAft[0](8,2) = 0.;
1478 chi2MatrixAft[0](8,3) = 0.;
1479 chi2MatrixAft[0](8,4) = -0.1194506;
1480 chi2MatrixAft[0](8,5) = -0.1542964;
1481 chi2MatrixAft[0](8,6) = -0.136098;
1482 chi2MatrixAft[0](8,7) = -0.1030149;
1483 chi2MatrixAft[0](8,8) = 0.9275388;
1484 chi2MatrixAft[0](8,9) = 0.;
1485 chi2MatrixAft[0](9,0) = 0.;
1486 chi2MatrixAft[0](9,1) = 0.;
1487 chi2MatrixAft[0](9,2) = 0.;
1488 chi2MatrixAft[0](9,3) = 0.;
1489 chi2MatrixAft[0](9,4) = 0.;
1490 chi2MatrixAft[0](9,5) = 0.;
1491 chi2MatrixAft[0](9,6) = 0.;
1492 chi2MatrixAft[0](9,7) = 0.;
1493 chi2MatrixAft[0](9,8) = 0.;
1494 chi2MatrixAft[0](9,9) = 0.;
1496 else if (getWeightsFromFile_)
1500 std::ifstream chi2MatrixAftFile(
edm::FileInPath(chi2MatrixAftFile_).fullPath().c_str());
1502 while (!chi2MatrixAftFile.eof() && tdcBin < nTDCbins_)
1505 for(
int j = 0;
j < 10; ++
j) {
1506 for(
int l = 0;
l < 10; ++
l) {
1508 chi2MatrixAftFile >> ww;
1509 chi2MatrixAft[tdcBin](
j,
l)=ww;
1514 assert (tdcBin == nTDCbins_);
1519 edm::LogError(
"EcalTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
1526 chi2MatrixAft_ = chi2MatrixAft;
1534 std::auto_ptr<EcalChannelStatus>
1537 std::auto_ptr<EcalChannelStatus> ecalStatus = std::auto_ptr<EcalChannelStatus>(
new EcalChannelStatus() );
1544 if(ieta==0)
continue;
1548 ecalStatus->setValue( ebid, 0 );
1558 ecalStatus->setValue( eedetidpos, 0 );
1562 ecalStatus->setValue( eedetidneg, 0 );
1572 std::ifstream statusFile(
edm::FileInPath(channelStatusFile_).fullPath().c_str());
1573 if ( !statusFile.good() ) {
1575 <<
"*** Problems opening file: " << channelStatusFile_ ;
1579 std::string EcalSubDet;
1584 while (!statusFile.eof())
1586 statusFile >> EcalSubDet;
1587 if (EcalSubDet!=std::string(
"EB") && EcalSubDet!=std::string(
"EE"))
1589 std::getline(statusFile,str);
1594 statusFile>> hashIndex >>
status;
1598 if(EcalSubDet==std::string(
"EB"))
1601 ecalStatus->setValue( ebid, status );
1603 else if(EcalSubDet==std::string(
"EE"))
1606 ecalStatus->setValue( eedetid, status );
1611 <<
" *** " << EcalSubDet <<
" is neither EB nor EE ";
1624 std::auto_ptr<EcalChannelStatus>
1628 std::auto_ptr<EcalChannelStatus> ical = std::auto_ptr<EcalChannelStatus>(
new EcalChannelStatus() );
1631 if(ieta==0)
continue;
1635 ical->setValue( ebid, 0 );
1645 ical->setValue( eedetidpos, 0 );
1649 ical->setValue( eedetidneg, 0 );
1657 std::auto_ptr<EcalDQMChannelStatus>
1662 std::auto_ptr<EcalDQMChannelStatus> ical = std::auto_ptr<EcalDQMChannelStatus>(
new EcalDQMChannelStatus() );
1665 if(ieta==0)
continue;
1669 ical->setValue( ebid, sta );
1679 ical->setValue( eedetidpos, sta );
1683 ical->setValue( eedetidneg, sta );
1691 std::auto_ptr<EcalDQMTowerStatus>
1695 std::auto_ptr<EcalDQMTowerStatus> ical = std::auto_ptr<EcalDQMTowerStatus>(
new EcalDQMTowerStatus() );
1701 for(
int k=0 ;
k<2;
k++ ) {
1704 for(
int i=1 ;
i<73;
i++) {
1705 for(
int j=1 ;
j<18;
j++) {
1709 ical->setValue( ebid, sta );
1717 for(
int k=0 ;
k<2;
k++ ) {
1720 for(
int i=1 ;
i<21;
i++) {
1721 for(
int j=1 ;
j<21;
j++) {
1724 ical->setValue( eeid, sta );
1734 std::auto_ptr<EcalDCSTowerStatus>
1738 std::auto_ptr<EcalDCSTowerStatus> ical = std::auto_ptr<EcalDCSTowerStatus>(
new EcalDCSTowerStatus() );
1744 for(
int k=0 ;
k<2;
k++ ) {
1747 for(
int i=1 ;
i<73;
i++) {
1748 for(
int j=1 ;
j<18;
j++) {
1752 ical->setValue( ebid, status );
1760 for(
int k=0 ;
k<2;
k++ ) {
1763 for(
int i=1 ;
i<21;
i++) {
1764 for(
int j=1 ;
j<21;
j++) {
1767 ical->setValue( eeid, status );
1777 std::auto_ptr<EcalDAQTowerStatus>
1781 std::auto_ptr<EcalDAQTowerStatus> ical = std::auto_ptr<EcalDAQTowerStatus>(
new EcalDAQTowerStatus() );
1787 for(
int k=0 ;
k<2;
k++ ) {
1790 for(
int i=1 ;
i<73;
i++) {
1791 for(
int j=1 ;
j<18;
j++) {
1795 ical->setValue( ebid, status );
1803 for(
int k=0 ;
k<2;
k++ ) {
1806 for(
int i=1 ;
i<21;
i++) {
1807 for(
int j=1 ;
j<21;
j++) {
1810 ical->setValue( eeid, status );
1820 std::auto_ptr<EcalTPGCrystalStatus>
1823 std::auto_ptr<EcalTPGCrystalStatus> ecalStatus = std::auto_ptr<EcalTPGCrystalStatus>(
new EcalTPGCrystalStatus() );
1830 if(ieta==0)
continue;
1834 ecalStatus->setValue( ebid, 0 );
1844 ecalStatus->setValue( eedetidpos, 0 );
1848 ecalStatus->setValue( eedetidneg, 0 );
1858 std::ifstream statusFile(
edm::FileInPath(channelStatusFile_).fullPath().c_str());
1859 if ( !statusFile.good() ) {
1861 <<
"*** Problems opening file: " << channelStatusFile_ ;
1865 std::string EcalSubDet;
1870 while (!statusFile.eof())
1872 statusFile >> EcalSubDet;
1873 if (EcalSubDet!=std::string(
"EB") && EcalSubDet!=std::string(
"EE"))
1875 std::getline(statusFile,str);
1880 statusFile>> hashIndex >>
status;
1884 if(EcalSubDet==std::string(
"EB"))
1887 ecalStatus->setValue( ebid, status );
1889 else if(EcalSubDet==std::string(
"EE"))
1892 ecalStatus->setValue( eedetid, status );
1897 <<
" *** " << EcalSubDet <<
" is neither EB nor EE ";
1910 std::auto_ptr<EcalTPGCrystalStatus>
1914 std::auto_ptr<EcalTPGCrystalStatus> ical = std::auto_ptr<EcalTPGCrystalStatus>(
new EcalTPGCrystalStatus() );
1917 if(ieta==0)
continue;
1921 ical->setValue( ebid, 0 );
1931 ical->setValue( eedetidpos, 0 );
1935 ical->setValue( eedetidneg, 0 );
1947 std::auto_ptr<EcalIntercalibConstants>
1951 std::auto_ptr<EcalIntercalibConstants> ical =
1957 edm::LogInfo(
"EcalTrivialConditionRetriever") <<
"Reading intercalibration constants from file "
1958 << intercalibConstantsFile_.c_str() ;
1961 inpFile = fopen (intercalibConstantsFile_.c_str (),
"r") ;
1965 <<
"*** Can not open file: " << intercalibConstantsFile_ ;
1966 throw cms::Exception (
"Cannot open inter-calibration coefficients txt file") ;
1970 std::ostringstream str ;
1971 fgets (line,255,inpFile) ;
1972 int sm_number=atoi (line) ;
1973 str <<
"sm: " << sm_number ;
1975 fgets (line,255,inpFile) ;
1978 fgets (line,255,inpFile) ;
1979 std::string gen_tag =
line ;
1980 str <<
"gen tag: " << gen_tag ;
1982 fgets (line,255,inpFile) ;
1983 std::string cali_method =
line ;
1984 str <<
"cali method: " << cali_method << std::endl ;
1986 fgets (line,255,inpFile) ;
1987 std::string cali_version =
line ;
1988 str <<
"cali version: " << cali_version << std::endl ;
1990 fgets (line,255,inpFile) ;
1991 std::string cali_type =
line ;
1992 str <<
"cali type: " << cali_type ;
1995 <<
"[PIETRO] Intercalibration file - "
1996 << str.str () << std::endl ;
1998 float calib[1700]={1} ;
1999 float calib_rms[1700]={0} ;
2000 int calib_nevents[1700]={0} ;
2001 int calib_status[1700]={0} ;
2005 while (fgets (line,255,inpFile))
2009 float dmy_calib = 0. ;
2010 float dmy_RMS = 0. ;
2011 int dmy_events = 0 ;
2012 int dmy_status = 0 ;
2013 sscanf (line,
"%d %f %f %d %d", &dmy_num, &dmy_calib,
2014 &dmy_RMS, &dmy_events,
2016 assert (dmy_num >= 1) ;
2017 assert (dmy_num <= 1700) ;
2018 calib[dmy_num-1] = dmy_calib ;
2019 calib_rms[dmy_num-1] = dmy_RMS ;
2020 calib_nevents[dmy_num-1] = dmy_events ;
2021 calib_status[dmy_num-1] = dmy_status ;
2033 edm::LogInfo (
"EcalTrivialConditionRetriever") <<
"Read intercalibrations for " << ii <<
" xtals " ;
2035 <<
"Some crystals missing, set to 1" << std::endl ;
2043 for (
int i=0 ;
i<1700 ;
i++)
2054 if (calib_status[
i]) ical->setValue (ebid.
rawId (), calib[
i]) ;
2055 else ical->setValue (ebid.
rawId (), 1.) ;
2065 std::auto_ptr<EcalIntercalibErrors>
2069 std::auto_ptr<EcalIntercalibErrors> ical =
2075 edm::LogInfo(
"EcalTrivialConditionRetriever") <<
"Reading intercalibration constants from file "
2076 << intercalibErrorsFile_.c_str() ;
2079 inpFile = fopen (intercalibErrorsFile_.c_str (),
"r") ;
2083 <<
"*** Can not open file: " << intercalibErrorsFile_ ;
2084 throw cms::Exception (
"Cannot open inter-calibration coefficients txt file") ;
2088 std::ostringstream str ;
2089 fgets (line,255,inpFile) ;
2090 int sm_number=atoi (line) ;
2091 str <<
"sm: " << sm_number ;
2093 fgets (line,255,inpFile) ;
2096 fgets (line,255,inpFile) ;
2097 std::string gen_tag =
line ;
2098 str <<
"gen tag: " << gen_tag ;
2100 fgets (line,255,inpFile) ;
2101 std::string cali_method =
line ;
2102 str <<
"cali method: " << cali_method << std::endl ;
2104 fgets (line,255,inpFile) ;
2105 std::string cali_version =
line ;
2106 str <<
"cali version: " << cali_version << std::endl ;
2108 fgets (line,255,inpFile) ;
2109 std::string cali_type =
line ;
2110 str <<
"cali type: " << cali_type ;
2113 <<
"[PIETRO] Intercalibration file - "
2114 << str.str () << std::endl ;
2116 float calib[1700]={1} ;
2117 float calib_rms[1700]={0} ;
2118 int calib_nevents[1700]={0} ;
2119 int calib_status[1700]={0} ;
2123 while (fgets (line,255,inpFile))
2127 float dmy_calib = 0. ;
2128 float dmy_RMS = 0. ;
2129 int dmy_events = 0 ;
2130 int dmy_status = 0 ;
2131 sscanf (line,
"%d %f %f %d %d", &dmy_num, &dmy_calib,
2132 &dmy_RMS, &dmy_events,
2134 assert (dmy_num >= 1) ;
2135 assert (dmy_num <= 1700) ;
2136 calib[dmy_num-1] = dmy_calib ;
2137 calib_rms[dmy_num-1] = dmy_RMS ;
2138 calib_nevents[dmy_num-1] = dmy_events ;
2139 calib_status[dmy_num-1] = dmy_status ;
2151 edm::LogInfo (
"EcalTrivialConditionRetriever") <<
"Read intercalibrations for " << ii <<
" xtals " ;
2153 <<
"Some crystals missing, set to 1" << std::endl ;
2161 for (
int i=0 ;
i<1700 ;
i++)
2172 if (calib_status[
i]) ical->setValue (ebid.
rawId (), calib[
i]) ;
2173 else ical->setValue (ebid.
rawId (), 1.) ;
2185 std::auto_ptr<EcalTimeCalibConstants>
2189 std::auto_ptr<EcalTimeCalibConstants> ical =
2195 edm::LogInfo(
"EcalTrivialConditionRetriever") <<
"Reading time calibration constants from file "
2196 << timeCalibConstantsFile_.c_str() ;
2199 inpFile = fopen (timeCalibConstantsFile_.c_str (),
"r") ;
2203 <<
"*** Can not open file: " << timeCalibConstantsFile_ ;
2204 throw cms::Exception (
"Cannot open inter-calibration coefficients txt file") ;
2208 std::ostringstream str ;
2209 fgets (line,255,inpFile) ;
2210 int sm_number=atoi (line) ;
2211 str <<
"sm: " << sm_number ;
2213 fgets (line,255,inpFile) ;
2216 fgets (line,255,inpFile) ;
2217 std::string gen_tag =
line ;
2218 str <<
"gen tag: " << gen_tag ;
2220 fgets (line,255,inpFile) ;
2221 std::string cali_method =
line ;
2222 str <<
"cali method: " << cali_method << std::endl ;
2224 fgets (line,255,inpFile) ;
2225 std::string cali_version =
line ;
2226 str <<
"cali version: " << cali_version << std::endl ;
2228 fgets (line,255,inpFile) ;
2229 std::string cali_type =
line ;
2230 str <<
"cali type: " << cali_type ;
2233 <<
"TimeCalibration file - "
2234 << str.str () << std::endl ;
2236 float calib[1700]={1} ;
2237 float calib_rms[1700]={0} ;
2238 int calib_nevents[1700]={0} ;
2239 int calib_status[1700]={0} ;
2243 while (fgets (line,255,inpFile))
2247 float dmy_calib = 0. ;
2248 float dmy_RMS = 0. ;
2249 int dmy_events = 0 ;
2250 int dmy_status = 0 ;
2251 sscanf (line,
"%d %f %f %d %d", &dmy_num, &dmy_calib,
2252 &dmy_RMS, &dmy_events,
2254 assert (dmy_num >= 1) ;
2255 assert (dmy_num <= 1700) ;
2256 calib[dmy_num-1] = dmy_calib ;
2257 calib_rms[dmy_num-1] = dmy_RMS ;
2258 calib_nevents[dmy_num-1] = dmy_events ;
2259 calib_status[dmy_num-1] = dmy_status ;
2271 edm::LogInfo (
"EcalTrivialConditionRetriever") <<
"Read timeCalibrations for " << ii <<
" xtals " ;
2273 <<
"Some crystals missing, set to 1" << std::endl ;
2281 for (
int i=0 ;
i<1700 ;
i++)
2292 if (calib_status[
i]) ical->setValue (ebid.
rawId (), calib[
i]) ;
2293 else ical->setValue (ebid.
rawId (), 1.) ;
2303 std::auto_ptr<EcalTimeCalibErrors>
2307 std::auto_ptr<EcalTimeCalibErrors> ical =
2313 edm::LogInfo(
"EcalTrivialConditionRetriever") <<
"Reading timeCalibration constants from file "
2314 << timeCalibErrorsFile_.c_str() ;
2317 inpFile = fopen (timeCalibErrorsFile_.c_str (),
"r") ;
2321 <<
"*** Can not open file: " << timeCalibErrorsFile_ ;
2322 throw cms::Exception (
"Cannot open inter-calibration coefficients txt file") ;
2326 std::ostringstream str ;
2327 fgets (line,255,inpFile) ;
2328 int sm_number=atoi (line) ;
2329 str <<
"sm: " << sm_number ;
2331 fgets (line,255,inpFile) ;
2334 fgets (line,255,inpFile) ;
2335 std::string gen_tag =
line ;
2336 str <<
"gen tag: " << gen_tag ;
2338 fgets (line,255,inpFile) ;
2339 std::string cali_method =
line ;
2340 str <<
"cali method: " << cali_method << std::endl ;
2342 fgets (line,255,inpFile) ;
2343 std::string cali_version =
line ;
2344 str <<
"cali version: " << cali_version << std::endl ;
2346 fgets (line,255,inpFile) ;
2347 std::string cali_type =
line ;
2348 str <<
"cali type: " << cali_type ;
2351 <<
"TimeCalibration file - "
2352 << str.str () << std::endl ;
2354 float calib[1700]={1} ;
2355 float calib_rms[1700]={0} ;
2356 int calib_nevents[1700]={0} ;
2357 int calib_status[1700]={0} ;
2361 while (fgets (line,255,inpFile))
2365 float dmy_calib = 0. ;
2366 float dmy_RMS = 0. ;
2367 int dmy_events = 0 ;
2368 int dmy_status = 0 ;
2369 sscanf (line,
"%d %f %f %d %d", &dmy_num, &dmy_calib,
2370 &dmy_RMS, &dmy_events,
2372 assert (dmy_num >= 1) ;
2373 assert (dmy_num <= 1700) ;
2374 calib[dmy_num-1] = dmy_calib ;
2375 calib_rms[dmy_num-1] = dmy_RMS ;
2376 calib_nevents[dmy_num-1] = dmy_events ;
2377 calib_status[dmy_num-1] = dmy_status ;
2389 edm::LogInfo (
"EcalTrivialConditionRetriever") <<
"Read time calibrations for " << ii <<
" xtals " ;
2391 <<
"Some crystals missing, set to 1" << std::endl ;
2399 for (
int i=0 ;
i<1700 ;
i++)
2410 if (calib_status[
i]) ical->setValue (ebid.
rawId (), calib[
i]) ;
2411 else ical->setValue (ebid.
rawId (), 1.) ;
2422 std::auto_ptr<EcalMappingElectronics>
2425 std::auto_ptr<EcalMappingElectronics> mapping = std::auto_ptr<EcalMappingElectronics>(
new EcalMappingElectronics() );
2431 edm::LogError(
"EcalTrivialConditionRetriever") <<
"File not found";
2440 int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
2441 int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
2446 f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >> tower >>
2447 pseudostrip_in_TCC >> pseudostrip_in_TT ;
2454 EcalElectronicsId elecid(dccid,towerid, pseudostrip_in_SC, xtal_in_pseudostrip);
2460 (*mapping).setValue(detid, aElement);
2469 std::auto_ptr<EcalMappingElectronics>
2473 std::auto_ptr<EcalMappingElectronics> ical = std::auto_ptr<EcalMappingElectronics>(
new EcalMappingElectronics() );
EcalChi2WeightMatrix & getChi2WeightsBeforeGainSwitch()
static bool validDetId(int i, int j)
check if a valid index combination
EcalDAQTowerStatusMap EcalDAQTowerStatus
virtual std::auto_ptr< EcalTimeCalibConstants > produceEcalTimeCalibConstants(const EcalTimeCalibConstantsRcd &)
static bool validDetId(int ix, int iy, int iz)
virtual std::auto_ptr< EcalChannelStatus > produceEcalChannelStatus(const EcalChannelStatusRcd &)
virtual std::auto_ptr< EcalIntercalibConstants > getIntercalibConstantsFromConfiguration(const EcalIntercalibConstantsRcd &)
EcalIntercalibConstantMCMap EcalIntercalibConstantsMC
T getUntrackedParameter(std::string const &, T const &) const
static const int MIN_IPHI
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
virtual std::auto_ptr< EcalClusterCrackCorrParameters > produceEcalClusterCrackCorrParameters(const EcalClusterCrackCorrParametersRcd &)
EcalFunParams EcalClusterCrackCorrParameters
virtual std::auto_ptr< EcalTPGCrystalStatus > produceEcalTrgChannelStatus(const EcalTPGCrystalStatusRcd &)
virtual std::auto_ptr< EcalChannelStatus > getChannelStatusFromConfiguration(const EcalChannelStatusRcd &)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
virtual std::auto_ptr< EcalTBWeights > produceEcalTBWeights(const EcalTBWeightsRcd &)
virtual std::auto_ptr< EcalMappingElectronics > produceEcalMappingElectronics(const EcalMappingElectronicsRcd &)
static const IOVSyncValue & endOfTime()
EcalTimeCalibErrorMap EcalTimeCalibErrors
EcalCondObjectContainer< EcalXtalGroupId > EcalWeightXtalGroups
EcalLaserAPDPNRatiosRefMap EcalLaserAPDPNRatiosRef
std::pair< Time_t, Time_t > ValidityInterval
void getWeightsFromConfiguration(const edm::ParameterSet &ps)
static EEDetId unhashIndex(int hi)
virtual std::auto_ptr< EcalPedestals > produceEcalPedestals(const EcalPedestalsRcd &)
virtual std::auto_ptr< EcalLaserAPDPNRatios > produceEcalLaserAPDPNRatios(const EcalLaserAPDPNRatiosRcd &)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
virtual std::auto_ptr< EcalLaserAlphas > produceEcalLaserAlphas(const EcalLaserAlphasRcd &)
void setGain12Over6(const float &g)
uint32_t rawId() const
get the raw id
virtual std::auto_ptr< EcalTimeCalibConstants > getTimeCalibConstantsFromConfiguration(const EcalTimeCalibConstantsRcd &)
virtual std::auto_ptr< EcalDAQTowerStatus > produceEcalDAQTowerStatus(const EcalDAQTowerStatusRcd &)
EcalDQMChannelStatusMap EcalDQMChannelStatus
MVATrainerComputer * calib
EcalMappingElectronicsMap EcalMappingElectronics
EcalChannelStatusMap EcalChannelStatus
EcalGainRatioMap EcalGainRatios
virtual std::auto_ptr< EcalADCToGeVConstant > produceEcalADCToGeVConstant(const EcalADCToGeVConstantRcd &)
static const IOVSyncValue & beginOfTime()
virtual std::auto_ptr< EcalClusterLocalContCorrParameters > produceEcalClusterLocalContCorrParameters(const EcalClusterLocalContCorrParametersRcd &)
EcalLaserAlphaMap EcalLaserAlphas
EcalDCSTowerStatusMap EcalDCSTowerStatus
EcalDQMTowerStatusMap EcalDQMTowerStatus
virtual std::auto_ptr< EcalWeightXtalGroups > produceEcalWeightXtalGroups(const EcalWeightXtalGroupsRcd &)
const char * name() const
virtual std::auto_ptr< EcalIntercalibErrors > getIntercalibErrorsFromConfiguration(const EcalIntercalibErrorsRcd &)
EcalTPGCrystalStatusMap EcalTPGCrystalStatus
EcalChi2WeightMatrix & getChi2WeightsAfterGainSwitch()
virtual std::auto_ptr< EcalDQMTowerStatus > produceEcalDQMTowerStatus(const EcalDQMTowerStatusRcd &)
virtual std::auto_ptr< EcalClusterEnergyUncertaintyParameters > produceEcalClusterEnergyUncertaintyParameters(const EcalClusterEnergyUncertaintyParametersRcd &)
virtual std::auto_ptr< EcalMappingElectronics > getMappingFromConfiguration(const EcalMappingElectronicsRcd &)
virtual std::auto_ptr< EcalIntercalibErrors > produceEcalIntercalibErrors(const EcalIntercalibErrorsRcd &)
virtual std::auto_ptr< EcalTimeCalibErrors > produceEcalTimeCalibErrors(const EcalTimeCalibErrorsRcd &)
virtual std::auto_ptr< EcalTPGCrystalStatus > getTrgChannelStatusFromConfiguration(const EcalTPGCrystalStatusRcd &)
virtual std::auto_ptr< EcalClusterEnergyCorrectionParameters > produceEcalClusterEnergyCorrectionParameters(const EcalClusterEnergyCorrectionParametersRcd &)
virtual ~EcalTrivialConditionRetriever()
EcalWeightMatrix & getWeightsAfterGainSwitch()
EcalIntercalibErrorMap EcalIntercalibErrors
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
EcalFunParams EcalClusterEnergyUncertaintyParameters
virtual std::auto_ptr< EcalDCSTowerStatus > produceEcalDCSTowerStatus(const EcalDCSTowerStatusRcd &)
TimeValue_t value() const
virtual std::auto_ptr< EcalIntercalibConstants > produceEcalIntercalibConstants(const EcalIntercalibConstantsRcd &)
virtual std::auto_ptr< EcalIntercalibConstantsMC > produceEcalIntercalibConstantsMC(const EcalIntercalibConstantsMCRcd &)
EcalPedestalsMap EcalPedestals
static const int MAX_IPHI
EcalWeightMatrix & getWeightsBeforeGainSwitch()
EcalTimeCalibConstantMap EcalTimeCalibConstants
EcalTrivialConditionRetriever(const edm::ParameterSet &pset)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
static const int MAX_IETA
virtual std::auto_ptr< EcalLaserAPDPNRatiosRef > produceEcalLaserAPDPNRatiosRef(const EcalLaserAPDPNRatiosRefRcd &)
EcalFunParams EcalClusterLocalContCorrParameters
EcalIntercalibConstantMap EcalIntercalibConstants
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
static Timestamp const & endOfTime()
EcalFunParams EcalClusterEnergyCorrectionParameters
math::Matrix< 3, 10 >::type EcalWeightMatrix
virtual std::auto_ptr< EcalTimeCalibErrors > getTimeCalibErrorsFromConfiguration(const EcalTimeCalibErrorsRcd &)
const Timestamp & time() const
std::string fullPath() const
virtual std::auto_ptr< EcalDQMChannelStatus > produceEcalDQMChannelStatus(const EcalDQMChannelStatusRcd &)
static const int SMCRYSTALMODE
virtual std::auto_ptr< EcalGainRatios > produceEcalGainRatios(const EcalGainRatiosRcd &)
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
tuple size
Write out results.