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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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.

Date:
2013/06/10 15:53:23
Revision:
1.2
Author
M. Maggim – INFN Bari

Definition at line 41 of file GEMRecHitProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 39 of file GEMRecHitProducer.cc.

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

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

Destructor.

Definition at line 96 of file GEMRecHitProducer.cc.

96  {
97 
98  delete theAlgo;
99  // delete GEMMaskedStripsObj;
100  // delete GEMDeadStripsObj;
101 
102 }
GEMRecHitBaseAlgo * theAlgo

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 106 of file GEMRecHitProducer.cc.

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

The method which produces the rechits.

Implements edm::EDProducer.

Definition at line 150 of file GEMRecHitProducer.cc.

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

150  {
151 
152  // Get the GEM Geometry
153 
154  ESHandle<GEMGeometry> gemGeom;
155  setup.get<MuonGeometryRecord>().get(gemGeom);
156 
157  // Get the digis from the event
158 
160  event.getByLabel(theGEMDigiLabel,digis);
161 
162  // Pass the EventSetup to the algo
163 
164  theAlgo->setES(setup);
165 
166  // Create the pointer to the collection which will store the rechits
167 
168  auto_ptr<GEMRecHitCollection> recHitCollection(new GEMRecHitCollection());
169 
170  // Iterate through all digi collections ordered by LayerId
171 
173  for (gemdgIt = digis->begin(); gemdgIt != digis->end();
174  ++gemdgIt){
175 
176  // The layerId
177  const GEMDetId& gemId = (*gemdgIt).first;
178 
179  // Get the GeomDet from the setup
180  const GEMEtaPartition* roll = gemGeom->etaPartition(gemId);
181 
182  // Get the iterators over the digis associated with this LayerId
183  const GEMDigiCollection::Range& range = (*gemdgIt).second;
184 
185 
186  // Getting the roll mask, that includes dead strips, for the given GEMDet
187  EtaPartitionMask mask;
188  /*
189  int rawId = gemId.rawId();
190  int Size = GEMMaskedStripsObj->MaskVec.size();
191  for (int i = 0; i < Size; i++ ) {
192  if ( GEMMaskedStripsObj->MaskVec[i].rawId == rawId ) {
193  int bit = GEMMaskedStripsObj->MaskVec[i].strip;
194  mask.set(bit-1);
195  }
196  }
197 
198  Size = GEMDeadStripsObj->DeadVec.size();
199  for (int i = 0; i < Size; i++ ) {
200  if ( GEMDeadStripsObj->DeadVec[i].rawId == rawId ) {
201  int bit = GEMDeadStripsObj->DeadVec[i].strip;
202  mask.set(bit-1);
203  }
204  }
205  */
206  // Call the reconstruction algorithm
207 
208  OwnVector<GEMRecHit> recHits =
209  theAlgo->reconstruct(*roll, gemId, range, mask);
210 
211  if(recHits.size() > 0) //FIXME: is it really needed?
212  recHitCollection->put(gemId, recHits.begin(), recHits.end());
213  }
214 
215  event.put(recHitCollection);
216 
217 }
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 62 of file GEMRecHitProducer.h.

edm::InputTag GEMRecHitProducer::theGEMDigiLabel
private

Definition at line 59 of file GEMRecHitProducer.h.