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.

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 }

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

◆ ~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.

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

References gather_cfg::cout.

◆ complete()

void RPCSeedrecHitFinder::complete ( unsigned int  LayerIndex)
private

Definition at line 82 of file RPCSeedrecHitFinder.cc.

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 }

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.

◆ configure()

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

Definition at line 36 of file RPCSeedrecHitFinder.cc.

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 }

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

◆ fillrecHits()

void RPCSeedrecHitFinder::fillrecHits ( )

Definition at line 63 of file RPCSeedrecHitFinder.cc.

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 }

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

◆ getdeltaPhifromrecHits()

double RPCSeedrecHitFinder::getdeltaPhifromrecHits ( )
private

Definition at line 142 of file RPCSeedrecHitFinder.cc.

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 }

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

◆ setInput()

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

Definition at line 46 of file RPCSeedrecHitFinder.cc.

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

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

◆ 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 }

◆ setOutput()

void RPCSeedrecHitFinder::setOutput ( RPCSeedFinder Seed)

Definition at line 53 of file RPCSeedrecHitFinder.cc.

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

References RPCSeedFinder::isOutputset.

◆ unsetInput()

void RPCSeedrecHitFinder::unsetInput ( )

Definition at line 52 of file RPCSeedrecHitFinder.cc.

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.

RPCSeedrecHitFinder::ClusterSet
std::vector< int > ClusterSet
Definition: RPCSeedrecHitFinder.h:53
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
RPCSeedrecHitFinder::getdeltaPhifromrecHits
double getdeltaPhifromrecHits()
Definition: RPCSeedrecHitFinder.cc:142
RPCSeedrecHitFinder::isLayerset
bool isLayerset
Definition: RPCSeedrecHitFinder.h:55
RPCSeedrecHitFinder::LayersinRPC
std::vector< unsigned int > LayersinRPC
Definition: RPCSeedrecHitFinder.h:60
RPCSeedFinder::setrecHits
void setrecHits(ConstMuonRecHitContainer &recHits)
Definition: RPCSeedFinder.cc:35
RPCSeedFinder::seed
void seed()
Definition: RPCSeedFinder.cc:47
TrackingRecHit::hit
virtual TrackingRecHit const * hit() const
Definition: TrackingRecHit.h:75
RPCSeedrecHitFinder::BxRange
unsigned int BxRange
Definition: RPCSeedrecHitFinder.h:51
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
RPCRecHit::BunchX
int BunchX() const
Definition: RPCRecHit.h:73
RPCSeedrecHitFinder::checkandfill
void checkandfill()
Definition: RPCSeedrecHitFinder.cc:220
RPCSeedrecHitFinder::isConfigured
bool isConfigured
Definition: RPCSeedrecHitFinder.h:56
RPCLayerNumber
#define RPCLayerNumber
Definition: RPCCosmicSeedrecHitFinder.h:18
RPCSeedrecHitFinder::isInputset
bool isInputset
Definition: RPCSeedrecHitFinder.h:57
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
RPCRecHit
Definition: RPCRecHit.h:14
RPCSeedrecHitFinder::therecHits
ConstMuonRecHitContainer therecHits
Definition: RPCSeedrecHitFinder.h:62
RPCSeedrecHitFinder::isOutputset
bool isOutputset
Definition: RPCSeedrecHitFinder.h:58
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
RPCSeedrecHitFinder::recHitsRPC
MuonRecHitContainer * recHitsRPC[12]
Definition: RPCSeedrecHitFinder.h:61
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
RPCRecHit::clusterSize
int clusterSize() const
Definition: RPCRecHit.h:77
PixelTestBeamValidation_cfi.ClusterSize
ClusterSize
Definition: PixelTestBeamValidation_cfi.py:85
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
TrackingRecHit::clone
virtual TrackingRecHit * clone() const =0
TrackingRecHit
Definition: TrackingRecHit.h:21
RPCSeedrecHitFinder::complete
void complete(unsigned int LayerIndex)
Definition: RPCSeedrecHitFinder.cc:82
RPCSeedrecHitFinder::MaxDeltaPhi
double MaxDeltaPhi
Definition: RPCSeedrecHitFinder.h:52
ConstMuonRecHitContainer
MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
Definition: CosmicMuonSmoother.h:36
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1TStage2uGTEmulatorClient_cff.BX
BX
Definition: L1TStage2uGTEmulatorClient_cff.py:9
lessPhi
bool lessPhi(const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it1, const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it2)
Definition: RPCSeedrecHitFinder.cc:15
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RPCSeedrecHitFinder::theSeed
RPCSeedFinder * theSeed
Definition: RPCSeedrecHitFinder.h:63