HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoSimStrips.cxx
Go to the documentation of this file.
1 #include "HarpoSimStrips.h"
2 
3 #include "TMath.h"
4 
5 
6 ClassImp(HarpoSimStrips)
7 
8 
10 TObject(),
11  fStripId(-1),
12  fTime(-1),
13  fQ(-1)
14 {
15 }
16 
17 HarpoSimStripHit::HarpoSimStripHit(Int_t stripId, Double_t t, Double_t q) :
18 TObject(),
19  fStripId(stripId),
20  fTime(t),
21  fQ(q)
22 {
23 }
24 
26  TObject(hit),
27  fStripId(hit.fStripId),
28  fTime(hit.fTime),
29  fQ(hit.fQ)
30 {
31 }
32 
33 
35 {
36 
37  Info("HarpoSimStrip","Creating");
38 
39  fStripHitsX = new TClonesArray("HarpoSimStripHit",fkMaxNhits);
40  fStripHitsY = new TClonesArray("HarpoSimStripHit",fkMaxNhits);
41 
42  fNhitsX = 0;
43  fNhitsY = 0;
44  fTrackId = -1;
45  fStripWidth = 1.;
46 }
47 
49  TObject(strips),
50  fStripHitsX(strips.fStripHitsX),
51  fStripHitsY(strips.fStripHitsY),
52  fNhitsX(strips.fNhitsX),
53  fNhitsY(strips.fNhitsY),
54  fTrackId(strips.fTrackId),
55  fStripWidth(strips.fStripWidth)
56 {
57 
58  // fStripHitsX = new TClonesArray("HarpoSimStripHit",fkMaxNhits);
59  // fStripHitsY = new TClonesArray("HarpoSimStripHit",fkMaxNhits);
60 
61 }
62 
64 {
65 
66  fStripHitsX->Delete();
67  fStripHitsY->Delete();
68 
69 }
70 
72 {
73  // fStripHitsX->Delete();
74  // fStripHitsY->Delete();
75  fStripHitsX = new TClonesArray("HarpoSimStripHit",fkMaxNhits);
76  fStripHitsY = new TClonesArray("HarpoSimStripHit",fkMaxNhits);
77  fNhitsX = 0;
78  fNhitsY = 0;
79  return 1;
80 }
81 
82 Int_t HarpoSimStrips::AddHit(Int_t plane, Int_t ch, Double_t t, Double_t q)
83 {
84 
85  if(plane==0){
86  if(fNhitsX>=fkMaxNhits) return -1;
87  new((*fStripHitsX)[fNhitsX]) HarpoSimStripHit(ch,t,q);
88  fNhitsX++;
89  }
90  if(plane==1){
91  if(fNhitsY>=fkMaxNhits) return -1;
92  new((*fStripHitsY)[fNhitsY]) HarpoSimStripHit(ch,t,q);
93  fNhitsY++;
94  }
95 
96  return 1;
97 }
98 
99 
100 // Int_t HarpoSimStrips::AddCharge(Double_t charge, Double_t sigma, Double_t x, Double_t y, Double_t t)
101 // {
102 
103  // if(fNhitsX>=fkMaxNhits) return -1;
104 
105  // //Info("AddCharge","%d %g %g %g %g %g",fNhitsX,charge,sigma,x,y,t);
106 
107 
108  // // Find Strip number (X coordinate)
109  // Int_t iX = Int_t((x + 150.)/fStripWidth);
110  // Int_t iY = Int_t((y + 150.)/fStripWidth);
111 
112  // Int_t nbins = Int_t(3*sigma/fStripWidth);
113  // for(Int_t i = iX - nbins; i<iX+nbins+1; i++){
114  // Double_t Xi1 = fStripWidth*i-150;
115  // Double_t Xi2 = Xi1 + 0.379;
116  // Double_t Xi3 = Xi2 + 0.1;
117  // Double_t Xi4 = Xi2 + 0.421;
118  // Double_t chX = TMath::Abs(TMath::Erf((x-Xi1)/sigma) - TMath::Erf((x-Xi2)/sigma));
119  // Double_t chY = TMath::Abs(TMath::Erf((x-Xi3)/sigma) - TMath::Erf((x-Xi4)/sigma));
120  // chX *= charge;
121  // chY *= charge;
122  // if(chX>0.1 && fNhitsX<fkMaxNhits && i>=0 && i<NSTRIPSX){
123  // new((*fStripHitsX)[fNhitsX]) HarpoSimStripHit(i,t,chX);
124  // fNhitsX++;
125  // }
126  // for(Int_t j = iY - nbins; j<iY+nbins+1; j++){
127  // if(j<0 || j>=NSTRIPSY) continue;
128  // Double_t Yj1 = fStripWidth*j-150;
129  // Double_t Yj2 = Yj1 + 0.9;
130  // Double_t ch = TMath::Abs(TMath::Erf((y-Yj1)/sigma) - TMath::Erf((y-Yj2)/sigma));
131  // ch *= chY;
132  // if(ch>0.1 && fNhitsY<fkMaxNhits){
133  // new((*fStripHitsY)[fNhitsY]) HarpoSimStripHit(j,t,ch);
134  // fNhitsY++;
135  // }
136  // }
137 
138  // }
139 
140  // return 1;
141 
142 // }
static const Int_t fkMaxNhits
TClonesArray * fStripHitsY
TClonesArray * fStripHitsX
Int_t AddHit(Int_t plane, Int_t ch, Double_t t, Double_t q)
virtual ~HarpoSimStrips()
Double_t fStripWidth