CMS 3D CMS Logo

PFEcalEndcapRecHitCreator.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFEcalEndcapRecHitCreator_h
2 #define RecoParticleFlow_PFClusterProducer_PFEcalEndcapRecHitCreator_h
3 
9 
12 
13 
19 
28 
30 
31  public:
33  PFRecHitCreatorBase(iConfig,iC)
34  {
37  elecMap_ = 0;
38  }
39 
40  void importRecHits(std::unique_ptr<reco::PFRecHitCollection>&out,std::unique_ptr<reco::PFRecHitCollection>& cleaned ,const edm::Event& iEvent,const edm::EventSetup& iSetup) {
41 
42  beginEvent(iEvent,iSetup);
43 
45 
47  iSetup.get<CaloGeometryRecord>().get(geoHandle);
48 
50 
51  // get the ecal geometry
52  const CaloSubdetectorGeometry *gTmp =
54 
55  const EcalEndcapGeometry *ecalGeo =dynamic_cast< const EcalEndcapGeometry* > (gTmp);
56 
57  iEvent.getByToken(recHitToken_,recHitHandle);
58  for(const auto& erh : *recHitHandle ) {
59  const DetId& detid = erh.detid();
60  auto energy = erh.energy();
61  auto time = erh.time();
62 
63  bool hi = isHighInterest(detid);
64 
65  const CaloCellGeometry * thisCell= ecalGeo->getGeometry(detid);
66 
67  // find rechit geometry
68  if(!thisCell) {
69  throw cms::Exception("PFEcalEndcapRecHitCreator")
70  << "detid "<< detid.rawId() << "not found in geometry";
71  }
72 
73  out->emplace_back(thisCell, detid.rawId(), PFLayer::ECAL_ENDCAP, energy);
74 
75  auto & rh = out->back();
76 
77  bool rcleaned = false;
78  bool keep=true;
79 
80  //Apply Q tests
81  for( const auto& qtest : qualityTests_ ) {
82  if (!qtest->test(rh,erh,rcleaned,hi)) {
83  keep = false;
84  }
85  }
86 
87  if(keep) {
88  rh.setTime(time);
89  rh.setDepth(1);
90  }
91  else {
92  if (rcleaned)
93  cleaned->push_back(std::move(out->back()));
94  out->pop_back();
95  }
96  }
97  }
98 
99  void init(const edm::EventSetup &es) {
100 
102  es.get< EcalMappingRcd >().get(ecalmapping);
103  elecMap_ = ecalmapping.product();
104 
105  }
106 
107  protected:
108 
109 
110  bool isHighInterest(const EEDetId& detid) {
111  bool result=false;
113  if(srf==srFlagHandle_->end()) return false;
114  else result = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK) == EcalSrFlag::SRF_FULL);
115  return result;
116  }
117 
118  EcalScDetId readOutUnitOf(const EEDetId& detid) const{
119  const EcalElectronicsId& EcalElecId = elecMap_->getElectronicsId(detid);
120  int iDCC= EcalElecId.dccId();
121  int iDccChan = EcalElecId.towerId();
122  const bool ignoreSingle = true;
123  const std::vector<EcalScDetId> id = elecMap_->getEcalScDetId(iDCC, iDccChan, ignoreSingle);
124  return id.size()>0?id[0]:EcalScDetId();
125  }
126 
127 
130 
132 
133  // Ecal electronics/geometrical mapping
135  // selective readout flags collection
137 
138 };
139 
140 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
std::vector< EESrFlag >::const_iterator const_iterator
int towerId() const
get the tower id
bool isHighInterest(const EEDetId &detid)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
const int keep
int iEvent
Definition: GenABIO.cc:230
PFEcalEndcapRecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
static const int SRF_FULL
Definition: EcalSrFlag.h:24
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
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
Definition: DetId.h:18
void init(const edm::EventSetup &es)
edm::Handle< EESrFlagCollection > srFlagHandle_
EcalScDetId readOutUnitOf(const EEDetId &detid) const
const T & get() const
Definition: EventSetup.h:56
edm::EDGetTokenT< EESrFlagCollection > srFlagToken_
void importRecHits(std::unique_ptr< reco::PFRecHitCollection > &out, std::unique_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup)
const EcalTrigTowerConstituentsMap * eTTmap_
const EcalElectronicsMapping * elecMap_
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510