Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-27 04:04:48

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