CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const 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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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,
CaloGeometryRecord
caloGeom_
 
const bool doPixelCut_
 
const double hfEtaCut_
 
const bool lowGainZDC_
 
const double midRapidityRange_
 
const bool produceEcalhits_
 
const bool produceETmidRap_
 
const bool produceHFhits_
 
const bool produceHFtowers_
 
const bool producePixelhits_
 
const bool producePixelTracks_
 
const bool produceTracks_
 
const bool produceZDChits_
 
const bool reuseAny_
 
const edm::EDGetTokenT
< Centrality
reuseTag_
 
const edm::EDGetTokenT
< EcalRecHitCollection
srcEBhits_
 
const edm::EDGetTokenT
< EcalRecHitCollection
srcEEhits_
 
const edm::EDGetTokenT
< HFRecHitCollection
srcHFhits_
 
const edm::EDGetTokenT
< SiPixelRecHitCollection
srcPixelhits_
 
const edm::EDGetTokenT
< TrackCollection
srcPixelTracks_
 
const edm::EDGetTokenT
< CaloTowerCollection
srcTowers_
 
const edm::EDGetTokenT
< TrackCollection
srcTracks_
 
const edm::EDGetTokenT
< VertexCollection
srcVertex_
 
const edm::EDGetTokenT
< ZDCRecHitCollection
srcZDChits_
 
const edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
trackerGeom_
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
trackerTopo_
 
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
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
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< B > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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

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

Definition at line 113 of file CentralityProducer.cc.

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")),
131  srcHFhits_(produceHFhits_ ? consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcHFhits"))
134  ? consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("srcTowers"))
136  srcEBhits_(produceEcalhits_ ? consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcEBhits"))
138  srcEEhits_(produceEcalhits_ ? consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcEEhits"))
140  srcZDChits_(produceZDChits_ ? consumes<ZDCRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcZDChits"))
143  ? consumes<SiPixelRecHitCollection>(iConfig.getParameter<edm::InputTag>("srcPixelhits"))
145  srcTracks_(produceTracks_ ? consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("srcTracks"))
148  ? consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("srcPixelTracks"))
151  ? consumes<VertexCollection>(iConfig.getParameter<edm::InputTag>("srcVertex"))
153  reuseTag_(reuseAny_ ? consumes<Centrality>(iConfig.getParameter<edm::InputTag>("srcReUse"))
155  caloGeom_(produceEcalhits_ ? esConsumes<CaloGeometry, CaloGeometryRecord>()
157  trackerGeom_(producePixelhits_ ? esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()
159  trackerTopo_(producePixelhits_ ? esConsumes<TrackerTopology, TrackerTopologyRcd>()
161  produces<Centrality>();
162  }
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::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_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
reco::CentralityProducer::~CentralityProducer ( )
overridedefault

Member Function Documentation

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

Reimplemented from edm::global::EDProducerBase.

Definition at line 524 of file CentralityProducer.cc.

524 {}
void reco::CentralityProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 527 of file CentralityProducer.cc.

527 {}
void reco::CentralityProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 490 of file CentralityProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

490  {
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);
501  desc.add<edm::InputTag>("srcHFhits", edm::InputTag("hfreco"));
502  desc.add<edm::InputTag>("srcTowers", edm::InputTag("towerMaker"));
503  desc.add<edm::InputTag>("srcEBhits", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
504  desc.add<edm::InputTag>("srcEEhits", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
505  desc.add<edm::InputTag>("srcZDChits", edm::InputTag("zdcreco"));
506  desc.add<edm::InputTag>("srcPixelhits", edm::InputTag("siPixelRecHits"));
507  desc.add<edm::InputTag>("srcTracks", edm::InputTag("hiGeneralTracks"));
508  desc.add<edm::InputTag>("srcVertex", edm::InputTag("hiSelectedVertex"));
509  desc.add<edm::InputTag>("srcReUse", edm::InputTag("hiCentrality"));
510  desc.add<edm::InputTag>("srcPixelTracks", edm::InputTag("hiPixel3PrimTracks"));
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);
519 
520  descriptions.addDefault(desc);
521  }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void reco::CentralityProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 169 of file CentralityProducer.cc.

References funct::abs(), edmNew::DetSet< T >::begin(), edmNew::DetSetVector< T >::begin(), caloGeom_, SiPixelRecHit::cluster(), DetId::det(), edmNew::DetSet< T >::detId(), doPixelCut_, PVValHelper::dxy, reco::TrackBase::dxy(), reco::TrackBase::dxyError(), PVValHelper::dz, reco::TrackBase::dz(), reco::TrackBase::dzError(), edmNew::DetSet< T >::end(), edmNew::DetSetVector< T >::end(), CaloRecHit::energy(), EcalRecHit::energy(), reco::LeafCandidate::energy(), PVValHelper::eta, reco::LeafCandidate::eta(), reco::TrackBase::eta(), edmNew::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), edm::Event::getByToken(), edm::EventSetup::getHandle(), hfEtaCut_, mps_fire::i, ZDCRecHit::id(), HFRecHit::id(), EcalRecHit::id(), HcalDetId::ieta(), CaloTower::ietaAbs(), HcalObjRepresent::isHF(), phase1PixelTopology::layer, BaseTrackerRecHit::localPosition(), ZDCRecHit::lowGainEnergy(), lowGainZDC_, midRapidityRange_, eostools::move(), BeamSpotPI::nTracks, PixelSubdetector::PixelBarrel, produceEcalhits_, produceETmidRap_, produceHFhits_, produceHFtowers_, producePixelhits_, producePixelTracks_, produceTracks_, produceZDChits_, edm::Handle< T >::product(), reco::LeafCandidate::pt(), reco::TrackBase::pt(), reco::TrackBase::ptError(), edm::Event::put(), reco::TrackBase::quality(), HI_PhotonSkim_cff::rechits, reuseAny_, reuseTag_, srcEBhits_, srcEEhits_, srcHFhits_, srcPixelhits_, srcPixelTracks_, srcTowers_, srcTracks_, srcVertex_, srcZDChits_, DetId::subdetId(), GeomDet::toGlobal(), hgcalTowerProducer_cfi::tower, HLT_FULL_cff::towers, HLT_FULL_cff::track, DetId::Tracker, trackerGeom_, trackerTopo_, trackEtaCut_, trackPtCut_, trackQuality_, tracks, useQuality_, and HcalZDCDetId::zside().

169  {
170  auto creco = std::make_unique<Centrality>();
171  Handle<Centrality> inputCentrality;
172  if (reuseAny_)
173  iEvent.getByToken(reuseTag_, inputCentrality);
174 
175  if (produceHFhits_) {
176  creco->etHFhitSumPlus_ = 0;
177  creco->etHFhitSumMinus_ = 0;
179  iEvent.getByToken(srcHFhits_, hits);
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();
186  }
187  } else {
188  if (reuseAny_) {
189  creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
190  creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
191  }
192  }
193 
195  creco->etHFtowerSumPlus_ = 0;
196  creco->etHFtowerSumMinus_ = 0;
197  creco->etHFtowerSumECutPlus_ = 0;
198  creco->etHFtowerSumECutMinus_ = 0;
199  creco->etMidRapiditySum_ = 0;
200 
202  iEvent.getByToken(srcTowers_, towers);
203 
204  for (size_t i = 0; i < towers->size(); ++i) {
205  const CaloTower& tower = (*towers)[i];
206  double eta = tower.eta();
207  if (produceHFtowers_) {
208  bool isHF = tower.ietaAbs() > 29;
209  if (isHF && eta > 0) {
210  creco->etHFtowerSumPlus_ += tower.pt();
211  if (tower.energy() > 1.5)
212  creco->etHFtowerSumECutPlus_ += tower.pt();
213  if (eta > hfEtaCut_)
214  creco->etHFtruncatedPlus_ += tower.pt();
215  } else if (isHF && eta < 0) {
216  creco->etHFtowerSumMinus_ += tower.pt();
217  if (tower.energy() > 1.5)
218  creco->etHFtowerSumECutMinus_ += tower.pt();
219  if (eta < -hfEtaCut_)
220  creco->etHFtruncatedMinus_ += tower.pt();
221  }
222  } else {
223  if (reuseAny_) {
224  creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
225  creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
226  creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
227  creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
228  creco->etHFtruncatedMinus_ = inputCentrality->EtHFtruncatedMinus();
229  creco->etHFtruncatedPlus_ = inputCentrality->EtHFtruncatedPlus();
230  }
231  }
232  if (produceETmidRap_) {
233  if (std::abs(eta) < midRapidityRange_)
234  creco->etMidRapiditySum_ += tower.pt() / (midRapidityRange_ * 2.);
235  } else if (reuseAny_)
236  creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
237  }
238  } else {
239  if (reuseAny_) {
240  creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
241  creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
242  creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
243  creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
244  creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
245  }
246  }
247 
248  if (produceEcalhits_) {
249  creco->etEESumPlus_ = 0;
250  creco->etEESumMinus_ = 0;
251  creco->etEBSum_ = 0;
252 
255  iEvent.getByToken(srcEBhits_, ebHits);
256  iEvent.getByToken(srcEEhits_, eeHits);
257 
259  for (unsigned int i = 0; i < ebHits->size(); ++i) {
260  const EcalRecHit& hit = (*ebHits)[i];
261  const GlobalPoint& pos = cGeo->getPosition(hit.id());
262  double et = hit.energy() * (pos.perp() / pos.mag());
263  creco->etEBSum_ += et;
264  }
265 
266  for (unsigned int i = 0; i < eeHits->size(); ++i) {
267  const EcalRecHit& hit = (*eeHits)[i];
268  const GlobalPoint& pos = cGeo->getPosition(hit.id());
269  double et = hit.energy() * (pos.perp() / pos.mag());
270  if (pos.z() > 0) {
271  creco->etEESumPlus_ += et;
272  } else {
273  creco->etEESumMinus_ += et;
274  }
275  }
276  } else {
277  if (reuseAny_) {
278  creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
279  creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
280  creco->etEBSum_ = inputCentrality->EtEBSum();
281  }
282  }
283 
284  if (producePixelhits_) {
287  creco->pixelMultiplicity_ = 0;
290  iEvent.getByToken(srcPixelhits_, rchts);
291  rechits = rchts.product();
292  int nPixel = 0;
293  int nPixel_plus = 0;
294  int nPixel_minus = 0;
295  for (SiPixelRecHitCollection::const_iterator it = rechits->begin(); it != rechits->end(); it++) {
297  DetId detId = DetId(hits.detId());
298  SiPixelRecHitCollection::const_iterator recHitMatch = rechits->find(detId);
299  const SiPixelRecHitCollection::DetSet recHitRange = *recHitMatch;
300  for (SiPixelRecHitCollection::DetSet::const_iterator recHitIterator = recHitRange.begin();
301  recHitIterator != recHitRange.end();
302  ++recHitIterator) {
303  // add selection if needed, now all hits.
304  const SiPixelRecHit* recHit = &(*recHitIterator);
305  const PixelGeomDetUnit* pixelLayer =
306  dynamic_cast<const PixelGeomDetUnit*>(tGeo->idToDet(recHit->geographicalId()));
307  GlobalPoint gpos = pixelLayer->toGlobal(recHit->localPosition());
308  math::XYZVector rechitPos(gpos.x(), gpos.y(), gpos.z());
309  double eta = rechitPos.eta();
310  int clusterSize = recHit->cluster()->size();
311  unsigned layer = topo->layer(detId);
312  if (doPixelCut_) {
313  if (detId.det() == DetId::Tracker && detId.subdetId() == PixelSubdetector::PixelBarrel) {
314  double abeta = std::abs(eta);
315  if (layer == 1) {
316  if (18 * abeta - 40 > clusterSize)
317  continue;
318  } else if (layer == 2) {
319  if (6 * abeta - 7.2 > clusterSize)
320  continue;
321  } else if (layer == 3 || layer == 4) {
322  if (4 * abeta - 2.4 > clusterSize)
323  continue;
324  }
325  }
326  }
327  nPixel++;
328  if (eta >= 0)
329  nPixel_plus++;
330  else if (eta < 0)
331  nPixel_minus++;
332  }
333  }
334  creco->pixelMultiplicity_ = nPixel;
335  creco->pixelMultiplicityPlus_ = nPixel_plus;
336  creco->pixelMultiplicityMinus_ = nPixel_minus;
337  } else {
338  if (reuseAny_) {
339  creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
340  creco->pixelMultiplicityPlus_ = inputCentrality->multiplicityPixelPlus();
341  creco->pixelMultiplicityMinus_ = inputCentrality->multiplicityPixelMinus();
342  }
343  }
344 
345  if (produceTracks_) {
346  double vx = -999.;
347  double vy = -999.;
348  double vz = -999.;
349  double vxError = -999.;
350  double vyError = -999.;
351  double vzError = -999.;
352  math::XYZVector vtxPos(0, 0, 0);
353 
354  Handle<VertexCollection> recoVertices;
355  iEvent.getByToken(srcVertex_, recoVertices);
356  unsigned int daughter = 0;
357  int greatestvtx = 0;
358 
359  for (unsigned int i = 0; i < recoVertices->size(); ++i) {
360  daughter = (*recoVertices)[i].tracksSize();
361  if (daughter > (*recoVertices)[greatestvtx].tracksSize())
362  greatestvtx = i;
363  }
364 
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();
372  }
373 
374  vtxPos = math::XYZVector(vx, vy, vz);
375 
377  iEvent.getByToken(srcTracks_, tracks);
378  int nTracks = 0;
379 
380  double trackCounter = 0;
381  double trackCounterEta = 0;
382  double trackCounterEtaPt = 0;
383 
384  for (unsigned int i = 0; i < tracks->size(); ++i) {
385  const Track& track = (*tracks)[i];
386  if (useQuality_ && !track.quality(trackQuality_))
387  continue;
388 
389  if (track.pt() > trackPtCut_)
390  trackCounter++;
391  if (std::abs(track.eta()) < trackEtaCut_) {
392  trackCounterEta++;
393  if (track.pt() > trackPtCut_)
394  trackCounterEtaPt++;
395  }
396 
397  math::XYZPoint v1(vx, vy, vz);
398  double dz = track.dz(v1);
399  double dzsigma2 = track.dzError() * track.dzError() + vzError * vzError;
400  double dxy = track.dxy(v1);
401  double dxysigma2 = track.dxyError() * track.dxyError() + vxError * vyError;
402 
403  const double pterrcut = 0.1;
404  const double dzrelcut = 3.0;
405  const double dxyrelcut = 3.0;
406 
407  if (track.quality(trackQuality_) && track.pt() > 0.4 && std::abs(track.eta()) < 2.4 &&
408  track.ptError() / track.pt() < pterrcut && dz * dz < dzrelcut * dzrelcut * dzsigma2 &&
409  dxy * dxy < dxyrelcut * dxyrelcut * dxysigma2) {
410  nTracks++;
411  }
412  }
413 
414  creco->trackMultiplicity_ = nTracks;
415  creco->ntracksPtCut_ = trackCounter;
416  creco->ntracksEtaCut_ = trackCounterEta;
417  creco->ntracksEtaPtCut_ = trackCounterEtaPt;
418 
419  } else {
420  if (reuseAny_) {
421  creco->trackMultiplicity_ = inputCentrality->Ntracks();
422  creco->ntracksPtCut_ = inputCentrality->NtracksPtCut();
423  creco->ntracksEtaCut_ = inputCentrality->NtracksEtaCut();
424  creco->ntracksEtaPtCut_ = inputCentrality->NtracksEtaPtCut();
425  }
426  }
427 
428  if (producePixelTracks_) {
429  Handle<TrackCollection> pixeltracks;
430  iEvent.getByToken(srcPixelTracks_, pixeltracks);
431  int nPixelTracks = pixeltracks->size();
432  int nPixelTracksPlus = 0;
433  int nPixelTracksMinus = 0;
434 
435  for (auto const& track : *pixeltracks) {
436  if (track.eta() < 0)
437  nPixelTracksMinus++;
438  else
439  nPixelTracksPlus++;
440  }
441  creco->nPixelTracks_ = nPixelTracks;
442  creco->nPixelTracksPlus_ = nPixelTracksPlus;
443  creco->nPixelTracksMinus_ = nPixelTracksMinus;
444  } else {
445  if (reuseAny_) {
446  creco->nPixelTracks_ = inputCentrality->NpixelTracks();
447  creco->nPixelTracksPlus_ = inputCentrality->NpixelTracksPlus();
448  creco->nPixelTracksMinus_ = inputCentrality->NpixelTracksMinus();
449  }
450  }
451 
452  if (produceZDChits_) {
453  creco->zdcSumPlus_ = 0;
454  creco->zdcSumMinus_ = 0;
455 
457  bool zdcAvailable = iEvent.getByToken(srcZDChits_, hits);
458  if (zdcAvailable) {
459  for (size_t ihit = 0; ihit < hits->size(); ++ihit) {
460  const ZDCRecHit& rechit = (*hits)[ihit];
461  if (rechit.id().zside() > 0) {
462  if (lowGainZDC_) {
463  creco->zdcSumPlus_ += rechit.lowGainEnergy();
464  } else {
465  creco->zdcSumPlus_ += rechit.energy();
466  }
467  }
468  if (rechit.id().zside() < 0) {
469  if (lowGainZDC_) {
470  creco->zdcSumMinus_ += rechit.lowGainEnergy();
471  } else {
472  creco->zdcSumMinus_ += rechit.energy();
473  }
474  }
475  }
476  } else {
477  creco->zdcSumPlus_ = -9;
478  creco->zdcSumMinus_ = -9;
479  }
480  } else {
481  if (reuseAny_) {
482  creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
483  creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
484  }
485  }
486 
487  iEvent.put(std::move(creco));
488  }
constexpr float energy() const
Definition: CaloRecHit.h:29
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< EcalRecHitCollection > srcEEhits_
T perp() const
Definition: PV3DBase.h:69
double pt() const final
transverse momentum
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeom_
const edm::EDGetTokenT< TrackCollection > srcTracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::EDGetTokenT< SiPixelRecHitCollection > srcPixelhits_
double dxyError() const
error on dxy
Definition: TrackBase.h:769
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalZDCDetId.h:39
T y() const
Definition: PV3DBase.h:60
auto const & tracks
cannot be loose
const edm::EDGetTokenT< CaloTowerCollection > srcTowers_
const reco::TrackBase::TrackQuality trackQuality_
const edm::EDGetTokenT< VertexCollection > srcVertex_
constexpr std::array< uint8_t, layerIndexSize > layer
T mag() const
Definition: PV3DBase.h:64
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopo_
double pt() const
track transverse momentum
Definition: TrackBase.h:637
T z() const
Definition: PV3DBase.h:61
const edm::EDGetTokenT< ZDCRecHitCollection > srcZDChits_
def move
Definition: eostools.py:511
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:754
const edm::EDGetTokenT< TrackCollection > srcPixelTracks_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
float energy() const
Definition: EcalRecHit.h:68
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeom_
const edm::EDGetTokenT< HFRecHitCollection > srcHFhits_
float lowGainEnergy() const
Definition: ZDCRecHit.h:20
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
double dzError() const
error on dz
Definition: TrackBase.h:778
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
DetId id() const
get the id
Definition: EcalRecHit.h:77
T const * product() const
Definition: Handle.h:70
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
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
const edm::EDGetTokenT< Centrality > reuseTag_
id_type detId() const
Definition: DetSetNew.h:66
bool isHF(int etabin, int depth)
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
const_iterator find(id_type i, bool update=false) const
T eta() const
Definition: PV3DBase.h:73
int ietaAbs() const
Definition: CaloTower.h:201
iterator end()
Definition: DetSetNew.h:56
LocalPoint localPosition() const override
HcalZDCDetId id() const
get the id
Definition: ZDCRecHit.h:18
constexpr HcalDetId id() const
Definition: HFRecHit.h:26
DetId geographicalId() const
const edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:608
T x() const
Definition: PV3DBase.h:59
const_iterator begin(bool update=false) const
Our base class.
Definition: SiPixelRecHit.h:23
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
double energy() const final
energy
double eta() const final
momentum pseudorapidity
iterator begin()
Definition: DetSetNew.h:54

Member Data Documentation

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

Definition at line 97 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::doPixelCut_
private

Definition at line 73 of file CentralityProducer.cc.

Referenced by produce().

const double reco::CentralityProducer::hfEtaCut_
private

Definition at line 80 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::lowGainZDC_
private

Definition at line 70 of file CentralityProducer.cc.

Referenced by produce().

const double reco::CentralityProducer::midRapidityRange_
private

Definition at line 77 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::produceEcalhits_
private

Definition at line 68 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::produceETmidRap_
private

Definition at line 71 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::produceHFhits_
private

Definition at line 66 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::produceHFtowers_
private

Definition at line 67 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::producePixelhits_
private

Definition at line 72 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::producePixelTracks_
private

Definition at line 75 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::produceTracks_
private

Definition at line 74 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::produceZDChits_
private

Definition at line 69 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::reuseAny_
private

Definition at line 82 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 95 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 88 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 89 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 86 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 91 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 93 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 87 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 92 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 94 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 90 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 98 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 99 of file CentralityProducer.cc.

Referenced by produce().

const double reco::CentralityProducer::trackEtaCut_
private

Definition at line 79 of file CentralityProducer.cc.

Referenced by produce().

const double reco::CentralityProducer::trackPtCut_
private

Definition at line 78 of file CentralityProducer.cc.

Referenced by produce().

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

Definition at line 84 of file CentralityProducer.cc.

Referenced by produce().

const bool reco::CentralityProducer::useQuality_
private

Definition at line 83 of file CentralityProducer.cc.

Referenced by produce().