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 31 of file RPCSeedLayerFinder.h.

Member Typedef Documentation

Definition at line 36 of file RPCSeedLayerFinder.h.

Definition at line 34 of file RPCSeedLayerFinder.h.

Definition at line 35 of file RPCSeedLayerFinder.h.

Definition at line 33 of file RPCSeedLayerFinder.h.

Constructor & Destructor Documentation

RPCSeedLayerFinder::RPCSeedLayerFinder ( )

Definition at line 13 of file RPCSeedLayerFinder.cc.

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

Definition at line 22 of file RPCSeedLayerFinder.cc.

22  {
23 
24 }

Member Function Documentation

bool RPCSeedLayerFinder::checkConstrain ( )
private

Definition at line 363 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, and mps_fire::i.

363  {
364 
365  bool pass = true;
366  std::vector<unsigned int> fitConstrain = constrainedLayersinBarrel;
367  for(unsigned int i = 0; i < LayersinRPC.size(); i++)
368  fitConstrain[LayersinRPC[i]] = 0;
369  for(unsigned int i = 0; i < BarrelLayerNumber; i++)
370  if(fitConstrain[i] != 0)
371  pass = false;
372  return pass;
373 }
std::vector< unsigned int > constrainedLayersinBarrel
std::vector< unsigned int > LayersinRPC
#define BarrelLayerNumber
void RPCSeedLayerFinder::configure ( const edm::ParameterSet iConfig)

Definition at line 26 of file RPCSeedLayerFinder.cc.

References edm::ParameterSet::getParameter().

26  {
27 
28  // Set the configuration
29  isCosmic = iConfig.getParameter<bool>("isCosmic");
30  isMixBarrelwithEndcap = iConfig.getParameter<bool>("isMixBarrelwithEndcap");
31  RangeofLayersinBarrel = iConfig.getParameter< std::vector<unsigned int> >("RangeofLayersinBarrel");
32  RangeofLayersinEndcap = iConfig.getParameter< std::vector<unsigned int> >("RangeofLayersinEndcap");
33  isSpecialLayers = iConfig.getParameter<bool>("isSpecialLayers");
34  LayersinBarrel = iConfig.getParameter< std::vector<unsigned int> >("LayersinBarrel");
35  LayersinEndcap = iConfig.getParameter< std::vector<unsigned int> >("LayersinEndcap");
36  constrainedLayersinBarrel = iConfig.getParameter< std::vector<unsigned int> >("constrainedLayersinBarrel");
37 
38  // Set the signal open
39  isConfigured = true;
40 }
T getParameter(std::string const &) const
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
void RPCSeedLayerFinder::fill ( void  )

Definition at line 63 of file RPCSeedLayerFinder.cc.

References gather_cfg::cout.

63  {
64 
65  // Check if already configured
66  if(isConfigured == false || isInputset == false || isOutputset == false) {
67  cout << "RPCSeedLayerFinder needs to be configured and set IO before running RPCSeedLayerFinder::fillLayers()" << endl;
68  return;
69  }
70 
71  // Clear the vector LayersinRPC
72  LayersinRPC.clear();
73 
74  // Now fill the Layers
75  if(isCosmic == true) {
76  if(RPCCosmicrecHitFinderRef != nullptr)
78  else
79  cout << "RPCCosmicrecHitFinderRef not set" << endl;
80  }
81  else {
82  if(RPCrecHitFinderRef != nullptr)
83  fillLayers();
84  else
85  cout << "RPCrecHitFinderRef not set" << endl;
86  }
87 }
RPCCosmicSeedrecHitFinder * RPCCosmicrecHitFinderRef
RPCSeedrecHitFinder * RPCrecHitFinderRef
std::vector< unsigned int > LayersinRPC
void RPCSeedLayerFinder::fillCosmicLayers ( )
private

Definition at line 193 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, and mps_fire::i.

193  {
194 
195  // For cosmic only handle the SpecialLayers case
196  if(isSpecialLayers == true && isMixBarrelwithEndcap == false) {
197 
198  // Fill barrel layer for seed
199  unsigned int i = 0;
200  LayersinRPC.clear();
201  for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
202  if((*it) != 0 && i < BarrelLayerNumber)
203  if(recHitsinLayers[i] != 0)
204  LayersinRPC.push_back(i);
205  }
206  if(!LayersinRPC.empty()) {
207  // Initiate and call recHit Finder
210  }
211  LayersinRPC.clear();
212 
213  // Fill -Z and +Z endcap layer
214 
215  // Fill endcap- layer for seed
216  i = BarrelLayerNumber;
217  LayersinRPC.clear();
218  for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
219  if((*it) != 0 && i < (BarrelLayerNumber+EachEndcapLayerNumber))
220  if(recHitsinLayers[i] != 0)
221  LayersinRPC.push_back(i);
222  }
223  if(!LayersinRPC.empty()) {
224  // Initiate and call recHit Finder
227  }
228  LayersinRPC.clear();
229 
230  //Fill endcap+ layer for seed
231  i = BarrelLayerNumber;
232  LayersinRPC.clear();
233  for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
235  if(recHitsinLayers[i] != 0)
236  LayersinRPC.push_back(i);
237  }
238  if(!LayersinRPC.empty()) {
239  // Initiate and call recHit Finder
242  }
243  LayersinRPC.clear();
244  }
245 
246  if(isSpecialLayers == true && isMixBarrelwithEndcap == true) {
247 
248  // Fill all
249  unsigned int i = 0;
250  LayersinRPC.clear();
251  for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
252  if((*it) != 0 && i < BarrelLayerNumber)
253  if(recHitsinLayers[i] != 0)
254  LayersinRPC.push_back(i);
255  }
256  i = BarrelLayerNumber;
257  for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
258  if((*it) != 0 && i < (BarrelLayerNumber+EachEndcapLayerNumber*2))
259  if(recHitsinLayers[i] != 0)
260  LayersinRPC.push_back(i);
261  }
262 
263  if(!LayersinRPC.empty()) {
264  // Initiate and call recHit Finder
267  }
268  LayersinRPC.clear();
269  }
270 
271  if(isSpecialLayers == false) {
272  cout << "Not ready for not SpecialLayers for Cosmic case" << endl;
273  LayersinRPC.clear();
274  }
275 }
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]
void RPCSeedLayerFinder::fillLayers ( )
private

Definition at line 89 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, and mps_fire::i.

89  {
90 
91  if(isSpecialLayers == false && isMixBarrelwithEndcap == false) {
92  for(std::vector<unsigned int>::iterator NumberofLayersinBarrel = RangeofLayersinBarrel.begin(); NumberofLayersinBarrel != RangeofLayersinBarrel.end(); NumberofLayersinBarrel++) {
93  // find N layers out of 6 Barrel Layers to fill to SeedinRPC
94  unsigned int NumberofLayers = *NumberofLayersinBarrel;
95  if(NumberofLayers < 1 || NumberofLayers > BarrelLayerNumber)
96  continue;
97  int type = 0; // type=0 for barrel
98  LayersinRPC.clear();
99  SpecialLayers(-1, NumberofLayers, type);
100  LayersinRPC.clear();
101  }
102 
103  for(std::vector<unsigned int>::iterator NumberofLayersinEndcap = RangeofLayersinEndcap.begin(); NumberofLayersinEndcap != RangeofLayersinEndcap.end(); NumberofLayersinEndcap++) {
104  unsigned int NumberofLayers = *NumberofLayersinEndcap;
105  if(NumberofLayers < 1 || NumberofLayers > EachEndcapLayerNumber)
106  continue;
107  int type = 1; // type=1 for endcap
108  // for -Z layers
109  LayersinRPC.clear();
110  SpecialLayers(BarrelLayerNumber-1, NumberofLayers, type);
111  LayersinRPC.clear();
112  //for +Z layers
113  LayersinRPC.clear();
114  SpecialLayers(BarrelLayerNumber+EachEndcapLayerNumber-1, NumberofLayers, type);
115  LayersinRPC.clear();
116  }
117  }
118 
119  if(isSpecialLayers == true && isMixBarrelwithEndcap == false) {
120  // Fill barrel layer for seed
121  bool EnoughforBarrel = true;
122  unsigned int i = 0;
123  LayersinRPC.clear();
124  for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
125  if((*it) != 0 && i < BarrelLayerNumber) {
126  if(recHitsinLayers[i] != 0)
127  LayersinRPC.push_back(i);
128  else {
129  cout << "Not recHits in special Barrel layer " << i << endl;
130  EnoughforBarrel = false;
131  }
132  }
133  }
134  if(EnoughforBarrel && (!LayersinRPC.empty())) {
135  // Initiate and call recHit Finder
138  }
139  LayersinRPC.clear();
140 
141  // Fill -Z and +Z endcap layer
142  bool EnoughforEndcap = true;
143 
144  // Fill endcap- layer for seed
145  i = BarrelLayerNumber;
146  EnoughforEndcap = true;
147  LayersinRPC.clear();
148  for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
149  if((*it) != 0 && i < (BarrelLayerNumber+EachEndcapLayerNumber)) {
150  if(recHitsinLayers[i] != 0)
151  LayersinRPC.push_back(i);
152  else {
153  cout << "Not recHits in special Endcap " << (i - BarrelLayerNumber) << endl;
154  EnoughforEndcap = false;
155  }
156  }
157  }
158  if(EnoughforEndcap && (!LayersinRPC.empty())) {
159  // Initiate and call recHit Finder
162  }
163  LayersinRPC.clear();
164 
165  //Fill endcap+ layer for seed
166  i = BarrelLayerNumber;
167  EnoughforEndcap = true;
168  LayersinRPC.clear();
169  for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
170  if((*it) != 0 && i >= (BarrelLayerNumber+EachEndcapLayerNumber) && i < (BarrelLayerNumber+EachEndcapLayerNumber*2)) {
171  if(recHitsinLayers[i] != 0)
172  LayersinRPC.push_back(i);
173  else {
174  cout << "Not recHits in special Endcap " << i << endl;
175  EnoughforEndcap = false;
176  }
177  }
178  }
179  if(EnoughforEndcap && (!LayersinRPC.empty())) {
180  // Initiate and call recHit Finder
183  }
184  LayersinRPC.clear();
185  }
186 
187  if(isMixBarrelwithEndcap == true) {
188  cout <<" Mix is not ready for non-cosmic case" << endl;
189  LayersinRPC.clear();
190  }
191 }
type
Definition: HCALResponse.h:21
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)
void RPCSeedLayerFinder::setInput ( MuonRecHitContainer(&)  recHitsRPC[12])

Definition at line 42 of file RPCSeedLayerFinder.cc.

References mps_fire::i, RPCLayerNumber, and findQualityFiles::size.

42  {
43 
44  for(unsigned int i = 0; i < RPCLayerNumber; i++)
45  recHitsinLayers[i] = recHitsRPC[i].size();
46 
47  // Set the signal open
48  isInputset = true;
49 }
size
Write out results.
#define RPCLayerNumber
unsigned int recHitsinLayers[12]
void RPCSeedLayerFinder::setOutput ( RPCSeedrecHitFinder Ref = 0,
RPCCosmicSeedrecHitFinder CosmicRef = 0 
)

Definition at line 56 of file RPCSeedLayerFinder.cc.

56  {
57 
59  RPCCosmicrecHitFinderRef = CosmicRef;
60  isOutputset = true;
61 }
RPCCosmicSeedrecHitFinder * RPCCosmicrecHitFinderRef
RPCSeedrecHitFinder * RPCrecHitFinderRef
void RPCSeedLayerFinder::SpecialLayers ( int  last,
unsigned int  NumberofLayers,
int  type 
)
private

Definition at line 277 of file RPCSeedLayerFinder.cc.

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

277  {
278 
279  // check type, 0=barrel, 1=endcap, 2=mix
280 
281  // barrel has 6 layers
282  if(type == 0) {
283  if(NumberofLayers > BarrelLayerNumber) {
284  cout << "NumberofLayers larger than max layers in barrel" << endl;
285  return;
286  }
287  for(unsigned int i = (last+1); i <= (BarrelLayerNumber-NumberofLayers+LayersinRPC.size()); i++) {
288  if(recHitsinLayers[i] != 0) {
289  LayersinRPC.push_back(i);
290  last = i;
291  if(LayersinRPC.size() < NumberofLayers)
292  SpecialLayers(last, NumberofLayers, type);
293  else {
294  if(checkConstrain()) {
295  cout << "Find special barrel layers: ";
296  for(unsigned int k = 0; k < NumberofLayers; k++)
297  cout << LayersinRPC[k] <<" ";
298  cout << endl;
299  // Initiate and call recHit Finder
302  }
303  else
304  cout << "The layers don't contain all layers in constrain" << endl;
305  }
306  LayersinRPC.pop_back();
307  }
308  }
309  }
310 
311  // endcap has 3 layers for each -Z and +Z
312  if(type == 1) {
313  if(NumberofLayers > EachEndcapLayerNumber) {
314  cout << "NumberofLayers larger than max layers in endcap" << endl;
315  return;
316  }
318  // For -Z case
319  for(unsigned int i = (last+1); i <= (BarrelLayerNumber+EachEndcapLayerNumber-NumberofLayers+LayersinRPC.size()); i++) {
320  if(recHitsinLayers[i] != 0) {
321  LayersinRPC.push_back(i);
322  last = i;
323  if(LayersinRPC.size() < NumberofLayers)
324  SpecialLayers(last, NumberofLayers, type);
325  else {
326  cout << "Find special -Z endcap layers: ";
327  for(unsigned int k = 0; k < NumberofLayers; k++)
328  cout << LayersinRPC[k] <<" ";
329  cout << endl;
330  // Initiate and call recHit Finder
333  }
334  LayersinRPC.pop_back();
335  }
336  }
337  }
338  else
339  {
340  // For +Z case
341  for(unsigned int i = (last+1); i <= (BarrelLayerNumber+EachEndcapLayerNumber*2-NumberofLayers+LayersinRPC.size()); i++) {
342  if(recHitsinLayers[i] != 0) {
343  LayersinRPC.push_back(i);
344  last = i;
345  if(LayersinRPC.size() < NumberofLayers)
346  SpecialLayers(last, NumberofLayers, type);
347  else {
348  cout << "Find special +Z endcap layers: ";
349  for(unsigned int k = 0; k < NumberofLayers; k++)
350  cout << LayersinRPC[k] <<" ";
351  cout << endl;
352  // Initiate and call recHit Finder
355  }
356  LayersinRPC.pop_back();
357  }
358  }
359  }
360  }
361 }
type
Definition: HCALResponse.h:21
RPCSeedrecHitFinder * RPCrecHitFinderRef
int k[5][pyjets_maxn]
#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)
void RPCSeedLayerFinder::unsetInput ( )

Definition at line 51 of file RPCSeedLayerFinder.cc.

51  {
52 
53  isInputset = false;
54 }

Member Data Documentation

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

Definition at line 67 of file RPCSeedLayerFinder.h.

bool RPCSeedLayerFinder::isConfigured
private

Definition at line 69 of file RPCSeedLayerFinder.h.

bool RPCSeedLayerFinder::isCosmic
private

Definition at line 60 of file RPCSeedLayerFinder.h.

bool RPCSeedLayerFinder::isInputset
private

Definition at line 70 of file RPCSeedLayerFinder.h.

bool RPCSeedLayerFinder::isMixBarrelwithEndcap
private

Definition at line 61 of file RPCSeedLayerFinder.h.

bool RPCSeedLayerFinder::isOutputset
private

Definition at line 71 of file RPCSeedLayerFinder.h.

bool RPCSeedLayerFinder::isSpecialLayers
private

Definition at line 64 of file RPCSeedLayerFinder.h.

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

Definition at line 66 of file RPCSeedLayerFinder.h.

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

Definition at line 65 of file RPCSeedLayerFinder.h.

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

Definition at line 73 of file RPCSeedLayerFinder.h.

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

Definition at line 62 of file RPCSeedLayerFinder.h.

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

Definition at line 63 of file RPCSeedLayerFinder.h.

unsigned int RPCSeedLayerFinder::recHitsinLayers[12]
private

Definition at line 75 of file RPCSeedLayerFinder.h.

RPCCosmicSeedrecHitFinder* RPCSeedLayerFinder::RPCCosmicrecHitFinderRef
private

Definition at line 58 of file RPCSeedLayerFinder.h.

RPCSeedrecHitFinder* RPCSeedLayerFinder::RPCrecHitFinderRef
private

Definition at line 57 of file RPCSeedLayerFinder.h.