test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ME0SegmentBuilder Class Reference

#include <ME0SegmentBuilder.h>

Public Member Functions

void build (const ME0RecHitCollection *rechits, ME0SegmentCollection &oc)
 
 ME0SegmentBuilder (const edm::ParameterSet &)
 
void setGeometry (const ME0Geometry *g)
 
 ~ME0SegmentBuilder ()
 Destructor. More...
 

Private Attributes

ME0SegmentAlgorithmalgo
 
const ME0Geometrygeom_
 

Detailed Description

CSCSegmentBuilder Algorithm to build ME0Segment's from ME0RecHit collection by implementing a 'build' function required by ME0SegmentProducer.

Implementation notes:
Configured via the Producer's ParameterSet.
Presume this might become an abstract base class one day.

Date:
2014/02/04 13:45:31
Revision:
1.1
Author
Marcello Maggi

Definition at line 25 of file ME0SegmentBuilder.h.

Constructor & Destructor Documentation

ME0SegmentBuilder::ME0SegmentBuilder ( const edm::ParameterSet ps)
explicit

Configure the algorithm via ctor. Receives ParameterSet percolated down from EDProducer which owns this Builder.

Definition at line 12 of file ME0SegmentBuilder.cc.

References algo, reco::get(), edm::ParameterSet::getParameter(), LogDebug, and AlCaHLTBitMon_QueryRunRegistry::string.

12  : geom_(0) {
13 
14  // Algo name
15  std::string algoName = ps.getParameter<std::string>("algo_name");
16 
17  LogDebug("ME0SegmentBuilder")<< "ME0SegmentBuilder algorithm name: " << algoName;
18 
19  // SegAlgo parameter set
20  edm::ParameterSet segAlgoPSet = ps.getParameter<edm::ParameterSet>("algo_pset");
21 
22  // Ask factory to build this algorithm, giving it appropriate ParameterSet
23  algo = ME0SegmentBuilderPluginFactory::get()->create(algoName, segAlgoPSet);
24 
25 }
#define LogDebug(id)
T getParameter(std::string const &) const
ME0SegmentAlgorithm * algo
const ME0Geometry * geom_
T get(const Candidate &c)
Definition: component.h:55
ME0SegmentBuilder::~ME0SegmentBuilder ( )

Destructor.

Definition at line 26 of file ME0SegmentBuilder.cc.

References algo.

26  {
27  delete algo;
28 }
ME0SegmentAlgorithm * algo

Member Function Documentation

void ME0SegmentBuilder::build ( const ME0RecHitCollection rechits,
ME0SegmentCollection oc 
)

Find rechits in each ensemble of 6 ME0 layers, build ME0Segment's , and fill into output collection.

Definition at line 30 of file ME0SegmentBuilder.cc.

References algo, ME0DetId::chamber(), ME0Geometry::etaPartition(), geom_, LogDebug, me0RecHits_cfi::me0RecHits, createTree::pp, ME0DetId::region(), and ME0SegmentAlgorithm::run().

30  {
31 
32  LogDebug("ME0SegmentBuilder")<< "Total number of rechits in this event: " << recHits->size();
33 
34  // Let's define the ensemble of ME0 devices having the same region, chambers number (phi), and eta partition
35  // and layer run from 1 to number of layer. This is not the definition of one chamber... and indeed segments
36  // could in principle run in different way... The concept of the DetLayer would be more appropriate...
37 
38  std::map<uint32_t, std::vector<ME0RecHit*> > ensembleRH;
39 
40  // Loop on the ME0 rechit and select the different ME0 Ensemble
41  for(ME0RecHitCollection::const_iterator it2 = recHits->begin(); it2 != recHits->end(); ++it2) {
42  // ME0 Ensemble is defined by assigning all the ME0DetIds of the same "superchamber"
43  // (i.e. region same, chamber same) to the DetId of the first layer
44  // At this point there is only one roll, so nothing to be worried about ...
45  // [At a later stage one will have to mask also the rolls
46  // if one wants to recover segments that are at the border of a roll]
47  ME0DetId id(it2->me0Id().region(),1,it2->me0Id().chamber(),it2->me0Id().roll());
48  std::vector<ME0RecHit* > pp = ensembleRH[id.rawId()];
49  pp.push_back(it2->clone());
50  ensembleRH[id.rawId()]=pp;
51  }
52 
53  for(auto enIt=ensembleRH.begin(); enIt != ensembleRH.end(); ++enIt) {
54 
55  std::vector<const ME0RecHit*> me0RecHits;
56  std::map<uint32_t,const ME0EtaPartition* > ens;
57 
58  // all detIds have been assigned to the according detId with layer 1
59  const ME0EtaPartition* firstlayer = geom_->etaPartition(enIt->first);
60  for(auto rechit = enIt->second.begin(); rechit != enIt->second.end(); ++rechit) {
61  me0RecHits.push_back(*rechit);
62  ens[(*rechit)->me0Id()]=geom_->etaPartition((*rechit)->me0Id());
63  }
64  ME0SegmentAlgorithm::ME0Ensemble ensemble(std::pair<const ME0EtaPartition*, std::map<uint32_t,const ME0EtaPartition*> >(firstlayer,ens));
65 
66  LogDebug("ME0SegmentBuilder") << "found " << me0RecHits.size() << " rechits in chamber " /*<< *enIt */;
67 
68  // given the chamber select the appropriate algo... and run it
69  std::vector<ME0Segment> segv = algo->run(ensemble, me0RecHits);
70  ME0DetId mid(enIt->first);
71 
72  //FIXME
73  //HACK to make it a chamberID
74  ME0DetId midchamber(mid.region(),1,mid.chamber(),0);
75 
76  LogDebug("ME0SegmentBuilder") << "found " << segv.size() << " segments in chamber " << mid;
77 
78  // Add the segments to master collection
79  //FIXME
80  //HACK to make it a chamberID (taken from midchamber, not mid
81  //oc.put(mid, segv.begin(), segv.end());
82  oc.put(midchamber, segv.begin(), segv.end());
83  }
84 }
#define LogDebug(id)
ME0SegmentAlgorithm * algo
virtual std::vector< ME0Segment > run(const ME0Ensemble &ensemble, const std::vector< const ME0RecHit * > &rechits)=0
tuple pp
Definition: createTree.py:15
std::pair< const ME0EtaPartition *, std::map< uint32_t, const ME0EtaPartition * > > ME0Ensemble
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return a etaPartition given its id.
Definition: ME0Geometry.cc:61
const ME0Geometry * geom_
void ME0SegmentBuilder::setGeometry ( const ME0Geometry g)

Cache pointer to geometry for current event

Definition at line 86 of file ME0SegmentBuilder.cc.

References relativeConstraints::geom, and geom_.

86  {
87  geom_ = geom;
88 }
const ME0Geometry * geom_

Member Data Documentation

ME0SegmentAlgorithm* ME0SegmentBuilder::algo
private

Definition at line 46 of file ME0SegmentBuilder.h.

Referenced by build(), ME0SegmentBuilder(), and ~ME0SegmentBuilder().

const ME0Geometry* ME0SegmentBuilder::geom_
private

Definition at line 47 of file ME0SegmentBuilder.h.

Referenced by build(), and setGeometry().