CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 using namespace std;
18  : cosmic_seed(conf, consumesCollector()),
19  check(conf, consumesCollector())
20 
21 {
22  edm::LogInfo("CosmicSeedGenerator") << "Enter the CosmicSeedGenerator";
23  // get Inputs
24  matchedrecHitsToken_ = consumes<SiStripMatchedRecHit2DCollection>(conf.getParameter<edm::InputTag>("matchedRecHits"));
25  rphirecHitsToken_ = consumes<SiStripRecHit2DCollection>(conf.getParameter<edm::InputTag>("rphirecHits"));
26  stereorecHitsToken_ = consumes<SiStripRecHit2DCollection>(conf.getParameter<edm::InputTag>("stereorecHits"));
27 
28  produces<TrajectorySeedCollection>();
29 }
30 
31 // Virtual destructor needed.
33 
34 // Functions that gets called by framework every event
37  ev.getByToken(rphirecHitsToken_, rphirecHits);
39  ev.getByToken(stereorecHitsToken_, stereorecHits);
41  ev.getByToken(matchedrecHitsToken_, matchedrecHits);
42 
43  auto output = std::make_unique<TrajectorySeedCollection>();
44 
45  //check on the number of clusters
46  size_t clustsOrZero = check.tooManyClusters(ev);
47  if (!clustsOrZero) {
48  // invoke the seed finding algorithm
49  cosmic_seed.run(*stereorecHits, *rphirecHits, *matchedrecHits, es, *output);
50  } else
51  edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
52 
53  // write output to file
54  LogDebug("CosmicSeedGenerator") << " number of seeds = " << output->size();
55 
56  ev.put(std::move(output));
57 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void produce(edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
bool ev
Log< level::Error, false > LogError
edm::EDGetTokenT< SiStripRecHit2DCollection > stereorecHitsToken_
CosmicSeedGenerator(const edm::ParameterSet &conf)
def move
Definition: eostools.py:511
size_t tooManyClusters(const edm::Event &e) const
SeedGeneratorForCosmics cosmic_seed
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void run(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c, TrajectorySeedCollection &)
#define LogDebug(id)