CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
MuonCSCSeedFromRecHits Class Reference

#include <MuonCSCSeedFromRecHits.h>

Inheritance diagram for MuonCSCSeedFromRecHits:
MuonSeedFromRecHits

Public Member Functions

ConstMuonRecHitPointer bestEndcapHit (const MuonRecHitContainer &endcapHits) const
 
 MuonCSCSeedFromRecHits ()
 
virtual TrajectorySeed seed () const
 
virtual ~MuonCSCSeedFromRecHits ()
 
- Public Member Functions inherited from MuonSeedFromRecHits
void add (MuonTransientTrackingRecHit::MuonRecHitPointer hit)
 
void clear ()
 
TrajectorySeed createSeed (float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
 
MuonTransientTrackingRecHit::ConstMuonRecHitPointer firstRecHit () const
 
 MuonSeedFromRecHits ()
 
unsigned int nrhit () const
 
void setBField (const MagneticField *field)
 
void setPtExtractor (const MuonSeedPtExtractor *extractor)
 
virtual ~MuonSeedFromRecHits ()
 

Private Member Functions

void analyze () const
 
float computeDefaultPt (ConstMuonRecHitPointer muon) const
 
bool createDefaultEndcapSeed (ConstMuonRecHitPointer last, TrajectorySeed &seed) const
 
void makeDefaultSeed (TrajectorySeed &seed) const
 
bool makeSeed (const MuonRecHitContainer &hits1, const MuonRecHitContainer &hits2, TrajectorySeed &seed) const
 
bool makeSeed2 (const MuonRecHitContainer &hits1, const MuonRecHitContainer &hits2, TrajectorySeed &seed) const
 
int segmentQuality (ConstMuonRecHitPointer muon) const
 

Additional Inherited Members

- Protected Types inherited from MuonSeedFromRecHits
typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
 
typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
 
typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
 
- Protected Attributes inherited from MuonSeedFromRecHits
const MagneticFieldtheField
 
const MuonSeedPtExtractorthePtExtractor
 
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
 

Detailed Description

Definition at line 6 of file MuonCSCSeedFromRecHits.h.

Constructor & Destructor Documentation

MuonCSCSeedFromRecHits::MuonCSCSeedFromRecHits ( )

Definition at line 16 of file MuonCSCSeedFromRecHits.cc.

virtual MuonCSCSeedFromRecHits::~MuonCSCSeedFromRecHits ( )
inlinevirtual

Member Function Documentation

void MuonCSCSeedFromRecHits::analyze ( ) const
private

Definition at line 266 of file MuonCSCSeedFromRecHits.cc.

References gather_cfg::cout, MuonCkfTrajectoryBuilder_cfi::deltaPhi, and MuonSeedFromRecHits::theRhits.

Referenced by ~MuonCSCSeedFromRecHits().

267 {
268  for ( MuonRecHitContainer::const_iterator iter = theRhits.begin(); iter!= theRhits.end(); iter++ ){
269  if ( !(*iter)->isCSC() ) continue;
270  for ( MuonRecHitContainer::const_iterator iter2 = iter + 1; iter2 != theRhits.end(); ++iter2)
271  {
272  if( !(*iter2)->isCSC() ) continue;
273 
274  CSCDetId cscId1((*iter)->geographicalId().rawId());
275  CSCDetId cscId2((*iter2)->geographicalId().rawId());
276  double dphi = deltaPhi((**iter).globalPosition().barePhi(), (**iter2).globalPosition().barePhi());
277 
278  int type1 = cscId1.iChamberType();
279  int type2 = cscId2.iChamberType();
280 
281  // say the lower station first
282  if(type1 < type2)
283  {
284  std::cout << "HITPAIRA," << type1 << type2 << "," <<
285  dphi << "," << (**iter).globalPosition().eta() << std::endl;
286  }
287  if(type2 < type1)
288  {
289  std::cout << "HITPAIRB," << type2 << type1 << "," <<
290  -dphi << "," << (**iter2).globalPosition().eta() << std::endl;
291  }
292  if(type1 == type2)
293  {
294  std::cout << "HITPAIRSAMESTATION," << type1 << cscId1.ring() << cscId2.ring()
295  << "," << dphi << "," << (**iter).globalPosition().eta() << std::endl;
296  }
297 
298  }
299  }
300 }
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
MuonCSCSeedFromRecHits::ConstMuonRecHitPointer MuonCSCSeedFromRecHits::bestEndcapHit ( const MuonRecHitContainer endcapHits) const

Definition at line 185 of file MuonCSCSeedFromRecHits.cc.

References MuonCkfTrajectoryBuilder_cfi::deltaPhi, M_PI, btvTracks_cfi::quality, and segmentQuality().

Referenced by MuonOverlapSeedFromRecHits::bestHit(), makeDefaultSeed(), makeSeed(), and ~MuonCSCSeedFromRecHits().

186 {
187  MuonRecHitPointer me1=0, meit=0;
188  float dPhiGloDir = .0; // +v
189  float bestdPhiGloDir = M_PI; // +v
190  int quality1 = 0, quality = 0; // +v I= 5,6-p. / II= 4p. / III= 3p.
191 
192  for ( MuonRecHitContainer::const_iterator iter = endcapHits.begin(); iter!= endcapHits.end(); iter++ ){
193  if ( !(*iter)->isCSC() && !(*iter)->isME0() ) continue;
194 
195  // tmp compar. Glob-Dir for the same tr-segm:
196 
197  meit = *iter;
198 
199  quality = segmentQuality(meit);
200 
201  dPhiGloDir = fabs ( deltaPhi(meit->globalPosition().barePhi(), meit->globalDirection().barePhi()) );
202 
203  if(!me1){
204  me1 = meit;
205  quality1 = quality;
206  bestdPhiGloDir = dPhiGloDir;
207  }
208 
209  if(me1) {
210 
211  if ( !me1->isValid() ) {
212  me1 = meit;
213  quality1 = quality;
214  bestdPhiGloDir = dPhiGloDir;
215  }
216 
217  if ( me1->isValid() && quality < quality1 ) {
218  me1 = meit;
219  quality1 = quality;
220  bestdPhiGloDir = dPhiGloDir;
221  }
222 
223  if ( me1->isValid() && bestdPhiGloDir > .03 ) {
224  if ( dPhiGloDir < bestdPhiGloDir - .01 && quality == quality1 ) {
225  me1 = meit;
226  quality1 = quality;
227  bestdPhiGloDir = dPhiGloDir;
228  }
229  }
230  }
231 
232  } // iter
233 
234  return me1;
235 }
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
int segmentQuality(ConstMuonRecHitPointer muon) const
#define M_PI
float MuonCSCSeedFromRecHits::computeDefaultPt ( ConstMuonRecHitPointer  muon) const
private

Referenced by ~MuonCSCSeedFromRecHits().

bool MuonCSCSeedFromRecHits::createDefaultEndcapSeed ( ConstMuonRecHitPointer  last,
TrajectorySeed seed 
) const
private

Definition at line 256 of file MuonCSCSeedFromRecHits.cc.

References MuonSeedFromRecHits::createSeed(), MuonSeedPtExtractor::pT_extract(), and MuonSeedFromRecHits::thePtExtractor.

Referenced by makeDefaultSeed(), and ~MuonCSCSeedFromRecHits().

257  {
258  //float momentum = computeDefaultPt(last);
259  std::vector<double> momentum = thePtExtractor->pT_extract(last, last);
260  seed = createSeed(momentum[0],momentum[1],last);
261  return true;
262 }
const MuonSeedPtExtractor * thePtExtractor
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
virtual std::vector< double > pT_extract(MuonTransientTrackingRecHit::ConstMuonRecHitPointer firstHit, MuonTransientTrackingRecHit::ConstMuonRecHitPointer secondHit) const
void MuonCSCSeedFromRecHits::makeDefaultSeed ( TrajectorySeed seed) const
private

Definition at line 238 of file MuonCSCSeedFromRecHits.cc.

References bestEndcapHit(), createDefaultEndcapSeed(), and MuonSeedFromRecHits::theRhits.

Referenced by seed(), and ~MuonCSCSeedFromRecHits().

239 {
240  //Search ME1 ...
242  // bool good=false;
243 
244  if(me1 && me1->isValid() )
245  {
246  //revert if a LogTrace or smth is necessary good =
247  createDefaultEndcapSeed(me1, seed);
248  }
249 }
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
ConstMuonRecHitPointer bestEndcapHit(const MuonRecHitContainer &endcapHits) const
bool createDefaultEndcapSeed(ConstMuonRecHitPointer last, TrajectorySeed &seed) const
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
bool MuonCSCSeedFromRecHits::makeSeed ( const MuonRecHitContainer hits1,
const MuonRecHitContainer hits2,
TrajectorySeed seed 
) const
private

Definition at line 103 of file MuonCSCSeedFromRecHits.cc.

References bestEndcapHit(), MuonSeedFromRecHits::createSeed(), HiEvtPlane_cfi::maxpt, HiEvtPlane_cfi::minpt, EnergyCorrector::pt, MuonSeedPtExtractor::pT_extract(), RPCpg::pts, MuonSeedFromRecHits::thePtExtractor, and MuonSeedFromRecHits::theRhits.

Referenced by seed(), and ~MuonCSCSeedFromRecHits().

105 {
106  for ( MuonRecHitContainer::const_iterator itr1 = hits1.begin(), end1 = hits1.end();
107  itr1 != end1; ++itr1)
108  {
109  CSCDetId cscId1((*itr1)->geographicalId().rawId());
110  //int type1 = CSCChamberSpecs::whatChamberType(cscId1.station(), cscId1.ring());
111 
112  for ( MuonRecHitContainer::const_iterator itr2 = hits2.begin(), end2 = hits2.end();
113  itr2 != end2; ++itr2)
114  {
115 
116  CSCDetId cscId2((*itr2)->geographicalId().rawId());
117  //int type2 = CSCChamberSpecs::whatChamberType(cscId2.station(), cscId2.ring());
118 
119  // take the first pair that comes along. Probably want to rank them later
120  std::vector<double> pts = thePtExtractor->pT_extract(*itr1, *itr2);
121 
122  double pt = pts[0];
123  double sigmapt = pts[1];
124  double minpt = 3.;
125 
126  // if too small, probably an error. Keep trying.
127  if(fabs(pt) > minpt)
128  {
129  double maxpt = 2000.;
130  if(pt > maxpt) {
131  pt = maxpt;
132  sigmapt = maxpt;
133  }
134  if(pt < -maxpt) {
135  pt = -maxpt;
136  sigmapt = maxpt;
137  }
138 
139  // get the position and direction from the higher-quality segment
141  seed = createSeed(pt, sigmapt, bestSeg);
142 
143  //std::cout << "FITTED TIMESPT " << pt << " dphi " << dphi << " eta " << eta << std::endl;
144  return true;
145  }
146 
147  }
148  }
149 
150  // guess it didn't find one
151 //std::cout << "NOTHING FOUND ! " << std::endl;
152  return false;
153 }
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
const MuonSeedPtExtractor * thePtExtractor
static const double pts[33]
Definition: Constants.h:30
ConstMuonRecHitPointer bestEndcapHit(const MuonRecHitContainer &endcapHits) const
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
virtual std::vector< double > pT_extract(MuonTransientTrackingRecHit::ConstMuonRecHitPointer firstHit, MuonTransientTrackingRecHit::ConstMuonRecHitPointer secondHit) const
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
bool MuonCSCSeedFromRecHits::makeSeed2 ( const MuonRecHitContainer hits1,
const MuonRecHitContainer hits2,
TrajectorySeed seed 
) const
private

Referenced by ~MuonCSCSeedFromRecHits().

TrajectorySeed MuonCSCSeedFromRecHits::seed ( ) const
virtual

Definition at line 22 of file MuonCSCSeedFromRecHits.cc.

References end, makeDefaultSeed(), makeSeed(), mps_fire::result, segmentQuality(), relativeConstraints::station, and MuonSeedFromRecHits::theRhits.

Referenced by MuonSeedFinder::seeds(), and ~MuonCSCSeedFromRecHits().

23 {
25  if(theRhits.size() == 1)
26  {
27  //return createSeed(100., 100., theRhits[0]);
28  makeDefaultSeed(result);
29  return result;
30  }
31  //@@ doesn't handle overlap between ME11 and ME12 correctly
32  // sort by station
33  MuonRecHitContainer station1Hits, station2Hits, station3Hits, station4Hits;
34  for ( MuonRecHitContainer::const_iterator iter = theRhits.begin(), end = theRhits.end();
35  iter != end; ++iter)
36  {
37  int station = CSCDetId((*iter)->geographicalId().rawId()).station();
38  if ((*iter)->isME0()) {
39  station=1;//ME0DetId((*iter)->geographicalId().rawId()).station();
40  }
41 
42  if(station == 1)
43  {
44  station1Hits.push_back(*iter);
45  }
46  else if(station == 2)
47  {
48  station2Hits.push_back(*iter);
49  }
50  else if(station == 3)
51  {
52  station3Hits.push_back(*iter);
53  }
54  else if(station == 4)
55  {
56  station4Hits.push_back(*iter);
57  }
58  }
59 
60  //std::cout << "Station hits " << station1Hits.size() << " "
61  // << station2Hits.size() << " "
62  // << station3Hits.size() << std::endl;
63 
64  // see whether station 2 or station 3 is better
65  MuonRecHitContainer * betterSecondHits = &station2Hits;
66  MuonRecHitContainer * notAsGoodSecondHits = &station3Hits;
67  if(!station2Hits.empty() && !station3Hits.empty())
68  {
69  // swap if station 3 has better quailty
70  if(segmentQuality(station3Hits[0]) < segmentQuality(station2Hits[0]))
71  {
72  betterSecondHits = &station3Hits;
73  notAsGoodSecondHits = &station2Hits;
74  }
75  }
76 
77  // now try to make pairs
78  if(makeSeed(station1Hits, *betterSecondHits, result))
79  {
80  return result;
81  }
82  if(makeSeed(station1Hits, *notAsGoodSecondHits, result))
83  {
84  return result;
85  }
86  if(makeSeed(station2Hits, station3Hits, result))
87  {
88  return result;
89  }
90  if(makeSeed(station1Hits, station4Hits, result))
91  {
92  return result;
93  }
94 
95 
96 
97  // no luck
98  makeDefaultSeed(result);
99  return result;
100 }
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
int segmentQuality(ConstMuonRecHitPointer muon) const
#define end
Definition: vmac.h:37
void makeDefaultSeed(TrajectorySeed &seed) const
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
bool makeSeed(const MuonRecHitContainer &hits1, const MuonRecHitContainer &hits2, TrajectorySeed &seed) const
int MuonCSCSeedFromRecHits::segmentQuality ( ConstMuonRecHitPointer  muon) const
private

Definition at line 157 of file MuonCSCSeedFromRecHits.cc.

References relativeConstraints::chamber, MuonCkfTrajectoryBuilder_cfi::deltaPhi, nhits, btvTracks_cfi::quality, and relativeConstraints::ring.

Referenced by bestEndcapHit(), seed(), and ~MuonCSCSeedFromRecHits().

158 {
159  int Nchi2 = 0;
160  int quality = 0;
161  int nhits = segment->recHits().size();
162  if ( segment->chi2()/(nhits*2.-4.) > 3. ) Nchi2 = 1;
163  if ( segment->chi2()/(nhits*2.-4.) > 9. ) Nchi2 = 2;
164 
165  if ( nhits > 4 ) quality = 1 + Nchi2;
166  if ( nhits == 4 ) quality = 3 + Nchi2;
167  if ( nhits == 3 ) quality = 5 + Nchi2;
168 
169  float dPhiGloDir = fabs ( deltaPhi(segment->globalPosition().barePhi(), segment->globalDirection().barePhi()) );
170 
171  if ( dPhiGloDir > .2 ) ++quality;
172  // add a penalty for being ME1A if the chamber is ganged
173  if ( segment->isCSC() and CSCDetId(segment->geographicalId()).ring() == 4 )
174  {
175  const auto chamber = dynamic_cast<const CSCChamber*>(segment->det());
176  if ( chamber->specs()->gangedStrips() ) ++quality;
177  }
178 
179  return quality;
180 }