CMS 3D CMS Logo

Functions

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/SimG4Core/Physics/src/DDG4ProductionCuts.cc File Reference

#include "SimG4Core/Physics/interface/DDG4ProductionCuts.h"
#include "SimG4Core/Notification/interface/SimG4Exception.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "G4ProductionCuts.hh"
#include "G4RegionStore.hh"
#include <algorithm>

Go to the source code of this file.

Functions

bool dd_is_greater (const std::pair< G4LogicalVolume *, DDLogicalPart > &p1, const std::pair< G4LogicalVolume *, DDLogicalPart > &p2)

Function Documentation

bool dd_is_greater ( const std::pair< G4LogicalVolume *, DDLogicalPart > &  p1,
const std::pair< G4LogicalVolume *, DDLogicalPart > &  p2 
)

helper function to compare parts through their name instead of comparing them by their pointers. It's guaranteed to produce the same order in subsequent application runs, while pointers usually can't guarantee this

Definition at line 23 of file DDG4ProductionCuts.cc.

References query::result.

Referenced by DDG4ProductionCuts::initialize().

                                                                        {
  bool result = false;
  if (p1.second.name().ns() > p2.second.name().ns()) {
    result = true;
  }
  if (p1.second.name().ns() == p2.second.name().ns()) {
    if (p1.second.name().name() > p2.second.name().name()) {
      result = true;
    }
    if (p1.second.name().name() == p2.second.name().name()) {
      if (p1.first->GetName() > p2.first->GetName()) {
        result = true;
      }
    }
  }
  return result;
}