1 #include "AnalysisUtils.hxx" 7 return ((pos1[0] - pos2[0])*(pos1[0] - pos2[0]) + (pos1[1] - pos2[1])*(pos1[1] - pos2[1]) + (pos1[2] - pos2[2])*(pos1[2] - pos2[2]));
14 std::vector<Float_t> weights;
17 weights.push_back(event.
Weight);
26 std::string version=
"";
27 size_t lastSlash = path.find_last_of(
"/");
28 version = path.substr(lastSlash+1);
44 getcwd(the_path, 255);
48 strcat(the_path,
"/");
49 strcat(the_path, program.c_str());
64 realpath(full_path.c_str(), real_path);
67 std::string path(real_path);
71 path = path.substr(0, path.rfind(getenv(
"CMTCONFIG"))-1);
76 std::string version = path.substr(path.find_last_of(
"/")+1);
78 if (version[0]==
'v' && (version[2]==
'r' || version[3]==
'r') &&
79 version.find(
"Analysis")==std::string::npos &&
80 version.find(
"highland")==std::string::npos &&
81 version.find(
"psyche") ==std::string::npos){
85 path = path.substr(0,path.find_last_of(
"/"));
90 path = path.substr(path.find_last_of(
"/")+1);
100 std::vector<std::string> packages;
102 std::string PATHENV = getenv(
"PATH");
105 for (Int_t i=0;i<50;i++){
106 size_t first = PATHENV.find_first_of(
":");
107 std::string path= PATHENV.substr(0,first);
108 if (path.find(
"nd280AnalysisTools") ==std::string::npos){
109 std::string
package = GetPackageNameFromPath(path);
110 packages.push_back(package);
111 if (package ==
"psycheCore")
break;
113 PATHENV= PATHENV.substr(first+1);
122 for (
int i = 0; i <
event.nTrueParticles; i++) {
124 return event.TrueParticles[i];
134 std::vector<AnaTrackB*> merged;
136 for (std::vector<AnaTrackB*>::const_iterator it = tracks1.begin(); it != tracks1.end(); it++) {
137 if (std::find(merged.begin(), merged.end(), *it) == merged.end()) {
138 merged.push_back(*it);
142 for (std::vector<AnaTrackB*>::const_iterator it = tracks2.begin(); it != tracks2.end(); it++) {
143 if (std::find(merged.begin(), merged.end(), *it) == merged.end()) {
144 merged.push_back(*it);
std::vector< AnaTrackB * > MergeUniqueTracks(const std::vector< AnaTrackB *> &tracks1, const std::vector< AnaTrackB *> &tracks2)
Merge the two vectors of AnaTrackBs into a single vector, with no duplicated tracks.
std::string GetPackageNameFromPath(const std::string &path)
Get the package name provided a path containing the package name.
std::string GetPackageNameFromProgram(const std::string &program)
Get the package name provided the name of the executable being run.
float GetSeparationSquared(const Float_t *pos1, const Float_t *pos2)
Calculate the distance between two points.
Int_t ID
The ID of the trueObj, which corresponds to the ID of the TTruthParticle that created it...
std::string GetSoftwareVersionFromPath(const std::string &path)
Get The software version from the path of the package.
Representation of a true Monte Carlo trajectory/particle.
Float_t Weight
Run, subrun, event, time stamp, etc.
AnaTrueParticleB * GetTrueParticleByID(const AnaEventB &event, int ID)
Get the AnaTrueParticleB in the current spill with the given ID. Return NULL if it can't be found...
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
std::vector< std::string > GetPackageHierarchy()
Get the vector of packages ordered following the package hierarchy.
std::vector< Float_t > ComputeWeights(const AnaEventB &event)
Compute all event weights (FluxWeight, etc. not the systematic ones !!!) and return the vector...