Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:55:58

0001 //   COCOA class implementation file
0002 // Id:  CocoaMaterialElementary.cc
0003 // CAT: Model
0004 //
0005 //   History: v1.0
0006 //   Pedro Arce
0007 #include <cmath>  // include floating-point std::abs functions
0008 #include <fstream>
0009 #include <map>
0010 
0011 #include "Alignment/CocoaDDLObjects/interface/CocoaMaterialElementary.h"
0012 
0013 CocoaMaterialElementary::CocoaMaterialElementary(ALIstring name, float density, ALIstring symbol, float A, ALIint Z)
0014     : theName(name), theDensity(density), theSymbol(symbol), theA(A), theZ(Z) {}
0015 
0016 ALIbool CocoaMaterialElementary::operator==(const CocoaMaterialElementary &mate) const {
0017   // GM: Using numeric_limits<float>::epsilon() might be better instead of a
0018   //     magic number 'kTolerance'. Not changing this to not break code
0019   //     potentially relying on this number.
0020   const float kTolerance = 1.E-9;
0021   return (std::abs(mate.getDensity() - theDensity) < kTolerance && mate.getSymbol() == theSymbol &&
0022           std::abs(mate.getA() - theA) < kTolerance && mate.getZ() == theZ);
0023 }