#include <RecoMuon/MuonSeedGenerator/src/MuonCSCSeedFromRecHits.h>
Public Member Functions | |
MuonCSCSeedFromRecHits () | |
virtual TrajectorySeed | seed () const |
virtual | ~MuonCSCSeedFromRecHits () |
Private Types | |
typedef std::map< std::pair < int, int >, std::pair < double, double > > | ConstantsMap |
Private Member Functions | |
void | analyze () const |
ConstMuonRecHitPointer | bestSegment () const |
float | computeDefaultPt (ConstMuonRecHitPointer muon) const |
bool | createDefaultEndcapSeed (ConstMuonRecHitPointer last, TrajectorySeed &seed) const |
void | fillConstants (int chamberType1, int chamberType2, double c1, double c2) |
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 |
Private Attributes | |
ConstantsMap | theConstantsMap |
Definition at line 7 of file MuonCSCSeedFromRecHits.h.
typedef std::map< std::pair<int, int>, std::pair<double, double> > MuonCSCSeedFromRecHits::ConstantsMap [private] |
Definition at line 36 of file MuonCSCSeedFromRecHits.h.
MuonCSCSeedFromRecHits::MuonCSCSeedFromRecHits | ( | ) |
Definition at line 14 of file MuonCSCSeedFromRecHits.cc.
References fillConstants().
00015 : MuonSeedFromRecHits() 00016 { 00017 //FIXME make configurable 00018 // parameters for the fit of dphi between chambers vs. eta 00019 // pt = (c1 + c2 abs(eta))/ dphi 00020 fillConstants(1,5, 0.6640, -0.2253); 00021 fillConstants(1,7, 0.6255, -0.1955); 00022 fillConstants(2,5, 0.6876, -0.2379); 00023 fillConstants(2,7, 0.6404, -0.2009); 00024 //fillConstants(2,8, 0.7972, -0.3032); 00025 fillConstants(3,5, 0.2773, -0.1017); 00026 fillConstants(3,6, -0.05597, 0.11840); 00027 fillConstants(3,8, -0.09705, 0.15916); 00028 // numbers from Shih-Chuam's May 2007 talk 00029 fillConstants(4,6, -0.123, 0.167); 00030 fillConstants(5,7, 0.035, 0.); 00031 fillConstants(6,8, 0.025, 0.); 00032 00033 00034 00035 }
virtual MuonCSCSeedFromRecHits::~MuonCSCSeedFromRecHits | ( | ) | [inline, virtual] |
Definition at line 295 of file MuonCSCSeedFromRecHits.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), iter, MuonSeedFromRecHits::theRhits, and CSCChamberSpecs::whatChamberType().
00296 { 00297 for ( MuonRecHitContainer::const_iterator iter = theRhits.begin(); iter!= theRhits.end(); iter++ ){ 00298 if ( !(*iter)->isCSC() ) continue; 00299 for ( MuonRecHitContainer::const_iterator iter2 = iter + 1; iter2 != theRhits.end(); ++iter2) 00300 { 00301 if( !(*iter2)->isCSC() ) continue; 00302 00303 CSCDetId cscId1((*iter)->geographicalId().rawId()); 00304 CSCDetId cscId2((*iter2)->geographicalId().rawId()); 00305 double dphi = (**iter).globalPosition().phi() - (**iter2).globalPosition().phi(); 00306 if(dphi > M_PI) dphi -= 2*M_PI; 00307 if(dphi < -M_PI) dphi += 2*M_PI; 00308 00309 int type1 = CSCChamberSpecs::whatChamberType(cscId1.station(), cscId1.ring()); 00310 int type2 = CSCChamberSpecs::whatChamberType(cscId2.station(), cscId2.ring()); 00311 00312 // say the lower station first 00313 if(type1 < type2) 00314 { 00315 std::cout << "HITPAIRA," << type1 << type2 << "," << 00316 dphi << "," << (**iter).globalPosition().eta() << std::endl; 00317 } 00318 if(type2 < type1) 00319 { 00320 std::cout << "HITPAIRB," << type2 << type1 << "," << 00321 -dphi << "," << (**iter2).globalPosition().eta() << std::endl; 00322 } 00323 if(type1 == type2) 00324 { 00325 std::cout << "HITPAIRSAMESTATION," << type1 << cscId1.ring() << cscId2.ring() 00326 << "," << dphi << "," << (**iter).globalPosition().eta() << std::endl; 00327 } 00328 00329 } 00330 } 00331 }
MuonCSCSeedFromRecHits::ConstMuonRecHitPointer MuonCSCSeedFromRecHits::bestSegment | ( | ) | const [private] |
Definition at line 196 of file MuonCSCSeedFromRecHits.cc.
References iter, segmentQuality(), and MuonSeedFromRecHits::theRhits.
Referenced by makeDefaultSeed(), and makeSeed().
00197 { 00198 MuonRecHitPointer me1=0, meit=0; 00199 float dPhiGloDir = .0; // +v 00200 float bestdPhiGloDir = M_PI; // +v 00201 int quality1 = 0, quality = 0; // +v I= 5,6-p. / II= 4p. / III= 3p. 00202 00203 for ( MuonRecHitContainer::const_iterator iter = theRhits.begin(); iter!= theRhits.end(); iter++ ){ 00204 if ( !(*iter)->isCSC() ) continue; 00205 00206 // tmp compar. Glob-Dir for the same tr-segm: 00207 00208 meit = *iter; 00209 00210 quality = segmentQuality(meit); 00211 00212 dPhiGloDir = fabs ( meit->globalPosition().phi() - meit->globalDirection().phi() ); 00213 if ( dPhiGloDir > M_PI ) dPhiGloDir = 2.*M_PI - dPhiGloDir; 00214 00215 00216 if(!me1){ 00217 me1 = meit; 00218 quality1 = quality; 00219 bestdPhiGloDir = dPhiGloDir; 00220 } 00221 00222 if(me1) { 00223 00224 if ( !me1->isValid() ) { 00225 me1 = meit; 00226 quality1 = quality; 00227 bestdPhiGloDir = dPhiGloDir; 00228 } 00229 00230 if ( me1->isValid() && quality < quality1 ) { 00231 me1 = meit; 00232 quality1 = quality; 00233 bestdPhiGloDir = dPhiGloDir; 00234 } 00235 00236 if ( me1->isValid() && bestdPhiGloDir > .03 ) { 00237 if ( dPhiGloDir < bestdPhiGloDir - .01 && quality == quality1 ) { 00238 me1 = meit; 00239 quality1 = quality; 00240 bestdPhiGloDir = dPhiGloDir; 00241 } 00242 } 00243 } 00244 00245 } // iter 00246 00247 return me1; 00248 }
float MuonCSCSeedFromRecHits::computeDefaultPt | ( | ConstMuonRecHitPointer | muon | ) | const [private] |
bool MuonCSCSeedFromRecHits::createDefaultEndcapSeed | ( | ConstMuonRecHitPointer | last, | |
TrajectorySeed & | seed | |||
) | const [private] |
Definition at line 268 of file MuonCSCSeedFromRecHits.cc.
References MuonSeedFromRecHits::createSeed(), MuonSeedPtExtractor::pT_extract(), and MuonSeedFromRecHits::thePtExtractor.
Referenced by makeDefaultSeed().
00269 { 00270 const std::string metname = "Muon|RecoMuon|MuonSeedFinder"; 00271 00272 AlgebraicSymMatrix mat(5,0) ; 00273 00274 // this perform H.T() * parErr * H, which is the projection of the 00275 // the measurement error (rechit rf) to the state error (TSOS rf) 00276 // Legenda: 00277 // H => is the 4x5 projection matrix 00278 // parError the 4x4 parameter error matrix of the RecHit 00279 00280 mat = last->parametersError().similarityT( last->projectionMatrix() ); 00281 00282 // We want pT but it's not in RecHit interface, so we've put it within this class 00283 //float momentum = computeDefaultPt(last); 00284 std::vector<double> momentum = thePtExtractor->pT_extract(last, last); 00285 // FIXME 00286 // float smomentum = 0.25*momentum; // FIXME!!!! 00287 float smomentum = 25; 00288 00289 seed = createSeed(momentum[0],momentum[1],last); 00290 return true; 00291 }
void MuonCSCSeedFromRecHits::fillConstants | ( | int | chamberType1, | |
int | chamberType2, | |||
double | c1, | |||
double | c2 | |||
) | [private] |
Definition at line 38 of file MuonCSCSeedFromRecHits.cc.
References theConstantsMap.
Referenced by MuonCSCSeedFromRecHits().
00039 { 00040 theConstantsMap[std::make_pair(chamberType1,chamberType2)] = std::make_pair(c1, c2); 00041 }
void MuonCSCSeedFromRecHits::makeDefaultSeed | ( | TrajectorySeed & | seed | ) | const [private] |
Definition at line 251 of file MuonCSCSeedFromRecHits.cc.
References bestSegment(), and createDefaultEndcapSeed().
Referenced by seed().
00252 { 00253 //Search ME1 ... 00254 ConstMuonRecHitPointer me1= bestSegment(); 00255 bool good=false; 00256 00257 if(me1 && me1->isValid() ) 00258 { 00259 good = createDefaultEndcapSeed(me1, seed); 00260 } 00261 }
bool MuonCSCSeedFromRecHits::makeSeed | ( | const MuonRecHitContainer & | hits1, | |
const MuonRecHitContainer & | hits2, | |||
TrajectorySeed & | seed | |||
) | const [private] |
Definition at line 120 of file MuonCSCSeedFromRecHits.cc.
References bestSegment(), MuonSeedFromRecHits::createSeed(), MuonSeedPtExtractor::pT_extract(), and MuonSeedFromRecHits::thePtExtractor.
Referenced by seed().
00122 { 00123 for ( MuonRecHitContainer::const_iterator itr1 = hits1.begin(), end1 = hits1.end(); 00124 itr1 != end1; ++itr1) 00125 { 00126 CSCDetId cscId1((*itr1)->geographicalId().rawId()); 00127 //int type1 = CSCChamberSpecs::whatChamberType(cscId1.station(), cscId1.ring()); 00128 00129 for ( MuonRecHitContainer::const_iterator itr2 = hits2.begin(), end2 = hits2.end(); 00130 itr2 != end2; ++itr2) 00131 { 00132 00133 CSCDetId cscId2((*itr2)->geographicalId().rawId()); 00134 //int type2 = CSCChamberSpecs::whatChamberType(cscId2.station(), cscId2.ring()); 00135 00136 // take the first pair that comes along. Probably want to rank them later 00137 std::vector<double> pts = thePtExtractor->pT_extract(*itr1, *itr2); 00138 00139 double pt = pts[0]; 00140 double sigmapt = pts[1]; 00141 double minpt = 3.; 00142 00143 // if too small, probably an error. Keep trying. 00144 if(fabs(pt) > minpt) 00145 { 00146 double maxpt = 2000.; 00147 if(pt > maxpt) { 00148 pt = maxpt; 00149 sigmapt = maxpt; 00150 } 00151 if(pt < -maxpt) { 00152 pt = -maxpt; 00153 sigmapt = maxpt; 00154 } 00155 00156 // get the position and direction from the higher-quality segment 00157 ConstMuonRecHitPointer bestSeg = bestSegment(); 00158 seed = createSeed(pt, sigmapt, bestSeg); 00159 00160 //std::cout << "FITTED TIMESPT " << pt << " dphi " << dphi << " eta " << eta << std::endl; 00161 return true; 00162 } 00163 00164 } 00165 } 00166 00167 // guess it didn't find one 00168 //std::cout << "NOTHING FOUND ! " << std::endl; 00169 return false; 00170 }
bool MuonCSCSeedFromRecHits::makeSeed2 | ( | const MuonRecHitContainer & | hits1, | |
const MuonRecHitContainer & | hits2, | |||
TrajectorySeed & | seed | |||
) | const [private] |
TrajectorySeed MuonCSCSeedFromRecHits::seed | ( | ) | const [virtual] |
Definition at line 44 of file MuonCSCSeedFromRecHits.cc.
References MuonSeedFromRecHits::createSeed(), end, iter, makeDefaultSeed(), makeSeed(), HLT_VtxMuL3::result, segmentQuality(), and MuonSeedFromRecHits::theRhits.
Referenced by MuonSeedFinder::seeds().
00045 { 00046 if(theRhits.size() == 1) 00047 { 00048 return createSeed(100., 100., theRhits[0]); 00049 } 00050 //analyze(); 00051 TrajectorySeed result; 00052 //@@ doesn't handle overlap between ME11 and ME12 correctly 00053 // sort by station 00054 MuonRecHitContainer station1Hits, station2Hits, station3Hits, station4Hits; 00055 for ( MuonRecHitContainer::const_iterator iter = theRhits.begin(), end = theRhits.end(); 00056 iter != end; ++iter) 00057 { 00058 int station = CSCDetId((*iter)->geographicalId().rawId()).station(); 00059 if(station == 1) 00060 { 00061 station1Hits.push_back(*iter); 00062 } 00063 else if(station == 2) 00064 { 00065 station2Hits.push_back(*iter); 00066 } 00067 else if(station == 3) 00068 { 00069 station3Hits.push_back(*iter); 00070 } 00071 else if(station == 4) 00072 { 00073 station4Hits.push_back(*iter); 00074 } 00075 } 00076 00077 //std::cout << "Station hits " << station1Hits.size() << " " 00078 // << station2Hits.size() << " " 00079 // << station3Hits.size() << std::endl; 00080 00081 // see whether station 2 or station 3 is better 00082 MuonRecHitContainer * betterSecondHits = &station2Hits; 00083 MuonRecHitContainer * notAsGoodSecondHits = &station3Hits; 00084 if(!station2Hits.empty() && !station3Hits.empty()) 00085 { 00086 // swap if station 3 has better quailty 00087 if(segmentQuality(station3Hits[0]) < segmentQuality(station2Hits[0])) 00088 { 00089 betterSecondHits = &station3Hits; 00090 notAsGoodSecondHits = &station2Hits; 00091 } 00092 } 00093 00094 // now try to make pairs 00095 if(makeSeed(station1Hits, *betterSecondHits, result)) 00096 { 00097 return result; 00098 } 00099 if(makeSeed(station1Hits, *notAsGoodSecondHits, result)) 00100 { 00101 return result; 00102 } 00103 if(makeSeed(station2Hits, station3Hits, result)) 00104 { 00105 return result; 00106 } 00107 if(makeSeed(station1Hits, station4Hits, result)) 00108 { 00109 return result; 00110 } 00111 00112 00113 00114 // no luck 00115 makeDefaultSeed(result); 00116 return result; 00117 }
int MuonCSCSeedFromRecHits::segmentQuality | ( | ConstMuonRecHitPointer | muon | ) | const [private] |
Definition at line 174 of file MuonCSCSeedFromRecHits.cc.
Referenced by bestSegment(), and seed().
00175 { 00176 int Nchi2 = 0; 00177 int quality = 0; 00178 int nhits = segment->recHits().size(); 00179 if ( segment->chi2()/(nhits*2.-4.) > 3. ) Nchi2 = 1; 00180 if ( segment->chi2()/(nhits*2.-4.) > 9. ) Nchi2 = 2; 00181 00182 if ( nhits > 4 ) quality = 1 + Nchi2; 00183 if ( nhits == 4 ) quality = 3 + Nchi2; 00184 if ( nhits == 3 ) quality = 5 + Nchi2; 00185 00186 float dPhiGloDir = fabs ( segment->globalPosition().phi() - segment->globalDirection().phi() ); 00187 if ( dPhiGloDir > M_PI ) dPhiGloDir = 2.*M_PI - dPhiGloDir; 00188 00189 if ( dPhiGloDir > .2 ) ++quality; 00190 return quality; 00191 }