CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTRegionalPixelSeedGeneratorProducers.cc
Go to the documentation of this file.
1 //
2 // Package: RecoEgamma/EgammaHLTProducers
3 // Class: EgammaHLTRegionalPixelSeedGeneratorProducers
4 // Modified from TkSeedGeneratorFromTrk by Jeremy Werner, Princeton University, USA
5 // $Id: EgammaHLTRegionalPixelSeedGeneratorProducers.cc,v 1.9 2008/02/15 16:11:01 ghezzi Exp $
6 //
7 
8 #include <iostream>
9 #include <memory>
10 #include <string>
11 
29 
33 
36 
39 // Math
40 #include "Math/GenVector/VectorUtil.h"
41 #include "Math/GenVector/PxPyPzE4D.h"
42 
43 using namespace std;
44 using namespace reco;
45 
47 {
48 
49  produces<TrajectorySeedCollection>();
50 
51  ptmin_ = conf_.getParameter<double>("ptMin");
52  vertexz_ = conf_.getParameter<double>("vertexZ");
53  originradius_= conf_.getParameter<double>("originRadius");
54  halflength_ = conf_.getParameter<double>("originHalfLength");
55  deltaEta_ = conf_.getParameter<double>("deltaEtaRegion");
56  deltaPhi_ = conf_.getParameter<double>("deltaPhiRegion");
57  candTag_ = conf_.getParameter< edm::InputTag > ("candTag");
58  candTagEle_ = conf_.getParameter< edm::InputTag > ("candTagEle");
59  useZvertex_ = conf_.getParameter<bool>("UseZInVertex");
60  BSProducer_ = conf.getParameter<edm::InputTag>("BSProducer");
61  // setup orderedhits setup (in order to tell seed generator to use pairs/triplets, which layers)
62 }
63 
64 // Virtual destructor needed.
66 }
67 
69 {
72 }
73 
74 
76 {
77  edm::ParameterSet hitsfactoryPSet =
78  conf_.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
79  std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");
80 
81  // get orderd hits generator from factory
82  OrderedHitsGenerator* hitsGenerator =
83  OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet);
84 
85  // start seed generator
87 }
88 
89 // Functions that gets called by framework every event
91 {
92 
93  // resulting collection
94  std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
95 
96  // Get the recoEcalCandidates
98  iEvent.getByLabel(candTag_,recoecalcands);
99 
100  //Get the Beam Spot position
101  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
102  // iEvent.getByType(recoBeamSpotHandle);
103  iEvent.getByLabel(BSProducer_,recoBeamSpotHandle);
104  // gets its position
105  const BeamSpot::Point& BSPosition = recoBeamSpotHandle->position();
106 
107  //Get the HLT electrons collection if needed
109  if(useZvertex_){iEvent.getByLabel(candTagEle_,electronHandle);}
110 
111  reco::SuperClusterRef scRef;
112  for (reco::RecoEcalCandidateCollection::const_iterator recoecalcand= recoecalcands->begin(); recoecalcand!=recoecalcands->end(); recoecalcand++) {
113  scRef = recoecalcand->superCluster();
114  float zvertex = 0;
115  if( useZvertex_ ){
116  reco::SuperClusterRef scRefEle;
117  for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
118  //Compare electron SC with EcalCandidate SC
119  scRefEle = iElectron->superCluster();
120  if(&(*scRef) == &(*scRefEle)){
121  zvertex = iElectron->track()->vz();
122  break;
123  }
124  }
125 
126  }
127  GlobalVector dirVector((recoecalcand)->px(),(recoecalcand)->py(),(recoecalcand)->pz());
128  RectangularEtaPhiTrackingRegion etaphiRegion( dirVector,
129  GlobalPoint( BSPosition.x(), BSPosition.y(), zvertex ),
130  ptmin_,
132  halflength_,
133  deltaEta_,
134  deltaPhi_);
135 
136  // fill Trajectory seed collection
137  combinatorialSeedGenerator->run(*output, etaphiRegion, iEvent, iSetup);
138 
139  }
140 
141  iEvent.put(output);
142 }
T getParameter(std::string const &) const
virtual void produce(edm::Event &e, const edm::EventSetup &c)
virtual void endRun(edm::Run &run, const edm::EventSetup &es)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:30
virtual void beginRun(edm::Run &run, const edm::EventSetup &es)
int iEvent
Definition: GenABIO.cc:243
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
tuple conf
Definition: dbtoconf.py:185
void run(TrajectorySeedCollection &seedCollection, const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es)
T get(const Candidate &c)
Definition: component.h:56
Definition: Run.h:32