CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GEMRecHitProducer Class Reference

#include <GEMRecHitProducer.h>

Inheritance diagram for GEMRecHitProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 GEMRecHitProducer (const edm::ParameterSet &config)
 Constructor. More...
 
void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the rechits. More...
 
 ~GEMRecHitProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

GEMRecHitBaseAlgotheAlgo
 
edm::EDGetTokenT< GEMDigiCollectiontheGEMDigiToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Module for GEMRecHit production.

Author
M. Maggim – INFN Bari

Definition at line 40 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  theGEMDigiToken = consumes<GEMDigiCollection>(config.getParameter<edm::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
GEMRecHitBaseAlgo * theAlgo
T get(const Candidate &c)
Definition: component.h:55
edm::EDGetTokenT< GEMDigiCollection > theGEMDigiToken
GEMRecHitProducer::~GEMRecHitProducer ( )
override

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 
)
override

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 
)
override

The method which produces the rechits.

Definition at line 148 of file GEMRecHitProducer.cc.

References edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::empty(), edm::OwnVector< T, P >::end(), GEMGeometry::etaPartition(), edm::EventSetup::get(), RecoTauDiscriminantConfiguration::mask, and eostools::move().

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.getByToken(theGEMDigiToken,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 recHitCollection = std::make_unique<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
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.empty()) //FIXME: is it really needed?
210  recHitCollection->put(gemId, recHits.begin(), recHits.end());
211  }
212 
213  event.put(std::move(recHitCollection));
214 
215 }
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the algo at each event.
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.
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:99
iterator begin()
Definition: OwnVector.h:244
bool empty() const
Definition: OwnVector.h:269
std::bitset< maskSIZE > EtaPartitionMask
iterator end()
Definition: OwnVector.h:249
T get() const
Definition: EventSetup.h:63
GEMRecHitBaseAlgo * theAlgo
std::pair< const_iterator, const_iterator > Range
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< GEMDigiCollection > theGEMDigiToken

Member Data Documentation

GEMRecHitBaseAlgo* GEMRecHitProducer::theAlgo
private

Definition at line 61 of file GEMRecHitProducer.h.

edm::EDGetTokenT<GEMDigiCollection> GEMRecHitProducer::theGEMDigiToken
private

Definition at line 58 of file GEMRecHitProducer.h.