Go to the documentation of this file.00001 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00002
00003
00004 #include "FastSimulation/CalorimeterProperties/interface/HCALProperties.h"
00005 #include <cmath>
00006 #include <iostream>
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008
00009
00010 HCALProperties::HCALProperties(const edm::ParameterSet& fastDet) : CalorimeterProperties()
00011 {
00012
00013 edm::ParameterSet fastDetHCAL= fastDet.getParameter<edm::ParameterSet>("HadronicCalorimeterProperties");
00014 hOPi = fastDetHCAL.getParameter<double>("HCAL_PiOverE");
00015 spotFrac= fastDetHCAL.getParameter<double>("HCAL_Sampling");
00016 HCALAeff_= fastDetHCAL.getParameter<double>("HCALAeff");
00017 HCALZeff_= fastDetHCAL.getParameter<double>("HCALZeff");
00018 HCALrho_= fastDetHCAL.getParameter<double>("HCALrho");
00019 HCALradiationLengthIncm_= fastDetHCAL.getParameter< double>("HCALradiationLengthIncm");
00020 HCALradLenIngcm2_= fastDetHCAL.getParameter<double>("HCALradLenIngcm2");
00021 HCALmoliereRadius_= fastDetHCAL.getParameter<double>("HCALmoliereRadius");
00022 HCALcriticalEnergy_= fastDetHCAL.getParameter<double>("HCALcriticalEnergy");
00023 HCALinteractionLength_= fastDetHCAL.getParameter<double>("HCALinteractionLength");
00024 etatow_=fastDetHCAL.getParameter<std::vector<double>>("HCALetatow");
00025 hcalDepthLam_=fastDetHCAL.getParameter<std::vector<double>>("HCALDepthLam");
00026
00027
00028 if (etatow_.size() != 42) std::cout << " HCALProperties::eta2ieta - WARNING: here we expect 42 entries instead of " << etatow_.size() << "; is the change intentional?" << std::endl;
00029
00030 if (hcalDepthLam_.size() != etatow_.size()-1) std::cout << " HCALProperties::eta2ieta - WARNING: the sizes of HCALetatow and HCALDepthLam should differ by 1 unit! HCALDepthLam has size " << hcalDepthLam_.size()<< " and HCALetatow has size " << etatow_.size() << std::endl;
00031
00032
00033 }
00034
00035 double HCALProperties::getHcalDepth(double eta) const{
00036
00037 int ieta = eta2ieta(eta);
00038
00039
00040
00041
00042
00043
00044 return hcalDepthLam_[ieta];
00045
00046 }
00047
00048
00049
00050 int HCALProperties::eta2ieta(double eta) const {
00051
00052 int size = etatow_.size();
00053
00054 double x = fabs(eta);
00055 int curr = size / 2;
00056 int step = size / 4;
00057 int iter;
00058 int prevdir = 0;
00059 int actudir = 0;
00060
00061 for (iter = 0; iter < size ; iter++) {
00062
00063 if( curr >= size || curr < 1 )
00064 std::cout << " HCALProperties::eta2ieta - wrong current index = "
00065 << curr << " !!!" << std::endl;
00066
00067 if ((x <= etatow_[curr]) && (x > etatow_[curr-1])) break;
00068 prevdir = actudir;
00069 if(x > etatow_[curr]) {actudir = 1;}
00070 else {actudir = -1;}
00071 if(prevdir * actudir < 0) { if(step > 1) step /= 2;}
00072 curr += actudir * step;
00073 if(curr > size) curr = size;
00074 else { if(curr < 1) {curr = 1;}}
00075
00076
00077
00078
00079
00080
00081
00082 }
00083
00084
00085
00086
00087
00088
00089
00090 return curr-1;
00091 }