test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CosmicSeedGenerator.cc
Go to the documentation of this file.
1 //
2 // Package: RecoTracker/TkSeedGenerator
3 // Class: GlobalPixelLessSeedGenerator
4 //
5 
6 #include <iostream>
7 #include <memory>
8 #include <string>
9 
15 
16 
17 using namespace std;
19  cosmic_seed(conf),
20  check(conf,consumesCollector())
21 
22  {
23  edm::LogInfo ("CosmicSeedGenerator")<<"Enter the CosmicSeedGenerator";
24  // get Inputs
25  matchedrecHitsToken_ = consumes<SiStripMatchedRecHit2DCollection>(
26  conf.getParameter<edm::InputTag>("matchedRecHits"));
27  rphirecHitsToken_ = consumes<SiStripRecHit2DCollection>(
28  conf.getParameter<edm::InputTag>("rphirecHits"));
29  stereorecHitsToken_ = consumes<SiStripRecHit2DCollection>(
30  conf.getParameter<edm::InputTag>("stereorecHits"));
31 
32  produces<TrajectorySeedCollection>();
33 }
34 
35 
36 // Virtual destructor needed.
38 
39 // Functions that gets called by framework every event
41 {
43  ev.getByToken( rphirecHitsToken_, rphirecHits);
45  ev.getByToken( stereorecHitsToken_,stereorecHits);
47  ev.getByToken( matchedrecHitsToken_, matchedrecHits);
48 
49 
50  std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection);
51 
52  //check on the number of clusters
53  size_t clustsOrZero = check.tooManyClusters(ev);
54  if (!clustsOrZero){
55  cosmic_seed.init(*stereorecHits,*rphirecHits,*matchedrecHits, es);
56 
57  // invoke the seed finding algorithm
58  cosmic_seed.run(*output,es);
59  } else edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
60 
61  // write output to file
62  LogDebug("CosmicSeedGenerator")<<" number of seeds = "<< output->size();
63 
64 
65  ev.put(output);
66 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
void run(TrajectorySeedCollection &, const edm::EventSetup &c)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
bool ev
edm::EDGetTokenT< SiStripRecHit2DCollection > stereorecHitsToken_
CosmicSeedGenerator(const edm::ParameterSet &conf)
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
size_t tooManyClusters(const edm::Event &e) const
SeedGeneratorForCosmics cosmic_seed
void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c)