Go to the documentation of this file.00001 #include "RecoParticleFlow/PFClusterProducer/plugins/PFClusterProducer.h"
00002
00003 #include <memory>
00004
00005 #include "RecoParticleFlow/PFClusterProducer/interface/PFClusterAlgo.h"
00006
00007 #include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
00008 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00009
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 #include "FWCore/Framework/interface/EventSetup.h"
00013
00014 using namespace std;
00015 using namespace edm;
00016
00017 PFClusterProducer::PFClusterProducer(const edm::ParameterSet& iConfig)
00018 {
00019
00020 verbose_ =
00021 iConfig.getUntrackedParameter<bool>("verbose",false);
00022
00023
00024
00025
00026
00027 double threshBarrel =
00028 iConfig.getParameter<double>("thresh_Barrel");
00029 double threshSeedBarrel =
00030 iConfig.getParameter<double>("thresh_Seed_Barrel");
00031
00032 double threshPtBarrel =
00033 iConfig.getParameter<double>("thresh_Pt_Barrel");
00034 double threshPtSeedBarrel =
00035 iConfig.getParameter<double>("thresh_Pt_Seed_Barrel");
00036
00037 double threshCleanBarrel =
00038 iConfig.getParameter<double>("thresh_Clean_Barrel");
00039 std::vector<double> minS4S1CleanBarrel =
00040 iConfig.getParameter< std::vector<double> >("minS4S1_Clean_Barrel");
00041
00042 double threshEndcap =
00043 iConfig.getParameter<double>("thresh_Endcap");
00044 double threshSeedEndcap =
00045 iConfig.getParameter<double>("thresh_Seed_Endcap");
00046
00047 double threshPtEndcap =
00048 iConfig.getParameter<double>("thresh_Pt_Endcap");
00049 double threshPtSeedEndcap =
00050 iConfig.getParameter<double>("thresh_Pt_Seed_Endcap");
00051
00052 double threshCleanEndcap =
00053 iConfig.getParameter<double>("thresh_Clean_Endcap");
00054 std::vector<double> minS4S1CleanEndcap =
00055 iConfig.getParameter< std::vector<double> >("minS4S1_Clean_Endcap");
00056
00057 double threshDoubleSpikeBarrel =
00058 iConfig.getParameter<double>("thresh_DoubleSpike_Barrel");
00059 double minS6S2DoubleSpikeBarrel =
00060 iConfig.getParameter<double>("minS6S2_DoubleSpike_Barrel");
00061 double threshDoubleSpikeEndcap =
00062 iConfig.getParameter<double>("thresh_DoubleSpike_Endcap");
00063 double minS6S2DoubleSpikeEndcap =
00064 iConfig.getParameter<double>("minS6S2_DoubleSpike_Endcap");
00065
00066 int nNeighbours =
00067 iConfig.getParameter<int>("nNeighbours");
00068
00069
00070
00071
00072 int posCalcNCrystal =
00073 iConfig.getParameter<int>("posCalcNCrystal");
00074
00075 double showerSigma =
00076 iConfig.getParameter<double>("showerSigma");
00077
00078 bool useCornerCells =
00079 iConfig.getParameter<bool>("useCornerCells");
00080
00081 bool cleanRBXandHPDs =
00082 iConfig.getParameter<bool>("cleanRBXandHPDs");
00083
00084
00085 clusterAlgo_.setThreshBarrel( threshBarrel );
00086 clusterAlgo_.setThreshSeedBarrel( threshSeedBarrel );
00087
00088 clusterAlgo_.setThreshPtBarrel( threshPtBarrel );
00089 clusterAlgo_.setThreshPtSeedBarrel( threshPtSeedBarrel );
00090
00091 clusterAlgo_.setThreshCleanBarrel(threshCleanBarrel);
00092 clusterAlgo_.setS4S1CleanBarrel(minS4S1CleanBarrel);
00093
00094 clusterAlgo_.setThreshDoubleSpikeBarrel( threshDoubleSpikeBarrel );
00095 clusterAlgo_.setS6S2DoubleSpikeBarrel( minS6S2DoubleSpikeBarrel );
00096
00097 clusterAlgo_.setThreshEndcap( threshEndcap );
00098 clusterAlgo_.setThreshSeedEndcap( threshSeedEndcap );
00099
00100 clusterAlgo_.setThreshPtEndcap( threshPtEndcap );
00101 clusterAlgo_.setThreshPtSeedEndcap( threshPtSeedEndcap );
00102
00103 clusterAlgo_.setThreshCleanEndcap(threshCleanEndcap);
00104 clusterAlgo_.setS4S1CleanEndcap(minS4S1CleanEndcap);
00105
00106 clusterAlgo_.setThreshDoubleSpikeEndcap( threshDoubleSpikeEndcap );
00107 clusterAlgo_.setS6S2DoubleSpikeEndcap( minS6S2DoubleSpikeEndcap );
00108
00109 clusterAlgo_.setNNeighbours( nNeighbours );
00110
00111
00112 double posCalcP1 = threshBarrel<threshEndcap ? threshBarrel:threshEndcap;
00113 clusterAlgo_.setPosCalcP1( posCalcP1 );
00114 clusterAlgo_.setPosCalcNCrystal( posCalcNCrystal );
00115 clusterAlgo_.setShowerSigma( showerSigma );
00116
00117 clusterAlgo_.setUseCornerCells( useCornerCells );
00118 clusterAlgo_.setCleanRBXandHPDs( cleanRBXandHPDs);
00119
00120 int dcormode =
00121 iConfig.getParameter<int>("depthCor_Mode");
00122
00123 double dcora =
00124 iConfig.getParameter<double>("depthCor_A");
00125 double dcorb =
00126 iConfig.getParameter<double>("depthCor_B");
00127 double dcorap =
00128 iConfig.getParameter<double>("depthCor_A_preshower");
00129 double dcorbp =
00130 iConfig.getParameter<double>("depthCor_B_preshower");
00131
00132 if( dcormode !=0 )
00133 reco::PFCluster::setDepthCorParameters( dcormode,
00134 dcora, dcorb,
00135 dcorap, dcorbp );
00136
00137
00138
00139
00140
00141 inputTagPFRecHits_ =
00142 iConfig.getParameter<InputTag>("PFRecHits");
00143
00144
00145
00146
00147
00148 produces<reco::PFClusterCollection>();
00149 produces<reco::PFRecHitCollection>("Cleaned");
00150
00151
00152 }
00153
00154
00155
00156 PFClusterProducer::~PFClusterProducer() {}
00157
00158
00159
00160
00161 void PFClusterProducer::produce(edm::Event& iEvent,
00162 const edm::EventSetup& iSetup) {
00163
00164
00165 edm::Handle< reco::PFRecHitCollection > rechitsHandle;
00166
00167
00168 bool found = iEvent.getByLabel( inputTagPFRecHits_, rechitsHandle );
00169
00170 if(!found ) {
00171
00172 ostringstream err;
00173 err<<"cannot find rechits: "<<inputTagPFRecHits_;
00174 LogError("PFClusterProducer")<<err.str()<<endl;
00175
00176 throw cms::Exception( "MissingProduct", err.str());
00177 }
00178
00179
00180
00181 clusterAlgo_.doClustering( rechitsHandle );
00182
00183 if( verbose_ ) {
00184 LogInfo("PFClusterProducer")
00185 <<" clusters --------------------------------- "<<endl
00186 <<clusterAlgo_<<endl;
00187 }
00188
00189
00190
00191 auto_ptr< vector<reco::PFCluster> > outClusters( clusterAlgo_.clusters() );
00192 auto_ptr< vector<reco::PFRecHit> > recHitsCleaned ( clusterAlgo_.rechitsCleaned() );
00193 iEvent.put( outClusters );
00194 iEvent.put( recHitsCleaned, "Cleaned" );
00195
00196 }
00197
00198
00199