CMS 3D CMS Logo

CSCSegmentBuilder.cc
Go to the documentation of this file.
1 
14 
17 
20 
22  // The algo chosen for the segment building
23  int chosenAlgo = ps.getParameter<int>("algo_type") - 1;
24 
25  // Find appropriate ParameterSets for each algo type
26  std::vector<edm::ParameterSet> algoPSets = ps.getParameter<std::vector<edm::ParameterSet> >("algo_psets");
27 
28  // Now load the right parameter set
29  // Algo name
30  std::string algoName = algoPSets[chosenAlgo].getParameter<std::string>("algo_name");
31 
32  LogDebug("CSCSegment|CSC") << "CSCSegmentBuilder algorithm name: " << algoName;
33 
34  // SegAlgo parameter set
35  std::vector<edm::ParameterSet> segAlgoPSet =
36  algoPSets[chosenAlgo].getParameter<std::vector<edm::ParameterSet> >("algo_psets");
37 
38  // Chamber types to handle
39  std::vector<std::string> chType = algoPSets[chosenAlgo].getParameter<std::vector<std::string> >("chamber_types");
40  LogDebug("CSCSegment|CSC") << "No. of chamber types to handle: " << chType.size();
41 
42  // Algo to chamber type
43  std::vector<int> algoToType = algoPSets[chosenAlgo].getParameter<std::vector<int> >("parameters_per_chamber_type");
44 
45  // Trap if we don't have enough parameter sets or haven't assigned an algo to every type
46  if (algoToType.size() != chType.size()) {
47  throw cms::Exception("ParameterSetError")
48  << "#dim algosToType=" << algoToType.size() << ", #dim chType=" << chType.size() << std::endl;
49  }
50 
51  // Ask factory to build this algorithm, giving it appropriate ParameterSet
52 
53  for (size_t j = 0; j < chType.size(); ++j) {
54  algoMap.emplace(chType[j], CSCSegmentBuilderPluginFactory::get()->create(algoName, segAlgoPSet[algoToType[j] - 1]));
55  edm::LogVerbatim("CSCSegment|CSC") << "using algorithm #" << algoToType[j] << " for chamber type " << chType[j];
56  }
57 }
58 
60 
62  LogDebug("CSCSegment|CSC") << "Total number of rechits in this event: " << recHits->size();
63 
64  std::vector<CSCDetId> chambers;
65  std::vector<CSCDetId>::const_iterator chIt;
66 
67  for (CSCRecHit2DCollection::const_iterator it2 = recHits->begin(); it2 != recHits->end(); it2++) {
68  bool insert = true;
69  for (chIt = chambers.begin(); chIt != chambers.end(); ++chIt)
70  if (((*it2).cscDetId().chamber() == (*chIt).chamber()) && ((*it2).cscDetId().station() == (*chIt).station()) &&
71  ((*it2).cscDetId().ring() == (*chIt).ring()) && ((*it2).cscDetId().endcap() == (*chIt).endcap()))
72  insert = false;
73 
74  if (insert)
75  chambers.push_back((*it2).cscDetId().chamberId());
76  }
77 
78  for (chIt = chambers.begin(); chIt != chambers.end(); ++chIt) {
79  std::vector<const CSCRecHit2D*> cscRecHits;
80  const CSCChamber* chamber = geom_->chamber(*chIt);
81 
84 
85  std::vector<int> hitPerLayer(6);
86  for (CSCRecHit2DCollection::const_iterator rechit = range.first; rechit != range.second; rechit++) {
87  hitPerLayer[(*rechit).cscDetId().layer() - 1]++;
88  cscRecHits.push_back(&(*rechit));
89  }
90 
91  LogDebug("CSCSegment|CSC") << "found " << cscRecHits.size() << " rechits in chamber " << *chIt;
92 
93  // given the chamber select the appropriate algo... and run it
94  std::vector<CSCSegment> segv = algoMap[chamber->specs()->chamberTypeName()]->run(chamber, cscRecHits);
95 
96  LogDebug("CSCSegment|CSC") << "found " << segv.size() << " segments in chamber " << *chIt;
97 
98  // Add the segments to master collection
99  oc.put((*chIt), segv.begin(), segv.end());
100  }
101 }
102 
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
CSCRecHit2DCollection
CSCSegmentBuilder::CSCSegmentBuilder
CSCSegmentBuilder(const edm::ParameterSet &)
Definition: CSCSegmentBuilder.cc:21
MessageLogger.h
CSCSegmentBuilder::setGeometry
void setGeometry(const CSCGeometry *geom)
Definition: CSCSegmentBuilder.cc:103
CSCSegmentBuilderPluginFactory.h
CSCSegmentBuilder::build
void build(const CSCRecHit2DCollection *rechits, CSCSegmentCollection &oc)
Definition: CSCSegmentBuilder.cc:61
HIPAlignmentAlgorithm_cfi.algoName
algoName
Definition: HIPAlignmentAlgorithm_cfi.py:5
CSCSegmentCollection
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
CSCDetId.h
CSCSegmentBuilder::geom_
const CSCGeometry * geom_
Definition: CSCSegmentBuilder.h:45
CSCGeometry
Definition: CSCGeometry.h:24
CSCChamber
Definition: CSCChamber.h:22
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
CSCRangeMapAccessor.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
edm::LogVerbatim
Definition: MessageLogger.h:297
chambers
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
CSCRangeMapAccessor::cscChamber
static std::pair< CSCDetId, CSCDetIdSameChamberComparator > cscChamber(CSCDetId id)
Returns a valid DetId + a valid comparator for the RangeMap.
Definition: CSCRangeMapAccessor.cc:13
CSCRangeMapAccessor
Definition: CSCRangeMapAccessor.h:22
CSCSegmentBuilder::algoMap
std::map< std::string, std::unique_ptr< CSCSegmentAlgorithm > > algoMap
Definition: CSCSegmentBuilder.h:46
get
#define get
CSCSegmentBuilder::~CSCSegmentBuilder
~CSCSegmentBuilder()
Destructor.
CSCSegmentBuilder.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::RangeMap::range
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
CSCLayer.h
Exception
Definition: hltDiff.cc:246
CSCSegmentAlgorithm.h
edm::eventsetup::heterocontainer::insert
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
Exception.h
CSCRecHit2D.h
CSCChamberSpecs.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CSCGeometry::chamber
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
CSCGeometry.h