CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
reco::CentralityProducer Class Reference
Inheritance diagram for reco::CentralityProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CentralityProducer (const edm::ParameterSet &)
 
 ~CentralityProducer () override=default
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

const edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeom_
 
const bool doPixelCut_
 
const double hfEtaCut_
 
const bool isPhase2_
 
const bool lowGainZDC_
 
const double midRapidityRange_
 
const bool produceEcalhits_
 
const bool produceETmidRap_
 
const bool produceHFhits_
 
const bool produceHFtowers_
 
const bool producePF_
 
const bool producePixelhits_
 
const bool producePixelTracks_
 
const bool produceTracks_
 
const bool produceZDChits_
 
const bool reuseAny_
 
const edm::EDGetTokenT< CentralityreuseTag_
 
const edm::EDGetTokenT< EcalRecHitCollectionsrcEBhits_
 
const edm::EDGetTokenT< EcalRecHitCollectionsrcEEhits_
 
const edm::EDGetTokenT< HFRecHitCollectionsrcHFhits_
 
const edm::EDGetTokenT< reco::CandidateViewsrcPF_
 
const edm::EDGetTokenT< SiPixelRecHitCollectionsrcPixelhits_
 
const edm::EDGetTokenT< TrackCollectionsrcPixelTracks_
 
const edm::EDGetTokenT< CaloTowerCollectionsrcTowers_
 
const edm::EDGetTokenT< TrackCollectionsrcTracks_
 
const edm::EDGetTokenT< VertexCollectionsrcVertex_
 
const edm::EDGetTokenT< ZDCRecHitCollectionsrcZDChits_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeom_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopo_
 
const double trackEtaCut_
 
const double trackPtCut_
 
const reco::TrackBase::TrackQuality trackQuality_
 
const bool useQuality_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 53 of file CentralityProducer.cc.

Constructor & Destructor Documentation

◆ CentralityProducer()

reco::CentralityProducer::CentralityProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 116 of file CentralityProducer.cc.

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")),
136  srcHFhits_(produceHFhits_ ? consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcHFhits"))
139  ? consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("srcTowers"))
141  srcEBhits_(produceEcalhits_ ? consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcEBhits"))
143  srcEEhits_(produceEcalhits_ ? consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcEEhits"))
145  srcZDChits_(produceZDChits_ ? consumes<ZDCRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcZDChits"))
148  ? consumes<SiPixelRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcPixelhits"))
150  srcTracks_(produceTracks_ ? consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("srcTracks"))
153  ? consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("srcPixelTracks"))
155  srcPF_(producePF_ ? consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("srcPF"))
158  ? consumes<VertexCollection>(iConfig.getParameter<edm::InputTag>("srcVertex"))
160  reuseTag_(reuseAny_ ? consumes<Centrality>(iConfig.getParameter<edm::InputTag>("srcReUse"))
162  caloGeom_(produceEcalhits_ ? esConsumes<CaloGeometry, CaloGeometryRecord>()
164  trackerGeom_(producePixelhits_ ? esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()
166  trackerTopo_(producePixelhits_ ? esConsumes<TrackerTopology, TrackerTopologyRcd>()
168  produces<Centrality>();
169  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< EcalRecHitCollection > srcEEhits_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeom_
const edm::EDGetTokenT< TrackCollection > srcTracks_
const edm::EDGetTokenT< SiPixelRecHitCollection > srcPixelhits_
const edm::EDGetTokenT< CaloTowerCollection > srcTowers_
const reco::TrackBase::TrackQuality trackQuality_
const edm::EDGetTokenT< VertexCollection > srcVertex_
const edm::EDGetTokenT< reco::CandidateView > srcPF_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopo_
const edm::EDGetTokenT< ZDCRecHitCollection > srcZDChits_
const edm::EDGetTokenT< TrackCollection > srcPixelTracks_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeom_
const edm::EDGetTokenT< HFRecHitCollection > srcHFhits_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
const edm::EDGetTokenT< Centrality > reuseTag_
const edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_

◆ ~CentralityProducer()

reco::CentralityProducer::~CentralityProducer ( )
overridedefault

Member Function Documentation

◆ beginJob()

void reco::CentralityProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 550 of file CentralityProducer.cc.

550 {}

◆ endJob()

void reco::CentralityProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 553 of file CentralityProducer.cc.

553 {}

◆ fillDescriptions()

void reco::CentralityProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 513 of file CentralityProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

513  {
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);
525  desc.add<edm::InputTag>("srcHFhits", edm::InputTag("hfreco"));
526  desc.add<edm::InputTag>("srcTowers", edm::InputTag("towerMaker"));
527  desc.add<edm::InputTag>("srcEBhits", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
528  desc.add<edm::InputTag>("srcEEhits", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
529  desc.add<edm::InputTag>("srcZDChits", edm::InputTag("zdcreco"));
530  desc.add<edm::InputTag>("srcPixelhits", edm::InputTag("siPixelRecHits"));
531  desc.add<edm::InputTag>("srcTracks", edm::InputTag("hiGeneralTracks"));
532  desc.add<edm::InputTag>("srcVertex", edm::InputTag("hiSelectedVertex"));
533  desc.add<edm::InputTag>("srcReUse", edm::InputTag("hiCentrality"));
534  desc.add<edm::InputTag>("srcPixelTracks", edm::InputTag("hiPixel3PrimTracks"));
535  desc.add<edm::InputTag>("srcPF", edm::InputTag("particleFlow"));
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);
545 
546  descriptions.addDefault(desc);
547  }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void reco::CentralityProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 176 of file CentralityProducer.cc.

References funct::abs(), edmNew::DetSet< T >::begin(), edmNew::DetSetVector< T >::begin(), caloGeom_, nano_mu_local_reco_cff::clusterSize, hcalRecHitTable_cff::detId, doPixelCut_, PVValHelper::dxy, PVValHelper::dz, edmNew::DetSet< T >::end(), edmNew::DetSetVector< T >::end(), CaloRecHit::energy(), l1tnanotables_cff::et, PVValHelper::eta, edmNew::DetSetVector< T >::find(), edm::EventSetup::getHandle(), CaloGeometry::getPosition(), hfEtaCut_, hfClusterShapes_cfi::hits, mps_fire::i, ZDCRecHit::id(), HFRecHit::id(), hit::id, TrackerGeometry::idToDet(), HcalDetId::ieta(), iEvent, HcalObjRepresent::isHF(), isPhase2_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, TrackerTopology::layer(), ZDCRecHit::lowGainEnergy(), lowGainZDC_, midRapidityRange_, eostools::move(), beamSpotPI::nTracks, packedPFCandidateRefMixer_cfi::pf, PixelSubdetector::PixelBarrel, produceEcalhits_, produceETmidRap_, produceHFhits_, produceHFtowers_, producePF_, producePixelhits_, producePixelTracks_, produceTracks_, produceZDChits_, edm::Handle< T >::product(), rpcPointValidation_cfi::recHit, reuseAny_, reuseTag_, edm::SortedCollection< T, SORT >::size(), srcEBhits_, srcEEhits_, srcHFhits_, srcPF_, srcPixelhits_, srcPixelTracks_, srcTowers_, srcTracks_, srcVertex_, srcZDChits_, GeomDet::toGlobal(), l1tHGCalTowerProducer_cfi::tower, HLT_2024v14_cff::towers, HLT_2024v14_cff::track, DetId::Tracker, trackerGeom_, trackerTopo_, trackEtaCut_, trackPtCut_, trackQuality_, DiMuonV_cfg::tracks, run3scouting_cff::tracksSize, useQuality_, btvMC_cff::vx, btvMC_cff::vy, btvMC_cff::vz, and HcalZDCDetId::zside().

176  {
177  auto creco = std::make_unique<Centrality>();
178  Handle<Centrality> inputCentrality;
179  if (reuseAny_)
180  iEvent.getByToken(reuseTag_, inputCentrality);
181 
182  if (produceHFhits_) {
183  creco->etHFhitSumPlus_ = 0;
184  creco->etHFhitSumMinus_ = 0;
186  iEvent.getByToken(srcHFhits_, hits);
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();
193  }
194  } else {
195  if (reuseAny_) {
196  creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
197  creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
198  }
199  }
200 
202  creco->etHFtowerSumPlus_ = 0;
203  creco->etHFtowerSumMinus_ = 0;
204  creco->etHFtowerSumECutPlus_ = 0;
205  creco->etHFtowerSumECutMinus_ = 0;
206  creco->etMidRapiditySum_ = 0;
207 
209  iEvent.getByToken(srcTowers_, towers);
210 
211  for (size_t i = 0; i < towers->size(); ++i) {
212  const CaloTower& tower = (*towers)[i];
213  double eta = tower.eta();
214  if (produceHFtowers_) {
215  bool isHF = tower.ietaAbs() > (isPhase2_ ? 16 : 29);
216  if (isHF && eta > 0) {
217  creco->etHFtowerSumPlus_ += tower.pt();
218  if (tower.energy() > 1.5)
219  creco->etHFtowerSumECutPlus_ += tower.pt();
220  if (eta > hfEtaCut_)
221  creco->etHFtruncatedPlus_ += tower.pt();
222  } else if (isHF && eta < 0) {
223  creco->etHFtowerSumMinus_ += tower.pt();
224  if (tower.energy() > 1.5)
225  creco->etHFtowerSumECutMinus_ += tower.pt();
226  if (eta < -hfEtaCut_)
227  creco->etHFtruncatedMinus_ += tower.pt();
228  }
229  } else {
230  if (reuseAny_) {
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();
237  }
238  }
239  if (produceETmidRap_) {
241  creco->etMidRapiditySum_ += tower.pt() / (midRapidityRange_ * 2.);
242  } else if (reuseAny_)
243  creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
244  }
245  } else {
246  if (reuseAny_) {
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();
252  }
253  }
254 
255  if (producePF_) {
256  creco->etPFhfSumPlus_ = 0;
257  creco->etPFhfSumMinus_ = 0;
258  for (const auto& pf : iEvent.get(srcPF_)) {
259  if (pf.pdgId() != 1 && pf.pdgId() != 2)
260  continue;
261  if (pf.eta() > 0)
262  creco->etPFhfSumPlus_ += pf.pt();
263  else
264  creco->etPFhfSumMinus_ += pf.pt();
265  }
266  } else if (reuseAny_) {
267  creco->etPFhfSumMinus_ = inputCentrality->EtPFhfSumMinus();
268  creco->etPFhfSumPlus_ = inputCentrality->EtPFhfSumPlus();
269  }
270 
271  if (produceEcalhits_) {
272  creco->etEESumPlus_ = 0;
273  creco->etEESumMinus_ = 0;
274  creco->etEBSum_ = 0;
275 
278  iEvent.getByToken(srcEBhits_, ebHits);
279  iEvent.getByToken(srcEEhits_, eeHits);
280 
282  for (unsigned int i = 0; i < ebHits->size(); ++i) {
283  const EcalRecHit& hit = (*ebHits)[i];
284  const GlobalPoint& pos = cGeo->getPosition(hit.id());
285  double et = hit.energy() * (pos.perp() / pos.mag());
286  creco->etEBSum_ += et;
287  }
288 
289  for (unsigned int i = 0; i < eeHits->size(); ++i) {
290  const EcalRecHit& hit = (*eeHits)[i];
291  const GlobalPoint& pos = cGeo->getPosition(hit.id());
292  double et = hit.energy() * (pos.perp() / pos.mag());
293  if (pos.z() > 0) {
294  creco->etEESumPlus_ += et;
295  } else {
296  creco->etEESumMinus_ += et;
297  }
298  }
299  } else {
300  if (reuseAny_) {
301  creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
302  creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
303  creco->etEBSum_ = inputCentrality->EtEBSum();
304  }
305  }
306 
307  if (producePixelhits_) {
310  creco->pixelMultiplicity_ = 0;
311  const SiPixelRecHitCollection* rechits;
313  iEvent.getByToken(srcPixelhits_, rchts);
314  rechits = rchts.product();
315  int nPixel = 0;
316  int nPixel_plus = 0;
317  int nPixel_minus = 0;
318  for (SiPixelRecHitCollection::const_iterator it = rechits->begin(); it != rechits->end(); it++) {
320  DetId detId = DetId(hits.detId());
321  SiPixelRecHitCollection::const_iterator recHitMatch = rechits->find(detId);
322  const SiPixelRecHitCollection::DetSet recHitRange = *recHitMatch;
323  for (SiPixelRecHitCollection::DetSet::const_iterator recHitIterator = recHitRange.begin();
324  recHitIterator != recHitRange.end();
325  ++recHitIterator) {
326  // add selection if needed, now all hits.
327  const SiPixelRecHit* recHit = &(*recHitIterator);
328  const PixelGeomDetUnit* pixelLayer =
329  dynamic_cast<const PixelGeomDetUnit*>(tGeo->idToDet(recHit->geographicalId()));
330  GlobalPoint gpos = pixelLayer->toGlobal(recHit->localPosition());
331  math::XYZVector rechitPos(gpos.x(), gpos.y(), gpos.z());
332  double eta = rechitPos.eta();
333  int clusterSize = recHit->cluster()->size();
334  unsigned layer = topo->layer(detId);
335  if (doPixelCut_) {
336  if (detId.det() == DetId::Tracker && detId.subdetId() == PixelSubdetector::PixelBarrel) {
337  double abeta = std::abs(eta);
338  if (layer == 1) {
339  if (18 * abeta - 40 > clusterSize)
340  continue;
341  } else if (layer == 2) {
342  if (6 * abeta - 7.2 > clusterSize)
343  continue;
344  } else if (layer == 3 || layer == 4) {
345  if (4 * abeta - 2.4 > clusterSize)
346  continue;
347  }
348  }
349  }
350  nPixel++;
351  if (eta >= 0)
352  nPixel_plus++;
353  else if (eta < 0)
354  nPixel_minus++;
355  }
356  }
357  creco->pixelMultiplicity_ = nPixel;
358  creco->pixelMultiplicityPlus_ = nPixel_plus;
359  creco->pixelMultiplicityMinus_ = nPixel_minus;
360  } else {
361  if (reuseAny_) {
362  creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
363  creco->pixelMultiplicityPlus_ = inputCentrality->multiplicityPixelPlus();
364  creco->pixelMultiplicityMinus_ = inputCentrality->multiplicityPixelMinus();
365  }
366  }
367 
368  if (produceTracks_) {
369  double vx = -999.;
370  double vy = -999.;
371  double vz = -999.;
372  double vxError = -999.;
373  double vyError = -999.;
374  double vzError = -999.;
375  math::XYZVector vtxPos(0, 0, 0);
376 
377  Handle<VertexCollection> recoVertices;
378  iEvent.getByToken(srcVertex_, recoVertices);
379  unsigned int daughter = 0;
380  int greatestvtx = 0;
381 
382  for (unsigned int i = 0; i < recoVertices->size(); ++i) {
383  daughter = (*recoVertices)[i].tracksSize();
384  if (daughter > (*recoVertices)[greatestvtx].tracksSize())
385  greatestvtx = i;
386  }
387 
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();
395  }
396 
397  vtxPos = math::XYZVector(vx, vy, vz);
398 
400  iEvent.getByToken(srcTracks_, tracks);
401  int nTracks = 0;
402 
403  double trackCounter = 0;
404  double trackCounterEta = 0;
405  double trackCounterEtaPt = 0;
406 
407  for (unsigned int i = 0; i < tracks->size(); ++i) {
408  const Track& track = (*tracks)[i];
409  if (useQuality_ && !track.quality(trackQuality_))
410  continue;
411 
412  if (track.pt() > trackPtCut_)
413  trackCounter++;
414  if (std::abs(track.eta()) < trackEtaCut_) {
415  trackCounterEta++;
416  if (track.pt() > trackPtCut_)
417  trackCounterEtaPt++;
418  }
419 
420  math::XYZPoint v1(vx, vy, vz);
421  double dz = track.dz(v1);
422  double dzsigma2 = track.dzError() * track.dzError() + vzError * vzError;
423  double dxy = track.dxy(v1);
424  double dxysigma2 = track.dxyError() * track.dxyError() + vxError * vyError;
425 
426  const double pterrcut = 0.1;
427  const double dzrelcut = 3.0;
428  const double dxyrelcut = 3.0;
429 
430  if (track.quality(trackQuality_) && track.pt() > 0.4 && std::abs(track.eta()) < 2.4 &&
431  track.ptError() / track.pt() < pterrcut && dz * dz < dzrelcut * dzrelcut * dzsigma2 &&
432  dxy * dxy < dxyrelcut * dxyrelcut * dxysigma2) {
433  nTracks++;
434  }
435  }
436 
437  creco->trackMultiplicity_ = nTracks;
438  creco->ntracksPtCut_ = trackCounter;
439  creco->ntracksEtaCut_ = trackCounterEta;
440  creco->ntracksEtaPtCut_ = trackCounterEtaPt;
441 
442  } else {
443  if (reuseAny_) {
444  creco->trackMultiplicity_ = inputCentrality->Ntracks();
445  creco->ntracksPtCut_ = inputCentrality->NtracksPtCut();
446  creco->ntracksEtaCut_ = inputCentrality->NtracksEtaCut();
447  creco->ntracksEtaPtCut_ = inputCentrality->NtracksEtaPtCut();
448  }
449  }
450 
451  if (producePixelTracks_) {
452  Handle<TrackCollection> pixeltracks;
453  iEvent.getByToken(srcPixelTracks_, pixeltracks);
454  int nPixelTracks = pixeltracks->size();
455  int nPixelTracksPlus = 0;
456  int nPixelTracksMinus = 0;
457 
458  for (auto const& track : *pixeltracks) {
459  if (track.eta() < 0)
460  nPixelTracksMinus++;
461  else
462  nPixelTracksPlus++;
463  }
464  creco->nPixelTracks_ = nPixelTracks;
465  creco->nPixelTracksPlus_ = nPixelTracksPlus;
466  creco->nPixelTracksMinus_ = nPixelTracksMinus;
467  } else {
468  if (reuseAny_) {
469  creco->nPixelTracks_ = inputCentrality->NpixelTracks();
470  creco->nPixelTracksPlus_ = inputCentrality->NpixelTracksPlus();
471  creco->nPixelTracksMinus_ = inputCentrality->NpixelTracksMinus();
472  }
473  }
474 
475  if (produceZDChits_) {
476  creco->zdcSumPlus_ = 0;
477  creco->zdcSumMinus_ = 0;
478 
480  bool zdcAvailable = iEvent.getByToken(srcZDChits_, hits);
481  if (zdcAvailable) {
482  for (size_t ihit = 0; ihit < hits->size(); ++ihit) {
483  const ZDCRecHit& rechit = (*hits)[ihit];
484  if (rechit.id().zside() > 0) {
485  if (lowGainZDC_) {
486  creco->zdcSumPlus_ += rechit.lowGainEnergy();
487  } else {
488  creco->zdcSumPlus_ += rechit.energy();
489  }
490  }
491  if (rechit.id().zside() < 0) {
492  if (lowGainZDC_) {
493  creco->zdcSumMinus_ += rechit.lowGainEnergy();
494  } else {
495  creco->zdcSumMinus_ += rechit.energy();
496  }
497  }
498  }
499  } else {
500  creco->zdcSumPlus_ = -9;
501  creco->zdcSumMinus_ = -9;
502  }
503  } else {
504  if (reuseAny_) {
505  creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
506  creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
507  }
508  }
509 
510  iEvent.put(std::move(creco));
511  }
const edm::EDGetTokenT< EcalRecHitCollection > srcEEhits_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeom_
const edm::EDGetTokenT< TrackCollection > srcTracks_
T z() const
Definition: PV3DBase.h:61
const edm::EDGetTokenT< SiPixelRecHitCollection > srcPixelhits_
size_type size() const
T const * product() const
Definition: Handle.h:70
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
Definition: CaloRecHit.h:29
const_iterator end(bool update=false) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
constexpr HcalDetId id() const
Definition: HFRecHit.h:26
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
float lowGainEnergy() const
Definition: ZDCRecHit.h:20
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopo_
const edm::EDGetTokenT< ZDCRecHitCollection > srcZDChits_
const edm::EDGetTokenT< TrackCollection > srcPixelTracks_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeom_
const edm::EDGetTokenT< HFRecHitCollection > srcHFhits_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
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.
Definition: GeomDet.h:49
unsigned int id
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
const_iterator begin(bool update=false) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const edm::EDGetTokenT< Centrality > reuseTag_
bool isHF(int etabin, int depth)
HcalZDCDetId id() const
get the id
Definition: ZDCRecHit.h:18
iterator end()
Definition: DetSetNew.h:53
const_iterator find(id_type i, bool update=false) const
const edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
constexpr int32_t zside() const
get the z-side of the cell (1/-1)
Definition: HcalZDCDetId.h:90
def move(src, dest)
Definition: eostools.py:511
Our base class.
Definition: SiPixelRecHit.h:23
iterator begin()
Definition: DetSetNew.h:51

Member Data Documentation

◆ caloGeom_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> reco::CentralityProducer::caloGeom_
private

Definition at line 100 of file CentralityProducer.cc.

Referenced by produce().

◆ doPixelCut_

const bool reco::CentralityProducer::doPixelCut_
private

Definition at line 73 of file CentralityProducer.cc.

Referenced by produce().

◆ hfEtaCut_

const double reco::CentralityProducer::hfEtaCut_
private

Definition at line 81 of file CentralityProducer.cc.

Referenced by produce().

◆ isPhase2_

const bool reco::CentralityProducer::isPhase2_
private

Definition at line 83 of file CentralityProducer.cc.

Referenced by produce().

◆ lowGainZDC_

const bool reco::CentralityProducer::lowGainZDC_
private

Definition at line 70 of file CentralityProducer.cc.

Referenced by produce().

◆ midRapidityRange_

const double reco::CentralityProducer::midRapidityRange_
private

Definition at line 78 of file CentralityProducer.cc.

Referenced by produce().

◆ produceEcalhits_

const bool reco::CentralityProducer::produceEcalhits_
private

Definition at line 68 of file CentralityProducer.cc.

Referenced by produce().

◆ produceETmidRap_

const bool reco::CentralityProducer::produceETmidRap_
private

Definition at line 71 of file CentralityProducer.cc.

Referenced by produce().

◆ produceHFhits_

const bool reco::CentralityProducer::produceHFhits_
private

Definition at line 66 of file CentralityProducer.cc.

Referenced by produce().

◆ produceHFtowers_

const bool reco::CentralityProducer::produceHFtowers_
private

Definition at line 67 of file CentralityProducer.cc.

Referenced by produce().

◆ producePF_

const bool reco::CentralityProducer::producePF_
private

Definition at line 76 of file CentralityProducer.cc.

Referenced by produce().

◆ producePixelhits_

const bool reco::CentralityProducer::producePixelhits_
private

Definition at line 72 of file CentralityProducer.cc.

Referenced by produce().

◆ producePixelTracks_

const bool reco::CentralityProducer::producePixelTracks_
private

Definition at line 75 of file CentralityProducer.cc.

Referenced by produce().

◆ produceTracks_

const bool reco::CentralityProducer::produceTracks_
private

Definition at line 74 of file CentralityProducer.cc.

Referenced by produce().

◆ produceZDChits_

const bool reco::CentralityProducer::produceZDChits_
private

Definition at line 69 of file CentralityProducer.cc.

Referenced by produce().

◆ reuseAny_

const bool reco::CentralityProducer::reuseAny_
private

Definition at line 84 of file CentralityProducer.cc.

Referenced by produce().

◆ reuseTag_

const edm::EDGetTokenT<Centrality> reco::CentralityProducer::reuseTag_
private

Definition at line 98 of file CentralityProducer.cc.

Referenced by produce().

◆ srcEBhits_

const edm::EDGetTokenT<EcalRecHitCollection> reco::CentralityProducer::srcEBhits_
private

Definition at line 90 of file CentralityProducer.cc.

Referenced by produce().

◆ srcEEhits_

const edm::EDGetTokenT<EcalRecHitCollection> reco::CentralityProducer::srcEEhits_
private

Definition at line 91 of file CentralityProducer.cc.

Referenced by produce().

◆ srcHFhits_

const edm::EDGetTokenT<HFRecHitCollection> reco::CentralityProducer::srcHFhits_
private

Definition at line 88 of file CentralityProducer.cc.

Referenced by produce().

◆ srcPF_

const edm::EDGetTokenT<reco::CandidateView> reco::CentralityProducer::srcPF_
private

Definition at line 96 of file CentralityProducer.cc.

Referenced by produce().

◆ srcPixelhits_

const edm::EDGetTokenT<SiPixelRecHitCollection> reco::CentralityProducer::srcPixelhits_
private

Definition at line 93 of file CentralityProducer.cc.

Referenced by produce().

◆ srcPixelTracks_

const edm::EDGetTokenT<TrackCollection> reco::CentralityProducer::srcPixelTracks_
private

Definition at line 95 of file CentralityProducer.cc.

Referenced by produce().

◆ srcTowers_

const edm::EDGetTokenT<CaloTowerCollection> reco::CentralityProducer::srcTowers_
private

Definition at line 89 of file CentralityProducer.cc.

Referenced by produce().

◆ srcTracks_

const edm::EDGetTokenT<TrackCollection> reco::CentralityProducer::srcTracks_
private

Definition at line 94 of file CentralityProducer.cc.

Referenced by produce().

◆ srcVertex_

const edm::EDGetTokenT<VertexCollection> reco::CentralityProducer::srcVertex_
private

Definition at line 97 of file CentralityProducer.cc.

Referenced by produce().

◆ srcZDChits_

const edm::EDGetTokenT<ZDCRecHitCollection> reco::CentralityProducer::srcZDChits_
private

Definition at line 92 of file CentralityProducer.cc.

Referenced by produce().

◆ trackerGeom_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> reco::CentralityProducer::trackerGeom_
private

Definition at line 101 of file CentralityProducer.cc.

Referenced by produce().

◆ trackerTopo_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> reco::CentralityProducer::trackerTopo_
private

Definition at line 102 of file CentralityProducer.cc.

Referenced by produce().

◆ trackEtaCut_

const double reco::CentralityProducer::trackEtaCut_
private

Definition at line 80 of file CentralityProducer.cc.

Referenced by produce().

◆ trackPtCut_

const double reco::CentralityProducer::trackPtCut_
private

Definition at line 79 of file CentralityProducer.cc.

Referenced by produce().

◆ trackQuality_

const reco::TrackBase::TrackQuality reco::CentralityProducer::trackQuality_
private

Definition at line 86 of file CentralityProducer.cc.

Referenced by produce().

◆ useQuality_

const bool reco::CentralityProducer::useQuality_
private

Definition at line 85 of file CentralityProducer.cc.

Referenced by produce().