17 const int ievt = evt.
id().
event();
18 if(formula_.get()!=0){
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);
28 if(verbose_)
cout <<
"(" << iEta0 <<
"," << iPhi0 <<
"): ";
29 digis->push_back(
EBDetId(iEta1,iPhi));
32 for(
int t = 0;
t < nSamples; ++
t){
33 uint16_t encodedAdc = (uint16_t)formula_->Eval(iEta0, iPhi0, ievt-1,
t);
34 if(verbose_)
cout << encodedAdc << ((
t<(nSamples-1))?
"\t":
"\n");
43 if(tpFormula_.get()!=0){
44 auto_ptr<EcalTrigPrimDigiCollection> tps
47 const int nSamples = 5;
48 for(
int iTtEta0=0; iTtEta0<56; ++iTtEta0){
49 for(
int iTtPhi0=0; iTtPhi0<72; ++iTtPhi0){
50 int iTtEta1 = cIndex2iTtEta(iTtEta0);
51 int iTtPhi = cIndex2iTtPhi(iTtPhi0);
53 if(verbose_)
cout <<
"(" << iTtEta0 <<
"," << iTtPhi0 <<
"): ";
54 int zside = iTtEta1<0?-1:1;
57 abs(iTtEta1), iTtPhi));
61 if(verbose_)
cout <<
"TP: ";
62 for(
int t = 0;
t < nSamples; ++
t){
63 uint16_t encodedTp = (uint16_t)tpFormula_->Eval(iTtEta0, iTtPhi0, ievt-1,
t);
65 if(verbose_)
cout <<
"TP(" << iTtEta0 <<
"," << iTtPhi0 <<
") = "
66 << encodedTp << ((
t<(nSamples-1))?
"\t":
"\n");
69 tps->push_back(tpframe);
74 if(simHitFormula_.get()!=0){
75 auto_ptr<PCaloHitContainer> hits
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);
81 if(verbose_)
cout <<
"(" << iEta0 <<
"," << iPhi0 <<
"): ";
83 double em = simHitFormula_->Eval(iEta0, iPhi0, ievt-1);
90 evt.
put(hits,
"EcalHitsEB");
113 replaceAll(tpFormula,
"itt0",
"((ieta0<28)*(27-ieta0)+(ieta0>=28)*(ieta0-28))*4+(iphi0+2)%4");
114 replaceAll(tpFormula,
"eb",
"(ieta0>10 && ieta0<45)");
115 replaceAll(tpFormula,
"ebm",
"(ieta0>10 && ieta0<28)");
116 replaceAll(tpFormula,
"ebp",
"(ieta0>27 && ieta0<45)");
117 replaceAll(tpFormula,
"ee",
"(ieta0<11 || ieta0>44)");
128 replaceAll(simHitFormula,
"ebm",
"(ieta0<85)");
129 replaceAll(simHitFormula,
"ebp",
"(ieta0>84)");
134 if(formula.size()!=0){
135 formula_ = auto_ptr<TFormula>(
new TFormula(
"f", formula.c_str()));
138 throw cms::Exception(
"Error in EcalSimpleProducer 'formula' config.");
140 produces<EBDigiCollection>();
141 produces<EEDigiCollection>();
143 if(tpFormula.size()!=0){
144 tpFormula_ = auto_ptr<TFormula>(
new TFormula(
"f", tpFormula.c_str()));
147 throw cms::Exception(
"Error in EcalSimpleProducer 'tpFormula' config.");
149 produces<EcalTrigPrimDigiCollection>();
151 if(simHitFormula.size()!=0){
153 = auto_ptr<TFormula>(
new TFormula(
"f", simHitFormula.c_str()));
157 "'simHitFormula' config.");
159 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
160 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
168 while((pos=s.find(from, pos))!=string::npos){
170 s.replace(pos, from.size(), to);
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< PCaloHit > PCaloHitContainer
std::auto_ptr< TFormula > simHitFormula_
virtual void produce(edm::Event &evt, const edm::EventSetup &)
EcalSimpleProducer(const edm::ParameterSet &pset)
std::auto_ptr< TFormula > formula_
std::auto_ptr< TFormula > tpFormula_
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::SortedCollection< EcalTriggerPrimitiveDigi > EcalTrigPrimDigiCollection
void replaceAll(std::string &s, const std::string &from, const std::string &to) const