62 void endJob()
override;
117 : produceHFhits_(iConfig.getParameter<
bool>(
"produceHFhits")),
118 produceHFtowers_(iConfig.getParameter<
bool>(
"produceHFtowers")),
119 produceEcalhits_(iConfig.getParameter<
bool>(
"produceEcalhits")),
120 produceZDChits_(iConfig.getParameter<
bool>(
"produceZDChits")),
121 lowGainZDC_(iConfig.getParameter<
bool>(
"lowGainZDC")),
122 produceETmidRap_(iConfig.getParameter<
bool>(
"produceETmidRapidity")),
123 producePixelhits_(iConfig.getParameter<
bool>(
"producePixelhits")),
124 doPixelCut_(iConfig.getParameter<
bool>(
"doPixelCut")),
125 produceTracks_(iConfig.getParameter<
bool>(
"produceTracks")),
126 producePixelTracks_(iConfig.getParameter<
bool>(
"producePixelTracks")),
127 producePF_(iConfig.getParameter<
bool>(
"producePF")),
128 midRapidityRange_(iConfig.getParameter<double>(
"midRapidityRange")),
129 trackPtCut_(iConfig.getParameter<double>(
"trackPtCut")),
130 trackEtaCut_(iConfig.getParameter<double>(
"trackEtaCut")),
131 hfEtaCut_(iConfig.getParameter<double>(
"hfEtaCut")),
132 isPhase2_(iConfig.getParameter<
bool>(
"isPhase2")),
133 reuseAny_(iConfig.getParameter<
bool>(
"reUseCentrality")),
134 useQuality_(iConfig.getParameter<
bool>(
"useQuality")),
138 srcTowers_((produceHFtowers_ || produceETmidRap_)
147 srcPixelhits_(producePixelhits_
152 srcPixelTracks_(producePixelTracks_
157 srcVertex_((produceTracks_ || producePixelTracks_)
168 produces<Centrality>();
177 auto creco = std::make_unique<Centrality>();
183 creco->etHFhitSumPlus_ = 0;
184 creco->etHFhitSumMinus_ = 0;
187 for (
size_t ihit = 0; ihit <
hits->size(); ++ihit) {
188 const HFRecHit& rechit = (*hits)[ihit];
189 if (rechit.
id().
ieta() > 0)
190 creco->etHFhitSumPlus_ += rechit.
energy();
191 if (rechit.
id().
ieta() < 0)
192 creco->etHFhitSumMinus_ += rechit.
energy();
196 creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
197 creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
202 creco->etHFtowerSumPlus_ = 0;
203 creco->etHFtowerSumMinus_ = 0;
204 creco->etHFtowerSumECutPlus_ = 0;
205 creco->etHFtowerSumECutMinus_ = 0;
206 creco->etMidRapiditySum_ = 0;
211 for (
size_t i = 0;
i <
towers->size(); ++
i) {
217 creco->etHFtowerSumPlus_ +=
tower.pt();
218 if (
tower.energy() > 1.5)
219 creco->etHFtowerSumECutPlus_ +=
tower.pt();
221 creco->etHFtruncatedPlus_ +=
tower.pt();
223 creco->etHFtowerSumMinus_ +=
tower.pt();
224 if (
tower.energy() > 1.5)
225 creco->etHFtowerSumECutMinus_ +=
tower.pt();
227 creco->etHFtruncatedMinus_ +=
tower.pt();
231 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
232 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
233 creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
234 creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
235 creco->etHFtruncatedMinus_ = inputCentrality->EtHFtruncatedMinus();
236 creco->etHFtruncatedPlus_ = inputCentrality->EtHFtruncatedPlus();
243 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
247 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
248 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
249 creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
250 creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
251 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
256 creco->etPFhfSumPlus_ = 0;
257 creco->etPFhfSumMinus_ = 0;
259 if (
pf.pdgId() != 1 &&
pf.pdgId() != 2)
262 creco->etPFhfSumPlus_ +=
pf.pt();
264 creco->etPFhfSumMinus_ +=
pf.pt();
267 creco->etPFhfSumMinus_ = inputCentrality->EtPFhfSumMinus();
268 creco->etPFhfSumPlus_ = inputCentrality->EtPFhfSumPlus();
272 creco->etEESumPlus_ = 0;
273 creco->etEESumMinus_ = 0;
282 for (
unsigned int i = 0;
i < ebHits->
size(); ++
i) {
285 double et =
hit.energy() * (
pos.perp() /
pos.mag());
286 creco->etEBSum_ +=
et;
289 for (
unsigned int i = 0;
i < eeHits->
size(); ++
i) {
292 double et =
hit.energy() * (
pos.perp() /
pos.mag());
294 creco->etEESumPlus_ +=
et;
296 creco->etEESumMinus_ +=
et;
301 creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
302 creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
303 creco->etEBSum_ = inputCentrality->EtEBSum();
310 creco->pixelMultiplicity_ = 0;
317 int nPixel_minus = 0;
324 recHitIterator != recHitRange.
end();
332 double eta = rechitPos.eta();
341 }
else if (layer == 2) {
344 }
else if (layer == 3 || layer == 4) {
357 creco->pixelMultiplicity_ = nPixel;
358 creco->pixelMultiplicityPlus_ = nPixel_plus;
359 creco->pixelMultiplicityMinus_ = nPixel_minus;
362 creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
363 creco->pixelMultiplicityPlus_ = inputCentrality->multiplicityPixelPlus();
364 creco->pixelMultiplicityMinus_ = inputCentrality->multiplicityPixelMinus();
372 double vxError = -999.;
373 double vyError = -999.;
374 double vzError = -999.;
379 unsigned int daughter = 0;
382 for (
unsigned int i = 0;
i < recoVertices->size(); ++
i) {
383 daughter = (*recoVertices)[
i].tracksSize();
384 if (daughter > (*recoVertices)[greatestvtx].
tracksSize())
388 if (!recoVertices->empty()) {
389 vx = (*recoVertices)[greatestvtx].position().x();
390 vy = (*recoVertices)[greatestvtx].position().y();
391 vz = (*recoVertices)[greatestvtx].position().z();
392 vxError = (*recoVertices)[greatestvtx].xError();
393 vyError = (*recoVertices)[greatestvtx].yError();
394 vzError = (*recoVertices)[greatestvtx].zError();
403 double trackCounter = 0;
404 double trackCounterEta = 0;
405 double trackCounterEtaPt = 0;
407 for (
unsigned int i = 0;
i <
tracks->size(); ++
i) {
422 double dzsigma2 =
track.dzError() *
track.dzError() + vzError * vzError;
424 double dxysigma2 =
track.dxyError() *
track.dxyError() + vxError * vyError;
426 const double pterrcut = 0.1;
427 const double dzrelcut = 3.0;
428 const double dxyrelcut = 3.0;
431 track.ptError() /
track.pt() < pterrcut &&
dz *
dz < dzrelcut * dzrelcut * dzsigma2 &&
432 dxy *
dxy < dxyrelcut * dxyrelcut * dxysigma2) {
437 creco->trackMultiplicity_ =
nTracks;
438 creco->ntracksPtCut_ = trackCounter;
439 creco->ntracksEtaCut_ = trackCounterEta;
440 creco->ntracksEtaPtCut_ = trackCounterEtaPt;
444 creco->trackMultiplicity_ = inputCentrality->Ntracks();
445 creco->ntracksPtCut_ = inputCentrality->NtracksPtCut();
446 creco->ntracksEtaCut_ = inputCentrality->NtracksEtaCut();
447 creco->ntracksEtaPtCut_ = inputCentrality->NtracksEtaPtCut();
454 int nPixelTracks = pixeltracks->size();
455 int nPixelTracksPlus = 0;
456 int nPixelTracksMinus = 0;
458 for (
auto const&
track : *pixeltracks) {
464 creco->nPixelTracks_ = nPixelTracks;
465 creco->nPixelTracksPlus_ = nPixelTracksPlus;
466 creco->nPixelTracksMinus_ = nPixelTracksMinus;
469 creco->nPixelTracks_ = inputCentrality->NpixelTracks();
470 creco->nPixelTracksPlus_ = inputCentrality->NpixelTracksPlus();
471 creco->nPixelTracksMinus_ = inputCentrality->NpixelTracksMinus();
476 creco->zdcSumPlus_ = 0;
477 creco->zdcSumMinus_ = 0;
482 for (
size_t ihit = 0; ihit <
hits->size(); ++ihit) {
488 creco->zdcSumPlus_ += rechit.
energy();
495 creco->zdcSumMinus_ += rechit.
energy();
500 creco->zdcSumPlus_ = -9;
501 creco->zdcSumMinus_ = -9;
505 creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
506 creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
515 desc.add<
bool>(
"produceHFhits",
true);
516 desc.add<
bool>(
"produceHFtowers",
true);
517 desc.add<
bool>(
"produceEcalhits",
true);
518 desc.add<
bool>(
"produceZDChits",
true);
519 desc.add<
bool>(
"produceETmidRapidity",
true);
520 desc.add<
bool>(
"producePixelhits",
true);
521 desc.add<
bool>(
"produceTracks",
true);
522 desc.add<
bool>(
"producePixelTracks",
true);
523 desc.add<
bool>(
"producePF",
true);
524 desc.add<
bool>(
"reUseCentrality",
false);
536 desc.add<
bool>(
"doPixelCut",
true);
537 desc.add<
bool>(
"useQuality",
true);
538 desc.add<
string>(
"trackQuality",
"highPurity");
539 desc.add<
double>(
"trackEtaCut", 2);
540 desc.add<
double>(
"trackPtCut", 1);
541 desc.add<
double>(
"hfEtaCut", 4)->setComment(
"hf above the absolute value of this cut is used");
542 desc.add<
double>(
"midRapidityRange", 1);
543 desc.add<
bool>(
"lowGainZDC",
true);
544 desc.add<
bool>(
"isPhase2",
false);
const bool producePixelTracks_
const edm::EDGetTokenT< EcalRecHitCollection > srcEEhits_
const bool producePixelhits_
const bool produceTracks_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeom_
const edm::EDGetTokenT< TrackCollection > srcTracks_
Quality qualityByName(std::string const &name)
const edm::EDGetTokenT< SiPixelRecHitCollection > srcPixelhits_
TrackQuality
track quality
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
const edm::EDGetTokenT< CaloTowerCollection > srcTowers_
const reco::TrackBase::TrackQuality trackQuality_
const edm::EDGetTokenT< VertexCollection > srcVertex_
const edm::EDGetTokenT< reco::CandidateView > srcPF_
unsigned int layer(const DetId &id) const
constexpr float energy() const
const bool produceZDChits_
const_iterator end(bool update=false) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const bool produceEcalhits_
void addDefault(ParameterSetDescription const &psetDescription)
constexpr HcalDetId id() const
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
const bool produceETmidRap_
float lowGainEnergy() const
constexpr int ieta() const
get the cell ieta
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopo_
const edm::EDGetTokenT< ZDCRecHitCollection > srcZDChits_
const edm::EDGetTokenT< TrackCollection > srcPixelTracks_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeom_
const edm::EDGetTokenT< HFRecHitCollection > srcHFhits_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const TrackerGeomDet * idToDet(DetId) const override
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin(bool update=false) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
const bool produceHFtowers_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< Centrality > reuseTag_
bool isHF(int etabin, int depth)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
HcalZDCDetId id() const
get the id
const_iterator find(id_type i, bool update=false) const
const double trackEtaCut_
const edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
const double midRapidityRange_
constexpr int32_t zside() const
get the z-side of the cell (1/-1)
const bool produceHFhits_