00001 #include "RecoParticleFlow/PFBlockProducer/interface/PFBlockProducer.h"
00002
00003
00004
00005
00006 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyCalibration.h"
00007 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyResolution.h"
00008
00009 #include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
00010 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00011 #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
00012 #include "DataFormats/ParticleFlowReco/interface/PFNuclearInteraction.h"
00013 #include "DataFormats/ParticleFlowReco/interface/PFConversionFwd.h"
00014 #include "DataFormats/ParticleFlowReco/interface/PFConversion.h"
00015 #include "DataFormats/ParticleFlowReco/interface/PFV0Fwd.h"
00016 #include "DataFormats/ParticleFlowReco/interface/PFV0.h"
00017
00018 #include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
00019 #include "DataFormats/ParticleFlowReco/interface/PFBlockFwd.h"
00020
00021 #include "FWCore/Framework/interface/ESHandle.h"
00022
00023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00024 #include "FWCore/Utilities/interface/Exception.h"
00025 #include "FWCore/Framework/interface/EventSetup.h"
00026
00027 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00028
00029 #include "FWCore/ParameterSet/interface/FileInPath.h"
00030
00031 #include <set>
00032
00033 using namespace std;
00034 using namespace edm;
00035
00036 PFBlockProducer::PFBlockProducer(const edm::ParameterSet& iConfig) {
00037
00038
00039
00040 inputTagRecTracks_
00041 = iConfig.getParameter<InputTag>("RecTracks");
00042
00043 inputTagGsfRecTracks_
00044 = iConfig.getParameter<InputTag>("GsfRecTracks");
00045
00046 inputTagRecMuons_
00047 = iConfig.getParameter<InputTag>("RecMuons");
00048
00049 inputTagPFNuclear_
00050 = iConfig.getParameter<InputTag>("PFNuclear");
00051
00052 inputTagPFConversions_
00053 = iConfig.getParameter<InputTag>("PFConversions");
00054
00055 inputTagPFV0_
00056 = iConfig.getParameter<InputTag>("PFV0");
00057
00058 inputTagPFClustersECAL_
00059 = iConfig.getParameter<InputTag>("PFClustersECAL");
00060
00061 inputTagPFClustersHCAL_
00062 = iConfig.getParameter<InputTag>("PFClustersHCAL");
00063
00064 inputTagPFClustersPS_
00065 = iConfig.getParameter<InputTag>("PFClustersPS");
00066
00067
00068
00069 verbose_ =
00070 iConfig.getUntrackedParameter<bool>("verbose",false);
00071
00072 bool debug_ =
00073 iConfig.getUntrackedParameter<bool>("debug",false);
00074
00075 useNuclear_ = iConfig.getParameter<bool>("useNuclear");
00076
00077 useConversions_ = iConfig.getParameter<bool>("useConversions");
00078
00079 useV0_ = iConfig.getParameter<bool>("useV0");
00080
00081 produces<reco::PFBlockCollection>();
00082
00083
00084
00085
00086
00087 string map_ECAL_eta
00088 = iConfig.getParameter<string>("pf_resolution_map_ECAL_eta");
00089 string map_ECAL_phi
00090 = iConfig.getParameter<string>("pf_resolution_map_ECAL_phi");
00091
00092
00093
00094
00095
00096 string map_HCAL_eta
00097 = iConfig.getParameter<string>("pf_resolution_map_HCAL_eta");
00098 string map_HCAL_phi
00099 = iConfig.getParameter<string>("pf_resolution_map_HCAL_phi");
00100
00101 double DPtovPtCut
00102 = iConfig.getParameter<double>("pf_DPtoverPt_Cut");
00103
00104 double chi2_ECAL_PS
00105 = iConfig.getParameter<double>("pf_chi2_ECAL_PS");
00106
00107
00108
00109 double chi2_ECAL_Track
00110 = iConfig.getParameter<double>("pf_chi2_ECAL_Track");
00111 double chi2_ECAL_GSF
00112 = iConfig.getParameter<double>("pf_chi2_ECAL_GSF");
00113 double chi2_HCAL_Track
00114 = iConfig.getParameter<double>("pf_chi2_HCAL_Track");
00115 double chi2_ECAL_HCAL
00116 = iConfig.getParameter<double>("pf_chi2_ECAL_HCAL");
00117 double chi2_PS_Track
00118 = iConfig.getParameter<double>("pf_chi2_PS_Track");
00119 double chi2_PSH_PSV
00120 = iConfig.getParameter<double>("pf_chi2_PSH_PSV");
00121
00122 bool multiLink =
00123 iConfig.getParameter<bool>("pf_multilink");
00124
00125
00126
00127
00128
00129
00130 edm::FileInPath path_ECAL_eta( map_ECAL_eta.c_str() );
00131 edm::FileInPath path_ECAL_phi( map_ECAL_phi.c_str() );
00132 edm::FileInPath path_HCAL_eta( map_HCAL_eta.c_str() );
00133 edm::FileInPath path_HCAL_phi( map_HCAL_phi.c_str() );
00134
00135 pfBlockAlgo_.setParameters( path_ECAL_eta.fullPath().c_str(),
00136 path_ECAL_phi.fullPath().c_str(),
00137 path_HCAL_eta.fullPath().c_str(),
00138 path_HCAL_phi.fullPath().c_str(),
00139 DPtovPtCut,
00140 chi2_ECAL_Track,
00141 chi2_ECAL_GSF,
00142 chi2_HCAL_Track,
00143 chi2_ECAL_HCAL,
00144 chi2_ECAL_PS,
00145 chi2_PS_Track,
00146 chi2_PSH_PSV,
00147 multiLink );
00148
00149 pfBlockAlgo_.setDebug(debug_);
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 }
00166
00167
00168
00169 PFBlockProducer::~PFBlockProducer() { }
00170
00171
00172
00173 void PFBlockProducer::beginJob(const edm::EventSetup & es) { }
00174
00175
00176 void PFBlockProducer::produce(Event& iEvent,
00177 const EventSetup& iSetup) {
00178
00179 LogDebug("PFBlockProducer")<<"START event: "<<iEvent.id().event()
00180 <<" in run "<<iEvent.id().run()<<endl;
00181
00182
00183
00184
00185 Handle< reco::PFRecTrackCollection > recTracks;
00186
00187
00188 bool found = iEvent.getByLabel(inputTagRecTracks_, recTracks);
00189
00190 if(!found )
00191 LogError("PFBlockProducer")<<" cannot get rectracks: "
00192 <<inputTagRecTracks_<<endl;
00193
00194
00195
00196
00197 Handle< reco::GsfPFRecTrackCollection > GsfrecTracks;
00198 found = iEvent.getByLabel(inputTagGsfRecTracks_,GsfrecTracks);
00199 if(!found )
00200 LogError("PFBlockProducer")<<" cannot get Gsfrectracks: "
00201 << inputTagGsfRecTracks_ <<endl;
00202
00203
00204
00205 Handle< reco::MuonCollection > recMuons;
00206
00207
00208 found = iEvent.getByLabel(inputTagRecMuons_, recMuons);
00209
00210
00211
00212
00213
00214
00215
00216
00217 Handle< reco::PFNuclearInteractionCollection > pfNuclears;
00218 if( useNuclear_ ) {
00219 found = iEvent.getByLabel(inputTagPFNuclear_, pfNuclears);
00220
00221
00222 if(!found )
00223 LogError("PFBlockProducer")<<" cannot get PFNuclearInteractions : "
00224 <<inputTagPFNuclear_<<endl;
00225 }
00226
00227
00228
00229
00230
00231 Handle< reco::PFConversionCollection > pfConversions;
00232 if( useConversions_ ) {
00233 found = iEvent.getByLabel(inputTagPFConversions_, pfConversions);
00234
00235 if(!found )
00236 LogError("PFBlockProducer")<<" cannot get PFConversions : "
00237 <<inputTagPFConversions_<<endl;
00238 }
00239
00240
00241
00242 Handle< reco::PFV0Collection > pfV0;
00243 if( useV0_ ) {
00244 found = iEvent.getByLabel(inputTagPFV0_, pfV0);
00245
00246 if(!found )
00247 LogError("PFBlockProducer")<<" cannot get PFV0 : "
00248 <<inputTagPFV0_<<endl;
00249 }
00250
00251
00252
00253
00254
00255
00256 Handle< reco::PFClusterCollection > clustersECAL;
00257 found = iEvent.getByLabel(inputTagPFClustersECAL_,
00258 clustersECAL);
00259 if(!found )
00260 LogError("PFBlockProducer")<<" cannot get ECAL clusters: "
00261 <<inputTagPFClustersECAL_<<endl;
00262
00263
00264 Handle< reco::PFClusterCollection > clustersHCAL;
00265 found = iEvent.getByLabel(inputTagPFClustersHCAL_,
00266 clustersHCAL);
00267 if(!found )
00268 LogError("PFBlockProducer")<<" cannot get HCAL clusters: "
00269 <<inputTagPFClustersHCAL_<<endl;
00270
00271
00272 Handle< reco::PFClusterCollection > clustersPS;
00273 found = iEvent.getByLabel(inputTagPFClustersPS_,
00274 clustersPS);
00275 if(!found )
00276 LogError("PFBlockProducer")<<" cannot get PS clusters: "
00277 <<inputTagPFClustersPS_<<endl;
00278
00279
00280
00281
00282
00283 pfBlockAlgo_.setInput( recTracks,
00284 GsfrecTracks,
00285 recMuons,
00286 pfNuclears,
00287 pfConversions,
00288 pfV0,
00289 clustersECAL,
00290 clustersHCAL,
00291 clustersPS );
00292 pfBlockAlgo_.findBlocks();
00293
00294 if(verbose_) {
00295 ostringstream str;
00296 str<<pfBlockAlgo_<<endl;
00297 LogInfo("PFBlockProducer") << str.str()<<endl;
00298 }
00299
00300 auto_ptr< reco::PFBlockCollection >
00301 pOutputBlockCollection( pfBlockAlgo_.transferBlocks() );
00302
00303
00304 iEvent.put(pOutputBlockCollection);
00305
00306 LogDebug("PFBlockProducer")<<"STOP event: "<<iEvent.id().event()
00307 <<" in run "<<iEvent.id().run()<<endl;
00308 }