17 const int ievt = evt.
id().
event();
18 if (formula_.get() !=
nullptr) {
21 digis->reserve(170 * 360);
23 const int nSamples = digis->stride();
24 for (
int iEta0 = 0; iEta0 < 170; ++iEta0) {
25 for (
int iPhi0 = 0; iPhi0 < 360; ++iPhi0) {
26 int iEta1 = cIndex2iEta(iEta0);
27 int iPhi = cIndex2iPhi(iPhi0);
29 cout <<
"(" << iEta0 <<
"," << iPhi0 <<
"): ";
30 digis->push_back(
EBDetId(iEta1, iPhi));
34 uint16_t encodedAdc = (uint16_t)formula_->Eval(iEta0, iPhi0, ievt - 1,
t);
37 dframe[
t] = encodedAdc;
45 if (tpFormula_.get() !=
nullptr) {
47 tps->reserve(56 * 72);
49 for (
int iTtEta0 = 0; iTtEta0 < 56; ++iTtEta0) {
50 for (
int iTtPhi0 = 0; iTtPhi0 < 72; ++iTtPhi0) {
51 int iTtEta1 = cIndex2iTtEta(iTtEta0);
52 int iTtPhi = cIndex2iTtPhi(iTtPhi0);
55 cout <<
"(" << iTtEta0 <<
"," << iTtPhi0 <<
"): ";
56 int zside = iTtEta1 < 0 ? -1 : 1;
64 uint16_t encodedTp = (uint16_t)tpFormula_->Eval(iTtEta0, iTtPhi0, ievt - 1,
t);
67 cout <<
"TP(" << iTtEta0 <<
"," << iTtPhi0 <<
") = " << encodedTp << ((
t < (
nSamples - 1)) ?
"\t" :
"\n");
70 tps->push_back(tpframe);
75 if (simHitFormula_.get() !=
nullptr) {
77 for (
int iEta0 = 0; iEta0 < 170; ++iEta0) {
78 for (
int iPhi0 = 0; iPhi0 < 360; ++iPhi0) {
79 int iEta1 = cIndex2iEta(iEta0);
80 int iPhi = cIndex2iPhi(iPhi0);
82 cout <<
"(" << iEta0 <<
"," << iPhi0 <<
"): ";
84 double em = simHitFormula_->Eval(iEta0, iPhi0, ievt - 1);
98 string formula =
pset.getParameter<
string>(
"formula");
100 string simHitFormula =
pset.getParameter<
string>(
"simHitFormula");
102 verbose_ =
pset.getUntrackedParameter<
bool>(
"verbose",
false);
113 replaceAll(
tpFormula,
"itt0",
"((ieta0<28)*(27-ieta0)+(ieta0>=28)*(ieta0-28))*4+(iphi0+2)%4");
128 replaceAll(simHitFormula,
"ebm",
"(ieta0<85)");
129 replaceAll(simHitFormula,
"ebp",
"(ieta0>84)");
138 throw cms::Exception(
"Error in EcalSimpleProducer 'formula' config.");
140 produces<EBDigiCollection>();
141 produces<EEDigiCollection>();
147 throw cms::Exception(
"Error in EcalSimpleProducer 'tpFormula' config.");
149 produces<EcalTrigPrimDigiCollection>();
151 if (!simHitFormula.empty()) {
152 simHitFormula_ = unique_ptr<TFormula>(
new TFormula(
"f", simHitFormula.c_str()));
156 "Error in EcalSimpleProducer "
157 "'simHitFormula' config.");
159 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
160 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
167 while ((
pos =
s.find(from,
pos)) != string::npos) {
169 s.replace(
pos, from.size(),
to);