89 : towercut_(iConfig.getParameter<double>(
"towercut")),
90 mintime_(iConfig.getParameter<double>(
"mintime")),
91 maxtime_(iConfig.getParameter<double>(
"maxtime")) {
95 produces<CastorTowerCollection>();
111 using namespace reco;
112 using namespace TMath;
119 auto OutputTowers = std::make_unique<CastorTowerCollection>();
122 int nRecHits = InputRecHits->
size();
124 LogDebug(
"CastorTowerProducer") <<
"2. entering CastorTowerProducer" << std::endl;
127 LogDebug(
"CastorTowerProducer") <<
"Warning: You are trying to run the Tower algorithm with 0 input rechits.";
132 double poscastortowerarray[4][16];
133 double negcastortowerarray[4][16];
139 for (
int j = 0;
j < 16;
j++) {
140 poscastortowerarray[3][
j] = -2.94524 +
j * 0.3927;
141 poscastortowerarray[0][
j] = 0.;
142 poscastortowerarray[1][
j] = 0.;
143 poscastortowerarray[2][
j] = 0.;
145 negcastortowerarray[3][
j] = -2.94524 +
j * 0.3927;
146 negcastortowerarray[0][
j] = 0.;
147 negcastortowerarray[1][
j] = 0.;
148 negcastortowerarray[2][
j] = 0.;
153 std::vector<DetId>
channels =
p->getAllChannels();
156 for (
unsigned int i = 0;
i < InputRecHits->
size();
i++) {
164 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); channel++) {
165 if (channel->rawId() == genericID.
rawId()) {
175 double Erechit = rechit_p->energy();
177 int sector =
id.sector();
180 zrechit = -14390 - 24.75 - 49.5 * (
module - 1);
182 zrechit = -14390 - 99 - 49.5 - 99 * (
module - 3);
183 double phirechit = -100;
185 phirechit = 0.19635 + (sector - 1) * 0.3927;
187 phirechit = -2.94524 + (sector - 9) * 0.3927;
192 for (
int j = 0;
j < 16;
j++) {
194 if (
TMath::Abs(phirechit - poscastortowerarray[3][
j]) < 0.0001) {
197 poscastortowerarray[0][
j] += Erechit;
199 poscastortowerarray[1][
j] += Erechit;
201 poscastortowerarray[2][
j] += Erechit;
205 negcastortowerarray[0][
j] += Erechit;
207 negcastortowerarray[1][
j] += Erechit;
209 negcastortowerarray[2][
j] += Erechit;
221 double fem, Ehot,
depth;
222 double rhoTower = 88.5;
225 for (
int k = 0;
k < 16;
k++) {
231 fem = poscastortowerarray[1][
k] / poscastortowerarray[0][
k];
235 LogDebug(
"CastorTowerProducer") <<
"tower " <<
k + 1 <<
": fem = " << fem <<
" ,depth = " <<
depth
236 <<
" ,Ehot = " << Ehot << std::endl;
238 TowerPoint temptowerposition(rhoTower, 5.9, poscastortowerarray[3][
k]);
239 Point towerposition(temptowerposition);
243 poscastortowerarray[1][
k],
244 poscastortowerarray[2][
k],
248 poscastorusedrechits[
k]);
249 OutputTowers->push_back(newtower);
254 fem = negcastortowerarray[1][
k] / negcastortowerarray[0][
k];
258 LogDebug(
"CastorTowerProducer") <<
"tower " <<
k + 1 <<
" energy = " << negcastortowerarray[0][
k]
259 <<
"EM = " << negcastortowerarray[1][
k] <<
"HAD = " << negcastortowerarray[2][
k]
260 <<
"phi = " << negcastortowerarray[3][
k] <<
": fem = " << fem
261 <<
" ,depth = " <<
depth <<
" ,Ehot = " << Ehot << std::endl;
263 TowerPoint temptowerposition(rhoTower, -5.9, negcastortowerarray[3][
k]);
264 Point towerposition(temptowerposition);
268 negcastortowerarray[1][
k],
269 negcastortowerarray[2][
k],
273 negcastorusedrechits[
k]);
274 OutputTowers->push_back(newtower);
285 using namespace reco;
293 double Erechit = rechit_p->energy();
298 zrechit = -14390 - 24.75 - 49.5 * (
module - 1);
300 zrechit = -14390 - 99 - 49.5 - 99 * (
module - 3);
304 depth += Erechit * zrechit;