CMS 3D CMS Logo

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

#include <RPCSeedrecHitFinder.h>

Public Member Functions

void configure (const edm::ParameterSet &iConfig)
 
void fillrecHits ()
 
 RPCSeedrecHitFinder ()
 
void setInput (MuonRecHitContainer(&recHits)[12])
 
void setLayers (const std::vector< unsigned int > &Layers)
 
void setOutput (RPCSeedFinder *Seed)
 
void unsetInput ()
 
 ~RPCSeedrecHitFinder ()
 

Private Types

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

Private Member Functions

void checkandfill ()
 
void complete (unsigned int LayerIndex)
 
double getdeltaPhifromrecHits ()
 

Private Attributes

unsigned int BxRange
 
std::vector< int > ClusterSet
 
bool isConfigured
 
bool isInputset
 
bool isLayerset
 
bool isOutputset
 
std::vector< unsigned int > LayersinRPC
 
double MaxDeltaPhi
 
MuonRecHitContainerrecHitsRPC [12]
 
ConstMuonRecHitContainer therecHits
 
RPCSeedFindertheSeed
 

Detailed Description

Definition at line 27 of file RPCSeedrecHitFinder.h.

Member Typedef Documentation

◆ ConstMuonRecHitContainer

Definition at line 31 of file RPCSeedrecHitFinder.h.

◆ ConstMuonRecHitPointer

Definition at line 29 of file RPCSeedrecHitFinder.h.

◆ MuonRecHitContainer

Definition at line 30 of file RPCSeedrecHitFinder.h.

◆ MuonRecHitPointer

Definition at line 28 of file RPCSeedrecHitFinder.h.

Constructor & Destructor Documentation

◆ RPCSeedrecHitFinder()

RPCSeedrecHitFinder::RPCSeedrecHitFinder ( )

Definition at line 21 of file RPCSeedrecHitFinder.cc.

References RPCSeedFinder::isConfigured, and RPCSeedFinder::isOutputset.

21  {
22  // Initiate the member
23  isLayerset = false;
24  isConfigured = false;
25  isInputset = false;
26  isOutputset = false;
27  BxRange = 0;
28  MaxDeltaPhi = 0;
29  ClusterSet.clear();
30  LayersinRPC.clear();
31  therecHits.clear();
32 }
std::vector< unsigned int > LayersinRPC
std::vector< int > ClusterSet
ConstMuonRecHitContainer therecHits

◆ ~RPCSeedrecHitFinder()

RPCSeedrecHitFinder::~RPCSeedrecHitFinder ( )

Definition at line 34 of file RPCSeedrecHitFinder.cc.

34 {}

Member Function Documentation

◆ checkandfill()

void RPCSeedrecHitFinder::checkandfill ( )
private

Definition at line 220 of file RPCSeedrecHitFinder.cc.

References gather_cfg::cout.

220  {
221  if (therecHits.size() >= 3) {
223  theSeed->seed();
224  } else
225  cout << "Layer less than 3, could not fill a RPCSeedFinder" << endl;
226 }
void setrecHits(ConstMuonRecHitContainer &recHits)
RPCSeedFinder * theSeed
ConstMuonRecHitContainer therecHits

◆ complete()

void RPCSeedrecHitFinder::complete ( unsigned int  LayerIndex)
private

Definition at line 82 of file RPCSeedrecHitFinder.cc.

References funct::abs(), RPCRecHit::BunchX(), L1TStage2uGTEmulatorClient_cff::BX, TrackingRecHit::clone(), RPCRecHit::clusterSize(), PixelTestBeamValidation_cfi::ClusterSize, gather_cfg::cout, SiPixelRawToDigiRegional_cfi::deltaPhi, TrackingRecHit::hit(), and VtxSmearedParameters_cfi::Phi.

82  {
83  for (MuonRecHitContainer::const_iterator it = recHitsRPC[LayersinRPC[LayerIndex]]->begin();
84  it != recHitsRPC[LayersinRPC[LayerIndex]]->end();
85  it++) {
86  cout << "Completing layer[" << LayersinRPC[LayerIndex] << "]." << endl;
87 
88  // Check validation
89  if (!(*it)->isValid())
90  continue;
91 
92  // Check BX range, be sure there is only RPCRecHit in the MuonRecHitContainer when use the dynamic_cast
93  TrackingRecHit* thisTrackingRecHit = (*it)->hit()->clone();
94  // Should also delete the RPCRecHit object cast by dynamic_cast<> ?
95  RPCRecHit* thisRPCRecHit = dynamic_cast<RPCRecHit*>(thisTrackingRecHit);
96  int BX = thisRPCRecHit->BunchX();
97  int ClusterSize = thisRPCRecHit->clusterSize();
98  delete thisTrackingRecHit;
99  // Check BX
100  if ((unsigned int)abs(BX) > BxRange)
101  continue;
102  // Check cluster size
103  bool Clustercheck = false;
104  if (ClusterSet.empty())
105  Clustercheck = true;
106  for (std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
107  if (ClusterSize == (*CluIter))
108  Clustercheck = true;
109  if (Clustercheck != true)
110  continue;
111  // Check the recHits Phi range
112  GlobalPoint pos = (*it)->globalPosition();
113  double Phi = pos.phi();
114  cout << "Phi: " << Phi << endl;
115  // The recHits should locate in some phi range
116  therecHits.push_back(*it);
117  double deltaPhi = getdeltaPhifromrecHits();
118  cout << "Delta phi: " << deltaPhi << endl;
119  therecHits.pop_back();
120  if (deltaPhi > MaxDeltaPhi)
121  continue;
122 
123  // If pass all, add to the seed
124  therecHits.push_back(*it);
125  cout << "RecHit's global position: " << pos.x() << ", " << pos.y() << ", " << pos.z() << endl;
126 
127  // Check if this recHit is the last one in the seed
128  // If it is the last one, calculate the seed
129  if (LayerIndex == (LayersinRPC.size() - 1)) {
130  cout << "Check and fill one seed." << endl;
131  checkandfill();
132  }
133  // If it is not the last one, continue to fill the seed from other layers
134  else
135  complete(LayerIndex + 1);
136 
137  // Remember to pop the recHit before add another one from the same layer!
138  therecHits.pop_back();
139  }
140 }
std::vector< unsigned int > LayersinRPC
void complete(unsigned int LayerIndex)
int BunchX() const
Definition: RPCRecHit.h:73
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > ClusterSet
virtual TrackingRecHit * clone() const =0
MuonRecHitContainer * recHitsRPC[12]
int clusterSize() const
Definition: RPCRecHit.h:77
virtual TrackingRecHit const * hit() const
ConstMuonRecHitContainer therecHits

◆ configure()

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

Definition at line 36 of file RPCSeedrecHitFinder.cc.

References edm::ParameterSet::getParameter(), and RPCSeedFinder::isConfigured.

Referenced by RPCSeedGenerator::RPCSeedGenerator().

36  {
37  // Set the configuration
38  BxRange = iConfig.getParameter<unsigned int>("BxRange");
39  MaxDeltaPhi = iConfig.getParameter<double>("MaxDeltaPhi");
40  ClusterSet = iConfig.getParameter<std::vector<int> >("ClusterSet");
41 
42  // Set the signal open
43  isConfigured = true;
44 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< int > ClusterSet

◆ fillrecHits()

void RPCSeedrecHitFinder::fillrecHits ( )

Definition at line 63 of file RPCSeedrecHitFinder.cc.

References gather_cfg::cout, RPCSeedFinder::isConfigured, RPCSeedFinder::isOutputset, and dqmdumpme::k.

63  {
64  if (isLayerset == false || isConfigured == false || isOutputset == false || isInputset == false) {
65  cout << "Not set the IO or not configured yet" << endl;
66  return;
67  }
68  cout << "Now fill recHits from Layers: ";
69  for (unsigned int k = 0; k < LayersinRPC.size(); k++)
70  cout << LayersinRPC[k] << " ";
71  cout << endl;
72  unsigned int LayerIndex = 0;
73  therecHits.clear();
74  complete(LayerIndex);
75 
76  // Unset the signal
77  LayersinRPC.clear();
78  therecHits.clear();
79  isLayerset = false;
80 }
std::vector< unsigned int > LayersinRPC
void complete(unsigned int LayerIndex)
ConstMuonRecHitContainer therecHits

◆ getdeltaPhifromrecHits()

double RPCSeedrecHitFinder::getdeltaPhifromrecHits ( )
private

Definition at line 142 of file RPCSeedrecHitFinder.cc.

References gather_cfg::cout, SiPixelRawToDigiRegional_cfi::deltaPhi, lessPhi(), M_PI, dqmiodumpmetadata::n, and jetUpdater_cfi::sort.

142  {
143  ConstMuonRecHitContainer sortRecHits = therecHits;
144  sort(sortRecHits.begin(), sortRecHits.end(), lessPhi);
145  cout << "Sorted recHit's Phi: ";
146  for (ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++)
147  cout << (*iter)->globalPosition().phi() << ", ";
148  cout << endl;
149  // Calculate the deltaPhi, take care Geom::Phi always in range [-pi,pi)
150  // In case of some deltaPhi larger then Pi, use value() in Geom::Phi to get the true value in radians of Phi, then do the calculation
151  double deltaPhi = 0;
152  if (sortRecHits.size() <= 1)
153  return deltaPhi;
154  if (sortRecHits.size() == 2) {
155  ConstMuonRecHitContainer::const_iterator iter1 = sortRecHits.begin();
156  ConstMuonRecHitContainer::const_iterator iter2 = sortRecHits.begin();
157  iter2++;
158  deltaPhi = (((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value()) > M_PI)
159  ? (2 * M_PI - ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value()))
160  : ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value());
161  return deltaPhi;
162  } else {
163  deltaPhi = 2 * M_PI;
164  int n = 0;
165  for (ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++) {
166  cout << "Before this loop deltaPhi is " << deltaPhi << endl;
167  n++;
168  double deltaPhi_more = 0;
169  double deltaPhi_less = 0;
170  if (iter == sortRecHits.begin()) {
171  cout << "Calculateing frist loop..." << endl;
172  ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
173  --iter;
174  ConstMuonRecHitContainer::const_iterator iter_less = sortRecHits.end();
175  --iter_less;
176  cout << "more_Phi: " << (*iter_more)->globalPosition().phi()
177  << ", less_Phi: " << (*iter_less)->globalPosition().phi()
178  << ", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
179  deltaPhi_more =
180  (2 * M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
181  deltaPhi_less = (*iter_less)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value();
182  } else if (iter == (--sortRecHits.end())) {
183  cout << "Calculateing last loop..." << endl;
184  ConstMuonRecHitContainer::const_iterator iter_less = --iter;
185  ++iter;
186  ConstMuonRecHitContainer::const_iterator iter_more = sortRecHits.begin();
187  cout << "more_Phi: " << (*iter_more)->globalPosition().phi()
188  << ", less_Phi: " << (*iter_less)->globalPosition().phi()
189  << ", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
190  deltaPhi_less =
191  (2 * M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
192  deltaPhi_more = (*iter)->globalPosition().phi().value() - (*iter_more)->globalPosition().phi().value();
193  } else {
194  cout << "Calculateing " << n << "st loop..." << endl;
195  ConstMuonRecHitContainer::const_iterator iter_less = --iter;
196  ++iter;
197  ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
198  --iter;
199  cout << "more_Phi: " << (*iter_more)->globalPosition().phi()
200  << ", less_Phi: " << (*iter_less)->globalPosition().phi()
201  << ", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
202  deltaPhi_less =
203  (2 * M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
204  deltaPhi_more =
205  (2 * M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
206  }
207  if (deltaPhi > deltaPhi_more)
208  deltaPhi = deltaPhi_more;
209  if (deltaPhi > deltaPhi_less)
210  deltaPhi = deltaPhi_less;
211 
212  cout << "For this loop deltaPhi_more is " << deltaPhi_more << endl;
213  cout << "For this loop deltaPhi_less is " << deltaPhi_less << endl;
214  cout << "For this loop deltaPhi is " << deltaPhi << endl;
215  }
216  return deltaPhi;
217  }
218 }
bool lessPhi(const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it1, const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it2)
MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
#define M_PI
ConstMuonRecHitContainer therecHits

◆ setInput()

void RPCSeedrecHitFinder::setInput ( MuonRecHitContainer(&)  recHits[12])

Definition at line 46 of file RPCSeedrecHitFinder.cc.

References mps_fire::i, FastTrackerRecHitMaskProducer_cfi::recHits, and RPCLayerNumber.

Referenced by RPCSeedGenerator::produce().

46  {
47  for (unsigned int i = 0; i < RPCLayerNumber; i++)
48  recHitsRPC[i] = &recHits[i];
49  isInputset = true;
50 }
#define RPCLayerNumber
MuonRecHitContainer * recHitsRPC[12]

◆ setLayers()

void RPCSeedrecHitFinder::setLayers ( const std::vector< unsigned int > &  Layers)

Definition at line 58 of file RPCSeedrecHitFinder.cc.

58  {
59  LayersinRPC = Layers;
60  isLayerset = true;
61 }
std::vector< unsigned int > LayersinRPC

◆ setOutput()

void RPCSeedrecHitFinder::setOutput ( RPCSeedFinder Seed)

Definition at line 53 of file RPCSeedrecHitFinder.cc.

References RPCSeedFinder::isOutputset.

Referenced by RPCSeedGenerator::beginStream().

53  {
54  theSeed = Seed;
55  isOutputset = true;
56 }
RPCSeedFinder * theSeed

◆ unsetInput()

void RPCSeedrecHitFinder::unsetInput ( )

Definition at line 52 of file RPCSeedrecHitFinder.cc.

Referenced by RPCSeedGenerator::produce().

52 { isInputset = false; }

Member Data Documentation

◆ BxRange

unsigned int RPCSeedrecHitFinder::BxRange
private

Definition at line 51 of file RPCSeedrecHitFinder.h.

◆ ClusterSet

std::vector<int> RPCSeedrecHitFinder::ClusterSet
private

Definition at line 53 of file RPCSeedrecHitFinder.h.

◆ isConfigured

bool RPCSeedrecHitFinder::isConfigured
private

Definition at line 56 of file RPCSeedrecHitFinder.h.

◆ isInputset

bool RPCSeedrecHitFinder::isInputset
private

Definition at line 57 of file RPCSeedrecHitFinder.h.

◆ isLayerset

bool RPCSeedrecHitFinder::isLayerset
private

Definition at line 55 of file RPCSeedrecHitFinder.h.

◆ isOutputset

bool RPCSeedrecHitFinder::isOutputset
private

Definition at line 58 of file RPCSeedrecHitFinder.h.

◆ LayersinRPC

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

Definition at line 60 of file RPCSeedrecHitFinder.h.

◆ MaxDeltaPhi

double RPCSeedrecHitFinder::MaxDeltaPhi
private

Definition at line 52 of file RPCSeedrecHitFinder.h.

◆ recHitsRPC

MuonRecHitContainer* RPCSeedrecHitFinder::recHitsRPC[12]
private

Definition at line 61 of file RPCSeedrecHitFinder.h.

◆ therecHits

ConstMuonRecHitContainer RPCSeedrecHitFinder::therecHits
private

Definition at line 62 of file RPCSeedrecHitFinder.h.

◆ theSeed

RPCSeedFinder* RPCSeedrecHitFinder::theSeed
private

Definition at line 63 of file RPCSeedrecHitFinder.h.