CMS 3D CMS Logo

LCToSCAssociatorEDProducer.cc
Go to the documentation of this file.
1 //
2 // Original Author: Leonardo Cristella
3 // Created: Thu Dec 3 10:52:11 CET 2020
4 //
5 //
6 
7 // system include files
8 #include <memory>
9 #include <string>
10 
11 // user include files
13 
16 
18 
20 
22 
25 
27 
28 //
29 // class decleration
30 //
31 
33 public:
35  ~LCToSCAssociatorEDProducer() override;
36 
37 private:
38  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
39 
43 };
44 
46  produces<ticl::SimToRecoCollectionWithSimClusters>();
47  produces<ticl::RecoToSimCollectionWithSimClusters>();
48 
49  SCCollectionToken_ = consumes<SimClusterCollection>(pset.getParameter<edm::InputTag>("label_scl"));
50  LCCollectionToken_ = consumes<reco::CaloClusterCollection>(pset.getParameter<edm::InputTag>("label_lcl"));
51  associatorToken_ = consumes<ticl::LayerClusterToSimClusterAssociator>(pset.getParameter<edm::InputTag>("associator"));
52 }
53 
55 
56 //
57 // member functions
58 //
59 
60 // ------------ method called to produce the data ------------
62  using namespace edm;
63 
65  iEvent.getByToken(associatorToken_, theAssociator);
66 
67  Handle<SimClusterCollection> SCCollection;
68  iEvent.getByToken(SCCollectionToken_, SCCollection);
69 
71  iEvent.getByToken(LCCollectionToken_, LCCollection);
72 
73  // associate LC and SC
74  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n";
75  ticl::RecoToSimCollectionWithSimClusters recSimColl = theAssociator->associateRecoToSim(LCCollection, SCCollection);
76 
77  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
78  ticl::SimToRecoCollectionWithSimClusters simRecColl = theAssociator->associateSimToReco(LCCollection, SCCollection);
79 
80  auto rts = std::make_unique<ticl::RecoToSimCollectionWithSimClusters>(recSimColl);
81  auto str = std::make_unique<ticl::SimToRecoCollectionWithSimClusters>(simRecColl);
82 
83  iEvent.put(std::move(rts));
84  iEvent.put(std::move(str));
85 }
86 
87 // define this as a plug-in
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< ticl::LayerClusterToSimClusterAssociator > associatorToken_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ticl::RecoToSimCollectionWithSimClusters associateRecoToSim(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< SimClusterCollection > &sCCH) const
Associate a LayerCluster to SimClusters.
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
HLT enums.
LCToSCAssociatorEDProducer(const edm::ParameterSet &)
ticl::SimToRecoCollectionWithSimClusters associateSimToReco(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< SimClusterCollection > &sCCH) const
Associate a SimCluster to LayerClusters.
#define str(s)
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
def move(src, dest)
Definition: eostools.py:511