CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 29 of file RPCSeedrecHitFinder.h.

Member Typedef Documentation

Definition at line 34 of file RPCSeedrecHitFinder.h.

Definition at line 32 of file RPCSeedrecHitFinder.h.

Definition at line 33 of file RPCSeedrecHitFinder.h.

Definition at line 31 of file RPCSeedrecHitFinder.h.

Constructor & Destructor Documentation

RPCSeedrecHitFinder::RPCSeedrecHitFinder ( )

Definition at line 23 of file RPCSeedrecHitFinder.cc.

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

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

Definition at line 37 of file RPCSeedrecHitFinder.cc.

37  {
38 
39 }

Member Function Documentation

void RPCSeedrecHitFinder::checkandfill ( )
private

Definition at line 233 of file RPCSeedrecHitFinder.cc.

References gather_cfg::cout.

233  {
234 
235  if(therecHits.size() >= 3)
236  {
238  theSeed->seed();
239  }
240  else
241  cout << "Layer less than 3, could not fill a RPCSeedFinder" << endl;
242 }
void setrecHits(ConstMuonRecHitContainer &recHits)
RPCSeedFinder * theSeed
tuple cout
Definition: gather_cfg.py:121
ConstMuonRecHitContainer therecHits
void RPCSeedrecHitFinder::complete ( unsigned int  LayerIndex)
private

Definition at line 96 of file RPCSeedrecHitFinder.cc.

References funct::abs(), begin, RPCRecHit::BunchX(), rpcdqm::BX, TrackingRecHit::clone(), RPCRecHit::clusterSize(), gather_cfg::cout, SiPixelRawToDigiRegional_cfi::deltaPhi, TrackingRecHit::hit(), colinearityKinematic::Phi, PV3DBase< T, PVType, FrameType >::phi(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

96  {
97 
98  for(MuonRecHitContainer::const_iterator it = recHitsRPC[LayersinRPC[LayerIndex]]->begin(); it != recHitsRPC[LayersinRPC[LayerIndex]]->end(); it++)
99  {
100  cout << "Completing layer[" << LayersinRPC[LayerIndex] << "]." << endl;
101 
102  // Check validation
103  if(!(*it)->isValid())
104  continue;
105 
106  // Check BX range, be sure there is only RPCRecHit in the MuonRecHitContainer when use the dynamic_cast
107  TrackingRecHit* thisTrackingRecHit = (*it)->hit()->clone();
108  // Should also delete the RPCRecHit object cast by dynamic_cast<> ?
109  RPCRecHit* thisRPCRecHit = dynamic_cast<RPCRecHit*>(thisTrackingRecHit);
110  int BX = thisRPCRecHit->BunchX();
111  int ClusterSize = thisRPCRecHit->clusterSize();
112  delete thisTrackingRecHit;
113  // Check BX
114  if((unsigned int)abs(BX) > BxRange)
115  continue;
116  // Check cluster size
117  bool Clustercheck = false;
118  if(ClusterSet.size() == 0)
119  Clustercheck = true;
120  for(std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
121  if(ClusterSize == (*CluIter))
122  Clustercheck = true;
123  if(Clustercheck != true)
124  continue;
125  // Check the recHits Phi range
126  GlobalPoint pos = (*it)->globalPosition();
127  double Phi = pos.phi();
128  cout << "Phi: " << Phi << endl;
129  // The recHits should locate in some phi range
130  therecHits.push_back(*it);
131  double deltaPhi = getdeltaPhifromrecHits();
132  cout << "Delta phi: "<< deltaPhi << endl;
133  therecHits.pop_back();
134  if(deltaPhi > MaxDeltaPhi)
135  continue;
136 
137  // If pass all, add to the seed
138  therecHits.push_back(*it);
139  cout << "RecHit's global position: " << pos.x() << ", " << pos.y() << ", " << pos.z() << endl;
140 
141  // Check if this recHit is the last one in the seed
142  // If it is the last one, calculate the seed
143  if(LayerIndex == (LayersinRPC.size()-1))
144  {
145  cout << "Check and fill one seed." << endl;
146  checkandfill();
147  }
148  // If it is not the last one, continue to fill the seed from other layers
149  else
150  complete(LayerIndex+1);
151 
152  // Remember to pop the recHit before add another one from the same layer!
153  therecHits.pop_back();
154  }
155 }
std::vector< unsigned int > LayersinRPC
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
int clusterSize() const
Definition: RPCRecHit.h:109
void complete(unsigned int LayerIndex)
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > ClusterSet
virtual TrackingRecHit * clone() const =0
MuonRecHitContainer * recHitsRPC[12]
virtual TrackingRecHit const * hit() const
#define begin
Definition: vmac.h:30
int BunchX() const
Definition: RPCRecHit.h:101
tuple cout
Definition: gather_cfg.py:121
ConstMuonRecHitContainer therecHits
T x() const
Definition: PV3DBase.h:62
void RPCSeedrecHitFinder::configure ( const edm::ParameterSet iConfig)

Definition at line 41 of file RPCSeedrecHitFinder.cc.

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

41  {
42 
43  // Set the configuration
44  BxRange = iConfig.getParameter<unsigned int>("BxRange");
45  MaxDeltaPhi = iConfig.getParameter<double>("MaxDeltaPhi");
46  ClusterSet = iConfig.getParameter< std::vector<int> >("ClusterSet");
47 
48  // Set the signal open
49  isConfigured = true;
50 }
T getParameter(std::string const &) const
std::vector< int > ClusterSet
void RPCSeedrecHitFinder::fillrecHits ( )

Definition at line 75 of file RPCSeedrecHitFinder.cc.

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

75  {
76 
77  if(isLayerset == false || isConfigured == false || isOutputset == false || isInputset == false)
78  {
79  cout << "Not set the IO or not configured yet" << endl;
80  return;
81  }
82  cout << "Now fill recHits from Layers: ";
83  for(unsigned int k = 0; k < LayersinRPC.size(); k++)
84  cout << LayersinRPC[k] <<" ";
85  cout << endl;
86  unsigned int LayerIndex = 0;
87  therecHits.clear();
88  complete(LayerIndex);
89 
90  // Unset the signal
91  LayersinRPC.clear();
92  therecHits.clear();
93  isLayerset = false;
94 }
std::vector< unsigned int > LayersinRPC
void complete(unsigned int LayerIndex)
int k[5][pyjets_maxn]
tuple cout
Definition: gather_cfg.py:121
ConstMuonRecHitContainer therecHits
double RPCSeedrecHitFinder::getdeltaPhifromrecHits ( )
private

Definition at line 157 of file RPCSeedrecHitFinder.cc.

References gather_cfg::cout, SiPixelRawToDigiRegional_cfi::deltaPhi, getDQMSummary::iter, lessPhi(), M_PI, n, and python.multivaluedict::sort().

157  {
158 
159  ConstMuonRecHitContainer sortRecHits = therecHits;
160  sort(sortRecHits.begin(), sortRecHits.end(), lessPhi);
161  cout << "Sorted recHit's Phi: ";
162  for(ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++)
163  cout << (*iter)->globalPosition().phi() << ", ";
164  cout << endl;
165  // Calculate the deltaPhi, take care Geom::Phi always in range [-pi,pi)
166  // 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
167  double deltaPhi = 0;
168  if(sortRecHits.size() <= 1)
169  return deltaPhi;
170  if(sortRecHits.size() == 2)
171  {
172  ConstMuonRecHitContainer::const_iterator iter1 = sortRecHits.begin();
173  ConstMuonRecHitContainer::const_iterator iter2 = sortRecHits.begin();
174  iter2++;
175  deltaPhi = (((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value()) > M_PI) ? (2 * M_PI - ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value())) : ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value());
176  return deltaPhi;
177  }
178  else
179  {
180  deltaPhi = 2 * M_PI;
181  int n = 0;
182  for(ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++)
183  {
184  cout << "Before this loop deltaPhi is " << deltaPhi << endl;
185  n++;
186  double deltaPhi_more = 0;
187  double deltaPhi_less = 0;
188  if(iter == sortRecHits.begin())
189  {
190  cout << "Calculateing frist loop..." << endl;
191  ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
192  --iter;
193  ConstMuonRecHitContainer::const_iterator iter_less = sortRecHits.end();
194  --iter_less;
195  cout << "more_Phi: " << (*iter_more)->globalPosition().phi() << ", less_Phi: " << (*iter_less)->globalPosition().phi() << ", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
196  deltaPhi_more = (2 * M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
197  deltaPhi_less = (*iter_less)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value();
198  }
199  else if(iter == (--sortRecHits.end()))
200  {
201  cout << "Calculateing last loop..." << endl;
202  ConstMuonRecHitContainer::const_iterator iter_less = --iter;
203  ++iter;
204  ConstMuonRecHitContainer::const_iterator iter_more = sortRecHits.begin();
205  cout << "more_Phi: " << (*iter_more)->globalPosition().phi() << ", less_Phi: " << (*iter_less)->globalPosition().phi() << ", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
206  deltaPhi_less = (2 * M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
207  deltaPhi_more = (*iter)->globalPosition().phi().value() - (*iter_more)->globalPosition().phi().value();
208  }
209  else
210  {
211  cout << "Calculateing " << n << "st loop..." << endl;
212  ConstMuonRecHitContainer::const_iterator iter_less = --iter;
213  ++iter;
214  ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
215  --iter;
216  cout << "more_Phi: " << (*iter_more)->globalPosition().phi() << ", less_Phi: " << (*iter_less)->globalPosition().phi() << ", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
217  deltaPhi_less = (2 * M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
218  deltaPhi_more = (2 * M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
219  }
220  if(deltaPhi > deltaPhi_more)
221  deltaPhi = deltaPhi_more;
222  if(deltaPhi > deltaPhi_less)
223  deltaPhi = deltaPhi_less;
224 
225  cout << "For this loop deltaPhi_more is " << deltaPhi_more << endl;
226  cout << "For this loop deltaPhi_less is " << deltaPhi_less << endl;
227  cout << "For this loop deltaPhi is " << deltaPhi << endl;
228  }
229  return deltaPhi;
230  }
231 }
bool lessPhi(const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it1, const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it2)
MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
#define M_PI
tuple cout
Definition: gather_cfg.py:121
ConstMuonRecHitContainer therecHits
void RPCSeedrecHitFinder::setInput ( MuonRecHitContainer(&)  recHits[12])

Definition at line 52 of file RPCSeedrecHitFinder.cc.

References i, and RPCLayerNumber.

52  {
53 
54  for(unsigned int i = 0; i < RPCLayerNumber; i++)
55  recHitsRPC[i] = &recHits[i];
56  isInputset = true;
57 }
int i
Definition: DBlmapReader.cc:9
#define RPCLayerNumber
MuonRecHitContainer * recHitsRPC[12]
void RPCSeedrecHitFinder::setLayers ( const std::vector< unsigned int > &  Layers)

Definition at line 69 of file RPCSeedrecHitFinder.cc.

69  {
70 
71  LayersinRPC = Layers;
72  isLayerset = true;
73 }
std::vector< unsigned int > LayersinRPC
void RPCSeedrecHitFinder::setOutput ( RPCSeedFinder Seed)

Definition at line 63 of file RPCSeedrecHitFinder.cc.

References RPCSeedFinder::isOutputset.

63  {
64 
65  theSeed = Seed;
66  isOutputset = true;
67 }
RPCSeedFinder * theSeed
void RPCSeedrecHitFinder::unsetInput ( )

Definition at line 59 of file RPCSeedrecHitFinder.cc.

59  {
60 
61  isInputset = false;
62 }

Member Data Documentation

unsigned int RPCSeedrecHitFinder::BxRange
private

Definition at line 53 of file RPCSeedrecHitFinder.h.

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

Definition at line 55 of file RPCSeedrecHitFinder.h.

bool RPCSeedrecHitFinder::isConfigured
private

Definition at line 58 of file RPCSeedrecHitFinder.h.

bool RPCSeedrecHitFinder::isInputset
private

Definition at line 59 of file RPCSeedrecHitFinder.h.

bool RPCSeedrecHitFinder::isLayerset
private

Definition at line 57 of file RPCSeedrecHitFinder.h.

bool RPCSeedrecHitFinder::isOutputset
private

Definition at line 60 of file RPCSeedrecHitFinder.h.

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

Definition at line 62 of file RPCSeedrecHitFinder.h.

double RPCSeedrecHitFinder::MaxDeltaPhi
private

Definition at line 54 of file RPCSeedrecHitFinder.h.

MuonRecHitContainer* RPCSeedrecHitFinder::recHitsRPC[12]
private

Definition at line 63 of file RPCSeedrecHitFinder.h.

ConstMuonRecHitContainer RPCSeedrecHitFinder::therecHits
private

Definition at line 64 of file RPCSeedrecHitFinder.h.

RPCSeedFinder* RPCSeedrecHitFinder::theSeed
private

Definition at line 65 of file RPCSeedrecHitFinder.h.