7 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalPulseSymmCovariancesHandler")) {
8 std::cout <<
"EcalPulseSymmCovariance Source handler constructor\n" << std::endl;
21 for (
int k = 0;
k <
N; ++
k) {
22 if (fabs(
item->covval[
k]) > 1)
35 item->covval[linK] = isbarrel ? m_EBPulseShapeCovariance[
k] : m_EEPulseShapeCovariance[
k];
41 std::cout <<
"------- Ecal - > getNewObjects\n";
47 std::ifstream inputfile;
48 inputfile.open(m_filename.c_str());
55 int nEBbad(0), nEEbad(0);
56 int nEBgood(0), nEEgood(0);
57 std::vector<EBDetId> ebgood;
58 std::vector<EEDetId> eegood;
62 while (std::getline(inputfile,
line)) {
63 std::istringstream linereader(
line);
64 linereader >> isbarrel >> rawId;
69 linereader >> covvals[
i][
j];
73 std::cout <<
"Wrong format of the text file. Exit." << std::endl;
84 if (!checkPulseSymmCovariance(&
item))
88 ebgood.push_back(ebdetid);
93 if (!checkPulseSymmCovariance(&
item))
97 eegood.push_back(eedetid);
105 std::cout <<
"Filled the DB with the good measured ECAL templates. Now filling the others with the TB values" 114 std::vector<EBDetId>::iterator it =
find(ebgood.begin(), ebgood.end(), ebdetid);
115 if (it == ebgood.end()) {
117 fillSimPulseSymmCovariance(&
item,
true);
124 for (
int iZ = -1; iZ < 2; iZ += 2) {
130 std::vector<EEDetId>::iterator it =
find(eegood.begin(), eegood.end(), eedetid);
131 if (it == eegood.end()) {
133 fillSimPulseSymmCovariance(&
item,
false);
141 std::cout <<
"Inserted the pulse covariances into the new item object" << std::endl;
143 unsigned int irun = m_firstRun;
148 std::cout <<
"Ecal - > end of getNewObjects -----------" << std::endl;
149 std::cout <<
"N. bad shapes for EB = " << nEBbad << std::endl;
150 std::cout <<
"N. bad shapes for EE = " << nEEbad << std::endl;
151 std::cout <<
"Written the object" << std::endl;
T getParameter(std::string const &) const
static const int MIN_IPHI
std::vector< double > m_EBPulseShapeCovariance
static const int TEMPLATESAMPLES
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static bool validDetId(int i, int j)
check if a valid index combination
EcalPulseSymmCovariancesMap EcalPulseSymmCovariances
void getNewObjects() override
EcalPulseSymmCovariancesHandler(edm::ParameterSet const &)
static const int ETAPHIMODE
void insert(std::pair< uint32_t, Item > const &a)
static const int MAX_IPHI
void fillSimPulseSymmCovariance(EcalPulseSymmCovariances::Item *item, bool isbarrel)
constexpr uint32_t rawId() const
get the raw id
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
std::vector< double > m_EEPulseShapeCovariance
bool checkPulseSymmCovariance(EcalPulseSymmCovariances::Item *item)
~EcalPulseSymmCovariancesHandler() override
Power< A, B >::type pow(const A &a, const B &b)