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 std::vector<EBDetId> ebgood;
51 std::vector<EEDetId> eegood;
55 while (std::getline(inputfile,
line)) {
56 std::istringstream linereader(
line);
57 linereader >> isbarrel >>
rawId;
60 linereader >> templatevals[
s];
66 std::cout <<
"Wrong format of the text file. Exit." << std::endl;
71 item.pdfval[
s] = templatevals[
s];
75 if (!checkPulseShape(&
item))
78 ebgood.push_back(ebdetid);
83 if (!checkPulseShape(&
item))
86 eegood.push_back(eedetid);
94 std::cout <<
"Filled the DB with the good measured ECAL templates. Now filling the others with the TB values" 103 std::vector<EBDetId>::iterator
it =
find(ebgood.begin(), ebgood.end(), ebdetid);
104 if (
it == ebgood.end()) {
106 fillSimPulseShape(&
item,
true);
113 for (
int iZ = -1; iZ < 2; iZ += 2) {
119 std::vector<EEDetId>::iterator
it =
find(eegood.begin(), eegood.end(), eedetid);
120 if (
it == eegood.end()) {
122 fillSimPulseShape(&
item,
false);
130 std::cout <<
"Inserted the pulse shapes into the new item object" << std::endl;
132 unsigned int irun = m_firstRun;
135 m_to_transfer.push_back(std::make_pair((
EcalPulseShapes*)pulseshapes, snc));
137 std::cout <<
"Ecal - > end of getNewObjects -----------" << std::endl;
138 std::cout <<
"N. bad shapes for EB = " << nEBbad << std::endl;
139 std::cout <<
"N. bad shapes for EE = " << nEEbad << std::endl;
140 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
if(threadIdxLocalY==0 &&threadIdxLocalX==0)