reducedTreeCreator.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. #ifndef REDUCEDTREECREATOR_H
  2. #define REDUCEDTREECREATOR_H
  3. #define _MAX_TRACKS 200000
  4. #define _N2_ZDC 225
  5. #define _N_ZDC 15
  6. #define _N_MODULES_TOTAL 90
  7. #define _N_ARM 2
  8. #define _N_HARM 2
  9. #define _N_METHOD 2
  10. #define _N_QCOMP 2
  11. #define UNDEFINED_CENTRALITY -9999
  12. #define UNDEFINED_PID -9999
  13. #include <iostream>
  14. #include <TMath.h>
  15. #include <TSystem.h>
  16. #include <TVector3.h>
  17. //#include "TRoot.h"
  18. #include "TFile.h"
  19. #include "TTree.h"
  20. #include "TString.h"
  21. #include "FairMCEventHeader.h"
  22. //#include "MCHeader.h"
  23. #include "MpdEvent.h"
  24. //#include "MPDEvent.h"
  25. #include "MpdZdcDigi.h"
  26. #include "MpdPid.h"
  27. //#include "MpdPid_AZ.h"
  28. //#include "ZDCHit.h"
  29. #include "TClonesArray.h"
  30. #include "MpdTrack.h"
  31. #include "FairMCTrack.h"
  32. #include <TH1.h>
  33. #include <TF1.h>
  34. #include <TFile.h>
  35. #include <TTree.h>
  36. #include <TRandom1.h>
  37. #include <MpdKalmanTrack.h>
  38. #include <MpdVertex.h>
  39. #include <TChain.h>
  40. using std::cout;
  41. using std::endl;
  42. using TMath::ATan2;
  43. #define NmultiplicityBins 100
  44. const Float_t pt_bins[]={0.,0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.};
  45. const Int_t n_pt_bin = 12;
  46. const Float_t eta_bins[]={-1.5,-1.2,-1.,-0.8,-0.6,-0.4,-0.2,0.,0.2,0.4,0.6,0.8,1.,1.2,1.5};
  47. const Int_t n_eta_bin = 14;
  48. const Int_t n_proj = 3;
  49. const Int_t n_hits_cut= 32;
  50. const Double_t PIDsigM = 4.0;
  51. const Double_t PIDsigE = 4.0;
  52. const Double_t PIDenergy = 11.;
  53. const Double_t PIDkoeff = 1.;
  54. const TString PIDgenerator = "URQMD";
  55. const TString PIDtracking = "CF";
  56. const TString PIDparticles = "pikapr";
  57. class reducedTreeCreator
  58. {
  59. public:
  60. reducedTreeCreator(TString inFileHistName, TString inFileTreeName, TString outFileName , TString dcaFileName);
  61. void CreateReducedTree();
  62. Int_t GetCentrality(Int_t multiplicity);
  63. Float_t integrate(TH1F *h, Int_t max_bin, Float_t sum);
  64. bool FillTrack(FairMCTrack *mctrack, long int j, int &m);
  65. private:
  66. TFile *inFile;
  67. TTree *inTree;
  68. TChain *dstTree;
  69. TFile *outFile;
  70. TTree *outTree;
  71. TFile *inFileHist;
  72. long int mc_side[_MAX_TRACKS][10];
  73. long int mpd_side[_MAX_TRACKS];
  74. MpdPid *pid;
  75. TFile* dcaFile;
  76. //TF1* f_dca[n_proj][n_pt_bin][n_eta_bin];
  77. TF1* f_pt_fit[n_proj][n_eta_bin];
  78. Float_t b_mc;
  79. Float_t phiEP_mc;
  80. Float_t x_vertex_mc;
  81. Float_t y_vertex_mc;
  82. Float_t z_vertex_mc;
  83. Float_t x_vertex_mpd;
  84. Float_t y_vertex_mpd;
  85. Float_t z_vertex_mpd;
  86. Long_t n_tracks_mc;
  87. Float_t eta_mc[_MAX_TRACKS];
  88. Float_t pt_mc[_MAX_TRACKS];
  89. Int_t mother_ID_mc[_MAX_TRACKS];
  90. Int_t PDG_code_mc[_MAX_TRACKS];
  91. Float_t px_mc[_MAX_TRACKS];
  92. Float_t py_mc[_MAX_TRACKS];
  93. Float_t pz_mc[_MAX_TRACKS];
  94. Float_t start_x_mc[_MAX_TRACKS];
  95. Float_t start_y_mc[_MAX_TRACKS];
  96. Float_t start_z_mc[_MAX_TRACKS];
  97. Float_t mass_mc[_MAX_TRACKS];
  98. Float_t energy_mc[_MAX_TRACKS];
  99. Long_t n_tracks_mpd;
  100. Long_t k_tracks_mpd;
  101. Float_t eta_mpd[_MAX_TRACKS];
  102. Float_t phi_mpd[_MAX_TRACKS];
  103. Float_t theta_mpd[_MAX_TRACKS];
  104. Int_t TOF_flag_mpd[_MAX_TRACKS];
  105. Float_t ZDC_energy_mpd[_N_MODULES_TOTAL];
  106. Float_t pid_tpc_prob_electron_mpd[_MAX_TRACKS];
  107. Float_t pid_tpc_prob_pion_mpd[_MAX_TRACKS];
  108. Float_t pid_tpc_prob_kaon_mpd[_MAX_TRACKS];
  109. Float_t pid_tpc_prob_proton_mpd[_MAX_TRACKS];
  110. Float_t pid_tof_prob_electron_mpd[_MAX_TRACKS];
  111. Float_t pid_tof_prob_pion_mpd[_MAX_TRACKS];
  112. Float_t pid_tof_prob_kaon_mpd[_MAX_TRACKS];
  113. Float_t pid_tof_prob_proton_mpd[_MAX_TRACKS];
  114. Float_t tof_beta_mpd[_MAX_TRACKS];
  115. Float_t tof_mass2_mpd[_MAX_TRACKS];
  116. Float_t dEdx_tpc_mpd[_MAX_TRACKS];
  117. Float_t chi2_mpd[_MAX_TRACKS];
  118. Float_t chi2_vertex[_MAX_TRACKS];
  119. Float_t pt_error_mpd[_MAX_TRACKS];
  120. Float_t theta_error_mpd[_MAX_TRACKS];
  121. Float_t phi_error_mpd[_MAX_TRACKS];
  122. Float_t DCA_x_mpd[_MAX_TRACKS];
  123. Float_t DCA_y_mpd[_MAX_TRACKS];
  124. Float_t DCA_z_mpd[_MAX_TRACKS];
  125. Float_t DCA_x_mc[_MAX_TRACKS];
  126. Float_t DCA_y_mc[_MAX_TRACKS];
  127. Float_t DCA_z_mc[_MAX_TRACKS];
  128. Int_t n_hits_mpd[_MAX_TRACKS];
  129. Int_t n_hits_poss_mpd[_MAX_TRACKS];
  130. Float_t signed_pt_mpd[_MAX_TRACKS];
  131. Float_t p_mpd[_MAX_TRACKS];
  132. Bool_t isPIDTofTpc[_MAX_TRACKS];
  133. Bool_t isPIDTpc[_MAX_TRACKS];
  134. Int_t centrality_tpc_mpd;
  135. FairMCEventHeader *MCHeader;
  136. TClonesArray *MCTracks;
  137. MpdEvent *MPDEvent;
  138. TClonesArray *ZDCHits;
  139. TClonesArray *MpdGlobalTracks;
  140. MpdZdcDigi* ZDCHit;
  141. TClonesArray *mpdKalmanTracks;
  142. TClonesArray *vertexes;
  143. TRandom *RNG = new TRandom();
  144. Float_t multiplicity_bins[NmultiplicityBins+1];
  145. TH1F *h_multiplicity_before;
  146. ClassDef(reducedTreeCreator,1);
  147. };
  148. #endif