test
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
ConvertedPhotonProducer Class Reference

#include <ConvertedPhotonProducer.h>

Inheritance diagram for ConvertedPhotonProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &, const edm::EventSetup &es) overridefinal
 
 ConvertedPhotonProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
virtual ~ConvertedPhotonProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 buildCollections (edm::EventSetup const &es, const edm::Handle< edm::View< reco::CaloCluster > > &scHandle, const edm::Handle< edm::View< reco::CaloCluster > > &bcHandle, const edm::Handle< CaloTowerCollection > &hcalTowersHandle, const edm::Handle< reco::TrackCollection > &trkHandle, std::map< std::vector< reco::TransientTrack >, reco::CaloClusterPtr, CompareTwoTracksVectors > &allPairs, reco::ConversionCollection &outputConvPhotonCollection)
 
float calculateMinApproachDistance (const reco::TrackRef &track1, const reco::TrackRef &track2)
 
void cleanCollections (const edm::Handle< edm::View< reco::CaloCluster > > &scHandle, const edm::OrphanHandle< reco::ConversionCollection > &conversionHandle, reco::ConversionCollection &outputCollection)
 
void getCircleCenter (const reco::TrackRef &tk, double r, double &x0, double &y0)
 
std::vector< reco::ConversionRefsolveAmbiguity (const edm::OrphanHandle< reco::ConversionCollection > &conversionHandle, reco::CaloClusterPtr &sc)
 
math::XYZPointF toFConverterP (const math::XYZPoint &val)
 
math::XYZVectorF toFConverterV (const math::XYZVector &val)
 

Private Attributes

std::string algoName_
 
edm::EDGetTokenT< edm::View
< reco::CaloCluster > > 
bcBarrelCollection_
 
edm::EDGetTokenT< edm::View
< reco::CaloCluster > > 
bcEndcapCollection_
 
std::string CleanedConvertedPhotonCollection_
 
edm::ParameterSet conf_
 
edm::EDGetTokenT
< reco::TrackCollection
conversionIOTrackProducer_
 
edm::EDGetTokenT
< reco::TrackCollection
conversionOITrackProducer_
 
std::string ConvertedPhotonCollection_
 
double deltaCotCut_
 
double dRForConversionRecovery_
 
edm::EDGetTokenT
< reco::TrackCollection
generalTrackProducer_
 
edm::EDGetTokenT
< CaloTowerCollection
hcalTowers_
 
double hOverEConeSize_
 
edm::EDGetTokenT
< reco::TrackCaloClusterPtrAssociation
inOutTrackSCAssociationCollection_
 
std::string likelihoodWeights_
 
double maxHOverE_
 
int maxNumOfCandidates_
 
double minApproachDisCut_
 
double minSCEt_
 
int nEvt_
 
edm::EDGetTokenT
< reco::TrackCaloClusterPtrAssociation
outInTrackSCAssociationCollection_
 
bool recoverOneTrackCase_
 
bool risolveAmbiguity_
 
edm::EDGetTokenT< edm::View
< reco::CaloCluster > > 
scHybridBarrelProducer_
 
edm::EDGetTokenT< edm::View
< reco::CaloCluster > > 
scIslandEndcapProducer_
 
edm::ESHandle< CaloGeometrytheCaloGeom_
 
ConversionTrackEcalImpactPointtheEcalImpactPositionFinder_
 
ConversionLikelihoodCalculatortheLikelihoodCalc_
 
edm::ESHandle< MagneticFieldtheMF_
 
ConversionTrackPairFindertheTrackPairFinder_
 
edm::ESHandle
< TransientTrackBuilder
theTransientTrackBuilder_
 
ConversionVertexFindertheVertexFinder_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 34 of file ConvertedPhotonProducer.h.

Constructor & Destructor Documentation

ConvertedPhotonProducer::ConvertedPhotonProducer ( const edm::ParameterSet ps)

Definition at line 46 of file ConvertedPhotonProducer.cc.

References algoName_, bcBarrelCollection_, bcEndcapCollection_, CleanedConvertedPhotonCollection_, conf_, conversionIOTrackProducer_, conversionOITrackProducer_, ConvertedPhotonCollection_, deltaCotCut_, dRForConversionRecovery_, generalTrackProducer_, edm::ParameterSet::getParameter(), hcalTowers_, hOverEConeSize_, inOutTrackSCAssociationCollection_, likelihoodWeights_, maxHOverE_, maxNumOfCandidates_, minApproachDisCut_, minSCEt_, nEvt_, outInTrackSCAssociationCollection_, recoverOneTrackCase_, risolveAmbiguity_, scHybridBarrelProducer_, scIslandEndcapProducer_, AlCaHLTBitMon_QueryRunRegistry::string, theLikelihoodCalc_, theTrackPairFinder_, and theVertexFinder_.

46  :
47  conf_(config),
49  theVertexFinder_(0),
51 {
52 
53 
54 
55  //cout<< " ConvertedPhotonProducer CTOR " << "\n";
56 
57 
58 
59  // use onfiguration file to setup input collection names
61  consumes<edm::View<reco::CaloCluster> >(conf_.getParameter<edm::InputTag>("bcBarrelCollection"));
63  consumes<edm::View<reco::CaloCluster> >(conf_.getParameter<edm::InputTag>("bcEndcapCollection"));
64 
66  consumes<edm::View<reco::CaloCluster> >(conf_.getParameter<edm::InputTag>("scHybridBarrelProducer"));
68  consumes<edm::View<reco::CaloCluster> >(conf_.getParameter<edm::InputTag>("scIslandEndcapProducer"));
69 
70  std::string oitrackprod =
71  conf_.getParameter<std::string>("conversionOITrackProducer");
72  std::string iotrackprod =
73  conf_.getParameter<std::string>("conversionIOTrackProducer");
74 
75  std::string oitrackassoc =
76  conf_.getParameter<std::string>("outInTrackSCAssociation");
77  std::string iotrackassoc =
78  conf_.getParameter<std::string>("inOutTrackSCAssociation");
79 
80  edm::InputTag oitracks(oitrackprod),oitracksassoc(oitrackprod,oitrackassoc),
81  iotracks(iotrackprod), iotracksassoc(iotrackprod,iotrackassoc);
82 
83  conversionOITrackProducer_ = consumes<reco::TrackCollection>(oitracks);
85  consumes<reco::TrackCaloClusterPtrAssociation>(oitracksassoc);
86  conversionIOTrackProducer_ = consumes<reco::TrackCollection>(iotracks);
88  consumes<reco::TrackCaloClusterPtrAssociation>(iotracksassoc);
89 
91  consumes<reco::TrackCollection>(conf_.getParameter<edm::InputTag>("generalTracksSrc"));
92 
93  algoName_ = conf_.getParameter<std::string>( "AlgorithmName" );
94 
95  hcalTowers_ =
96  consumes<CaloTowerCollection>(conf_.getParameter<edm::InputTag>("hcalTowers"));
97  hOverEConeSize_ = conf_.getParameter<double>("hOverEConeSize");
98  maxHOverE_ = conf_.getParameter<double>("maxHOverE");
99  minSCEt_ = conf_.getParameter<double>("minSCEt");
100  recoverOneTrackCase_ = conf_.getParameter<bool>( "recoverOneTrackCase" );
101  dRForConversionRecovery_ = conf_.getParameter<double>("dRForConversionRecovery");
102  deltaCotCut_ = conf_.getParameter<double>("deltaCotCut");
103  minApproachDisCut_ = conf_.getParameter<double>("minApproachDisCut");
104 
105  maxNumOfCandidates_ = conf_.getParameter<int>("maxNumOfCandidates");
106  risolveAmbiguity_ = conf_.getParameter<bool>("risolveConversionAmbiguity");
107  likelihoodWeights_= conf_.getParameter<std::string>("MVA_weights_location");
108 
109 
110  // use configuration file to setup output collection names
111  ConvertedPhotonCollection_ = conf_.getParameter<std::string>("convertedPhotonCollection");
112  CleanedConvertedPhotonCollection_ = conf_.getParameter<std::string>("cleanedConvertedPhotonCollection");
113 
114 
115  // Register the product
116  produces< reco::ConversionCollection >(ConvertedPhotonCollection_);
117  produces< reco::ConversionCollection >(CleanedConvertedPhotonCollection_);
118 
119  // instantiate the Track Pair Finder algorithm
121  edm::FileInPath path_mvaWeightFile(likelihoodWeights_.c_str() );
123  theLikelihoodCalc_->setWeightsFile(path_mvaWeightFile.fullPath().c_str());
124  // instantiate the Vertex Finder algorithm
126 
127 
128  // Inizilize my global event counter
129  nEvt_=0;
130 
131 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCaloClusterPtrAssociation > outInTrackSCAssociationCollection_
ConversionTrackPairFinder * theTrackPairFinder_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > bcEndcapCollection_
edm::EDGetTokenT< reco::TrackCollection > conversionIOTrackProducer_
ConversionVertexFinder * theVertexFinder_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > scIslandEndcapProducer_
edm::EDGetTokenT< reco::TrackCollection > generalTrackProducer_
edm::EDGetTokenT< CaloTowerCollection > hcalTowers_
edm::EDGetTokenT< reco::TrackCollection > conversionOITrackProducer_
edm::EDGetTokenT< reco::TrackCaloClusterPtrAssociation > inOutTrackSCAssociationCollection_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > bcBarrelCollection_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > scHybridBarrelProducer_
ConversionLikelihoodCalculator * theLikelihoodCalc_
ConvertedPhotonProducer::~ConvertedPhotonProducer ( )
virtual

Definition at line 133 of file ConvertedPhotonProducer.cc.

References theLikelihoodCalc_, theTrackPairFinder_, and theVertexFinder_.

133  {
134  delete theTrackPairFinder_;
135  delete theLikelihoodCalc_;
136  delete theVertexFinder_;
137 }
ConversionTrackPairFinder * theTrackPairFinder_
ConversionVertexFinder * theVertexFinder_
ConversionLikelihoodCalculator * theLikelihoodCalc_

Member Function Documentation

void ConvertedPhotonProducer::beginRun ( edm::Run const &  r,
const edm::EventSetup es 
)
finaloverridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 141 of file ConvertedPhotonProducer.cc.

References edm::EventSetup::get(), theMF_, and theTransientTrackBuilder_.

141  {
142 
143 
144  //get magnetic field
145  //edm::LogInfo("ConvertedPhotonProducer") << " get magnetic field" << "\n";
146  theEventSetup.get<IdealMagneticFieldRecord>().get(theMF_);
147 
148  // Transform Track into TransientTrack (needed by the Vertex fitter)
149  theEventSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTransientTrackBuilder_);
150 
151 
152 }
edm::ESHandle< TransientTrackBuilder > theTransientTrackBuilder_
edm::ESHandle< MagneticField > theMF_
void ConvertedPhotonProducer::buildCollections ( edm::EventSetup const &  es,
const edm::Handle< edm::View< reco::CaloCluster > > &  scHandle,
const edm::Handle< edm::View< reco::CaloCluster > > &  bcHandle,
const edm::Handle< CaloTowerCollection > &  hcalTowersHandle,
const edm::Handle< reco::TrackCollection > &  trkHandle,
std::map< std::vector< reco::TransientTrack >, reco::CaloClusterPtr, CompareTwoTracksVectors > &  allPairs,
reco::ConversionCollection outputConvPhotonCollection 
)
private

Definition at line 320 of file ConvertedPhotonProducer.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, reco::Conversion::algoByName(), algoName_, begin, ConversionLikelihoodCalculator::calculateLikelihood(), calculateMinApproachDistance(), edm::PtrVectorBase::clear(), deltaCotCut_, dPhi(), dRForConversionRecovery_, alignCSCRings::e, end, reco::CaloCluster::energy(), cms::Exception::explainSelf(), ConversionTrackEcalImpactPoint::find(), EgammaTowerIsolation::getTowerESum(), hOverEConeSize_, i, edm::Ref< C, T, F >::isNonnull(), reco::Vertex::isValid(), ConversionTrackEcalImpactPoint::matchingBC(), maxHOverE_, metname, minApproachDisCut_, minSCEt_, p4, reco::TrackTransientTrack::persistentTrackRef(), edm::Handle< T >::product(), edm::PtrVector< T >::push_back(), recoverOneTrackCase_, ConversionVertexFinder::run(), reco::Conversion::setMVAout(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), theLikelihoodCalc_, theMF_, theVertexFinder_, toFConverterP(), and toFConverterV().

Referenced by produce().

328 {
329 
330  // instantiate the algorithm for finding the position of the track extrapolation at the Ecal front face
331  ConversionTrackEcalImpactPoint theEcalImpactPositionFinder( &(*theMF_) );
332 
333 
335 
336  std::vector<reco::TransientTrack> t_generalTrk;
337  if ( recoverOneTrackCase_ ) t_generalTrk = ( *theTransientTrackBuilder_ ).build(generalTrkHandle );
338  //const CaloGeometry* geometry = theCaloGeom_.product();
339 
340  // Loop over SC in the barrel and reconstruct converted photons
341  int myCands=0;
343  for (unsigned i = 0; i < scHandle->size(); ++i ) {
344  reco::CaloClusterPtr aClus= scHandle->ptrAt(i);
345 
346  // preselection based in Et and H/E cut
347  if (aClus->energy()/cosh(aClus->eta()) <= minSCEt_) continue;
348  const reco::CaloCluster* pClus=&(*aClus);
349  const reco::SuperCluster* sc=dynamic_cast<const reco::SuperCluster*>(pClus);
350  const CaloTowerCollection* hcalTowersColl = hcalTowersHandle.product();
351  EgammaTowerIsolation towerIso(hOverEConeSize_,0.,0.,-1,hcalTowersColl) ;
352  double HoE=towerIso.getTowerESum(sc)/sc->energy();
353  if (HoE>=maxHOverE_) continue;
355 
356 
357  std::vector<edm::Ref<reco::TrackCollection> > trackPairRef;
358  std::vector<math::XYZPointF> trackInnPos;
359  std::vector<math::XYZVectorF> trackPin;
360  std::vector<math::XYZVectorF> trackPout;
361  float minAppDist=-99;
362 
363  //LogDebug("ConvertedPhotonProducer") << "ConvertedPhotonProducer SC energy " << aClus->energy() << " eta " << aClus->eta() << " phi " << aClus->phi() << "\n";
364 
365 
367  const reco::Particle::Point vtx( 0, 0, 0 );
368 
369 
370  math::XYZVector direction =aClus->position() - vtx;
371  math::XYZVector momentum = direction.unit() * aClus->energy();
372  const reco::Particle::LorentzVector p4(momentum.x(), momentum.y(), momentum.z(), aClus->energy() );
373 
374  int nFound=0;
375  if ( allPairs.size() ) {
376 
377  nFound=0;
378 
379 
380  for ( std::map<std::vector<reco::TransientTrack>, reco::CaloClusterPtr>::const_iterator iPair= allPairs.begin(); iPair!= allPairs.end(); ++iPair ) {
381  scPtrVec.clear();
382 
383  reco::Vertex theConversionVertex;
384  reco::CaloClusterPtr caloPtr=iPair->second;
385  if ( !( aClus == caloPtr ) ) continue;
386 
387  scPtrVec.push_back(aClus);
388  nFound++;
389 
390  std::vector<math::XYZPointF> trkPositionAtEcal = theEcalImpactPositionFinder.find( iPair->first, bcHandle );
391  std::vector<reco::CaloClusterPtr> matchingBC = theEcalImpactPositionFinder.matchingBC();
392 
393 
394  minAppDist=-99;
395  const std::string metname = "ConvertedPhotons|ConvertedPhotonProducer";
396  if ( (iPair->first).size() > 1 ) {
397  try{
398 
399  theVertexFinder_->run(iPair->first, theConversionVertex );
400 
401 
402  }
403  catch ( cms::Exception& e ) {
404  //std::cout << " cms::Exception caught in ConvertedPhotonProducer::produce" << "\n" ;
405  edm::LogWarning(metname) << "cms::Exception caught in ConvertedPhotonProducer::produce\n"
406  << e.explainSelf();
407 
408  }
409 
410  // Old TwoTrackMinimumDistance md;
411  // Old md.calculate ( (iPair->first)[0].initialFreeState(), (iPair->first)[1].initialFreeState() );
412  // Old minAppDist = md.distance();
413 
414 
415 
416 
417 
418 
419 
420  /*
421  for ( unsigned int i=0; i< matchingBC.size(); ++i) {
422  if ( matchingBC[i].isNull() ) std::cout << " This ref to BC is null: skipping " << "\n";
423  else
424  std::cout << " BC energy " << matchingBC[i]->energy() << "\n";
425  }
426  */
427 
428 
430  trackPairRef.clear();
431  trackInnPos.clear();
432  trackPin.clear();
433  trackPout.clear();
434 
435 
436  for ( std::vector<reco::TransientTrack>::const_iterator iTk=(iPair->first).begin(); iTk!= (iPair->first).end(); ++iTk) {
437  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer Transient Tracks in the pair charge " << iTk->charge() << " Num of RecHits " << iTk->recHitsSize() << " inner momentum " << iTk->track().innerMomentum() << "\n";
438 
439  const reco::TrackTransientTrack* ttt = dynamic_cast<const reco::TrackTransientTrack*>(iTk->basicTransientTrack());
440  reco::TrackRef myTkRef= ttt->persistentTrackRef();
441 
442  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer Ref to Rec Tracks in the pair charge " << myTkRef->charge() << " Num of RecHits " << myTkRef->recHitsSize() << " inner momentum " << myTkRef->innerMomentum() << "\n";
443  if ( myTkRef->extra().isNonnull() ) {
444  trackInnPos.push_back( toFConverterP(myTkRef->innerPosition()));
445  trackPin.push_back( toFConverterV( myTkRef->innerMomentum()));
446  trackPout.push_back( toFConverterV(myTkRef->outerMomentum()));
447  }
448  trackPairRef.push_back(myTkRef);
449 
450  }
451 
452  // std::cout << " ConvertedPhotonProducer trackPin size " << trackPin.size() << std::endl;
453  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer SC energy " << aClus->energy() << "\n";
454  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer photon p4 " << p4 << "\n";
455  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer vtx " << vtx.x() << " " << vtx.y() << " " << vtx.z() << "\n";
456  if( theConversionVertex.isValid() ) {
457 
458  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer theConversionVertex " << theConversionVertex.position().x() << " " << theConversionVertex.position().y() << " " << theConversionVertex.position().z() << "\n";
459 
460  }
461  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer trackPairRef " << trackPairRef.size() << "\n";
462 
463 
464  minAppDist=calculateMinApproachDistance( trackPairRef[0], trackPairRef[1]);
465 
466  double like = -999.;
467  reco::Conversion newCandidate(scPtrVec, trackPairRef, trkPositionAtEcal, theConversionVertex, matchingBC, minAppDist, trackInnPos, trackPin, trackPout, like, algo);
468 // like = theLikelihoodCalc_->calculateLikelihood(newCandidate, es );
469  like = theLikelihoodCalc_->calculateLikelihood( newCandidate );
470 // std::cout << "like = " << like << std::endl;
471  newCandidate.setMVAout(like);
472  outputConvPhotonCollection.push_back(newCandidate);
473 
474 
475  myCands++;
476  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer Put the ConvertedPhotonCollection a candidate in the Barrel " << "\n";
477 
478  } else {
479 
480 
481  // std::cout << " ConvertedPhotonProducer case with only one track found " << "\n";
482 
483  //std::cout << " ConvertedPhotonProducer recovering one track " << "\n";
484  trackPairRef.clear();
485  trackInnPos.clear();
486  trackPin.clear();
487  trackPout.clear();
488  std::vector<reco::TransientTrack>::const_iterator iTk=(iPair->first).begin();
489  //std::cout << " ConvertedPhotonProducer Transient Tracks in the pair charge " << iTk->charge() << " Num of RecHits " << iTk->recHitsSize() << " inner momentum " << iTk->track().innerMomentum() << " pt " << sqrt(iTk->track().innerMomentum().perp2()) << "\n";
490  const reco::TrackTransientTrack* ttt = dynamic_cast<const reco::TrackTransientTrack*>(iTk->basicTransientTrack());
491  reco::TrackRef myTk= ttt->persistentTrackRef();
492  if ( myTk->extra().isNonnull() ) {
493  trackInnPos.push_back( toFConverterP(myTk->innerPosition()));
494  trackPin.push_back( toFConverterV(myTk->innerMomentum()));
495  trackPout.push_back( toFConverterV(myTk->outerMomentum()));
496  }
497  trackPairRef.push_back(myTk);
498  //std::cout << " Provenance " << myTk->algoName() << std::endl;
499 
500  if ( recoverOneTrackCase_ ) {
501  float theta1 = myTk->innerMomentum().Theta();
502  float dCot=999.;
503  float dCotTheta=-999.;
504  reco::TrackRef goodRef;
505  std::vector<reco::TransientTrack>::const_iterator iGoodGenTran;
506  for ( std::vector<reco::TransientTrack>::const_iterator iTran= t_generalTrk.begin(); iTran != t_generalTrk.end(); ++iTran) {
507  const reco::TrackTransientTrack* ttt = dynamic_cast<const reco::TrackTransientTrack*>(iTran->basicTransientTrack());
508  reco::TrackRef trRef= ttt->persistentTrackRef();
509  if ( trRef->charge()*myTk->charge() > 0 ) continue;
510  float dEta = trRef->eta() - myTk->eta();
511  float dPhi = trRef->phi() - myTk->phi();
512  if ( sqrt (dEta*dEta + dPhi*dPhi) > dRForConversionRecovery_ ) continue;
513  float theta2 = trRef->innerMomentum().Theta();
514  dCotTheta = 1./tan(theta1) - 1./tan(theta2) ;
515  // std::cout << " ConvertedPhotonProducer recovering general transient track charge " << trRef->charge() << " momentum " << trRef->innerMomentum() << " dcotTheta " << fabs(dCotTheta) << std::endl;
516  if ( fabs(dCotTheta) < dCot ) {
517  dCot = fabs(dCotTheta);
518  goodRef = trRef;
519  iGoodGenTran=iTran;
520  }
521  }
522 
523  if ( goodRef.isNonnull() ) {
524 
525  minAppDist=calculateMinApproachDistance( myTk, goodRef);
526 
527  // std::cout << " ConvertedPhotonProducer chosen dCotTheta " << fabs(dCotTheta) << std::endl;
528  if ( fabs(dCotTheta) < deltaCotCut_ && minAppDist > minApproachDisCut_ ) {
529  trackInnPos.push_back( toFConverterP(goodRef->innerPosition()));
530  trackPin.push_back( toFConverterV(goodRef->innerMomentum()));
531  trackPout.push_back( toFConverterV(goodRef->outerMomentum()));
532  trackPairRef.push_back( goodRef );
533  // std::cout << " ConvertedPhotonProducer adding opposite charge track from generalTrackCollection charge " << goodRef ->charge() << " pt " << sqrt(goodRef->innerMomentum().perp2()) << " trackPairRef size " << trackPairRef.size() << std::endl;
534  //std::cout << " Track Provenenance " << goodRef->algoName() << std::endl;
535  std::vector<reco::TransientTrack> mypair;
536  mypair.push_back(*iTk);
537  mypair.push_back(*iGoodGenTran);
538 
539  try{
540  theVertexFinder_->run(iPair->first, theConversionVertex );
541 
542  }
543  catch ( cms::Exception& e ) {
544  //std::cout << " cms::Exception caught in ConvertedPhotonProducer::produce" << "\n" ;
545  edm::LogWarning(metname) << "cms::Exception caught in ConvertedPhotonProducer::produce\n"
546  << e.explainSelf();
547 
548  }
549  }
550 
551  }
552 
553  } // bool On/Off one track case recovery using generalTracks
554  double like = -999.;
555  reco::Conversion newCandidate(scPtrVec, trackPairRef, trkPositionAtEcal, theConversionVertex, matchingBC, minAppDist, trackInnPos, trackPin, trackPout, like, algo);
556  like = theLikelihoodCalc_->calculateLikelihood(newCandidate);
557  newCandidate.setMVAout(like);
558  outputConvPhotonCollection.push_back(newCandidate);
559 
560 
561 
562 
563  } // case with only on track: looking in general tracks
564 
565 
566 
567 
568  }
569 
570  }
571 
572 
573 
574 
575  }
576 
577 
578 
579 
580 
581 }
int i
Definition: DBlmapReader.cc:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
TransientVertex run(const std::vector< reco::TransientTrack > &pair)
const std::string metname
virtual std::string explainSelf() const
Definition: Exception.cc:146
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:141
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:60
ConversionVertexFinder * theVertexFinder_
static ConversionAlgorithm algoByName(const std::string &name)
Definition: Conversion.cc:163
math::XYZVectorF toFConverterV(const math::XYZVector &val)
TrackRef persistentTrackRef() const
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:18
double p4[4]
Definition: TauolaWrapper.h:92
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
math::XYZPoint Point
point in the space
Definition: Particle.h:25
float calculateMinApproachDistance(const reco::TrackRef &track1, const reco::TrackRef &track2)
double energy() const
cluster energy
Definition: CaloCluster.h:121
#define end
Definition: vmac.h:37
edm::ESHandle< MagneticField > theMF_
double calculateLikelihood(reco::ConversionRef conversion)
T const * product() const
Definition: Handle.h:81
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
void clear()
Clear the PtrVector.
Definition: PtrVectorBase.h:80
#define begin
Definition: vmac.h:30
math::XYZPointF toFConverterP(const math::XYZPoint &val)
ConversionLikelihoodCalculator * theLikelihoodCalc_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
float ConvertedPhotonProducer::calculateMinApproachDistance ( const reco::TrackRef track1,
const reco::TrackRef track2 
)
private

Definition at line 673 of file ConvertedPhotonProducer.cc.

References getCircleCenter(), mathSSE::sqrt(), and theMF_.

Referenced by buildCollections().

673  {
674  float dist=9999.;
675 
676  double x1, x2, y1, y2;
677  double xx_1 = track1->innerPosition().x(), yy_1 = track1->innerPosition().y(), zz_1 = track1->innerPosition().z();
678  double xx_2 = track2->innerPosition().x(), yy_2 = track2->innerPosition().y(), zz_2 = track2->innerPosition().z();
679  double radius1 = track1->innerMomentum().Rho()/(.3*(theMF_->inTesla(GlobalPoint(xx_1, yy_1, zz_1)).z()))*100;
680  double radius2 = track2->innerMomentum().Rho()/(.3*(theMF_->inTesla(GlobalPoint(xx_2, yy_2, zz_2)).z()))*100;
681  getCircleCenter(track1, radius1, x1, y1);
682  getCircleCenter(track2, radius2, x2, y2);
683  dist = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) - radius1 - radius2;
684 
685  return dist;
686 
687 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T sqrt(T t)
Definition: SSEVec.h:18
edm::ESHandle< MagneticField > theMF_
void getCircleCenter(const reco::TrackRef &tk, double r, double &x0, double &y0)
void ConvertedPhotonProducer::cleanCollections ( const edm::Handle< edm::View< reco::CaloCluster > > &  scHandle,
const edm::OrphanHandle< reco::ConversionCollection > &  conversionHandle,
reco::ConversionCollection outputCollection 
)
private

Definition at line 584 of file ConvertedPhotonProducer.cc.

References reco::Conversion::clone(), clone(), edm::Ptr< T >::id(), edm::Ref< C, T, F >::id(), edm::OrphanHandleBase::isValid(), edm::Ptr< T >::key(), edm::Ref< C, T, F >::key(), minSCEt_, risolveAmbiguity_, and solveAmbiguity().

Referenced by produce().

586  {
587 
588 
589  reco::Conversion* newCandidate=0;
590  for(unsigned int lSC=0; lSC < scHandle->size(); lSC++) {
591 
592  // get pointer to SC
593  reco::CaloClusterPtr aClus= scHandle->ptrAt(lSC);
594 
595  // SC energy preselection
596  if (aClus->energy()/cosh(aClus->eta()) <= minSCEt_) continue;
597 
598 
599  if ( conversionHandle.isValid() ) {
600 
601  if ( risolveAmbiguity_ ) {
602  std::vector<reco::ConversionRef> bestRef=solveAmbiguity( conversionHandle , aClus);
603 
604  for ( std::vector<reco::ConversionRef>::iterator iRef=bestRef.begin(); iRef!=bestRef.end(); iRef++ ) {
605  if ( iRef->isNonnull() ) {
606  newCandidate= (*iRef)->clone();
607  outputConversionCollection.push_back(*newCandidate);
608  delete newCandidate;
609  }
610  }
611 
612  } else {
613 
614 
615  for( unsigned int icp = 0; icp < conversionHandle->size(); icp++) {
616  reco::ConversionRef cpRef(reco::ConversionRef(conversionHandle,icp));
617  if (!( aClus.id() == cpRef->caloCluster()[0].id() && aClus.key() == cpRef->caloCluster()[0].key() )) continue;
618  if ( !cpRef->isConverted() ) continue;
619  if ( cpRef->nTracks() <2 ) continue;
620  newCandidate= (&(*cpRef))->clone();
621  outputConversionCollection.push_back(*newCandidate);
622  delete newCandidate;
623 
624  }
625 
626  } // solve or not the ambiguity of many conversion candidates
627 
628  }
629 
630 
631  }
632 }
key_type key() const
Definition: Ptr.h:186
Conversion * clone() const
returns a clone of the candidate
Definition: Conversion.cc:171
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:181
std::vector< reco::ConversionRef > solveAmbiguity(const edm::OrphanHandle< reco::ConversionCollection > &conversionHandle, reco::CaloClusterPtr &sc)
ProductIndex id() const
Definition: ProductID.h:38
void ConvertedPhotonProducer::getCircleCenter ( const reco::TrackRef tk,
double  r,
double &  x0,
double &  y0 
)
private

Definition at line 690 of file ConvertedPhotonProducer.cc.

References RecoTauCleanerPlugins::charge, funct::cos(), phi, and funct::sin().

Referenced by calculateMinApproachDistance().

690  {
691  double x1, y1, phi;
692  x1 = tk->innerPosition().x();//inner position and inner momentum need track Extra!
693  y1 = tk->innerPosition().y();
694  phi = tk->innerMomentum().phi();
695  const int charge = tk->charge();
696  x0 = x1 + r*sin(phi)*charge;
697  y0 = y1 - r*cos(phi)*charge;
698 
699 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void ConvertedPhotonProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 156 of file ConvertedPhotonProducer.cc.

References bcBarrelCollection_, bcEndcapCollection_, buildCollections(), cleanCollections(), CleanedConvertedPhotonCollection_, printConversionInfo::conversionHandle, conversionIOTrackProducer_, conversionOITrackProducer_, ConvertedPhotonCollection_, generalTrackProducer_, edm::EventSetup::get(), edm::Event::getByToken(), hcalTowers_, inOutTrackSCAssociationCollection_, nEvt_, outInTrackSCAssociationCollection_, edm::Event::put(), recoverOneTrackCase_, ConversionTrackPairFinder::run(), scHybridBarrelProducer_, scIslandEndcapProducer_, theCaloGeom_, and theTrackPairFinder_.

156  {
157 
158  using namespace edm;
159  nEvt_++;
160 
161 
162  // LogDebug("ConvertedPhotonProducer") << "ConvertedPhotonProduce::produce event number " << theEvent.id() << " Global counter " << nEvt_ << "\n";
163  // std::cout << "ConvertedPhotonProduce::produce event number " << theEvent.id() << " Global counter " << nEvt_ << "\n";
164 
165  //
166  // create empty output collections
167  //
168  // Converted photon candidates
169  reco::ConversionCollection outputConvPhotonCollection;
170  std::auto_ptr<reco::ConversionCollection> outputConvPhotonCollection_p(new reco::ConversionCollection);
171  // Converted photon candidates
172  reco::ConversionCollection cleanedConversionCollection;
173  std::auto_ptr<reco::ConversionCollection> cleanedConversionCollection_p(new reco::ConversionCollection);
174 
175 
176  // Get the Super Cluster collection in the Barrel
177  bool validBarrelSCHandle=true;
179  theEvent.getByToken(scHybridBarrelProducer_,scBarrelHandle);
180  if (!scBarrelHandle.isValid()) {
181  edm::LogError("ConvertedPhotonProducer")
182  << "Error! Can't get the scHybridBarrelProducer";
183  validBarrelSCHandle=false;
184  }
185 
186  // Get the Super Cluster collection in the Endcap
187  bool validEndcapSCHandle=true;
189  theEvent.getByToken(scIslandEndcapProducer_,scEndcapHandle);
190  if (!scEndcapHandle.isValid()) {
191  edm::LogError("ConvertedPhotonProducer")
192  << "Error! Can't get the scIslandEndcapProducer";
193  validEndcapSCHandle=false;
194  }
195 
196 
198  bool validTrackInputs=true;
199  Handle<reco::TrackCollection> outInTrkHandle;
200  theEvent.getByToken(conversionOITrackProducer_, outInTrkHandle);
201  if (!outInTrkHandle.isValid()) {
202  //std::cout << "Error! Can't get the conversionOITrack " << "\n";
203  edm::LogError("ConvertedPhotonProducer")
204  << "Error! Can't get the conversionOITrack " << "\n";
205  validTrackInputs=false;
206  }
207  // LogDebug("ConvertedPhotonProducer")<< "ConvertedPhotonProducer outInTrack collection size " << (*outInTrkHandle).size() << "\n";
208 
209 
211  Handle<reco::TrackCaloClusterPtrAssociation> outInTrkSCAssocHandle;
212  theEvent.getByToken( outInTrackSCAssociationCollection_, outInTrkSCAssocHandle);
213  if (!outInTrkSCAssocHandle.isValid()) {
214  // std::cout << "Error! Can't get the product " << outInTrackSCAssociationCollection_.c_str() <<"\n";
215  edm::LogError("ConvertedPhotonProducer")
216  << "Error! Can't get the outInTrackSCAssociationCollection)";
217  validTrackInputs=false;
218  }
219 
221  Handle<reco::TrackCollection> inOutTrkHandle;
222  theEvent.getByToken(conversionIOTrackProducer_, inOutTrkHandle);
223  if (!inOutTrkHandle.isValid()) {
224  // std::cout << "Error! Can't get the conversionIOTrack " << "\n";
225  edm::LogError("ConvertedPhotonProducer")
226  << "Error! Can't get the conversionIOTrack " << "\n";
227  validTrackInputs=false;
228  }
229  // LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer inOutTrack collection size " << (*inOutTrkHandle).size() << "\n";
230 
231 
233 
234  Handle<reco::TrackCollection> generalTrkHandle;
235  if ( recoverOneTrackCase_ ) {
236  theEvent.getByToken(generalTrackProducer_, generalTrkHandle);
237  if (!generalTrkHandle.isValid()) {
238  //std::cout << "Error! Can't get the genralTracks " << "\n";
239  edm::LogError("ConvertedPhotonProducer")
240  << "Error! Can't get the genralTracks " << "\n";
241  }
242  }
243 
245  Handle<reco::TrackCaloClusterPtrAssociation> inOutTrkSCAssocHandle;
246  theEvent.getByToken( inOutTrackSCAssociationCollection_, inOutTrkSCAssocHandle);
247  if (!inOutTrkSCAssocHandle.isValid()) {
248  //std::cout << "Error! Can't get the product " << inOutTrackSCAssociationCollection_.c_str() <<"\n";
249  edm::LogError("ConvertedPhotonProducer")
250  << "Error! Can't get the inOutTrackSCAssociationCollection_.c_str()";
251  validTrackInputs=false;
252  }
253 
254 
255 
256 
257  // Get the basic cluster collection in the Barrel
259  theEvent.getByToken( bcBarrelCollection_, bcBarrelHandle);
260  if (!bcBarrelHandle.isValid()) {
261  edm::LogError("ConvertedPhotonProducer")
262  << "Error! Can't get the bcBarrelCollection";
263  }
264 
265 
266  // Get the basic cluster collection in the Endcap
268  theEvent.getByToken( bcEndcapCollection_, bcEndcapHandle);
269  if (!bcEndcapHandle.isValid()) {
270  edm::LogError("ConvertedPhotonProducer")
271  << "Error! Can't get the bcEndcapCollection";
272  }
273 
274 
275 // get Hcal towers collection
276  Handle<CaloTowerCollection> hcalTowersHandle;
277  theEvent.getByToken(hcalTowers_, hcalTowersHandle);
278 
279  // get the geometry from the event setup:
280  theEventSetup.get<CaloGeometryRecord>().get(theCaloGeom_);
281 
282 
283  if ( validTrackInputs ) {
284  //do the conversion:
285  std::vector<reco::TransientTrack> t_outInTrk = ( *theTransientTrackBuilder_ ).build(outInTrkHandle );
286  std::vector<reco::TransientTrack> t_inOutTrk = ( *theTransientTrackBuilder_ ).build(inOutTrkHandle );
287 
288 
290  std::map<std::vector<reco::TransientTrack>, reco::CaloClusterPtr, CompareTwoTracksVectors> allPairs;
291  allPairs = theTrackPairFinder_->run(t_outInTrk, outInTrkHandle, outInTrkSCAssocHandle, t_inOutTrk, inOutTrkHandle, inOutTrkSCAssocHandle );
292  //LogDebug("ConvertedPhotonProducer") << "ConvertedPhotonProducer allPairs.size " << allPairs.size() << "\n";
293 
294  buildCollections(theEventSetup, scBarrelHandle, bcBarrelHandle, hcalTowersHandle, generalTrkHandle, allPairs, outputConvPhotonCollection);
295  buildCollections(theEventSetup, scEndcapHandle, bcEndcapHandle, hcalTowersHandle, generalTrkHandle, allPairs, outputConvPhotonCollection);
296  }
297 
298  // put the product in the event
299  outputConvPhotonCollection_p->assign(outputConvPhotonCollection.begin(),outputConvPhotonCollection.end());
300  //LogDebug("ConvertedPhotonProducer") << " ConvertedPhotonProducer Putting in the event converted photon candidates " << (*outputConvPhotonCollection_p).size() << "\n";
301  const edm::OrphanHandle<reco::ConversionCollection> conversionHandle= theEvent.put( outputConvPhotonCollection_p, ConvertedPhotonCollection_);
302 
303 
304  // Loop over barrel and endcap SC collections and fill the photon collection
305  if ( validBarrelSCHandle) cleanCollections(scBarrelHandle,
307  cleanedConversionCollection);
308  if ( validEndcapSCHandle) cleanCollections(scEndcapHandle,
310  cleanedConversionCollection);
311 
312 
313  cleanedConversionCollection_p->assign(cleanedConversionCollection.begin(),cleanedConversionCollection.end());
314  theEvent.put( cleanedConversionCollection_p, CleanedConvertedPhotonCollection_);
315 
316 
317 }
edm::EDGetTokenT< reco::TrackCaloClusterPtrAssociation > outInTrackSCAssociationCollection_
edm::ESHandle< CaloGeometry > theCaloGeom_
ConversionTrackPairFinder * theTrackPairFinder_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > bcEndcapCollection_
edm::EDGetTokenT< reco::TrackCollection > conversionIOTrackProducer_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > scIslandEndcapProducer_
void buildCollections(edm::EventSetup const &es, const edm::Handle< edm::View< reco::CaloCluster > > &scHandle, const edm::Handle< edm::View< reco::CaloCluster > > &bcHandle, const edm::Handle< CaloTowerCollection > &hcalTowersHandle, const edm::Handle< reco::TrackCollection > &trkHandle, std::map< std::vector< reco::TransientTrack >, reco::CaloClusterPtr, CompareTwoTracksVectors > &allPairs, reco::ConversionCollection &outputConvPhotonCollection)
edm::Ptr< CaloCluster > CaloClusterPtr
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
edm::EDGetTokenT< reco::TrackCollection > generalTrackProducer_
void cleanCollections(const edm::Handle< edm::View< reco::CaloCluster > > &scHandle, const edm::OrphanHandle< reco::ConversionCollection > &conversionHandle, reco::ConversionCollection &outputCollection)
edm::EDGetTokenT< CaloTowerCollection > hcalTowers_
edm::EDGetTokenT< reco::TrackCollection > conversionOITrackProducer_
edm::EDGetTokenT< reco::TrackCaloClusterPtrAssociation > inOutTrackSCAssociationCollection_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > bcBarrelCollection_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > scHybridBarrelProducer_
std::map< std::vector< reco::TransientTrack >, reco::CaloClusterPtr, CompareTwoTracksVectors > run(const std::vector< reco::TransientTrack > &outIn, const edm::Handle< reco::TrackCollection > &outInTrkHandle, const edm::Handle< reco::TrackCaloClusterPtrAssociation > &outInTrackSCAssH, const std::vector< reco::TransientTrack > &inOut, const edm::Handle< reco::TrackCollection > &inOutTrkHandle, const edm::Handle< reco::TrackCaloClusterPtrAssociation > &inOutTrackSCAssH)
std::vector< reco::ConversionRef > ConvertedPhotonProducer::solveAmbiguity ( const edm::OrphanHandle< reco::ConversionCollection > &  conversionHandle,
reco::CaloClusterPtr sc 
)
private

Definition at line 637 of file ConvertedPhotonProducer.cc.

References edm::Ptr< T >::id(), edm::Ref< C, T, F >::id(), edm::Ptr< T >::key(), edm::Ref< C, T, F >::key(), and maxNumOfCandidates_.

Referenced by cleanCollections().

637  {
638  std::multimap<double, reco::ConversionRef, std::greater<double> > convMap;
639 
640  for ( unsigned int icp=0; icp< conversionHandle->size(); icp++) {
641  reco::ConversionRef cpRef(reco::ConversionRef(conversionHandle,icp));
642 
643  //std::cout << " cpRef " << cpRef->nTracks() << " " << cpRef ->caloCluster()[0]->energy() << std::endl;
644  if (!( scRef.id() == cpRef->caloCluster()[0].id() && scRef.key() == cpRef->caloCluster()[0].key() )) continue;
645  if ( !cpRef->isConverted() ) continue;
646  double like = cpRef->MVAout();
647  if ( cpRef->nTracks() <2 ) continue;
648  // std::cout << " Like " << like << std::endl;
649  convMap.insert ( std::make_pair(like,cpRef) );
650 
651  }
652 
653  // std::cout << " convMap size " << convMap.size() << std::endl;
654 
655  std::multimap<double, reco::ConversionRef>::iterator iMap;
656  std::vector<reco::ConversionRef> bestRefs;
657  for (iMap=convMap.begin(); iMap!=convMap.end(); iMap++) {
658  // std::cout << " Like list in the map " << iMap->first << " " << (iMap->second)->EoverP() << std::endl;
659  bestRefs.push_back( iMap->second );
660  if ( int(bestRefs.size()) == maxNumOfCandidates_ ) break;
661  }
662 
663 
664  return bestRefs;
665 
666 
667 }
math::XYZPointF ConvertedPhotonProducer::toFConverterP ( const math::XYZPoint val)
inlineprivate

Definition at line 114 of file ConvertedPhotonProducer.h.

Referenced by buildCollections().

114  {
115  return math::XYZPointF(val.x(),val.y(),val.z());
116  }
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
math::XYZVectorF ConvertedPhotonProducer::toFConverterV ( const math::XYZVector val)
inlineprivate

Definition at line 118 of file ConvertedPhotonProducer.h.

Referenced by buildCollections().

118  {
119  return math::XYZVectorF(val.x(),val.y(),val.z());
120  }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17

Member Data Documentation

std::string ConvertedPhotonProducer::algoName_
private

Definition at line 97 of file ConvertedPhotonProducer.h.

Referenced by buildCollections(), and ConvertedPhotonProducer().

edm::EDGetTokenT<edm::View<reco::CaloCluster> > ConvertedPhotonProducer::bcBarrelCollection_
private

Definition at line 82 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

edm::EDGetTokenT<edm::View<reco::CaloCluster> > ConvertedPhotonProducer::bcEndcapCollection_
private

Definition at line 83 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

std::string ConvertedPhotonProducer::CleanedConvertedPhotonCollection_
private

Definition at line 80 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

edm::ParameterSet ConvertedPhotonProducer::conf_
private

Definition at line 86 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer().

edm::EDGetTokenT<reco::TrackCollection> ConvertedPhotonProducer::conversionIOTrackProducer_
private

Definition at line 69 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

edm::EDGetTokenT<reco::TrackCollection> ConvertedPhotonProducer::conversionOITrackProducer_
private

Definition at line 68 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

std::string ConvertedPhotonProducer::ConvertedPhotonCollection_
private

Definition at line 79 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

double ConvertedPhotonProducer::deltaCotCut_
private

Definition at line 105 of file ConvertedPhotonProducer.h.

Referenced by buildCollections(), and ConvertedPhotonProducer().

double ConvertedPhotonProducer::dRForConversionRecovery_
private

Definition at line 104 of file ConvertedPhotonProducer.h.

Referenced by buildCollections(), and ConvertedPhotonProducer().

edm::EDGetTokenT<reco::TrackCollection> ConvertedPhotonProducer::generalTrackProducer_
private

Definition at line 77 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

edm::EDGetTokenT<CaloTowerCollection> ConvertedPhotonProducer::hcalTowers_
private

Definition at line 87 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

double ConvertedPhotonProducer::hOverEConeSize_
private

Definition at line 100 of file ConvertedPhotonProducer.h.

Referenced by buildCollections(), and ConvertedPhotonProducer().

edm::EDGetTokenT<reco::TrackCaloClusterPtrAssociation> ConvertedPhotonProducer::inOutTrackSCAssociationCollection_
private

Definition at line 75 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

std::string ConvertedPhotonProducer::likelihoodWeights_
private

Definition at line 112 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer().

double ConvertedPhotonProducer::maxHOverE_
private

Definition at line 101 of file ConvertedPhotonProducer.h.

Referenced by buildCollections(), and ConvertedPhotonProducer().

int ConvertedPhotonProducer::maxNumOfCandidates_
private

Definition at line 107 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and solveAmbiguity().

double ConvertedPhotonProducer::minApproachDisCut_
private

Definition at line 106 of file ConvertedPhotonProducer.h.

Referenced by buildCollections(), and ConvertedPhotonProducer().

double ConvertedPhotonProducer::minSCEt_
private
int ConvertedPhotonProducer::nEvt_
private

Definition at line 96 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

edm::EDGetTokenT<reco::TrackCaloClusterPtrAssociation> ConvertedPhotonProducer::outInTrackSCAssociationCollection_
private

Definition at line 73 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

bool ConvertedPhotonProducer::recoverOneTrackCase_
private

Definition at line 103 of file ConvertedPhotonProducer.h.

Referenced by buildCollections(), ConvertedPhotonProducer(), and produce().

bool ConvertedPhotonProducer::risolveAmbiguity_
private

Definition at line 108 of file ConvertedPhotonProducer.h.

Referenced by cleanCollections(), and ConvertedPhotonProducer().

edm::EDGetTokenT<edm::View<reco::CaloCluster> > ConvertedPhotonProducer::scHybridBarrelProducer_
private

Definition at line 84 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

edm::EDGetTokenT<edm::View<reco::CaloCluster> > ConvertedPhotonProducer::scIslandEndcapProducer_
private

Definition at line 85 of file ConvertedPhotonProducer.h.

Referenced by ConvertedPhotonProducer(), and produce().

edm::ESHandle<CaloGeometry> ConvertedPhotonProducer::theCaloGeom_
private

Definition at line 89 of file ConvertedPhotonProducer.h.

Referenced by produce().

ConversionTrackEcalImpactPoint* ConvertedPhotonProducer::theEcalImpactPositionFinder_
private

Definition at line 95 of file ConvertedPhotonProducer.h.

ConversionLikelihoodCalculator* ConvertedPhotonProducer::theLikelihoodCalc_
private
edm::ESHandle<MagneticField> ConvertedPhotonProducer::theMF_
private
ConversionTrackPairFinder* ConvertedPhotonProducer::theTrackPairFinder_
private
edm::ESHandle<TransientTrackBuilder> ConvertedPhotonProducer::theTransientTrackBuilder_
private

Definition at line 91 of file ConvertedPhotonProducer.h.

Referenced by beginRun().

ConversionVertexFinder* ConvertedPhotonProducer::theVertexFinder_
private