Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <iostream>
00009 #include <memory>
00010 #include <string>
00011
00012 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTRegionalPixelSeedGeneratorProducers.h"
00013 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
00014 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00015 #include "DataFormats/Common/interface/Handle.h"
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017 #include "FWCore/Framework/interface/EventSetup.h"
00018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00019 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00020 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00021 #include "RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h"
00022 #include "DataFormats/TrackReco/interface/Track.h"
00023 #include "DataFormats/Math/interface/Vector3D.h"
00024 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
00025 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
00026 #include "DataFormats/EgammaCandidates/interface/Electron.h"
00027 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
00028 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00029
00030 #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGeneratorFactory.h"
00031 #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGenerator.h"
00032 #include "RecoTracker/TkSeedGenerator/interface/SeedGeneratorFromRegionHits.h"
00033 #include "RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h"
00034
00035 #include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h"
00036 #include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
00037
00038 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00039 #include "DataFormats/Math/interface/Point3D.h"
00040
00041 #include "Math/GenVector/VectorUtil.h"
00042 #include "Math/GenVector/PxPyPzE4D.h"
00043
00044 using namespace std;
00045 using namespace reco;
00046
00047 EgammaHLTRegionalPixelSeedGeneratorProducers::EgammaHLTRegionalPixelSeedGeneratorProducers(edm::ParameterSet const& conf) : conf_(conf),combinatorialSeedGenerator(0)
00048 {
00049
00050 produces<TrajectorySeedCollection>();
00051
00052 ptmin_ = conf_.getParameter<double>("ptMin");
00053 vertexz_ = conf_.getParameter<double>("vertexZ");
00054 originradius_= conf_.getParameter<double>("originRadius");
00055 halflength_ = conf_.getParameter<double>("originHalfLength");
00056 deltaEta_ = conf_.getParameter<double>("deltaEtaRegion");
00057 deltaPhi_ = conf_.getParameter<double>("deltaPhiRegion");
00058 candTag_ = conf_.getParameter< edm::InputTag > ("candTag");
00059 candTagEle_ = conf_.getParameter< edm::InputTag > ("candTagEle");
00060 useZvertex_ = conf_.getParameter<bool>("UseZInVertex");
00061 BSProducer_ = conf.getParameter<edm::InputTag>("BSProducer");
00062
00063 }
00064
00065
00066 EgammaHLTRegionalPixelSeedGeneratorProducers::~EgammaHLTRegionalPixelSeedGeneratorProducers() {
00067 }
00068
00069 void EgammaHLTRegionalPixelSeedGeneratorProducers::endRun(edm::Run &run, const edm::EventSetup& es)
00070 {
00071 delete combinatorialSeedGenerator;
00072 combinatorialSeedGenerator=0;
00073 }
00074
00075
00076 void EgammaHLTRegionalPixelSeedGeneratorProducers::beginRun(edm::Run &run, const edm::EventSetup& es)
00077 {
00078 edm::ParameterSet hitsfactoryPSet =
00079 conf_.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
00080 std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");
00081
00082
00083 OrderedHitsGenerator* hitsGenerator =
00084 OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet);
00085
00086
00087
00088 edm::ParameterSet creatorPSet;
00089 creatorPSet.addParameter<std::string>("propagator","PropagatorWithMaterial");
00090
00091 combinatorialSeedGenerator = new SeedGeneratorFromRegionHits( hitsGenerator, 0,
00092 SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet)
00093 );
00094 }
00095
00096
00097 void EgammaHLTRegionalPixelSeedGeneratorProducers::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00098 {
00099
00100
00101 std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
00102
00103
00104 edm::Handle<reco::RecoEcalCandidateCollection> recoecalcands;
00105 iEvent.getByLabel(candTag_,recoecalcands);
00106
00107
00108 edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
00109
00110 iEvent.getByLabel(BSProducer_,recoBeamSpotHandle);
00111
00112 const BeamSpot::Point& BSPosition = recoBeamSpotHandle->position();
00113
00114
00115 edm::Handle<reco::ElectronCollection> electronHandle;
00116 if(useZvertex_){iEvent.getByLabel(candTagEle_,electronHandle);}
00117
00118 reco::SuperClusterRef scRef;
00119 for (reco::RecoEcalCandidateCollection::const_iterator recoecalcand= recoecalcands->begin(); recoecalcand!=recoecalcands->end(); recoecalcand++) {
00120 scRef = recoecalcand->superCluster();
00121 float zvertex = 0;
00122 if( useZvertex_ ){
00123 reco::SuperClusterRef scRefEle;
00124 for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
00125
00126 scRefEle = iElectron->superCluster();
00127 if(&(*scRef) == &(*scRefEle)){
00128 if(iElectron->track().isNonnull()) zvertex = iElectron->track()->vz();
00129 else zvertex = iElectron->gsfTrack()->vz();
00130 break;
00131 }
00132 }
00133
00134 }
00135 GlobalVector dirVector((recoecalcand)->px(),(recoecalcand)->py(),(recoecalcand)->pz());
00136 RectangularEtaPhiTrackingRegion etaphiRegion( dirVector,
00137 GlobalPoint( BSPosition.x(), BSPosition.y(), zvertex ),
00138 ptmin_,
00139 originradius_,
00140 halflength_,
00141 deltaEta_,
00142 deltaPhi_);
00143
00144
00145 combinatorialSeedGenerator->run(*output, etaphiRegion, iEvent, iSetup);
00146
00147 }
00148
00149 iEvent.put(output);
00150 }