CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTrivialConditionRetriever.cc
Go to the documentation of this file.
1 //
2 // Created: 2 Mar 2006
3 // Shahram Rahatlou, University of Rome & INFN
4 //
5 #include <iostream>
6 #include <fstream>
7 #include "TRandom3.h"
8 
13 
20 
21 //#include "DataFormats/Provenance/interface/Timestamp.h"
22 
26 
27 
28 using namespace edm;
29 
31 {
32  // initilize parameters used to produce cond DB objects
33  totLumi_=ps.getUntrackedParameter<double>("TotLumi",0.0);
34  instLumi_ = ps.getUntrackedParameter<double>("InstLumi",0.0);
35 
36  // initilize parameters used to produce cond DB objects
37  adcToGeVEBConstant_ = ps.getUntrackedParameter<double>("adcToGeVEBConstant",0.035);
38  adcToGeVEEConstant_ = ps.getUntrackedParameter<double>("adcToGeVEEConstant",0.060);
39 
40  intercalibConstantMeanMC_ = ps.getUntrackedParameter<double>("intercalibConstantMeanMC",1.0);
41  intercalibConstantSigmaMC_ = ps.getUntrackedParameter<double>("intercalibConstantSigmaMC",0.0);
42 
43  linCorrMean_ = ps.getUntrackedParameter<double>("linCorrMean",1.0);
44  linCorrSigma_ = ps.getUntrackedParameter<double>("linCorrSigma",0.0);
45 
46  linearTime1_ = (unsigned long)atoi( ps.getUntrackedParameter<std::string>("linearTime1","1").c_str());
47  linearTime2_= (unsigned long)atoi( ps.getUntrackedParameter<std::string>("linearTime2","0").c_str());
48  linearTime3_= (unsigned long)atoi( ps.getUntrackedParameter<std::string>("linearTime3","0").c_str());
49 
50 
51  intercalibConstantMean_ = ps.getUntrackedParameter<double>("intercalibConstantMean",1.0);
52  intercalibConstantSigma_ = ps.getUntrackedParameter<double>("intercalibConstantSigma",0.0);
53  intercalibErrorMean_ = ps.getUntrackedParameter<double>("IntercalibErrorMean",0.0);
54 
55  timeCalibConstantMean_ = ps.getUntrackedParameter<double>("timeCalibConstantMean",0.0);
56  timeCalibConstantSigma_ = ps.getUntrackedParameter<double>("timeCalibConstantSigma",0.0);
57  timeCalibErrorMean_ = ps.getUntrackedParameter<double>("timeCalibErrorMean",0.0);
58 
59  timeOffsetEBConstant_ = ps.getUntrackedParameter<double>("timeOffsetEBConstant",0.0);
60  timeOffsetEEConstant_ = ps.getUntrackedParameter<double>("timeOffsetEEConstant",0.0);
61 
62  laserAlphaMean_ = ps.getUntrackedParameter<double>("laserAlphaMean",1.55);
63  laserAlphaSigma_ = ps.getUntrackedParameter<double>("laserAlphaSigma",0);
64 
65  laserAPDPNTime1_ = (unsigned long)atoi( ps.getUntrackedParameter<std::string>("laserAPDPNTime1","1").c_str());
66  laserAPDPNTime2_= (unsigned long)atoi( ps.getUntrackedParameter<std::string>("laserAPDPNTime2","0").c_str());
67  laserAPDPNTime3_= (unsigned long)atoi( ps.getUntrackedParameter<std::string>("laserAPDPNTime3","0").c_str());
68 
69  laserAPDPNRefMean_ = ps.getUntrackedParameter<double>("laserAPDPNRefMean",1.0);
70  laserAPDPNRefSigma_ = ps.getUntrackedParameter<double>("laserAPDPNRefSigma",0.0);
71 
72  laserAPDPNMean_ = ps.getUntrackedParameter<double>("laserAPDPNMean",1.0);
73  laserAPDPNSigma_ = ps.getUntrackedParameter<double>("laserAPDPNSigma",0.0);
74 
75  localContCorrParameters_ = ps.getUntrackedParameter< std::vector<double> >("localContCorrParameters", std::vector<double>(0) );
76  crackCorrParameters_ = ps.getUntrackedParameter< std::vector<double> >("crackCorrParameters", std::vector<double>(0) );
77  energyCorrectionParameters_ = ps.getUntrackedParameter< std::vector<double> >("energyCorrectionParameters", std::vector<double>(0) );
78  energyUncertaintyParameters_ = ps.getUntrackedParameter< std::vector<double> >("energyUncertaintyParameters", std::vector<double>(0) );
79  energyCorrectionObjectSpecificParameters_ = ps.getUntrackedParameter< std::vector<double> >("energyCorrectionObjectSpecificParameters", std::vector<double>(0) );
80 
81  EBpedMeanX12_ = ps.getUntrackedParameter<double>("EBpedMeanX12", 200.);
82  EBpedRMSX12_ = ps.getUntrackedParameter<double>("EBpedRMSX12", 1.10);
83  EBpedMeanX6_ = ps.getUntrackedParameter<double>("EBpedMeanX6", 200.);
84  EBpedRMSX6_ = ps.getUntrackedParameter<double>("EBpedRMSX6", 0.90);
85  EBpedMeanX1_ = ps.getUntrackedParameter<double>("EBpedMeanX1", 200.);
86  EBpedRMSX1_ = ps.getUntrackedParameter<double>("EBpedRMSX1", 0.62);
87 
88  EEpedMeanX12_ = ps.getUntrackedParameter<double>("EEpedMeanX12", 200.);
89  EEpedRMSX12_ = ps.getUntrackedParameter<double>("EEpedRMSX12", 2.50);
90  EEpedMeanX6_ = ps.getUntrackedParameter<double>("EEpedMeanX6", 200.);
91  EEpedRMSX6_ = ps.getUntrackedParameter<double>("EEpedRMSX6", 2.00);
92  EEpedMeanX1_ = ps.getUntrackedParameter<double>("EEpedMeanX1", 200.);
93  EEpedRMSX1_ = ps.getUntrackedParameter<double>("EEpedRMSX1", 1.40);
94 
95  gainRatio12over6_ = ps.getUntrackedParameter<double>("gainRatio12over6", 2.0);
96  gainRatio6over1_ = ps.getUntrackedParameter<double>("gainRatio6over1", 6.0);
97 
98  getWeightsFromFile_ = ps.getUntrackedParameter<bool>("getWeightsFromFile",false);
99 
100  sampleMaskEB_ = ps.getUntrackedParameter<unsigned int>("sampleMaskEB",1023);
101  sampleMaskEE_ = ps.getUntrackedParameter<unsigned int>("sampleMaskEB",1023);
102 
103  EBtimeCorrAmplitudeBins_ = ps.getUntrackedParameter< std::vector<double> >("EBtimeCorrAmplitudeBins", std::vector<double>() );
104  EBtimeCorrShiftBins_ = ps.getUntrackedParameter< std::vector<double> >("EBtimeCorrShiftBins", std::vector<double>() );
105  EEtimeCorrAmplitudeBins_ = ps.getUntrackedParameter< std::vector<double> >("EEtimeCorrAmplitudeBins", std::vector<double>() );
106  EEtimeCorrShiftBins_ = ps.getUntrackedParameter< std::vector<double> >("EEtimeCorrShiftBins", std::vector<double>() );
107 
108  nTDCbins_ = 1;
109 
110  weightsForAsynchronousRunning_ = ps.getUntrackedParameter<bool>("weightsForTB",false);
111 
112  std::cout << " EcalTrivialConditionRetriever " << std::endl;
113 
114 
115 
116  if(totLumi_ > 0 ) {
117 
118  std::cout << " EcalTrivialConditionRetriever going to create conditions based on the damage deu to "<<totLumi_<<
119  " fb-1 integrated luminosity" << std::endl;
120 
121  }
122 
123  if (weightsForAsynchronousRunning_)
124  {
125  getWeightsFromFile_ = true; //override user request
126  //nTDCbins_ = 25;
127  nTDCbins_ = 50; //modif Alex-21-07-2006
128  }
129 
130  std::string path="CalibCalorimetry/EcalTrivialCondModules/data/";
131  std::string weightType;
132  std::ostringstream str;
133 
134  if (!weightsForAsynchronousRunning_)
135  str << "_CMS.txt" ;
136  else
137  str << "_TB.txt" ;
138 
139  weightType = str.str();
140 
141  amplWeightsFile_ = ps.getUntrackedParameter<std::string>("amplWeightsFile",path+"ampWeights"+weightType);
142  amplWeightsAftFile_ = ps.getUntrackedParameter<std::string>("amplWeightsAftFile",path+"ampWeightsAfterGainSwitch"+weightType);
143  pedWeightsFile_ = ps.getUntrackedParameter<std::string>("pedWeightsFile",path+"pedWeights"+weightType);
144  pedWeightsAftFile_ = ps.getUntrackedParameter<std::string>("pedWeightsAftFile",path+"pedWeightsAfterGainSwitch"+weightType);
145  jittWeightsFile_ = ps.getUntrackedParameter<std::string>("jittWeightsFile",path+"timeWeights"+weightType);
146  jittWeightsAftFile_ = ps.getUntrackedParameter<std::string>("jittWeightsAftFile",path+"timeWeightsAfterGainSwitch"+weightType);
147  chi2MatrixFile_ = ps.getUntrackedParameter<std::string>("chi2MatrixFile",path+"chi2Matrix"+weightType);
148  chi2MatrixAftFile_ = ps.getUntrackedParameter<std::string>("chi2MatrixAftFile",path+"chi2MatrixAfterGainSwitch"+weightType);
149 
150  amplWeights_.resize(nTDCbins_);
151  amplWeightsAft_.resize(nTDCbins_);
152  pedWeights_.resize(nTDCbins_);
153  pedWeightsAft_.resize(nTDCbins_);
154  jittWeights_.resize(nTDCbins_);
155  jittWeightsAft_.resize(nTDCbins_);
156  chi2Matrix_.resize(nTDCbins_);
157  chi2MatrixAft_.resize(nTDCbins_);
158 
159  // default weights for MGPA shape after pedestal subtraction
160  getWeightsFromConfiguration(ps);
161 
162  producedEcalPedestals_ = ps.getUntrackedParameter<bool>("producedEcalPedestals",true);
163  producedEcalWeights_ = ps.getUntrackedParameter<bool>("producedEcalWeights",true);
164 
165  producedEcalGainRatios_ = ps.getUntrackedParameter<bool>("producedEcalGainRatios",true);
166  producedEcalADCToGeVConstant_ = ps.getUntrackedParameter<bool>("producedEcalADCToGeVConstant",true);
167 
168  producedEcalMappingElectronics_ = ps.getUntrackedParameter<bool>("producedEcalMappingElectronics",true);
169  mappingFile_ = ps.getUntrackedParameter<std::string>("mappingFile","");
170 
171  if ( producedEcalMappingElectronics_ ) {
172  if ( mappingFile_ != "" ) { // if file provided read channel map
174  } else {
176  }
177  findingRecord<EcalMappingElectronicsRcd>();
178  }
179  // Alignment from file
180  getEBAlignmentFromFile_ = ps.getUntrackedParameter<bool>("getEBAlignmentFromFile",false);
181  if(getEBAlignmentFromFile_) {
182  EBAlignmentFile_ = ps.getUntrackedParameter<std::string>("EBAlignmentFile",path+"EBAlignment.txt");
183  }
184 
185  getEEAlignmentFromFile_ = ps.getUntrackedParameter<bool>("getEEAlignmentFromFile",false);
186  if(getEEAlignmentFromFile_) {
187  EEAlignmentFile_ = ps.getUntrackedParameter<std::string>("EEAlignmentFile",path+"EEAlignment.txt");
188  }
189 
190  getESAlignmentFromFile_ = ps.getUntrackedParameter<bool>("getESAlignmentFromFile",false);
191  if(getESAlignmentFromFile_)
192  ESAlignmentFile_ = ps.getUntrackedParameter<std::string>("ESAlignmentFile",path+"ESAlignment.txt");
193 
194  verbose_ = ps.getUntrackedParameter<int>("verbose", 0);
195 
196  //Tell Producer what we produce
197  //setWhatproduce(this);
198  if (producedEcalPedestals_)
200 
201  if (producedEcalWeights_) {
204  }
205 
206  if (producedEcalGainRatios_)
208 
209  if (producedEcalADCToGeVConstant_)
211 
212  // TimeOffsetConstant
213  producedEcalTimeOffsetConstant_ = ps.getUntrackedParameter<bool>("producedEcalTimeOffsetConstant",true);
214  //std::cout << " EcalTrivialConditionRetriever : producedEcalTimeOffsetConstant_" << producedEcalTimeOffsetConstant_ << std::endl;
215  if (producedEcalTimeOffsetConstant_) {
217  findingRecord<EcalTimeOffsetConstantRcd>();
218  }
219 
220  // linear corrections
221  producedEcalLinearCorrections_ = ps.getUntrackedParameter<bool>("producedEcalLinearCorrections",true);
222  linearCorrectionsFile_ = ps.getUntrackedParameter<std::string>("linearCorrectionsFile","") ;
223 
224  if (producedEcalLinearCorrections_) { // user asks to produce constants
225  if(linearCorrectionsFile_ != "") { // if file provided read constants
227  } else { // set all constants to 1. or smear as specified by user
229  }
230  findingRecord<EcalLinearCorrectionsRcd> () ;
231  }
232 
233 
234 
235  // intercalibration constants
236  producedEcalIntercalibConstants_ = ps.getUntrackedParameter<bool>("producedEcalIntercalibConstants",true);
237  intercalibConstantsFile_ = ps.getUntrackedParameter<std::string>("intercalibConstantsFile","") ;
238 
239  intercalibConstantsMCFile_ = ps.getUntrackedParameter<std::string>("intercalibConstantsMCFile","") ;
240 
241  if (producedEcalIntercalibConstants_) { // user asks to produce constants
242  if(intercalibConstantsFile_ != "") { // if file provided read constants
244  } else { // set all constants to 1. or smear as specified by user
246  }
247  findingRecord<EcalIntercalibConstantsRcd> () ;
248  }
249  // MC intercalibrations
250  producedEcalIntercalibConstantsMC_ = ps.getUntrackedParameter<bool>("producedEcalIntercalibConstantsMC",true);
251 
252  if (producedEcalIntercalibConstantsMC_) { // user asks to produce constants
253  if(intercalibConstantsMCFile_ != "") { // if file provided read constants
255  } else { // set all constants to 1. or smear as specified by user
257  }
258  findingRecord<EcalIntercalibConstantsMCRcd> () ;
259  }
260 
261  // intercalibration constants
262  producedEcalIntercalibErrors_ = ps.getUntrackedParameter<bool>("producedEcalIntercalibErrors",true);
263  intercalibErrorsFile_ = ps.getUntrackedParameter<std::string>("intercalibErrorsFile","") ;
264 
265  if (producedEcalIntercalibErrors_) { // user asks to produce constants
266  if(intercalibErrorsFile_ != "") { // if file provided read constants
268  } else { // set all constants to 1. or smear as specified by user
270  }
271  findingRecord<EcalIntercalibErrorsRcd> () ;
272  }
273 
274  // time calibration constants
275  producedEcalTimeCalibConstants_ = ps.getUntrackedParameter<bool>("producedEcalTimeCalibConstants",true);
276  timeCalibConstantsFile_ = ps.getUntrackedParameter<std::string>("timeCalibConstantsFile","") ;
277 
278  if (producedEcalTimeCalibConstants_) { // user asks to produce constants
279  if(timeCalibConstantsFile_ != "") { // if file provided read constants
281  } else { // set all constants to 1. or smear as specified by user
283  }
284  findingRecord<EcalTimeCalibConstantsRcd> () ;
285  }
286 
287  // time calibration constants
288  producedEcalTimeCalibErrors_ = ps.getUntrackedParameter<bool>("producedEcalTimeCalibErrors",true);
289  timeCalibErrorsFile_ = ps.getUntrackedParameter<std::string>("timeCalibErrorsFile","") ;
290 
291  if (producedEcalTimeCalibErrors_) { // user asks to produce constants
292  if(timeCalibErrorsFile_ != "") { // if file provided read constants
294  } else { // set all constants to 1. or smear as specified by user
296  }
297  findingRecord<EcalTimeCalibErrorsRcd> () ;
298  }
299 
300  // cluster corrections
301  producedEcalClusterLocalContCorrParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterLocalContCorrParameters", false);
302  producedEcalClusterCrackCorrParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterCrackCorrParameters", false);
303  producedEcalClusterEnergyCorrectionParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterEnergyCorrectionParameters", false);
304  producedEcalClusterEnergyUncertaintyParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterEnergyUncertaintyParameters", false);
305  producedEcalClusterEnergyCorrectionObjectSpecificParameters_ = ps.getUntrackedParameter<bool>("producedEcalClusterEnergyCorrectionObjectSpecificParameters", false);
306  if ( producedEcalClusterLocalContCorrParameters_ ) {
308  findingRecord<EcalClusterLocalContCorrParametersRcd>();
309  }
310  if ( producedEcalClusterCrackCorrParameters_ ) {
312  findingRecord<EcalClusterCrackCorrParametersRcd>();
313  }
314  if ( producedEcalClusterEnergyCorrectionParameters_ ) {
316  findingRecord<EcalClusterEnergyCorrectionParametersRcd>();
317  }
318  if ( producedEcalClusterEnergyUncertaintyParameters_ ) {
320  findingRecord<EcalClusterEnergyUncertaintyParametersRcd>();
321  }
322  if ( producedEcalClusterEnergyCorrectionObjectSpecificParameters_ ) {
324  findingRecord<EcalClusterEnergyCorrectionObjectSpecificParametersRcd>();
325  }
326 
327  // laser correction
328  producedEcalLaserCorrection_ = ps.getUntrackedParameter<bool>("producedEcalLaserCorrection",true);
329  if (producedEcalLaserCorrection_) { // user asks to produce constants
330  // set all constants to 1. or smear as specified by user
332  findingRecord<EcalLaserAlphasRcd> () ;
333  getLaserAlphaFromFile_ = ps.getUntrackedParameter<bool>("getLaserAlphaFromFile",false);
334  std::cout << " getLaserAlphaFromFile_ " << getLaserAlphaFromFile_ << std::endl;
335  if(getLaserAlphaFromFile_) {
336  EBLaserAlphaFile_ = ps.getUntrackedParameter<std::string>("EBLaserAlphaFile",path+"EBLaserAlpha.txt");
337  EELaserAlphaFile_ = ps.getUntrackedParameter<std::string>("EELaserAlphaFile",path+"EELaserAlpha.txt");
338  std::cout << " EELaserAlphaFile_ " << EELaserAlphaFile_.c_str() << std::endl;
339  }
341  findingRecord<EcalLaserAPDPNRatiosRefRcd> () ;
343  findingRecord<EcalLaserAPDPNRatiosRcd> () ;
344  }
345 
346  // channel status
347  producedEcalChannelStatus_ = ps.getUntrackedParameter<bool>("producedEcalChannelStatus",true);
348  channelStatusFile_ = ps.getUntrackedParameter<std::string>("channelStatusFile","");
349 
350  if ( producedEcalChannelStatus_ ) {
351  if ( channelStatusFile_ != "" ) { // if file provided read channel map
353  } else { // set all channels to working -- FIXME might be changed
355  }
356  findingRecord<EcalChannelStatusRcd>();
357  }
358  // DQM channel status
359  producedEcalDQMChannelStatus_ = ps.getUntrackedParameter<bool>("producedEcalDQMChannelStatus",true);
360  if ( producedEcalDQMChannelStatus_ ) {
362  findingRecord<EcalDQMChannelStatusRcd>();
363  }
364  // DCS Tower status
365  producedEcalDCSTowerStatus_ = ps.getUntrackedParameter<bool>("producedEcalDCSTowerStatus",true);
366  if ( producedEcalDCSTowerStatus_ ) {
368  findingRecord<EcalDCSTowerStatusRcd>();
369  }
370  // DAQ Tower status
371  producedEcalDAQTowerStatus_ = ps.getUntrackedParameter<bool>("producedEcalDAQTowerStatus",true);
372  if ( producedEcalDAQTowerStatus_ ) {
374  findingRecord<EcalDAQTowerStatusRcd>();
375  }
376  // DQM Tower status
377  producedEcalDQMTowerStatus_ = ps.getUntrackedParameter<bool>("producedEcalDQMTowerStatus",true);
378  if ( producedEcalDQMTowerStatus_ ) {
380  findingRecord<EcalDQMTowerStatusRcd>();
381  }
382 
383  // trigger channel status
384  producedEcalTrgChannelStatus_ = ps.getUntrackedParameter<bool>("producedEcalTrgChannelStatus",true);
385  trgChannelStatusFile_ = ps.getUntrackedParameter<std::string>("trgChannelStatusFile","");
386 
387  if ( producedEcalTrgChannelStatus_ ) {
388  if ( trgChannelStatusFile_ != "" ) { // if file provided read channel map
390  } else { // set all channels to working -- FIXME might be changed
392  }
393  findingRecord<EcalTPGCrystalStatusRcd>();
394  }
395 
396  // Alignment
397  producedEcalAlignmentEB_ = ps.getUntrackedParameter<bool>("producedEcalAlignmentEB",true);
398  if ( producedEcalAlignmentEB_ ) {
400  findingRecord<EBAlignmentRcd>();
401  }
402  producedEcalAlignmentEE_ = ps.getUntrackedParameter<bool>("producedEcalAlignmentEE",true);
403  if ( producedEcalAlignmentEE_ ) {
405  findingRecord<EEAlignmentRcd>();
406  }
407  producedEcalAlignmentES_ = ps.getUntrackedParameter<bool>("producedEcalAlignmentES",true);
408  if ( producedEcalAlignmentES_ ) {
410  findingRecord<ESAlignmentRcd>();
411  }
412  //Tell Finder what records we find
413  if (producedEcalPedestals_) findingRecord<EcalPedestalsRcd>();
414 
415  if (producedEcalWeights_) {
416  findingRecord<EcalWeightXtalGroupsRcd>();
417  findingRecord<EcalTBWeightsRcd>();
418  }
419 
420  if (producedEcalGainRatios_) findingRecord<EcalGainRatiosRcd>();
421 
422  if (producedEcalADCToGeVConstant_) findingRecord<EcalADCToGeVConstantRcd>();
423 
424  producedEcalSampleMask_ = ps.getUntrackedParameter<bool>("producedEcalSampleMask",true);
425  if (producedEcalSampleMask_) {
427  findingRecord<EcalSampleMaskRcd>();
428  }
429  producedEcalTimeBiasCorrections_ = ps.getUntrackedParameter<bool>("producedEcalTimeBiasCorrections", false);
430  if (producedEcalTimeBiasCorrections_) {
432  findingRecord<EcalTimeBiasCorrectionsRcd>();
433  }
434 }
435 
437 {
438 }
439 
440 //
441 // member functions
442 //
443 void
445  const edm::IOVSyncValue& iTime,
446  edm::ValidityInterval& oValidity)
447 {
448  if(verbose_>=1) std::cout << "EcalTrivialConditionRetriever::setIntervalFor(): record key = " << rk.name() << "\ttime: " << iTime.time().value() << std::endl;
449  //For right now, we will just use an infinite interval of validity
451 }
452 
453 //produce methods
454 std::auto_ptr<EcalPedestals>
456  std::auto_ptr<EcalPedestals> peds = std::auto_ptr<EcalPedestals>( new EcalPedestals() );
457  EcalPedestals::Item EBitem;
458  EcalPedestals::Item EEitem;
459 
460  EBitem.mean_x1 = EBpedMeanX1_;
461  EBitem.rms_x1 = EBpedRMSX1_;
462  EBitem.mean_x6 = EBpedMeanX6_;
463  EBitem.rms_x6 = EBpedRMSX6_;
464  EBitem.mean_x12 = EBpedMeanX12_;
465  EBitem.rms_x12 = EBpedRMSX12_;
466 
467  EEitem.mean_x1 = EEpedMeanX1_;
468  EEitem.rms_x1 = EEpedRMSX1_;
469  EEitem.mean_x6 = EEpedMeanX6_;
470  EEitem.rms_x6 = EEpedRMSX6_;
471  EEitem.mean_x12 = EEpedMeanX12_;
472  EEitem.rms_x12 = EEpedRMSX12_;
473 
474 
475 
476 
477 
478  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
479  if(iEta==0) continue;
480 
481  if(totLumi_>0) {
482  double eta=EBDetId::approxEta(EBDetId(iEta,1));
483 
484  EnergyResolutionVsLumi ageing;
485  ageing.setLumi(totLumi_);
486  ageing.setInstLumi(instLumi_);
487  eta = fabs(eta);
488  double noisefactor= ageing.calcnoiseIncreaseADC(eta);
489 
490 
491  EBitem.rms_x1 = EBpedRMSX1_*noisefactor;
492  EBitem.rms_x6 = EBpedRMSX6_*noisefactor;
493  EBitem.rms_x12 = EBpedRMSX12_*noisefactor;
494  std::cout << "rms ped at eta:"<< eta<<" ="<< EBitem.rms_x12 << std::endl;
495  }
496 
497 
498 
499  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
500  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
501  if (EBDetId::validDetId(iEta,iPhi))
502  {
503  EBDetId ebdetid(iEta,iPhi);
504  peds->insert(std::make_pair(ebdetid.rawId(),EBitem));
505  }
506  }
507  }
508 
509  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
510  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
511  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
512  if (EEDetId::validDetId(iX,iY,1))
513  {
514  EEDetId eedetidpos(iX,iY,1);
515  peds->insert(std::make_pair(eedetidpos.rawId(),EEitem));
516  }
517  if(EEDetId::validDetId(iX,iY,-1))
518  {
519  EEDetId eedetidneg(iX,iY,-1);
520  peds->insert(std::make_pair(eedetidneg.rawId(),EEitem));
521  }
522  }
523  }
524 
525  //return std::auto_ptr<EcalPedestals>( peds );
526  return peds;
527 }
528 
529 
530 
531 std::auto_ptr<EcalWeightXtalGroups>
533 {
534  std::auto_ptr<EcalWeightXtalGroups> xtalGroups = std::auto_ptr<EcalWeightXtalGroups>( new EcalWeightXtalGroups() );
535  EcalXtalGroupId defaultGroupId(1);
536  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
537  if(ieta==0) continue;
538  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
539  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
540  if (EBDetId::validDetId(ieta,iphi))
541  {
542  EBDetId ebid(ieta,iphi);
543  // xtalGroups->setValue(ebid.rawId(), EcalXtalGroupId(ieta) ); // define rings in eta
544  xtalGroups->setValue(ebid.rawId(), defaultGroupId ); // define rings in eta
545  }
546  }
547  }
548 
549  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
550  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
551  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
552  if (EEDetId::validDetId(iX,iY,1))
553  {
554  EEDetId eedetidpos(iX,iY,1);
555  xtalGroups->setValue(eedetidpos.rawId(), defaultGroupId );
556  }
557  if(EEDetId::validDetId(iX,iY,-1))
558  {
559  EEDetId eedetidneg(iX,iY,-1);
560  xtalGroups->setValue(eedetidneg.rawId(), defaultGroupId );
561  }
562  }
563  }
564  return xtalGroups;
565 }
566 
567 
568 std::auto_ptr<EcalLinearCorrections>
570 {
571  std::auto_ptr<EcalLinearCorrections> ical = std::auto_ptr<EcalLinearCorrections>( new EcalLinearCorrections() );
572 
573  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
574  if(ieta==0) continue;
575  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
576  if (EBDetId::validDetId(ieta,iphi)) {
577  EBDetId ebid(ieta,iphi);
578  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
579 
581  pairAPDPN.p1 = linCorrMean_ + r*linCorrSigma_;
582  pairAPDPN.p2 = linCorrMean_ + r*linCorrSigma_;
583  pairAPDPN.p3 = linCorrMean_ + r*linCorrSigma_;
584  ical->setValue( ebid, pairAPDPN );
585  }
586  }
587  }
588 
589  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
590  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
591  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
592  if (EEDetId::validDetId(iX,iY,1)) {
593  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
594  EEDetId eedetidpos(iX,iY,1);
595 
597  pairAPDPN.p1 = linCorrMean_ + r*linCorrSigma_;
598  pairAPDPN.p2 = linCorrMean_ + r*linCorrSigma_;
599  pairAPDPN.p3 = linCorrMean_ + r*linCorrSigma_;
600 
601  ical->setValue( eedetidpos, pairAPDPN );
602  }
603 
604  if (EEDetId::validDetId(iX,iY,-1)) {
605  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
606  EEDetId eedetidneg(iX,iY,-1);
607 
609  pairAPDPN.p1 = linCorrMean_ + r1*linCorrSigma_;
610  pairAPDPN.p2 = linCorrMean_ + r1*linCorrSigma_;
611  pairAPDPN.p3 = linCorrMean_ + r1*linCorrSigma_;
612 
613  ical->setValue( eedetidneg, pairAPDPN );
614  }
615  }
616  }
617 
619  // for(int i=1; i<=92; i++){
620  for(int i=0; i<92; i++){
621  TimeStamp.t1 = Timestamp(linearTime1_);
622  if(linearTime2_ == 0 ){
623  TimeStamp.t2 = Timestamp(edm::Timestamp::endOfTime().value());
624  } else {
625  TimeStamp.t2 = Timestamp(linearTime2_);
626  }
627  if(linearTime3_ == 0 ){
628  TimeStamp.t3 = Timestamp(edm::Timestamp::endOfTime().value());
629  } else {
630  TimeStamp.t3 = Timestamp(linearTime3_);
631  }
632 
633  ical->setTime( i, TimeStamp );
634  }
635 
636  return ical;
637 
638 }
639 
640 //------------------------------
641 
642 std::auto_ptr<EcalIntercalibConstants>
644 {
645  std::auto_ptr<EcalIntercalibConstants> ical = std::auto_ptr<EcalIntercalibConstants>( new EcalIntercalibConstants() );
646 
647  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
648  if(ieta==0) continue;
649  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
650  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
651  if (EBDetId::validDetId(ieta,iphi))
652  {
653  EBDetId ebid(ieta,iphi);
654  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
655  ical->setValue( ebid.rawId(), intercalibConstantMean_ + r*intercalibConstantSigma_ );
656  }
657  }
658  }
659 
660  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
661  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
662  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
663  if (EEDetId::validDetId(iX,iY,1))
664  {
665  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
666  EEDetId eedetidpos(iX,iY,1);
667  ical->setValue( eedetidpos.rawId(), intercalibConstantMean_ + r*intercalibConstantSigma_ );
668  }
669  if(EEDetId::validDetId(iX,iY,-1))
670  {
671  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
672  EEDetId eedetidneg(iX,iY,-1);
673  ical->setValue( eedetidneg.rawId(), intercalibConstantMean_ + r1*intercalibConstantSigma_ );
674  }
675  }
676  }
677 
678  return ical;
679 }
680 
681 std::auto_ptr<EcalIntercalibConstantsMC>
683 {
684  std::auto_ptr<EcalIntercalibConstantsMC> ical = std::auto_ptr<EcalIntercalibConstantsMC>( new EcalIntercalibConstantsMC() );
685 
686  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
687  if(ieta==0) continue;
688  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
689  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
690  if (EBDetId::validDetId(ieta,iphi))
691  {
692  EBDetId ebid(ieta,iphi);
693  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
694  ical->setValue( ebid.rawId(), intercalibConstantMeanMC_ + r*intercalibConstantSigmaMC_ );
695  }
696  }
697  }
698 
699  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
700  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
701  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
702  if (EEDetId::validDetId(iX,iY,1))
703  {
704  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
705  EEDetId eedetidpos(iX,iY,1);
706  ical->setValue( eedetidpos.rawId(), intercalibConstantMeanMC_ + r*intercalibConstantSigmaMC_ );
707  }
708  if(EEDetId::validDetId(iX,iY,-1))
709  {
710  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
711  EEDetId eedetidneg(iX,iY,-1);
712  ical->setValue( eedetidneg.rawId(), intercalibConstantMeanMC_ + r1*intercalibConstantSigmaMC_ );
713  }
714  }
715  }
716 
717  return ical;
718 }
719 
720 std::auto_ptr<EcalIntercalibErrors>
722 {
723  std::auto_ptr<EcalIntercalibErrors> ical = std::auto_ptr<EcalIntercalibErrors>( new EcalIntercalibErrors() );
724 
725  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
726  if(ieta==0) continue;
727  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
728  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
729  if (EBDetId::validDetId(ieta,iphi))
730  {
731  EBDetId ebid(ieta,iphi);
732  ical->setValue( ebid.rawId(), intercalibErrorMean_);
733  }
734  }
735  }
736 
737  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
738  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
739  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
740  if (EEDetId::validDetId(iX,iY,1))
741  {
742  EEDetId eedetidpos(iX,iY,1);
743  ical->setValue( eedetidpos.rawId(), intercalibErrorMean_ );
744  }
745  if(EEDetId::validDetId(iX,iY,-1))
746  {
747  EEDetId eedetidneg(iX,iY,-1);
748  ical->setValue( eedetidneg.rawId(), intercalibErrorMean_ );
749  }
750  }
751  }
752 
753  return ical;
754 }
755 
756 std::auto_ptr<EcalTimeCalibConstants>
758 {
759  std::auto_ptr<EcalTimeCalibConstants> ical = std::auto_ptr<EcalTimeCalibConstants>( new EcalTimeCalibConstants() );
760 
761  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
762  if(ieta==0) continue;
763  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
764  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
765  if (EBDetId::validDetId(ieta,iphi))
766  {
767  EBDetId ebid(ieta,iphi);
768  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
769  ical->setValue( ebid.rawId(), timeCalibConstantMean_ + r*timeCalibConstantSigma_ );
770  }
771  }
772  }
773 
774  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
775  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
776  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
777  if (EEDetId::validDetId(iX,iY,1))
778  {
779  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
780  EEDetId eedetidpos(iX,iY,1);
781  ical->setValue( eedetidpos.rawId(), timeCalibConstantMean_ + r*timeCalibConstantSigma_ );
782  }
783  if(EEDetId::validDetId(iX,iY,-1))
784  {
785  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
786  EEDetId eedetidneg(iX,iY,-1);
787  ical->setValue( eedetidneg.rawId(), timeCalibConstantMean_ + r1*timeCalibConstantSigma_ );
788  }
789  }
790  }
791 
792  return ical;
793 }
794 
795 std::auto_ptr<EcalTimeCalibErrors>
797 {
798  std::auto_ptr<EcalTimeCalibErrors> ical = std::auto_ptr<EcalTimeCalibErrors>( new EcalTimeCalibErrors() );
799 
800  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
801  if(ieta==0) continue;
802  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
803  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
804  if (EBDetId::validDetId(ieta,iphi))
805  {
806  EBDetId ebid(ieta,iphi);
807  ical->setValue( ebid.rawId(), timeCalibErrorMean_);
808  }
809  }
810  }
811 
812  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
813  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
814  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
815  if (EEDetId::validDetId(iX,iY,1))
816  {
817  EEDetId eedetidpos(iX,iY,1);
818  ical->setValue( eedetidpos.rawId(), timeCalibErrorMean_ );
819  }
820  if(EEDetId::validDetId(iX,iY,-1))
821  {
822  EEDetId eedetidneg(iX,iY,-1);
823  ical->setValue( eedetidneg.rawId(), timeCalibErrorMean_ );
824  }
825  }
826  }
827 
828  return ical;
829 }
830 
831 std::auto_ptr<EcalTimeOffsetConstant>
833 {
834  std::cout << " produceEcalTimeOffsetConstant: " << std::endl;
835  std::cout << " EB " << timeOffsetEBConstant_ << " EE " << timeOffsetEEConstant_<< std::endl;
836  return std::auto_ptr<EcalTimeOffsetConstant>( new EcalTimeOffsetConstant(timeOffsetEBConstant_,timeOffsetEEConstant_) );
837 }
838 
839 std::auto_ptr<EcalGainRatios>
841 {
842  std::auto_ptr<EcalGainRatios> gratio = std::auto_ptr<EcalGainRatios>( new EcalGainRatios() );
844  gr.setGain12Over6( gainRatio12over6_ );
845  gr.setGain6Over1( gainRatio6over1_ );
846 
847  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
848  if(ieta==0) continue;
849  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
850  if (EBDetId::validDetId(ieta,iphi))
851  {
852  EBDetId ebid(ieta,iphi);
853  gratio->setValue( ebid.rawId(), gr );
854  }
855  }
856  }
857 
858  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
859  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
860  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
861  if (EEDetId::validDetId(iX,iY,1))
862  {
863  EEDetId eedetidpos(iX,iY,1);
864  gratio->setValue( eedetidpos.rawId(), gr );
865  }
866  if (EEDetId::validDetId(iX,iY,-1))
867  {
868  EEDetId eedetidneg(iX,iY,-1);
869  gratio->setValue( eedetidneg.rawId(), gr );
870  }
871  }
872  }
873 
874  return gratio;
875 }
876 
877 std::auto_ptr<EcalADCToGeVConstant>
879 {
880  return std::auto_ptr<EcalADCToGeVConstant>( new EcalADCToGeVConstant(adcToGeVEBConstant_,adcToGeVEEConstant_) );
881 }
882 
883 std::auto_ptr<EcalTBWeights>
885 {
886  // create weights for the test-beam
887  std::auto_ptr<EcalTBWeights> tbwgt = std::auto_ptr<EcalTBWeights>( new EcalTBWeights() );
888 
889  // create weights for each distinct group ID
890  // int nMaxTDC = 10;
891 // for(int igrp=-EBDetId::MAX_IETA; igrp<=EBDetId::MAX_IETA; ++igrp) {
892 // if(igrp==0) continue;
893  int igrp=1;
894  for(int itdc=1; itdc<=nTDCbins_; ++itdc) {
895  // generate random number
896  // double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
897 
898  // make a new set of weights
899  EcalWeightSet wgt;
900  //typedef std::vector< std::vector<EcalWeight> > EcalWeightSet::EcalWeightMatrix;
903 
904 // if(verbose_>=1) {
905 // std::cout << "initial size of mat1: " << mat1.size() << std::endl;
906 // std::cout << "initial size of mat2: " << mat2.size() << std::endl;
907 // }
908 
909  // generate random numbers to use as weights
924  // use values provided by user
925  mat1.Place_in_row(amplWeights_[itdc-1],0,0);
926  mat1.Place_in_row(pedWeights_[itdc-1],1,0);
927  mat1.Place_in_row(jittWeights_[itdc-1],2,0);
928 
929  // wdights after gain switch
930  mat2.Place_in_row(amplWeightsAft_[itdc-1],0,0);
931  mat2.Place_in_row(pedWeightsAft_[itdc-1],1,0);
932  mat2.Place_in_row(jittWeightsAft_[itdc-1],2,0);
933 
934  // fill the chi2 matrcies with random numbers
935  // r = (double)std::rand()/( double(RAND_MAX)+double(1) );
938  mat3=chi2Matrix_[itdc-1];
939  mat4=chi2MatrixAft_[itdc-1];
940 
941  // for(size_t i=0; i<10; ++i)
942  // {
943  // mat3.push_back(chi2Matrix_[itdc-1][i]);
944  // mat4.push_back(chi2MatrixAft_[itdc-1][i]);
945  // }
946  // std::vector<EcalWeight> tv1, tv2;
947  // for(size_t j=0; j<10; ++j) {
948  // double ww = igrp*itdc*r + i*10. + j;
949  // tv1.push_back( EcalWeight(1000+ww) );
950  // tv2.push_back( EcalWeight(1000+100+ww) );
951  // }
952 
953 
954 
955 
956 // if(verbose_>=1) {
957 // std::cout << "group: " << igrp << " TDC: " << itdc
958 // << " mat1: " << mat1.size() << " mat2: " << mat2.size()
959 // << " mat3: " << mat3.size() << " mat4: " << mat4.size()
960 // << std::endl;
961 // }
962 
963  // put the weight in the container
964  tbwgt->setValue(std::make_pair(igrp,itdc), wgt);
965  }
966  // }
967  return tbwgt;
968 }
969 
970 
971 // cluster functions/corrections
972 std::auto_ptr<EcalClusterLocalContCorrParameters>
974 {
975  std::auto_ptr<EcalClusterLocalContCorrParameters> ipar = std::auto_ptr<EcalClusterLocalContCorrParameters>( new EcalClusterLocalContCorrParameters() );
976  for (size_t i = 0; i < localContCorrParameters_.size(); ++i ) {
977  ipar->params().push_back( localContCorrParameters_[i] );
978  }
979  return ipar;
980 }
981 std::auto_ptr<EcalClusterCrackCorrParameters>
983 {
984  std::auto_ptr<EcalClusterCrackCorrParameters> ipar = std::auto_ptr<EcalClusterCrackCorrParameters>( new EcalClusterCrackCorrParameters() );
985  for (size_t i = 0; i < crackCorrParameters_.size(); ++i ) {
986  ipar->params().push_back( crackCorrParameters_[i] );
987  }
988  return ipar;
989 }
990 std::auto_ptr<EcalClusterEnergyCorrectionParameters>
992 {
993  std::auto_ptr<EcalClusterEnergyCorrectionParameters> ipar = std::auto_ptr<EcalClusterEnergyCorrectionParameters>( new EcalClusterEnergyCorrectionParameters() );
994  for (size_t i = 0; i < energyCorrectionParameters_.size(); ++i ) {
995  ipar->params().push_back( energyCorrectionParameters_[i] );
996  }
997  return ipar;
998 }
999 std::auto_ptr<EcalClusterEnergyUncertaintyParameters>
1001 {
1002  std::auto_ptr<EcalClusterEnergyUncertaintyParameters> ipar = std::auto_ptr<EcalClusterEnergyUncertaintyParameters>( new EcalClusterEnergyUncertaintyParameters() );
1003  for (size_t i = 0; i < energyUncertaintyParameters_.size(); ++i ) {
1004  ipar->params().push_back( energyUncertaintyParameters_[i] );
1005  }
1006  return ipar;
1007 }
1008 std::auto_ptr<EcalClusterEnergyCorrectionObjectSpecificParameters>
1010 {
1011  std::auto_ptr<EcalClusterEnergyCorrectionObjectSpecificParameters> ipar = std::auto_ptr<EcalClusterEnergyCorrectionObjectSpecificParameters>( new EcalClusterEnergyCorrectionObjectSpecificParameters() );
1012  for (size_t i = 0; i < energyCorrectionObjectSpecificParameters_.size(); ++i ) {
1013  ipar->params().push_back( energyCorrectionObjectSpecificParameters_[i] );
1014  }
1015  return ipar;
1016 }
1017 
1018 
1019 // laser records
1020 std::auto_ptr<EcalLaserAlphas>
1022 {
1023 
1024  std::cout << " produceEcalLaserAlphas " << std::endl;
1025  std::auto_ptr<EcalLaserAlphas> ical = std::auto_ptr<EcalLaserAlphas>( new EcalLaserAlphas() );
1026  if(getLaserAlphaFromFile_) {
1027  std::ifstream fEB(edm::FileInPath(EBLaserAlphaFile_).fullPath().c_str());
1028  int SMpos[36] = {-10, 4, -7, -16, 6, -9, 11, -17, 5, 18, 3, -8, 1, -3, -13, 14, -6, 2,
1029  15, -18, 8, 17, -2, 9, -1, 10, -5, 7, -12, -11, 16, -4, -15, -14, 12, 13};
1030  // check!
1031  int SMCal[36] = {12,17,10, 1, 8, 4,27,20,23,25, 6,34,35,15,18,30,21, 9,
1032  24,22,13,31,26,16, 2,11, 5, 0,29,28,14,33,32, 3, 7,19};
1033  /*
1034  int slot_to_constr[37]={-1,12,17,10,1,8,4,27,20,23,25,6,34,35,15,18,30,21,9
1035  ,24,22,13,31,26,16,2,11,5,0,29,28,14,33,32,3,7,19};
1036  int constr_to_slot[36]={28,4,25,34,6,27,11,35,5,18,3,26,1,21,31,14,24,2,15,
1037  36,8,17,20,9,19,10,23,7,30,29,16,22,33,32,12,13 };
1038  */
1039  for(int SMcons = 0; SMcons < 36; SMcons++) {
1040  int SM = SMpos[SMcons];
1041  if(SM < 0) SM = 17 + abs(SM);
1042  else SM--;
1043  if(SMCal[SM] != SMcons)
1044  std::cout << " SM pb : read SM " << SMcons<< " SMpos " << SM
1045  << " SMCal " << SMCal[SM] << std::endl;
1046  }
1047  // check
1049  int readSM, pos, bar, bar2;
1050  float alpha = 0;
1051  for(int SMcons = 0; SMcons < 36; SMcons++) {
1052  int SM = SMpos[SMcons];
1053  for(int ic = 0; ic < 1700; ic++) {
1054  fEB >> readSM >> pos >> bar >> bar2 >> type >> batch;
1055  // if(ic == 0) std::cout << readSM << " " << pos << " " << bar << " " << bar2 << " "
1056  // << type << " " << batch << std::endl;
1057  if(readSM != SMcons || pos != ic + 1)
1058  std::cout << " barrel read pb read SM " << readSM << " const SM " << SMcons
1059  << " read pos " << pos << " ic " << ic << std::endl;
1060  if(SM < 0) SM = 18 + abs(SM);
1061  EBDetId ebdetid(SM, pos, EBDetId::SMCRYSTALMODE);
1062  if(bar == 33101 || bar == 30301 )
1063  alpha = 1.52;
1064  else if(bar == 33106) {
1065  if(bar2 <= 2000)
1066  alpha = 1.0;
1067  else {
1068  std::cout << " problem with barcode first " << bar << " last " << bar2
1069  << " read SM " << readSM << " read pos " << pos << std::endl;
1070  alpha = 0.0;
1071  }
1072  }
1073  ical->setValue( ebdetid, alpha );
1074  }
1075  } // loop over SMcons
1076  } // laserAlpha from a file
1077  else {
1078  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
1079  if(ieta==0) continue;
1080  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
1081  if (EBDetId::validDetId(ieta,iphi)) {
1082  EBDetId ebid(ieta,iphi);
1083  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
1084  ical->setValue( ebid, laserAlphaMean_ + r*laserAlphaSigma_ );
1085  }
1086  } // loop over iphi
1087  } // loop over ieta
1088  } // do not read a file
1089 
1090  std::cout << " produceEcalLaserAlphas EE" << std::endl;
1091  if(getLaserAlphaFromFile_) {
1092  std::ifstream fEE(edm::FileInPath(EELaserAlphaFile_).fullPath().c_str());
1093  int check[101][101];
1094  for(int x = 1; x < 101; x++)
1095  for(int y = 1; y < 101; y++)
1096  check[x][y] = -1;
1097  for(int crystal = 0; crystal < 14648; crystal++) {
1098  int x, y ,z, bid, bar, bar2;
1099  float LY, alpha = 0;
1100  fEE >> z >> x >> y >> LY >> bid >> bar >> bar2;
1101  if(x < 1 || x > 100 || y < 1 || y > 100)
1102  std::cout << " wrong coordinates for barcode " << bar
1103  << " x " << x << " y " << y << " z " << z << std::endl;
1104  else {
1105  if(z == 1) check[x][y] = 1;
1106  else check[x][y] = 0;
1107  if(bar == 33201 || (bar == 30399 && bar2 < 568))
1108  alpha = 1.52;
1109  else if((bar == 33106 && bar2 > 2000 && bar2 < 4669)
1110  || (bar == 30399 && bar2 > 567))
1111  alpha = 1.0;
1112  else {
1113  std::cout << " problem with barcode " << bar << " " << bar2
1114  << " x " << x << " y " << y << " z " << z << std::endl;
1115  alpha = 0.0;
1116  }
1117  }
1118  if (EEDetId::validDetId(x, y, z)) {
1119  EEDetId eedetidpos(x, y, z);
1120  ical->setValue( eedetidpos, alpha );
1121  }
1122  else // should not occur
1123  std::cout << " problem with EEDetId " << " x " << x << " y " << y << " z " << z << std::endl;
1124  } // loop over crystal in file
1125  for(int x = 1; x < 101; x++)
1126  for(int y = 1; y < 101; y++)
1127  if(check[x][y] == 1) std::cout << " missing x " << x << " y " << y << std::endl;
1128  } // laserAlpha from a file
1129  else {
1130  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
1131  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
1132  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
1133  if (EEDetId::validDetId(iX,iY,1)) {
1134  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
1135  EEDetId eedetidpos(iX,iY,1);
1136  ical->setValue( eedetidpos, laserAlphaMean_ + r*laserAlphaSigma_ );
1137  }
1138 
1139  if (EEDetId::validDetId(iX,iY,-1)) {
1140  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
1141  EEDetId eedetidneg(iX,iY,-1);
1142  ical->setValue( eedetidneg, laserAlphaMean_ + r1*laserAlphaSigma_ );
1143  }
1144  } // loop over iY
1145  } // loop over iX
1146  } // do not read a file
1147 
1148  return ical;
1149 }
1150 
1151 
1152 std::auto_ptr<EcalLaserAPDPNRatiosRef>
1154 {
1155  std::auto_ptr<EcalLaserAPDPNRatiosRef> ical = std::auto_ptr<EcalLaserAPDPNRatiosRef>( new EcalLaserAPDPNRatiosRef() );
1156  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
1157  if(ieta==0) continue;
1158  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
1159  if (EBDetId::validDetId(ieta,iphi)) {
1160  EBDetId ebid(ieta,iphi);
1161  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
1162  ical->setValue( ebid, laserAPDPNRefMean_ + r*laserAPDPNRefSigma_ );
1163  }
1164  }
1165  }
1166 
1167  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
1168  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
1169  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
1170  if (EEDetId::validDetId(iX,iY,1)) {
1171  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
1172  EEDetId eedetidpos(iX,iY,1);
1173  ical->setValue( eedetidpos, laserAPDPNRefMean_ + r*laserAPDPNRefSigma_ );
1174  }
1175 
1176  if (EEDetId::validDetId(iX,iY,-1)) {
1177  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
1178  EEDetId eedetidneg(iX,iY,-1);
1179  ical->setValue( eedetidneg, laserAPDPNRefMean_ + r1*laserAPDPNRefSigma_ );
1180  }
1181  }
1182  }
1183 
1184  return ical;
1185 }
1186 
1187 
1188 std::auto_ptr<EcalLaserAPDPNRatios>
1190 {
1191  EnergyResolutionVsLumi ageing;
1192  ageing.setLumi(totLumi_);
1193  ageing.setInstLumi(instLumi_);
1194 
1195 
1196  std::auto_ptr<EcalLaserAPDPNRatios> ical = std::auto_ptr<EcalLaserAPDPNRatios>( new EcalLaserAPDPNRatios() );
1197  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
1198  if(ieta==0) continue;
1199 
1200 
1201 
1202  double eta=EBDetId::approxEta(EBDetId(ieta,1));
1203 
1204  eta = fabs(eta);
1205  double drop=ageing.calcampDropTotal(eta);
1206  std::cout<<"EB at eta="<<eta<<" dropping by "<<drop<<std::endl;
1207 
1208  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
1209  if (EBDetId::validDetId(ieta,iphi)) {
1210  EBDetId ebid(ieta,iphi);
1211  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
1212 
1214  pairAPDPN.p1 = laserAPDPNMean_*drop + r*laserAPDPNSigma_;
1215  pairAPDPN.p2 = laserAPDPNMean_*drop + r*laserAPDPNSigma_;
1216  pairAPDPN.p3 = laserAPDPNMean_*drop + r*laserAPDPNSigma_;
1217  ical->setValue( ebid, pairAPDPN );
1218  }
1219  }
1220  }
1221 
1222 
1223  std::cout<<"----- EE -----"<<std::endl;
1224 
1225  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
1226  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
1227  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
1228 
1229 
1230  if (EEDetId::validDetId(iX,iY,1)) {
1231  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
1232  EEDetId eedetidpos(iX,iY,1);
1233 
1234  double eta= -log(tan(0.5*atan(sqrt((iX-50.0)
1235  *(iX-50.0)+
1236  (iY-50.0)*
1237  (iY-50.0))
1238  *2.98/328.)));
1239  eta = fabs(eta);
1240  double drop=ageing.calcampDropTotal(eta);
1241  if(iX==50) std::cout<<"EE at eta="<<eta<<" dropping by "<<drop<<std::endl;
1242 
1243 
1245  pairAPDPN.p1 = laserAPDPNMean_*drop + r*laserAPDPNSigma_;
1246  pairAPDPN.p2 = laserAPDPNMean_*drop + r*laserAPDPNSigma_;
1247  pairAPDPN.p3 = laserAPDPNMean_*drop + r*laserAPDPNSigma_;
1248  ical->setValue( eedetidpos, pairAPDPN );
1249  }
1250 
1251  if (EEDetId::validDetId(iX,iY,-1)) {
1252  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
1253  EEDetId eedetidneg(iX,iY,-1);
1254 
1255  double eta= -log(tan(0.5*atan(sqrt((iX-50.0)*(iX-50.0)+(iY-50.0)*(iY-50.0))*2.98/328.)));
1256  eta = fabs(eta);
1257  double drop=ageing.calcampDropTotal(eta);
1258  if(iX==50) std::cout<<"EE at eta="<<eta<<" dropping by "<<drop<<std::endl;
1259 
1260 
1262  pairAPDPN.p1 = laserAPDPNMean_*drop + r1*laserAPDPNSigma_;
1263  pairAPDPN.p2 = laserAPDPNMean_*drop + r1*laserAPDPNSigma_;
1264  pairAPDPN.p3 = laserAPDPNMean_*drop + r1*laserAPDPNSigma_;
1265  ical->setValue( eedetidneg, pairAPDPN );
1266  }
1267  }
1268  }
1269 
1271  // for(int i=1; i<=92; i++){
1272  for(int i=0; i<92; i++){
1273  TimeStamp.t1 = Timestamp(laserAPDPNTime1_);
1274  if(laserAPDPNTime2_ == 0 ){
1275  TimeStamp.t2 = Timestamp(edm::Timestamp::endOfTime().value());
1276  } else {
1277  TimeStamp.t2 = Timestamp(laserAPDPNTime2_);
1278  }
1279  if(laserAPDPNTime3_ == 0 ){
1280  TimeStamp.t3 = Timestamp(edm::Timestamp::endOfTime().value());
1281  } else {
1282  TimeStamp.t3 = Timestamp(laserAPDPNTime3_);
1283  }
1284 
1285  ical->setTime( i, TimeStamp );
1286  }
1287 
1288  return ical;
1289 
1290 }
1291 
1292 
1294 {
1295 
1296  std::vector < std::vector<double> > amplwgtv(nTDCbins_);
1297 
1298  if (!getWeightsFromFile_ && nTDCbins_ == 1)
1299  {
1300  std::vector<double> vampl;
1301  //As default using simple 3+1 weights
1302  vampl.push_back( -0.33333 );
1303  vampl.push_back( -0.33333 );
1304  vampl.push_back( -0.33333 );
1305  vampl.push_back( 0. );
1306  vampl.push_back( 0. );
1307  vampl.push_back( 1. );
1308  vampl.push_back( 0. );
1309  vampl.push_back( 0. );
1310  vampl.push_back( 0. );
1311  vampl.push_back( 0. );
1312  amplwgtv[0]= ps.getUntrackedParameter< std::vector<double> >("amplWeights", vampl);
1313  }
1314  else if (getWeightsFromFile_)
1315  {
1316  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading amplitude weights from file " << edm::FileInPath(amplWeightsFile_).fullPath().c_str() ;
1317  std::ifstream amplFile(edm::FileInPath(amplWeightsFile_).fullPath().c_str());
1318  int tdcBin=0;
1319  while (!amplFile.eof() && tdcBin < nTDCbins_)
1320  {
1321  for(int j = 0; j < 10; ++j) {
1322  float ww;
1323  amplFile >> ww;
1324  amplwgtv[tdcBin].push_back(ww);
1325  }
1326  ++tdcBin;
1327  }
1328  assert (tdcBin == nTDCbins_);
1329  //Read from file
1330  }
1331  else
1332  {
1333  //Not supported
1334  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1335  throw cms::Exception("WrongConfig");
1336  }
1337 
1338 
1339  for (int i=0;i<nTDCbins_;i++)
1340  {
1341  assert(amplwgtv[i].size() == 10);
1342  int j=0;
1343  for(std::vector<double>::const_iterator it = amplwgtv[i].begin(); it != amplwgtv[i].end(); ++it)
1344  {
1345  (amplWeights_[i])[j]=*it;
1346  j++;
1347  }
1348  }
1349 
1350 
1351  std::vector < std::vector<double> > amplwgtvAftGain(nTDCbins_);
1352 
1353  if (!getWeightsFromFile_ && nTDCbins_ == 1 )
1354  {
1355  std::vector<double> vamplAftGain;
1356  vamplAftGain.push_back( 0. );
1357  vamplAftGain.push_back( 0. );
1358  vamplAftGain.push_back( 0. );
1359  vamplAftGain.push_back( 0. );
1360  vamplAftGain.push_back( 0. );
1361  vamplAftGain.push_back( 1. );
1362  vamplAftGain.push_back( 0. );
1363  vamplAftGain.push_back( 0. );
1364  vamplAftGain.push_back( 0. );
1365  vamplAftGain.push_back( 0. );
1366  amplwgtvAftGain[0] = ps.getUntrackedParameter< std::vector<double> >("amplWeightsAftGain", vamplAftGain);
1367  }
1368  else if (getWeightsFromFile_)
1369  {
1370  //Read from file
1371  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading amplitude weights aftre gain switch from file " << edm::FileInPath(amplWeightsAftFile_).fullPath().c_str() ;
1372  std::ifstream amplFile(edm::FileInPath(amplWeightsAftFile_).fullPath().c_str());
1373  int tdcBin=0;
1374  while (!amplFile.eof() && tdcBin < nTDCbins_)
1375  {
1376  for(int j = 0; j < 10; ++j) {
1377  float ww;
1378  amplFile >> ww;
1379  amplwgtvAftGain[tdcBin].push_back(ww);
1380  }
1381  ++tdcBin;
1382  }
1383  assert (tdcBin == nTDCbins_);
1384  }
1385  else
1386  {
1387  //Not supported
1388  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1389  throw cms::Exception("WrongConfig");
1390  }
1391 
1392  for (int i=0;i<nTDCbins_;i++)
1393  {
1394  assert(amplwgtvAftGain[i].size() == 10);
1395  int j=0;
1396  for(std::vector<double>::const_iterator it = amplwgtvAftGain[i].begin(); it != amplwgtvAftGain[i].end(); ++it) {
1397  (amplWeightsAft_[i])[j]=*it;
1398  j++;
1399  }
1400  }
1401 
1402  // default weights to reco amplitude w/o pedestal subtraction
1403 
1404  std::vector< std::vector<double> > pedwgtv(nTDCbins_);
1405 
1406  if (!getWeightsFromFile_ && nTDCbins_ == 1)
1407  {
1408  std::vector<double> vped;
1409  vped.push_back( 0.33333 );
1410  vped.push_back( 0.33333 );
1411  vped.push_back( 0.33333 );
1412  vped.push_back( 0. );
1413  vped.push_back( 0. );
1414  vped.push_back( 0. );
1415  vped.push_back( 0. );
1416  vped.push_back( 0. );
1417  vped.push_back( 0. );
1418  vped.push_back( 0. );
1419  pedwgtv[0] = ps.getUntrackedParameter< std::vector<double> >("pedWeights", vped);
1420  }
1421  else if (getWeightsFromFile_)
1422  {
1423  //Read from file
1424  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading pedestal weights from file " << edm::FileInPath(pedWeightsFile_).fullPath().c_str() ;
1425  std::ifstream pedFile(edm::FileInPath(pedWeightsFile_).fullPath().c_str());
1426  int tdcBin=0;
1427  while (!pedFile.eof() && tdcBin < nTDCbins_)
1428  {
1429  for(int j = 0; j < 10; ++j) {
1430  float ww;
1431  pedFile >> ww;
1432  pedwgtv[tdcBin].push_back(ww);
1433  }
1434  ++tdcBin;
1435  }
1436  assert (tdcBin == nTDCbins_);
1437  }
1438  else
1439  {
1440  //Not supported
1441  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1442  throw cms::Exception("WrongConfig");
1443  }
1444 
1445  for (int i=0;i<nTDCbins_;i++)
1446  {
1447  assert(pedwgtv[i].size() == 10);
1448  int j=0;
1449  for(std::vector<double>::const_iterator it = pedwgtv[i].begin(); it != pedwgtv[i].end(); ++it) {
1450  (pedWeights_[i])[j] = *it;
1451  j++;
1452  }
1453  }
1454 
1455  std::vector< std::vector<double> > pedwgtvaft(nTDCbins_);
1456 
1457  if (!getWeightsFromFile_ && nTDCbins_ == 1)
1458  {
1459  std::vector<double> vped;
1460  vped.push_back( 0. );
1461  vped.push_back( 0. );
1462  vped.push_back( 0. );
1463  vped.push_back( 0. );
1464  vped.push_back( 0. );
1465  vped.push_back( 0. );
1466  vped.push_back( 0. );
1467  vped.push_back( 0. );
1468  vped.push_back( 0. );
1469  vped.push_back( 0. );
1470  pedwgtvaft[0] = ps.getUntrackedParameter< std::vector<double> >("pedWeightsAft", vped);
1471  }
1472  else if (getWeightsFromFile_)
1473  {
1474  //Read from file
1475  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading pedestal after gain switch weights from file " << edm::FileInPath(pedWeightsAftFile_).fullPath().c_str() ;
1476  std::ifstream pedFile(edm::FileInPath(pedWeightsAftFile_).fullPath().c_str());
1477  int tdcBin=0;
1478  while (!pedFile.eof() && tdcBin < nTDCbins_)
1479  {
1480  for(int j = 0; j < 10; ++j) {
1481  float ww;
1482  pedFile >> ww;
1483  pedwgtvaft[tdcBin].push_back(ww);
1484  }
1485  ++tdcBin;
1486  }
1487  assert (tdcBin == nTDCbins_);
1488  }
1489  else
1490  {
1491  //Not supported
1492  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1493  throw cms::Exception("WrongConfig");
1494  }
1495 
1496  for (int i=0;i<nTDCbins_;i++)
1497  {
1498  assert(pedwgtvaft[i].size() == 10);
1499  int j=0;
1500  for(std::vector<double>::const_iterator it = pedwgtvaft[i].begin(); it != pedwgtvaft[i].end(); ++it) {
1501  (pedWeightsAft_[i])[j]=*it;
1502  j++;
1503  }
1504  }
1505 
1506 
1507 
1508  // default weights to reco jitter
1509 
1510  std::vector< std::vector<double> > jittwgtv(nTDCbins_);
1511 
1512  if (!getWeightsFromFile_ && nTDCbins_ == 1 )
1513  {
1514  std::vector<double> vjitt;
1515  vjitt.push_back( 0.04066309 );
1516  vjitt.push_back( 0.04066309 );
1517  vjitt.push_back( 0.04066309 );
1518  vjitt.push_back( 0.000 );
1519  vjitt.push_back( 1.325176 );
1520  vjitt.push_back( -0.04997078 );
1521  vjitt.push_back( -0.504338 );
1522  vjitt.push_back( -0.5024844 );
1523  vjitt.push_back( -0.3903718 );
1524  vjitt.push_back( 0.000 );
1525  jittwgtv[0] = ps.getUntrackedParameter< std::vector<double> >("jittWeights", vjitt);
1526  }
1527  else if (getWeightsFromFile_)
1528  {
1529  //Read from file
1530  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading jitter weights from file " << edm::FileInPath(jittWeightsFile_).fullPath().c_str() ;
1531  std::ifstream jittFile(edm::FileInPath(jittWeightsFile_).fullPath().c_str());
1532  int tdcBin=0;
1533  while (!jittFile.eof() && tdcBin < nTDCbins_)
1534  {
1535  for(int j = 0; j < 10; ++j) {
1536  float ww;
1537  jittFile >> ww;
1538  jittwgtv[tdcBin].push_back(ww);
1539  }
1540  ++tdcBin;
1541  }
1542  assert (tdcBin == nTDCbins_);
1543  }
1544  else
1545  {
1546  //Not supported
1547  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1548  throw cms::Exception("WrongConfig");
1549  }
1550 
1551  for (int i=0;i<nTDCbins_;i++)
1552  {
1553  assert(jittwgtv[i].size() == 10);
1554  int j=0;
1555  for(std::vector<double>::const_iterator it = jittwgtv[i].begin(); it != jittwgtv[i].end(); ++it) {
1556  (jittWeights_[i])[j]= *it;
1557  j++;
1558  }
1559  }
1560 
1561  std::vector< std::vector<double> > jittwgtvaft(nTDCbins_);
1562 
1563  if (!getWeightsFromFile_ && nTDCbins_ == 1)
1564  {
1565  std::vector<double> vjitt;
1566  vjitt.push_back( 0. );
1567  vjitt.push_back( 0. );
1568  vjitt.push_back( 0. );
1569  vjitt.push_back( 0. );
1570  vjitt.push_back( 1.097871 );
1571  vjitt.push_back( -0.04551035 );
1572  vjitt.push_back( -0.4159156 );
1573  vjitt.push_back( -0.4185352 );
1574  vjitt.push_back( -0.3367127 );
1575  vjitt.push_back( 0. );
1576  jittwgtvaft[0] = ps.getUntrackedParameter< std::vector<double> >("jittWeightsAft", vjitt);
1577  }
1578  else if (getWeightsFromFile_)
1579  {
1580  //Read from file
1581  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading jitter after gain switch weights from file " << edm::FileInPath(jittWeightsAftFile_).fullPath().c_str() ;
1582  std::ifstream jittFile(edm::FileInPath(jittWeightsAftFile_).fullPath().c_str());
1583  int tdcBin=0;
1584  while (!jittFile.eof() && tdcBin < nTDCbins_)
1585  {
1586  for(int j = 0; j < 10; ++j) {
1587  float ww;
1588  jittFile >> ww;
1589  jittwgtvaft[tdcBin].push_back(ww);
1590  }
1591  ++tdcBin;
1592  }
1593  assert (tdcBin == nTDCbins_);
1594  }
1595  else
1596  {
1597  //Not supported
1598  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1599  throw cms::Exception("WrongConfig");
1600  }
1601 
1602  for (int i=0;i<nTDCbins_;i++)
1603  {
1604  assert(jittwgtvaft[i].size() == 10);
1605  int j=0;
1606  for(std::vector<double>::const_iterator it = jittwgtvaft[i].begin(); it != jittwgtvaft[i].end(); ++it) {
1607  (jittWeightsAft_[i])[j]= *it;
1608  j++;
1609  }
1610  }
1611 
1612 
1613  std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2Matrix(nTDCbins_);
1614  if (!getWeightsFromFile_ && nTDCbins_ == 1 )
1615  {
1616  // chi2Matrix[0].resize(10);
1617  // for (int i=0;i<10;i++)
1618  // chi2Matrix[0][i].resize(10);
1619 
1620  chi2Matrix[0](0,0) = 0.694371;
1621  chi2Matrix[0](0,1) = -0.305629;
1622  chi2Matrix[0](0,2) = -0.305629;
1623  chi2Matrix[0](0,3) = 0.;
1624  chi2Matrix[0](0,4) = 0.;
1625  chi2Matrix[0](0,5) = 0.;
1626  chi2Matrix[0](0,6) = 0.;
1627  chi2Matrix[0](0,7) = 0.;
1628  chi2Matrix[0](0,8) = 0.;
1629  chi2Matrix[0](0,9) = 0.;
1630  chi2Matrix[0](1,0) = -0.305629;
1631  chi2Matrix[0](1,1) = 0.694371;
1632  chi2Matrix[0](1,2) = -0.305629;
1633  chi2Matrix[0](1,3) = 0.;
1634  chi2Matrix[0](1,4) = 0.;
1635  chi2Matrix[0](1,5) = 0.;
1636  chi2Matrix[0](1,6) = 0.;
1637  chi2Matrix[0](1,7) = 0.;
1638  chi2Matrix[0](1,8) = 0.;
1639  chi2Matrix[0](1,9) = 0.;
1640  chi2Matrix[0](2,0) = -0.305629;
1641  chi2Matrix[0](2,1) = -0.305629;
1642  chi2Matrix[0](2,2) = 0.694371;
1643  chi2Matrix[0](2,3) = 0.;
1644  chi2Matrix[0](2,4) = 0.;
1645  chi2Matrix[0](2,5) = 0.;
1646  chi2Matrix[0](2,6) = 0.;
1647  chi2Matrix[0](2,7) = 0.;
1648  chi2Matrix[0](2,8) = 0.;
1649  chi2Matrix[0](2,9) = 0.;
1650  chi2Matrix[0](3,0) = 0.;
1651  chi2Matrix[0](3,1) = 0.;
1652  chi2Matrix[0](3,2) = 0.;
1653  chi2Matrix[0](3,3) = 0.;
1654  chi2Matrix[0](3,4) = 0.;
1655  chi2Matrix[0](3,5) = 0.;
1656  chi2Matrix[0](3,6) = 0.;
1657  chi2Matrix[0](3,7) = 0.;
1658  chi2Matrix[0](3,8) = 0.;
1659  chi2Matrix[0](3,9) = 0.;
1660  chi2Matrix[0](4,0) = 0.;
1661  chi2Matrix[0](4,1) = 0.;
1662  chi2Matrix[0](4,2) = 0.;
1663  chi2Matrix[0](4,3) = 0.;
1664  chi2Matrix[0](4,4) = 0.8027116;
1665  chi2Matrix[0](4,5) = -0.2517103;
1666  chi2Matrix[0](4,6) = -0.2232882;
1667  chi2Matrix[0](4,7) = -0.1716192;
1668  chi2Matrix[0](4,8) = -0.1239006;
1669  chi2Matrix[0](4,9) = 0.;
1670  chi2Matrix[0](5,0) = 0.;
1671  chi2Matrix[0](5,1) = 0.;
1672  chi2Matrix[0](5,2) = 0.;
1673  chi2Matrix[0](5,3) = 0.;
1674  chi2Matrix[0](5,4) = -0.2517103;
1675  chi2Matrix[0](5,5) = 0.6528964;
1676  chi2Matrix[0](5,6) = -0.2972839;
1677  chi2Matrix[0](5,7) = -0.2067162;
1678  chi2Matrix[0](5,8) = -0.1230729;
1679  chi2Matrix[0](5,9) = 0.;
1680  chi2Matrix[0](6,0) = 0.;
1681  chi2Matrix[0](6,1) = 0.;
1682  chi2Matrix[0](6,2) = 0.;
1683  chi2Matrix[0](6,3) = 0.;
1684  chi2Matrix[0](6,4) = -0.2232882;
1685  chi2Matrix[0](6,5) = -0.2972839;
1686  chi2Matrix[0](6,6) = 0.7413607;
1687  chi2Matrix[0](6,7) = -0.1883866;
1688  chi2Matrix[0](6,8) = -0.1235052;
1689  chi2Matrix[0](6,9) = 0.;
1690  chi2Matrix[0](7,0) = 0.;
1691  chi2Matrix[0](7,1) = 0.;
1692  chi2Matrix[0](7,2) = 0.;
1693  chi2Matrix[0](7,3) = 0.;
1694  chi2Matrix[0](7,4) = -0.1716192;
1695  chi2Matrix[0](7,5) = -0.2067162;
1696  chi2Matrix[0](7,6) = -0.1883866;
1697  chi2Matrix[0](7,7) = 0.844935;
1698  chi2Matrix[0](7,8) = -0.124291;
1699  chi2Matrix[0](7,9) = 0.;
1700  chi2Matrix[0](8,0) = 0.;
1701  chi2Matrix[0](8,1) = 0.;
1702  chi2Matrix[0](8,2) = 0.;
1703  chi2Matrix[0](8,3) = 0.;
1704  chi2Matrix[0](8,4) = -0.1239006;
1705  chi2Matrix[0](8,5) = -0.1230729;
1706  chi2Matrix[0](8,6) = -0.1235052;
1707  chi2Matrix[0](8,7) = -0.124291;
1708  chi2Matrix[0](8,8) = 0.8749833;
1709  chi2Matrix[0](8,9) = 0.;
1710  chi2Matrix[0](9,0) = 0.;
1711  chi2Matrix[0](9,1) = 0.;
1712  chi2Matrix[0](9,2) = 0.;
1713  chi2Matrix[0](9,3) = 0.;
1714  chi2Matrix[0](9,4) = 0.;
1715  chi2Matrix[0](9,5) = 0.;
1716  chi2Matrix[0](9,6) = 0.;
1717  chi2Matrix[0](9,7) = 0.;
1718  chi2Matrix[0](9,8) = 0.;
1719  chi2Matrix[0](9,9) = 0.;
1720  }
1721  else if (getWeightsFromFile_)
1722  {
1723  //Read from file
1724  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading chi2Matrix from file " << edm::FileInPath(chi2MatrixFile_).fullPath().c_str() ;
1725  std::ifstream chi2MatrixFile(edm::FileInPath(chi2MatrixFile_).fullPath().c_str());
1726  int tdcBin=0;
1727  while (!chi2MatrixFile.eof() && tdcBin < nTDCbins_)
1728  {
1729  // chi2Matrix[tdcBin].resize(10);
1730  for(int j = 0; j < 10; ++j) {
1731  for(int l = 0; l < 10; ++l) {
1732  float ww;
1733  chi2MatrixFile >> ww;
1734  chi2Matrix[tdcBin](j,l)=ww;
1735  }
1736  }
1737  ++tdcBin;
1738  }
1739  assert (tdcBin == nTDCbins_);
1740  }
1741  else
1742  {
1743  //Not supported
1744  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1745  throw cms::Exception("WrongConfig");
1746  }
1747 
1748 // for (int i=0;i<nTDCbins_;i++)
1749 // {
1750  // assert(chi2Matrix[i].size() == 10);
1751  chi2Matrix_ = chi2Matrix;
1752 // }
1753 
1754  std::vector< EcalWeightSet::EcalChi2WeightMatrix > chi2MatrixAft(nTDCbins_);
1755  if (!getWeightsFromFile_ && nTDCbins_ == 1 )
1756  {
1757  // chi2MatrixAft[0].resize(10);
1758  // for (int i=0;i<10;i++)
1759  // chi2MatrixAft[0][i].resize(10);
1760 
1761  chi2MatrixAft[0](0,0) = 0.;
1762  chi2MatrixAft[0](0,1) = 0.;
1763  chi2MatrixAft[0](0,2) = 0.;
1764  chi2MatrixAft[0](0,3) = 0.;
1765  chi2MatrixAft[0](0,4) = 0.;
1766  chi2MatrixAft[0](0,5) = 0.;
1767  chi2MatrixAft[0](0,6) = 0.;
1768  chi2MatrixAft[0](0,7) = 0.;
1769  chi2MatrixAft[0](0,8) = 0.;
1770  chi2MatrixAft[0](0,9) = 0.;
1771  chi2MatrixAft[0](1,0) = 0.;
1772  chi2MatrixAft[0](1,1) = 0.;
1773  chi2MatrixAft[0](1,2) = 0.;
1774  chi2MatrixAft[0](1,3) = 0.;
1775  chi2MatrixAft[0](1,4) = 0.;
1776  chi2MatrixAft[0](1,5) = 0.;
1777  chi2MatrixAft[0](1,6) = 0.;
1778  chi2MatrixAft[0](1,7) = 0.;
1779  chi2MatrixAft[0](1,8) = 0.;
1780  chi2MatrixAft[0](1,9) = 0.;
1781  chi2MatrixAft[0](2,0) = 0.;
1782  chi2MatrixAft[0](2,1) = 0.;
1783  chi2MatrixAft[0](2,2) = 0.;
1784  chi2MatrixAft[0](2,3) = 0.;
1785  chi2MatrixAft[0](2,4) = 0.;
1786  chi2MatrixAft[0](2,5) = 0.;
1787  chi2MatrixAft[0](2,6) = 0.;
1788  chi2MatrixAft[0](2,7) = 0.;
1789  chi2MatrixAft[0](2,8) = 0.;
1790  chi2MatrixAft[0](2,9) = 0.;
1791  chi2MatrixAft[0](3,0) = 0.;
1792  chi2MatrixAft[0](3,1) = 0.;
1793  chi2MatrixAft[0](3,2) = 0.;
1794  chi2MatrixAft[0](3,3) = 0.;
1795  chi2MatrixAft[0](3,4) = 0.;
1796  chi2MatrixAft[0](3,5) = 0.;
1797  chi2MatrixAft[0](3,6) = 0.;
1798  chi2MatrixAft[0](3,7) = 0.;
1799  chi2MatrixAft[0](3,8) = 0.;
1800  chi2MatrixAft[0](3,9) = 0.;
1801  chi2MatrixAft[0](4,0) = 0.;
1802  chi2MatrixAft[0](4,1) = 0.;
1803  chi2MatrixAft[0](4,2) = 0.;
1804  chi2MatrixAft[0](4,3) = 0.;
1805  chi2MatrixAft[0](4,4) = 0.8030884;
1806  chi2MatrixAft[0](4,5) = -0.2543541;
1807  chi2MatrixAft[0](4,6) = -0.2243544;
1808  chi2MatrixAft[0](4,7) = -0.1698177;
1809  chi2MatrixAft[0](4,8) = -0.1194506;
1810  chi2MatrixAft[0](4,9) = 0.;
1811  chi2MatrixAft[0](5,0) = 0.;
1812  chi2MatrixAft[0](5,1) = 0.;
1813  chi2MatrixAft[0](5,2) = 0.;
1814  chi2MatrixAft[0](5,3) = 0.;
1815  chi2MatrixAft[0](5,4) = -0.2543541;
1816  chi2MatrixAft[0](5,5) = 0.6714465;
1817  chi2MatrixAft[0](5,6) = -0.2898025;
1818  chi2MatrixAft[0](5,7) = -0.2193564;
1819  chi2MatrixAft[0](5,8) = -0.1542964;
1820  chi2MatrixAft[0](5,9) = 0.;
1821  chi2MatrixAft[0](6,0) = 0.;
1822  chi2MatrixAft[0](6,1) = 0.;
1823  chi2MatrixAft[0](6,2) = 0.;
1824  chi2MatrixAft[0](6,3) = 0.;
1825  chi2MatrixAft[0](6,4) = -0.2243544;
1826  chi2MatrixAft[0](6,5) = -0.2898025;
1827  chi2MatrixAft[0](6,6) = 0.7443781;
1828  chi2MatrixAft[0](6,7) = -0.1934846;
1829  chi2MatrixAft[0](6,8) = -0.136098;
1830  chi2MatrixAft[0](6,9) = 0.;
1831  chi2MatrixAft[0](7,0) = 0.;
1832  chi2MatrixAft[0](7,1) = 0.;
1833  chi2MatrixAft[0](7,2) = 0.;
1834  chi2MatrixAft[0](7,3) = 0.;
1835  chi2MatrixAft[0](7,4) = -0.1698177;
1836  chi2MatrixAft[0](7,5) = -0.2193564;
1837  chi2MatrixAft[0](7,6) = -0.1934846;
1838  chi2MatrixAft[0](7,7) = 0.8535482;
1839  chi2MatrixAft[0](7,8) = -0.1030149;
1840  chi2MatrixAft[0](7,9) = 0.;
1841  chi2MatrixAft[0](8,0) = 0.;
1842  chi2MatrixAft[0](8,1) = 0.;
1843  chi2MatrixAft[0](8,2) = 0.;
1844  chi2MatrixAft[0](8,3) = 0.;
1845  chi2MatrixAft[0](8,4) = -0.1194506;
1846  chi2MatrixAft[0](8,5) = -0.1542964;
1847  chi2MatrixAft[0](8,6) = -0.136098;
1848  chi2MatrixAft[0](8,7) = -0.1030149;
1849  chi2MatrixAft[0](8,8) = 0.9275388;
1850  chi2MatrixAft[0](8,9) = 0.;
1851  chi2MatrixAft[0](9,0) = 0.;
1852  chi2MatrixAft[0](9,1) = 0.;
1853  chi2MatrixAft[0](9,2) = 0.;
1854  chi2MatrixAft[0](9,3) = 0.;
1855  chi2MatrixAft[0](9,4) = 0.;
1856  chi2MatrixAft[0](9,5) = 0.;
1857  chi2MatrixAft[0](9,6) = 0.;
1858  chi2MatrixAft[0](9,7) = 0.;
1859  chi2MatrixAft[0](9,8) = 0.;
1860  chi2MatrixAft[0](9,9) = 0.;
1861  }
1862  else if (getWeightsFromFile_)
1863  {
1864  //Read from file
1865  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading chi2MatrixAft from file " << edm::FileInPath(chi2MatrixAftFile_).fullPath().c_str() ;
1866  std::ifstream chi2MatrixAftFile(edm::FileInPath(chi2MatrixAftFile_).fullPath().c_str());
1867  int tdcBin=0;
1868  while (!chi2MatrixAftFile.eof() && tdcBin < nTDCbins_)
1869  {
1870  // chi2MatrixAft[tdcBin].resize(10);
1871  for(int j = 0; j < 10; ++j) {
1872  for(int l = 0; l < 10; ++l) {
1873  float ww;
1874  chi2MatrixAftFile >> ww;
1875  chi2MatrixAft[tdcBin](j,l)=ww;
1876  }
1877  }
1878  ++tdcBin;
1879  }
1880  assert (tdcBin == nTDCbins_);
1881  }
1882  else
1883  {
1884  //Not supported
1885  edm::LogError("EcalTrivialConditionRetriever") << "Configuration not supported. Exception is raised ";
1886  throw cms::Exception("WrongConfig");
1887  }
1888 
1889 // for (int i=0;i<nTDCbins_;i++)
1890 // {
1891  // assert(chi2MatrixAft[i].size() == 10);
1892  chi2MatrixAft_ = chi2MatrixAft;
1893  // }
1894 
1895 }
1896 
1897 
1898 // --------------------------------------------------------------------------------
1899 
1900 std::auto_ptr<EcalChannelStatus>
1902 {
1903  std::auto_ptr<EcalChannelStatus> ecalStatus = std::auto_ptr<EcalChannelStatus>( new EcalChannelStatus() );
1904 
1905 
1906  // start by setting all statuses to 0
1907 
1908  // barrel
1909  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
1910  if(ieta==0) continue;
1911  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
1912  if (EBDetId::validDetId(ieta,iphi)) {
1913  EBDetId ebid(ieta,iphi);
1914  ecalStatus->setValue( ebid, 0 );
1915  }
1916  }
1917  }
1918  // endcap
1919  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
1920  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
1921  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
1922  if (EEDetId::validDetId(iX,iY,1)) {
1923  EEDetId eedetidpos(iX,iY,1);
1924  ecalStatus->setValue( eedetidpos, 0 );
1925  }
1926  if (EEDetId::validDetId(iX,iY,-1)) {
1927  EEDetId eedetidneg(iX,iY,-1);
1928  ecalStatus->setValue( eedetidneg, 0 );
1929  }
1930  }
1931  }
1932 
1933 
1934 
1935  // overwrite the statuses which are in the file
1936 
1937  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading channel statuses from file " << edm::FileInPath(channelStatusFile_).fullPath().c_str() ;
1938  std::ifstream statusFile(edm::FileInPath(channelStatusFile_).fullPath().c_str());
1939  if ( !statusFile.good() ) {
1940  edm::LogError ("EcalTrivialConditionRetriever")
1941  << "*** Problems opening file: " << channelStatusFile_ ;
1942  throw cms::Exception ("Cannot open ECAL channel status file") ;
1943  }
1944 
1945  std::string EcalSubDet;
1946  std::string str;
1947  int hashIndex(0);
1948  int status(0);
1949 
1950  while (!statusFile.eof())
1951  {
1952  statusFile >> EcalSubDet;
1953  if (EcalSubDet!=std::string("EB") && EcalSubDet!=std::string("EE"))
1954  {
1955  std::getline(statusFile,str);
1956  continue;
1957  }
1958  else
1959  {
1960  statusFile>> hashIndex >> status;
1961  }
1962  // std::cout << EcalSubDet << " " << hashIndex << " " << status;
1963 
1964  if(EcalSubDet==std::string("EB"))
1965  {
1966  EBDetId ebid = EBDetId::unhashIndex(hashIndex);
1967  ecalStatus->setValue( ebid, status );
1968  }
1969  else if(EcalSubDet==std::string("EE"))
1970  {
1971  EEDetId eedetid = EEDetId::unhashIndex(hashIndex);
1972  ecalStatus->setValue( eedetid, status );
1973  }
1974  else
1975  {
1976  edm::LogError ("EcalTrivialConditionRetriever")
1977  << " *** " << EcalSubDet << " is neither EB nor EE ";
1978  }
1979 
1980  }
1981  // the file is supposed to be in the form -- FIXME
1982 
1983 
1984  statusFile.close();
1985  return ecalStatus;
1986 }
1987 
1988 
1989 
1990 std::auto_ptr<EcalChannelStatus>
1992 {
1993 
1994  std::auto_ptr<EcalChannelStatus> ical = std::auto_ptr<EcalChannelStatus>( new EcalChannelStatus() );
1995  // barrel
1996  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
1997  if(ieta==0) continue;
1998  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
1999  if (EBDetId::validDetId(ieta,iphi)) {
2000  EBDetId ebid(ieta,iphi);
2001  ical->setValue( ebid, 0 );
2002  }
2003  }
2004  }
2005  // endcap
2006  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
2007  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
2008  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
2009  if (EEDetId::validDetId(iX,iY,1)) {
2010  EEDetId eedetidpos(iX,iY,1);
2011  ical->setValue( eedetidpos, 0 );
2012  }
2013  if (EEDetId::validDetId(iX,iY,-1)) {
2014  EEDetId eedetidneg(iX,iY,-1);
2015  ical->setValue( eedetidneg, 0 );
2016  }
2017  }
2018  }
2019  return ical;
2020 }
2021 
2022 // --------------------------------------------------------------------------------
2023 std::auto_ptr<EcalDQMChannelStatus>
2025 {
2026  uint32_t sta(0);
2027 
2028  std::auto_ptr<EcalDQMChannelStatus> ical = std::auto_ptr<EcalDQMChannelStatus>( new EcalDQMChannelStatus() );
2029  // barrel
2030  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
2031  if(ieta==0) continue;
2032  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
2033  if (EBDetId::validDetId(ieta,iphi)) {
2034  EBDetId ebid(ieta,iphi);
2035  ical->setValue( ebid, sta );
2036  }
2037  }
2038  }
2039  // endcap
2040  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
2041  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
2042  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
2043  if (EEDetId::validDetId(iX,iY,1)) {
2044  EEDetId eedetidpos(iX,iY,1);
2045  ical->setValue( eedetidpos, sta );
2046  }
2047  if (EEDetId::validDetId(iX,iY,-1)) {
2048  EEDetId eedetidneg(iX,iY,-1);
2049  ical->setValue( eedetidneg, sta );
2050  }
2051  }
2052  }
2053  return ical;
2054 }
2055 // --------------------------------------------------------------------------------
2056 
2057 std::auto_ptr<EcalDQMTowerStatus>
2059 {
2060 
2061  std::auto_ptr<EcalDQMTowerStatus> ical = std::auto_ptr<EcalDQMTowerStatus>( new EcalDQMTowerStatus() );
2062 
2063  uint32_t sta(0);
2064 
2065  // barrel
2066  int iz=0;
2067  for(int k=0 ; k<2; k++ ) {
2068  if(k==0) iz=-1;
2069  if(k==1) iz=+1;
2070  for(int i=1 ; i<73; i++) {
2071  for(int j=1 ; j<18; j++) {
2073  EcalTrigTowerDetId ebid(iz,EcalBarrel,j,i);
2074 
2075  ical->setValue( ebid, sta );
2076  }
2077  }
2078  }
2079  }
2080 
2081 
2082  // endcap
2083  for(int k=0 ; k<2; k++ ) {
2084  if(k==0) iz=-1;
2085  if(k==1) iz=+1;
2086  for(int i=1 ; i<21; i++) {
2087  for(int j=1 ; j<21; j++) {
2088  if (EcalScDetId::validDetId(i,j,iz )){
2089  EcalScDetId eeid(i,j,iz);
2090  ical->setValue( eeid, sta );
2091  }
2092  }
2093  }
2094  }
2095 
2096  return ical;
2097 }
2098 
2099 // --------------------------------------------------------------------------------
2100 std::auto_ptr<EcalDCSTowerStatus>
2102 {
2103 
2104  std::auto_ptr<EcalDCSTowerStatus> ical = std::auto_ptr<EcalDCSTowerStatus>( new EcalDCSTowerStatus() );
2105 
2106  int status(0);
2107 
2108  // barrel
2109  int iz=0;
2110  for(int k=0 ; k<2; k++ ) {
2111  if(k==0) iz=-1;
2112  if(k==1) iz=+1;
2113  for(int i=1 ; i<73; i++) {
2114  for(int j=1 ; j<18; j++) {
2116  EcalTrigTowerDetId ebid(iz,EcalBarrel,j,i);
2117 
2118  ical->setValue( ebid, status );
2119  }
2120  }
2121  }
2122  }
2123 
2124 
2125  // endcap
2126  for(int k=0 ; k<2; k++ ) {
2127  if(k==0) iz=-1;
2128  if(k==1) iz=+1;
2129  for(int i=1 ; i<21; i++) {
2130  for(int j=1 ; j<21; j++) {
2131  if (EcalScDetId::validDetId(i,j,iz )){
2132  EcalScDetId eeid(i,j,iz);
2133  ical->setValue( eeid, status );
2134  }
2135  }
2136  }
2137  }
2138 
2139  return ical;
2140 }
2141 // --------------------------------------------------------------------------------
2142 
2143 std::auto_ptr<EcalDAQTowerStatus>
2145 {
2146 
2147  std::auto_ptr<EcalDAQTowerStatus> ical = std::auto_ptr<EcalDAQTowerStatus>( new EcalDAQTowerStatus() );
2148 
2149  int status(0);
2150 
2151  // barrel
2152  int iz=0;
2153  for(int k=0 ; k<2; k++ ) {
2154  if(k==0) iz=-1;
2155  if(k==1) iz=+1;
2156  for(int i=1 ; i<73; i++) {
2157  for(int j=1 ; j<18; j++) {
2159  EcalTrigTowerDetId ebid(iz,EcalBarrel,j,i);
2160 
2161  ical->setValue( ebid, status );
2162  }
2163  }
2164  }
2165  }
2166 
2167 
2168  // endcap
2169  for(int k=0 ; k<2; k++ ) {
2170  if(k==0) iz=-1;
2171  if(k==1) iz=+1;
2172  for(int i=1 ; i<21; i++) {
2173  for(int j=1 ; j<21; j++) {
2174  if (EcalScDetId::validDetId(i,j,iz )){
2175  EcalScDetId eeid(i,j,iz);
2176  ical->setValue( eeid, status );
2177  }
2178  }
2179  }
2180  }
2181 
2182  return ical;
2183 }
2184 // --------------------------------------------------------------------------------
2185 
2186 std::auto_ptr<EcalTPGCrystalStatus>
2188 {
2189  std::auto_ptr<EcalTPGCrystalStatus> ecalStatus = std::auto_ptr<EcalTPGCrystalStatus>( new EcalTPGCrystalStatus() );
2190 
2191 
2192  // start by setting all statuses to 0
2193 
2194  // barrel
2195  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
2196  if(ieta==0) continue;
2197  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
2198  if (EBDetId::validDetId(ieta,iphi)) {
2199  EBDetId ebid(ieta,iphi);
2200  ecalStatus->setValue( ebid, 0 );
2201  }
2202  }
2203  }
2204  // endcap
2205  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
2206  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
2207  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
2208  if (EEDetId::validDetId(iX,iY,1)) {
2209  EEDetId eedetidpos(iX,iY,1);
2210  ecalStatus->setValue( eedetidpos, 0 );
2211  }
2212  if (EEDetId::validDetId(iX,iY,-1)) {
2213  EEDetId eedetidneg(iX,iY,-1);
2214  ecalStatus->setValue( eedetidneg, 0 );
2215  }
2216  }
2217  }
2218 
2219 
2220 
2221  // overwrite the statuses which are in the file
2222 
2223  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading channel statuses from file " << edm::FileInPath(channelStatusFile_).fullPath().c_str() ;
2224  std::ifstream statusFile(edm::FileInPath(channelStatusFile_).fullPath().c_str());
2225  if ( !statusFile.good() ) {
2226  edm::LogError ("EcalTrivialConditionRetriever")
2227  << "*** Problems opening file: " << channelStatusFile_ ;
2228  throw cms::Exception ("Cannot open ECAL channel status file") ;
2229  }
2230 
2231  std::string EcalSubDet;
2232  std::string str;
2233  int hashIndex(0);
2234  int status(0);
2235 
2236  while (!statusFile.eof())
2237  {
2238  statusFile >> EcalSubDet;
2239  if (EcalSubDet!=std::string("EB") && EcalSubDet!=std::string("EE"))
2240  {
2241  std::getline(statusFile,str);
2242  continue;
2243  }
2244  else
2245  {
2246  statusFile>> hashIndex >> status;
2247  }
2248  // std::cout << EcalSubDet << " " << hashIndex << " " << status;
2249 
2250  if(EcalSubDet==std::string("EB"))
2251  {
2252  EBDetId ebid = EBDetId::unhashIndex(hashIndex);
2253  ecalStatus->setValue( ebid, status );
2254  }
2255  else if(EcalSubDet==std::string("EE"))
2256  {
2257  EEDetId eedetid = EEDetId::unhashIndex(hashIndex);
2258  ecalStatus->setValue( eedetid, status );
2259  }
2260  else
2261  {
2262  edm::LogError ("EcalTrivialConditionRetriever")
2263  << " *** " << EcalSubDet << " is neither EB nor EE ";
2264  }
2265 
2266  }
2267  // the file is supposed to be in the form -- FIXME
2268 
2269 
2270  statusFile.close();
2271  return ecalStatus;
2272 }
2273 
2274 
2275 
2276 std::auto_ptr<EcalTPGCrystalStatus>
2278 {
2279 
2280  std::auto_ptr<EcalTPGCrystalStatus> ical = std::auto_ptr<EcalTPGCrystalStatus>( new EcalTPGCrystalStatus() );
2281  // barrel
2282  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
2283  if(ieta==0) continue;
2284  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
2285  if (EBDetId::validDetId(ieta,iphi)) {
2286  EBDetId ebid(ieta,iphi);
2287  ical->setValue( ebid, 0 );
2288  }
2289  }
2290  }
2291  // endcap
2292  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
2293  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
2294  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
2295  if (EEDetId::validDetId(iX,iY,1)) {
2296  EEDetId eedetidpos(iX,iY,1);
2297  ical->setValue( eedetidpos, 0 );
2298  }
2299  if (EEDetId::validDetId(iX,iY,-1)) {
2300  EEDetId eedetidneg(iX,iY,-1);
2301  ical->setValue( eedetidneg, 0 );
2302  }
2303  }
2304  }
2305  return ical;
2306 }
2307 
2308 
2309 
2310 
2311 std::auto_ptr<EcalIntercalibConstants>
2314 {
2315  std::auto_ptr<EcalIntercalibConstants> ical;
2316  // std::auto_ptr<EcalIntercalibConstants>( new EcalIntercalibConstants() );
2317 
2318  // Read the values from a txt file
2319  // -------------------------------
2320 
2321  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading intercalibration constants from file "
2322  << intercalibConstantsFile_.c_str() ;
2323 
2324  if(intercalibConstantsFile_.find(".xml")!= std::string::npos) {
2325 
2326  std::cout<<"generating Intercalib from xml file"<<std::endl;
2327 
2328  EcalCondHeader h;
2330  EcalIntercalibConstantsXMLTranslator::readXML(intercalibConstantsFile_,h,*rcd);
2331 
2332 
2333  if(totLumi_ !=0 || instLumi_!=0) {
2334  std::cout<<"implementing ageing for intercalib"<<std::endl;
2335 
2337 
2338  if(intercalibConstantsMCFile_.find(".xml")!= std::string::npos) {
2339 
2340  std::cout<<"generating IntercalibMC from xml file"<<std::endl;
2341 
2342  EcalCondHeader h;
2343  EcalIntercalibConstantsMCXMLTranslator::readXML(intercalibConstantsMCFile_,h,*rcdMC);
2344 
2345  } else {
2346  std::cout<<"please provide the xml file of the EcalIntercalibConstantsMC"<<std::endl;
2347  }
2348 
2349 
2350  TRandom3 * gRandom = new TRandom3();
2351 
2352  EnergyResolutionVsLumi ageing;
2353  ageing.setLumi(totLumi_);
2354  ageing.setInstLumi(instLumi_);
2355 
2356 
2357  const EcalIntercalibConstantMap& mymap= rcd->getMap();
2358  const EcalIntercalibConstantMCMap& mymapMC= rcdMC->getMap();
2359 
2360  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA ;++ieta) {
2361  if(ieta==0) continue;
2362 
2363  double eta=EBDetId::approxEta(EBDetId(ieta,1));
2364  eta = fabs(eta);
2365  double constantTerm= ageing.calcresolutitonConstantTerm(eta);
2366  std::cout<<"EB at eta="<<eta<<" constant term is "<<constantTerm<<std::endl;
2367 
2368  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
2369  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
2370  if (EBDetId::validDetId(ieta,iphi))
2371  {
2372  EBDetId ebid(ieta,iphi);
2374  EcalIntercalibConstant icalconstant=1;
2375  if(idref!=mymap.end())icalconstant=(*idref);
2376 
2377  EcalIntercalibConstantsMC::const_iterator idrefMC=mymapMC.find(ebid);
2378  EcalIntercalibConstantMC icalconstantMC=1;
2379  if(idrefMC!=mymapMC.end())icalconstantMC=(*idrefMC);
2380 
2381  double r = gRandom->Gaus(0,constantTerm);
2382 
2383  if(iphi==10) std::cout<<"EB at eta="<<eta<<" IC="<<icalconstant<<" ICMC="<<icalconstantMC<<" smear="<<r<<" ";
2384 
2385  icalconstant = icalconstant + r*1.29*icalconstantMC;
2386  rcd->setValue( ebid.rawId(), icalconstant );
2387 
2388  if(iphi==10) std::cout<<"newIC="<<icalconstant<<std::endl;
2389 
2390  EcalIntercalibConstant icalconstant2=(*idref);
2391  if(icalconstant !=icalconstant2) std::cout<<">>>> error in smearing intercalib"<<std::endl;
2392  }
2393  }
2394  }
2395 
2396  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
2397  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
2398  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
2399  if (EEDetId::validDetId(iX,iY,1))
2400  {
2401 
2402  EEDetId eedetidpos(iX,iY,1);
2403  double eta= -log(tan(0.5*atan(sqrt((iX-50.0)*(iX-50.0)+(iY-50.0)*(iY-50.0))*2.98/328.)));
2404  eta = fabs(eta);
2405  double constantTerm=ageing.calcresolutitonConstantTerm(eta);
2406  if(iX==50) std::cout<<"EE at eta="<<eta<<" constant term is "<<constantTerm<<std::endl;
2407 
2408 
2409 
2410 
2411  EcalIntercalibConstants::const_iterator idref=mymap.find(eedetidpos);
2412  EcalIntercalibConstant icalconstant=1;
2413  if(idref!=mymap.end())icalconstant=(*idref);
2414 
2415  EcalIntercalibConstantsMC::const_iterator idrefMC=mymapMC.find(eedetidpos);
2416  EcalIntercalibConstantMC icalconstantMC=1;
2417  if(idrefMC!=mymapMC.end())icalconstantMC=(*idrefMC);
2418 
2419  double r = gRandom->Gaus(0,constantTerm);
2420 
2421  if(iX==10) std::cout<<"EE at eta="<<eta<<" IC="<<icalconstant<<" ICMC="<<icalconstantMC<<" smear="<<r<<" ";
2422  icalconstant = icalconstant + r*1.29*icalconstantMC;
2423  rcd->setValue( eedetidpos.rawId(), icalconstant );
2424  if(iX==10) std::cout<<"newIC="<<icalconstant<<std::endl;
2425 
2426 
2427 
2428  }
2429  if(EEDetId::validDetId(iX,iY,-1))
2430  {
2431 
2432  EEDetId eedetidneg(iX,iY,-1);
2433  double eta= -log(tan(0.5*atan(sqrt((iX-50.0)*(iX-50.0)+(iY-50.0)*(iY-50.0))*2.98/328.)));
2434  eta = fabs(eta);
2435  double constantTerm=ageing.calcresolutitonConstantTerm(eta);
2436  EcalIntercalibConstant icalconstant=1;
2437 
2438 
2439  EcalIntercalibConstantsMC::const_iterator idrefMC=mymapMC.find(eedetidneg);
2440  EcalIntercalibConstantMC icalconstantMC=1;
2441  if(idrefMC!=mymapMC.end())icalconstantMC=(*idrefMC);
2442 
2443  double r = gRandom->Gaus(0,constantTerm);
2444  icalconstant = icalconstant + r*1.29*icalconstantMC;
2445  rcd->setValue( eedetidneg.rawId(), icalconstant );
2446 
2447 
2448  }
2449  }
2450  }
2451 
2452  ical = std::auto_ptr<EcalIntercalibConstants> (rcd);
2453 
2454  delete gRandom;
2455 
2456  }
2457 
2458 
2459  } else {
2460 
2461  ical =std::auto_ptr<EcalIntercalibConstants>( new EcalIntercalibConstants() );
2462 
2463  FILE *inpFile ;
2464  inpFile = fopen (intercalibConstantsFile_.c_str (),"r") ;
2465  if (!inpFile)
2466  {
2467  edm::LogError ("EcalTrivialConditionRetriever")
2468  << "*** Can not open file: " << intercalibConstantsFile_ ;
2469  throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
2470  }
2471 
2472  char line[256] ;
2473  std::ostringstream str ;
2474  fgets (line,255,inpFile) ;
2475  int sm_number=atoi (line) ;
2476  str << "sm: " << sm_number ;
2477 
2478  fgets (line,255,inpFile) ;
2479  //int nevents=atoi (line) ; // not necessary here just for online conddb
2480 
2481  fgets (line,255,inpFile) ;
2482  std::string gen_tag = line ;
2483  str << "gen tag: " << gen_tag ; // should I use this?
2484 
2485  fgets (line,255,inpFile) ;
2486  std::string cali_method = line ;
2487  str << "cali method: " << cali_method << std::endl ; // not important
2488 
2489  fgets (line,255,inpFile) ;
2490  std::string cali_version = line ;
2491  str << "cali version: " << cali_version << std::endl ; // not important
2492 
2493  fgets (line,255,inpFile) ;
2494  std::string cali_type = line ;
2495  str << "cali type: " << cali_type ; // not important
2496 
2497  edm::LogInfo("EcalTrivialConditionRetriever")
2498  << "[PIETRO] Intercalibration file - "
2499  << str.str () << std::endl ;
2500 
2501  float calib[1700]={1} ;
2502  int calib_status[1700]={0} ;
2503 
2504  int ii = 0 ;
2505 
2506  while (fgets (line,255,inpFile))
2507  {
2508  ii++;
2509  int dmy_num = 0 ;
2510  float dmy_calib = 0. ;
2511  float dmy_RMS = 0. ;
2512  int dmy_events = 0 ;
2513  int dmy_status = 0 ;
2514  sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
2515  &dmy_RMS, &dmy_events,
2516  &dmy_status) ;
2517  assert (dmy_num >= 1) ;
2518  assert (dmy_num <= 1700) ;
2519  calib[dmy_num-1] = dmy_calib ;
2520  calib_status[dmy_num-1] = dmy_status ;
2521 
2522  // edm::LogInfo ("EcalTrivialConditionRetriever")
2523  // << "[PIETRO] cry = " << dmy_num
2524  // << " calib = " << calib[dmy_num-1]
2525  // << " RMS = " << dmy_RMS
2526  // << " events = " << dmy_events
2527  // << " status = " << calib_status[dmy_num-1]
2528  // << std::endl ;
2529  }
2530 
2531  fclose (inpFile) ; // close inp. file
2532  edm::LogInfo ("EcalTrivialConditionRetriever") << "Read intercalibrations for " << ii << " xtals " ;
2533  if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
2534  << "Some crystals missing, set to 1" << std::endl ;
2535 
2536  // Transfer the data to the inter-calibration coefficients container
2537  // -----------------------------------------------------------------
2538 
2539  // DB supermodule always set to 1 for the TestBeam FIXME
2540  int sm_db=1 ;
2541  // loop over channels
2542  for (int i=0 ; i<1700 ; i++)
2543  {
2544  //if (EBDetId::validDetId(iEta,iPhi)) {
2545  // CANNOT be used -- validDetId only checks ETA PHI method
2546  // doing a check by hand, here is the only place in CMSSW
2547  // outside TB code and EcalRawToDigi where needed
2548  // => no need for changing the DetId interface
2549  //
2550  // checking only sm_db -- guess can change with the above FIXME
2551  if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
2552  EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
2553  if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
2554  else ical->setValue (ebid.rawId (), 1.) ;
2555  }
2556  //}
2557  } // loop over channels
2558 
2559 
2560 
2561 
2562  }
2563 
2564  return ical;
2565 
2566 
2567 }
2568 
2569 std::auto_ptr<EcalIntercalibConstantsMC>
2572 {
2573  std::auto_ptr<EcalIntercalibConstantsMC> ical;
2574  // std::auto_ptr<EcalIntercalibConstants>( new EcalIntercalibConstants() );
2575 
2576  // Read the values from a xml file
2577  // -------------------------------
2578 
2579  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading intercalibration constants MC from file "
2580  << intercalibConstantsMCFile_.c_str() ;
2581 
2582  if(intercalibConstantsMCFile_.find(".xml")!= std::string::npos) {
2583 
2584  std::cout<<"generating Intercalib MC from xml file"<<std::endl;
2585 
2586  EcalCondHeader h;
2588  EcalIntercalibConstantsMCXMLTranslator::readXML(intercalibConstantsMCFile_,h,*rcd);
2589 
2590  ical = std::auto_ptr<EcalIntercalibConstants> (rcd);
2591 
2592  } else {
2593 
2594  std::cout <<"ERROR>>> please provide a xml file"<<std::endl;
2595  }
2596 
2597 
2598  return ical;
2599 
2600 }
2601 
2602 
2603 std::auto_ptr<EcalIntercalibErrors>
2606 {
2607  std::auto_ptr<EcalIntercalibErrors> ical =
2608  std::auto_ptr<EcalIntercalibErrors>( new EcalIntercalibErrors() );
2609 
2610  // Read the values from a txt file
2611  // -------------------------------
2612 
2613  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading intercalibration constants from file "
2614  << intercalibErrorsFile_.c_str() ;
2615 
2616  FILE *inpFile ;
2617  inpFile = fopen (intercalibErrorsFile_.c_str (),"r") ;
2618  if (!inpFile)
2619  {
2620  edm::LogError ("EcalTrivialConditionRetriever")
2621  << "*** Can not open file: " << intercalibErrorsFile_ ;
2622  throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
2623  }
2624 
2625  char line[256] ;
2626  std::ostringstream str ;
2627  fgets (line,255,inpFile) ;
2628  int sm_number=atoi (line) ;
2629  str << "sm: " << sm_number ;
2630 
2631  fgets (line,255,inpFile) ;
2632  //int nevents=atoi (line) ; // not necessary here just for online conddb
2633 
2634  fgets (line,255,inpFile) ;
2635  std::string gen_tag = line ;
2636  str << "gen tag: " << gen_tag ; // should I use this?
2637 
2638  fgets (line,255,inpFile) ;
2639  std::string cali_method = line ;
2640  str << "cali method: " << cali_method << std::endl ; // not important
2641 
2642  fgets (line,255,inpFile) ;
2643  std::string cali_version = line ;
2644  str << "cali version: " << cali_version << std::endl ; // not important
2645 
2646  fgets (line,255,inpFile) ;
2647  std::string cali_type = line ;
2648  str << "cali type: " << cali_type ; // not important
2649 
2650  edm::LogInfo("EcalTrivialConditionRetriever")
2651  << "[PIETRO] Intercalibration file - "
2652  << str.str () << std::endl ;
2653 
2654  float calib[1700]={1} ;
2655  int calib_status[1700]={0} ;
2656 
2657  int ii = 0 ;
2658 
2659  while (fgets (line,255,inpFile))
2660  {
2661  ii++;
2662  int dmy_num = 0 ;
2663  float dmy_calib = 0. ;
2664  float dmy_RMS = 0. ;
2665  int dmy_events = 0 ;
2666  int dmy_status = 0 ;
2667  sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
2668  &dmy_RMS, &dmy_events,
2669  &dmy_status) ;
2670  assert (dmy_num >= 1) ;
2671  assert (dmy_num <= 1700) ;
2672  calib[dmy_num-1] = dmy_calib ;
2673  calib_status[dmy_num-1] = dmy_status ;
2674 
2675 // edm::LogInfo ("EcalTrivialConditionRetriever")
2676 // << "[PIETRO] cry = " << dmy_num
2677 // << " calib = " << calib[dmy_num-1]
2678 // << " RMS = " << dmy_RMS
2679 // << " events = " << dmy_events
2680 // << " status = " << calib_status[dmy_num-1]
2681 // << std::endl ;
2682  }
2683 
2684  fclose (inpFile) ; // close inp. file
2685  edm::LogInfo ("EcalTrivialConditionRetriever") << "Read intercalibrations for " << ii << " xtals " ;
2686  if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
2687  << "Some crystals missing, set to 1" << std::endl ;
2688 
2689  // Transfer the data to the inter-calibration coefficients container
2690  // -----------------------------------------------------------------
2691 
2692  // DB supermodule always set to 1 for the TestBeam FIXME
2693  int sm_db=1 ;
2694  // loop over channels
2695  for (int i=0 ; i<1700 ; i++)
2696  {
2697  //if (EBDetId::validDetId(iEta,iPhi)) {
2698  // CANNOT be used -- validDetId only checks ETA PHI method
2699  // doing a check by hand, here is the only place in CMSSW
2700  // outside TB code and EcalRawToDigi where needed
2701  // => no need for changing the DetId interface
2702  //
2703  // checking only sm_db -- guess can change with the above FIXME
2704  if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
2705  EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
2706  if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
2707  else ical->setValue (ebid.rawId (), 1.) ;
2708  }
2709  //}
2710  } // loop over channels
2711 
2712 // edm::LogInfo ("EcalTrivialConditionRetriever") << "INTERCALIBRATION DONE" ;
2713  return ical;
2714 
2715 
2716 
2717 
2718 
2719 }
2720 
2721 // --------------------------------------------------------------------------------
2722 
2723 
2724 std::auto_ptr<EcalTimeCalibConstants>
2727 {
2728  std::auto_ptr<EcalTimeCalibConstants> ical =
2729  std::auto_ptr<EcalTimeCalibConstants>( new EcalTimeCalibConstants() );
2730 
2731  // Read the values from a txt file
2732  // -------------------------------
2733 
2734  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading time calibration constants from file "
2735  << timeCalibConstantsFile_.c_str() ;
2736 
2737  FILE *inpFile ;
2738  inpFile = fopen (timeCalibConstantsFile_.c_str (),"r") ;
2739  if (!inpFile)
2740  {
2741  edm::LogError ("EcalTrivialConditionRetriever")
2742  << "*** Can not open file: " << timeCalibConstantsFile_ ;
2743  throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
2744  }
2745 
2746  char line[256] ;
2747  std::ostringstream str ;
2748  fgets (line,255,inpFile) ;
2749  int sm_number=atoi (line) ;
2750  str << "sm: " << sm_number ;
2751 
2752  fgets (line,255,inpFile) ;
2753  //int nevents=atoi (line) ; // not necessary here just for online conddb
2754 
2755  fgets (line,255,inpFile) ;
2756  std::string gen_tag = line ;
2757  str << "gen tag: " << gen_tag ; // should I use this?
2758 
2759  fgets (line,255,inpFile) ;
2760  std::string cali_method = line ;
2761  str << "cali method: " << cali_method << std::endl ; // not important
2762 
2763  fgets (line,255,inpFile) ;
2764  std::string cali_version = line ;
2765  str << "cali version: " << cali_version << std::endl ; // not important
2766 
2767  fgets (line,255,inpFile) ;
2768  std::string cali_type = line ;
2769  str << "cali type: " << cali_type ; // not important
2770 
2771  edm::LogInfo("EcalTrivialConditionRetriever")
2772  << "TimeCalibration file - "
2773  << str.str () << std::endl ;
2774 
2775  float calib[1700]={1} ;
2776  int calib_status[1700]={0} ;
2777 
2778  int ii = 0 ;
2779 
2780  while (fgets (line,255,inpFile))
2781  {
2782  ii++;
2783  int dmy_num = 0 ;
2784  float dmy_calib = 0. ;
2785  float dmy_RMS = 0. ;
2786  int dmy_events = 0 ;
2787  int dmy_status = 0 ;
2788  sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
2789  &dmy_RMS, &dmy_events,
2790  &dmy_status) ;
2791  assert (dmy_num >= 1) ;
2792  assert (dmy_num <= 1700) ;
2793  calib[dmy_num-1] = dmy_calib ;
2794  calib_status[dmy_num-1] = dmy_status ;
2795 
2796 // edm::LogInfo ("EcalTrivialConditionRetriever")
2797 // << "[PIETRO] cry = " << dmy_num
2798 // << " calib = " << calib[dmy_num-1]
2799 // << " RMS = " << dmy_RMS
2800 // << " events = " << dmy_events
2801 // << " status = " << calib_status[dmy_num-1]
2802 // << std::endl ;
2803  }
2804 
2805  fclose (inpFile) ; // close inp. file
2806  edm::LogInfo ("EcalTrivialConditionRetriever") << "Read timeCalibrations for " << ii << " xtals " ;
2807  if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
2808  << "Some crystals missing, set to 1" << std::endl ;
2809 
2810  // Transfer the data to the inter-calibration coefficients container
2811  // -----------------------------------------------------------------
2812 
2813  // DB supermodule always set to 1 for the TestBeam FIXME
2814  int sm_db=1 ;
2815  // loop over channels
2816  for (int i=0 ; i<1700 ; i++)
2817  {
2818  //if (EBDetId::validDetId(iEta,iPhi)) {
2819  // CANNOT be used -- validDetId only checks ETA PHI method
2820  // doing a check by hand, here is the only place in CMSSW
2821  // outside TB code and EcalRawToDigi where needed
2822  // => no need for changing the DetId interface
2823  //
2824  // checking only sm_db -- guess can change with the above FIXME
2825  if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
2826  EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
2827  if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
2828  else ical->setValue (ebid.rawId (), 1.) ;
2829  }
2830  //}
2831  } // loop over channels
2832 
2833 // edm::LogInfo ("EcalTrivialConditionRetriever") << "INTERCALIBRATION DONE" ;
2834  return ical;
2835 }
2836 
2837 
2838 std::auto_ptr<EcalTimeCalibErrors>
2841 {
2842  std::auto_ptr<EcalTimeCalibErrors> ical =
2843  std::auto_ptr<EcalTimeCalibErrors>( new EcalTimeCalibErrors() );
2844 
2845  // Read the values from a txt file
2846  // -------------------------------
2847 
2848  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading timeCalibration constants from file "
2849  << timeCalibErrorsFile_.c_str() ;
2850 
2851  FILE *inpFile ;
2852  inpFile = fopen (timeCalibErrorsFile_.c_str (),"r") ;
2853  if (!inpFile)
2854  {
2855  edm::LogError ("EcalTrivialConditionRetriever")
2856  << "*** Can not open file: " << timeCalibErrorsFile_ ;
2857  throw cms::Exception ("Cannot open inter-calibration coefficients txt file") ;
2858  }
2859 
2860  char line[256] ;
2861  std::ostringstream str ;
2862  fgets (line,255,inpFile) ;
2863  int sm_number=atoi (line) ;
2864  str << "sm: " << sm_number ;
2865 
2866  fgets (line,255,inpFile) ;
2867  //int nevents=atoi (line) ; // not necessary here just for online conddb
2868 
2869  fgets (line,255,inpFile) ;
2870  std::string gen_tag = line ;
2871  str << "gen tag: " << gen_tag ; // should I use this?
2872 
2873  fgets (line,255,inpFile) ;
2874  std::string cali_method = line ;
2875  str << "cali method: " << cali_method << std::endl ; // not important
2876 
2877  fgets (line,255,inpFile) ;
2878  std::string cali_version = line ;
2879  str << "cali version: " << cali_version << std::endl ; // not important
2880 
2881  fgets (line,255,inpFile) ;
2882  std::string cali_type = line ;
2883  str << "cali type: " << cali_type ; // not important
2884 
2885  edm::LogInfo("EcalTrivialConditionRetriever")
2886  << "TimeCalibration file - "
2887  << str.str () << std::endl ;
2888 
2889  float calib[1700]={1} ;
2890  int calib_status[1700]={0} ;
2891 
2892  int ii = 0 ;
2893 
2894  while (fgets (line,255,inpFile))
2895  {
2896  ii++;
2897  int dmy_num = 0 ;
2898  float dmy_calib = 0. ;
2899  float dmy_RMS = 0. ;
2900  int dmy_events = 0 ;
2901  int dmy_status = 0 ;
2902  sscanf (line, "%d %f %f %d %d", &dmy_num, &dmy_calib,
2903  &dmy_RMS, &dmy_events,
2904  &dmy_status) ;
2905  assert (dmy_num >= 1) ;
2906  assert (dmy_num <= 1700) ;
2907  calib[dmy_num-1] = dmy_calib ;
2908  calib_status[dmy_num-1] = dmy_status ;
2909 
2910 // edm::LogInfo ("EcalTrivialConditionRetriever")
2911 // << "[PIETRO] cry = " << dmy_num
2912 // << " calib = " << calib[dmy_num-1]
2913 // << " RMS = " << dmy_RMS
2914 // << " events = " << dmy_events
2915 // << " status = " << calib_status[dmy_num-1]
2916 // << std::endl ;
2917  }
2918 
2919  fclose (inpFile) ; // close inp. file
2920  edm::LogInfo ("EcalTrivialConditionRetriever") << "Read time calibrations for " << ii << " xtals " ;
2921  if (ii!=1700) edm::LogWarning ("StoreEcalCondition")
2922  << "Some crystals missing, set to 1" << std::endl ;
2923 
2924  // Transfer the data to the inter-calibration coefficients container
2925  // -----------------------------------------------------------------
2926 
2927  // DB supermodule always set to 1 for the TestBeam FIXME
2928  int sm_db=1 ;
2929  // loop over channels
2930  for (int i=0 ; i<1700 ; i++)
2931  {
2932  //if (EBDetId::validDetId(iEta,iPhi)) {
2933  // CANNOT be used -- validDetId only checks ETA PHI method
2934  // doing a check by hand, here is the only place in CMSSW
2935  // outside TB code and EcalRawToDigi where needed
2936  // => no need for changing the DetId interface
2937  //
2938  // checking only sm_db -- guess can change with the above FIXME
2939  if (sm_db >= EBDetId::MIN_SM && sm_db <= EBDetId::MAX_SM) {
2940  EBDetId ebid (sm_db,i+1,EBDetId::SMCRYSTALMODE) ;
2941  if (calib_status[i]) ical->setValue (ebid.rawId (), calib[i]) ;
2942  else ical->setValue (ebid.rawId (), 1.) ;
2943  }
2944  //}
2945  } // loop over channels
2946 
2947 // edm::LogInfo ("EcalTrivialConditionRetriever") << "INTERCALIBRATION DONE" ;
2948  return ical;
2949 }
2950 
2951 // --------------------------------------------------------------------------------
2952 
2953 std::auto_ptr<EcalMappingElectronics>
2955 {
2956  std::auto_ptr<EcalMappingElectronics> mapping = std::auto_ptr<EcalMappingElectronics>( new EcalMappingElectronics() );
2957  edm::LogInfo("EcalTrivialConditionRetriever") << "Reading mapping from file " << edm::FileInPath(mappingFile_).fullPath().c_str() ;
2958 
2959  std::ifstream f(edm::FileInPath(mappingFile_).fullPath().c_str());
2960  if (!f.good())
2961  {
2962  edm::LogError("EcalTrivialConditionRetriever") << "File not found";
2963  throw cms::Exception("FileNotFound");
2964  }
2965 
2966  // uint32_t detid, elecid, triggerid;
2967 
2968  int ix, iy, iz, CL;
2969  // int dccid, towerid, stripid, xtalid;
2970  // int tccid, tower, ipseudostrip, xtalinps;
2971  int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
2972  int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
2973 
2974  while ( ! f.eof())
2975  {
2976  // f >> detid >> elecid >> triggerid;
2977  f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >> tower >>
2978  pseudostrip_in_TCC >> pseudostrip_in_TT ;
2979 
2980 // if (!EEDetId::validDetId(ix,iy,iz))
2981 // continue;
2982 
2983  EEDetId detid(ix,iy,iz,EEDetId::XYMODE);
2984  // std::cout << " dcc tower ps_in_SC xtal_in_ps " << dccid << " " << towerid << " " << pseudostrip_in_SC << " " << xtal_in_pseudostrip << std::endl;
2985  EcalElectronicsId elecid(dccid,towerid, pseudostrip_in_SC, xtal_in_pseudostrip);
2986  // std::cout << " tcc tt ps_in_TT xtal_in_ps " << tccid << " " << tower << " " << pseudostrip_in_TT << " " << xtal_in_pseudostrip << std::endl;
2987  EcalTriggerElectronicsId triggerid(tccid, tower, pseudostrip_in_TT, xtal_in_pseudostrip);
2988  EcalMappingElement aElement;
2989  aElement.electronicsid = elecid.rawId();
2990  aElement.triggerid = triggerid.rawId();
2991  (*mapping).setValue(detid, aElement);
2992  }
2993 
2994  f.close();
2995  return mapping;
2996 }
2997 
2998 
2999 
3000 std::auto_ptr<EcalMappingElectronics>
3002 {
3003 
3004  std::auto_ptr<EcalMappingElectronics> ical = std::auto_ptr<EcalMappingElectronics>( new EcalMappingElectronics() );
3005  return ical;
3006 }
3007 
3008 // --------------------------------------------------------------------------------
3009 
3010 std::auto_ptr<Alignments>
3012  double mytrans[3] = {0., 0., 0.};
3013  double myeuler[3] = {0., 0., 0.};
3014  std::ifstream f;
3015  if(getEBAlignmentFromFile_)
3016  f.open(edm::FileInPath(EBAlignmentFile_).fullPath().c_str());
3017  std::vector<AlignTransform> my_align;
3018  int ieta = 1;
3019  int iphi = 0;
3020  for(int SM = 1 ; SM < 37; SM++ ) {
3021  // make an EBDetId since we need EBDetId::rawId()
3022  if(SM > 18) {
3023  iphi = 1 + (SM - 19) * 20;
3024  ieta = -1;
3025  }
3026  else
3027  iphi = SM * 20;
3028  EBDetId ebdetId(ieta,iphi);
3029  if(getEBAlignmentFromFile_) {
3030  f >> myeuler[0] >> myeuler[1] >> myeuler[2] >> mytrans[0] >> mytrans[1] >> mytrans[2];
3031  std::cout << " translation " << mytrans[0] << " " << mytrans[1] << " " << mytrans[2] << "\n"
3032  << " euler " << myeuler[0] << " " << myeuler[1] << " " << myeuler[2] << std::endl;
3033  }
3034  CLHEP::Hep3Vector translation( mytrans[0], mytrans[1], mytrans[2]);
3035  CLHEP::HepEulerAngles euler( myeuler[0], myeuler[1], myeuler[2]);
3036  AlignTransform transform( translation, euler, ebdetId );
3037  my_align.push_back(transform);
3038  }
3039  /*
3040  // check
3041  uint32_t m_rawid;
3042  double m_x, m_y, m_z;
3043  double m_phi, m_theta, m_psi;
3044  int SM = 0;
3045  for (std::vector<AlignTransform>::const_iterator i = my_align.begin(); i != my_align.end(); ++i){
3046  m_rawid = i->rawId();
3047  CLHEP::Hep3Vector translation = i->translation();
3048  m_x = translation.x();
3049  m_y = translation.y();
3050  m_z = translation.z();
3051  CLHEP::HepRotation rotation = i->rotation();
3052  m_phi = rotation.getPhi();
3053  m_theta = rotation.getTheta();
3054  m_psi = rotation.getPsi();
3055  SM++;
3056  std::cout << " SM " << SM << " Id " << m_rawid << " x " << m_x << " y " << m_y << " z " << m_z
3057  << " phi " << m_phi << " theta " << m_theta << " psi " << m_psi << std::endl;
3058  }
3059  */
3060  Alignments a;
3061  a.m_align = my_align;
3062 
3063  std::auto_ptr<Alignments> ical = std::auto_ptr<Alignments>( new Alignments(a) );
3064  return ical;
3065 }
3066 
3067 std::auto_ptr<Alignments>
3069  double mytrans[3] = {0., 0., 0.};
3070  double myeuler[3] = {0., 0., 0.};
3071  std::ifstream f;
3072  if(getEEAlignmentFromFile_)
3073  f.open(edm::FileInPath(EEAlignmentFile_).fullPath().c_str());
3074  std::vector<AlignTransform> my_align;
3075  int ix = 20;
3076  int iy = 50;
3077  int side = -1;
3078  for(int Dee = 0 ; Dee < 4; Dee++ ) {
3079  // make an EEDetId since we need EEDetId::rawId()
3080  if(Dee == 1 || Dee == 3)
3081  ix = 70;
3082  else ix = 20;
3083  if(Dee == 2)
3084  side = 1;
3085  EEDetId eedetId(ix, iy, side);
3086  if(getEEAlignmentFromFile_) {
3087  f >> myeuler[0] >> myeuler[1] >> myeuler[2] >> mytrans[0] >> mytrans[1] >> mytrans[2];
3088  std::cout << " translation " << mytrans[0] << " " << mytrans[1] << " " << mytrans[2] << "\n"
3089  << " euler " << myeuler[0] << " " << myeuler[1] << " " << myeuler[2] << std::endl;
3090  }
3091  CLHEP::Hep3Vector translation( mytrans[0], mytrans[1], mytrans[2]);
3092  CLHEP::HepEulerAngles euler( myeuler[0], myeuler[1], myeuler[2]);
3093  AlignTransform transform( translation, euler, eedetId );
3094  my_align.push_back(transform);
3095  }
3096  Alignments a;
3097  a.m_align = my_align;
3098  std::auto_ptr<Alignments> ical = std::auto_ptr<Alignments>( new Alignments(a) );
3099  return ical;
3100 }
3101 
3102 std::auto_ptr<Alignments>
3104  double mytrans[3] = {0., 0., 0.};
3105  double myeuler[3] = {0., 0., 0.};
3106  std::ifstream f;
3107  if(getESAlignmentFromFile_)
3108  f.open(edm::FileInPath(ESAlignmentFile_).fullPath().c_str());
3109  std::vector<AlignTransform> my_align;
3110  // int ix_vect[10] = {10, 30, 30, 50, 10, 30, 10, 30};
3111  int pl_vect[10] = {2, 2, 1, 1, 1, 1, 2, 2};
3112  int iy = 10;
3113  int side = -1;
3114  int strip = 1;
3115  for(int layer = 0 ; layer < 8; layer++ ) {
3116  // make an ESDetId since we need ESDetId::rawId()
3117  int ix = 10 + (layer%2) * 20;
3118  int plane = pl_vect[layer];
3119  if(layer > 3) side = 1;
3120  ESDetId esdetId(strip, ix, iy, plane, side);
3121  if(getESAlignmentFromFile_) {
3122  f >> myeuler[0] >> myeuler[1] >> myeuler[2] >> mytrans[0] >> mytrans[1] >> mytrans[2];
3123  std::cout << " translation " << mytrans[0] << " " << mytrans[1] << " " << mytrans[2] << "\n"
3124  << " euler " << myeuler[0] << " " << myeuler[1] << " " << myeuler[2] << std::endl;
3125  }
3126  CLHEP::Hep3Vector translation( mytrans[0], mytrans[1], mytrans[2]);
3127  CLHEP::HepEulerAngles euler( myeuler[0], myeuler[1], myeuler[2]);
3128  AlignTransform transform( translation, euler, esdetId );
3129  my_align.push_back(transform);
3130  }
3131  Alignments a;
3132  a.m_align = my_align;
3133  std::auto_ptr<Alignments> ical = std::auto_ptr<Alignments>( new Alignments(a) );
3134  return ical;
3135 }
3136 
3137 std::auto_ptr<EcalSampleMask>
3139 {
3140  return std::auto_ptr<EcalSampleMask>( new EcalSampleMask(sampleMaskEB_, sampleMaskEE_) );
3141 }
3142 
3143 std::auto_ptr<EcalTimeBiasCorrections>
3145  std::auto_ptr<EcalTimeBiasCorrections> ipar = std::auto_ptr<EcalTimeBiasCorrections>( new EcalTimeBiasCorrections() );
3146  copy(EBtimeCorrAmplitudeBins_.begin(), EBtimeCorrAmplitudeBins_.end(),
3147  back_inserter(ipar->EBTimeCorrAmplitudeBins));
3148  copy(EBtimeCorrShiftBins_.begin(), EBtimeCorrShiftBins_.end(),
3149  back_inserter(ipar->EBTimeCorrShiftBins));
3150  copy(EEtimeCorrAmplitudeBins_.begin(), EEtimeCorrAmplitudeBins_.end(),
3151  back_inserter(ipar->EETimeCorrAmplitudeBins));
3152  copy(EEtimeCorrShiftBins_.begin(), EEtimeCorrShiftBins_.end(),
3153  back_inserter(ipar->EETimeCorrShiftBins));
3154  return ipar;
3155 }
float approxEta() const
Definition: EBDetId.h:106
EcalChi2WeightMatrix & getChi2WeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:31
type
Definition: HCALResponse.h:21
EcalDAQTowerStatusMap EcalDAQTowerStatus
virtual std::auto_ptr< EcalTimeCalibConstants > produceEcalTimeCalibConstants(const EcalTimeCalibConstantsRcd &)
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
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
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
static const int MIN_IPHI
Definition: EBDetId.h:142
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
static Timestamp endOfTime()
Definition: Timestamp.h:102
virtual std::auto_ptr< EcalClusterCrackCorrParameters > produceEcalClusterCrackCorrParameters(const EcalClusterCrackCorrParametersRcd &)
EcalFunParams EcalClusterCrackCorrParameters
virtual std::auto_ptr< EcalTPGCrystalStatus > produceEcalTrgChannelStatus(const EcalTPGCrystalStatusRcd &)
virtual std::auto_ptr< EcalIntercalibConstantsMC > getIntercalibConstantsMCFromConfiguration(const EcalIntercalibConstantsMCRcd &)
const self & getMap() const
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 &)
tuple batch
Use ROOT&#39;s batch mode, unless outputting to C macros, since there is a bug in pyROOT that fails to ex...
Definition: core.py:62
virtual std::auto_ptr< EcalTimeBiasCorrections > produceEcalTimeBiasCorrections(const EcalTimeBiasCorrectionsRcd &)
static const int XYMODE
Definition: EEDetId.h:339
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
EcalTimeCalibErrorMap EcalTimeCalibErrors
EcalCondObjectContainer< EcalXtalGroupId > EcalWeightXtalGroups
EcalLaserAPDPNRatiosRefMap EcalLaserAPDPNRatiosRef
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
void getWeightsFromConfiguration(const edm::ParameterSet &ps)
double calcresolutitonConstantTerm(double eta)
T eta() const
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:99
virtual std::auto_ptr< EcalPedestals > produceEcalPedestals(const EcalPedestalsRcd &)
virtual std::auto_ptr< EcalLaserAPDPNRatios > produceEcalLaserAPDPNRatios(const EcalLaserAPDPNRatiosRcd &)
int ii
Definition: cuy.py:588
EcalTimeDependentCorrections EcalLinearCorrections
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
static const int IX_MIN
Definition: EEDetId.h:294
float float float z
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
static const int IY_MIN
Definition: EEDetId.h:298
virtual std::auto_ptr< EcalLaserAlphas > produceEcalLaserAlphas(const EcalLaserAlphasRcd &)
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
static const int MIN_SM
Definition: EBDetId.h:152
void setGain12Over6(const float &g)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual std::auto_ptr< EcalTimeCalibConstants > getTimeCalibConstantsFromConfiguration(const EcalTimeCalibConstantsRcd &)
void setValue(const uint32_t id, const Item &item)
virtual std::auto_ptr< EcalDAQTowerStatus > produceEcalDAQTowerStatus(const EcalDAQTowerStatusRcd &)
virtual std::auto_ptr< Alignments > produceEcalAlignmentEE(const EEAlignmentRcd &)
EcalDQMChannelStatusMap EcalDQMChannelStatus
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
EcalMappingElectronicsMap EcalMappingElectronics
EcalChannelStatusMap EcalChannelStatus
EcalGainRatioMap EcalGainRatios
tuple path
else: Piece not in the list, fine.
virtual std::auto_ptr< EcalADCToGeVConstant > produceEcalADCToGeVConstant(const EcalADCToGeVConstantRcd &)
static const IOVSyncValue & beginOfTime()
virtual std::auto_ptr< EcalClusterLocalContCorrParameters > produceEcalClusterLocalContCorrParameters(const EcalClusterLocalContCorrParametersRcd &)
EcalLaserAlphaMap EcalLaserAlphas
double calcnoiseIncreaseADC(double eta)
T sqrt(T t)
Definition: SSEVec.h:48
EcalDCSTowerStatusMap EcalDCSTowerStatus
EcalDQMTowerStatusMap EcalDQMTowerStatus
virtual std::auto_ptr< EcalWeightXtalGroups > produceEcalWeightXtalGroups(const EcalWeightXtalGroupsRcd &)
virtual std::auto_ptr< EcalIntercalibErrors > getIntercalibErrorsFromConfiguration(const EcalIntercalibErrorsRcd &)
virtual std::auto_ptr< Alignments > produceEcalAlignmentEB(const EBAlignmentRcd &)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
EcalTPGCrystalStatusMap EcalTPGCrystalStatus
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
EcalChi2WeightMatrix & getChi2WeightsAfterGainSwitch()
Definition: EcalWeightSet.h:32
virtual std::auto_ptr< EcalDQMTowerStatus > produceEcalDQMTowerStatus(const EcalDQMTowerStatusRcd &)
EcalFunParams EcalClusterEnergyCorrectionObjectSpecificParameters
double f[11][100]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 std::auto_ptr< EcalSampleMask > produceEcalSampleMask(const EcalSampleMaskRcd &)
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:30
uint32_t rawId() const
EcalIntercalibErrorMap EcalIntercalibErrors
const int drop
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:23
static const int IX_MAX
Definition: EEDetId.h:302
EcalFunParams EcalClusterEnergyUncertaintyParameters
virtual std::auto_ptr< EcalDCSTowerStatus > produceEcalDCSTowerStatus(const EcalDCSTowerStatusRcd &)
static void check(Principal const &p, std::string const &id, edm::ModuleCallingContext const *mcc)
virtual std::auto_ptr< EcalIntercalibConstants > produceEcalIntercalibConstants(const EcalIntercalibConstantsRcd &)
virtual std::auto_ptr< EcalIntercalibConstantsMC > produceEcalIntercalibConstantsMC(const EcalIntercalibConstantsMCRcd &)
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:53
static const int MAX_IPHI
Definition: EBDetId.h:144
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:29
EcalTimeCalibConstantMap EcalTimeCalibConstants
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EcalTrivialConditionRetriever(const edm::ParameterSet &pset)
std::vector< Item >::const_iterator const_iterator
static const int MAX_IETA
Definition: EBDetId.h:143
virtual std::auto_ptr< EcalLaserAPDPNRatiosRef > produceEcalLaserAPDPNRatiosRef(const EcalLaserAPDPNRatiosRefRcd &)
EcalFunParams EcalClusterLocalContCorrParameters
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:114
EcalIntercalibConstantMap EcalIntercalibConstants
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
#define begin
Definition: vmac.h:30
double a
Definition: hdecay.h:121
EcalFunParams EcalClusterEnergyCorrectionParameters
Signal rand(Signal arg)
Definition: vlib.cc:442
const_iterator find(uint32_t rawId) const
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22
virtual std::auto_ptr< Alignments > produceEcalAlignmentES(const ESAlignmentRcd &)
virtual std::auto_ptr< EcalTimeCalibErrors > getTimeCalibErrorsFromConfiguration(const EcalTimeCalibErrorsRcd &)
const Timestamp & time() const
Definition: IOVSyncValue.h:44
virtual std::auto_ptr< EcalTimeOffsetConstant > produceEcalTimeOffsetConstant(const EcalTimeOffsetConstantRcd &)
virtual std::auto_ptr< EcalClusterEnergyCorrectionObjectSpecificParameters > produceEcalClusterEnergyCorrectionObjectSpecificParameters(const EcalClusterEnergyCorrectionObjectSpecificParametersRcd &)
virtual std::auto_ptr< EcalLinearCorrections > produceEcalLinearCorrections(const EcalLinearCorrectionsRcd &)
tuple cout
Definition: gather_cfg.py:121
static const int MAX_SM
Definition: EBDetId.h:153
static const int IY_MAX
Definition: EEDetId.h:306
const_iterator end() const
float EcalIntercalibConstantMC
std::string fullPath() const
Definition: FileInPath.cc:165
Definition: DDAxes.h:10
tuple status
Definition: ntuplemaker.py:245
virtual std::auto_ptr< EcalDQMChannelStatus > produceEcalDQMChannelStatus(const EcalDQMChannelStatusRcd &)
static const int SMCRYSTALMODE
Definition: EBDetId.h:167
double calcampDropTotal(double eta)
virtual std::auto_ptr< EcalGainRatios > produceEcalGainRatios(const EcalGainRatiosRcd &)
TimeValue_t value() const
Definition: Timestamp.h:56
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.
float EcalIntercalibConstant