108 using namespace reco;
109 using namespace TMath;
116 auto OutputTowers = std::make_unique<CastorTowerCollection>();
119 int nRecHits = InputRecHits->
size();
121 LogDebug(
"CastorTowerProducer") <<
"2. entering CastorTowerProducer" << std::endl;
124 LogDebug(
"CastorTowerProducer") <<
"Warning: You are trying to run the Tower algorithm with 0 input rechits.";
129 double poscastortowerarray[4][16];
130 double negcastortowerarray[4][16];
136 for (
int j = 0;
j < 16;
j++) {
137 poscastortowerarray[3][
j] = -2.94524 +
j * 0.3927;
138 poscastortowerarray[0][
j] = 0.;
139 poscastortowerarray[1][
j] = 0.;
140 poscastortowerarray[2][
j] = 0.;
142 negcastortowerarray[3][
j] = -2.94524 +
j * 0.3927;
143 negcastortowerarray[0][
j] = 0.;
144 negcastortowerarray[1][
j] = 0.;
145 negcastortowerarray[2][
j] = 0.;
151 std::vector<DetId>
channels =
p->getAllChannels();
154 for (
unsigned int i = 0;
i < InputRecHits->
size();
i++) {
162 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); channel++) {
163 if (channel->rawId() == genericID.
rawId()) {
173 double Erechit = rechit_p->energy();
175 int sector =
id.sector();
178 zrechit = -14390 - 24.75 - 49.5 * (
module - 1);
180 zrechit = -14390 - 99 - 49.5 - 99 * (
module - 3);
181 double phirechit = -100;
183 phirechit = 0.19635 + (sector - 1) * 0.3927;
185 phirechit = -2.94524 + (sector - 9) * 0.3927;
190 for (
int j = 0;
j < 16;
j++) {
192 if (
TMath::Abs(phirechit - poscastortowerarray[3][
j]) < 0.0001) {
195 poscastortowerarray[0][
j] += Erechit;
197 poscastortowerarray[1][
j] += Erechit;
199 poscastortowerarray[2][
j] += Erechit;
201 poscastorusedrechits[
j].push_back(rechit_p);
203 negcastortowerarray[0][
j] += Erechit;
205 negcastortowerarray[1][
j] += Erechit;
207 negcastortowerarray[2][
j] += Erechit;
209 negcastorusedrechits[
j].push_back(rechit_p);
219 double fem, Ehot,
depth;
220 double rhoTower = 88.5;
223 for (
int k = 0;
k < 16;
k++) {
230 fem = poscastortowerarray[1][
k] / poscastortowerarray[0][
k];
234 LogDebug(
"CastorTowerProducer") <<
"tower " <<
k + 1 <<
": fem = " << fem <<
" ,depth = " <<
depth
235 <<
" ,Ehot = " << Ehot << std::endl;
237 TowerPoint temptowerposition(rhoTower, 5.9, poscastortowerarray[3][
k]);
238 Point towerposition(temptowerposition);
242 poscastortowerarray[1][
k],
243 poscastortowerarray[2][
k],
247 poscastorusedrechits[
k]);
248 OutputTowers->push_back(newtower);
253 fem = negcastortowerarray[1][
k] / negcastortowerarray[0][
k];
257 LogDebug(
"CastorTowerProducer") <<
"tower " <<
k + 1 <<
" energy = " << negcastortowerarray[0][
k]
258 <<
"EM = " << negcastortowerarray[1][
k] <<
"HAD = " << negcastortowerarray[2][
k]
259 <<
"phi = " << negcastortowerarray[3][
k] <<
": fem = " << fem
260 <<
" ,depth = " <<
depth <<
" ,Ehot = " << Ehot << std::endl;
262 TowerPoint temptowerposition(rhoTower, -5.9, negcastortowerarray[3][
k]);
263 Point towerposition(temptowerposition);
267 negcastortowerarray[1][
k],
268 negcastortowerarray[2][
k],
272 negcastorusedrechits[
k]);
273 OutputTowers->push_back(newtower);