Fork me on GitHub

Changeset 5658083 in git for modules/VertexFinder.cc


Ignore:
Timestamp:
May 18, 2016, 11:39:09 AM (8 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
bc4bff0
Parents:
641cb3d
Message:

changed datatype to ROOT compliant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/VertexFinder.cc

    r641cb3d r5658083  
    33 *  Cluster vertices from tracks
    44 *
    5  *  \author M. Selvaggi - UCL, Louvain-la-Neuve
     5 *  \authors A. Hart, M. Selvaggi
    66 *
    77 */
     
    3232#include "TVector3.h"
    3333
    34 static const double mm  = 1.;
    35 static const double m = 1000.*mm;
    36 static const double ns  = 1.;
    37 static const double s = 1.e+9 *ns;
    38 static const double c_light   = 2.99792458e+8 * m/s;
     34static const Double_t mm  = 1.;
     35static const Double_t m = 1000.*mm;
     36static const Double_t ns  = 1.;
     37static const Double_t s = 1.e+9 *ns;
     38static const Double_t c_light   = 2.99792458e+8 * m/s;
    3939
    4040//------------------------------------------------------------------------------
     
    7878//------------------------------------------------------------------------------
    7979//
    80 bool VertexFinder::secondAscending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)
     80Bool_t VertexFinder::secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
    8181{
    8282  return (pair0.second < pair1.second);
    8383}
    8484
    85 bool VertexFinder::secondDescending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)
     85Bool_t VertexFinder::secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
    8686{
    8787  return (pair0.second > pair1.second);
     
    116116////////////////////////////////////////////////////////////////////////////////
    117117  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++)
    119119    {
    120120      // Skip the cluster if it no longer has any tracks
     
    129129      // otherwise, mark the seed track as claimed
    130130     
    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++)
    134134            {
    135               if (track->second.at ("clusterIndex") != (int) cluster->first)
     135              if (track->second.at ("clusterIndex") != (Int_t) cluster->first)
    136136                continue;
    137137              track->second["clusterIndex"] = -1;
     
    162162////////////////////////////////////////////////////////////////////////////////
    163163  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++)
    165165  {
    166166   
     
    171171  sort (clusterSumPT2.begin (), clusterSumPT2.end (), secondDescending);
    172172 
    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++)
    174174  {
    175175    DelphesFactory *factory = GetFactory();
     
    192192{
    193193  Candidate *candidate;
    194   unsigned clusterIndex = 0, maxSeeds = 0;
     194  UInt_t clusterIndex = 0, maxSeeds = 0;
    195195
    196196////////////////////////////////////////////////////////////////////////////////
     
    224224////////////////////////////////////////////////////////////////////////////////
    225225  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++)
    227227    {
    228228      if (track->second < fSeedMinPT)
     
    242242// Create the seeds from the SeedMinPT highest pt tracks.
    243243////////////////////////////////////////////////////////////////////////////////
    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++)
    245245    {
    246246      addTrackToCluster (track->first, clusterIndex);
     
    251251
    252252void
    253 VertexFinder::growCluster (const unsigned clusterIndex)
    254 {
    255   bool done = false;
    256   unsigned nearestID;
    257   int oldClusterIndex;
    258   double nearestDistance;
    259   vector<unsigned> nearTracks;
     253VertexFinder::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;
    260260  nearTracks.clear ();
    261261
     
    277277        {
    278278       
    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++)
    280280            {
    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)
    282282                continue;
    283283               
     
    285285              Double_t sz_vt =  clusterIDToDouble.at (clusterIndex).at ("ez") *  clusterIDToDouble.at (clusterIndex).at ("z");
    286286               
    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"));
    289288              if (nearestDistance < 0.0 || distance < nearestDistance)
    290289                {
     
    299298      else
    300299        {
    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++)
    302301            {
    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)
    304303                continue;
    305               double distance = 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"));
    306305              if (nearestDistance < 0.0 || distance < nearestDistance)
    307306                {
     
    334333}
    335334
    336 double
    337 VertexFinder::weight (const unsigned trackID)
     335Double_t
     336VertexFinder::weight (const UInt_t trackID)
    338337{
    339338  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"))));
     
    341340
    342341void
    343 VertexFinder::removeTrackFromCluster (const unsigned trackID, const unsigned clusterID)
    344 {
    345   double wz = weight (trackID);
     342VertexFinder::removeTrackFromCluster (const UInt_t trackID, const UInt_t clusterID)
     343{
     344  Double_t wz = weight (trackID);
    346345
    347346  trackIDToInt[trackID]["clusterIndex"] = -1;
     
    357356
    358357void
    359 VertexFinder::addTrackToCluster (const unsigned trackID, const unsigned clusterID)
    360 {
    361   double wz = weight (trackID);
     358VertexFinder::addTrackToCluster (const UInt_t trackID, const UInt_t clusterID)
     359{
     360  Double_t wz = weight (trackID);
    362361
    363362  if (!clusterIDToInt.count (clusterID))
Note: See TracChangeset for help on using the changeset viewer.