59 virtual void endJob()
override ;
90 towercut_(iConfig.getParameter<double>(
"towercut")),
91 mintime_(iConfig.getParameter<double>(
"mintime")),
92 maxtime_(iConfig.getParameter<double>(
"maxtime"))
96 produces<CastorTowerCollection>();
116 using namespace reco;
117 using namespace TMath;
127 int nRecHits = InputRecHits->size();
130 <<
"2. entering CastorTowerProducer"<<std::endl;
133 LogDebug(
"CastorTowerProducer") <<
"Warning: You are trying to run the Tower algorithm with 0 input rechits.";
138 double poscastortowerarray[4][16];
139 double negcastortowerarray[4][16];
145 for (
int j = 0;
j < 16;
j++) {
146 poscastortowerarray[3][
j] = -2.94524 +
j*0.3927;
147 poscastortowerarray[0][
j] = 0.;
148 poscastortowerarray[1][
j] = 0.;
149 poscastortowerarray[2][
j] = 0.;
151 negcastortowerarray[3][
j] = -2.94524 +
j*0.3927;
152 negcastortowerarray[0][
j] = 0.;
153 negcastortowerarray[1][
j] = 0.;
154 negcastortowerarray[2][
j] = 0.;
160 std::vector<DetId> channels =
p->getAllChannels();
163 for (
unsigned int i = 0;
i < InputRecHits->size();
i++) {
172 for (std::vector<DetId>::iterator channel = channels.begin();channel != channels.end();channel++) {
173 if (channel->rawId() == genericID.
rawId()) {
181 double Erechit = rechit_p->energy();
183 int sector =
id.sector();
185 if (module < 3) zrechit = -14390 - 24.75 - 49.5*(module-1);
186 if (module > 2) zrechit = -14390 - 99 - 49.5 - 99*(module-3);
187 double phirechit = -100;
188 if (sector < 9) phirechit = 0.19635 + (sector-1)*0.3927;
189 if (sector > 8) phirechit = -2.94524 + (sector - 9)*0.3927;
195 for (
int j=0;
j<16;
j++) {
198 if (TMath::Abs(phirechit - poscastortowerarray[3][
j]) < 0.0001) {
202 poscastortowerarray[0][
j]+=Erechit;
203 if (module < 3) {poscastortowerarray[1][
j]+=Erechit;}
else {poscastortowerarray[2][
j]+=Erechit;}
204 poscastorusedrechits[
j].push_back(rechit_p);
206 negcastortowerarray[0][
j]+=Erechit;
207 if (module < 3) {negcastortowerarray[1][
j]+=Erechit;}
else {negcastortowerarray[2][
j]+=Erechit;}
208 negcastorusedrechits[
j].push_back(rechit_p);
218 double fem, Ehot, depth;
219 double rhoTower = 88.5;
222 for (
int k=0;
k<16;
k++) {
231 fem = poscastortowerarray[1][
k]/poscastortowerarray[0][
k];
236 <<
"tower "<<
k+1<<
": fem = "<<fem<<
" ,depth = "<<depth<<
" ,Ehot = "<<Ehot<<std::endl;
238 TowerPoint temptowerposition(rhoTower,5.9,poscastortowerarray[3][
k]);
239 Point towerposition(temptowerposition);
241 CastorTower newtower(poscastortowerarray[0][k],towerposition,poscastortowerarray[1][k],poscastortowerarray[2][k],fem,depth,Ehot,
242 poscastorusedrechits[k]);
243 OutputTowers->push_back(newtower);
249 fem = negcastortowerarray[1][
k]/negcastortowerarray[0][
k];
254 <<
"tower "<<
k+1 <<
" energy = " << negcastortowerarray[0][
k] <<
"EM = " << negcastortowerarray[1][
k] <<
"HAD = " << negcastortowerarray[2][
k] <<
"phi = " << negcastortowerarray[3][
k] <<
": fem = "<<fem<<
" ,depth = "<<depth<<
" ,Ehot = "<<Ehot<<std::endl;
256 TowerPoint temptowerposition(rhoTower,-5.9,negcastortowerarray[3][
k]);
257 Point towerposition(temptowerposition);
259 CastorTower newtower(negcastortowerarray[0][k],towerposition,negcastortowerarray[1][k],negcastortowerarray[2][k],fem,depth,Ehot,
260 negcastorusedrechits[k]);
261 OutputTowers->push_back(newtower);
266 iEvent.
put(OutputTowers);
273 <<
"Starting CastorTowerProducer";
279 <<
"Ending CastorTowerProducer";
284 using namespace reco;
292 double Erechit = rechit_p->energy();
296 if (module < 3) zrechit = -14390 - 24.75 - 49.5*(module-1);
297 if (module > 2) zrechit = -14390 - 99 - 49.5 - 99*(module-3);
299 if(Erechit > Ehot) Ehot = Erechit;
300 depth+=Erechit*zrechit;
T getParameter(std::string const &) const
edm::SortedCollection< CastorRecHit > CastorRecHitCollection
ROOT::Math::RhoZPhiPoint CellPoint
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void endJob() override
#define DEFINE_FWK_MODULE(type)
std::vector< reco::CastorTower > CastorTowerCollection
ROOT::Math::RhoEtaPhiPoint TowerPoint
int bad(Items const &cont)
uint32_t rawId() const
get the raw id
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::RefVector< CastorRecHitCollection > CastorRecHitRefVector
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual void beginJob() 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)
ProductID id() const
Accessor for product ID.
tuple size
Write out results.