8 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalPulseShapesHandler")) {
9 std::cout <<
"EcalPulseShape Source handler constructor\n" << std::endl;
22 if (
item->pdfval[
s] > 1 ||
item->pdfval[
s] < 0)
30 item->pdfval[
s] = isbarrel ? m_EBPulseShapeTemplate[
s] : m_EEPulseShapeTemplate[
s];
35 std::cout <<
"------- Ecal - > getNewObjects\n";
41 std::ifstream inputfile;
42 inputfile.open(m_filename.c_str());
49 int nEBbad(0), nEEbad(0);
50 int nEBgood(0), nEEgood(0);
51 std::vector<EBDetId> ebgood;
52 std::vector<EEDetId> eegood;
56 while (std::getline(inputfile,
line)) {
57 std::istringstream linereader(
line);
58 linereader >> isbarrel >> rawId;
61 linereader >> templatevals[
s];
67 std::cout <<
"Wrong format of the text file. Exit." << std::endl;
72 item.pdfval[
s] = templatevals[
s];
76 if (!checkPulseShape(&
item))
80 ebgood.push_back(ebdetid);
85 if (!checkPulseShape(&
item))
89 eegood.push_back(eedetid);
97 std::cout <<
"Filled the DB with the good measured ECAL templates. Now filling the others with the TB values" 106 std::vector<EBDetId>::iterator it =
find(ebgood.begin(), ebgood.end(), ebdetid);
107 if (it == ebgood.end()) {
109 fillSimPulseShape(&
item,
true);
116 for (
int iZ = -1; iZ < 2; iZ += 2) {
122 std::vector<EEDetId>::iterator it =
find(eegood.begin(), eegood.end(), eedetid);
123 if (it == eegood.end()) {
125 fillSimPulseShape(&
item,
false);
133 std::cout <<
"Inserted the pulse shapes into the new item object" << std::endl;
135 unsigned int irun = m_firstRun;
138 m_to_transfer.push_back(std::make_pair((
EcalPulseShapes*)pulseshapes, snc));
140 std::cout <<
"Ecal - > end of getNewObjects -----------" << std::endl;
141 std::cout <<
"N. bad shapes for EB = " << nEBbad << std::endl;
142 std::cout <<
"N. bad shapes for EE = " << nEEbad << std::endl;
143 std::cout <<
"Written the object" << std::endl;
EcalPulseShapesMap EcalPulseShapes
std::vector< double > m_EBPulseShapeTemplate
T getParameter(std::string const &) const
static const int MIN_IPHI
EcalPulseShapesHandler(edm::ParameterSet const &)
static const int TEMPLATESAMPLES
void getNewObjects() override
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
bool checkPulseShape(EcalPulseShapes::Item *item)
std::vector< double > m_EEPulseShapeTemplate
void fillSimPulseShape(EcalPulseShapes::Item *item, bool isbarrel)
static const int ETAPHIMODE
void insert(std::pair< uint32_t, Item > const &a)
static const int MAX_IPHI
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
~EcalPulseShapesHandler() override