Fork me on GitHub

Changeset 95b4e9f in git for modules/VertexFinder.cc


Ignore:
Timestamp:
Aug 31, 2016, 4:25:59 PM (8 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
4154bbd
Parents:
b195ba1
Message:

reorganize includes in vertexing modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/VertexFinder.cc

    rb195ba1 r95b4e9f  
    2828#include "TVector3.h"
    2929
     30#include <utility>
     31#include <algorithm>
     32#include <stdexcept>
     33#include <iostream>
     34#include <vector>
     35#include <map>
     36#include <string>
     37
     38using namespace std;
     39
    3040static const Double_t mm  = 1.;
    3141static const Double_t m = 1000.*mm;
     
    7383
    7484//------------------------------------------------------------------------------
    75 //
    76 Bool_t VertexFinder::secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
     85
     86static Bool_t secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
    7787{
    7888  return (pair0.second < pair1.second);
    7989}
    8090
    81 Bool_t VertexFinder::secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
     91static Bool_t secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
    8292{
    8393  return (pair0.second > pair1.second);
    8494}
    8595
     96//------------------------------------------------------------------------------
     97
    8698void VertexFinder::Process()
    8799{
    88100  Candidate *candidate;
    89101
    90 ////////////////////////////////////////////////////////////////////////////////
    91 // Clear the track and cluster maps before starting
    92 ////////////////////////////////////////////////////////////////////////////////
     102  // Clear the track and cluster maps before starting
    93103  trackIDToDouble.clear ();
    94104  trackIDToInt.clear ();
     
    99109  trackPT.clear ();
    100110  clusterSumPT2.clear ();
    101 ////////////////////////////////////////////////////////////////////////////////
    102 
    103 ////////////////////////////////////////////////////////////////////////////////
    104 // Create the initial cluster seeds
    105 ////////////////////////////////////////////////////////////////////////////////
     111
     112  // Create the initial cluster seeds
    106113  createSeeds ();
    107 ////////////////////////////////////////////////////////////////////////////////
    108 
    109 ////////////////////////////////////////////////////////////////////////////////
    110 // In order of descending seed pt, grow each cluster. If a cluster ends up with
    111 // fewer than MinNDF tracks, release the tracks for other clusters to claim.
    112 ////////////////////////////////////////////////////////////////////////////////
     114
     115  // In order of descending seed pt, grow each cluster. If a cluster ends up with
     116  // fewer than MinNDF tracks, release the tracks for other clusters to claim.
    113117  sort (clusterSumPT2.begin (), clusterSumPT2.end (), secondDescending);
    114118  for (vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin (); cluster != clusterSumPT2.end (); cluster++)
     
    138142        trackIDToBool[clusterIDToInt.at (cluster->first).at ("seed")]["claimed"] = true;
    139143    }
    140 ////////////////////////////////////////////////////////////////////////////////
    141 
    142 ////////////////////////////////////////////////////////////////////////////////
    143 // Add tracks to the output array after updating their ClusterIndex.
    144 ////////////////////////////////////////////////////////////////////////////////
     144
     145  // Add tracks to the output array after updating their ClusterIndex.
    145146  fItInputArray->Reset ();
    146147  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     
    151152      fOutputArray->Add(candidate);
    152153    }
    153 ////////////////////////////////////////////////////////////////////////////////
    154 
    155 ////////////////////////////////////////////////////////////////////////////////
    156 // Add clusters with at least MinNDF tracks to the output array in order of
    157 // descending sum(pt**2).
    158 ////////////////////////////////////////////////////////////////////////////////
     154
     155  // Add clusters with at least MinNDF tracks to the output array in order of
     156  // descending sum(pt**2).
    159157  clusterSumPT2.clear ();
    160158  for (map<UInt_t, map<string, Int_t> >::const_iterator cluster = clusterIDToInt.begin (); cluster != clusterIDToInt.end (); cluster++)
     
    181179    fVertexOutputArray->Add(candidate);
    182180  }
    183 ////////////////////////////////////////////////////////////////////////////////
    184 }
    185 
    186 void
    187 VertexFinder::createSeeds ()
     181}
     182
     183//------------------------------------------------------------------------------
     184
     185void VertexFinder::createSeeds ()
    188186{
    189187  Candidate *candidate;
    190188  UInt_t clusterIndex = 0, maxSeeds = 0;
    191189
    192 ////////////////////////////////////////////////////////////////////////////////
    193 // Loop over all tracks, initializing some variables.
    194 ////////////////////////////////////////////////////////////////////////////////
     190  // Loop over all tracks, initializing some variables.
    195191  fItInputArray->Reset();
    196192  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     
    213209      trackPT.push_back (make_pair (candidate->GetUniqueID (), candidate->Momentum.Pt ()));
    214210    }
    215 ////////////////////////////////////////////////////////////////////////////////
    216 
    217 ////////////////////////////////////////////////////////////////////////////////
    218 // Sort tracks by pt and leave only the SeedMinPT highest pt ones in the
    219 // trackPT vector.
    220 ////////////////////////////////////////////////////////////////////////////////
     211
     212  // Sort tracks by pt and leave only the SeedMinPT highest pt ones in the
     213  // trackPT vector.
    221214  sort (trackPT.begin (), trackPT.end (), secondDescending);
    222215  for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, maxSeeds++)
     
    233226      trackPT.erase (trackPT.begin () + maxSeeds, trackPT.end ());
    234227    }
    235 ////////////////////////////////////////////////////////////////////////////////
    236 
    237 ////////////////////////////////////////////////////////////////////////////////
    238 // Create the seeds from the SeedMinPT highest pt tracks.
    239 ////////////////////////////////////////////////////////////////////////////////
     228
     229  // Create the seeds from the SeedMinPT highest pt tracks.
    240230  for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, clusterIndex++)
    241231    {
     
    243233      clusterSumPT2.push_back (make_pair (clusterIndex, track->second * track->second));
    244234    }
    245 ////////////////////////////////////////////////////////////////////////////////
    246 }
    247 
    248 void
    249 VertexFinder::growCluster (const UInt_t clusterIndex)
     235}
     236
     237//------------------------------------------------------------------------------
     238
     239void VertexFinder::growCluster (const UInt_t clusterIndex)
    250240{
    251241  Bool_t done = false;
     
    256246  nearTracks.clear ();
    257247
    258 ////////////////////////////////////////////////////////////////////////////////
    259 // Grow the cluster until there are no more tracks within Sigma standard
    260 // deviations of the cluster.
    261 ////////////////////////////////////////////////////////////////////////////////
     248  // Grow the cluster until there are no more tracks within Sigma standard
     249  // deviations of the cluster.
    262250  while (!done)
    263251    {
     
    323311        }
    324312    }
    325 ////////////////////////////////////////////////////////////////////////////////
    326 }
    327 
    328 Double_t
    329 VertexFinder::weight (const UInt_t trackID)
     313}
     314
     315//------------------------------------------------------------------------------
     316
     317Double_t VertexFinder::weight (const UInt_t trackID)
    330318{
    331319  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"))));
    332320}
    333321
    334 void
    335 VertexFinder::removeTrackFromCluster (const UInt_t trackID, const UInt_t clusterID)
     322//------------------------------------------------------------------------------
     323
     324void VertexFinder::removeTrackFromCluster (const UInt_t trackID, const UInt_t clusterID)
    336325{
    337326  Double_t wz = weight (trackID);
     
    348337}
    349338
    350 void
    351 VertexFinder::addTrackToCluster (const UInt_t trackID, const UInt_t clusterID)
     339//------------------------------------------------------------------------------
     340
     341void VertexFinder::addTrackToCluster (const UInt_t trackID, const UInt_t clusterID)
    352342{
    353343  Double_t wz = weight (trackID);
Note: See TracChangeset for help on using the changeset viewer.