CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
PFEcalEndcapRecHitCreator Class Reference

#include <PFEcalEndcapRecHitCreator.h>

Inheritance diagram for PFEcalEndcapRecHitCreator:
PFRecHitCreatorBase

Public Member Functions

void importRecHits (std::unique_ptr< reco::PFRecHitCollection > &out, std::unique_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void init (const edm::EventSetup &es) override
 
 PFEcalEndcapRecHitCreator (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from PFRecHitCreatorBase
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
virtual ~PFRecHitCreatorBase ()=default
 

Protected Member Functions

bool isHighInterest (const EEDetId &detid)
 
EcalScDetId readOutUnitOf (const EEDetId &detid) const
 
- Protected Member Functions inherited from PFRecHitCreatorBase
void beginEvent (const edm::Event &event, const edm::EventSetup &setup)
 

Protected Attributes

const EcalElectronicsMappingelecMap_
 
const EcalTrigTowerConstituentsMapeTTmap_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitToken_
 
edm::Handle< EESrFlagCollectionsrFlagHandle_
 
edm::EDGetTokenT< EESrFlagCollectionsrFlagToken_
 
- Protected Attributes inherited from PFRecHitCreatorBase
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
 

Detailed Description

Definition at line 30 of file PFEcalEndcapRecHitCreator.h.

Constructor & Destructor Documentation

PFEcalEndcapRecHitCreator::PFEcalEndcapRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 33 of file PFEcalEndcapRecHitCreator.h.

References edm::ConsumesCollector::consumes(), elecMap_, edm::ParameterSet::getParameter(), recHitToken_, and srFlagToken_.

33  :
34  PFRecHitCreatorBase(iConfig,iC)
35  {
37  auto srF = iConfig.getParameter<edm::InputTag>("srFlags");
38  if (not srF.label().empty())
40  elecMap_ = nullptr;
41  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
edm::EDGetTokenT< EESrFlagCollection > srFlagToken_
const EcalElectronicsMapping * elecMap_

Member Function Documentation

void PFEcalEndcapRecHitCreator::importRecHits ( std::unique_ptr< reco::PFRecHitCollection > &  out,
std::unique_ptr< reco::PFRecHitCollection > &  cleaned,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverridevirtual

Implements PFRecHitCreatorBase.

Definition at line 43 of file PFEcalEndcapRecHitCreator.h.

References PFRecHitCreatorBase::beginEvent(), DetId::Ecal, PFLayer::ECAL_ENDCAP, EcalEndcap, Exception, edm::EventSetup::get(), edm::Event::getByToken(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), isHighInterest(), keep, eostools::move(), PFRecHitCreatorBase::qualityTests_, DetId::rawId(), recHitToken_, srFlagHandle_, srFlagToken_, and ntuplemaker::time.

43  {
44 
45  beginEvent(iEvent,iSetup);
46 
48 
50  iSetup.get<CaloGeometryRecord>().get(geoHandle);
51 
52  bool useSrF = false;
53  if (not srFlagToken_.isUninitialized()){
55  useSrF = true;
56  }
57 
58  // get the ecal geometry
59  const CaloSubdetectorGeometry *gTmp =
61 
62  const EcalEndcapGeometry *ecalGeo = dynamic_cast<const EcalEndcapGeometry*>(gTmp);
63 
64  iEvent.getByToken(recHitToken_,recHitHandle);
65  for(const auto& erh : *recHitHandle ) {
66  const DetId& detid = erh.detid();
67  auto energy = erh.energy();
68  auto time = erh.time();
69 
70  bool hi = (useSrF ? isHighInterest(detid) : true);
71 
72  std::shared_ptr<const CaloCellGeometry> thisCell= ecalGeo->getGeometry(detid);
73 
74  // find rechit geometry
75  if(!thisCell) {
76  throw cms::Exception("PFEcalEndcapRecHitCreator")
77  << "detid "<< detid.rawId() << "not found in geometry";
78  }
79 
80  out->emplace_back(thisCell, detid.rawId(), PFLayer::ECAL_ENDCAP, energy);
81 
82  auto & rh = out->back();
83 
84  bool rcleaned = false;
85  bool keep=true;
86 
87  //Apply Q tests
88  for( const auto& qtest : qualityTests_ ) {
89  if (!qtest->test(rh,erh,rcleaned,hi)) {
90  keep = false;
91  }
92  }
93 
94  if(keep) {
95  rh.setTime(time);
96  rh.setDepth(1);
97  }
98  else {
99  if (rcleaned)
100  cleaned->push_back(std::move(out->back()));
101  out->pop_back();
102  }
103  }
104  }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
bool isHighInterest(const EEDetId &detid)
const int keep
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: DetId.h:18
edm::Handle< EESrFlagCollection > srFlagHandle_
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
edm::EDGetTokenT< EESrFlagCollection > srFlagToken_
T get() const
Definition: EventSetup.h:68
def move(src, dest)
Definition: eostools.py:511
void PFEcalEndcapRecHitCreator::init ( const edm::EventSetup es)
inlineoverridevirtual

Reimplemented from PFRecHitCreatorBase.

Definition at line 106 of file PFEcalEndcapRecHitCreator.h.

References elecMap_, edm::EventSetup::get(), and edm::ESHandle< T >::product().

106  {
107 
109  es.get< EcalMappingRcd >().get(ecalmapping);
110  elecMap_ = ecalmapping.product();
111 
112  }
T get() const
Definition: EventSetup.h:68
const EcalElectronicsMapping * elecMap_
T const * product() const
Definition: ESHandle.h:84
bool PFEcalEndcapRecHitCreator::isHighInterest ( const EEDetId detid)
inlineprotected

Definition at line 117 of file PFEcalEndcapRecHitCreator.h.

References readOutUnitOf(), mps_fire::result, EcalSrFlag::SRF_FULL, and srFlagHandle_.

Referenced by importRecHits().

117  {
118  bool result=false;
119  auto srf = srFlagHandle_->find(readOutUnitOf(detid));
120  if(srf==srFlagHandle_->end()) return false;
121  else result = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK) == EcalSrFlag::SRF_FULL);
122  return result;
123  }
static const int SRF_FULL
Definition: EcalSrFlag.h:24
edm::Handle< EESrFlagCollection > srFlagHandle_
EcalScDetId readOutUnitOf(const EEDetId &detid) const
EcalScDetId PFEcalEndcapRecHitCreator::readOutUnitOf ( const EEDetId detid) const
inlineprotected

Definition at line 125 of file PFEcalEndcapRecHitCreator.h.

References EcalElectronicsId::dccId(), elecMap_, EcalElectronicsMapping::getEcalScDetId(), EcalElectronicsMapping::getElectronicsId(), and EcalElectronicsId::towerId().

Referenced by isHighInterest().

125  {
126  const EcalElectronicsId& EcalElecId = elecMap_->getElectronicsId(detid);
127  int iDCC= EcalElecId.dccId();
128  int iDccChan = EcalElecId.towerId();
129  const bool ignoreSingle = true;
130  const std::vector<EcalScDetId> id = elecMap_->getEcalScDetId(iDCC, iDccChan, ignoreSingle);
131  return !id.empty()?id[0]:EcalScDetId();
132  }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int towerId() const
get the tower id
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
const EcalElectronicsMapping * elecMap_

Member Data Documentation

const EcalElectronicsMapping* PFEcalEndcapRecHitCreator::elecMap_
protected

Definition at line 141 of file PFEcalEndcapRecHitCreator.h.

Referenced by init(), PFEcalEndcapRecHitCreator(), and readOutUnitOf().

const EcalTrigTowerConstituentsMap* PFEcalEndcapRecHitCreator::eTTmap_
protected

Definition at line 138 of file PFEcalEndcapRecHitCreator.h.

edm::EDGetTokenT<EcalRecHitCollection> PFEcalEndcapRecHitCreator::recHitToken_
protected

Definition at line 135 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits(), and PFEcalEndcapRecHitCreator().

edm::Handle<EESrFlagCollection> PFEcalEndcapRecHitCreator::srFlagHandle_
protected

Definition at line 143 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits(), and isHighInterest().

edm::EDGetTokenT<EESrFlagCollection> PFEcalEndcapRecHitCreator::srFlagToken_
protected

Definition at line 136 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits(), and PFEcalEndcapRecHitCreator().