CMS 3D CMS Logo

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

#include <RPCSeedLayerFinder.h>

Public Member Functions

void configure (const edm::ParameterSet &iConfig)
 
void fill ()
 
 RPCSeedLayerFinder ()
 
void setInput (MuonRecHitContainer(&recHitsRPC)[12])
 
void setOutput (RPCSeedrecHitFinder *Ref, RPCCosmicSeedrecHitFinder *CosmicRef)
 
void unsetInput ()
 
 ~RPCSeedLayerFinder ()
 

Private Types

typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
 
typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
 
typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
 
typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
 

Private Member Functions

bool checkConstrain ()
 
void fillCosmicLayers ()
 
void fillLayers ()
 
void SpecialLayers (int last, unsigned int NumberofLayers, int type)
 

Private Attributes

std::vector< unsigned int > constrainedLayersinBarrel
 
bool isConfigured
 
bool isCosmic
 
bool isInputset
 
bool isMixBarrelwithEndcap
 
bool isOutputset
 
bool isSpecialLayers
 
std::vector< unsigned int > LayersinBarrel
 
std::vector< unsigned int > LayersinEndcap
 
std::vector< unsigned int > LayersinRPC
 
std::vector< unsigned int > RangeofLayersinBarrel
 
std::vector< unsigned int > RangeofLayersinEndcap
 
unsigned int recHitsinLayers [12]
 
RPCCosmicSeedrecHitFinderRPCCosmicrecHitFinderRef
 
RPCSeedrecHitFinderRPCrecHitFinderRef
 

Detailed Description

Author
Haiyun.Teng - Peking University

Definition at line 28 of file RPCSeedLayerFinder.h.

Member Typedef Documentation

◆ ConstMuonRecHitContainer

Definition at line 32 of file RPCSeedLayerFinder.h.

◆ ConstMuonRecHitPointer

Definition at line 30 of file RPCSeedLayerFinder.h.

◆ MuonRecHitContainer

Definition at line 31 of file RPCSeedLayerFinder.h.

◆ MuonRecHitPointer

Definition at line 29 of file RPCSeedLayerFinder.h.

Constructor & Destructor Documentation

◆ RPCSeedLayerFinder()

RPCSeedLayerFinder::RPCSeedLayerFinder ( )

Definition at line 11 of file RPCSeedLayerFinder.cc.

11  {
12  // Initiate the member
13  LayersinRPC.clear();
14  isConfigured = false;
15  isInputset = false;
16  isOutputset = false;
17 }
std::vector< unsigned int > LayersinRPC

◆ ~RPCSeedLayerFinder()

RPCSeedLayerFinder::~RPCSeedLayerFinder ( )

Definition at line 19 of file RPCSeedLayerFinder.cc.

19 {}

Member Function Documentation

◆ checkConstrain()

bool RPCSeedLayerFinder::checkConstrain ( )
private

Definition at line 354 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, and mps_fire::i.

354  {
355  bool pass = true;
356  std::vector<unsigned int> fitConstrain = constrainedLayersinBarrel;
357  for (unsigned int i = 0; i < LayersinRPC.size(); i++)
358  fitConstrain[LayersinRPC[i]] = 0;
359  for (unsigned int i = 0; i < BarrelLayerNumber; i++)
360  if (fitConstrain[i] != 0)
361  pass = false;
362  return pass;
363 }
std::vector< unsigned int > constrainedLayersinBarrel
std::vector< unsigned int > LayersinRPC
#define BarrelLayerNumber

◆ configure()

void RPCSeedLayerFinder::configure ( const edm::ParameterSet iConfig)

Definition at line 21 of file RPCSeedLayerFinder.cc.

References edm::ParameterSet::getParameter().

Referenced by RPCSeedGenerator::RPCSeedGenerator().

21  {
22  // Set the configuration
23  isCosmic = iConfig.getParameter<bool>("isCosmic");
24  isMixBarrelwithEndcap = iConfig.getParameter<bool>("isMixBarrelwithEndcap");
25  RangeofLayersinBarrel = iConfig.getParameter<std::vector<unsigned int> >("RangeofLayersinBarrel");
26  RangeofLayersinEndcap = iConfig.getParameter<std::vector<unsigned int> >("RangeofLayersinEndcap");
27  isSpecialLayers = iConfig.getParameter<bool>("isSpecialLayers");
28  LayersinBarrel = iConfig.getParameter<std::vector<unsigned int> >("LayersinBarrel");
29  LayersinEndcap = iConfig.getParameter<std::vector<unsigned int> >("LayersinEndcap");
30  constrainedLayersinBarrel = iConfig.getParameter<std::vector<unsigned int> >("constrainedLayersinBarrel");
31 
32  // Set the signal open
33  isConfigured = true;
34 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< unsigned int > LayersinEndcap
std::vector< unsigned int > LayersinBarrel
std::vector< unsigned int > RangeofLayersinBarrel
std::vector< unsigned int > RangeofLayersinEndcap
std::vector< unsigned int > constrainedLayersinBarrel

◆ fill()

void RPCSeedLayerFinder::fill ( void  )

Definition at line 52 of file RPCSeedLayerFinder.cc.

References gather_cfg::cout.

Referenced by RPCSeedGenerator::produce().

52  {
53  // Check if already configured
54  if (isConfigured == false || isInputset == false || isOutputset == false) {
55  cout << "RPCSeedLayerFinder needs to be configured and set IO before running RPCSeedLayerFinder::fillLayers()"
56  << endl;
57  return;
58  }
59 
60  // Clear the vector LayersinRPC
61  LayersinRPC.clear();
62 
63  // Now fill the Layers
64  if (isCosmic == true) {
65  if (RPCCosmicrecHitFinderRef != nullptr)
67  else
68  cout << "RPCCosmicrecHitFinderRef not set" << endl;
69  } else {
70  if (RPCrecHitFinderRef != nullptr)
71  fillLayers();
72  else
73  cout << "RPCrecHitFinderRef not set" << endl;
74  }
75 }
RPCCosmicSeedrecHitFinder * RPCCosmicrecHitFinderRef
RPCSeedrecHitFinder * RPCrecHitFinderRef
std::vector< unsigned int > LayersinRPC

◆ fillCosmicLayers()

void RPCSeedLayerFinder::fillCosmicLayers ( )
private

Definition at line 185 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, mps_fire::i, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

185  {
186  // For cosmic only handle the SpecialLayers case
187  if (isSpecialLayers == true && isMixBarrelwithEndcap == false) {
188  // Fill barrel layer for seed
189  unsigned int i = 0;
190  LayersinRPC.clear();
191  for (std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
192  if ((*it) != 0 && i < BarrelLayerNumber)
193  if (recHitsinLayers[i] != 0)
194  LayersinRPC.push_back(i);
195  }
196  if (!LayersinRPC.empty()) {
197  // Initiate and call recHit Finder
200  }
201  LayersinRPC.clear();
202 
203  // Fill -Z and +Z endcap layer
204 
205  // Fill endcap- layer for seed
207  LayersinRPC.clear();
208  for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
209  if ((*it) != 0 && i < (BarrelLayerNumber + EachEndcapLayerNumber))
210  if (recHitsinLayers[i] != 0)
211  LayersinRPC.push_back(i);
212  }
213  if (!LayersinRPC.empty()) {
214  // Initiate and call recHit Finder
217  }
218  LayersinRPC.clear();
219 
220  //Fill endcap+ layer for seed
222  LayersinRPC.clear();
223  for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
224  if ((*it) != 0 && i >= (BarrelLayerNumber + EachEndcapLayerNumber) &&
226  if (recHitsinLayers[i] != 0)
227  LayersinRPC.push_back(i);
228  }
229  if (!LayersinRPC.empty()) {
230  // Initiate and call recHit Finder
233  }
234  LayersinRPC.clear();
235  }
236 
237  if (isSpecialLayers == true && isMixBarrelwithEndcap == true) {
238  // Fill all
239  unsigned int i = 0;
240  LayersinRPC.clear();
241  for (std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
242  if ((*it) != 0 && i < BarrelLayerNumber)
243  if (recHitsinLayers[i] != 0)
244  LayersinRPC.push_back(i);
245  }
247  for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
248  if ((*it) != 0 && i < (BarrelLayerNumber + EachEndcapLayerNumber * 2))
249  if (recHitsinLayers[i] != 0)
250  LayersinRPC.push_back(i);
251  }
252 
253  if (!LayersinRPC.empty()) {
254  // Initiate and call recHit Finder
257  }
258  LayersinRPC.clear();
259  }
260 
261  if (isSpecialLayers == false) {
262  cout << "Not ready for not SpecialLayers for Cosmic case" << endl;
263  LayersinRPC.clear();
264  }
265 }
std::vector< unsigned int > LayersinEndcap
std::vector< unsigned int > LayersinBarrel
RPCCosmicSeedrecHitFinder * RPCCosmicrecHitFinderRef
void setLayers(const std::vector< unsigned int > &Layers)
#define EachEndcapLayerNumber
std::vector< unsigned int > LayersinRPC
#define BarrelLayerNumber
unsigned int recHitsinLayers[12]

◆ fillLayers()

void RPCSeedLayerFinder::fillLayers ( )
private

Definition at line 77 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, mps_fire::i, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

77  {
78  if (isSpecialLayers == false && isMixBarrelwithEndcap == false) {
79  for (std::vector<unsigned int>::iterator NumberofLayersinBarrel = RangeofLayersinBarrel.begin();
80  NumberofLayersinBarrel != RangeofLayersinBarrel.end();
81  NumberofLayersinBarrel++) {
82  // find N layers out of 6 Barrel Layers to fill to SeedinRPC
83  unsigned int NumberofLayers = *NumberofLayersinBarrel;
84  if (NumberofLayers < 1 || NumberofLayers > BarrelLayerNumber)
85  continue;
86  int type = 0; // type=0 for barrel
87  LayersinRPC.clear();
88  SpecialLayers(-1, NumberofLayers, type);
89  LayersinRPC.clear();
90  }
91 
92  for (std::vector<unsigned int>::iterator NumberofLayersinEndcap = RangeofLayersinEndcap.begin();
93  NumberofLayersinEndcap != RangeofLayersinEndcap.end();
94  NumberofLayersinEndcap++) {
95  unsigned int NumberofLayers = *NumberofLayersinEndcap;
96  if (NumberofLayers < 1 || NumberofLayers > EachEndcapLayerNumber)
97  continue;
98  int type = 1; // type=1 for endcap
99  // for -Z layers
100  LayersinRPC.clear();
101  SpecialLayers(BarrelLayerNumber - 1, NumberofLayers, type);
102  LayersinRPC.clear();
103  //for +Z layers
104  LayersinRPC.clear();
106  LayersinRPC.clear();
107  }
108  }
109 
110  if (isSpecialLayers == true && isMixBarrelwithEndcap == false) {
111  // Fill barrel layer for seed
112  bool EnoughforBarrel = true;
113  unsigned int i = 0;
114  LayersinRPC.clear();
115  for (std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
116  if ((*it) != 0 && i < BarrelLayerNumber) {
117  if (recHitsinLayers[i] != 0)
118  LayersinRPC.push_back(i);
119  else {
120  cout << "Not recHits in special Barrel layer " << i << endl;
121  EnoughforBarrel = false;
122  }
123  }
124  }
125  if (EnoughforBarrel && (!LayersinRPC.empty())) {
126  // Initiate and call recHit Finder
129  }
130  LayersinRPC.clear();
131 
132  // Fill -Z and +Z endcap layer
133  bool EnoughforEndcap = true;
134 
135  // Fill endcap- layer for seed
137  EnoughforEndcap = true;
138  LayersinRPC.clear();
139  for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
140  if ((*it) != 0 && i < (BarrelLayerNumber + EachEndcapLayerNumber)) {
141  if (recHitsinLayers[i] != 0)
142  LayersinRPC.push_back(i);
143  else {
144  cout << "Not recHits in special Endcap " << (i - BarrelLayerNumber) << endl;
145  EnoughforEndcap = false;
146  }
147  }
148  }
149  if (EnoughforEndcap && (!LayersinRPC.empty())) {
150  // Initiate and call recHit Finder
153  }
154  LayersinRPC.clear();
155 
156  //Fill endcap+ layer for seed
158  EnoughforEndcap = true;
159  LayersinRPC.clear();
160  for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
161  if ((*it) != 0 && i >= (BarrelLayerNumber + EachEndcapLayerNumber) &&
163  if (recHitsinLayers[i] != 0)
164  LayersinRPC.push_back(i);
165  else {
166  cout << "Not recHits in special Endcap " << i << endl;
167  EnoughforEndcap = false;
168  }
169  }
170  }
171  if (EnoughforEndcap && (!LayersinRPC.empty())) {
172  // Initiate and call recHit Finder
175  }
176  LayersinRPC.clear();
177  }
178 
179  if (isMixBarrelwithEndcap == true) {
180  cout << " Mix is not ready for non-cosmic case" << endl;
181  LayersinRPC.clear();
182  }
183 }
std::vector< unsigned int > LayersinEndcap
std::vector< unsigned int > LayersinBarrel
std::vector< unsigned int > RangeofLayersinBarrel
std::vector< unsigned int > RangeofLayersinEndcap
RPCSeedrecHitFinder * RPCrecHitFinderRef
#define EachEndcapLayerNumber
std::vector< unsigned int > LayersinRPC
#define BarrelLayerNumber
unsigned int recHitsinLayers[12]
void setLayers(const std::vector< unsigned int > &Layers)
void SpecialLayers(int last, unsigned int NumberofLayers, int type)

◆ setInput()

void RPCSeedLayerFinder::setInput ( MuonRecHitContainer(&)  recHitsRPC[12])

Definition at line 36 of file RPCSeedLayerFinder.cc.

References mps_fire::i, and RPCLayerNumber.

Referenced by RPCSeedGenerator::produce().

36  {
37  for (unsigned int i = 0; i < RPCLayerNumber; i++)
38  recHitsinLayers[i] = recHitsRPC[i].size();
39 
40  // Set the signal open
41  isInputset = true;
42 }
size
Write out results.
#define RPCLayerNumber
unsigned int recHitsinLayers[12]

◆ setOutput()

void RPCSeedLayerFinder::setOutput ( RPCSeedrecHitFinder Ref = nullptr,
RPCCosmicSeedrecHitFinder CosmicRef = nullptr 
)

Definition at line 46 of file RPCSeedLayerFinder.cc.

Referenced by RPCSeedGenerator::beginStream().

46  {
48  RPCCosmicrecHitFinderRef = CosmicRef;
49  isOutputset = true;
50 }
RPCCosmicSeedrecHitFinder * RPCCosmicrecHitFinderRef
RPCSeedrecHitFinder * RPCrecHitFinderRef

◆ SpecialLayers()

void RPCSeedLayerFinder::SpecialLayers ( int  last,
unsigned int  NumberofLayers,
int  type 
)
private

Definition at line 267 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, mps_fire::i, dqmdumpme::k, and dqmdumpme::last.

267  {
268  // check type, 0=barrel, 1=endcap, 2=mix
269 
270  // barrel has 6 layers
271  if (type == 0) {
272  if (NumberofLayers > BarrelLayerNumber) {
273  cout << "NumberofLayers larger than max layers in barrel" << endl;
274  return;
275  }
276  for (unsigned int i = (last + 1); i <= (BarrelLayerNumber - NumberofLayers + LayersinRPC.size()); i++) {
277  if (recHitsinLayers[i] != 0) {
278  LayersinRPC.push_back(i);
279  last = i;
280  if (LayersinRPC.size() < NumberofLayers)
281  SpecialLayers(last, NumberofLayers, type);
282  else {
283  if (checkConstrain()) {
284  cout << "Find special barrel layers: ";
285  for (unsigned int k = 0; k < NumberofLayers; k++)
286  cout << LayersinRPC[k] << " ";
287  cout << endl;
288  // Initiate and call recHit Finder
291  } else
292  cout << "The layers don't contain all layers in constrain" << endl;
293  }
294  LayersinRPC.pop_back();
295  }
296  }
297  }
298 
299  // endcap has 3 layers for each -Z and +Z
300  if (type == 1) {
301  if (NumberofLayers > EachEndcapLayerNumber) {
302  cout << "NumberofLayers larger than max layers in endcap" << endl;
303  return;
304  }
306  (last == (BarrelLayerNumber + EachEndcapLayerNumber - 1) && !LayersinRPC.empty())) {
307  // For -Z case
308  for (unsigned int i = (last + 1);
309  i <= (BarrelLayerNumber + EachEndcapLayerNumber - NumberofLayers + LayersinRPC.size());
310  i++) {
311  if (recHitsinLayers[i] != 0) {
312  LayersinRPC.push_back(i);
313  last = i;
314  if (LayersinRPC.size() < NumberofLayers)
315  SpecialLayers(last, NumberofLayers, type);
316  else {
317  cout << "Find special -Z endcap layers: ";
318  for (unsigned int k = 0; k < NumberofLayers; k++)
319  cout << LayersinRPC[k] << " ";
320  cout << endl;
321  // Initiate and call recHit Finder
324  }
325  LayersinRPC.pop_back();
326  }
327  }
328  } else {
329  // For +Z case
330  for (unsigned int i = (last + 1);
331  i <= (BarrelLayerNumber + EachEndcapLayerNumber * 2 - NumberofLayers + LayersinRPC.size());
332  i++) {
333  if (recHitsinLayers[i] != 0) {
334  LayersinRPC.push_back(i);
335  last = i;
336  if (LayersinRPC.size() < NumberofLayers)
337  SpecialLayers(last, NumberofLayers, type);
338  else {
339  cout << "Find special +Z endcap layers: ";
340  for (unsigned int k = 0; k < NumberofLayers; k++)
341  cout << LayersinRPC[k] << " ";
342  cout << endl;
343  // Initiate and call recHit Finder
346  }
347  LayersinRPC.pop_back();
348  }
349  }
350  }
351  }
352 }
RPCSeedrecHitFinder * RPCrecHitFinderRef
#define EachEndcapLayerNumber
std::vector< unsigned int > LayersinRPC
#define BarrelLayerNumber
unsigned int recHitsinLayers[12]
void setLayers(const std::vector< unsigned int > &Layers)
void SpecialLayers(int last, unsigned int NumberofLayers, int type)

◆ unsetInput()

void RPCSeedLayerFinder::unsetInput ( )

Definition at line 44 of file RPCSeedLayerFinder.cc.

Referenced by RPCSeedGenerator::produce().

44 { isInputset = false; }

Member Data Documentation

◆ constrainedLayersinBarrel

std::vector<unsigned int> RPCSeedLayerFinder::constrainedLayersinBarrel
private

Definition at line 63 of file RPCSeedLayerFinder.h.

◆ isConfigured

bool RPCSeedLayerFinder::isConfigured
private

Definition at line 65 of file RPCSeedLayerFinder.h.

◆ isCosmic

bool RPCSeedLayerFinder::isCosmic
private

Definition at line 56 of file RPCSeedLayerFinder.h.

◆ isInputset

bool RPCSeedLayerFinder::isInputset
private

Definition at line 66 of file RPCSeedLayerFinder.h.

◆ isMixBarrelwithEndcap

bool RPCSeedLayerFinder::isMixBarrelwithEndcap
private

Definition at line 57 of file RPCSeedLayerFinder.h.

◆ isOutputset

bool RPCSeedLayerFinder::isOutputset
private

Definition at line 67 of file RPCSeedLayerFinder.h.

◆ isSpecialLayers

bool RPCSeedLayerFinder::isSpecialLayers
private

Definition at line 60 of file RPCSeedLayerFinder.h.

◆ LayersinBarrel

std::vector<unsigned int> RPCSeedLayerFinder::LayersinBarrel
private

Definition at line 62 of file RPCSeedLayerFinder.h.

◆ LayersinEndcap

std::vector<unsigned int> RPCSeedLayerFinder::LayersinEndcap
private

Definition at line 61 of file RPCSeedLayerFinder.h.

◆ LayersinRPC

std::vector<unsigned int> RPCSeedLayerFinder::LayersinRPC
private

Definition at line 69 of file RPCSeedLayerFinder.h.

◆ RangeofLayersinBarrel

std::vector<unsigned int> RPCSeedLayerFinder::RangeofLayersinBarrel
private

Definition at line 58 of file RPCSeedLayerFinder.h.

◆ RangeofLayersinEndcap

std::vector<unsigned int> RPCSeedLayerFinder::RangeofLayersinEndcap
private

Definition at line 59 of file RPCSeedLayerFinder.h.

◆ recHitsinLayers

unsigned int RPCSeedLayerFinder::recHitsinLayers[12]
private

Definition at line 71 of file RPCSeedLayerFinder.h.

◆ RPCCosmicrecHitFinderRef

RPCCosmicSeedrecHitFinder* RPCSeedLayerFinder::RPCCosmicrecHitFinderRef
private

Definition at line 54 of file RPCSeedLayerFinder.h.

◆ RPCrecHitFinderRef

RPCSeedrecHitFinder* RPCSeedLayerFinder::RPCrecHitFinderRef
private

Definition at line 53 of file RPCSeedLayerFinder.h.