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 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 15 of file MuonCSCSeedFromRecHits.cc.

17 {
18 }
virtual MuonCSCSeedFromRecHits::~MuonCSCSeedFromRecHits ( )
inlinevirtual

Definition at line 11 of file MuonCSCSeedFromRecHits.h.

11 {}

Member Function Documentation

void MuonCSCSeedFromRecHits::analyze ( void  ) const
private

Definition at line 261 of file MuonCSCSeedFromRecHits.cc.

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

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

Definition at line 180 of file MuonCSCSeedFromRecHits.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, TrackingRecHit::isValid(), M_PI, HLT_25ns14e33_v1_cff::quality, and segmentQuality().

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

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

Definition at line 251 of file MuonCSCSeedFromRecHits.cc.

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

Referenced by makeDefaultSeed().

252  {
253  //float momentum = computeDefaultPt(last);
254  std::vector<double> momentum = thePtExtractor->pT_extract(last, last);
255  seed = createSeed(momentum[0],momentum[1],last);
256  return true;
257 }
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 233 of file MuonCSCSeedFromRecHits.cc.

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

Referenced by seed().

234 {
235  //Search ME1 ...
237  // bool good=false;
238 
239  if(me1 && me1->isValid() )
240  {
241  //revert if a LogTrace or smth is necessary good =
242  createDefaultEndcapSeed(me1, seed);
243  }
244 }
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 98 of file MuonCSCSeedFromRecHits.cc.

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

Referenced by seed().

100 {
101  for ( MuonRecHitContainer::const_iterator itr1 = hits1.begin(), end1 = hits1.end();
102  itr1 != end1; ++itr1)
103  {
104  CSCDetId cscId1((*itr1)->geographicalId().rawId());
105  //int type1 = CSCChamberSpecs::whatChamberType(cscId1.station(), cscId1.ring());
106 
107  for ( MuonRecHitContainer::const_iterator itr2 = hits2.begin(), end2 = hits2.end();
108  itr2 != end2; ++itr2)
109  {
110 
111  CSCDetId cscId2((*itr2)->geographicalId().rawId());
112  //int type2 = CSCChamberSpecs::whatChamberType(cscId2.station(), cscId2.ring());
113 
114  // take the first pair that comes along. Probably want to rank them later
115  std::vector<double> pts = thePtExtractor->pT_extract(*itr1, *itr2);
116 
117  double pt = pts[0];
118  double sigmapt = pts[1];
119  double minpt = 3.;
120 
121  // if too small, probably an error. Keep trying.
122  if(fabs(pt) > minpt)
123  {
124  double maxpt = 2000.;
125  if(pt > maxpt) {
126  pt = maxpt;
127  sigmapt = maxpt;
128  }
129  if(pt < -maxpt) {
130  pt = -maxpt;
131  sigmapt = maxpt;
132  }
133 
134  // get the position and direction from the higher-quality segment
136  seed = createSeed(pt, sigmapt, bestSeg);
137 
138  //std::cout << "FITTED TIMESPT " << pt << " dphi " << dphi << " eta " << eta << std::endl;
139  return true;
140  }
141 
142  }
143  }
144 
145  // guess it didn't find one
146 //std::cout << "NOTHING FOUND ! " << std::endl;
147  return false;
148 }
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
TrajectorySeed MuonCSCSeedFromRecHits::seed ( ) const
virtual

Definition at line 21 of file MuonCSCSeedFromRecHits.cc.

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

Referenced by MuonSeedFinder::seeds().

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

References CSCDetId, SiPixelRawToDigiRegional_cfi::deltaPhi, nhits, HLT_25ns14e33_v1_cff::quality, and relativeConstraints::ring.

Referenced by bestEndcapHit(), and seed().

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