CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PhotonCoreProducer Class Reference
Inheritance diagram for PhotonCoreProducer:
edm::stream::EDProducer<>

Public Member Functions

 PhotonCoreProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
 ~PhotonCoreProducer () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void fillPhotonCollection (edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::SuperClusterCollection > &scHandle, const edm::Handle< reco::ConversionCollection > &conversionHandle, const edm::Handle< reco::ElectronSeedCollection > &pixelSeeds, reco::PhotonCoreCollection &outputCollection, int &iSC)
 
reco::ConversionRef solveAmbiguity (const edm::Handle< reco::ConversionCollection > &conversionHandle, reco::SuperClusterRef &sc)
 

Private Attributes

edm::ParameterSet conf_
 
edm::EDGetTokenT< reco::ConversionCollectionconversionProducer_
 
double minSCEt_
 
std::string PhotonCoreCollection_
 
edm::EDGetTokenT< reco::ElectronSeedCollectionpixelSeedProducer_
 
bool risolveAmbiguity_
 
edm::EDGetTokenT< reco::SuperClusterCollectionscHybridBarrelProducer_
 
edm::EDGetTokenT< reco::SuperClusterCollectionscIslandEndcapProducer_
 
bool validConversions_
 
bool validPixelSeeds_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 28 of file PhotonCoreProducer.cc.

Constructor & Destructor Documentation

◆ PhotonCoreProducer()

PhotonCoreProducer::PhotonCoreProducer ( const edm::ParameterSet ps)

Definition at line 63 of file PhotonCoreProducer.cc.

64  : conf_(config)
65 
66 {
67  // use onfiguration file to setup input/output collection names
69  consumes<reco::SuperClusterCollection>(conf_.getParameter<edm::InputTag>("scHybridBarrelProducer"));
71  consumes<reco::SuperClusterCollection>(conf_.getParameter<edm::InputTag>("scIslandEndcapProducer"));
72  conversionProducer_ = consumes<reco::ConversionCollection>(conf_.getParameter<edm::InputTag>("conversionProducer"));
73  PhotonCoreCollection_ = conf_.getParameter<std::string>("photonCoreCollection");
74  pixelSeedProducer_ = consumes<reco::ElectronSeedCollection>(conf_.getParameter<edm::InputTag>("pixelSeedProducer"));
75  minSCEt_ = conf_.getParameter<double>("minSCEt");
76  risolveAmbiguity_ = conf_.getParameter<bool>("risolveConversionAmbiguity");
77 
78  // Register the product
79  produces<reco::PhotonCoreCollection>(PhotonCoreCollection_);
80 }

References conf_, conversionProducer_, edm::ParameterSet::getParameter(), minSCEt_, PhotonCoreCollection_, pixelSeedProducer_, risolveAmbiguity_, scHybridBarrelProducer_, scIslandEndcapProducer_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~PhotonCoreProducer()

PhotonCoreProducer::~PhotonCoreProducer ( )
override

Definition at line 82 of file PhotonCoreProducer.cc.

82 {}

Member Function Documentation

◆ fillPhotonCollection()

void PhotonCoreProducer::fillPhotonCollection ( edm::Event evt,
edm::EventSetup const &  es,
const edm::Handle< reco::SuperClusterCollection > &  scHandle,
const edm::Handle< reco::ConversionCollection > &  conversionHandle,
const edm::Handle< reco::ElectronSeedCollection > &  pixelSeeds,
reco::PhotonCoreCollection outputCollection,
int &  iSC 
)
private

Definition at line 143 of file PhotonCoreProducer.cc.

149  {
150  for (unsigned int lSC = 0; lSC < scHandle->size(); lSC++) {
151  // get SuperClusterRef
152  reco::SuperClusterRef scRef(reco::SuperClusterRef(scHandle, lSC));
153  iSC++;
154  //const reco::SuperCluster* pClus=&(*scRef);
155 
156  // SC energy preselection
157  if (scRef->energy() / cosh(scRef->eta()) <= minSCEt_)
158  continue;
159 
160  reco::PhotonCore newCandidate(scRef);
161  newCandidate.setParentSuperCluster(scRef);
162  if (validConversions_) {
163  if (risolveAmbiguity_) {
165  if (bestRef.isNonnull())
166  newCandidate.addConversion(bestRef);
167 
168  } else {
169  for (unsigned int icp = 0; icp < conversionHandle->size(); icp++) {
171  if (cpRef->caloCluster().empty())
172  continue;
173  if (!(scRef.id() == cpRef->caloCluster()[0].id() && scRef.key() == cpRef->caloCluster()[0].key()))
174  continue;
175  if (!cpRef->isConverted())
176  continue;
177  newCandidate.addConversion(cpRef);
178  }
179 
180  } // solve or not the ambiguity of many conversion candidates
181  }
182 
183  if (validPixelSeeds_) {
184  for (unsigned int icp = 0; icp < pixelSeedHandle->size(); icp++) {
185  reco::ElectronSeedRef cpRef(reco::ElectronSeedRef(pixelSeedHandle, icp));
186  if (!cpRef->isEcalDriven())
187  continue;
188  if (!(scRef.id() == cpRef->caloCluster().id() && scRef.key() == cpRef->caloCluster().key()))
189  continue;
190  newCandidate.addElectronPixelSeed(cpRef);
191  }
192  }
193 
194  outputPhotonCoreCollection.push_back(newCandidate);
195  }
196 }

References reco::PhotonCore::addConversion(), reco::PhotonCore::addElectronPixelSeed(), printConversionInfo::conversionHandle, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), minSCEt_, risolveAmbiguity_, reco::PhotonCore::setParentSuperCluster(), solveAmbiguity(), validConversions_, and validPixelSeeds_.

Referenced by produce().

◆ produce()

void PhotonCoreProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 84 of file PhotonCoreProducer.cc.

84  {
85  using namespace edm;
86  // nEvt_++;
87 
88  reco::PhotonCoreCollection outputPhotonCoreCollection;
89  auto outputPhotonCoreCollection_p = std::make_unique<reco::PhotonCoreCollection>();
90 
91  // Get the Barrel Super Cluster collection
92  bool validBarrelSCHandle = true;
94  theEvent.getByToken(scHybridBarrelProducer_, scBarrelHandle);
95  if (!scBarrelHandle.isValid()) {
96  edm::LogError("PhotonCoreProducer") << "Error! Can't get the scHybridBarrelProducer";
97  validBarrelSCHandle = false;
98  }
99 
100  // Get the Endcap Super Cluster collection
101  bool validEndcapSCHandle = true;
103  theEvent.getByToken(scIslandEndcapProducer_, scEndcapHandle);
104  if (!scEndcapHandle.isValid()) {
105  edm::LogError("PhotonCoreProducer") << "Error! Can't get the scIslandEndcapProducer";
106  validEndcapSCHandle = false;
107  }
108 
110  validConversions_ = true;
112  theEvent.getByToken(conversionProducer_, conversionHandle);
113  if (!conversionHandle.isValid()) {
114  //edm::LogError("PhotonCoreProducer") << "Error! Can't get the product "<< conversionProducer_.label() << "\n" ;
115  validConversions_ = false;
116  }
117 
118  // Get ElectronPixelSeeds
119  validPixelSeeds_ = true;
120  Handle<reco::ElectronSeedCollection> pixelSeedHandle;
122  theEvent.getByToken(pixelSeedProducer_, pixelSeedHandle);
123  if (!pixelSeedHandle.isValid()) {
124  validPixelSeeds_ = false;
125  }
126  // if ( validPixelSeeds_) pixelSeeds = *(pixelSeedHandle.product());
127 
128  int iSC = 0; // index in photon collection
129  // Loop over barrel and endcap SC collections and fill the photon collection
130  if (validBarrelSCHandle)
132  theEvent, theEventSetup, scBarrelHandle, conversionHandle, pixelSeedHandle, outputPhotonCoreCollection, iSC);
133  if (validEndcapSCHandle)
135  theEvent, theEventSetup, scEndcapHandle, conversionHandle, pixelSeedHandle, outputPhotonCoreCollection, iSC);
136 
137  // put the product in the event
138  edm::LogInfo("PhotonCoreProducer") << " Put in the event " << iSC << " Photon Candidates \n";
139  outputPhotonCoreCollection_p->assign(outputPhotonCoreCollection.begin(), outputPhotonCoreCollection.end());
140  theEvent.put(std::move(outputPhotonCoreCollection_p), PhotonCoreCollection_);
141 }

References printConversionInfo::conversionHandle, conversionProducer_, fillPhotonCollection(), edm::Event::getByToken(), edm::HandleBase::isValid(), eostools::move(), PhotonCoreCollection_, pixelSeedProducer_, hltEgammaHLTExtra_cfi::pixelSeeds, edm::Event::put(), scHybridBarrelProducer_, scIslandEndcapProducer_, validConversions_, and validPixelSeeds_.

◆ solveAmbiguity()

reco::ConversionRef PhotonCoreProducer::solveAmbiguity ( const edm::Handle< reco::ConversionCollection > &  conversionHandle,
reco::SuperClusterRef sc 
)
private

only one track reconstructed. Pick the one with best E/P

Definition at line 198 of file PhotonCoreProducer.cc.

199  {
200  std::multimap<reco::ConversionRef, double> convMap;
201  for (unsigned int icp = 0; icp < conversionHandle->size(); icp++) {
203 
204  if (!(scRef.id() == cpRef->caloCluster()[0].id() && scRef.key() == cpRef->caloCluster()[0].key()))
205  continue;
206  if (!cpRef->isConverted())
207  continue;
208  double like = cpRef->MVAout();
209  convMap.insert(std::make_pair(cpRef, like));
210  }
211 
212  std::multimap<reco::ConversionRef, double>::iterator iMap;
213  double max_lh = -1.;
214  reco::ConversionRef bestRef;
215  // std::cout << " Pick up the best conv " << std::endl;
216  for (iMap = convMap.begin(); iMap != convMap.end(); iMap++) {
217  double like = iMap->second;
218  if (like > max_lh) {
219  max_lh = like;
220  bestRef = iMap->first;
221  }
222  }
223 
224  //std::cout << " Best conv like " << max_lh << std::endl;
225 
226  float ep = 0;
227  if (max_lh < 0) {
228  // std::cout << " Candidates with only one track " << std::endl;
230  float epMin = 999;
231 
232  for (iMap = convMap.begin(); iMap != convMap.end(); iMap++) {
233  reco::ConversionRef convRef = iMap->first;
234  // std::vector<reco::TrackRef> tracks = convRef->tracks();
235  const std::vector<edm::RefToBase<reco::Track> > tracks = convRef->tracks();
236  float px = tracks[0]->innerMomentum().x();
237  float py = tracks[0]->innerMomentum().y();
238  float pz = tracks[0]->innerMomentum().z();
239  float p = sqrt(px * px + py * py + pz * pz);
240  ep = fabs(1. - convRef->caloCluster()[0]->energy() / p);
241  // std::cout << " 1-E/P = " << ep << std::endl;
242  if (ep < epMin) {
243  epMin = ep;
244  bestRef = iMap->first;
245  }
246  }
247  // std::cout << " Best conv 1-E/P " << ep << std::endl;
248  }
249 
250  return bestRef;
251 }

References printConversionInfo::conversionHandle, SiStripBadComponentsDQMServiceTemplate_cfg::ep, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), AlCaHLTBitMon_ParallelJobs::p, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mathSSE::sqrt(), and tracks.

Referenced by fillPhotonCollection().

Member Data Documentation

◆ conf_

edm::ParameterSet PhotonCoreProducer::conf_
private

Definition at line 55 of file PhotonCoreProducer.cc.

Referenced by PhotonCoreProducer().

◆ conversionProducer_

edm::EDGetTokenT<reco::ConversionCollection> PhotonCoreProducer::conversionProducer_
private

Definition at line 50 of file PhotonCoreProducer.cc.

Referenced by PhotonCoreProducer(), and produce().

◆ minSCEt_

double PhotonCoreProducer::minSCEt_
private

Definition at line 53 of file PhotonCoreProducer.cc.

Referenced by fillPhotonCollection(), and PhotonCoreProducer().

◆ PhotonCoreCollection_

std::string PhotonCoreProducer::PhotonCoreCollection_
private

Definition at line 47 of file PhotonCoreProducer.cc.

Referenced by PhotonCoreProducer(), and produce().

◆ pixelSeedProducer_

edm::EDGetTokenT<reco::ElectronSeedCollection> PhotonCoreProducer::pixelSeedProducer_
private

Definition at line 51 of file PhotonCoreProducer.cc.

Referenced by PhotonCoreProducer(), and produce().

◆ risolveAmbiguity_

bool PhotonCoreProducer::risolveAmbiguity_
private

Definition at line 57 of file PhotonCoreProducer.cc.

Referenced by fillPhotonCollection(), and PhotonCoreProducer().

◆ scHybridBarrelProducer_

edm::EDGetTokenT<reco::SuperClusterCollection> PhotonCoreProducer::scHybridBarrelProducer_
private

Definition at line 48 of file PhotonCoreProducer.cc.

Referenced by PhotonCoreProducer(), and produce().

◆ scIslandEndcapProducer_

edm::EDGetTokenT<reco::SuperClusterCollection> PhotonCoreProducer::scIslandEndcapProducer_
private

Definition at line 49 of file PhotonCoreProducer.cc.

Referenced by PhotonCoreProducer(), and produce().

◆ validConversions_

bool PhotonCoreProducer::validConversions_
private

Definition at line 54 of file PhotonCoreProducer.cc.

Referenced by fillPhotonCollection(), and produce().

◆ validPixelSeeds_

bool PhotonCoreProducer::validPixelSeeds_
private

Definition at line 56 of file PhotonCoreProducer.cc.

Referenced by fillPhotonCollection(), and produce().

PhotonCoreProducer::scIslandEndcapProducer_
edm::EDGetTokenT< reco::SuperClusterCollection > scIslandEndcapProducer_
Definition: PhotonCoreProducer.cc:49
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
edm
HLT enums.
Definition: AlignableModifier.h:19
printConversionInfo.conversionHandle
conversionHandle
Definition: printConversionInfo.py:15
PhotonCoreProducer::fillPhotonCollection
void fillPhotonCollection(edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::SuperClusterCollection > &scHandle, const edm::Handle< reco::ConversionCollection > &conversionHandle, const edm::Handle< reco::ElectronSeedCollection > &pixelSeeds, reco::PhotonCoreCollection &outputCollection, int &iSC)
Definition: PhotonCoreProducer.cc:143
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
PhotonCoreProducer::conf_
edm::ParameterSet conf_
Definition: PhotonCoreProducer.cc:55
edm::Ref< SuperClusterCollection >
hltEgammaHLTExtra_cfi.pixelSeeds
pixelSeeds
Definition: hltEgammaHLTExtra_cfi.py:6
PhotonCoreProducer::risolveAmbiguity_
bool risolveAmbiguity_
Definition: PhotonCoreProducer.cc:57
config
Definition: config.py:1
PhotonCoreProducer::minSCEt_
double minSCEt_
Definition: PhotonCoreProducer.cc:53
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::PhotonCore
Definition: PhotonCore.h:24
reco::ElectronSeedCollection
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
Definition: ElectronSeedFwd.h:10
PhotonCoreProducer::validConversions_
bool validConversions_
Definition: PhotonCoreProducer.cc:54
reco::PhotonCoreCollection
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
PhotonCoreProducer::validPixelSeeds_
bool validPixelSeeds_
Definition: PhotonCoreProducer.cc:56
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PhotonCoreProducer::pixelSeedProducer_
edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
Definition: PhotonCoreProducer.cc:51
PhotonCoreProducer::PhotonCoreCollection_
std::string PhotonCoreCollection_
Definition: PhotonCoreProducer.cc:47
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
PhotonCoreProducer::solveAmbiguity
reco::ConversionRef solveAmbiguity(const edm::Handle< reco::ConversionCollection > &conversionHandle, reco::SuperClusterRef &sc)
Definition: PhotonCoreProducer.cc:198
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::InputTag
Definition: InputTag.h:15
PhotonCoreProducer::scHybridBarrelProducer_
edm::EDGetTokenT< reco::SuperClusterCollection > scHybridBarrelProducer_
Definition: PhotonCoreProducer.cc:48
PhotonCoreProducer::conversionProducer_
edm::EDGetTokenT< reco::ConversionCollection > conversionProducer_
Definition: PhotonCoreProducer.cc:50