Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-02 05:10:04

0001 /** \class CollectionMerger
0002  *
0003  * \author Stefan Wayand;
0004  *         Christian Veelken, LLR
0005  *
0006  *  Clean Up from Christian Winter & Sebastian Brommer, KIT
0007  */
0008 #ifndef TauAnalysis_MCEmbeddingTools_CollectionMerger_H
0009 #define TauAnalysis_MCEmbeddingTools_CollectionMerger_H
0010 
0011 #include "DataFormats/Common/interface/Handle.h"
0012 #include "DataFormats/MuonReco/interface/MuonEnergy.h"
0013 #include "DataFormats/PatCandidates/interface/Muon.h"
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/MakerMacros.h"
0016 #include "FWCore/Framework/interface/stream/EDProducer.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 
0019 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0020 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0021 
0022 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
0023 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
0024 
0025 #include "DataFormats/TrackReco/interface/Track.h"
0026 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0027 #include "DataFormats/TrackReco/interface/TrackToTrackMap.h"
0028 
0029 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0030 #include "TrackingTools/TrackAssociator/interface/TrackAssociatorParameters.h"
0031 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
0032 
0033 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0034 #include "DataFormats/Common/interface/SortedCollection.h"
0035 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0036 #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
0037 #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h"
0038 
0039 #include <iostream>
0040 #include <map>
0041 #include <string>
0042 
0043 template <typename T1, typename T2>
0044 class CollectionMerger : public edm::stream::EDProducer<> {
0045 public:
0046   explicit CollectionMerger(const edm::ParameterSet &);
0047   ~CollectionMerger() override;
0048 
0049 private:
0050   void produce(edm::Event &, const edm::EventSetup &) override;
0051 
0052   typedef T1 MergeCollection;
0053   typedef T2 BaseHit;
0054   std::map<std::string, std::vector<edm::EDGetTokenT<MergeCollection>>> inputs_;
0055 
0056   edm::EDGetTokenT<reco::SuperClusterCollection> inputs_scEB_, inputs_scEE_, inputs_SC_;
0057 
0058   typedef edm::ValueMap<reco::TrackRefVector> TrackToTrackMapnew;
0059   edm::EDGetTokenT<TrackToTrackMapnew> inputs_fixtrackrefs_;
0060   edm::EDGetTokenT<reco::TrackCollection> inputs_fixtrackcol_;
0061 
0062   void fill_output_obj(edm::Event &,
0063                        std::unique_ptr<MergeCollection> &output,
0064                        std::vector<edm::Handle<MergeCollection>> &inputCollections);
0065   void fill_output_obj_tracker(std::unique_ptr<MergeCollection> &output,
0066                                std::vector<edm::Handle<MergeCollection>> &inputCollections,
0067                                bool print_pixel = false);
0068   void fill_output_obj_calo(std::unique_ptr<MergeCollection> &output,
0069                             std::vector<edm::Handle<MergeCollection>> &inputCollections);
0070   void fill_output_obj_muonchamber(std::unique_ptr<MergeCollection> &output,
0071                                    std::vector<edm::Handle<MergeCollection>> &inputCollections);
0072   // seed merger
0073   void fill_output_obj_seed(edm::Event &,
0074                             std::unique_ptr<MergeCollection> &output,
0075                             std::vector<edm::Handle<MergeCollection>> &inputCollections);
0076 
0077   void willproduce(std::string instance, std::string alias);
0078   void willconsume(const edm::ParameterSet &iConfig);
0079 };
0080 
0081 #endif