CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GEDPhotonCoreProducer Class Reference

#include <GEDPhotonCoreProducer.h>

Inheritance diagram for GEDPhotonCoreProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GEDPhotonCoreProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~GEDPhotonCoreProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void createSingleLegConversions (reco::CaloClusterPtr, const std::vector< reco::TrackRef > &, const std::vector< float > &, reco::ConversionCollection &oneLegConversions)
 

Private Attributes

edm::ParameterSet conf_
 
std::string GEDPhotonCoreCollection_
 
double minSCEt_
 
std::string PFConversionCollection_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
pfEgammaCandidates_
 
edm::EDGetTokenT
< reco::ElectronSeedCollection
pixelSeedProducer_
 
bool validConversions_
 
bool validPixelSeeds_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 23 of file GEDPhotonCoreProducer.h.

Constructor & Destructor Documentation

GEDPhotonCoreProducer::GEDPhotonCoreProducer ( const edm::ParameterSet ps)

Definition at line 36 of file GEDPhotonCoreProducer.cc.

References conf_, GEDPhotonCoreCollection_, edm::ParameterSet::getParameter(), PFConversionCollection_, pfEgammaCandidates_, pixelSeedProducer_, and AlCaHLTBitMon_QueryRunRegistry::string.

36  :
37  conf_(config)
38 
39 {
40 
41  // use onfiguration file to setup input/output collection names
43  consumes<reco::PFCandidateCollection>(conf_.getParameter<edm::InputTag>("pfEgammaCandidates"));
45  consumes<reco::ElectronSeedCollection>(conf_.getParameter<edm::InputTag>("pixelSeedProducer"));
46 
47  GEDPhotonCoreCollection_ = conf_.getParameter<std::string>("gedPhotonCoreCollection");
48 
49 
50 
51  // Register the product
52  produces<reco::PhotonCoreCollection>(GEDPhotonCoreCollection_);
53  produces<reco::ConversionCollection>(PFConversionCollection_);
54 
55 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
GEDPhotonCoreProducer::~GEDPhotonCoreProducer ( )

Definition at line 57 of file GEDPhotonCoreProducer.cc.

57 {}

Member Function Documentation

void GEDPhotonCoreProducer::createSingleLegConversions ( reco::CaloClusterPtr  sc,
const std::vector< reco::TrackRef > &  conv,
const std::vector< float > &  mva,
reco::ConversionCollection oneLegConversions 
)
private

Definition at line 182 of file GEDPhotonCoreProducer.cc.

References relativeConstraints::error, reco::Conversion::pflow, edm::PtrVector< T >::push_back(), reco::Conversion::setOneLegMVA(), X, and Gflash::Z.

Referenced by produce().

182  {
183  // this method translates the single track into the Conversion Data Format
184 
186  for (unsigned int itk=0; itk<conv.size(); itk++){
187  const reco::Vertex convVtx(conv[itk]->innerPosition(), error);
188  std::vector<reco::TrackRef> OneLegConvVector;
189  OneLegConvVector.push_back(conv[itk]);
190  std::vector< float > OneLegMvaVector;
191  OneLegMvaVector.push_back(mva[itk]);
192  std::vector<reco::CaloClusterPtr> dummymatchingBC;
194  scPtrVec.push_back(sc);
195 
196 
197  std::vector<math::XYZPointF>trackPositionAtEcalVec;
198  std::vector<math::XYZPointF>innPointVec;
199  std::vector<math::XYZVectorF>trackPinVec;
200  std::vector<math::XYZVectorF>trackPoutVec;
201  math::XYZPointF trackPositionAtEcal(conv[itk]->outerPosition().X(), conv[itk]->outerPosition().Y(), conv[itk]->outerPosition().Z());
202  trackPositionAtEcalVec.push_back(trackPositionAtEcal);
203 
204  math::XYZPointF innPoint(conv[itk]->innerPosition().X(), conv[itk]->innerPosition().Y(), conv[itk]->innerPosition().Z());
205  innPointVec.push_back(innPoint);
206 
207  math::XYZVectorF trackPin(conv[itk]->innerMomentum().X(), conv[itk]->innerMomentum().Y(), conv[itk]->innerMomentum().Z());
208  trackPinVec.push_back(trackPin);
209 
210  math::XYZVectorF trackPout(conv[itk]->outerMomentum().X(), conv[itk]->outerMomentum().Y(), conv[itk]->outerMomentum().Z());
211  trackPoutVec.push_back( trackPout );
212 
213  float DCA = conv[itk]->d0() ;
214  reco::Conversion singleLegConvCandidate(scPtrVec,
215  OneLegConvVector,
216  trackPositionAtEcalVec,
217  convVtx,
218  dummymatchingBC,
219  DCA,
220  innPointVec,
221  trackPinVec,
222  trackPoutVec,
223  mva[itk],
225  singleLegConvCandidate.setOneLegMVA(OneLegMvaVector);
226  oneLegConversions.push_back(singleLegConvCandidate);
227 
228  }
229 
230 
231 
232 }
const double Z[kNumberCalorimeter]
static HepMC::IO_HEPEVT conv
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:138
#define X(str)
Definition: MuonsGrabber.cc:48
ErrorD< N >::type type
Definition: Error.h:29
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17
void GEDPhotonCoreProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 62 of file GEDPhotonCoreProducer.cc.

References reco::PhotonCore::addConversion(), reco::PhotonCore::addElectronPixelSeed(), createSingleLegConversions(), GEDPhotonCoreCollection_, edm::Event::getByToken(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), PFConversionCollection_, pfEgammaCandidates_, pixelSeedProducer_, edm::Event::put(), edm::refToPtr(), reco::PhotonCore::setParentSuperCluster(), reco::PhotonCore::setPFlowPhoton(), reco::PhotonCore::setStandardPhoton(), reco::PhotonCore::setSuperCluster(), edm::RefVector< C, T, F >::size(), and validPixelSeeds_.

62  {
63 
64 
65  using namespace edm;
66  // nEvt_++;
67 
68  reco::PhotonCoreCollection outputPhotonCoreCollection;
69  std::auto_ptr< reco::PhotonCoreCollection > outputPhotonCoreCollection_p(new reco::PhotonCoreCollection);
70 
71  reco::ConversionCollection outputOneLegConversionCollection;
72  std::auto_ptr<reco::ConversionCollection> SingleLeg_p(new reco::ConversionCollection(outputOneLegConversionCollection));
73 
74  // Get the PF refined cluster collection
75  Handle<reco::PFCandidateCollection> pfCandidateHandle;
76  theEvent.getByToken(pfEgammaCandidates_,pfCandidateHandle);
77  if (!pfCandidateHandle.isValid()) {
78  edm::LogError("GEDPhotonCoreProducer")
79  << "Error! Can't get the pfEgammaCandidates";
80  }
81 
82 
83  // Get ElectronPixelSeeds
84  validPixelSeeds_=true;
87  theEvent.getByToken(pixelSeedProducer_, pixelSeedHandle);
88  if (!pixelSeedHandle.isValid()) {
89  validPixelSeeds_=false;
90  }
91 
92 
93 
94  // std::cout << " GEDPhotonCoreProducer::produce input PFcandidate size " << pfCandidateHandle->size() << std::endl;
95 
96 
97  // Loop over PF candidates and get only photons
98  reco::ElectronSeedCollection::const_iterator pixelSeedItr;
99  for(unsigned int lCand=0; lCand < pfCandidateHandle->size(); lCand++) {
100  reco::PFCandidateRef candRef (reco::PFCandidateRef(pfCandidateHandle,lCand));
101 
102  // Retrieve stuff from the pfPhoton
103  reco::PFCandidateEGammaExtraRef pfPhoRef = candRef->egammaExtraRef();
104  reco::SuperClusterRef refinedSC= pfPhoRef->superClusterRef();
105  reco::SuperClusterRef boxSC= pfPhoRef->superClusterPFECALRef();
106  const reco::ConversionRefVector & doubleLegConv = pfPhoRef->conversionRef();
107  reco::CaloClusterPtr refinedSCPtr= edm::refToPtr(refinedSC);
108 
109  // std::cout << "newCandidate doubleLegConv="<<doubleLegConv.size()<< std::endl;
110  //std::cout << "newCandidate singleLegConv="<< pfPhoRef->singleLegConvTrackRef().size()<< std::endl;
111 
113  reco::PhotonCore newCandidate;
114  newCandidate.setPFlowPhoton(true);
115  newCandidate.setStandardPhoton(false);
116  newCandidate.setSuperCluster(refinedSC);
117  newCandidate.setParentSuperCluster(boxSC);
118  // fill conversion infos
119 
120 
121  for(unsigned int lConv=0; lConv < doubleLegConv.size(); lConv++) {
122  newCandidate.addConversion(doubleLegConv[lConv]);
123  }
124 
125  // std::cout << "newCandidate pf refined SC energy="<< newCandidate.superCluster()->energy()<<std::endl;
126  //std::cout << "newCandidate pf SC energy="<< newCandidate.parentSuperCluster()->energy()<<std::endl;
127  //std::cout << "newCandidate nconv2leg="<<newCandidate.conversions().size()<< std::endl;
128 
129  if ( validPixelSeeds_) {
130  for( unsigned int icp = 0; icp < pixelSeedHandle->size(); icp++) {
131  reco::ElectronSeedRef cpRef(pixelSeedHandle,icp);
132  if ( boxSC.isNonnull() && boxSC.id() == cpRef->caloCluster().id() && boxSC.key() == cpRef->caloCluster().key() ) {
133  newCandidate.addElectronPixelSeed(cpRef);
134  }
135  }
136  }
137 
138 
139 
140  //
141  createSingleLegConversions(refinedSCPtr, pfPhoRef->singleLegConvTrackRef(), pfPhoRef->singleLegConvMva(), outputOneLegConversionCollection);
142  outputPhotonCoreCollection.push_back(newCandidate);
143  }
144 
145  SingleLeg_p->assign(outputOneLegConversionCollection.begin(),outputOneLegConversionCollection.end());
146  const edm::OrphanHandle<reco::ConversionCollection> singleLegConvOrhpHandle = theEvent.put(SingleLeg_p,PFConversionCollection_);
147 
148  //std::cout << " GEDPhotonCoreProducer::produce orphanHandle to single legs " << singleLegConvOrhpHandle->size() << std::endl;
149  //std::cout << " GEDPhotonCoreProducer::produce photon size " << outputPhotonCoreCollection.size() << std::endl;
150 
151 
152 
153  int ipho=0;
154  for (reco::PhotonCoreCollection::iterator gamIter=outputPhotonCoreCollection.begin(); gamIter != outputPhotonCoreCollection.end(); ++gamIter){
155 
156  for( unsigned int icp = 0; icp < singleLegConvOrhpHandle->size(); icp++) {
157  const reco::ConversionRef cpRef(reco::ConversionRef(singleLegConvOrhpHandle,icp));
158  if ( !cpRef->caloCluster().size()) continue;
159  if (!( gamIter->superCluster().id() == cpRef->caloCluster()[0].id() && gamIter->superCluster().key() == cpRef->caloCluster()[0].key() )) continue;
160  gamIter->addOneLegConversion(cpRef);
161  }
162  // debug
163  // std::cout << "PhotonCoreCollection i="<<ipho<<" pf refined SC energy="<<gamIter->superCluster()->energy()<<std::endl;
164  //std::cout << "PhotonCoreCollection i="<<ipho<<" pf SC energy="<<gamIter->parentSuperCluster()->energy()<<std::endl;
165  //std::cout << "PhotonCoreCollection i="<<ipho<<" nconv2leg="<<gamIter->conversions().size()<<" nconv1leg="<<gamIter->conversionsOneLeg().size()<<std::endl;
166  ipho++;
167  }
168 
169 
170 
171  // put the product in the event
172  // edm::LogInfo("GEDPhotonCoreProducer") << " Put in the event " << iSC << " Photon Candidates \n";
173  outputPhotonCoreCollection_p->assign(outputPhotonCoreCollection.begin(),outputPhotonCoreCollection.end());
174  theEvent.put( outputPhotonCoreCollection_p, GEDPhotonCoreCollection_);
175 
176 
177 
178 
179 }
void createSingleLegConversions(reco::CaloClusterPtr, const std::vector< reco::TrackRef > &, const std::vector< float > &, reco::ConversionCollection &oneLegConversions)
void setSuperCluster(const reco::SuperClusterRef &r)
set reference to SuperCluster
Definition: PhotonCore.h:50
void addConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
Definition: PhotonCore.h:54
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void setParentSuperCluster(const reco::SuperClusterRef &r)
set reference to PFlow SuperCluster
Definition: PhotonCore.h:52
void setStandardPhoton(const bool prov)
Definition: PhotonCore.h:61
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
void setPFlowPhoton(const bool prov)
set the provenance
Definition: PhotonCore.h:60
key_type key() const
Accessor for product key.
Definition: Ref.h:266
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
ProductIndex id() const
Definition: ProductID.h:38
void addElectronPixelSeed(const reco::ElectronSeedRef &r)
set electron pixel seed ref
Definition: PhotonCore.h:58
edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_

Member Data Documentation

edm::ParameterSet GEDPhotonCoreProducer::conf_
private

Definition at line 43 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer().

std::string GEDPhotonCoreProducer::GEDPhotonCoreCollection_
private

Definition at line 36 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

double GEDPhotonCoreProducer::minSCEt_
private

Definition at line 41 of file GEDPhotonCoreProducer.h.

std::string GEDPhotonCoreProducer::PFConversionCollection_
private

Definition at line 37 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

edm::EDGetTokenT<reco::PFCandidateCollection> GEDPhotonCoreProducer::pfEgammaCandidates_
private

Definition at line 38 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

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

Definition at line 39 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

bool GEDPhotonCoreProducer::validConversions_
private

Definition at line 42 of file GEDPhotonCoreProducer.h.

bool GEDPhotonCoreProducer::validPixelSeeds_
private

Definition at line 44 of file GEDPhotonCoreProducer.h.

Referenced by produce().