59 produces<CastorTowerCollection>();
86 using namespace TMath;
101 double castorplus [4][16];
102 double castormin [4][16];
104 for (
int j = 0;
j < 16;
j++) {
105 castorplus[3][
j] = -2.94524 +
j*0.3927;
106 castormin[3][
j] = -2.94524 +
j*0.3927;
107 castorplus[0][
j] = 0.;
108 castormin[0][
j] = 0.;
109 castorplus[1][
j] = 0.;
110 castormin[1][
j] = 0.;
111 castorplus[2][
j] = 0.;
112 castormin[2][
j] = 0.;
118 vector<double> depthplus[16];
119 vector<double> depthmin[16];
120 vector<double> fhotplus [16];
121 vector<double> fhotmin [16];
122 vector<double> energyplus [16];
123 vector<double> energymin [16];
127 for (
int i=0;
i<16;
i++) {
128 depthplus[
i].clear();
132 energyplus[
i].clear();
133 energymin[
i].clear();
145 if ( fabs(p.
eta()) > 5.2 && fabs(p.
eta()) < 6.6) {
152 double emEnergy = 0.;
153 double hadEnergy = 0.;
162 while ( energy < 0.) {
167 double sigma = 0.0228*p.
energy() + 2.1061;
168 energy = r.Gaus(mean,sigma);
175 if ( p.
pdgId() == 11) { cte = -0.5; }
else { cte = 0.5; }
176 tmax = 1.0*(
log(energy/0.0015)+cte);
179 double x = 0.5*19.38;
180 leakage = energy - energy*
Gamma(a,x);
183 emEnergy = energy - leakage;
188 double d0 = 0.2338 *
pow(p.
energy(),-0.1634);
189 double d1 = 5.4336 *
pow(p.
energy(),0.2410) + 14408.1025;
190 double d2 = 1.4692 *
pow(p.
energy(),0.1307) - 0.5216;
191 if (d0 < 0.) d0 =
abs(d0);
193 TF1 *
fdepth =
new TF1(
"fdepth",
"[0] * TMath::Exp(-0.5*( (x-[1])/[2] + TMath::Exp(-(x-[1])/[2])))",14400.,14460.);
194 fdepth->SetParameters(d0,d1,d2);
195 depth = fdepth->GetRandom();
202 while (energy < 0.) {
207 double sigma = 0.1595*p.
energy() + 3.1183;
208 energy = r.Gaus(mean,sigma);
217 double d0 = -0.000012 * p.
energy() + 0.0661;
218 double d1 = 785.7524 *
pow(p.
energy(),0.0262) + 13663.4262;
219 double d2 = 9.8748 *
pow(p.
energy(),0.1720) + 37.0187;
220 if (d0 < 0.) d0 =
abs(d0);
222 TF1 *
fdepth =
new TF1(
"fdepth",
"[0] * TMath::Exp(-0.5*( (x-[1])/[2] + TMath::Exp(-(x-[1])/[2]) ))",14400.,15500.);
223 fdepth->SetParameters(d0,d1,d2);
224 depth = fdepth->GetRandom();
235 for (
int j = 0;
j < 16;
j++) {
236 double a = -
M_PI +
j*0.3927;
237 double b = -
M_PI + (
j+1)*0.3927;
238 if ( (p.
phi() >
a) && (p.
phi() <
b)) {
245 castorplus[0][sector] = castorplus[0][sector] +
energy;
246 castorplus[1][sector] = castorplus[1][sector] + emEnergy;
247 castorplus[2][sector] = castorplus[2][sector] + hadEnergy;
249 depthplus[sector].push_back(depth);
250 fhotplus[sector].push_back(fhot);
251 energyplus[sector].push_back(energy);
258 castormin[0][sector] = castormin[0][sector] +
energy;
259 castormin[1][sector] = castormin[1][sector] + emEnergy;
260 castormin[2][sector] = castormin[2][sector] + hadEnergy;
263 depthmin[sector].push_back(depth);
264 fhotmin[sector].push_back(fhot);
265 energymin[sector].push_back(energy);
276 for (
int j = 0;
j < 16;
j++) {
277 double hadnoise = 0.;
279 for (
int i=0;
i<12;
i++) {
284 hadnoise = hadnoise - 12*0.053;
285 emnoise = emnoise - 2*0.053;
286 if ( hadnoise < 0.) hadnoise = 0.;
287 if ( emnoise < 0.) emnoise = 0.;
288 double totnoise = hadnoise + emnoise;
291 castorplus[0][
j] = castorplus[0][
j] + totnoise;
292 castormin[0][
j] = castormin[0][
j] + totnoise;
293 castorplus[1][
j] = castorplus[1][
j] + emnoise;
294 castormin[1][
j] = castormin[1][
j] + emnoise;
295 castorplus[2][
j] = castorplus[2][
j] + hadnoise;
296 castormin[2][
j] = castormin[2][
j] + hadnoise;
307 for (
int j=0;
j<16;
j++) {
308 if (castorplus[0][
j] != 0.) {
311 fem = castorplus[1][
j]/castorplus[0][
j];
317 double depth_mean = 0.;
318 double fhot_mean = 0.;
319 double sum_energy = 0.;
322 for (
size_t p = 0;
p<energyplus[
j].size();
p++) {
323 depth_mean = depth_mean + depthplus[
j][
p]*energyplus[
j][
p];
324 fhot_mean = fhot_mean + fhotplus[
j][
p]*energyplus[
j][
p];
325 sum_energy = sum_energy + energyplus[
j][
p];
327 depth_mean = depth_mean/sum_energy;
328 fhot_mean = fhot_mean/sum_energy;
334 CastorTowers->
push_back(
reco::CastorTower(castorplus[0][j],pt2,castorplus[1][j],castorplus[2][j],fem,depth_mean,fhot_mean,refvector));
338 for (
int j=0;
j<16;
j++) {
339 if (castormin[0][
j] != 0.) {
341 fem = castormin[1][
j]/castormin[0][
j];
345 double depth_mean = 0.;
346 double fhot_mean = 0.;
347 double sum_energy = 0.;
350 for (
size_t p = 0;
p<energymin[
j].size();
p++) {
351 depth_mean = depth_mean + depthmin[
j][
p]*energymin[
j][
p];
352 fhot_mean = fhot_mean + fhotmin[
j][
p]*energymin[
j][
p];
353 sum_energy = sum_energy + energymin[
j][
p];
355 depth_mean = depth_mean/sum_energy;
356 fhot_mean = fhot_mean/sum_energy;
361 CastorTowers->
push_back(
reco::CastorTower(castormin[0][j],pt2,castormin[1][j],castormin[2][j],fem,depth_mean,fhot_mean,refvector));
372 double mu_noise = 0.053;
373 double sigma_noise = 0.027;
375 while (result < 0.) {
376 result = r2.Gaus(mu_noise,sigma_noise);
virtual double energy() const =0
energy
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
CastorFastTowerProducer(const edm::ParameterSet &)
std::vector< reco::CastorTower > CastorTowerCollection
~CastorFastTowerProducer()
#define DEFINE_FWK_MODULE(type)
ROOT::Math::RhoEtaPhiPoint TowerPoint
Abs< T >::type abs(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual int pdgId() const =0
PDG identifier.
static const double tmax[3]
virtual void produce(edm::Event &, const edm::EventSetup &) override
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Power< A, B >::type pow(const A &a, const B &b)
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity