Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019 #include "FastSimulation/EgammaElectronAlgos/plugins/FastElectronSeedProducer.h"
00020 #include "FastSimulation/EgammaElectronAlgos/interface/FastElectronSeedGenerator.h"
00021
00022 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h"
00023 #include "RecoEgamma/EgammaTools/interface/HoECalculator.h"
00024 #include "RecoCaloTools/Selectors/interface/CaloConeSelector.h"
00025
00026 #include "FWCore/Framework/interface/Event.h"
00027 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00029
00030 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00031 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00032 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00033
00034 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSMatchedRecHit2DCollection.h"
00035 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00036 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
00037 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
00038 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00039 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00040
00041 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00042
00043 #include <iostream>
00044
00045 FastElectronSeedProducer::FastElectronSeedProducer(const edm::ParameterSet& iConfig)
00046 : matcher_(0), caloGeomCacheId_(0), hcalIso_(0), mhbhe_(0)
00047 {
00048 edm::ParameterSet pset = iConfig.getParameter<edm::ParameterSet>("SeedConfiguration");
00049 SCEtCut_=pset.getParameter<double>("SCEtCut");
00050 maxHOverE_=pset.getParameter<double>("maxHOverE");
00051 hOverEConeSize_=pset.getParameter<double>("hOverEConeSize");
00052 hOverEHBMinE_=pset.getParameter<double>("hOverEHBMinE");
00053 hOverEHFMinE_=pset.getParameter<double>("hOverEHFMinE");
00054 fromTrackerSeeds_=pset.getParameter<bool>("fromTrackerSeeds");
00055 initialSeeds_=pset.getParameter<edm::InputTag>("initialSeeds");
00056
00057 matcher_ = new FastElectronSeedGenerator(pset,
00058 iConfig.getParameter<double>("pTMin"),
00059 iConfig.getParameter<edm::InputTag>("beamSpot"));
00060
00061
00062 clusters_[0]=iConfig.getParameter<edm::InputTag>("barrelSuperClusters");
00063 clusters_[1]=iConfig.getParameter<edm::InputTag>("endcapSuperClusters");
00064 simTracks_=iConfig.getParameter<edm::InputTag>("simTracks");
00065 trackerHits_=iConfig.getParameter<edm::InputTag>("trackerHits");
00066 hcalRecHits_= pset.getParameter<edm::InputTag>("hcalRecHits");
00067
00068
00069 produces<reco::ElectronSeedCollection>();
00070
00071 }
00072
00073
00074 FastElectronSeedProducer::~FastElectronSeedProducer()
00075 {
00076
00077
00078 delete matcher_ ;
00079 delete mhbhe_ ;
00080
00081 delete hcalIso_ ;
00082 }
00083
00084 void
00085 FastElectronSeedProducer::beginRun(edm::Run & run, const edm::EventSetup & es)
00086 {
00087
00088 if (caloGeomCacheId_!=es.get<CaloGeometryRecord>().cacheIdentifier())
00089 {
00090 es.get<CaloGeometryRecord>().get(caloGeom_);
00091 caloGeomCacheId_=es.get<CaloGeometryRecord>().cacheIdentifier();
00092 }
00093
00094
00095
00096
00097 matcher_->setupES(es) ;
00098
00099 }
00100
00101 void
00102 FastElectronSeedProducer::produce(edm::Event& e, const edm::EventSetup& iSetup)
00103 {
00104 LogDebug("FastElectronSeedProducer")<<"[FastElectronSeedProducer::produce] entering " ;
00105
00106
00107 if (fromTrackerSeeds_) {
00108
00109 edm::Handle<TrajectorySeedCollection> hSeeds;
00110 e.getByLabel(initialSeeds_, hSeeds);
00111 initialSeedColl_ = const_cast<TrajectorySeedCollection *> (hSeeds.product());
00112
00113 } else {
00114
00115 initialSeedColl_=0;
00116
00117 }
00118
00119 reco::ElectronSeedCollection * seeds = new reco::ElectronSeedCollection ;
00120
00121
00122 edm::Handle<edm::SimTrackContainer> theSTC;
00123 e.getByLabel(simTracks_,theSTC);
00124 const edm::SimTrackContainer* theSimTracks = &(*theSTC);
00125
00126
00127 edm::Handle<SiTrackerGSMatchedRecHit2DCollection> theRHC;
00128 e.getByLabel(trackerHits_, theRHC);
00129 const SiTrackerGSMatchedRecHit2DCollection* theGSRecHits = &(*theRHC);
00130
00131
00132 edm::Handle<HBHERecHitCollection> hbhe ;
00133 delete mhbhe_ ;
00134 if (e.getByLabel(hcalRecHits_,hbhe))
00135 { mhbhe_= new HBHERecHitMetaCollection(*hbhe) ; }
00136 else
00137 { mhbhe_ = 0 ; }
00138
00139
00140
00141
00142
00143
00144 delete hcalIso_ ;
00145 hcalIso_ = new EgammaHcalIsolation(hOverEConeSize_,0.,hOverEHBMinE_,hOverEHFMinE_,0.,0.,caloGeom_,mhbhe_) ;
00146
00147
00148 for (unsigned int i=0; i<2; i++) {
00149
00150
00151 edm::Handle<reco::SuperClusterCollection> clusters;
00152 e.getByLabel(clusters_[i],clusters);
00153 reco::SuperClusterRefVector clusterRefs;
00154 filterClusters(clusters,clusterRefs) ;
00155 matcher_->run(e,clusterRefs,theGSRecHits,theSimTracks,initialSeedColl_,*seeds);
00156
00157 }
00158
00159
00160 std::auto_ptr<reco::ElectronSeedCollection> pSeeds(seeds) ;
00161 e.put(pSeeds);
00162
00163 }
00164
00165
00166 void
00167 FastElectronSeedProducer::filterClusters
00168 ( const edm::Handle<reco::SuperClusterCollection> & superClusters,
00169
00170 reco::SuperClusterRefVector & sclRefs )
00171 {
00172
00173
00174
00175 for (unsigned int i=0;i<superClusters->size();++i)
00176 {
00177 const reco::SuperCluster & scl=(*superClusters)[i] ;
00178 if (scl.energy()/cosh(scl.eta())>SCEtCut_)
00179 {
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 double newHcalE = hcalIso_->getHcalESum(&scl), newHoE = newHcalE/scl.energy() ;
00206
00207 if (newHoE<=maxHOverE_)
00208 { sclRefs.push_back(edm::Ref<reco::SuperClusterCollection>(superClusters,i)) ; }
00209 }
00210 }
00211
00212 LogDebug("ElectronSeedProducer")<<"Filtered out "
00213 <<sclRefs.size()<<" superclusters from "<<superClusters->size() ;
00214 }