Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-08 05:11:58

0001 /** \class ConversionTrackCandidateProducer
0002  **  
0003  **
0004  **  \author Nancy Marinelli, U. of Notre Dame, US
0005  **
0006  ***/
0007 
0008 #include "CommonTools/Utils/interface/StringToEnumValue.h"
0009 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
0010 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0011 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
0012 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0013 #include "DataFormats/Common/interface/Handle.h"
0014 #include "DataFormats/Common/interface/View.h"
0015 #include "DataFormats/DetId/interface/DetId.h"
0016 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0017 #include "DataFormats/EgammaTrackReco/interface/TrackCandidateCaloClusterAssociation.h"
0018 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
0019 #include "FWCore/Framework/interface/ConsumesCollector.h"
0020 #include "FWCore/Framework/interface/ESHandle.h"
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "FWCore/Framework/interface/EventSetup.h"
0023 #include "FWCore/Framework/interface/stream/EDProducer.h"
0024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0025 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0028 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0029 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0030 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h"
0031 #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionSeedFinder.h"
0032 #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackFinder.h"
0033 #include "RecoEgamma/EgammaPhotonAlgos/interface/InOutConversionSeedFinder.h"
0034 #include "RecoEgamma/EgammaPhotonAlgos/interface/InOutConversionTrackFinder.h"
0035 #include "RecoEgamma/EgammaPhotonAlgos/interface/OutInConversionSeedFinder.h"
0036 #include "RecoEgamma/EgammaPhotonAlgos/interface/OutInConversionTrackFinder.h"
0037 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
0038 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
0039 #include "RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h"
0040 #include "RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilderFactory.h"
0041 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
0042 #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
0043 #include "RecoTracker/Record/interface/NavigationSchoolRecord.h"
0044 #include "TrackingTools/DetLayers/interface/NavigationSchool.h"
0045 #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h"
0046 #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
0047 #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"
0048 #include <vector>
0049 
0050 class ConversionTrackCandidateProducer : public edm::stream::EDProducer<> {
0051 public:
0052   ConversionTrackCandidateProducer(const edm::ParameterSet& ps);
0053 
0054   void beginRun(edm::Run const&, edm::EventSetup const& es) final;
0055   void produce(edm::Event& evt, const edm::EventSetup& es) override;
0056 
0057   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0058 
0059 private:
0060   /// Initialize EventSetup objects at each event
0061   void setEventSetup(const edm::EventSetup& es);
0062 
0063   std::string OutInTrackCandidateCollection_;
0064   std::string InOutTrackCandidateCollection_;
0065 
0066   std::string OutInTrackSCAssociationCollection_;
0067   std::string InOutTrackSCAssociationCollection_;
0068 
0069   edm::EDGetTokenT<edm::View<reco::CaloCluster>> bcBarrelCollection_;
0070   edm::EDGetTokenT<edm::View<reco::CaloCluster>> bcEndcapCollection_;
0071   edm::EDGetTokenT<edm::View<reco::CaloCluster>> scHybridBarrelProducer_;
0072   edm::EDGetTokenT<edm::View<reco::CaloCluster>> scIslandEndcapProducer_;
0073   edm::EDGetTokenT<HBHERecHitCollection> hbheRecHits_;
0074   edm::EDGetTokenT<EcalRecHitCollection> barrelecalCollection_;
0075   edm::EDGetTokenT<EcalRecHitCollection> endcapecalCollection_;
0076   edm::EDGetTokenT<MeasurementTrackerEvent> measurementTrkEvtToken_;
0077 
0078   const edm::ESGetToken<NavigationSchool, NavigationSchoolRecord> navToken_;
0079   const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> theCaloGeomToken_;
0080   const edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> sevlvToken_;
0081   const edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> ecalPFRechitThresholdsToken_;
0082   const EcalPFRecHitThresholds* thresholds = nullptr;
0083 
0084   double hOverEConeSize_;
0085   double maxHOverE_;
0086   double minSCEt_;
0087   double isoConeR_;
0088   double isoInnerConeR_;
0089   double isoEtaSlice_;
0090   double isoEtMin_;
0091   double isoEMin_;
0092   bool vetoClusteredHits_;
0093   bool useNumXtals_;
0094 
0095   std::vector<int> flagsexclEB_;
0096   std::vector<int> flagsexclEE_;
0097   std::vector<int> severitiesexclEB_;
0098   std::vector<int> severitiesexclEE_;
0099 
0100   double ecalIsoCut_offset_;
0101   double ecalIsoCut_slope_;
0102 
0103   edm::ESHandle<CaloGeometry> theCaloGeom_;
0104 
0105   std::unique_ptr<BaseCkfTrajectoryBuilder> theTrajectoryBuilder_;
0106 
0107   OutInConversionSeedFinder outInSeedFinder_;
0108   OutInConversionTrackFinder outInTrackFinder_;
0109   InOutConversionSeedFinder inOutSeedFinder_;
0110   InOutConversionTrackFinder inOutTrackFinder_;
0111 
0112   std::vector<edm::Ptr<reco::CaloCluster>> caloPtrVecOutIn_;
0113   std::vector<edm::Ptr<reco::CaloCluster>> caloPtrVecInOut_;
0114 
0115   std::vector<edm::Ref<reco::SuperClusterCollection>> vecOfSCRefForOutIn;
0116   std::vector<edm::Ref<reco::SuperClusterCollection>> vecOfSCRefForInOut;
0117 
0118   std::unique_ptr<ElectronHcalHelper> hcalHelper_;
0119 
0120   edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> hcalCutsToken_;
0121   bool cutsFromDB;
0122   HcalPFCuts const* hcalCuts = nullptr;
0123 
0124   void buildCollections(bool detector,
0125                         const edm::Handle<edm::View<reco::CaloCluster>>& scHandle,
0126                         const edm::Handle<edm::View<reco::CaloCluster>>& bcHandle,
0127                         const EcalRecHitCollection& ecalRecHits,
0128                         const EcalSeverityLevelAlgo* sevLev,
0129                         ElectronHcalHelper const& hcalHelper,
0130                         TrackCandidateCollection& outInTracks,
0131                         TrackCandidateCollection& inOutTracks,
0132                         std::vector<edm::Ptr<reco::CaloCluster>>& vecRecOI,
0133                         std::vector<edm::Ptr<reco::CaloCluster>>& vecRecIO);
0134 };
0135 
0136 #include "FWCore/Framework/interface/MakerMacros.h"
0137 DEFINE_FWK_MODULE(ConversionTrackCandidateProducer);
0138 
0139 namespace {
0140   auto createBaseCkfTrajectoryBuilder(const edm::ParameterSet& pset, edm::ConsumesCollector&& iC) {
0141     return BaseCkfTrajectoryBuilderFactory::get()->create(pset.getParameter<std::string>("ComponentType"), pset, iC);
0142   }
0143 }  // namespace
0144 
0145 ConversionTrackCandidateProducer::ConversionTrackCandidateProducer(const edm::ParameterSet& config)
0146     : bcBarrelCollection_{consumes(config.getParameter<edm::InputTag>("bcBarrelCollection"))},
0147       bcEndcapCollection_{consumes(config.getParameter<edm::InputTag>("bcEndcapCollection"))},
0148       scHybridBarrelProducer_{consumes(config.getParameter<edm::InputTag>("scHybridBarrelProducer"))},
0149       scIslandEndcapProducer_{consumes(config.getParameter<edm::InputTag>("scIslandEndcapProducer"))},
0150 
0151       hbheRecHits_{consumes(config.getParameter<edm::InputTag>("hbheRecHits"))},
0152       barrelecalCollection_{consumes(config.getParameter<edm::InputTag>("barrelEcalRecHitCollection"))},
0153       endcapecalCollection_{consumes(config.getParameter<edm::InputTag>("endcapEcalRecHitCollection"))},
0154       measurementTrkEvtToken_{consumes(edm::InputTag("MeasurementTrackerEvent"))},
0155 
0156       navToken_(esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "SimpleNavigationSchool"))),
0157       theCaloGeomToken_(esConsumes()),
0158       sevlvToken_(esConsumes()),
0159       ecalPFRechitThresholdsToken_{esConsumes()},
0160       theTrajectoryBuilder_(createBaseCkfTrajectoryBuilder(
0161           config.getParameter<edm::ParameterSet>("TrajectoryBuilderPSet"), consumesCollector())),
0162       outInSeedFinder_{config, consumesCollector()},
0163       outInTrackFinder_{config, theTrajectoryBuilder_.get(), consumesCollector()},
0164       inOutSeedFinder_{config, consumesCollector()},
0165       inOutTrackFinder_{config, theTrajectoryBuilder_.get(), consumesCollector()} {
0166   OutInTrackCandidateCollection_ = config.getParameter<std::string>("outInTrackCandidateCollection");
0167   InOutTrackCandidateCollection_ = config.getParameter<std::string>("inOutTrackCandidateCollection");
0168 
0169   OutInTrackSCAssociationCollection_ = config.getParameter<std::string>("outInTrackCandidateSCAssociationCollection");
0170   InOutTrackSCAssociationCollection_ = config.getParameter<std::string>("inOutTrackCandidateSCAssociationCollection");
0171 
0172   cutsFromDB = config.getParameter<bool>("usePFThresholdsFromDB");
0173   if (cutsFromDB) {
0174     hcalCutsToken_ = esConsumes<HcalPFCuts, HcalPFCutsRcd, edm::Transition::BeginRun>(edm::ESInputTag("", "withTopo"));
0175   }
0176   hOverEConeSize_ = config.getParameter<double>("hOverEConeSize");
0177   maxHOverE_ = config.getParameter<double>("maxHOverE");
0178   minSCEt_ = config.getParameter<double>("minSCEt");
0179   isoConeR_ = config.getParameter<double>("isoConeR");
0180   isoInnerConeR_ = config.getParameter<double>("isoInnerConeR");
0181   isoEtaSlice_ = config.getParameter<double>("isoEtaSlice");
0182   isoEtMin_ = config.getParameter<double>("isoEtMin");
0183   isoEMin_ = config.getParameter<double>("isoEMin");
0184   vetoClusteredHits_ = config.getParameter<bool>("vetoClusteredHits");
0185   useNumXtals_ = config.getParameter<bool>("useNumXstals");
0186   ecalIsoCut_offset_ = config.getParameter<double>("ecalIsoCut_offset");
0187   ecalIsoCut_slope_ = config.getParameter<double>("ecalIsoCut_slope");
0188 
0189   //Flags and Severities to be excluded from photon calculations
0190   auto const& flagnamesEB = config.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEB");
0191   auto const& flagnamesEE = config.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEE");
0192 
0193   flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
0194   flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
0195 
0196   auto const& severitynamesEB = config.getParameter<std::vector<std::string>>("RecHitSeverityToBeExcludedEB");
0197   auto const& severitynamesEE = config.getParameter<std::vector<std::string>>("RecHitSeverityToBeExcludedEE");
0198 
0199   severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
0200   severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
0201 
0202   // Register the product
0203   produces<TrackCandidateCollection>(OutInTrackCandidateCollection_);
0204   produces<TrackCandidateCollection>(InOutTrackCandidateCollection_);
0205 
0206   produces<reco::TrackCandidateCaloClusterPtrAssociation>(OutInTrackSCAssociationCollection_);
0207   produces<reco::TrackCandidateCaloClusterPtrAssociation>(InOutTrackSCAssociationCollection_);
0208 
0209   ElectronHcalHelper::Configuration cfgCone;
0210   cfgCone.hOverEConeSize = hOverEConeSize_;
0211   if (cfgCone.hOverEConeSize > 0) {
0212     cfgCone.onlyBehindCluster = false;
0213     cfgCone.checkHcalStatus = false;
0214 
0215     cfgCone.hbheRecHits = hbheRecHits_;
0216 
0217     cfgCone.eThresHB = config.getParameter<EgammaHcalIsolation::arrayHB>("recHitEThresholdHB");
0218     cfgCone.maxSeverityHB = config.getParameter<int>("maxHcalRecHitSeverity");
0219     cfgCone.eThresHE = config.getParameter<EgammaHcalIsolation::arrayHE>("recHitEThresholdHE");
0220     cfgCone.maxSeverityHE = cfgCone.maxSeverityHB;
0221   }
0222 
0223   hcalHelper_ = std::make_unique<ElectronHcalHelper>(cfgCone, consumesCollector());
0224 }
0225 
0226 void ConversionTrackCandidateProducer::setEventSetup(const edm::EventSetup& theEventSetup) {
0227   outInSeedFinder_.setEventSetup(theEventSetup);
0228   inOutSeedFinder_.setEventSetup(theEventSetup);
0229   outInTrackFinder_.setEventSetup(theEventSetup);
0230   inOutTrackFinder_.setEventSetup(theEventSetup);
0231 }
0232 
0233 void ConversionTrackCandidateProducer::beginRun(edm::Run const& r, edm::EventSetup const& theEventSetup) {
0234   const NavigationSchool* navigation = &theEventSetup.getData(navToken_);
0235   theTrajectoryBuilder_->setNavigationSchool(navigation);
0236   outInSeedFinder_.setNavigationSchool(navigation);
0237   inOutSeedFinder_.setNavigationSchool(navigation);
0238 
0239   if (cutsFromDB) {
0240     hcalCuts = &theEventSetup.getData(hcalCutsToken_);
0241   }
0242 }
0243 
0244 void ConversionTrackCandidateProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEventSetup) {
0245   // get the trajectory builder and initialize it with the data
0246   theTrajectoryBuilder_->setEvent(theEvent, theEventSetup, &theEvent.get(measurementTrkEvtToken_));
0247 
0248   // this need to be done after the initialization of the TrajectoryBuilder!
0249   setEventSetup(theEventSetup);
0250 
0251   outInSeedFinder_.setEvent(theEvent);
0252   inOutSeedFinder_.setEvent(theEvent);
0253 
0254   //
0255   // create empty output collections
0256   //
0257   //  Out In Track Candidates
0258   auto outInTrackCandidate_p = std::make_unique<TrackCandidateCollection>();
0259   //  In Out  Track Candidates
0260   auto inOutTrackCandidate_p = std::make_unique<TrackCandidateCollection>();
0261   //   Track Candidate  calo  Cluster Association
0262   auto outInAssoc_p = std::make_unique<reco::TrackCandidateCaloClusterPtrAssociation>();
0263   auto inOutAssoc_p = std::make_unique<reco::TrackCandidateCaloClusterPtrAssociation>();
0264 
0265   // Get the basic cluster collection in the Barrel
0266   bool validBarrelBCHandle = true;
0267   auto bcBarrelHandle = theEvent.getHandle(bcBarrelCollection_);
0268   if (!bcBarrelHandle.isValid()) {
0269     edm::LogError("ConversionTrackCandidateProducer") << "Error! Can't get the Barrel Basic Clusters!";
0270     validBarrelBCHandle = false;
0271   }
0272 
0273   // Get the basic cluster collection in the Endcap
0274   bool validEndcapBCHandle = true;
0275   auto bcEndcapHandle = theEvent.getHandle(bcEndcapCollection_);
0276   if (!bcEndcapHandle.isValid()) {
0277     edm::LogError("CoonversionTrackCandidateProducer") << "Error! Can't get the Endcap Basic Clusters";
0278     validEndcapBCHandle = false;
0279   }
0280 
0281   // Get the Super Cluster collection in the Barrel
0282   bool validBarrelSCHandle = true;
0283   auto scBarrelHandle = theEvent.getHandle(scHybridBarrelProducer_);
0284   if (!scBarrelHandle.isValid()) {
0285     edm::LogError("CoonversionTrackCandidateProducer") << "Error! Can't get the barrel superclusters!";
0286     validBarrelSCHandle = false;
0287   }
0288 
0289   // Get the Super Cluster collection in the Endcap
0290   bool validEndcapSCHandle = true;
0291   auto scEndcapHandle = theEvent.getHandle(scIslandEndcapProducer_);
0292   if (!scEndcapHandle.isValid()) {
0293     edm::LogError("CoonversionTrackCandidateProducer") << "Error! Can't get the endcap superclusters!";
0294     validEndcapSCHandle = false;
0295   }
0296 
0297   thresholds = &theEventSetup.getData(ecalPFRechitThresholdsToken_);
0298 
0299   // get the geometry from the event setup:
0300   theCaloGeom_ = theEventSetup.getHandle(theCaloGeomToken_);
0301 
0302   hcalHelper_->beginEvent(theEvent, theEventSetup);
0303 
0304   auto const& ecalhitsCollEB = theEvent.get(barrelecalCollection_);
0305   auto const& ecalhitsCollEE = theEvent.get(endcapecalCollection_);
0306 
0307   const EcalSeverityLevelAlgo* sevLevel = &theEventSetup.getData(sevlvToken_);
0308 
0309   caloPtrVecOutIn_.clear();
0310   caloPtrVecInOut_.clear();
0311 
0312   bool isBarrel = true;
0313   if (validBarrelBCHandle && validBarrelSCHandle)
0314     buildCollections(isBarrel,
0315                      scBarrelHandle,
0316                      bcBarrelHandle,
0317                      ecalhitsCollEB,
0318                      sevLevel,
0319                      *hcalHelper_,
0320                      *outInTrackCandidate_p,
0321                      *inOutTrackCandidate_p,
0322                      caloPtrVecOutIn_,
0323                      caloPtrVecInOut_);
0324 
0325   if (validEndcapBCHandle && validEndcapSCHandle) {
0326     isBarrel = false;
0327     buildCollections(isBarrel,
0328                      scEndcapHandle,
0329                      bcEndcapHandle,
0330                      ecalhitsCollEE,
0331                      sevLevel,
0332                      *hcalHelper_,
0333                      *outInTrackCandidate_p,
0334                      *inOutTrackCandidate_p,
0335                      caloPtrVecOutIn_,
0336                      caloPtrVecInOut_);
0337   }
0338 
0339   //  std::cout  << "  ConversionTrackCandidateProducer  caloPtrVecOutIn_ size " <<  caloPtrVecOutIn_.size() << " caloPtrVecInOut_ size " << caloPtrVecInOut_.size()  << "\n";
0340 
0341   // put all products in the event
0342   // Barrel
0343   //std::cout  << "ConversionTrackCandidateProducer Putting in the event " << (*outInTrackCandidate_p).size() << " Out In track Candidates " << "\n";
0344   auto const refprodOutInTrackC = theEvent.put(std::move(outInTrackCandidate_p), OutInTrackCandidateCollection_);
0345   //std::cout  << "ConversionTrackCandidateProducer  refprodOutInTrackC size  " <<  (*(refprodOutInTrackC.product())).size()  <<  "\n";
0346   //
0347   //std::cout << "ConversionTrackCandidateProducer Putting in the event  " << (*inOutTrackCandidate_p).size() << " In Out track Candidates " <<  "\n";
0348   auto const refprodInOutTrackC = theEvent.put(std::move(inOutTrackCandidate_p), InOutTrackCandidateCollection_);
0349   //std::cout  << "ConversionTrackCandidateProducer  refprodInOutTrackC size  " <<  (*(refprodInOutTrackC.product())).size()  <<  "\n";
0350 
0351   edm::ValueMap<reco::CaloClusterPtr>::Filler fillerOI(*outInAssoc_p);
0352   fillerOI.insert(refprodOutInTrackC, caloPtrVecOutIn_.begin(), caloPtrVecOutIn_.end());
0353   fillerOI.fill();
0354   edm::ValueMap<reco::CaloClusterPtr>::Filler fillerIO(*inOutAssoc_p);
0355   fillerIO.insert(refprodInOutTrackC, caloPtrVecInOut_.begin(), caloPtrVecInOut_.end());
0356   fillerIO.fill();
0357 
0358   // std::cout  << "ConversionTrackCandidateProducer Putting in the event   OutIn track - SC association: size  " <<  (*outInAssoc_p).size() << "\n";
0359   theEvent.put(std::move(outInAssoc_p), OutInTrackSCAssociationCollection_);
0360 
0361   // std::cout << "ConversionTrackCandidateProducer Putting in the event   InOut track - SC association: size  " <<  (*inOutAssoc_p).size() << "\n";
0362   theEvent.put(std::move(inOutAssoc_p), InOutTrackSCAssociationCollection_);
0363 
0364   outInSeedFinder_.clear();
0365   inOutSeedFinder_.clear();
0366 }
0367 
0368 void ConversionTrackCandidateProducer::buildCollections(bool isBarrel,
0369                                                         const edm::Handle<edm::View<reco::CaloCluster>>& scHandle,
0370                                                         const edm::Handle<edm::View<reco::CaloCluster>>& bcHandle,
0371                                                         EcalRecHitCollection const& ecalRecHits,
0372                                                         const EcalSeverityLevelAlgo* sevLevel,
0373                                                         ElectronHcalHelper const& hcalHelper,
0374                                                         TrackCandidateCollection& outInTrackCandidates,
0375                                                         TrackCandidateCollection& inOutTrackCandidates,
0376                                                         std::vector<edm::Ptr<reco::CaloCluster>>& vecRecOI,
0377                                                         std::vector<edm::Ptr<reco::CaloCluster>>& vecRecIO)
0378 
0379 {
0380   //  Loop over SC in the barrel and reconstruct converted photons
0381   for (auto const& aClus : scHandle->ptrs()) {
0382     // preselection based in Et and H/E cut.
0383     if (aClus->energy() / cosh(aClus->eta()) <= minSCEt_)
0384       continue;
0385     if (aClus->eta() > 1.479 && aClus->eta() < 1.556)
0386       continue;
0387 
0388     const reco::CaloCluster* pClus = &(*aClus);
0389     const reco::SuperCluster* sc = dynamic_cast<const reco::SuperCluster*>(pClus);
0390     double scEt = sc->energy() / cosh(sc->eta());
0391     double HoE = hcalHelper.hcalESum(*sc, 0, hcalCuts) / sc->energy();
0392     if (HoE >= maxHOverE_)
0393       continue;
0394 
0395     //// Apply also ecal isolation
0396     EgammaRecHitIsolation ecalIso(
0397         isoConeR_, isoInnerConeR_, isoEtaSlice_, isoEtMin_, isoEMin_, theCaloGeom_, ecalRecHits, sevLevel, DetId::Ecal);
0398 
0399     ecalIso.setVetoClustered(vetoClusteredHits_);
0400     ecalIso.setUseNumCrystals(useNumXtals_);
0401     if (isBarrel) {
0402       ecalIso.doFlagChecks(flagsexclEB_);
0403       ecalIso.doSeverityChecks(&ecalRecHits, severitiesexclEB_);
0404     } else {
0405       ecalIso.doFlagChecks(flagsexclEE_);
0406       ecalIso.doSeverityChecks(&ecalRecHits, severitiesexclEE_);
0407     }
0408 
0409     double ecalIsolation = ecalIso.getEtSum(sc, thresholds);
0410     if (ecalIsolation > ecalIsoCut_offset_ + ecalIsoCut_slope_ * scEt)
0411       continue;
0412 
0413     // Now launch the seed finding
0414     outInSeedFinder_.setCandidate(pClus->energy(),
0415                                   GlobalPoint(pClus->position().x(), pClus->position().y(), pClus->position().z()));
0416     outInSeedFinder_.makeSeeds(bcHandle);
0417 
0418     std::vector<Trajectory> theOutInTracks = outInTrackFinder_.tracks(outInSeedFinder_.seeds(), outInTrackCandidates);
0419 
0420     inOutSeedFinder_.setCandidate(pClus->energy(),
0421                                   GlobalPoint(pClus->position().x(), pClus->position().y(), pClus->position().z()));
0422     inOutSeedFinder_.setTracks(theOutInTracks);
0423     inOutSeedFinder_.makeSeeds(bcHandle);
0424 
0425     std::vector<Trajectory> theInOutTracks = inOutTrackFinder_.tracks(inOutSeedFinder_.seeds(), inOutTrackCandidates);
0426 
0427     // Debug
0428     //   std::cout  << "ConversionTrackCandidateProducer  theOutInTracks.size() " << theOutInTracks.size() << " theInOutTracks.size() " << theInOutTracks.size() <<  " Event pointer to out in track size barrel " << outInTrackCandidates.size() << " in out track size " << inOutTrackCandidates.size() <<   "\n";
0429 
0430     //////////// Fill vectors of Ref to SC to be used for the Track-SC association
0431     for (auto it = theOutInTracks.begin(); it != theOutInTracks.end(); ++it) {
0432       vecRecOI.push_back(aClus);
0433       //     std::cout  << "ConversionTrackCandidateProducer Barrel OutIn Tracks Number of hits " << (*it).foundHits() << "\n";
0434     }
0435 
0436     for (auto it = theInOutTracks.begin(); it != theInOutTracks.end(); ++it) {
0437       vecRecIO.push_back(aClus);
0438       //     std::cout  << "ConversionTrackCandidateProducer Barrel InOut Tracks Number of hits " << (*it).foundHits() << "\n";
0439     }
0440   }
0441 }
0442 
0443 void ConversionTrackCandidateProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0444   // conversionTrackCandidates
0445   edm::ParameterSetDescription desc;
0446 
0447   desc.add<edm::InputTag>("bcBarrelCollection", {"particleFlowSuperClusterECAL", "particleFlowBasicClusterECALBarrel"});
0448   desc.add<edm::InputTag>("bcEndcapCollection", {"particleFlowSuperClusterECAL", "particleFlowBasicClusterECALEndcap"});
0449   desc.add<edm::InputTag>("scHybridBarrelProducer",
0450                           {"particleFlowSuperClusterECAL", "particleFlowSuperClusterECALBarrel"});
0451   desc.add<edm::InputTag>("scIslandEndcapProducer",
0452                           {"particleFlowSuperClusterECAL", "particleFlowSuperClusterECALEndcapWithPreshower"});
0453 
0454   desc.add<std::string>("outInTrackCandidateSCAssociationCollection", "outInTrackCandidateSCAssociationCollection");
0455   desc.add<std::string>("inOutTrackCandidateSCAssociationCollection", "inOutTrackCandidateSCAssociationCollection");
0456   desc.add<std::string>("outInTrackCandidateCollection", "outInTracksFromConversions");
0457   desc.add<std::string>("inOutTrackCandidateCollection", "inOutTracksFromConversions");
0458 
0459   desc.add<edm::InputTag>("barrelEcalRecHitCollection", {"ecalRecHit", "EcalRecHitsEB"});
0460   desc.add<edm::InputTag>("endcapEcalRecHitCollection", {"ecalRecHit", "EcalRecHitsEE"});
0461   desc.add<std::string>("MeasurementTrackerName", "");
0462   desc.add<std::string>("OutInRedundantSeedCleaner", "CachingSeedCleanerBySharedInput");
0463   desc.add<std::string>("InOutRedundantSeedCleaner", "CachingSeedCleanerBySharedInput");
0464   desc.add<bool>("useHitsSplitting", false);
0465   desc.add<int>("maxNumOfSeedsOutIn", 50);
0466   desc.add<int>("maxNumOfSeedsInOut", 50);
0467   desc.add<double>("bcEtCut", 1.5);
0468   desc.add<double>("bcECut", 1.5);
0469   desc.add<bool>("useEtCut", true);
0470 
0471   desc.add<edm::InputTag>("hbheRecHits", {"hbhereco"});
0472   desc.add<std::vector<double>>("recHitEThresholdHB", {0., 0., 0., 0.});
0473   desc.add<std::vector<double>>("recHitEThresholdHE", {0., 0., 0., 0., 0., 0., 0.});
0474   desc.add<bool>("usePFThresholdsFromDB", false);
0475   desc.add<int>("maxHcalRecHitSeverity", 999999);
0476 
0477   desc.add<double>("minSCEt", 20.0);
0478   desc.add<double>("hOverEConeSize", 0.15);
0479   desc.add<double>("maxHOverE", 0.15);
0480   desc.add<double>("isoInnerConeR", 3.5);
0481   desc.add<double>("isoConeR", 0.4);
0482   desc.add<double>("isoEtaSlice", 2.5);
0483   desc.add<double>("isoEtMin", 0.0);
0484   desc.add<double>("isoEMin", 0.08);
0485   desc.add<bool>("vetoClusteredHits", false);
0486   desc.add<bool>("useNumXstals", true);
0487   desc.add<double>("ecalIsoCut_offset", 999999999);  // alternative value: 4.2
0488   desc.add<double>("ecalIsoCut_slope", 0.0);         // alternative value: 0.003
0489 
0490   desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEB", {});
0491   desc.add<std::vector<std::string>>("RecHitSeverityToBeExcludedEB", {});
0492   desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEE", {});
0493   desc.add<std::vector<std::string>>("RecHitSeverityToBeExcludedEE", {});
0494 
0495   desc.add<double>("fractionShared", 0.5);
0496   desc.add<std::string>("TrajectoryBuilder", "TrajectoryBuilderForConversions");
0497   {
0498     edm::ParameterSetDescription psd0;
0499     psd0.setUnknown();
0500     desc.add<edm::ParameterSetDescription>("TrajectoryBuilderPSet", psd0);
0501   }
0502   {
0503     edm::ParameterSetDescription psd0;
0504     psd0.add<std::string>("propagatorAlongTISE", "alongMomElePropagator");
0505     psd0.add<int>("numberMeasurementsForFit", 4);
0506     psd0.add<std::string>("propagatorOppositeTISE", "oppositeToMomElePropagator");
0507     desc.add<edm::ParameterSetDescription>("TransientInitialStateEstimatorParameters", psd0);
0508   }
0509   desc.add<bool>("allowSharedFirstHit", true);
0510   desc.add<double>("ValidHitBonus", 5.0);
0511   desc.add<double>("MissingHitPenalty", 20.0);
0512 
0513   descriptions.add("conversionTrackCandidatesDefault", desc);
0514   // or use the following to generate the label from the module's C++ type
0515   //descriptions.addWithDefaultLabel(desc);
0516 }