FairRoot/PandaRoot
PndLmdPerformanceTask.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndLmdPerformance Task header file -----
3 // ----- Based on PndLmdGeaneTask -----
4 // ----- Author: Prometeusz Jasinski -----
5 // -------------------------------------------------------------------------
6 
7 
14 #ifndef PndLmdPerformanceTask_H
15 #define PndLmdPerformanceTask_H
16 
17 // framework includes
18 #include "FairTask.h"
19 #include "TH1.h"
20 #include "TH2.h"
21 #include <TRotation.h>
22 #include <TVector3.h>
23 #include "GFTrackCand.h"
24 #include "FairGeanePro.h"
25 #include "TFile.h"
26 #include "TString.h"
27 #include "TH2Poly.h"
28 
29 //#include "PndSdsGeoHandling.h"
30 #include "PndGeoHandling.h"
31 #include "FairGeanePro.h"
32 #include "TGeoManager.h"
33 #include <vector>
34 #include <map>
35 
36 class TClonesArray;
37 class PndSdsCluster;
38 class TGeant3;
39 
40 // some design constants of the LUMI detector
41 const unsigned int nplanes(4);
42 const unsigned int nsensors_per_plane(100);//(12);
43 const unsigned int nmdules_per_plane(10);
44 
45 class PndLmdPerformanceTask: public FairTask {
46 public:
47 
50 
52  PndLmdPerformanceTask(Double_t pBeam, TVector3 IP);
53 
56 
58  virtual void SetParContainers();
59  virtual InitStatus Init();
60 
62  /*void Propagate(TVector3 pos, // position of the measured track
63  TVector3 mom, // direction and momentum of the measured track
64  int pdgcode, // particle type to be propagated
65  TVector3 ip, // initial point assumed to be the origin of the track
66  TVector3& initpos, // position after back tracking via distance of closest approach to ip
67  TVector3& initdir // initial momentum (assumed) will be changed to direction and momentum after back tracking
68  );*/
69 
71  virtual void Exec(Option_t* opt);
72 
73  virtual void Finish();
74 
75  // to save the output histograms into a file that you prefere
76  // it is mandatory to provide that filename
78 
79 private:
80 
81  TClonesArray* fTrackParGeane;
82  TClonesArray* fTrackParIni;
83  TClonesArray* fTrackParFinal;
84  TClonesArray* fDetName;
85 
86  FairGeanePro* fPro;
88  TGeoManager* fgGeoMan;
89  int fEventNr;
92  Int_t fPDGid;
93  TVector3 vtx;
94 
95  std::map<int, std::vector<int> > fTrackPixHitIdMap; //Track -> PixHitId
96  std::map<int, std::vector<int> > fTrackStripHitIdMap; //Track -> StripHitId
97 
98  // hits per each plane are stored event wise in this map
99  std::map<int, std::vector<TVector3> > fTrackPlaneHitMap;
100  // momenta of possibly more than one anti proton at
101  std::map<int, std::vector<TVector3> > fTrackMCVectMapIn; // the a plane of the detector
102  std::vector<TVector3> fTrackMCVectMapInit; // the initial point at the target
103 
104  // Input Data ----------
105  TClonesArray* fMCHits;
106  /* TClonesArray* fMCTracks; */
107 
108  TClonesArray* fTracks; //Real tracks
109  TClonesArray* fHits; //Real hits
110 
111 
112  //--- MC info -----------------------------------------------------------------
113  TClonesArray* true_tracks;
114  TClonesArray* true_points;
115  //----------------------------------------------------------------------------------
116 
117 
118  //--- Digitization info ------------------------------------------------------------
119  TClonesArray* fStripClusterArray;
120  TClonesArray* fStripDigiArray;
121  //----------------------------------------------------------------------------------
122 
123  //--- Real Hits --------------------------------------------------------------------
124  TClonesArray* rechit_array;
125  //----------------------------------------------------------------------------------
126 
127 
128  //--- Track Candidate ---------------------------------------------------------------
129  TClonesArray* trkcand_array;
130  //-----------------------------------------------------------------------------------
131 
132  //--- Real tracks -------------------------------------------------------------------
133  TClonesArray* rec_trk;
134  //----------------------------------------------------------------------------------
135  // Output Data -------
136 
137  // performance histograms
140 
141  // spatial acceptance in x and y at the first lumi plane
144 
145  // theta over momentum acceptance
148 
149  // phi over momentum acceptance
152 
153  TTree* tree_results;
154  // initial momenta of the antiprotons
155  double px_init;
156  double py_init;
157  double pz_init;
158  double ptheta_init;
159  double pphi_init;
160  // momenta at the entry of a detector plane
161  // in the reference system of the LUMI
162  double px_in;
163  double py_in;
164  double pz_in;
165  double ptheta_in;
166  double pphi_in;
167  // position at the entry of a detector plane
168  // in the reference system of the LUMI
169  double x_in;
170  double y_in;
171  double z_in;
172  // detector and sensor id of the mc hits
173  int det_id;
174  int sens_id;
175  // calculated plane and sensor in plane id
176  int plane;
177  int sensor;
178  // variables due to new HVMAPS setup
180  double x_in_mod; // reference frame on the module surface
181  double y_in_mod;
182  double z_in_mod;
183  double x_in_sens; // reference frame on the sensor
184  double y_in_sens;
185  double z_in_sens;
186  double x_in_sens_al; // aligned reference frame on the sensor
187  double y_in_sens_al;
188  double z_in_sens_al;
189  double x_in_aligned; // reference frame on the module surface
190  double y_in_aligned; // aligned coordinates in the lumi frame
191  double z_in_aligned;
192  double theta_prop;
194  bool missed;
195 
196  // Drawing directly from a tree is elegant but slow as every Draw call
197  // loops over the whole tree of events
198  // Better it is to create the desired histograms in advance
199  // and to fill those on event by event basis simultaneously
200 
201  // histograms per plane
210 
211  // histograms per sensor
221 
222  // histograms for geane tests
225 
226  TRotation inv_lmdrotation;
228 
230 
231  void Register();
232 
233  void Reset();
234 
235  void ProduceHits();
236 
237  double last_percent;
238  int fnevents;
239  unsigned int fievent;
240  // draw a progress bar only when the length changes significantly
241  void DrawProgressBar(int len, double percent);
242 
243  std::map<int, std::vector<int> > AssignHitsToTracks();
244 
245 ClassDef(PndLmdPerformanceTask,1)
246  ;
247 
248 };
249 
250 #endif
const int nplanes(120)
void DrawProgressBar(int len, double percent)
TH2 * hists_xy_local[nplanes][nsensors_per_plane]
const unsigned int nmdules_per_plane(10)
Class to store the Digis which belong to one cluster This class holds the information which Digi belo...
Definition: PndSdsCluster.h:19
TH1 * hists_theta_rec_diff_rel[nplanes][nsensors_per_plane]
TH1 * hists_theta_diff_rel[nplanes][nsensors_per_plane]
virtual void Exec(Option_t *opt)
std::map< int, std::vector< TVector3 > > fTrackMCVectMapIn
TH1 * hists_theta_in[nplanes][nsensors_per_plane]
TH2 * hists_xy_local_cvd[nplanes][nmdules_per_plane]
std::map< int, std::vector< int > > fTrackPixHitIdMap
Class to access the naming information of the MVD.
Double_t
void SetHistFilename(TString filename)
std::vector< TVector3 > fTrackMCVectMapInit
const unsigned int nsensors_per_plane(100)
TH2 * hist_theta_rec_diff_rel[nplanes]
virtual InitStatus Init()
TH2 * hists_xy[nplanes][nsensors_per_plane]
std::map< int, std::vector< TVector3 > > fTrackPlaneHitMap
TH1 * hists_theta_diff[nplanes][nsensors_per_plane]
std::map< int, std::vector< int > > fTrackStripHitIdMap
TH2 * hist_theta_diff_rel[nplanes]
TH1 * hists_theta_init[nplanes][nsensors_per_plane]
std::map< int, std::vector< int > > AssignHitsToTracks()
TH2 * hist_theta_rec_diff[nplanes]
TH1 * hists_theta_rec_diff[nplanes][nsensors_per_plane]
const string filename