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
 
 ~MuonCSCSeedFromRecHits () override
 
- 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::MuonCSCSeedFromRecHits ( )

Definition at line 15 of file MuonCSCSeedFromRecHits.cc.

◆ ~MuonCSCSeedFromRecHits()

MuonCSCSeedFromRecHits::~MuonCSCSeedFromRecHits ( )
inlineoverride

Definition at line 9 of file MuonCSCSeedFromRecHits.h.

9 {}

Member Function Documentation

◆ analyze()

void MuonCSCSeedFromRecHits::analyze ( ) const
private

Definition at line 224 of file MuonCSCSeedFromRecHits.cc.

224  {
225  for (MuonRecHitContainer::const_iterator iter = theRhits.begin(); iter != theRhits.end(); iter++) {
226  if (!(*iter)->isCSC())
227  continue;
228  for (MuonRecHitContainer::const_iterator iter2 = iter + 1; iter2 != theRhits.end(); ++iter2) {
229  if (!(*iter2)->isCSC())
230  continue;
231 
232  CSCDetId cscId1((*iter)->geographicalId().rawId());
233  CSCDetId cscId2((*iter2)->geographicalId().rawId());
234  double dphi = deltaPhi((**iter).globalPosition().barePhi(), (**iter2).globalPosition().barePhi());
235 
236  int type1 = cscId1.iChamberType();
237  int type2 = cscId2.iChamberType();
238 
239  // say the lower station first
240  if (type1 < type2) {
241  std::cout << "HITPAIRA," << type1 << type2 << "," << dphi << "," << (**iter).globalPosition().eta()
242  << std::endl;
243  }
244  if (type2 < type1) {
245  std::cout << "HITPAIRB," << type2 << type1 << "," << -dphi << "," << (**iter2).globalPosition().eta()
246  << std::endl;
247  }
248  if (type1 == type2) {
249  std::cout << "HITPAIRSAMESTATION," << type1 << cscId1.ring() << cscId2.ring() << "," << dphi << ","
250  << (**iter).globalPosition().eta() << std::endl;
251  }
252  }
253  }
254 }

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

◆ bestEndcapHit()

MuonCSCSeedFromRecHits::ConstMuonRecHitPointer MuonCSCSeedFromRecHits::bestEndcapHit ( const MuonRecHitContainer endcapHits) const

Definition at line 154 of file MuonCSCSeedFromRecHits.cc.

155  {
156  MuonRecHitPointer me1 = nullptr, meit = nullptr;
157  float dPhiGloDir = .0; // +v
158  float bestdPhiGloDir = M_PI; // +v
159  int quality1 = 0, quality = 0; // +v I= 5,6-p. / II= 4p. / III= 3p.
160 
161  for (MuonRecHitContainer::const_iterator iter = endcapHits.begin(); iter != endcapHits.end(); iter++) {
162  if (!(*iter)->isCSC() && !(*iter)->isME0())
163  continue;
164 
165  // tmp compar. Glob-Dir for the same tr-segm:
166 
167  meit = *iter;
168 
169  quality = segmentQuality(meit);
170 
171  dPhiGloDir = fabs(deltaPhi(meit->globalPosition().barePhi(), meit->globalDirection().barePhi()));
172 
173  if (!me1) {
174  me1 = meit;
175  quality1 = quality;
176  bestdPhiGloDir = dPhiGloDir;
177  }
178 
179  if (me1) {
180  if (!me1->isValid()) {
181  me1 = meit;
182  quality1 = quality;
183  bestdPhiGloDir = dPhiGloDir;
184  }
185 
186  if (me1->isValid() && quality < quality1) {
187  me1 = meit;
188  quality1 = quality;
189  bestdPhiGloDir = dPhiGloDir;
190  }
191 
192  if (me1->isValid() && bestdPhiGloDir > .03) {
193  if (dPhiGloDir < bestdPhiGloDir - .01 && quality == quality1) {
194  me1 = meit;
195  quality1 = quality;
196  bestdPhiGloDir = dPhiGloDir;
197  }
198  }
199  }
200 
201  } // iter
202 
203  return me1;
204 }

References SiPixelRawToDigiRegional_cfi::deltaPhi, HLT_FULL_cff::endcapHits, M_PI, hlt_dqm_clientPB-live_cfg::me1, quality, and segmentQuality().

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

◆ computeDefaultPt()

float MuonCSCSeedFromRecHits::computeDefaultPt ( ConstMuonRecHitPointer  muon) const
private

◆ createDefaultEndcapSeed()

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

Definition at line 217 of file MuonCSCSeedFromRecHits.cc.

217  {
218  //float momentum = computeDefaultPt(last);
219  std::vector<double> momentum = thePtExtractor->pT_extract(last, last);
220  seed = createSeed(momentum[0], momentum[1], last);
221  return true;
222 }

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

Referenced by makeDefaultSeed().

◆ makeDefaultSeed()

void MuonCSCSeedFromRecHits::makeDefaultSeed ( TrajectorySeed seed) const
private

Definition at line 206 of file MuonCSCSeedFromRecHits.cc.

206  {
207  //Search ME1 ...
209  // bool good=false;
210 
211  if (me1 && me1->isValid()) {
212  //revert if a LogTrace or smth is necessary good =
214  }
215 }

References bestEndcapHit(), createDefaultEndcapSeed(), hlt_dqm_clientPB-live_cfg::me1, seed(), and MuonSeedFromRecHits::theRhits.

Referenced by seed().

◆ makeSeed()

bool MuonCSCSeedFromRecHits::makeSeed ( const MuonRecHitContainer hits1,
const MuonRecHitContainer hits2,
TrajectorySeed seed 
) const
private

Definition at line 78 of file MuonCSCSeedFromRecHits.cc.

80  {
81  for (MuonRecHitContainer::const_iterator itr1 = hits1.begin(), end1 = hits1.end(); itr1 != end1; ++itr1) {
82  CSCDetId cscId1((*itr1)->geographicalId().rawId());
83  //int type1 = CSCChamberSpecs::whatChamberType(cscId1.station(), cscId1.ring());
84 
85  for (MuonRecHitContainer::const_iterator itr2 = hits2.begin(), end2 = hits2.end(); itr2 != end2; ++itr2) {
86  CSCDetId cscId2((*itr2)->geographicalId().rawId());
87  //int type2 = CSCChamberSpecs::whatChamberType(cscId2.station(), cscId2.ring());
88 
89  // take the first pair that comes along. Probably want to rank them later
90  std::vector<double> pts = thePtExtractor->pT_extract(*itr1, *itr2);
91 
92  double pt = pts[0];
93  double sigmapt = pts[1];
94  double minpt = 3.;
95 
96  // if too small, probably an error. Keep trying.
97  if (fabs(pt) > minpt) {
98  double maxpt = 2000.;
99  if (pt > maxpt) {
100  pt = maxpt;
101  sigmapt = maxpt;
102  }
103  if (pt < -maxpt) {
104  pt = -maxpt;
105  sigmapt = maxpt;
106  }
107 
108  // get the position and direction from the higher-quality segment
110  seed = createSeed(pt, sigmapt, bestSeg);
111 
112  //std::cout << "FITTED TIMESPT " << pt << " dphi " << dphi << " eta " << eta << std::endl;
113  return true;
114  }
115  }
116  }
117 
118  // guess it didn't find one
119  //std::cout << "NOTHING FOUND ! " << std::endl;
120  return false;
121 }

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

Referenced by seed().

◆ makeSeed2()

bool MuonCSCSeedFromRecHits::makeSeed2 ( const MuonRecHitContainer hits1,
const MuonRecHitContainer hits2,
TrajectorySeed seed 
) const
private

◆ seed()

TrajectorySeed MuonCSCSeedFromRecHits::seed ( ) const
virtual

Definition at line 17 of file MuonCSCSeedFromRecHits.cc.

17  {
19  if (theRhits.size() == 1) {
20  //return createSeed(100., 100., theRhits[0]);
22  return result;
23  }
24  //@@ doesn't handle overlap between ME11 and ME12 correctly
25  // sort by station
26  MuonRecHitContainer station1Hits, station2Hits, station3Hits, station4Hits;
27  for (MuonRecHitContainer::const_iterator iter = theRhits.begin(), end = theRhits.end(); iter != end; ++iter) {
28  int station = CSCDetId((*iter)->geographicalId().rawId()).station();
29  if ((*iter)->isME0()) {
30  station = 1; //ME0DetId((*iter)->geographicalId().rawId()).station();
31  }
32 
33  if (station == 1) {
34  station1Hits.push_back(*iter);
35  } else if (station == 2) {
36  station2Hits.push_back(*iter);
37  } else if (station == 3) {
38  station3Hits.push_back(*iter);
39  } else if (station == 4) {
40  station4Hits.push_back(*iter);
41  }
42  }
43 
44  //std::cout << "Station hits " << station1Hits.size() << " "
45  // << station2Hits.size() << " "
46  // << station3Hits.size() << std::endl;
47 
48  // see whether station 2 or station 3 is better
49  MuonRecHitContainer* betterSecondHits = &station2Hits;
50  MuonRecHitContainer* notAsGoodSecondHits = &station3Hits;
51  if (!station2Hits.empty() && !station3Hits.empty()) {
52  // swap if station 3 has better quailty
53  if (segmentQuality(station3Hits[0]) < segmentQuality(station2Hits[0])) {
54  betterSecondHits = &station3Hits;
55  notAsGoodSecondHits = &station2Hits;
56  }
57  }
58 
59  // now try to make pairs
60  if (makeSeed(station1Hits, *betterSecondHits, result)) {
61  return result;
62  }
63  if (makeSeed(station1Hits, *notAsGoodSecondHits, result)) {
64  return result;
65  }
66  if (makeSeed(station2Hits, station3Hits, result)) {
67  return result;
68  }
69  if (makeSeed(station1Hits, station4Hits, result)) {
70  return result;
71  }
72 
73  // no luck
75  return result;
76 }

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

Referenced by createDefaultEndcapSeed(), makeDefaultSeed(), makeSeed(), and MuonSeedFinder::seeds().

◆ segmentQuality()

int MuonCSCSeedFromRecHits::segmentQuality ( ConstMuonRecHitPointer  muon) const
private

Definition at line 124 of file MuonCSCSeedFromRecHits.cc.

124  {
125  int Nchi2 = 0;
126  int quality = 0;
127  int nhits = segment->recHits().size();
128  if (segment->chi2() / (nhits * 2. - 4.) > 3.)
129  Nchi2 = 1;
130  if (segment->chi2() / (nhits * 2. - 4.) > 9.)
131  Nchi2 = 2;
132 
133  if (nhits > 4)
134  quality = 1 + Nchi2;
135  if (nhits == 4)
136  quality = 3 + Nchi2;
137  if (nhits == 3)
138  quality = 5 + Nchi2;
139 
140  float dPhiGloDir = fabs(deltaPhi(segment->globalPosition().barePhi(), segment->globalDirection().barePhi()));
141 
142  if (dPhiGloDir > .2)
143  ++quality;
144  // add a penalty for being ME1A if the chamber is ganged
145  if (segment->isCSC() and CSCDetId(segment->geographicalId()).ring() == 4) {
146  const auto chamber = dynamic_cast<const CSCChamber*>(segment->det());
147  if (chamber->specs()->gangedStrips())
148  ++quality;
149  }
150 
151  return quality;
152 }

References relativeConstraints::chamber, SiPixelRawToDigiRegional_cfi::deltaPhi, nhits, quality, and relativeConstraints::ring.

Referenced by bestEndcapHit(), and seed().

MuonCSCSeedFromRecHits::createDefaultEndcapSeed
bool createDefaultEndcapSeed(ConstMuonRecHitPointer last, TrajectorySeed &seed) const
Definition: MuonCSCSeedFromRecHits.cc:217
MuonSeedFromRecHits::thePtExtractor
const MuonSeedPtExtractor * thePtExtractor
Definition: MuonSeedFromRecHits.h:43
MuonRecHitPointer
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
Definition: MuonDetLayerMeasurements.cc:22
HLT_FULL_cff.endcapHits
endcapHits
Definition: HLT_FULL_cff.py:84485
MuonRecHitContainer
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
Definition: CosmicMuonSmoother.h:31
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
MuonSeedFromRecHits::theRhits
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
Definition: MuonSeedFromRecHits.h:41
MuonSeedFromRecHits::MuonSeedFromRecHits
MuonSeedFromRecHits()
Definition: MuonSeedFromRecHits.cc:36
relativeConstraints.station
station
Definition: relativeConstraints.py:67
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MuonCSCSeedFromRecHits::segmentQuality
int segmentQuality(ConstMuonRecHitPointer muon) const
Definition: MuonCSCSeedFromRecHits.cc:124
MuonCSCSeedFromRecHits::bestEndcapHit
ConstMuonRecHitPointer bestEndcapHit(const MuonRecHitContainer &endcapHits) const
Definition: MuonCSCSeedFromRecHits.cc:154
HiEvtPlane_cfi.minpt
minpt
Definition: HiEvtPlane_cfi.py:17
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
dqmdumpme.last
last
Definition: dqmdumpme.py:56
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
mps_fire.end
end
Definition: mps_fire.py:242
nhits
Definition: HIMultiTrackSelector.h:42
MuonCSCSeedFromRecHits::seed
virtual TrajectorySeed seed() const
Definition: MuonCSCSeedFromRecHits.cc:17
ConstMuonRecHitPointer
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
Definition: MuonSeedGenerator.cc:48
CSCDetId
Definition: CSCDetId.h:26
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
hlt_dqm_clientPB-live_cfg.me1
me1
Definition: hlt_dqm_clientPB-live_cfg.py:73
RPCpg::pts
static const double pts[33]
Definition: Constants.h:30
MuonSeedPtExtractor::pT_extract
virtual std::vector< double > pT_extract(MuonTransientTrackingRecHit::ConstMuonRecHitPointer firstHit, MuonTransientTrackingRecHit::ConstMuonRecHitPointer secondHit) const
Definition: MuonSeedPtExtractor.cc:118
MuonCSCSeedFromRecHits::makeSeed
bool makeSeed(const MuonRecHitContainer &hits1, const MuonRecHitContainer &hits2, TrajectorySeed &seed) const
Definition: MuonCSCSeedFromRecHits.cc:78
HiEvtPlane_cfi.maxpt
maxpt
Definition: HiEvtPlane_cfi.py:18
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
TrajectorySeed
Definition: TrajectorySeed.h:18
MuonCSCSeedFromRecHits::makeDefaultSeed
void makeDefaultSeed(TrajectorySeed &seed) const
Definition: MuonCSCSeedFromRecHits.cc:206
mps_fire.result
result
Definition: mps_fire.py:311
MuonSeedFromRecHits::createSeed
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const
Definition: MuonSeedFromRecHits.cc:38