CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFECALSuperClusterProducer.cc
Go to the documentation of this file.
2 
3 #include <memory>
4 
6 
10 
13 
17 
18 using namespace std;
19 using namespace edm;
20 
21 namespace {
22  const std::string ClusterType__BOX("Box");
23  const std::string ClusterType__Mustache("Mustache");
24 }
25 
27 {
28 
29  verbose_ =
30  iConfig.getUntrackedParameter<bool>("verbose",false);
31 
32  std::string _typename = iConfig.getParameter<std::string>("ClusteringType");
33  if( _typename == ClusterType__BOX ) {
34  _theclusteringtype = PFECALSuperClusterAlgo::kBOX;
35  } else if ( _typename == ClusterType__Mustache ) {
36  _theclusteringtype = PFECALSuperClusterAlgo::kMustache;
37  } else {
38  throw cms::Exception("InvalidClusteringType")
39  << "You have not chosen a valid clustering type,"
40  << " please choose from \"Box\" or \"Mustache\"!";
41  }
42 
43 
44  // parameters for clustering
45 
46  bool useDynamicDPhi = iConfig.getParameter<bool>("useDynamicDPhiWindow");
47 
48  double threshPFClusterSeedBarrel = iConfig.getParameter<double>("thresh_PFClusterSeedBarrel");
49  double threshPFClusterBarrel = iConfig.getParameter<double>("thresh_PFClusterBarrel");
50 
51  double threshPFClusterSeedEndcap = iConfig.getParameter<double>("thresh_PFClusterSeedEndcap");
52  double threshPFClusterEndcap = iConfig.getParameter<double>("thresh_PFClusterEndcap");
53 
54  double phiwidthSuperClusterBarrel = iConfig.getParameter<double>("phiwidth_SuperClusterBarrel");
55  double etawidthSuperClusterBarrel = iConfig.getParameter<double>("etawidth_SuperClusterBarrel");
56 
57  double phiwidthSuperClusterEndcap = iConfig.getParameter<double>("phiwidth_SuperClusterEndcap");
58  double etawidthSuperClusterEndcap = iConfig.getParameter<double>("etawidth_SuperClusterEndcap");
59 
60  double threshPFClusterES = iConfig.getParameter<double>("thresh_PFClusterES");
61 
62  //double threshPFClusterMustacheOutBarrel = iConfig.getParameter<double>("thresh_PFClusterMustacheOutBarrel");
63  //double threshPFClusterMustacheOutEndcap = iConfig.getParameter<double>("thresh_PFClusterMustacheOutEndcap");
64 
65  double doSatelliteClusterMerge =
66  iConfig.getParameter<bool>("doSatelliteClusterMerge");
67  double satelliteClusterSeedThreshold =
68  iConfig.getParameter<double>("satelliteClusterSeedThreshold");
69  double satelliteMajorityFraction =
70  iConfig.getParameter<double>("satelliteMajorityFraction");
71 
72  superClusterAlgo_.setVerbosityLevel(verbose_);
73  superClusterAlgo_.setClusteringType(_theclusteringtype);
74  superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);
75 
76  superClusterAlgo_.setThreshPFClusterSeedBarrel( threshPFClusterSeedBarrel );
77  superClusterAlgo_.setThreshPFClusterBarrel( threshPFClusterBarrel );
78 
79  superClusterAlgo_.setThreshPFClusterSeedEndcap( threshPFClusterSeedEndcap );
80  superClusterAlgo_.setThreshPFClusterEndcap( threshPFClusterEndcap );
81 
82  superClusterAlgo_.setPhiwidthSuperClusterBarrel( phiwidthSuperClusterBarrel );
83  superClusterAlgo_.setEtawidthSuperClusterBarrel( etawidthSuperClusterBarrel );
84 
85  superClusterAlgo_.setPhiwidthSuperClusterEndcap( phiwidthSuperClusterEndcap );
86  superClusterAlgo_.setEtawidthSuperClusterEndcap( etawidthSuperClusterEndcap );
87 
88  superClusterAlgo_.setThreshPFClusterES( threshPFClusterES );
89 
90  superClusterAlgo_.setSatelliteMerging( doSatelliteClusterMerge );
91  superClusterAlgo_.setSatelliteThreshold( satelliteClusterSeedThreshold );
92  superClusterAlgo_.setMajorityFraction( satelliteMajorityFraction );
93  //superClusterAlgo_.setThreshPFClusterMustacheOutBarrel( threshPFClusterMustacheOutBarrel );
94  //superClusterAlgo_.setThreshPFClusterMustacheOutEndcap( threshPFClusterMustacheOutEndcap );
95 
96  //Load the ECAL energy calibration
97  thePFEnergyCalibration_ =
98  std::shared_ptr<PFEnergyCalibration>(new PFEnergyCalibration());
99  superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
100  superClusterAlgo_.setUsePS(iConfig.getParameter<bool>("use_preshower"));
101 
102  bool applyCrackCorrections_ = iConfig.getParameter<bool>("applyCrackCorrections");
103  superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
104 
105 
106 
107  inputTagPFClusters_ = iConfig.getParameter<InputTag>("PFClusters");
108  inputTagPFClustersES_ = iConfig.getParameter<InputTag>("PFClustersES");
109 
110  PFBasicClusterCollectionBarrel_ = iConfig.getParameter<string>("PFBasicClusterCollectionBarrel");
111  PFSuperClusterCollectionBarrel_ = iConfig.getParameter<string>("PFSuperClusterCollectionBarrel");
112 
113  PFBasicClusterCollectionEndcap_ = iConfig.getParameter<string>("PFBasicClusterCollectionEndcap");
114  PFSuperClusterCollectionEndcap_ = iConfig.getParameter<string>("PFSuperClusterCollectionEndcap");
115 
116  PFBasicClusterCollectionPreshower_ = iConfig.getParameter<string>("PFBasicClusterCollectionPreshower");
117  PFSuperClusterCollectionEndcapWithPreshower_ = iConfig.getParameter<string>("PFSuperClusterCollectionEndcapWithPreshower");
118 
119  produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
120  produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
121 }
122 
123 
124 
126 
127 
128 
129 
131  const edm::EventSetup& iSetup) {
132 
133 
134  //Load the pfcluster collections
135  edm::Handle<edm::View<reco::PFCluster> > pfclustersHandle;
136  iEvent.getByLabel( inputTagPFClusters_, pfclustersHandle );
137 
138  edm::Handle<edm::View<reco::PFCluster> > preshowerpfclustersHandle;
139  iEvent.getByLabel( inputTagPFClustersES_, preshowerpfclustersHandle);
140 
141 
142  // do clustering
143  superClusterAlgo_.loadAndSortPFClusters(*pfclustersHandle,
144  *preshowerpfclustersHandle);
145  superClusterAlgo_.run();
146 
147  //store in the event
148  iEvent.put(superClusterAlgo_.getEBOutputSCCollection(),
149  PFSuperClusterCollectionBarrel_);
150  iEvent.put(superClusterAlgo_.getEEOutputSCCollection(),
151  PFSuperClusterCollectionEndcapWithPreshower_);
152 }
153 
154 
155 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
PFECALSuperClusterProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361