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
GEMRecHitProducer Class Reference

#include <GEMRecHitProducer.h>

Inheritance diagram for GEMRecHitProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 GEMRecHitProducer (const edm::ParameterSet &config)
 Constructor. More...
 
virtual void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the rechits. More...
 
virtual ~GEMRecHitProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

GEMRecHitBaseAlgotheAlgo
 
edm::InputTag theGEMDigiLabel
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Module for GEMRecHit production.

Author
M. Maggim – INFN Bari

Definition at line 39 of file GEMRecHitProducer.h.

Constructor & Destructor Documentation

GEMRecHitProducer::GEMRecHitProducer ( const edm::ParameterSet config)

Constructor.

Definition at line 37 of file GEMRecHitProducer.cc.

References reco::get(), and edm::ParameterSet::getParameter().

37  {
38 
39  // Set verbose output
40 
41  produces<GEMRecHitCollection>();
42 
43  theGEMDigiLabel = config.getParameter<InputTag>("gemDigiLabel");
44 
45  // Get the concrete reconstruction algo from the factory
46 
47  string theAlgoName = config.getParameter<string>("recAlgo");
48  theAlgo = GEMRecHitAlgoFactory::get()->create(theAlgoName,
49  config.getParameter<ParameterSet>("recAlgoConfig"));
50 
51  // Get masked- and dead-strip information
52 
53  /* GEMMaskedStripsObj = new GEMMaskedStrips();
54 
55  GEMDeadStripsObj = new GEMDeadStrips();
56 
57  maskSource = config.getParameter<std::string>("maskSource");
58 
59  if (maskSource == "File") {
60  edm::FileInPath fp = config.getParameter<edm::FileInPath>("maskvecfile");
61  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
62  if ( !inputFile ) {
63  std::cerr << "Masked Strips File cannot not be opened" << std::endl;
64  exit(1);
65  }
66  while ( inputFile.good() ) {
67  GEMMaskedStrips::MaskItem Item;
68  inputFile >> Item.rawId >> Item.strip;
69  if ( inputFile.good() ) MaskVec.push_back(Item);
70  }
71  inputFile.close();
72  }
73 
74  deadSource = config.getParameter<std::string>("deadSource");
75 
76  if (deadSource == "File") {
77  edm::FileInPath fp = config.getParameter<edm::FileInPath>("deadvecfile");
78  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
79  if ( !inputFile ) {
80  std::cerr << "Dead Strips File cannot not be opened" << std::endl;
81  exit(1);
82  }
83  while ( inputFile.good() ) {
84  GEMDeadStrips::DeadItem Item;
85  inputFile >> Item.rawId >> Item.strip;
86  if ( inputFile.good() ) DeadVec.push_back(Item);
87  }
88  inputFile.close();
89  }
90  */
91 }
T getParameter(std::string const &) const
edm::InputTag theGEMDigiLabel
GEMRecHitBaseAlgo * theAlgo
T get(const Candidate &c)
Definition: component.h:55
GEMRecHitProducer::~GEMRecHitProducer ( )
virtual

Destructor.

Definition at line 94 of file GEMRecHitProducer.cc.

94  {
95 
96  delete theAlgo;
97  // delete GEMMaskedStripsObj;
98  // delete GEMDeadStripsObj;
99 
100 }
GEMRecHitBaseAlgo * theAlgo

Member Function Documentation

void GEMRecHitProducer::beginRun ( const edm::Run r,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 104 of file GEMRecHitProducer.cc.

104  {
105 
106  // Getting the masked-strip information
107  /*
108  if ( maskSource == "EventSetup" ) {
109  edm::ESHandle<GEMMaskedStrips> readoutMaskedStrips;
110  setup.get<GEMMaskedStripsRcd>().get(readoutMaskedStrips);
111  const GEMMaskedStrips* tmp_obj = readoutMaskedStrips.product();
112  GEMMaskedStripsObj->MaskVec = tmp_obj->MaskVec;
113  delete tmp_obj;
114  }
115  else if ( maskSource == "File" ) {
116  std::vector<GEMMaskedStrips::MaskItem>::iterator posVec;
117  for ( posVec = MaskVec.begin(); posVec != MaskVec.end(); ++posVec ) {
118  GEMMaskedStrips::MaskItem Item;
119  Item.rawId = (*posVec).rawId;
120  Item.strip = (*posVec).strip;
121  GEMMaskedStripsObj->MaskVec.push_back(Item);
122  }
123  }
124  */
125  // Getting the dead-strip information
126  /*
127  if ( deadSource == "EventSetup" ) {
128  edm::ESHandle<GEMDeadStrips> readoutDeadStrips;
129  setup.get<GEMDeadStripsRcd>().get(readoutDeadStrips);
130  const GEMDeadStrips* tmp_obj = readoutDeadStrips.product();
131  GEMDeadStripsObj->DeadVec = tmp_obj->DeadVec;
132  delete tmp_obj;
133  }
134  else if ( deadSource == "File" ) {
135  std::vector<GEMDeadStrips::DeadItem>::iterator posVec;
136  for ( posVec = DeadVec.begin(); posVec != DeadVec.end(); ++posVec ) {
137  GEMDeadStrips::DeadItem Item;
138  Item.rawId = (*posVec).rawId;
139  Item.strip = (*posVec).strip;
140  GEMDeadStripsObj->DeadVec.push_back(Item);
141  }
142  }
143  */
144 }
void GEMRecHitProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

The method which produces the rechits.

Implements edm::EDProducer.

Definition at line 148 of file GEMRecHitProducer.cc.

References edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::end(), edm::EventSetup::get(), and edm::OwnVector< T, P >::size().

148  {
149 
150  // Get the GEM Geometry
151 
152  ESHandle<GEMGeometry> gemGeom;
153  setup.get<MuonGeometryRecord>().get(gemGeom);
154 
155  // Get the digis from the event
156 
158  event.getByLabel(theGEMDigiLabel,digis);
159 
160  // Pass the EventSetup to the algo
161 
162  theAlgo->setES(setup);
163 
164  // Create the pointer to the collection which will store the rechits
165 
166  auto_ptr<GEMRecHitCollection> recHitCollection(new GEMRecHitCollection());
167 
168  // Iterate through all digi collections ordered by LayerId
169 
171  for (gemdgIt = digis->begin(); gemdgIt != digis->end();
172  ++gemdgIt){
173 
174  // The layerId
175  const GEMDetId& gemId = (*gemdgIt).first;
176 
177  // Get the GeomDet from the setup
178  const GEMEtaPartition* roll = gemGeom->etaPartition(gemId);
179 
180  // Get the iterators over the digis associated with this LayerId
181  const GEMDigiCollection::Range& range = (*gemdgIt).second;
182 
183 
184  // Getting the roll mask, that includes dead strips, for the given GEMDet
185  EtaPartitionMask mask;
186  /*
187  int rawId = gemId.rawId();
188  int Size = GEMMaskedStripsObj->MaskVec.size();
189  for (int i = 0; i < Size; i++ ) {
190  if ( GEMMaskedStripsObj->MaskVec[i].rawId == rawId ) {
191  int bit = GEMMaskedStripsObj->MaskVec[i].strip;
192  mask.set(bit-1);
193  }
194  }
195 
196  Size = GEMDeadStripsObj->DeadVec.size();
197  for (int i = 0; i < Size; i++ ) {
198  if ( GEMDeadStripsObj->DeadVec[i].rawId == rawId ) {
199  int bit = GEMDeadStripsObj->DeadVec[i].strip;
200  mask.set(bit-1);
201  }
202  }
203  */
204  // Call the reconstruction algorithm
205 
206  OwnVector<GEMRecHit> recHits =
207  theAlgo->reconstruct(*roll, gemId, range, mask);
208 
209  if(recHits.size() > 0) //FIXME: is it really needed?
210  recHitCollection->put(gemId, recHits.begin(), recHits.end());
211  }
212 
213  event.put(recHitCollection);
214 
215 }
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the algo at each event.
size_type size() const
Definition: OwnVector.h:247
virtual edm::OwnVector< GEMRecHit > reconstruct(const GEMEtaPartition &roll, const GEMDetId &gemId, const GEMDigiCollection::Range &digiRange, const EtaPartitionMask &mask)
Build all hits in the range associated to the gemId, at the 1st step.
iterator begin()
Definition: OwnVector.h:227
std::bitset< maskSIZE > EtaPartitionMask
edm::RangeMap< GEMDetId, edm::OwnVector< GEMRecHit, edm::ClonePolicy< GEMRecHit > >, edm::ClonePolicy< GEMRecHit > > GEMRecHitCollection
iterator end()
Definition: OwnVector.h:232
const T & get() const
Definition: EventSetup.h:55
edm::InputTag theGEMDigiLabel
GEMRecHitBaseAlgo * theAlgo
std::pair< const_iterator, const_iterator > Range

Member Data Documentation

GEMRecHitBaseAlgo* GEMRecHitProducer::theAlgo
private

Definition at line 60 of file GEMRecHitProducer.h.

edm::InputTag GEMRecHitProducer::theGEMDigiLabel
private

Definition at line 57 of file GEMRecHitProducer.h.