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.

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

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 }
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits

◆ bestEndcapHit()

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

Definition at line 154 of file MuonCSCSeedFromRecHits.cc.

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

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

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 }
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
#define M_PI
int segmentQuality(ConstMuonRecHitPointer muon) const
string quality

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

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

Referenced by makeDefaultSeed().

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 }
virtual TrajectorySeed seed() const
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

◆ makeDefaultSeed()

void MuonCSCSeedFromRecHits::makeDefaultSeed ( TrajectorySeed seed) const
private

Definition at line 206 of file MuonCSCSeedFromRecHits.cc.

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

Referenced by seed().

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 }
virtual TrajectorySeed seed() const
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
ConstMuonRecHitPointer bestEndcapHit(const MuonRecHitContainer &endcapHits) const
bool createDefaultEndcapSeed(ConstMuonRecHitPointer last, TrajectorySeed &seed) const
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer

◆ makeSeed()

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

Definition at line 78 of file MuonCSCSeedFromRecHits.cc.

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().

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 }
virtual TrajectorySeed seed() const
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

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

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

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

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 }
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
bool makeSeed(const MuonRecHitContainer &hits1, const MuonRecHitContainer &hits2, TrajectorySeed &seed) const
void makeDefaultSeed(TrajectorySeed &seed) const
int segmentQuality(ConstMuonRecHitPointer muon) const
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer

◆ segmentQuality()

int MuonCSCSeedFromRecHits::segmentQuality ( ConstMuonRecHitPointer  muon) const
private

Definition at line 124 of file MuonCSCSeedFromRecHits.cc.

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

Referenced by bestEndcapHit(), and seed().

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 }
string quality