CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFHCALSuperClusterProducer.cc
Go to the documentation of this file.
2 
3 #include <memory>
4 
6 
10 
14 
15 using namespace std;
16 using namespace edm;
17 
19 {
20 
21  verbose_ =
22  iConfig.getUntrackedParameter<bool>("verbose",false);
23 
24  // parameters for clustering
25 
26 
27  // access to the collections of clusters:
28 
29  inputTagPFClusters_ = iConfig.getParameter<InputTag>("PFClusters");
30  inputTagPFClustersHO_ = iConfig.getParameter<InputTag>("PFClustersHO");
31 
32  produces<reco::PFClusterCollection>();
33  produces<reco::PFSuperClusterCollection>();
34 
35 }
36 
37 
38 
40 
41 
42 
43 
45  const edm::EventSetup& iSetup) {
46 
47 
50 
51  // access the clusters in the event
52  bool found = iEvent.getByLabel( inputTagPFClusters_, clustersHandle );
53  bool foundHO = iEvent.getByLabel( inputTagPFClustersHO_, clustersHOHandle );
54 
55  if(!found ) {
56 
57  ostringstream err;
58  err<<"cannot find clusters: "<<inputTagPFClusters_;
59  LogError("PFHCALSuperClusterProducer")<<err.str()<<endl;
60 
61  throw cms::Exception( "MissingProduct", err.str());
62  }
63 
64  if(!foundHO ) {
65 
66  ostringstream err;
67  err<<"cannot find HO clusters: "<<inputTagPFClustersHO_;
68  LogError("PFHCALSuperClusterProducer")<<err.str()<<endl;
69 
70  throw cms::Exception( "MissingProduct", err.str());
71  }
72 
73  // do clustering
74  hcalSuperClusterAlgo_.doClustering( clustersHandle, clustersHOHandle );
75 
76  if( verbose_ ) {
77  LogInfo("PFHCALSuperClusterProducer")
78  <<" superclusters --------------------------------- "<<endl
79  <<hcalSuperClusterAlgo_<<endl;
80  }
81 
82  // get clusters out of the clustering algorithm
83  // and put them in the event. There is no copy.
84  auto_ptr< vector<reco::PFCluster> > outClusters( hcalSuperClusterAlgo_.clusters() );
85  auto_ptr< vector<reco::PFSuperCluster> > outSuperClusters( hcalSuperClusterAlgo_.superClusters() );
86  iEvent.put( outClusters );
87  iEvent.put( outSuperClusters );
88 
89 }
90 
92 
93 hcalSuperClusterAlgo_.write();
94 
95 }
96 
97 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
PFHCALSuperClusterProducer(const edm::ParameterSet &)
virtual void produce(edm::Event &, const edm::EventSetup &)