libatomprobe
Library for Atom Probe Tomography (APT) computation
rangetest.cpp
Go to the documentation of this file.
1 
2 #include "atomprobe/atomprobe.h"
3 
4 using namespace std;
5 using namespace AtomProbe;
6 
7 #include "test.h"
8 
9 int main()
10 {
11 
12  RangeFile rng;
13  RGBf c;
14  c.red=c.green=c.blue=1.0f;
15  unsigned int ionId;
16  ionId=rng.addIon("FeO","FeO",c);
17 
18  //add a range
19  unsigned int rangeId;
20  rangeId = rng.addRange(55.9+16.0,56.3+16.0,ionId);
21 
22  TEST(rng.isSelfConsistent(),"check self consistent");
23 
24  //Now, guess the charge state
25 
26  AbundanceData massTable;
27  if(massTable.open("../data/naturalAbundance.xml"))
28  {
29  cerr << "unable to execute test, could not find abundance data" << endl;
30  return 1;
31  }
32 
33  unsigned int charge;
34  if(!rng.guessChargeState(rangeId,massTable,charge))
35  {
36  cerr << "Unable to compute charge state, thats not right" << endl;
37  TEST(false,"charge guess failed");
38  }
39 
40  TEST(charge ==1,"Check charge state guess");
41 
42  MultiRange m(rng,massTable);
43 
44 }
unsigned int addIon(const std::string &shortName, const std::string &longName, const RGBf &ionCol)
Add the ion to the database returns ion ID if successful, -1 otherwise.
Definition: ranges.cpp:3274
Data holder for colour as float.
Definition: misc.h:26
float green
Definition: misc.h:30
STL namespace.
#define TEST(f, g)
Definition: aptAssert.h:49
bool guessChargeState(unsigned int rangeId, const AtomProbe::AbundanceData &massTable, unsigned int &charge, float tolerance=0.5f) const
Guess the charge state for the ion that corresponds to the given range&#39;s midpoint.
Definition: ranges.cpp:3462
bool isSelfConsistent() const
Performs checks for self consistency.
Definition: ranges.cpp:2450
Data storage and retrieval class for "ranging" a spectra, where overlapping ranges are permitted...
Definition: multiRange.h:63
float blue
Definition: misc.h:31
Class to load abundance information for natural isotopes.
Definition: abundance.h:54
Data storage and retrieval class for various range files.
Definition: ranges.h:95
int main()
Definition: rangetest.cpp:9
float red
Definition: misc.h:29
unsigned int addRange(float start, float end, unsigned int ionID)
Add a range to the rangefile. Returns ID number of added range.
Definition: ranges.cpp:3235