File indexing completed on 2024-08-19 22:31:33
0001
0002
0003
0004
0005
0006
0007
0008 #include <memory>
0009 #include <iostream>
0010
0011
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "FWCore/Framework/interface/global/EDProducer.h"
0014 #include "FWCore/Utilities/interface/StreamID.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017
0018 #include "FWCore/Framework/interface/MakerMacros.h"
0019 #include "FWCore/Framework/interface/ESHandle.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Utilities/interface/InputTag.h"
0022 #include "FWCore/Utilities/interface/ESGetToken.h"
0023
0024 #include "DataFormats/Candidate/interface/Candidate.h"
0025
0026 #include "DataFormats/HeavyIonEvent/interface/Centrality.h"
0027 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0028 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0029
0030 #include "DataFormats/Common/interface/Ref.h"
0031 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
0032 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
0033 #include "DataFormats/TrackReco/interface/Track.h"
0034 #include "DataFormats/VertexReco/interface/Vertex.h"
0035 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0036 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0037
0038 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0039 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0040 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0041 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0042 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0043
0044 using namespace std;
0045 using namespace edm;
0046 using namespace reco;
0047
0048
0049
0050
0051
0052 namespace reco {
0053 class CentralityProducer : public edm::global::EDProducer<> {
0054 public:
0055 explicit CentralityProducer(const edm::ParameterSet&);
0056 ~CentralityProducer() override = default;
0057 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0058
0059 private:
0060 void beginJob() override;
0061 void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
0062 void endJob() override;
0063
0064
0065
0066 const bool produceHFhits_;
0067 const bool produceHFtowers_;
0068 const bool produceEcalhits_;
0069 const bool produceZDChits_;
0070 const bool lowGainZDC_;
0071 const bool produceETmidRap_;
0072 const bool producePixelhits_;
0073 const bool doPixelCut_;
0074 const bool produceTracks_;
0075 const bool producePixelTracks_;
0076 const bool producePF_;
0077
0078 const double midRapidityRange_;
0079 const double trackPtCut_;
0080 const double trackEtaCut_;
0081 const double hfEtaCut_;
0082
0083 const bool isPhase2_;
0084 const bool reuseAny_;
0085 const bool useQuality_;
0086 const reco::TrackBase::TrackQuality trackQuality_;
0087
0088 const edm::EDGetTokenT<HFRecHitCollection> srcHFhits_;
0089 const edm::EDGetTokenT<CaloTowerCollection> srcTowers_;
0090 const edm::EDGetTokenT<EcalRecHitCollection> srcEBhits_;
0091 const edm::EDGetTokenT<EcalRecHitCollection> srcEEhits_;
0092 const edm::EDGetTokenT<ZDCRecHitCollection> srcZDChits_;
0093 const edm::EDGetTokenT<SiPixelRecHitCollection> srcPixelhits_;
0094 const edm::EDGetTokenT<TrackCollection> srcTracks_;
0095 const edm::EDGetTokenT<TrackCollection> srcPixelTracks_;
0096 const edm::EDGetTokenT<reco::CandidateView> srcPF_;
0097 const edm::EDGetTokenT<VertexCollection> srcVertex_;
0098 const edm::EDGetTokenT<Centrality> reuseTag_;
0099
0100 const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeom_;
0101 const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeom_;
0102 const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopo_;
0103 };
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116 CentralityProducer::CentralityProducer(const edm::ParameterSet& iConfig)
0117 : produceHFhits_(iConfig.getParameter<bool>("produceHFhits")),
0118 produceHFtowers_(iConfig.getParameter<bool>("produceHFtowers")),
0119 produceEcalhits_(iConfig.getParameter<bool>("produceEcalhits")),
0120 produceZDChits_(iConfig.getParameter<bool>("produceZDChits")),
0121 lowGainZDC_(iConfig.getParameter<bool>("lowGainZDC")),
0122 produceETmidRap_(iConfig.getParameter<bool>("produceETmidRapidity")),
0123 producePixelhits_(iConfig.getParameter<bool>("producePixelhits")),
0124 doPixelCut_(iConfig.getParameter<bool>("doPixelCut")),
0125 produceTracks_(iConfig.getParameter<bool>("produceTracks")),
0126 producePixelTracks_(iConfig.getParameter<bool>("producePixelTracks")),
0127 producePF_(iConfig.getParameter<bool>("producePF")),
0128 midRapidityRange_(iConfig.getParameter<double>("midRapidityRange")),
0129 trackPtCut_(iConfig.getParameter<double>("trackPtCut")),
0130 trackEtaCut_(iConfig.getParameter<double>("trackEtaCut")),
0131 hfEtaCut_(iConfig.getParameter<double>("hfEtaCut")),
0132 isPhase2_(iConfig.getParameter<bool>("isPhase2")),
0133 reuseAny_(iConfig.getParameter<bool>("reUseCentrality")),
0134 useQuality_(iConfig.getParameter<bool>("useQuality")),
0135 trackQuality_(TrackBase::qualityByName(iConfig.getParameter<std::string>("trackQuality"))),
0136 srcHFhits_(produceHFhits_ ? consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcHFhits"))
0137 : edm::EDGetTokenT<HFRecHitCollection>()),
0138 srcTowers_((produceHFtowers_ || produceETmidRap_)
0139 ? consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("srcTowers"))
0140 : edm::EDGetTokenT<CaloTowerCollection>()),
0141 srcEBhits_(produceEcalhits_ ? consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcEBhits"))
0142 : edm::EDGetTokenT<EcalRecHitCollection>()),
0143 srcEEhits_(produceEcalhits_ ? consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcEEhits"))
0144 : edm::EDGetTokenT<EcalRecHitCollection>()),
0145 srcZDChits_(produceZDChits_ ? consumes<ZDCRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcZDChits"))
0146 : edm::EDGetTokenT<ZDCRecHitCollection>()),
0147 srcPixelhits_(producePixelhits_
0148 ? consumes<SiPixelRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcPixelhits"))
0149 : edm::EDGetTokenT<SiPixelRecHitCollection>()),
0150 srcTracks_(produceTracks_ ? consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("srcTracks"))
0151 : edm::EDGetTokenT<TrackCollection>()),
0152 srcPixelTracks_(producePixelTracks_
0153 ? consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("srcPixelTracks"))
0154 : edm::EDGetTokenT<TrackCollection>()),
0155 srcPF_(producePF_ ? consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("srcPF"))
0156 : edm::EDGetTokenT<reco::CandidateView>()),
0157 srcVertex_((produceTracks_ || producePixelTracks_)
0158 ? consumes<VertexCollection>(iConfig.getParameter<edm::InputTag>("srcVertex"))
0159 : edm::EDGetTokenT<VertexCollection>()),
0160 reuseTag_(reuseAny_ ? consumes<Centrality>(iConfig.getParameter<edm::InputTag>("srcReUse"))
0161 : edm::EDGetTokenT<Centrality>()),
0162 caloGeom_(produceEcalhits_ ? esConsumes<CaloGeometry, CaloGeometryRecord>()
0163 : edm::ESGetToken<CaloGeometry, CaloGeometryRecord>()),
0164 trackerGeom_(producePixelhits_ ? esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()
0165 : edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord>()),
0166 trackerTopo_(producePixelhits_ ? esConsumes<TrackerTopology, TrackerTopologyRcd>()
0167 : edm::ESGetToken<TrackerTopology, TrackerTopologyRcd>()) {
0168 produces<Centrality>();
0169 }
0170
0171
0172
0173
0174
0175
0176 void CentralityProducer::produce(edm::StreamID sid, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0177 auto creco = std::make_unique<Centrality>();
0178 Handle<Centrality> inputCentrality;
0179 if (reuseAny_)
0180 iEvent.getByToken(reuseTag_, inputCentrality);
0181
0182 if (produceHFhits_) {
0183 creco->etHFhitSumPlus_ = 0;
0184 creco->etHFhitSumMinus_ = 0;
0185 Handle<HFRecHitCollection> hits;
0186 iEvent.getByToken(srcHFhits_, hits);
0187 for (size_t ihit = 0; ihit < hits->size(); ++ihit) {
0188 const HFRecHit& rechit = (*hits)[ihit];
0189 if (rechit.id().ieta() > 0)
0190 creco->etHFhitSumPlus_ += rechit.energy();
0191 if (rechit.id().ieta() < 0)
0192 creco->etHFhitSumMinus_ += rechit.energy();
0193 }
0194 } else {
0195 if (reuseAny_) {
0196 creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
0197 creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
0198 }
0199 }
0200
0201 if (produceHFtowers_ || produceETmidRap_) {
0202 creco->etHFtowerSumPlus_ = 0;
0203 creco->etHFtowerSumMinus_ = 0;
0204 creco->etHFtowerSumECutPlus_ = 0;
0205 creco->etHFtowerSumECutMinus_ = 0;
0206 creco->etMidRapiditySum_ = 0;
0207
0208 Handle<CaloTowerCollection> towers;
0209 iEvent.getByToken(srcTowers_, towers);
0210
0211 for (size_t i = 0; i < towers->size(); ++i) {
0212 const CaloTower& tower = (*towers)[i];
0213 double eta = tower.eta();
0214 if (produceHFtowers_) {
0215 bool isHF = tower.ietaAbs() > (isPhase2_ ? 16 : 29);
0216 if (isHF && eta > 0) {
0217 creco->etHFtowerSumPlus_ += tower.pt();
0218 if (tower.energy() > 1.5)
0219 creco->etHFtowerSumECutPlus_ += tower.pt();
0220 if (eta > hfEtaCut_)
0221 creco->etHFtruncatedPlus_ += tower.pt();
0222 } else if (isHF && eta < 0) {
0223 creco->etHFtowerSumMinus_ += tower.pt();
0224 if (tower.energy() > 1.5)
0225 creco->etHFtowerSumECutMinus_ += tower.pt();
0226 if (eta < -hfEtaCut_)
0227 creco->etHFtruncatedMinus_ += tower.pt();
0228 }
0229 } else {
0230 if (reuseAny_) {
0231 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
0232 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
0233 creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
0234 creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
0235 creco->etHFtruncatedMinus_ = inputCentrality->EtHFtruncatedMinus();
0236 creco->etHFtruncatedPlus_ = inputCentrality->EtHFtruncatedPlus();
0237 }
0238 }
0239 if (produceETmidRap_) {
0240 if (std::abs(eta) < midRapidityRange_)
0241 creco->etMidRapiditySum_ += tower.pt() / (midRapidityRange_ * 2.);
0242 } else if (reuseAny_)
0243 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
0244 }
0245 } else {
0246 if (reuseAny_) {
0247 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
0248 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
0249 creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
0250 creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
0251 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
0252 }
0253 }
0254
0255 if (producePF_) {
0256 creco->etPFhfSumPlus_ = 0;
0257 creco->etPFhfSumMinus_ = 0;
0258 for (const auto& pf : iEvent.get(srcPF_)) {
0259 if (pf.pdgId() != 1 && pf.pdgId() != 2)
0260 continue;
0261 if (pf.eta() > 0)
0262 creco->etPFhfSumPlus_ += pf.pt();
0263 else
0264 creco->etPFhfSumMinus_ += pf.pt();
0265 }
0266 } else if (reuseAny_) {
0267 creco->etPFhfSumMinus_ = inputCentrality->EtPFhfSumMinus();
0268 creco->etPFhfSumPlus_ = inputCentrality->EtPFhfSumPlus();
0269 }
0270
0271 if (produceEcalhits_) {
0272 creco->etEESumPlus_ = 0;
0273 creco->etEESumMinus_ = 0;
0274 creco->etEBSum_ = 0;
0275
0276 Handle<EcalRecHitCollection> ebHits;
0277 Handle<EcalRecHitCollection> eeHits;
0278 iEvent.getByToken(srcEBhits_, ebHits);
0279 iEvent.getByToken(srcEEhits_, eeHits);
0280
0281 edm::ESHandle<CaloGeometry> cGeo = iSetup.getHandle(caloGeom_);
0282 for (unsigned int i = 0; i < ebHits->size(); ++i) {
0283 const EcalRecHit& hit = (*ebHits)[i];
0284 const GlobalPoint& pos = cGeo->getPosition(hit.id());
0285 double et = hit.energy() * (pos.perp() / pos.mag());
0286 creco->etEBSum_ += et;
0287 }
0288
0289 for (unsigned int i = 0; i < eeHits->size(); ++i) {
0290 const EcalRecHit& hit = (*eeHits)[i];
0291 const GlobalPoint& pos = cGeo->getPosition(hit.id());
0292 double et = hit.energy() * (pos.perp() / pos.mag());
0293 if (pos.z() > 0) {
0294 creco->etEESumPlus_ += et;
0295 } else {
0296 creco->etEESumMinus_ += et;
0297 }
0298 }
0299 } else {
0300 if (reuseAny_) {
0301 creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
0302 creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
0303 creco->etEBSum_ = inputCentrality->EtEBSum();
0304 }
0305 }
0306
0307 if (producePixelhits_) {
0308 edm::ESHandle<TrackerGeometry> tGeo = iSetup.getHandle(trackerGeom_);
0309 edm::ESHandle<TrackerTopology> topo = iSetup.getHandle(trackerTopo_);
0310 creco->pixelMultiplicity_ = 0;
0311 const SiPixelRecHitCollection* rechits;
0312 Handle<SiPixelRecHitCollection> rchts;
0313 iEvent.getByToken(srcPixelhits_, rchts);
0314 rechits = rchts.product();
0315 int nPixel = 0;
0316 int nPixel_plus = 0;
0317 int nPixel_minus = 0;
0318 for (SiPixelRecHitCollection::const_iterator it = rechits->begin(); it != rechits->end(); it++) {
0319 SiPixelRecHitCollection::DetSet hits = *it;
0320 DetId detId = DetId(hits.detId());
0321 SiPixelRecHitCollection::const_iterator recHitMatch = rechits->find(detId);
0322 const SiPixelRecHitCollection::DetSet recHitRange = *recHitMatch;
0323 for (SiPixelRecHitCollection::DetSet::const_iterator recHitIterator = recHitRange.begin();
0324 recHitIterator != recHitRange.end();
0325 ++recHitIterator) {
0326
0327 const SiPixelRecHit* recHit = &(*recHitIterator);
0328 const PixelGeomDetUnit* pixelLayer =
0329 dynamic_cast<const PixelGeomDetUnit*>(tGeo->idToDet(recHit->geographicalId()));
0330 GlobalPoint gpos = pixelLayer->toGlobal(recHit->localPosition());
0331 math::XYZVector rechitPos(gpos.x(), gpos.y(), gpos.z());
0332 double eta = rechitPos.eta();
0333 int clusterSize = recHit->cluster()->size();
0334 unsigned layer = topo->layer(detId);
0335 if (doPixelCut_) {
0336 if (detId.det() == DetId::Tracker && detId.subdetId() == PixelSubdetector::PixelBarrel) {
0337 double abeta = std::abs(eta);
0338 if (layer == 1) {
0339 if (18 * abeta - 40 > clusterSize)
0340 continue;
0341 } else if (layer == 2) {
0342 if (6 * abeta - 7.2 > clusterSize)
0343 continue;
0344 } else if (layer == 3 || layer == 4) {
0345 if (4 * abeta - 2.4 > clusterSize)
0346 continue;
0347 }
0348 }
0349 }
0350 nPixel++;
0351 if (eta >= 0)
0352 nPixel_plus++;
0353 else if (eta < 0)
0354 nPixel_minus++;
0355 }
0356 }
0357 creco->pixelMultiplicity_ = nPixel;
0358 creco->pixelMultiplicityPlus_ = nPixel_plus;
0359 creco->pixelMultiplicityMinus_ = nPixel_minus;
0360 } else {
0361 if (reuseAny_) {
0362 creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
0363 creco->pixelMultiplicityPlus_ = inputCentrality->multiplicityPixelPlus();
0364 creco->pixelMultiplicityMinus_ = inputCentrality->multiplicityPixelMinus();
0365 }
0366 }
0367
0368 if (produceTracks_) {
0369 double vx = -999.;
0370 double vy = -999.;
0371 double vz = -999.;
0372 double vxError = -999.;
0373 double vyError = -999.;
0374 double vzError = -999.;
0375 math::XYZVector vtxPos(0, 0, 0);
0376
0377 Handle<VertexCollection> recoVertices;
0378 iEvent.getByToken(srcVertex_, recoVertices);
0379 unsigned int daughter = 0;
0380 int greatestvtx = 0;
0381
0382 for (unsigned int i = 0; i < recoVertices->size(); ++i) {
0383 daughter = (*recoVertices)[i].tracksSize();
0384 if (daughter > (*recoVertices)[greatestvtx].tracksSize())
0385 greatestvtx = i;
0386 }
0387
0388 if (!recoVertices->empty()) {
0389 vx = (*recoVertices)[greatestvtx].position().x();
0390 vy = (*recoVertices)[greatestvtx].position().y();
0391 vz = (*recoVertices)[greatestvtx].position().z();
0392 vxError = (*recoVertices)[greatestvtx].xError();
0393 vyError = (*recoVertices)[greatestvtx].yError();
0394 vzError = (*recoVertices)[greatestvtx].zError();
0395 }
0396
0397 vtxPos = math::XYZVector(vx, vy, vz);
0398
0399 Handle<TrackCollection> tracks;
0400 iEvent.getByToken(srcTracks_, tracks);
0401 int nTracks = 0;
0402
0403 double trackCounter = 0;
0404 double trackCounterEta = 0;
0405 double trackCounterEtaPt = 0;
0406
0407 for (unsigned int i = 0; i < tracks->size(); ++i) {
0408 const Track& track = (*tracks)[i];
0409 if (useQuality_ && !track.quality(trackQuality_))
0410 continue;
0411
0412 if (track.pt() > trackPtCut_)
0413 trackCounter++;
0414 if (std::abs(track.eta()) < trackEtaCut_) {
0415 trackCounterEta++;
0416 if (track.pt() > trackPtCut_)
0417 trackCounterEtaPt++;
0418 }
0419
0420 math::XYZPoint v1(vx, vy, vz);
0421 double dz = track.dz(v1);
0422 double dzsigma2 = track.dzError() * track.dzError() + vzError * vzError;
0423 double dxy = track.dxy(v1);
0424 double dxysigma2 = track.dxyError() * track.dxyError() + vxError * vyError;
0425
0426 const double pterrcut = 0.1;
0427 const double dzrelcut = 3.0;
0428 const double dxyrelcut = 3.0;
0429
0430 if (track.quality(trackQuality_) && track.pt() > 0.4 && std::abs(track.eta()) < 2.4 &&
0431 track.ptError() / track.pt() < pterrcut && dz * dz < dzrelcut * dzrelcut * dzsigma2 &&
0432 dxy * dxy < dxyrelcut * dxyrelcut * dxysigma2) {
0433 nTracks++;
0434 }
0435 }
0436
0437 creco->trackMultiplicity_ = nTracks;
0438 creco->ntracksPtCut_ = trackCounter;
0439 creco->ntracksEtaCut_ = trackCounterEta;
0440 creco->ntracksEtaPtCut_ = trackCounterEtaPt;
0441
0442 } else {
0443 if (reuseAny_) {
0444 creco->trackMultiplicity_ = inputCentrality->Ntracks();
0445 creco->ntracksPtCut_ = inputCentrality->NtracksPtCut();
0446 creco->ntracksEtaCut_ = inputCentrality->NtracksEtaCut();
0447 creco->ntracksEtaPtCut_ = inputCentrality->NtracksEtaPtCut();
0448 }
0449 }
0450
0451 if (producePixelTracks_) {
0452 Handle<TrackCollection> pixeltracks;
0453 iEvent.getByToken(srcPixelTracks_, pixeltracks);
0454 int nPixelTracks = pixeltracks->size();
0455 int nPixelTracksPlus = 0;
0456 int nPixelTracksMinus = 0;
0457
0458 for (auto const& track : *pixeltracks) {
0459 if (track.eta() < 0)
0460 nPixelTracksMinus++;
0461 else
0462 nPixelTracksPlus++;
0463 }
0464 creco->nPixelTracks_ = nPixelTracks;
0465 creco->nPixelTracksPlus_ = nPixelTracksPlus;
0466 creco->nPixelTracksMinus_ = nPixelTracksMinus;
0467 } else {
0468 if (reuseAny_) {
0469 creco->nPixelTracks_ = inputCentrality->NpixelTracks();
0470 creco->nPixelTracksPlus_ = inputCentrality->NpixelTracksPlus();
0471 creco->nPixelTracksMinus_ = inputCentrality->NpixelTracksMinus();
0472 }
0473 }
0474
0475 if (produceZDChits_) {
0476 creco->zdcSumPlus_ = 0;
0477 creco->zdcSumMinus_ = 0;
0478
0479 Handle<ZDCRecHitCollection> hits;
0480 bool zdcAvailable = iEvent.getByToken(srcZDChits_, hits);
0481 if (zdcAvailable) {
0482 for (size_t ihit = 0; ihit < hits->size(); ++ihit) {
0483 const ZDCRecHit& rechit = (*hits)[ihit];
0484 if (rechit.id().zside() > 0) {
0485 if (lowGainZDC_) {
0486 creco->zdcSumPlus_ += rechit.lowGainEnergy();
0487 } else {
0488 creco->zdcSumPlus_ += rechit.energy();
0489 }
0490 }
0491 if (rechit.id().zside() < 0) {
0492 if (lowGainZDC_) {
0493 creco->zdcSumMinus_ += rechit.lowGainEnergy();
0494 } else {
0495 creco->zdcSumMinus_ += rechit.energy();
0496 }
0497 }
0498 }
0499 } else {
0500 creco->zdcSumPlus_ = -9;
0501 creco->zdcSumMinus_ = -9;
0502 }
0503 } else {
0504 if (reuseAny_) {
0505 creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
0506 creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
0507 }
0508 }
0509
0510 iEvent.put(std::move(creco));
0511 }
0512
0513 void CentralityProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0514 edm::ParameterSetDescription desc;
0515 desc.add<bool>("produceHFhits", true);
0516 desc.add<bool>("produceHFtowers", true);
0517 desc.add<bool>("produceEcalhits", true);
0518 desc.add<bool>("produceZDChits", true);
0519 desc.add<bool>("produceETmidRapidity", true);
0520 desc.add<bool>("producePixelhits", true);
0521 desc.add<bool>("produceTracks", true);
0522 desc.add<bool>("producePixelTracks", true);
0523 desc.add<bool>("producePF", true);
0524 desc.add<bool>("reUseCentrality", false);
0525 desc.add<edm::InputTag>("srcHFhits", edm::InputTag("hfreco"));
0526 desc.add<edm::InputTag>("srcTowers", edm::InputTag("towerMaker"));
0527 desc.add<edm::InputTag>("srcEBhits", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
0528 desc.add<edm::InputTag>("srcEEhits", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
0529 desc.add<edm::InputTag>("srcZDChits", edm::InputTag("zdcreco"));
0530 desc.add<edm::InputTag>("srcPixelhits", edm::InputTag("siPixelRecHits"));
0531 desc.add<edm::InputTag>("srcTracks", edm::InputTag("hiGeneralTracks"));
0532 desc.add<edm::InputTag>("srcVertex", edm::InputTag("hiSelectedVertex"));
0533 desc.add<edm::InputTag>("srcReUse", edm::InputTag("hiCentrality"));
0534 desc.add<edm::InputTag>("srcPixelTracks", edm::InputTag("hiPixel3PrimTracks"));
0535 desc.add<edm::InputTag>("srcPF", edm::InputTag("particleFlow"));
0536 desc.add<bool>("doPixelCut", true);
0537 desc.add<bool>("useQuality", true);
0538 desc.add<string>("trackQuality", "highPurity");
0539 desc.add<double>("trackEtaCut", 2);
0540 desc.add<double>("trackPtCut", 1);
0541 desc.add<double>("hfEtaCut", 4)->setComment("hf above the absolute value of this cut is used");
0542 desc.add<double>("midRapidityRange", 1);
0543 desc.add<bool>("lowGainZDC", true);
0544 desc.add<bool>("isPhase2", false);
0545
0546 descriptions.addDefault(desc);
0547 }
0548
0549
0550 void CentralityProducer::beginJob() {}
0551
0552
0553 void CentralityProducer::endJob() {}
0554
0555
0556 DEFINE_FWK_MODULE(CentralityProducer);
0557
0558 }