8 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalPulseShapesHandler")) {
10 std::cout <<
"EcalPulseShape Source handler constructor\n" << std::endl;
34 item->
pdfval[
s] = isbarrel ? m_EBPulseShapeTemplate[
s] : m_EEPulseShapeTemplate[
s];
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;
67 linereader >> templatevals[
s];
73 std::cout <<
"Wrong format of the text file. Exit." << std::endl;
81 if(!checkPulseShape(&item) ) nEBbad++;
84 ebgood.push_back(ebdetid);
85 pulseshapes->
insert(std::make_pair(ebdetid.
rawId(),item));
89 if(!checkPulseShape(&item) ) nEEbad++;
92 eegood.push_back(eedetid);
93 pulseshapes->
insert(std::make_pair(eedetid.
rawId(),item));
100 std::cout <<
"Filled the DB with the good measured ECAL templates. Now filling the others with the TB values" << std::endl;
102 if(iEta==0)
continue;
107 std::vector<EBDetId>::iterator it =
find(ebgood.begin(),ebgood.end(),ebdetid);
108 if(it == ebgood.end()) {
110 fillSimPulseShape(&item,
true);
111 pulseshapes->
insert(std::make_pair(ebdetid.
rawId(),item));
117 for(
int iZ=-1; iZ<2; iZ+=2) {
123 std::vector<EEDetId>::iterator it =
find(eegood.begin(),eegood.end(),eedetid);
124 if(it == eegood.end()) {
126 fillSimPulseShape(&item,
false);
127 pulseshapes->
insert(std::make_pair(eedetid.
rawId(),item));
134 std::cout <<
"Inserted the pulse shapes into the new item object" << std::endl;
136 unsigned int irun=m_firstRun;
139 m_to_transfer.push_back(std::make_pair((
EcalPulseShapes*)pulseshapes,snc));
141 std::cout <<
"Ecal - > end of getNewObjects -----------" << std::endl;
142 std::cout <<
"N. bad shapes for EB = " << nEBbad << std::endl;
143 std::cout <<
"N. bad shapes for EE = " << nEEbad << std::endl;
144 std::cout <<
"Written the object" << std::endl;
T getParameter(std::string const &) const
EcalPulseShapesMap EcalPulseShapes
std::vector< double > m_EBPulseShapeTemplate
static const int MIN_IPHI
EcalPulseShapesHandler(edm::ParameterSet const &)
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
bool checkPulseShape(EcalPulseShapes::Item *item)
uint32_t rawId() const
get the raw id
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
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
float pdfval[TEMPLATESAMPLES]
~EcalPulseShapesHandler()