PandaRoot
PndDrcRecoLookupMap.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndDrcRecoLookupMap header file -----
3 // ----- Created 30/09/11 by Maria Patsyuk -----
4 // ----- -----
5 // ----- -----
6 // -------------------------------------------------------------------------
7 
16 #ifndef PNDDRCRECOLOOKUPMAP_H
17 #define PNDDRCRECOLOOKUPMAP_H
18 
19 #include "FairTask.h"
20 #include "TClonesArray.h"
21 #include "PndMCTrack.h"
22 #include "PndDrcHit.h"
23 #include "PndDrcPDHit.h"
24 #include "PndStack.h"
25 #include "FairBaseParSet.h"
26 #include "PndGeoDrcPar.h"
27 #include "TString.h"
28 #include <string>
29 #include "PndDrcDigiPar.h"
30 #include "PndDrcDigi.h"
31 #include "PndGeoHandling.h"
32 
33 #include "TH1.h"
34 #include "TH2.h"
35 #include "TTree.h"
36 #include "TGraph2D.h"
37 #include "TColor.h"
38 #include "TStyle.h"
39 #include "TLine.h"
40 #include "TPolyLine.h"
41 
42 #ifndef ROOT_TParticlePDG
43 #include "TParticlePDG.h"
44 #endif
45 #ifndef ROOT_TDatabasePDG
46 #include "TDatabasePDG.h"
47 #endif
48 
49 class PndDrcRecoLookupMap : public FairTask {
50 
51  public:
54 
56  PndDrcRecoLookupMap(Int_t verbose);
57 
59  virtual ~PndDrcRecoLookupMap();
60 
61  virtual InitStatus Init();
62 
64  virtual void Exec(Option_t *option);
65 
67  virtual void Finish();
68 
69  void SetHistoWidth(double wid = 0.01) { fWidth = wid; } // 0.01
70  void SetNSigma(double nsig = 3.) { fNSigma = nsig; }
71  void SetMagneticField(double mag = 0.) { fB = mag; } // [Tesla]
72  void SetOutputFile(TString outName = "PndDrcRecoLookupMap_output.root") { fOutputName = outName; }
73 
74  void SetPlotStyle()
75  {
76  const Int_t NRGBs = 5;
77  const Int_t NCont = 255;
78 
79  Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
80  Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
81  Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
82  Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
83  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
84  gStyle->SetNumberContours(NCont);
85  }
86 
88  {
89  // drawing of detector layout
90  Double_t theta = (180. - 2 * fGeo->PipehAngle()) / fGeo->BBoxNum() / 180. * 3.1415; //[rad]
91  // std::cout<<"-I- DrawLayout: theta = "<<theta<<std::endl;
92  Double_t rad_out = 102.6; // 104.0; // PD outer radius
93  Double_t rad_in = 49.15; // 50.53; // PD inner radius
94  Double_t rp_out = rad_out / cos(theta);
95  Double_t rp_in = rad_in / cos(theta);
96  Double_t xout[4], yout[4], xin[4], yin[4];
97  for (Int_t i = 0; i < 4; i++) {
98  xout[i] = rp_out * cos(2.0 * (i - 1) * theta);
99  yout[i] = rp_out * sin(2.0 * (i - 1) * theta);
100  xin[i] = rp_in * cos(2.0 * (i - 1) * theta);
101  yin[i] = rp_in * sin(2.0 * (i - 1) * theta);
102  TLine *l1 = new TLine(xout[i], yout[i], xin[i], yin[i]);
103  l1->Draw("same");
104  }
105  TPolyLine *p1 = new TPolyLine(4, xout, yout);
106  p1->SetFillColor(kYellow);
107  p1->Draw("same");
108  TPolyLine *p2 = new TPolyLine(4, xin, yin);
109  p2->SetFillColor(0);
110  p2->Draw("same");
111  //--------------------------
112  }
113 
114  protected:
115  private:
116  void ProcessPhotonHit();
117  void ProcessPhotonMC();
118  void WriteToFile();
119  void CreateHisto();
120  void DrawHisto();
121  void ProcessBarHit();
122 
123  // parameters:
124  Double_t fpi;
125  Double_t fR;
126  Double_t fzup;
127  Double_t fzdown;
128  Double_t fHThick;
129  Double_t fBboxNum;
130  Double_t fBarNum;
131  Double_t fPipehAngle;
132  Double_t fBarBoxGap;
133  Double_t fLSide;
134  Double_t fBarWidth;
135  Double_t fDphi;
136 
137  // look up table
138  virtual void SetParContainers();
139  PndDrcDigiPar *fDigiPar;
140 
141  Double_t InBarCoordSyst(TVector3, TVector3 *, TVector3 *, TVector3 *, TVector3 *);
142  Double_t SectorNum(Double_t, Double_t);
143  Int_t NumberOfBounces(TVector3, TVector3, Int_t);
144  Double_t FindOutPoint(Double_t, Double_t, Double_t, Double_t *, Bool_t);
145  Double_t CherenkovPhi(TVector3, TVector3, Double_t *, Double_t *);
146  Double_t RecoAmbigTime(TVector3, TVector3, Double_t *, Bool_t);
147  void DrawBarBox(TVector3, TVector3, TVector3, TVector3);
148  Int_t fDetectorID;
149 
150  TClonesArray *fBarPointArray; // DRC MC points in the bars
151  TClonesArray *fPDPointArray; // DRC points in the photon detector
152  TClonesArray *fHitArray; // DRC Hits in the bars
153  TClonesArray *fPDHitArray; // DRC Hits in the photon detector
154  TClonesArray *fMCArray; // DRC Hits in the photon detector
155  TClonesArray *fDigiArray;
156 
157  // TClonesArray* fChPhoArray; // output array of PndChPho
158  TClonesArray *fDrcLutInfoArray;
159 
160  TList *fHistoList;
161 
162  PndGeoDrc *fGeo;
163  PndGeoHandling *fGeoH;
164 
166  void SetDefaultParameters();
167 
169  Int_t fVerbose;
170 
171  Int_t nevents;
172 
173  TString fOutputName;
174  Double_t fWidth;
175  Double_t fPixelSize;
176  Double_t fHAngleInBDeg;
177 
178  Double_t fCHrecoMin;
179  Double_t fCHrecoMax;
180  Double_t fNSigma;
181  Double_t fB;
182 
183  TVector3 fnX1;
184  TVector3 fnY1;
185 
186  Double_t flambdah;
187  Double_t fpixID;
188  Double_t fxbar;
189  Double_t fybar;
190  Double_t fxPHit;
191  Double_t fyPHit;
192  Double_t fzPHit;
193  Double_t ftime;
194  Double_t ftime0;
195  Double_t fPhiRot;
196  TVector3 fPMo;
197  TVector3 fPMoB;
198  TVector3 fPphoInit;
199  TVector3 fkBar;
200  Double_t fWeight;
201  Int_t fBarId;
202 
203  Bool_t print;
204 
205  // look up parameters
206  Int_t NHitPix;
207  Int_t NPixPar;
208  Int_t NAmb;
209 
210  Double_t fkxBar, fkyBar, fkzBar;
211  Double_t fPxMoBar, fPyMoBar, fPzMoBar;
212  Double_t fxnew, fynew;
213  Double_t CHexp;
214  Double_t CHreal;
215  TVector3 fPphoB; // kBar
216  TVector3 fStartVertex;
217  TVector3 fPphoPD;
218  Double_t fPath;
219 
220  // vertices of hit BarBox
221  TVector3 fBBver1;
222  TVector3 fBBver2;
223  TVector3 fBBver3;
224  TVector3 fBBver4;
225 
226  std::vector<TH1F *> PhiThetaPoints;
227  std::vector<TH1F *> PhiThetaPointsCut;
228  std::vector<TH1F *> PhiThetaPointsWeight;
229  std::vector<TH1F *> NboPoints;
230  TH2F *fMapHist;
231  TH2F *fSigHist;
232  TH2F *fCheHist;
233  TH2F *fkBarXHist;
234  TH2F *fkBarYHist;
235 
236  // time resolution
237  TF1 *timeres;
238 
239  TH1D *fhPDTime;
240  TH2D *fhPDHits;
241  TH1F *fhDiff;
242 
243  TH2F *fhRecoT1;
244  TH1F *fhCHreal;
245  TH1F *fhLam;
246 
247  TH2F *fhNboLam;
248 
249  ClassDef(PndDrcRecoLookupMap, 1)
250 };
251 
252 #endif
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:119
Double_t BBoxNum()
Definition: PndGeoDrc.h:136
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:118
void SetNSigma(double nsig=3.)
virtual void Exec(Option_t *option)
unsigned int i
Definition: P4_F32vec4.h:21
void SetHistoWidth(double wid=0.01)
Double_t PipehAngle()
Definition: PndGeoDrc.h:139
void SetOutputFile(TString outName="PndDrcRecoLookupMap_output.root")
Class to access the naming information of the MVD.
virtual void Finish()
virtual ~PndDrcRecoLookupMap()
virtual InitStatus Init()
Digitization Parameter Class for DIRC barrel part.
Definition: PndDrcDigiPar.h:28
void SetMagneticField(double mag=0.)