75 using namespace TMath;
84 iEvent.
getByLabel(
"genParticles", genParticles);
90 double castorplus[4][16];
91 double castormin[4][16];
93 for (
int j = 0;
j < 16;
j++) {
94 castorplus[3][
j] = -2.94524 +
j * 0.3927;
95 castormin[3][
j] = -2.94524 +
j * 0.3927;
96 castorplus[0][
j] = 0.;
98 castorplus[1][
j] = 0.;
100 castorplus[2][
j] = 0.;
101 castormin[2][
j] = 0.;
107 vector<double> depthplus[16];
108 vector<double> depthmin[16];
109 vector<double> fhotplus[16];
110 vector<double> fhotmin[16];
111 vector<double> energyplus[16];
112 vector<double> energymin[16];
116 for (
int i = 0;
i < 16;
i++) {
117 depthplus[
i].clear();
121 energyplus[
i].clear();
122 energymin[
i].clear();
130 for (
size_t i = 0;
i < genParticles->size(); ++
i) {
134 if (fabs(p.
eta()) > 5.2 && fabs(p.
eta()) < 6.6) {
140 double emEnergy = 0.;
141 double hadEnergy = 0.;
149 while (energy < 0.) {
154 double sigma = 0.0228 * p.
energy() + 2.1061;
155 energy =
r.Gaus(mean, sigma);
162 if (p.
pdgId() == 11) {
167 tmax = 1.0 * (
log(energy / 0.0015) + cte);
170 double x = 0.5 * 19.38;
171 leakage = energy - energy * Gamma(a, x);
174 emEnergy = energy - leakage;
180 double d1 = 5.4336 *
pow(p.
energy(), 0.2410) + 14408.1025;
181 double d2 = 1.4692 *
pow(p.
energy(), 0.1307) - 0.5216;
186 new TF1(
"fdepth",
"[0] * TMath::Exp(-0.5*( (x-[1])/[2] + TMath::Exp(-(x-[1])/[2])))", 14400., 14460.);
187 fdepth->SetParameters(d0, d1, d2);
188 depth = fdepth->GetRandom();
195 while (energy < 0.) {
199 double mean = 0.8340 * p.
energy() - 8.5054;
200 double sigma = 0.1595 * p.
energy() + 3.1183;
201 energy =
r.Gaus(mean, sigma);
210 double d0 = -0.000012 * p.
energy() + 0.0661;
211 double d1 = 785.7524 *
pow(p.
energy(), 0.0262) + 13663.4262;
212 double d2 = 9.8748 *
pow(p.
energy(), 0.1720) + 37.0187;
217 new TF1(
"fdepth",
"[0] * TMath::Exp(-0.5*( (x-[1])/[2] + TMath::Exp(-(x-[1])/[2]) ))", 14400., 15500.);
218 fdepth->SetParameters(d0, d1, d2);
219 depth = fdepth->GetRandom();
229 for (
int j = 0;
j < 16;
j++) {
230 double a = -
M_PI +
j * 0.3927;
231 double b = -
M_PI + (
j + 1) * 0.3927;
232 if ((p.
phi() >
a) && (p.
phi() <
b)) {
239 castorplus[0][sector] = castorplus[0][sector] +
energy;
240 castorplus[1][sector] = castorplus[1][sector] + emEnergy;
241 castorplus[2][sector] = castorplus[2][sector] + hadEnergy;
243 depthplus[sector].push_back(depth);
244 fhotplus[sector].push_back(fhot);
245 energyplus[sector].push_back(energy);
252 castormin[0][sector] = castormin[0][sector] +
energy;
253 castormin[1][sector] = castormin[1][sector] + emEnergy;
254 castormin[2][sector] = castormin[2][sector] + hadEnergy;
256 depthmin[sector].push_back(depth);
257 fhotmin[sector].push_back(fhot);
258 energymin[sector].push_back(energy);
265 for (
int j = 0;
j < 16;
j++) {
266 double hadnoise = 0.;
268 for (
int i = 0;
i < 12;
i++) {
274 hadnoise = hadnoise - 12 * 0.053;
275 emnoise = emnoise - 2 * 0.053;
280 double totnoise = hadnoise + emnoise;
283 castorplus[0][
j] = castorplus[0][
j] + totnoise;
284 castormin[0][
j] = castormin[0][
j] + totnoise;
285 castorplus[1][
j] = castorplus[1][
j] + emnoise;
286 castormin[1][
j] = castormin[1][
j] + emnoise;
287 castorplus[2][
j] = castorplus[2][
j] + hadnoise;
288 castormin[2][
j] = castormin[2][
j] + hadnoise;
297 for (
int j = 0;
j < 16;
j++) {
298 if (castorplus[0][
j] != 0.) {
300 fem = castorplus[1][
j] / castorplus[0][
j];
306 double depth_mean = 0.;
307 double fhot_mean = 0.;
308 double sum_energy = 0.;
311 for (
size_t p = 0; p < energyplus[
j].
size(); p++) {
312 depth_mean = depth_mean + depthplus[
j][
p] * energyplus[
j][
p];
313 fhot_mean = fhot_mean + fhotplus[
j][
p] * energyplus[
j][
p];
314 sum_energy = sum_energy + energyplus[
j][
p];
316 depth_mean = depth_mean / sum_energy;
317 fhot_mean = fhot_mean / sum_energy;
323 castorplus[0][
j],
pt2, castorplus[1][j], castorplus[2][j], fem, depth_mean, fhot_mean, refvector));
327 for (
int j = 0;
j < 16;
j++) {
328 if (castormin[0][
j] != 0.) {
330 fem = castormin[1][
j] / castormin[0][
j];
334 double depth_mean = 0.;
335 double fhot_mean = 0.;
336 double sum_energy = 0.;
338 for (
size_t p = 0; p < energymin[
j].
size(); p++) {
339 depth_mean = depth_mean + depthmin[
j][
p] * energymin[
j][
p];
340 fhot_mean = fhot_mean + fhotmin[
j][
p] * energymin[
j][
p];
341 sum_energy = sum_energy + energymin[
j][
p];
343 depth_mean = depth_mean / sum_energy;
344 fhot_mean = fhot_mean / sum_energy;
349 castormin[0][
j],
pt2, castormin[1][j], castormin[2][j], fem, depth_mean, fhot_mean, refvector));
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ROOT::Math::RhoEtaPhiPoint TowerPoint
virtual double energy() const =0
energy
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
static const double tmax[3]
virtual double eta() const =0
momentum pseudorapidity
Structure Point Contains parameters of Gaussian fits to DMRs.
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
std::vector< CastorTower > CastorTowerCollection
collection of CastorTower objects
virtual double phi() const =0
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)