7 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalPulseCovariancesHandler")) {
9 std::cout <<
"EcalPulseCovariance Source handler constructor\n" << std::endl;
27 if(fabs(item->
covval[i][j]) > 1) result=
false;
36 item->
covval[
i][
j] = isbarrel ? m_EBPulseShapeCovariance[
k] : m_EEPulseShapeCovariance[
k];
43 std::cout <<
"------- Ecal - > getNewObjects\n";
49 std::ifstream inputfile;
50 inputfile.open(m_filename.c_str());
57 int nEBbad(0), nEEbad(0);
58 int nEBgood(0), nEEgood(0);
59 std::vector<EBDetId> ebgood;
60 std::vector<EEDetId> eegood;
64 while (std::getline(inputfile, line)) {
65 std::istringstream linereader(line);
66 linereader >> isbarrel >> rawId;
71 linereader >> covvals[
i][
j];
75 std::cout <<
"Wrong format of the text file. Exit." << std::endl;
83 if(!checkPulseCovariance(&item) ) nEBbad++;
86 ebgood.push_back(ebdetid);
87 pulsecovs->
insert(std::make_pair(ebdetid.
rawId(),item));
91 if(!checkPulseCovariance(&item) ) nEEbad++;
94 eegood.push_back(eedetid);
95 pulsecovs->
insert(std::make_pair(eedetid.
rawId(),item));
102 std::cout <<
"Filled the DB with the good measured ECAL templates. Now filling the others with the TB values" << std::endl;
104 if(iEta==0)
continue;
109 std::vector<EBDetId>::iterator it =
find(ebgood.begin(),ebgood.end(),ebdetid);
110 if(it == ebgood.end()) {
112 fillSimPulseCovariance(&item,
true);
113 pulsecovs->
insert(std::make_pair(ebdetid.
rawId(),item));
119 for(
int iZ=-1; iZ<2; iZ+=2) {
125 std::vector<EEDetId>::iterator it =
find(eegood.begin(),eegood.end(),eedetid);
126 if(it == eegood.end()) {
128 fillSimPulseCovariance(&item,
false);
129 pulsecovs->
insert(std::make_pair(eedetid.
rawId(),item));
136 std::cout <<
"Inserted the pulse covariances into the new item object" << std::endl;
138 unsigned int irun=m_firstRun;
143 std::cout <<
"Ecal - > end of getNewObjects -----------" << std::endl;
144 std::cout <<
"N. bad shapes for EB = " << nEBbad << std::endl;
145 std::cout <<
"N. bad shapes for EE = " << nEEbad << std::endl;
146 std::cout <<
"Written the object" << std::endl;
T getParameter(std::string const &) const
static const int MIN_IPHI
void fillSimPulseCovariance(EcalPulseCovariances::Item *item, bool isbarrel)
static const int TEMPLATESAMPLES
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< double > m_EBPulseShapeCovariance
static bool validDetId(int i, int j)
check if a valid index combination
uint32_t rawId() const
get the raw id
EcalPulseCovariancesMap EcalPulseCovariances
static const int ETAPHIMODE
float covval[EcalPulseShape::TEMPLATESAMPLES][EcalPulseShape::TEMPLATESAMPLES]
~EcalPulseCovariancesHandler()
void insert(std::pair< uint32_t, Item > const &a)
static const int MAX_IPHI
std::vector< double > m_EEPulseShapeCovariance
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
Power< A, B >::type pow(const A &a, const B &b)
EcalPulseCovariancesHandler(edm::ParameterSet const &)
bool checkPulseCovariance(EcalPulseCovariances::Item *item)