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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::ParameterSet conf_
 
std::string GEDPhotonCoreCollection_
 
double minSCEt_
 
std::string PFConversionCollection_
 
edm::InputTag pfEgammaCandidates_
 
std::string pixelSeedProducer_
 
bool validConversions_
 
bool validPixelSeeds_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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

Id:
GEDPhotonCoreProducer.h,v 1.1 2013/05/07 12:34:14 nancy Exp
Date:
2013/05/07 12:34:14
Revision:
1.1
Author
Nancy Marinelli, U. of Notre Dame, US
Id:
GEDPhotonCoreProducer.cc,v 1.1 2013/05/07 12:33:37 nancy Exp
Date:
2013/05/07 12:33:37
Revision:
1.1
Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 25 of file GEDPhotonCoreProducer.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file GEDPhotonCoreProducer.cc.

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

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

Definition at line 54 of file GEDPhotonCoreProducer.cc.

54 {}

Member Function Documentation

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

Definition at line 159 of file GEDPhotonCoreProducer.cc.

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

Referenced by produce().

159  {
160  // this method translates the single track into the Conversion Data Format
161 
163  for (unsigned int itk=0; itk<conv.size(); itk++){
164  const reco::Vertex * convVtx = new reco::Vertex(conv[itk]->innerPosition(), error);
165  std::vector<reco::TrackRef> OneLegConvVector;
166  OneLegConvVector.push_back(conv[itk]);
167  std::vector< float > OneLegMvaVector;
168  OneLegMvaVector.push_back(mva[itk]);
169  std::vector<reco::CaloClusterPtr> dummymatchingBC;
171  scPtrVec.push_back(sc);
172 
173 
174  std::vector<math::XYZPointF>trackPositionAtEcalVec;
175  std::vector<math::XYZPointF>innPointVec;
176  std::vector<math::XYZVectorF>trackPinVec;
177  std::vector<math::XYZVectorF>trackPoutVec;
178  math::XYZPointF trackPositionAtEcal(conv[itk]->outerPosition().X(), conv[itk]->outerPosition().Y(), conv[itk]->outerPosition().Z());
179  trackPositionAtEcalVec.push_back(trackPositionAtEcal);
180 
181  math::XYZPointF innPoint(conv[itk]->innerPosition().X(), conv[itk]->innerPosition().Y(), conv[itk]->innerPosition().Z());
182  innPointVec.push_back(innPoint);
183 
184  math::XYZVectorF trackPin(conv[itk]->innerMomentum().X(), conv[itk]->innerMomentum().Y(), conv[itk]->innerMomentum().Z());
185  trackPinVec.push_back(trackPin);
186 
187  math::XYZVectorF trackPout(conv[itk]->outerMomentum().X(), conv[itk]->outerMomentum().Y(), conv[itk]->outerMomentum().Z());
188  trackPoutVec.push_back( trackPout );
189 
190  float DCA = conv[itk]->d0() ;
191  reco::Conversion singleLegConvCandidate(scPtrVec,
192  OneLegConvVector,
193  trackPositionAtEcalVec,
194  *convVtx,
195  dummymatchingBC,
196  DCA,
197  innPointVec,
198  trackPinVec,
199  trackPoutVec,
200  mva[itk],
202  singleLegConvCandidate.setOneLegMVA(OneLegMvaVector);
203  oneLegConversions.push_back(singleLegConvCandidate);
204 
205  }
206 
207 
208 
209 }
const double Z[kNumberCalorimeter]
static HepMC::IO_HEPEVT conv
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:137
#define X(str)
Definition: MuonsGrabber.cc:49
ErrorD< N >::type type
Definition: Error.h:30
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:11
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:18
void GEDPhotonCoreProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 59 of file GEDPhotonCoreProducer.cc.

References reco::PhotonCore::addConversion(), createSingleLegConversions(), reco::PFCandidate::gamma, GEDPhotonCoreCollection_, edm::Event::getByLabel(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), edm::InputTag::label(), PFConversionCollection_, pfEgammaCandidates_, edm::Event::put(), edm::refToPtr(), reco::PhotonCore::setPFlowPhoton(), reco::PhotonCore::setPflowSuperCluster(), reco::PhotonCore::setStandardPhoton(), reco::PhotonCore::setSuperCluster(), and edm::RefVector< C, T, F >::size().

59  {
60 
61 
62  using namespace edm;
63  // nEvt_++;
64 
65  reco::PhotonCoreCollection outputPhotonCoreCollection;
66  std::auto_ptr< reco::PhotonCoreCollection > outputPhotonCoreCollection_p(new reco::PhotonCoreCollection);
67 
68  reco::ConversionCollection outputOneLegConversionCollection;
69  std::auto_ptr<reco::ConversionCollection> SingleLeg_p(new reco::ConversionCollection(outputOneLegConversionCollection));
70 
71  // Get the PF refined cluster collection
72  Handle<reco::PFCandidateCollection> pfCandidateHandle;
73  theEvent.getByLabel(pfEgammaCandidates_,pfCandidateHandle);
74  if (!pfCandidateHandle.isValid()) {
75  edm::LogError("GEDPhotonCoreProducer") << "Error! Can't get the product "<<pfEgammaCandidates_.label();
76  }
77 
78 
79  // std::cout << " GEDPhotonCoreProducer::produce input PFcandidate size " << pfCandidateHandle->size() << std::endl;
80 
81 
82  // Loop over PF candidates and get only photons
83 
84  for(unsigned int lCand=0; lCand < pfCandidateHandle->size(); lCand++) {
85  reco::PFCandidateRef candRef (reco::PFCandidateRef(pfCandidateHandle,lCand));
86  if(candRef->particleId()!=reco::PFCandidate::gamma) continue;
87 
88  // Retrieve stuff from the pfPhoton
89  reco::PFCandidateEGammaExtraRef pfPhoRef = candRef->egammaExtraRef();
90  reco::SuperClusterRef refinedSC= pfPhoRef->superClusterRef();
91  reco::SuperClusterRef boxSC= pfPhoRef->superClusterBoxRef();
92  const reco::ConversionRefVector & doubleLegConv = pfPhoRef->conversionRef();
93  reco::CaloClusterPtr refinedSCPtr= edm::refToPtr(refinedSC);
94 
95  // std::cout << "newCandidate doubleLegConv="<<doubleLegConv.size()<< std::endl;
96  //std::cout << "newCandidate singleLegConv="<< pfPhoRef->singleLegConvTrackRef().size()<< std::endl;
97 
99  reco::PhotonCore newCandidate;
100  newCandidate.setPFlowPhoton(true);
101  newCandidate.setStandardPhoton(false);
102  newCandidate.setSuperCluster(refinedSC);
103  newCandidate.setPflowSuperCluster(boxSC);
104  // fill conversion infos
105 
106 
107  for(unsigned int lConv=0; lConv < doubleLegConv.size(); lConv++) {
108  newCandidate.addConversion(doubleLegConv[lConv]);
109  }
110 
111  // std::cout << "newCandidate pf refined SC energy="<< newCandidate.superCluster()->energy()<<std::endl;
112  //std::cout << "newCandidate pf SC energy="<< newCandidate.pfSuperCluster()->energy()<<std::endl;
113  //std::cout << "newCandidate nconv2leg="<<newCandidate.conversions().size()<< std::endl;
114 
115 
116 
117  //
118  createSingleLegConversions(refinedSCPtr, pfPhoRef->singleLegConvTrackRef(), pfPhoRef->singleLegConvMva(), outputOneLegConversionCollection);
119  outputPhotonCoreCollection.push_back(newCandidate);
120  }
121 
122 
123  const edm::OrphanHandle<reco::ConversionCollection> singleLegConvOrhpHandle = theEvent.put(SingleLeg_p,PFConversionCollection_);
124 
125  // std::cout << " GEDPhotonCoreProducer::produce orphanHandle to single legs " << singleLegConvOrhpHandle->size() << std::endl;
126  //std::cout << " GEDPhotonCoreProducer::produce photon size " << outputPhotonCoreCollection.size() << std::endl;
127 
128 
129 
130  int ipho=0;
131  for (reco::PhotonCoreCollection::iterator gamIter=outputPhotonCoreCollection.begin(); gamIter != outputPhotonCoreCollection.end(); ++gamIter){
132 
133  for( unsigned int icp = 0; icp < singleLegConvOrhpHandle->size(); icp++) {
134  const reco::ConversionRef cpRef(reco::ConversionRef(singleLegConvOrhpHandle,icp));
135  if ( !cpRef->caloCluster().size()) continue;
136  if (!( gamIter->superCluster().id() == cpRef->caloCluster()[0].id() && gamIter->superCluster().key() == cpRef->caloCluster()[0].key() )) continue;
137  gamIter->addOneLegConversion(cpRef);
138  }
139  // debug
140  // std::cout << "PhotonCoreCollection i="<<ipho<<" pf refined SC energy="<<gamIter->superCluster()->energy()<<std::endl;
141  //std::cout << "PhotonCoreCollection i="<<ipho<<" pf SC energy="<<gamIter->pfSuperCluster()->energy()<<std::endl;
142  //std::cout << "PhotonCoreCollection i="<<ipho<<" nconv2leg="<<gamIter->conversions().size()<<" nconv1leg="<<gamIter->conversionsOneLeg().size()<<std::endl;
143  ipho++;
144  }
145 
146 
147 
148  // put the product in the event
149  // edm::LogInfo("GEDPhotonCoreProducer") << " Put in the event " << iSC << " Photon Candidates \n";
150  outputPhotonCoreCollection_p->assign(outputPhotonCoreCollection.begin(),outputPhotonCoreCollection.end());
151  theEvent.put( outputPhotonCoreCollection_p, GEDPhotonCoreCollection_);
152 
153 
154 
155 
156 }
void setPflowSuperCluster(const reco::SuperClusterRef &r)
set reference to PFlow SuperCluster
Definition: PhotonCore.h:53
void setSuperCluster(const reco::SuperClusterRef &r)
set reference to SuperCluster
Definition: PhotonCore.h:51
void addConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
Definition: PhotonCore.h:55
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
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
void createSingleLegConversions(reco::CaloClusterPtr, std::vector< reco::TrackRef >, std::vector< float >, reco::ConversionCollection &oneLegConversions)
void setStandardPhoton(const bool prov)
Definition: PhotonCore.h:62
void setPFlowPhoton(const bool prov)
set the provenance
Definition: PhotonCore.h:61
std::string const & label() const
Definition: InputTag.h:42
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89

Member Data Documentation

edm::ParameterSet GEDPhotonCoreProducer::conf_
private

Definition at line 45 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer().

std::string GEDPhotonCoreProducer::GEDPhotonCoreCollection_
private

Definition at line 38 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

double GEDPhotonCoreProducer::minSCEt_
private

Definition at line 42 of file GEDPhotonCoreProducer.h.

std::string GEDPhotonCoreProducer::PFConversionCollection_
private

Definition at line 39 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

edm::InputTag GEDPhotonCoreProducer::pfEgammaCandidates_
private

Definition at line 40 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

std::string GEDPhotonCoreProducer::pixelSeedProducer_
private

Definition at line 44 of file GEDPhotonCoreProducer.h.

bool GEDPhotonCoreProducer::validConversions_
private

Definition at line 43 of file GEDPhotonCoreProducer.h.

bool GEDPhotonCoreProducer::validPixelSeeds_
private

Definition at line 46 of file GEDPhotonCoreProducer.h.