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