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