87 :
towercut_(iConfig.getParameter<double>(
"towercut")),
88 mintime_(iConfig.getParameter<double>(
"mintime")),
89 maxtime_(iConfig.getParameter<double>(
"maxtime")) {
92 produces<CastorTowerCollection>();
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.;
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;
203 negcastortowerarray[0][
j] += Erechit;
205 negcastortowerarray[1][
j] += Erechit;
207 negcastortowerarray[2][
j] += Erechit;
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);
284 using namespace reco;
292 double Erechit = rechit_p->energy();
297 zrechit = -14390 - 24.75 - 49.5 * (module - 1);
299 zrechit = -14390 - 99 - 49.5 - 99 * (module - 3);
303 depth += Erechit * zrechit;
T getParameter(std::string const &) const
edm::SortedCollection< CastorRecHit > CastorRecHitCollection
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ROOT::Math::RhoZPhiPoint CellPoint
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr uint32_t rawId() const
get the raw id
std::vector< DetId > getAllChannels() const
std::vector< reco::CastorTower > CastorTowerCollection
ROOT::Math::RhoEtaPhiPoint TowerPoint
ProductID id() const
Accessor for product ID.
~CastorTowerProducer() override
#define DEFINE_FWK_MODULE(type)
edm::RefVector< CastorRecHitCollection > CastorRecHitRefVector
void produce(edm::Event &, const edm::EventSetup &) override
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
CastorTowerProducer(const edm::ParameterSet &)
edm::EDGetTokenT< CastorRecHitCollection > tok_input_
virtual void ComputeTowerVariable(const edm::RefVector< edm::SortedCollection< CastorRecHit > > &usedRecHits, double &Ehot, double &depth)
Structure Point Contains parameters of Gaussian fits to DMRs.
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.