62 void endJob()
override;
114 : produceHFhits_(iConfig.getParameter<
bool>(
"produceHFhits")),
115 produceHFtowers_(iConfig.getParameter<
bool>(
"produceHFtowers")),
116 produceEcalhits_(iConfig.getParameter<
bool>(
"produceEcalhits")),
117 produceZDChits_(iConfig.getParameter<
bool>(
"produceZDChits")),
118 lowGainZDC_(iConfig.getParameter<
bool>(
"lowGainZDC")),
119 produceETmidRap_(iConfig.getParameter<
bool>(
"produceETmidRapidity")),
120 producePixelhits_(iConfig.getParameter<
bool>(
"producePixelhits")),
121 doPixelCut_(iConfig.getParameter<
bool>(
"doPixelCut")),
122 produceTracks_(iConfig.getParameter<
bool>(
"produceTracks")),
123 producePixelTracks_(iConfig.getParameter<
bool>(
"producePixelTracks")),
124 midRapidityRange_(iConfig.getParameter<double>(
"midRapidityRange")),
125 trackPtCut_(iConfig.getParameter<double>(
"trackPtCut")),
126 trackEtaCut_(iConfig.getParameter<double>(
"trackEtaCut")),
127 hfEtaCut_(iConfig.getParameter<double>(
"hfEtaCut")),
128 reuseAny_(iConfig.getParameter<
bool>(
"reUseCentrality")),
129 useQuality_(iConfig.getParameter<
bool>(
"useQuality")),
130 trackQuality_(
TrackBase::qualityByName(iConfig.getParameter<
std::
string>(
"trackQuality"))),
133 srcTowers_((produceHFtowers_ || produceETmidRap_)
142 srcPixelhits_(producePixelhits_
147 srcPixelTracks_(producePixelTracks_
150 srcVertex_((produceTracks_ || producePixelTracks_)
161 produces<Centrality>();
170 auto creco = std::make_unique<Centrality>();
176 creco->etHFhitSumPlus_ = 0;
177 creco->etHFhitSumMinus_ = 0;
180 for (
size_t ihit = 0; ihit <
hits->size(); ++ihit) {
181 const HFRecHit& rechit = (*hits)[ihit];
182 if (rechit.
id().
ieta() > 0)
183 creco->etHFhitSumPlus_ += rechit.
energy();
184 if (rechit.
id().
ieta() < 0)
185 creco->etHFhitSumMinus_ += rechit.
energy();
195 creco->etHFtowerSumPlus_ = 0;
196 creco->etHFtowerSumMinus_ = 0;
197 creco->etHFtowerSumECutPlus_ = 0;
198 creco->etHFtowerSumECutMinus_ = 0;
199 creco->etMidRapiditySum_ = 0;
204 for (
size_t i = 0;
i <
towers->size(); ++
i) {
210 creco->etHFtowerSumPlus_ +=
tower.pt();
211 if (
tower.energy() > 1.5)
212 creco->etHFtowerSumECutPlus_ +=
tower.pt();
214 creco->etHFtruncatedPlus_ +=
tower.pt();
216 creco->etHFtowerSumMinus_ +=
tower.pt();
217 if (
tower.energy() > 1.5)
218 creco->etHFtowerSumECutMinus_ +=
tower.pt();
220 creco->etHFtruncatedMinus_ +=
tower.pt();
249 creco->etEESumPlus_ = 0;
250 creco->etEESumMinus_ = 0;
259 for (
unsigned int i = 0;
i < ebHits->
size(); ++
i) {
262 double et =
hit.energy() * (
pos.perp() /
pos.mag());
263 creco->etEBSum_ +=
et;
266 for (
unsigned int i = 0;
i < eeHits->
size(); ++
i) {
269 double et =
hit.energy() * (
pos.perp() /
pos.mag());
271 creco->etEESumPlus_ +=
et;
273 creco->etEESumMinus_ +=
et;
279 creco->etEESumPlus_ = inputCentrality->
EtEESumPlus();
280 creco->etEBSum_ = inputCentrality->
EtEBSum();
287 creco->pixelMultiplicity_ = 0;
294 int nPixel_minus = 0;
301 recHitIterator != recHitRange.
end();
306 dynamic_cast<const PixelGeomDetUnit*>(tGeo->
idToDet(
recHit->geographicalId()));
309 double eta = rechitPos.eta();
310 int clusterSize =
recHit->cluster()->size();
316 if (18 * abeta - 40 > clusterSize)
318 }
else if (
layer == 2) {
319 if (6 * abeta - 7.2 > clusterSize)
322 if (4 * abeta - 2.4 > clusterSize)
334 creco->pixelMultiplicity_ = nPixel;
335 creco->pixelMultiplicityPlus_ = nPixel_plus;
336 creco->pixelMultiplicityMinus_ = nPixel_minus;
349 double vxError = -999.;
350 double vyError = -999.;
351 double vzError = -999.;
356 unsigned int daughter = 0;
359 for (
unsigned int i = 0;
i < recoVertices->size(); ++
i) {
360 daughter = (*recoVertices)[
i].tracksSize();
361 if (daughter > (*recoVertices)[greatestvtx].tracksSize())
365 if (!recoVertices->empty()) {
366 vx = (*recoVertices)[greatestvtx].position().x();
367 vy = (*recoVertices)[greatestvtx].position().y();
368 vz = (*recoVertices)[greatestvtx].position().z();
369 vxError = (*recoVertices)[greatestvtx].xError();
370 vyError = (*recoVertices)[greatestvtx].yError();
371 vzError = (*recoVertices)[greatestvtx].zError();
380 double trackCounter = 0;
381 double trackCounterEta = 0;
382 double trackCounterEtaPt = 0;
384 for (
unsigned int i = 0;
i <
tracks->size(); ++
i) {
399 double dzsigma2 =
track.dzError() *
track.dzError() + vzError * vzError;
401 double dxysigma2 =
track.dxyError() *
track.dxyError() + vxError * vyError;
403 const double pterrcut = 0.1;
404 const double dzrelcut = 3.0;
405 const double dxyrelcut = 3.0;
408 track.ptError() /
track.pt() < pterrcut &&
dz *
dz < dzrelcut * dzrelcut * dzsigma2 &&
409 dxy *
dxy < dxyrelcut * dxyrelcut * dxysigma2) {
414 creco->trackMultiplicity_ =
nTracks;
415 creco->ntracksPtCut_ = trackCounter;
416 creco->ntracksEtaCut_ = trackCounterEta;
417 creco->ntracksEtaPtCut_ = trackCounterEtaPt;
421 creco->trackMultiplicity_ = inputCentrality->
Ntracks();
431 int nPixelTracks = pixeltracks->size();
432 int nPixelTracksPlus = 0;
433 int nPixelTracksMinus = 0;
435 for (
auto const&
track : *pixeltracks) {
441 creco->nPixelTracks_ = nPixelTracks;
442 creco->nPixelTracksPlus_ = nPixelTracksPlus;
443 creco->nPixelTracksMinus_ = nPixelTracksMinus;
453 creco->zdcSumPlus_ = 0;
454 creco->zdcSumMinus_ = 0;
459 for (
size_t ihit = 0; ihit <
hits->size(); ++ihit) {
465 creco->zdcSumPlus_ += rechit.
energy();
472 creco->zdcSumMinus_ += rechit.
energy();
477 creco->zdcSumPlus_ = -9;
478 creco->zdcSumMinus_ = -9;
482 creco->zdcSumMinus_ = inputCentrality->
zdcSumMinus();
483 creco->zdcSumPlus_ = inputCentrality->
zdcSumPlus();
492 desc.add<
bool>(
"produceHFhits",
true);
493 desc.add<
bool>(
"produceHFtowers",
true);
494 desc.add<
bool>(
"produceEcalhits",
true);
495 desc.add<
bool>(
"produceZDChits",
true);
496 desc.add<
bool>(
"produceETmidRapidity",
true);
497 desc.add<
bool>(
"producePixelhits",
true);
498 desc.add<
bool>(
"produceTracks",
true);
499 desc.add<
bool>(
"producePixelTracks",
true);
500 desc.add<
bool>(
"reUseCentrality",
false);
511 desc.add<
bool>(
"doPixelCut",
true);
512 desc.add<
bool>(
"useQuality",
true);
513 desc.add<
string>(
"trackQuality",
"highPurity");
514 desc.add<
double>(
"trackEtaCut", 2);
515 desc.add<
double>(
"trackPtCut", 1);
516 desc.add<
double>(
"hfEtaCut", 4)->setComment(
"hf above the absolute value of this cut is used");
517 desc.add<
double>(
"midRapidityRange", 1);
518 desc.add<
bool>(
"lowGainZDC",
true);