7 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalPulseSymmCovariancesHandler")) {
9 std::cout <<
"EcalPulseSymmCovariance Source handler constructor\n" << std::endl;
25 for(
int k=0;
k<
N; ++
k) {
26 if(fabs(item->
covval[
k]) > 1) result=
false;
37 item->
covval[linK] = isbarrel ? m_EBPulseShapeCovariance[
k] : m_EEPulseShapeCovariance[
k];
45 std::cout <<
"------- Ecal - > getNewObjects\n";
51 std::ifstream inputfile;
52 inputfile.open(m_filename.c_str());
59 int nEBbad(0), nEEbad(0);
60 int nEBgood(0), nEEgood(0);
61 std::vector<EBDetId> ebgood;
62 std::vector<EEDetId> eegood;
66 while (std::getline(inputfile, line)) {
67 std::istringstream linereader(line);
68 linereader >> isbarrel >> rawId;
73 linereader >> covvals[
i][
j];
77 std::cout <<
"Wrong format of the text file. Exit." << std::endl;
83 if(
j >=
i) k =
j + (EcalPulseShape::TEMPLATESAMPLES-1)*
i;
84 else k =
i + (EcalPulseShape::TEMPLATESAMPLES-1)*
j;
90 if(!checkPulseSymmCovariance(&item) ) nEBbad++;
93 ebgood.push_back(ebdetid);
94 pulsecovs->
insert(std::make_pair(ebdetid.
rawId(),item));
98 if(!checkPulseSymmCovariance(&item) ) nEEbad++;
101 eegood.push_back(eedetid);
102 pulsecovs->
insert(std::make_pair(eedetid.
rawId(),item));
109 std::cout <<
"Filled the DB with the good measured ECAL templates. Now filling the others with the TB values" << std::endl;
111 if(iEta==0)
continue;
116 std::vector<EBDetId>::iterator it =
find(ebgood.begin(),ebgood.end(),ebdetid);
117 if(it == ebgood.end()) {
119 fillSimPulseSymmCovariance(&item,
true);
120 pulsecovs->
insert(std::make_pair(ebdetid.
rawId(),item));
126 for(
int iZ=-1; iZ<2; iZ+=2) {
132 std::vector<EEDetId>::iterator it =
find(eegood.begin(),eegood.end(),eedetid);
133 if(it == eegood.end()) {
135 fillSimPulseSymmCovariance(&item,
false);
136 pulsecovs->
insert(std::make_pair(eedetid.
rawId(),item));
143 std::cout <<
"Inserted the pulse covariances into the new item object" << std::endl;
145 unsigned int irun=m_firstRun;
150 std::cout <<
"Ecal - > end of getNewObjects -----------" << std::endl;
151 std::cout <<
"N. bad shapes for EB = " << nEBbad << std::endl;
152 std::cout <<
"N. bad shapes for EE = " << nEEbad << std::endl;
153 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
uint32_t rawId() const
get the raw id
EcalPulseSymmCovariancesMap EcalPulseSymmCovariances
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)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
std::vector< double > m_EEPulseShapeCovariance
float covval[EcalPulseShape::TEMPLATESAMPLES *(EcalPulseShape::TEMPLATESAMPLES+1)/2]
bool checkPulseSymmCovariance(EcalPulseSymmCovariances::Item *item)
Power< A, B >::type pow(const A &a, const B &b)
~EcalPulseSymmCovariancesHandler()