Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RecoTracker
ConversionSeedGenerators
plugins
SeedGeneratorFromTrackingParticleEDProducer.cc
Go to the documentation of this file.
1
/*#include "FWCore/Framework/interface/EDProducer.h"
2
#include "FWCore/Utilities/interface/InputTag.h"
3
#include "FWCore/ParameterSet/interface/ParameterSet.h"
4
#include "FWCore/Framework/interface/Event.h"
5
#include "DataFormats/Common/interface/Handle.h"
6
#include "DataFormats/TrackReco/interface/Track.h"
7
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
8
#include "RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h"
9
#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h"
10
#include "RecoTracker/TkSeedGenerator/interface/SeedFromConsecutiveHitsCreator.h"
11
#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
12
#include "TrackingTools/Records/interface/TransientRecHitRecord.h"
13
#include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h"
14
#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
15
#include "FWCore/Framework/interface/EventSetup.h"
16
#include "FWCore/Framework/interface/ESHandle.h"
17
#include "DataFormats/TrackReco/interface/TrackFwd.h"
18
#include "FWCore/MessageLogger/interface/MessageLogger.h"
19
#include <vector>
20
21
class SeedGeneratorFromTrackingParticleEDProducer : public edm::EDProducer {
22
public:
23
SeedGeneratorFromTrackingParticleEDProducer(const edm::ParameterSet& cfg);
24
virtual ~SeedGeneratorFromTrackingParticleEDProducer(){}
25
virtual void produce(edm::Event& ev, const edm::EventSetup& es);
26
private:
27
edm::ParameterSet theConfig;
28
edm::InputTag theInputCollectionTag;
29
};
30
31
using namespace edm;
32
using namespace reco;
33
34
template <class T> T sqr( T t) {return t*t;}
35
typedef TransientTrackingRecHit::ConstRecHitPointer Hit;
36
37
struct HitLessByRadius { bool operator() (const Hit& h1, const Hit & h2) { return h1->globalPosition().perp2() < h2->globalPosition().perp2(); } };
38
39
SeedGeneratorFromTrackingParticleEDProducer::SeedGeneratorFromTrackingParticleEDProducer(const ParameterSet& cfg)
40
: theConfig(cfg), theInputCollectionTag(cfg.getParameter<InputTag>("InputCollection"))
41
{
42
produces<TrajectorySeedCollection>();
43
}
44
45
void SeedGeneratorFromTrackingParticleEDProducer::produce(edm::Event& ev, const edm::EventSetup& es)
46
{
47
auto result = std::make_unique<TrajectorySeedCollection>();
48
Handle<reco::TrackCollection> trks;
49
ev.getByLabel(theInputCollectionTag, trks);
50
51
const TrackCollection &protos = *(trks.product());
52
53
for (TrackCollection::const_iterator it=protos.begin(); it!= protos.end(); ++it) {
54
const Track & proto = (*it);
55
56
if (theConfig.getParameter<bool>("useProtoTrackKinematics")) {
57
SeedFromProtoTrack seedFromProtoTrack( proto, es);
58
if (seedFromProtoTrack.isValid()) (*result).push_back( seedFromProtoTrack.trajectorySeed() );
59
} else {
60
edm::ESHandle<TransientTrackingRecHitBuilder> ttrhbESH;
61
std::string builderName = theConfig.getParameter<std::string>("TTRHBuilder");
62
es.get<TransientRecHitRecord>().get(builderName,ttrhbESH);
63
std::vector<Hit> hits;
64
for (unsigned int iHit = 0, nHits = proto.recHitsSize(); iHit < nHits; ++iHit) {
65
TrackingRecHitRef refHit = proto.recHit(iHit);
66
if(refHit->isValid()) hits.push_back(ttrhbESH->build( &(*refHit) ));
67
sort(hits.begin(), hits.end(), HitLessByRadius());
68
}
69
if (hits.size() >= 2) {
70
GlobalPoint vtx(proto.vertex().x(), proto.vertex().y(), proto.vertex().z());
71
double mom_perp = sqrt(proto.momentum().x()*proto.momentum().x()+proto.momentum().y()*proto.momentum().y());
72
GlobalTrackingRegion region(mom_perp, vtx, 0.2, 0.2);
73
SeedFromConsecutiveHitsCreator().trajectorySeed(*result, SeedingHitSet(hits), region, es);
74
}
75
}
76
}
77
78
ev.put(std::move(result));
79
}
80
*/
Generated for CMSSW Reference Manual by
1.8.5