Changeset 5658083 in git
- Timestamp:
- May 18, 2016, 11:39:09 AM (8 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- bc4bff0
- Parents:
- 641cb3d
- Location:
- modules
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/TrackSmearing.cc
r641cb3d r5658083 3 3 * Performs d0, dZ, p, Theta, Phi smearing of tracks. 4 4 * 5 * 6 * 7 * \author A. Hart, M. Selvaggi 5 * \authors A. Hart, M. Selvaggi 8 6 * 9 7 */ -
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)) -
modules/VertexFinder.h
r641cb3d r5658083 6 6 * Cluster vertices from tracks 7 7 * 8 * \author M. Selvaggi - UCL, Louvain-la-Neuve8 * \authors A. Hart, M. Selvaggi 9 9 * 10 10 */ 11 11 12 12 13 #include "classes/DelphesModule.h" … … 36 37 void Finish(); 37 38 38 static bool secondDescending (pair<unsigned, double>, pair<unsigned, double>);39 static bool secondAscending (pair<unsigned, double>, pair<unsigned, double>);39 static Bool_t secondDescending (pair<UInt_t, Double_t>, pair<UInt_t, Double_t>); 40 static Bool_t secondAscending (pair<UInt_t, Double_t>, pair<UInt_t, Double_t>); 40 41 41 42 private: 42 43 43 44 void createSeeds (); 44 void growCluster (const unsigned);45 double weight (const unsigned);46 void addTrackToCluster (const unsigned, const unsigned);47 void removeTrackFromCluster (const unsigned, const unsigned);45 void growCluster (const UInt_t); 46 Double_t weight (const UInt_t); 47 void addTrackToCluster (const UInt_t, const UInt_t); 48 void removeTrackFromCluster (const UInt_t, const UInt_t); 48 49 49 50 Double_t fSigma; … … 60 61 TObjArray *fVertexOutputArray; 61 62 62 map< unsigned, map<string, double> > trackIDToDouble;63 map< unsigned, map<string, int> > trackIDToInt;64 map< unsigned, map<string, bool> > trackIDToBool;63 map<UInt_t, map<string, Double_t> > trackIDToDouble; 64 map<UInt_t, map<string, Int_t> > trackIDToInt; 65 map<UInt_t, map<string, Bool_t> > trackIDToBool; 65 66 66 map< unsigned, map<string, double> > clusterIDToDouble;67 map< unsigned, map<string, int> > clusterIDToInt;68 map< unsigned, map<string, bool> > clusterIDToBool;69 vector<pair< unsigned, double> > trackPT;70 vector<pair< unsigned, double> > clusterSumPT2;67 map<UInt_t, map<string, Double_t> > clusterIDToDouble; 68 map<UInt_t, map<string, Int_t> > clusterIDToInt; 69 map<UInt_t, map<string, Bool_t> > clusterIDToBool; 70 vector<pair<UInt_t, Double_t> > trackPT; 71 vector<pair<UInt_t, Double_t> > clusterSumPT2; 71 72 72 73 ClassDef(VertexFinder, 1) -
modules/VertexSorter.cc
r641cb3d r5658083 1 1 /** \class VertexSorter 2 2 * 3 * Merges particles from pile-up sample into event 4 * 5 * 6 * $Date: 2013-02-12 15:13:59 +0100 (Tue, 12 Feb 2013) $ 7 * $Revision: 907 $ 8 * 9 * 10 * \author M. Selvaggi - UCL, Louvain-la-Neuve 11 * 12 */ 3 * 4 * Sorts vertices according to different criteria 5 * 6 * \authors A. Hart, M. Selvaggi 7 * 8 * 9 */ 13 10 14 11 #include <unordered_map> 15 12 #include "modules/VertexSorter.h" 16 17 //#include "CLHEP/Units/GlobalSystemOfUnits.h"18 //#include "CLHEP/Units/GlobalPhysicalConstants.h"19 13 20 14 #include "classes/DelphesClasses.h" … … 37 31 #include "TVector3.h" 38 32 39 static const doublemm = 1.;40 static const doublem = 1000.*mm;41 static const doublens = 1.;42 static const doubles = 1.e+9 *ns;43 static const doublec_light = 2.99792458e+8 * m/s;33 static const Double_t mm = 1.; 34 static const Double_t m = 1000.*mm; 35 static const Double_t ns = 1.; 36 static const Double_t s = 1.e+9 *ns; 37 static const Double_t c_light = 2.99792458e+8 * m/s; 44 38 45 39 //------------------------------------------------------------------------------ … … 96 90 //------------------------------------------------------------------------------ 97 91 // 98 bool VertexSorter::secondDescending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)92 Bool_t VertexSorter::secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 99 93 { 100 94 return (pair0.second > pair1.second); 101 95 } 102 bool VertexSorter::secondAscending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)96 Bool_t VertexSorter::secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 103 97 { 104 98 return (pair0.second < pair1.second); … … 108 102 { 109 103 Candidate *candidate, *jetCandidate, *beamSpotCandidate; 110 unordered_map< int, unsigned> clusterIDToIndex;111 unordered_map< int, double> clusterIDToSumPT2;112 vector<pair< int, double> > sortedClusterIDs;113 114 for ( int iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++)104 unordered_map<Int_t, UInt_t> clusterIDToIndex; 105 unordered_map<Int_t, Double_t> clusterIDToSumPT2; 106 vector<pair<Int_t, Double_t> > sortedClusterIDs; 107 108 for (Int_t iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++) 115 109 { 116 110 const Candidate &cluster = *((Candidate *) fInputArray->At (iCluster)); … … 135 129 continue; 136 130 TLorentzVector p (candidate->Momentum.Px (), candidate->Momentum.Py (), candidate->Momentum.Pz (), candidate->Momentum.E ()); 137 boolisInJet = false;131 Bool_t isInJet = false; 138 132 139 133 fItJetInputArray->Reset(); … … 173 167 174 168 beamSpotCandidate = (Candidate *) fBeamSpotInputArray->At (0); 175 for ( int iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++)169 for (Int_t iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++) 176 170 { 177 171 const Candidate &cluster = *((Candidate *) fInputArray->At (iCluster)); -
modules/VertexSorter.h
r641cb3d r5658083 4 4 /** \class VertexSorter 5 5 * 6 * Merges particles from pile-up sample into event 6 * 7 * Sorts vertices according to different criteria 8 * 9 * \authors A. Hart, M. Selvaggi 7 10 * 8 11 * 9 * $Date: 2013-02-12 15:13:59 +0100 (Tue, 12 Feb 2013) $ 10 * $Revision: 907 $ 11 * 12 * 13 * \author M. Selvaggi - UCL, Louvain-la-Neuve 14 * 15 */ 12 */ 16 13 17 14 #include "classes/DelphesModule.h" … … 42 39 void Finish(); 43 40 44 static bool secondDescending (pair<unsigned, double>, pair<unsigned, double>);45 static bool secondAscending (pair<unsigned, double>, pair<unsigned, double>);41 static Bool_t secondDescending (pair<UInt_t, Double_t>, pair<UInt_t, Double_t>); 42 static Bool_t secondAscending (pair<UInt_t, Double_t>, pair<UInt_t, Double_t>); 46 43 47 44 private:
Note:
See TracChangeset
for help on using the changeset viewer.