Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019 #include "FastElectronSeedProducer.h"
00020 #include "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 const& 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::ESHandle<TrackerTopology> tTopoHand;
00133 iSetup.get<IdealGeometryRecord>().get(tTopoHand);
00134 const TrackerTopology *tTopo=tTopoHand.product();
00135
00136
00137
00138 edm::Handle<HBHERecHitCollection> hbhe ;
00139 delete mhbhe_ ;
00140 if (e.getByLabel(hcalRecHits_,hbhe))
00141 { mhbhe_= new HBHERecHitMetaCollection(*hbhe) ; }
00142 else
00143 { mhbhe_ = 0 ; }
00144
00145
00146
00147
00148
00149
00150 delete hcalIso_ ;
00151 hcalIso_ = new EgammaHcalIsolation(hOverEConeSize_,0.,hOverEHBMinE_,hOverEHFMinE_,0.,0.,caloGeom_,mhbhe_) ;
00152
00153
00154 for (unsigned int i=0; i<2; i++) {
00155
00156
00157 edm::Handle<reco::SuperClusterCollection> clusters;
00158 e.getByLabel(clusters_[i],clusters);
00159 reco::SuperClusterRefVector clusterRefs;
00160 filterClusters(clusters,clusterRefs) ;
00161 matcher_->run(e,clusterRefs,theGSRecHits,theSimTracks,initialSeedColl_,tTopo,*seeds);
00162
00163 }
00164
00165
00166 std::auto_ptr<reco::ElectronSeedCollection> pSeeds(seeds) ;
00167 e.put(pSeeds);
00168
00169 }
00170
00171
00172 void
00173 FastElectronSeedProducer::filterClusters
00174 ( const edm::Handle<reco::SuperClusterCollection> & superClusters,
00175
00176 reco::SuperClusterRefVector & sclRefs )
00177 {
00178
00179
00180
00181 for (unsigned int i=0;i<superClusters->size();++i)
00182 {
00183 const reco::SuperCluster & scl=(*superClusters)[i] ;
00184 if (scl.energy()/cosh(scl.eta())>SCEtCut_)
00185 {
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211 double newHcalE = hcalIso_->getHcalESum(&scl), newHoE = newHcalE/scl.energy() ;
00212
00213 if (newHoE<=maxHOverE_)
00214 { sclRefs.push_back(edm::Ref<reco::SuperClusterCollection>(superClusters,i)) ; }
00215 }
00216 }
00217
00218 LogDebug("ElectronSeedProducer")<<"Filtered out "
00219 <<sclRefs.size()<<" superclusters from "<<superClusters->size() ;
00220 }