Fork me on GitHub

Changeset 5658083 in git


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

Location:
modules
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • modules/TrackSmearing.cc

    r641cb3d r5658083  
    33 *  Performs d0, dZ, p, Theta, Phi smearing of tracks.
    44 *
    5  *
    6  *
    7  *  \author A. Hart, M. Selvaggi
     5 *  \authors A. Hart, M. Selvaggi
    86 *
    97*/
  • 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))
  • modules/VertexFinder.h

    r641cb3d r5658083  
    66 *  Cluster vertices from tracks
    77 *
    8  *  \author M. Selvaggi - UCL, Louvain-la-Neuve
     8 *  \authors A. Hart, M. Selvaggi
    99 *
    1010 */
     11
    1112
    1213#include "classes/DelphesModule.h"
     
    3637  void Finish();
    3738
    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>);
    4041
    4142private:
    4243
    4344  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);
    4849
    4950  Double_t fSigma;
     
    6061  TObjArray *fVertexOutputArray;
    6162
    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;
    6566
    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;
    7172
    7273  ClassDef(VertexFinder, 1)
  • modules/VertexSorter.cc

    r641cb3d r5658083  
    11/** \class VertexSorter
    22 *
    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*/
    1310
    1411#include <unordered_map>
    1512#include "modules/VertexSorter.h"
    16 
    17 //#include "CLHEP/Units/GlobalSystemOfUnits.h"
    18 //#include "CLHEP/Units/GlobalPhysicalConstants.h"
    1913
    2014#include "classes/DelphesClasses.h"
     
    3731#include "TVector3.h"
    3832
    39 static const double mm  = 1.;
    40 static const double m = 1000.*mm;
    41 static const double ns  = 1.;
    42 static const double s = 1.e+9 *ns;
    43 static const double c_light   = 2.99792458e+8 * m/s;
     33static const Double_t mm  = 1.;
     34static const Double_t m = 1000.*mm;
     35static const Double_t ns  = 1.;
     36static const Double_t s = 1.e+9 *ns;
     37static const Double_t c_light   = 2.99792458e+8 * m/s;
    4438
    4539//------------------------------------------------------------------------------
     
    9690//------------------------------------------------------------------------------
    9791//
    98 bool VertexSorter::secondDescending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)
     92Bool_t VertexSorter::secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
    9993{
    10094  return (pair0.second > pair1.second);
    10195}
    102 bool VertexSorter::secondAscending (pair<unsigned, double> pair0, pair<unsigned, double> pair1)
     96Bool_t VertexSorter::secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
    10397{
    10498  return (pair0.second < pair1.second);
     
    108102{
    109103  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++)
    115109    {
    116110      const Candidate &cluster = *((Candidate *) fInputArray->At (iCluster));
     
    135129            continue;
    136130          TLorentzVector p (candidate->Momentum.Px (), candidate->Momentum.Py (), candidate->Momentum.Pz (), candidate->Momentum.E ());
    137           bool isInJet = false;
     131          Bool_t isInJet = false;
    138132
    139133          fItJetInputArray->Reset();
     
    173167
    174168      beamSpotCandidate = (Candidate *) fBeamSpotInputArray->At (0);
    175       for (int iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++)
     169      for (Int_t iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++)
    176170        {
    177171          const Candidate &cluster = *((Candidate *) fInputArray->At (iCluster));
  • modules/VertexSorter.h

    r641cb3d r5658083  
    44/** \class VertexSorter
    55 *
    6  *  Merges particles from pile-up sample into event
     6 *
     7 *  Sorts vertices according to different criteria
     8 *
     9 *  \authors A. Hart, M. Selvaggi
    710 *
    811 *
    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*/
    1613
    1714#include "classes/DelphesModule.h"
     
    4239  void Finish();
    4340
    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>);
    4643
    4744private:
Note: See TracChangeset for help on using the changeset viewer.