Changeset 5658083 in git for modules/VertexFinder.cc
- Timestamp:
- May 18, 2016, 11:39:09 AM (8 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- bc4bff0
- Parents:
- 641cb3d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/VertexFinder.cc
r641cb3d r5658083 3 3 * Cluster vertices from tracks 4 4 * 5 * \author M. Selvaggi - UCL, Louvain-la-Neuve5 * \authors A. Hart, M. Selvaggi 6 6 * 7 7 */ … … 32 32 #include "TVector3.h" 33 33 34 static const doublemm = 1.;35 static const doublem = 1000.*mm;36 static const doublens = 1.;37 static const doubles = 1.e+9 *ns;38 static const doublec_light = 2.99792458e+8 * m/s;34 static const Double_t mm = 1.; 35 static const Double_t m = 1000.*mm; 36 static const Double_t ns = 1.; 37 static const Double_t s = 1.e+9 *ns; 38 static const Double_t c_light = 2.99792458e+8 * m/s; 39 39 40 40 //------------------------------------------------------------------------------ … … 78 78 //------------------------------------------------------------------------------ 79 79 // 80 bool VertexFinder::secondAscending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)80 Bool_t VertexFinder::secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 81 81 { 82 82 return (pair0.second < pair1.second); 83 83 } 84 84 85 bool VertexFinder::secondDescending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)85 Bool_t VertexFinder::secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 86 86 { 87 87 return (pair0.second > pair1.second); … … 116 116 //////////////////////////////////////////////////////////////////////////////// 117 117 sort (clusterSumPT2.begin (), clusterSumPT2.end (), secondDescending); 118 for (vector<pair< unsigned, double> >::const_iterator cluster = clusterSumPT2.begin (); cluster != clusterSumPT2.end (); cluster++)118 for (vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin (); cluster != clusterSumPT2.end (); cluster++) 119 119 { 120 120 // Skip the cluster if it no longer has any tracks … … 129 129 // otherwise, mark the seed track as claimed 130 130 131 if (( int) clusterIDToInt.at (cluster->first).at ("ndf") < fMinNDF)132 { 133 for (map< unsigned, map<string, int> >::iterator track = trackIDToInt.begin (); track != trackIDToInt.end (); track++)131 if ((Int_t) clusterIDToInt.at (cluster->first).at ("ndf") < fMinNDF) 132 { 133 for (map<UInt_t, map<string, Int_t> >::iterator track = trackIDToInt.begin (); track != trackIDToInt.end (); track++) 134 134 { 135 if (track->second.at ("clusterIndex") != ( int) cluster->first)135 if (track->second.at ("clusterIndex") != (Int_t) cluster->first) 136 136 continue; 137 137 track->second["clusterIndex"] = -1; … … 162 162 //////////////////////////////////////////////////////////////////////////////// 163 163 clusterSumPT2.clear (); 164 for (map< unsigned, map<string, int> >::const_iterator cluster = clusterIDToInt.begin (); cluster != clusterIDToInt.end (); cluster++)164 for (map<UInt_t, map<string, Int_t> >::const_iterator cluster = clusterIDToInt.begin (); cluster != clusterIDToInt.end (); cluster++) 165 165 { 166 166 … … 171 171 sort (clusterSumPT2.begin (), clusterSumPT2.end (), secondDescending); 172 172 173 for (vector<pair< unsigned, double> >::const_iterator cluster = clusterSumPT2.begin (); cluster != clusterSumPT2.end (); cluster++)173 for (vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin (); cluster != clusterSumPT2.end (); cluster++) 174 174 { 175 175 DelphesFactory *factory = GetFactory(); … … 192 192 { 193 193 Candidate *candidate; 194 unsignedclusterIndex = 0, maxSeeds = 0;194 UInt_t clusterIndex = 0, maxSeeds = 0; 195 195 196 196 //////////////////////////////////////////////////////////////////////////////// … … 224 224 //////////////////////////////////////////////////////////////////////////////// 225 225 sort (trackPT.begin (), trackPT.end (), secondDescending); 226 for (vector<pair< unsigned, double> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, maxSeeds++)226 for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, maxSeeds++) 227 227 { 228 228 if (track->second < fSeedMinPT) … … 242 242 // Create the seeds from the SeedMinPT highest pt tracks. 243 243 //////////////////////////////////////////////////////////////////////////////// 244 for (vector<pair< unsigned, double> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, clusterIndex++)244 for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, clusterIndex++) 245 245 { 246 246 addTrackToCluster (track->first, clusterIndex); … … 251 251 252 252 void 253 VertexFinder::growCluster (const unsignedclusterIndex)254 { 255 booldone = false;256 unsignednearestID;257 int oldClusterIndex;258 doublenearestDistance;259 vector< unsigned> nearTracks;253 VertexFinder::growCluster (const UInt_t clusterIndex) 254 { 255 Bool_t done = false; 256 UInt_t nearestID; 257 Int_t oldClusterIndex; 258 Double_t nearestDistance; 259 vector<UInt_t> nearTracks; 260 260 nearTracks.clear (); 261 261 … … 277 277 { 278 278 279 for (map< unsigned, map<string, double> >::const_iterator track = trackIDToDouble.begin (); track != trackIDToDouble.end (); track++)279 for (map<UInt_t, map<string, Double_t> >::const_iterator track = trackIDToDouble.begin (); track != trackIDToDouble.end (); track++) 280 280 { 281 if (trackIDToBool.at (track->first).at ("claimed") || trackIDToInt.at (track->first).at ("clusterIndex") == ( int) clusterIndex)281 if (trackIDToBool.at (track->first).at ("claimed") || trackIDToInt.at (track->first).at ("clusterIndex") == (Int_t) clusterIndex) 282 282 continue; 283 283 … … 285 285 Double_t sz_vt = clusterIDToDouble.at (clusterIndex).at ("ez") * clusterIDToDouble.at (clusterIndex).at ("z"); 286 286 287 double distance = fabs (clusterIDToDouble.at (clusterIndex).at ("z") - track->second.at ("z")) / hypot (clusterIDToDouble.at (clusterIndex).at ("ez"), track->second.at ("ez")); 288 //double distance = fabs (clusterIDToDouble.at (clusterIndex).at ("z") - track->second.at ("z")) / hypot (sz_vt, sz_tr); 287 Double_t distance = fabs (clusterIDToDouble.at (clusterIndex).at ("z") - track->second.at ("z")) / hypot (clusterIDToDouble.at (clusterIndex).at ("ez"), track->second.at ("ez")); 289 288 if (nearestDistance < 0.0 || distance < nearestDistance) 290 289 { … … 299 298 else 300 299 { 301 for (vector< unsigned>::const_iterator track = nearTracks.begin (); track != nearTracks.end (); track++)300 for (vector<UInt_t>::const_iterator track = nearTracks.begin (); track != nearTracks.end (); track++) 302 301 { 303 if (trackIDToBool.at (*track).at ("claimed") || trackIDToInt.at (*track).at ("clusterIndex") == ( int) clusterIndex)302 if (trackIDToBool.at (*track).at ("claimed") || trackIDToInt.at (*track).at ("clusterIndex") == (Int_t) clusterIndex) 304 303 continue; 305 doubledistance = fabs (clusterIDToDouble.at (clusterIndex).at ("z") - trackIDToDouble.at (*track).at ("z")) / hypot (clusterIDToDouble.at (clusterIndex).at ("ez"), trackIDToDouble.at (*track).at ("ez"));304 Double_t distance = fabs (clusterIDToDouble.at (clusterIndex).at ("z") - trackIDToDouble.at (*track).at ("z")) / hypot (clusterIDToDouble.at (clusterIndex).at ("ez"), trackIDToDouble.at (*track).at ("ez")); 306 305 if (nearestDistance < 0.0 || distance < nearestDistance) 307 306 { … … 334 333 } 335 334 336 double 337 VertexFinder::weight (const unsignedtrackID)335 Double_t 336 VertexFinder::weight (const UInt_t trackID) 338 337 { 339 338 return ((trackIDToDouble.at (trackID).at ("pt") / (trackIDToDouble.at (trackID).at ("ept") * trackIDToDouble.at (trackID).at ("ez"))) * (trackIDToDouble.at (trackID).at ("pt") / (trackIDToDouble.at (trackID).at ("ept") * trackIDToDouble.at (trackID).at ("ez")))); … … 341 340 342 341 void 343 VertexFinder::removeTrackFromCluster (const unsigned trackID, const unsignedclusterID)344 { 345 doublewz = weight (trackID);342 VertexFinder::removeTrackFromCluster (const UInt_t trackID, const UInt_t clusterID) 343 { 344 Double_t wz = weight (trackID); 346 345 347 346 trackIDToInt[trackID]["clusterIndex"] = -1; … … 357 356 358 357 void 359 VertexFinder::addTrackToCluster (const unsigned trackID, const unsignedclusterID)360 { 361 doublewz = weight (trackID);358 VertexFinder::addTrackToCluster (const UInt_t trackID, const UInt_t clusterID) 359 { 360 Double_t wz = weight (trackID); 362 361 363 362 if (!clusterIDToInt.count (clusterID))
Note:
See TracChangeset
for help on using the changeset viewer.