Skip to content

Commit a777a78

Browse files
author
contuandrea
committed
Added class for map configuration
1 parent c12cf3c commit a777a78

File tree

4 files changed

+308
-195
lines changed

4 files changed

+308
-195
lines changed

include/analysis.h

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -45,51 +45,7 @@
4545

4646
using namespace hydra::placeholders;
4747
namespace analysis{
48-
template <typename Data>
49-
TH3D *getHist3DDraw(Data mapx, Data mapy, Data mapz, std::set<double> _vx, std::set<double> _vy, std::set<double> _vz){
50-
51-
std::vector<double> vx(_vx.begin(),_vx.end());
52-
std::vector<double> vy(_vy.begin(),_vy.end());
53-
std::vector<double> vz(_vz.begin(),_vz.end());
54-
std::vector<double> vex(vx.size()+1);
55-
std::vector<double> vey(vy.size()+1);
56-
std::vector<double> vez(vz.size()+1);
57-
58-
vex[0]=vx[0]-fabs(vx[0]-vx[1])/10.;
59-
vey[0]=vy[0]-fabs(vy[0]-vy[1])/10.;
60-
vez[0]=vz[0]-fabs(vz[0]-vz[1])/10.;
61-
62-
for(size_t ix=0;ix<vx.size()-1;ix++){
63-
vex[ix+1]=(vx[ix]+vx[ix+1])/2.;
64-
65-
}
66-
for(size_t iy=0;iy<vy.size()-1;iy++){
67-
vey[iy+1]=(vy[iy]+vy[iy+1])/2.;
68-
69-
}
70-
for(size_t iz=0;iz<vz.size()-1;iz++){
71-
vez[iz+1]=(vz[iz]+vz[iz+1])/2.;
72-
}
73-
74-
vex[vx.size()]=vx[vx.size()-1]+fabs(vx[vx.size()-2]-vx[vx.size()-1])/10.;
75-
vey[vy.size()]=vy[vy.size()-1]+fabs(vy[vy.size()-2]-vy[vy.size()-1])/10.;
76-
vez[vz.size()]=vz[vz.size()-1]+fabs(vz[vz.size()-2]-vz[vz.size()-1])/10.;
77-
78-
TH3D *h3=new TH3D("physmap","physmap;x [#mum];y [#mum];z [#mum]",vx.size(),vex.data(),vy.size(),vey.data(),vz.size(),vez.data());
79-
80-
81-
size_t count=0;
82-
for(size_t iz=0;iz<vz.size();iz++){
83-
for(size_t ix=0;ix<vx.size();ix++){
84-
for(size_t iy=0;iy<vy.size();iy++){
85-
h3->SetBinContent(ix+1,iy+1,iz+1, sqrt(mapx[count]*mapx[count]+mapy[count]*mapy[count]+mapz[count]*mapz[count]));
86-
count++;
87-
}
88-
}
89-
}
90-
return h3;
91-
}
92-
48+
9349
TGraph *setGraph(size_t points, std::string nm, int color, int mstyle=8, int msize=1, int lwidth=2){
9450
TGraph *g = new TGraph(points);
9551
g->SetName(nm.c_str());
@@ -736,7 +692,7 @@ namespace analysis{
736692
}
737693

738694

739-
695+
extradir->WriteTObject(hdraw,"h3bkg","Overwrite");
740696

741697
can->Print(Form("%s/%s.gif++",settings["outputdir"].c_str(),settings["name"].c_str()));
742698
delete can;

include/details/utils.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ if(flag){\
8181
#include <hydra/Zip.h>
8282
// #include <hydra/detail/external/Eigen/Dense>
8383

84+
85+
//ROOT
86+
#ifdef _ROOT_AVAILABLE_
87+
#include "TCanvas.h"
88+
#include "TROOT.h"
89+
#include "TGraph.h"
90+
#include "TGraph2D.h"
91+
#include "TH3D.h"
92+
#include "TH2D.h"
93+
#include "TApplication.h"
94+
#include "TGraphTime.h"
95+
#include "TMarker.h"
96+
#include "TFile.h"
97+
#include "TPad.h"
98+
#include "TLegend.h"
99+
#include "TTree.h"
100+
#endif //_ROOT_AVAILABLE_
101+
84102
//printouts
85103
#define TOPROW "===================================================================================================="
86104
#define MIDDLEROW "----------------------------------------------------------------------------------------------------"
@@ -425,4 +443,16 @@ int sgn(T val) {
425443
return (T(0) < val) - (val < T(0));
426444
}
427445

446+
struct vectorLength
447+
{
448+
449+
template<typename Particle>
450+
__hydra_dual__
451+
double operator()(Particle p){
452+
return sqrt(hydra::get<0>(p)*hydra::get<0>(p) + hydra::get<1>(p)*hydra::get<1>(p) +hydra::get<2>(p)*hydra::get<2>(p));
453+
454+
}
455+
456+
};
457+
428458
#endif /* UTILS_H_ */

0 commit comments

Comments
 (0)