forked from ActarSimGroup/Actarsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdigit.h
1957 lines (1760 loc) · 86.4 KB
/
digit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////////////////////////////////////////////////////////
//*-- AUTHOR : Hector Alvarez-Pol
//*-- Date: 06/2006
//*-- Last Update: 28/10/15
//*-- Copyright: GENP (Univ. Santiago de Compostela)
//
// --------------------------------------------------------------
//
// --------------------------------------------------------------
// Technical details...
// diffusion: gaussian with sigma = sqrt(2Dx/w)
// where D is the field dependent diff. coefficient, w the drift
// velocity and x the distance
// as described in A. Peisert and F. Sauli CERN84-08 (1984)
//
// --------------------------------------------------------------
// How to run this program:
// 1 - Run the simulation
// actarsim batch1.mac
// 2 - Open a root session
// root -l
// 3 - Run this macro inside root
// gSystem->Load("libactar.sl");
// .L digitizationMacro.C+
//
// thePadsGeometry.SetGeometryValues(Int_t geometryType,
// Int_t padType,
// Int_t layout,
// Double_t xLength,
// Double_t yLength,
// Double_t zLength,
// Double_t xBeamShift,
// Double_t yBeamShift,
// Double_t radius,
// Double_t padSize);
// where all distances are in mm
//
// or use a predefined geometry
// thePadsGeometry.SetGeometryValues("ActarTPCDemo")
//
// theDriftManager.SetDriftVelocity(Double_t velocity); in mm/ns
// theDriftManager.SetDiffusionParameters(Double_t long,
// Double_t trans); in mm^2/ns
// theDriftManager.SetMagneticField(Double_t mag); NOT WORKING YET
// theDriftManager.SetLorentzAngle(Double_t lor); in radians
//
// theAmplificationManager.SetIsWireOn(); for a MAYA-like ACtive TARget
// theAmplificationManager.SetWireAmplificationParameters(ra,s,h);
//
// ra: radius of amplification wire: 5, 10, and 20 mu
// s: spacing between two amplification wires: 2 or 2.3 mm
// h: distance between the amplification wire and induction pads: 10 mm
//
// (Optionally you can set theAmplificationManager.SetOldChargeCalculation(); for old Style calculations)
// digitEvents(inputFile, outputFile, run#, numberOfEvents);
//
// the number within brackets means:
// the geometryType (0 for a box, 1 for cylinder)
// the padType (0 for square, 1 for hexagonal)
// the layout, only effective for hexagonal pads, (0, MAYA-type, 1: rotated 90 degrees)
// the radius is the radius if the cylinder
// the xLength is the half-length of the box along x
// the yLength is the half-length of the box along y
// the zLength is the half-length of the box along z
// the xBeamShift is the distance between beam axis and GasBox center along x
// the yBeamShift is the distance between beam axis and GasBox center along y
// the padSize is the square or hexagonal pad side
// the velocity is the drift velocity in the gas
// the long and trans are the longitudinal and transversal diffusion
// coefficients in the gas
// the mag is the magnetic field inside the gas
// the inputFile (output of the simulation)
// the outputFile (output of the digitization)
// the run numbers (begin in 0)
///////////////////////////////////////////////////////////////////////
//
// NOTE: it is possible to digitize over the endcaps of a cylinder
// using the following method:
//
// 1) simulate in GEANT the reaction on a cylinder. Use the typical
// GEANT4 directions and conventions
// 2) run this digitization macro following the previous instructions,
// with the following details:
// a)use a box in when selecting the geometry with xlength and zlength
// equal to the radius, and yLength equal to the tube length
// b)call the function
// thePadsGeometry.SetEndCapModeOn()
// This will change the data of your track... the direction Z will
// be converted to Y and Y will be -X. Then, the typical box-like
// projection on plane XZ will be equivalent to a projection on the
// end cup of the cylinder.
//
#include <TObject.h>
#include <TVector3.h>
#include "include/ActarSimSimpleTrack.hh"
#include "include/ActarSimSilHit.hh"
#include <TTree.h>
#include <TF2.h>
#include <cmath>
#include <fstream>
#include <iostream>
#include <TMath.h>
#include <TClonesArray.h>
#include <TString.h>
#include <TRandom.h>
using namespace std;
Int_t DIGI_DEBUG=0; //A global DEBUG variable:
//0 absolutly no output (quiet)
//1 minimum output when trouble, status or warnings
//2 tracking the functions behavior
//3 tracking with increased verbosity
//4 full verbosity
class ActarPadSignal;
class projectionOnPadPlane;
class padsGeometry;
class amplificationManager;
class driftManager;
Float_t Polya(Float_t param=3.2){
//
// Gain distribution according to a Polya function
// The first time this function is called, the integral of the Polya function,
// [ taken from Bellazzini et al NIMA 581 (2007) 246 ]
// is calculated (with N=1).
// Returns a random gain according to the gain distribution.
//
static Short_t firstcall=0;
static Float_t integral[1000];
Int_t check=0;
Int_t i=0;
Float_t f = 0.;
Float_t buff[1000];
Float_t lambda;
Float_t step=0.01;
Float_t shift=0.005;
Float_t pran=0;
if(firstcall==0){
for(i=0;i<1000;i++){
lambda=i*step+shift; //gain: number of electrons produced for a single incoming electron
buff[i]=pow(param,param)/TMath::Gamma(param)*pow(lambda,param-1)*exp(-param*lambda);
if(i>0)
integral[i]=integral[i-1]+buff[i];
else
integral[i]=buff[i];
}
firstcall=1;
}
while(check==0){
f=gRandom->Rndm();
if(f>0.0001 && f<0.9999) check=1;
}
i=0;
while(i<1000){
if(f<integral[i]/integral[999]){
pran=i*step+shift;
break;
}
i++;
}
return pran;
}
class ActarPadSignal : public TObject {
private:
//Basic Pad information
Int_t padNumber; //pad control number
Int_t padRow; //pad address: row
Int_t padColumn; //pad address: column
Int_t numberOfStrides; //number of strides on the pad
//TIME CONTENT IS GOING TO BE SOON MODIFIED TO REPRODUCE A GET SIGNAL
Double_t initTime; //first induction time
Double_t finalTime; //last induction time
Double_t sigmaTime; //sigma in induction time
Double_t chargeDeposited; //charge deposited
Int_t eventID;
Int_t runID;
public:
ActarPadSignal();
~ActarPadSignal();
void Reset(void);
ActarPadSignal& operator=(const ActarPadSignal &right);
Int_t GetPadNumber(){return padNumber;}
Int_t GetPadRow(){return padRow;}
Int_t GetPadColumn(){return padColumn;}
Int_t GetNumberOfStrides(){return numberOfStrides;}
Double_t GetInitTime(){return initTime;}
Double_t GetFinalTime(){return finalTime;}
Double_t GetSigmaTime(){return sigmaTime;}
Double_t GetChargeDeposited(){return chargeDeposited;}
Int_t GetEventID(){return eventID;}
Int_t GetRunID(){return runID;}
void SetPadNumber(Int_t pad){padNumber=pad;}
void SetPadRow(Int_t pad){padRow=pad;}
void SetPadColumn(Int_t pad){padColumn=pad;}
void SetNumberOfStrides(Int_t num){numberOfStrides=num;}
void SetInitTime(Double_t time){initTime=time;}
void SetFinalTime(Double_t time){finalTime=time;}
void SetSigmaTime(Double_t time){sigmaTime=time;}
void SetChargeDeposited(Double_t cha){chargeDeposited = cha;}
void SetEventID(Int_t id){eventID=id;}
void SetRunID(Int_t id){runID=id;}
ClassDef(ActarPadSignal,1);
};
ActarPadSignal::ActarPadSignal(){
if(DIGI_DEBUG>3) cout << "Enters ActarPadSignal::ActarPadSignal()" << endl;
padNumber=0; padRow=0; padColumn=0;
numberOfStrides=0;
initTime=0.; finalTime=0.; sigmaTime=0.;
chargeDeposited=0.;
eventID=0; runID=0;
if(DIGI_DEBUG>3) cout << "Exits ActarPadSignal::ActarPadSignal()" << endl;
}
ActarPadSignal::~ActarPadSignal(){
}
void ActarPadSignal::Reset(void){
// clearing to defaults
if(DIGI_DEBUG>3) cout << "Enters ActarPadSignal::Reset()" << endl;
padNumber=0; padRow=0; padColumn=0;
numberOfStrides=0;
initTime=0.; finalTime=0.; sigmaTime=0.;
chargeDeposited=0.;
eventID=0; runID=0;
if(DIGI_DEBUG>3) cout << "Exits ActarPadSignal::Reset()" << endl;
}
ActarPadSignal& ActarPadSignal::operator=(const ActarPadSignal &right){
// overloading the copy operator, similar as it in the ActarSimSimpleTrack class
if(DIGI_DEBUG>3) cout << "Enters ActarPadSignal::operator=()" << endl;
if(this != &right){
padNumber = right.padNumber;
padRow = right.padRow;
padColumn = right.padColumn;
numberOfStrides = right.numberOfStrides;
initTime = right.initTime;
finalTime = right.finalTime;
sigmaTime = right.sigmaTime;
chargeDeposited = right.chargeDeposited;
eventID = right.eventID;
runID = right.runID;
}
if(DIGI_DEBUG>3) cout << "Exits ActarPadSignal::operator=()" << endl;
return *this;
}
class projectionOnPadPlane{
private:
ActarSimSimpleTrack* track; //the track to be projected
TVector3* pre; //projection of the initial point
TVector3* post; //projection of the final point
Double_t timePre; //drift time of the initial point
Double_t timePost; //drift time of the final point
Double_t sigmaLongAtPadPlane; //spatial spread at the pad plane
Double_t sigmaTransvAtPadPlane; //time spread at the pad plane
Int_t position; //0 still not calculated
//1 if any point is closer to the (0,0,z) than a delta (rho<delta)
//2 else if both points lies within the limits of the beamShielding
//3 else if one point is within the limits of the beamShielding
//4 else if both point lie in the gas outside the beamShielding
//5 if any point lies outside of the gas volume
public:
projectionOnPadPlane();
virtual ~projectionOnPadPlane();
ActarSimSimpleTrack* GetTrack(){return track;}
TVector3* GetPre(){return pre;}
TVector3* GetPost(){return post;}
Double_t GetTimePre(){return timePre;}
Double_t GetTimePost(){return timePost;}
Double_t GetSigmaLongAtPadPlane(){return sigmaLongAtPadPlane;}
Double_t GetSigmaTransvAtPadPlane(){return sigmaTransvAtPadPlane;}
Int_t GetPosition(){return position;}
void SetTrack(ActarSimSimpleTrack* tr){track = tr;}
void SetPre(TVector3* ve){pre = ve;}
void SetPost(TVector3* ve){post = ve;}
void SetTimePre(Double_t time){timePre = time;}
void SetTimePost(Double_t time){timePost = time;}
void SetSigmaLongAtPadPlane(Double_t del){sigmaLongAtPadPlane = del;}
void SetSigmaTransvAtPadPlane(Double_t del){sigmaTransvAtPadPlane = del;}
void SetPosition(Int_t pos){position=pos;}
ClassDef(projectionOnPadPlane,1);
};
projectionOnPadPlane::projectionOnPadPlane(){
if(DIGI_DEBUG>3) cout << "Enters projectionOnPadPlane::projectionOnPadPlane()" << endl;
track=0; pre=new TVector3(1,1,1); post=new TVector3(1,1,1);
timePre=-1.; timePost=-1.;
sigmaLongAtPadPlane=-1.; sigmaTransvAtPadPlane=-1.;
position=0;
if(DIGI_DEBUG>3) cout << "Exits projectionOnPadPlane::projectionOnPadPlane()" << endl;
}
projectionOnPadPlane::~projectionOnPadPlane(){
if(DIGI_DEBUG>3) cout << "Enters projectionOnPadPlane::~projectionOnPadPlane()" << endl;
delete pre;
delete post;
if(DIGI_DEBUG>3) cout << "Exits projectionOnPadPlane::~projectionOnPadPlane()" << endl;
}
class padsGeometry{
private:
Int_t numberOfColumns; //columns: determined by the Z length
Int_t numberOfRows; //rows: determined by the sizes of pads and ACTAR
Int_t numberOfPads; //number of pads in the detector
//PADS, ROWS & COLUMNS begin in 1
//(if numberOfRows=80, then there are rows from 1 to 80).
Int_t geoType; //geometry type (0 box, 1 tube)
Int_t padType; //pad type (0 square, 1 hexagon)
Int_t padLayout; // layout pattern for hexagon pads
// (0: MAYA like, 1: rotated MAYA-like)
Double_t padSize; //pads size (square side or hexagon side)
Double_t rHexagon; //for hexagon only, the apothem
Double_t radius; // cylinder: radius
Double_t xLength; //all are half-length! dimension for the box case
Double_t yLength;
Double_t zLength;
Double_t xBeamShift; //distance between beam axis and GasBox center along x
Double_t yBeamShift; //distance between beam axis and GasBox center along y
Double_t sideBlankSpaceX; // length of blank space between the GasBox and the Pad (both side in X direction)
Double_t sideBlankSpaceZ; // length of blank space between the GasBox and the Pad (both side in Z direction)
Double_t deltaProximityBeam; //to avoid strides to close to the beam
Double_t sizeBeamShielding; //radius of the beam shielding cylinder
Int_t endCapMode; //set to 1 for projection on the end cups
public:
padsGeometry();
virtual ~padsGeometry();
void SetPadsGeometry(void);
void SetGeometryValues(Int_t geo, Int_t pad, Int_t layout, Double_t x, Double_t y, Double_t z, Double_t xBeam, Double_t yBeam,
Double_t ra, Double_t psi, Double_t gapx, Double_t gapz){
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::SetGeometryValues()" << endl;
geoType=geo; padType=pad; padLayout=layout;
xLength = x; yLength = y; zLength = z;
xBeamShift = xBeam; yBeamShift = yBeam;
radius=ra; padSize=psi;
if(padType == 1)rHexagon = 0.8660254037844386467868626478 * padSize;
else rHexagon=0;
sideBlankSpaceX = gapx; sideBlankSpaceZ = gapz;
SetPadsGeometry();
if(DIGI_DEBUG>3) cout << "Exits padsGeometry::SetGeometryValues()" << endl;
}
void SetGeometryValues(TString DetectorConfig){
if(DetectorConfig=="ActarTPCDemo"){
geoType=0; padType=0; padLayout=0;
radius=0.; padSize=2.;
xLength = 37.; yLength = 85.; zLength = 69.;
xBeamShift = 0.; yBeamShift = 15.;
sideBlankSpaceX=5.; sideBlankSpaceZ=5.;
}
if(DetectorConfig=="ActarTPC"){
geoType=0; padType=0; padLayout=0;
radius=0.; padSize=2.;
xLength = 133.; yLength = 85.; zLength = 133.;
xBeamShift = 0.; yBeamShift = 15.;
sideBlankSpaceX=5.; sideBlankSpaceZ=5.;
}
SetPadsGeometry();
if(DIGI_DEBUG>3) cout << "Exits padsGeometry::SetGeometryValues()" << endl;
}
void SetNumberOfColumns(Int_t col){numberOfColumns=col;}
void SetNumberOfRows(Int_t row){numberOfRows=row;}
void SetNumberOfPads(Int_t pad){numberOfPads=pad;}
void SetGeoType(Int_t type){geoType=type;}
void SetPadType(Int_t type){padType=type;}
void SetPadLayout(Int_t layout){padLayout=layout;}
void SetPadSize(Double_t si){padSize=si;}
void SetRHexagon(Double_t si){rHexagon=si;}
void SetXLength(Double_t x){xLength=x;}
void SetYLength(Double_t y){yLength=y;}
void SetZLength(Double_t z){zLength=z;}
void SetXBeamShift(Double_t xBeam){xBeamShift=xBeam;}
void SetYBeamShift(Double_t yBeam){yBeamShift=yBeam;}
void SetSideBlankSpaceX(Double_t gapx){sideBlankSpaceX=gapx;}
void SetSideBlankSpaceZ(Double_t gapz){sideBlankSpaceZ=gapz;}
void SetRadius(Double_t ra){radius=ra;}
void SetDeltaProximityBeam(Double_t de){deltaProximityBeam=de;}
void SetSizeBeamShielding(Double_t le){sizeBeamShielding=le;}
void SetEndCapModeOn(){endCapMode=1;}
void SetEndCapModeOff(){endCapMode=0;}
Int_t GetNumberOfColumns(void){return numberOfColumns;}
Int_t GetNumberOfRows(void){return numberOfRows;}
Int_t GetNumberOfPads(void){return numberOfPads;}
Int_t GetGeoType(void){return geoType;}
Int_t GetPadType(void){return padType;}
Int_t GetPadLayout(void){return padLayout;}
Double_t GetPadSize(void){return padSize;}
Double_t GetRHexagon(void){return rHexagon;}
Double_t GetXLength(void){return xLength;}
Double_t GetYLength(void){return yLength;}
Double_t GetZLength(void){return zLength;}
Double_t GetXBeamShift(void){return xBeamShift;}
Double_t GetYBeamShift(void){return yBeamShift;}
Double_t GetSideBlankSpaceX(void){return sideBlankSpaceX;}
Double_t GetSideBlankSpaceZ(void){return sideBlankSpaceZ;}
Double_t GetRadius(void){return radius;}
Double_t GetDeltaProximityBeam(void){return deltaProximityBeam;}
Double_t GetSizeBeamShielding(void){return sizeBeamShielding;}
Int_t GetEndCapMode(void){return endCapMode;}
TVector3 CoordinatesCenterOfPad(Int_t pad);
Int_t IsInPadNumber(TVector3* point);
Int_t GetPadColumnFromXZValue(Double_t x, Double_t z);
Int_t GetPadRowFromXZValue(Double_t x, Double_t z);
Int_t CalculatePad(Int_t r, Int_t c){
//Pad number calculation from row and column (PADS, ROWS & COLUMNS begin in 1)
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::CalculatePad()" << endl;
if(r<=0 || r>numberOfRows || c<=0 || c>numberOfColumns){
if(DIGI_DEBUG>4) {
cout << "WARNING: padsGeometry:CalculatePad(" << r << "," << c
<<"): row or column number out of range!" << " row=" << r << ", col=" << c << endl;
}
return 0;
}
else return ((r-1) * numberOfColumns + (c-1) + 1);
}
Int_t CalculateColumn(Int_t p){
//Column calculation from pad (PADS, ROWS & COLUMNS begin in 1)
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::CalculateColumn()" << endl;
if(p>numberOfPads || p==0) return 0;
if(p%numberOfColumns==0) return numberOfColumns;
else return p%numberOfColumns;
}
Int_t CalculateRow(Int_t p){
//Row calculation from pad (PADS, ROWS & COLUMNS begin in 1)
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::CalculateRow()" << endl;
if(p>numberOfPads || p==0) return 0;
else return (Int_t)(((p-1)/numberOfColumns)+1);}
ClassDef(padsGeometry,1);
};
padsGeometry::padsGeometry(){
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::padsGeometry()" << endl;
numberOfColumns=0; numberOfRows=0; numberOfPads=0;
geoType=999; padType=999; padLayout=0;
padSize=0.; rHexagon=0.;
xLength=0; yLength=0; zLength=0;
sideBlankSpaceX=0.; sideBlankSpaceZ=0.;
radius=0.;
deltaProximityBeam=0.; sizeBeamShielding=0.;
endCapMode=0;
if(DIGI_DEBUG>3) cout << "Exits padsGeometry::padsGeometry()" << endl;
}
padsGeometry::~padsGeometry(){
}
void padsGeometry::SetPadsGeometry(void){
// the pads geometry should be calculated using this function
// from the sizes and types of ACTAR geometry and pads geometry
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::SetPadsGeometry()" << endl;
if(DIGI_DEBUG)
cout << "________________________________________________________" << endl
<< "In padsGeometry::SetPadsGeometry() " << endl
<< "Note that the calculation of the pads geometry could "<< endl
<< "modify slightly the size of the pad you have introduced." << endl;
if(geoType == 0 && padType == 0){ //box and square pad
numberOfRows = (Int_t) (2*(xLength-sideBlankSpaceX)/padSize);
if(DIGI_DEBUG)
cout << "User selected a box with square pads" << endl
<< "User selected a padSize = " << padSize;
padSize = (2*(xLength-sideBlankSpaceX)) / numberOfRows;
if(DIGI_DEBUG)
cout << " after the calculation: padSize = " << padSize <<endl;
numberOfColumns = ((Int_t) (2*(zLength-sideBlankSpaceZ) / padSize)) - 1;
if((numberOfColumns+1)*padSize <= 2*(zLength-sideBlankSpaceZ)) numberOfColumns++;
numberOfPads = numberOfRows*numberOfColumns;
if(DIGI_DEBUG)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::SetPadsGeometry() " << endl
<< " numberOfRows = "<< numberOfRows
<< ", numberOfColumns = " << numberOfColumns << endl
<< "________________________________________________________"<< endl;
}
else if(geoType == 0 && padType == 1 && padLayout==0){ //box and hexagonal pad with MAYA-type layout
numberOfColumns = (Int_t) (zLength/rHexagon);
if(DIGI_DEBUG)
cout << "User selected a box with hexagonal pads (MAYA-type)" << endl
<< "User selected a padSize = " << padSize
<< " and therefore a rHexagon = " << rHexagon<< endl;
rHexagon = zLength / numberOfColumns;
padSize = 1.154700538379251529013 * rHexagon;
if(DIGI_DEBUG)
cout << " after the calculation: padSize = " << padSize
<< " and therefore a rHexagon = " << rHexagon << endl;
numberOfRows = (Int_t) ((2.*xLength-2.*padSize)/(1.5*padSize))+1;
sideBlankSpaceX = (2.*xLength-(numberOfRows-1)*1.5*padSize-2.*padSize )/2.;
numberOfPads = numberOfRows*numberOfColumns;
if(DIGI_DEBUG)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::SetPadsGeometry() " << endl
<< " numberOfRows = "<< numberOfRows
<< ", numberOfColumns = " << numberOfColumns << endl
<< "________________________________________________________"<< endl;
}
else if(geoType == 0 && padType == 1 && padLayout==1){ //box and hexagonal pad
numberOfRows = (Int_t) (xLength/rHexagon);
if(DIGI_DEBUG)
cout << "User selected a box with hexagonal pads (rotated wrt MAYA-type)" << endl
<< "User selected a padSize = " << padSize
<< " and therefore a rHexagon = " << rHexagon<< endl;
rHexagon = xLength / numberOfRows;
padSize = 1.154700538379251529013 * rHexagon;
if(DIGI_DEBUG)
cout << " after the calculation: padSize = " << padSize
<< " and therefore a rHexagon = " << rHexagon << endl;
numberOfColumns = (Int_t) ((2.*zLength-2.*padSize)/(1.5*padSize)) + 1;
sideBlankSpaceZ = (2.*zLength -(numberOfColumns-1)*1.5*padSize-2.*padSize)/2.;
numberOfPads = numberOfRows*numberOfColumns;
if(DIGI_DEBUG)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::SetPadsGeometry() " << endl
<< " numberOfRows = "<< numberOfRows
<< ", numberOfColumns = " << numberOfColumns << endl
<< "________________________________________________________"<< endl;
}
else if(geoType == 1 && padType == 0){ //cylinder and square pad
numberOfRows = (Int_t) (2*TMath::Pi()*radius / padSize);
if(DIGI_DEBUG)
cout << "User selected a cylinder with square pads (on the cylindrical walls)" << endl
<< "User selected a padSize = " << padSize;
padSize = 2*TMath::Pi()*radius / numberOfRows;
if(DIGI_DEBUG)
cout << " after the calculation: padSize = " << padSize <<endl;
numberOfColumns = ((Int_t) (2*zLength / padSize)) - 1;
if( (numberOfColumns+1)*padSize <= 2*zLength ) numberOfColumns++;
numberOfPads = numberOfRows*numberOfColumns;
if(DIGI_DEBUG)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::SetPadsGeometry() " << endl
<< " numberOfRows = "<< numberOfRows
<< ", numberOfColumns = " << numberOfColumns << endl
<< "________________________________________________________"<< endl;
}
else if(geoType == 1 && padType == 1){ //cylinder and hexagonal pad
numberOfRows = (Int_t) (TMath::Pi()*radius / rHexagon);
if(DIGI_DEBUG)
cout << "User selected a cylinder with hexagonal pads" << endl
<< "User selected a padSize = " << padSize
<< " and therefore a rHexagon = " << rHexagon<< endl;
rHexagon = TMath::Pi()*radius / numberOfRows;
padSize = 1.154700538379251529013 * rHexagon;
if(DIGI_DEBUG)
cout << " after the calculation: padSize = " << padSize
<< " and therefore a rHexagon = " << rHexagon << endl;
numberOfColumns = ((Int_t) (2*zLength / (1.5*padSize))) - 1;
if( (numberOfColumns+1)*1.5*padSize <= 2*zLength ) numberOfColumns++;
numberOfPads = numberOfRows*numberOfColumns;
if(DIGI_DEBUG)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::SetPadsGeometry() " << endl
<< " numberOfRows = "<< numberOfRows
<< ", numberOfColumns = " << numberOfColumns << endl
<< "________________________________________________________"<< endl;
}
else {
if(DIGI_DEBUG)
cout << "ERROR: No valid geometry... Have you called "
<< "SetGeometryValues() with valid arguments?" << endl << endl;
}
if(DIGI_DEBUG>3) cout << "Exits padsGeometry::SetPadsGeometry()" << endl;
}
Int_t padsGeometry::IsInPadNumber(TVector3* point){
//calculates the pad number where the point is
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::IsInPadNumber()" << endl;
Int_t column; Int_t row;
if(geoType == 0 && padType == 0) { //box and square pad
row = (Int_t) (((point->X() - sideBlankSpaceX + xLength)/ padSize) + 1);
//column = (Int_t) (((point->Z() - sideBlankSpaceZ)/ padSize)+1);
column = (Int_t) (((point->Z() - sideBlankSpaceZ + zLength)/ padSize)+1);//Piotr : Now that origin is at the middle of the GasBox
if(column > 0 && column < numberOfColumns+1
&& row > 0 && row < numberOfRows+1) {
if(DIGI_DEBUG>2)
cout << "In padsGeometry::IsInPadNumber()" << endl
<< " Pad (" << row << "," << column << ") for point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return CalculatePad(row,column);
}
else{
if(DIGI_DEBUG)
cout << "ERROR: in padsGeometry::IsInPadNumber()" << endl
<< " Invalid pad returned from requested point "
<< " sideBlankSpaceZ "<<sideBlankSpaceZ <<" Pad (" << row << "," << column << ") for point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return 0;
}
}
else if(geoType == 0 && padType == 1 && padLayout == 0){ //box and hexagonal pad and MAYA-type layout
//if(point->X()< -xLength || point->X()>xLength || point->Z()< 0 || point->Z()>2*zLength) {
if(point->X()< -xLength || point->X()>xLength || point->Z()< -zLength || point->Z()>zLength) {//Piotr : Now that origin is at the middle of the GasBox
if(DIGI_DEBUG)
cout << "ERROR: in padsGeometry::IsInPadNumber()" << endl
<< " Invalid pad returned from requested point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return 0;
}
row = (Int_t) ((point->X() + xLength - sideBlankSpaceX)/(1.5*padSize))+1;
column = (Int_t) (point->Z()/ (2*rHexagon)) + 1;
Double_t shorterDist = padSize; Int_t candidate=0; point->SetY(-yLength);
for(Int_t i=0;i<2;i++){ //checking if it is on the next column
for(Int_t j=-1;j<1;j++){ //checking if it is on the previous row
if((column+i)>numberOfColumns || (row+j)<1 || (row+j)>numberOfRows) continue;
TVector3 distance = *point - CoordinatesCenterOfPad(CalculatePad(row+j,column+i));
if (distance.Mag() <= rHexagon){
return CalculatePad(row+j,column+i);
}
if(distance.Mag() <= shorterDist) {
shorterDist = distance.Mag();
candidate = CalculatePad(row+j,column+i);
}
}
}
if(DIGI_DEBUG>2)
cout << "In padsGeometry::IsInPadNumber()" << endl
<< " Pad (" << row << "," << column << ") for point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return candidate;
}
else if(geoType == 0 && padType == 1 && padLayout == 1){ //box and hexagonal pad
//if(point->X()< -xLength || point->X()>xLength || point->Z()< 0 || point->Z()>2*zLength) {
if(point->X()< -xLength || point->X()>xLength || point->Z()< -zLength || point->Z()>zLength) {//Piotr : Now that origin is at the middle of the GasBox
if(DIGI_DEBUG)
cout << "ERROR: in padsGeometry::IsInPadNumber()" << endl
<< " Invalid pad returned from requested point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return 0;
}
row = (Int_t) (((point->X() + xLength)/ (2*rHexagon)) + 1);
//column = (Int_t) (((point->Z()-sideBlankSpaceZ)/(1.5*padSize))+1);
column = (Int_t) (((point->Z() - sideBlankSpaceZ + xLength)/(1.5*padSize))+1);//Piotr : Now that origin is at the middle of the GasBox
Double_t shorterDist = padSize; Int_t candidate=0; point->SetY(-yLength);
for(Int_t i=0;i<2;i++){ //checking if it is on the next row
for(Int_t j=-1;j<1;j++){ //checking if it is on the previous column
if(row+i>numberOfRows || column+j<1 || column+j>numberOfColumns) continue;
TVector3 distance = *point - CoordinatesCenterOfPad(CalculatePad(row+i,column+j));
if (distance.Mag() <= rHexagon) return CalculatePad(row+i,column+j);
if( distance.Mag() <= shorterDist ) {
shorterDist = distance.Mag();
candidate = CalculatePad(row+i,column+j);
}
}
}
if(DIGI_DEBUG>2)
cout << "In padsGeometry::IsInPadNumber()" << endl
<< " Pad (" << row << "," << column << ") for point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return candidate;
}
else if(geoType == 1 && padType == 0){ //cylinder and square pad
if(point->Phi()>=0) row =(Int_t)(numberOfRows * (point->Phi()) / (2*TMath::Pi())) +1;
else row =(Int_t)(numberOfRows * ( point->Phi() + (2*TMath::Pi())) / (2*TMath::Pi())) +1;
column = (Int_t) ((point->Z() / padSize)+1);
if(column > 0 && column < numberOfColumns+1 &&
row > 0 && row < numberOfRows+1) {
if(DIGI_DEBUG>2)
cout << "In padsGeometry::IsInPadNumber()" << endl
<< " Pad (" << row << "," << column << ") for point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return CalculatePad(row,column);
}
else{
if(DIGI_DEBUG)
cout << "ERROR: in padsGeometry::IsInPadNumber()" << endl
<< " Invalid pad returned from requested point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return 0;
}
}
else if(geoType == 1 && padType == 1){ //cylinder and hexagonal pad
if(point->Z()<0 || point->Z()>2*zLength) {
if(DIGI_DEBUG)
cout << "ERROR: in padsGeometry::IsInPadNumber()" << endl
<< " Invalid pad returned from requested point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return 0;
}
if(point->Phi()>=0) row= (Int_t)(numberOfRows * (point->Phi()) / (2*TMath::Pi())) + 1;
else row= (Int_t)(numberOfRows * (point->Phi()+(2*TMath::Pi())) / (2*TMath::Pi())) + 1;
column = (Int_t)((point->Z()/(1.5*padSize))+1);
Double_t shorterDist = padSize; Int_t candidate=0; point->SetPerp(radius);
for(Int_t i=0;i<2;i++){ //checking if it is on the next row
for(Int_t j=-1;j<1;j++){ //checking if it is on the previous column
if(row+i>numberOfRows || column+j<1 || column+j>numberOfColumns) continue;
TVector3 distance = *point - CoordinatesCenterOfPad(CalculatePad(row+i,column+j));
if( distance.Mag() <= shorterDist ) {
shorterDist = distance.Mag();
candidate = CalculatePad(row+i,column+j);
}
}
}
if(DIGI_DEBUG>2)
cout << "In padsGeometry::IsInPadNumber()" << endl
<< " Pad (" << row << "," << column << ") for point "
<< point->X() << ","<< point->Y() << ","<< point->Z()<< endl;
return candidate;
}
else {
if(DIGI_DEBUG)
cout << "No valid geometry... Have you called "
<<"SetGeometryValues() with valid arguments?" <<endl<<endl;
return 0;
}
}
Int_t padsGeometry::GetPadColumnFromXZValue(Double_t x, Double_t z){
//calculates the pad column number by x, z-values of a point
// NOTE: column number here start from 1
// column number returned here is allowed to be out of the range of the chamber
//if(DIGI_DEBUG>3) cout << "Enters padsGeometry::GetPadColumnFromXZValue()" << endl;
TVector3 point(x, -yBeamShift-yLength, z);
TVector3 vec;
Int_t column=0, row=0;
if(geoType == 0 && padType == 0){ //box and square pad
//column = (Int_t) (((z - sideBlankSpaceZ) / padSize)+1);
column = (Int_t) numberOfColumns/2.+ ((z / padSize)+1);//Piotr : Now that origin is at the middle of the GasBox
return column;
}
else if(geoType == 0 && padType == 1 && padLayout == 0){ //box and hexagonal pad with MAYA-type layout
column = (Int_t) ((point.Z()/(2*rHexagon))+1);
return column;
}
else if(geoType == 0 && padType == 1 && padLayout == 1){ //box and hexagonal pad
row = (Int_t) (((point.X() + xLength)/ (2*rHexagon)) + 1);
column = (Int_t) (((point.Z()-sideBlankSpaceZ)/(1.5*padSize))+1);
Double_t shorterDist = padSize; Int_t candidate=0; point.SetY(-yBeamShift-yLength);
for(Int_t i=0;i<2;i++){ //checking if it is on the next row
for(Int_t j=-1;j<1;j++){ //checking if it is on the previous column
vec.SetXYZ(-xLength + ((2*(row+i))-1)*rHexagon,
-yBeamShift-yLength,
padSize*((column+j)*1.5-0.5)+sideBlankSpaceZ);
if((column+j)%2==0) vec.SetX(vec.X()-rHexagon);
TVector3 distance = point - vec;
if (distance.Mag() <= rHexagon) return column+j;
if( distance.Mag() <= shorterDist ) {
shorterDist = distance.Mag();
candidate = column+j;
}
}
}
if(DIGI_DEBUG>2)
cout << "In padsGeometry::IsInPadNumber()" << endl
<< " Pad (" << row << "," << column << ") for point "
<< point.X() << ","<< point.Y() << ","<< point.Z()<< endl;
return candidate;
}
else {
cout << "No valid geometry... Have you called "
<<"SetGeometryValues() with valid arguments?" <<endl<<endl;
return 0;
}
}
Int_t padsGeometry::GetPadRowFromXZValue(Double_t x, Double_t z){
//calculates the pad column number by x, z-values of a point
// NOTE: column number here start from 1
// column number returned here is allowed to be out of the range of the chamber
//if(DIGI_DEBUG>3) cout << "Enters padsGeometry::GetPadRowFromXZValue()" << endl;
TVector3 point(x, -yBeamShift-yLength, z);
TVector3 vec;
Int_t column=0, row=0;
if(geoType == 0 && padType == 0){ //box and square pad
row = (Int_t) numberOfRows/2.+ ((x / padSize)+1);
return row;
}
else {
cout << "No valid geometry... Have you called"
<<"SetGeometryValues() with valid arguments?" <<endl<<endl;
return 0;
}
}
TVector3 padsGeometry::CoordinatesCenterOfPad(Int_t pad){
if(DIGI_DEBUG>3) cout << "Enters padsGeometry::CoordinatesCenterOfPad()" << endl;
if(pad==0 || pad> numberOfPads) {
if(DIGI_DEBUG)
cout << "ERROR in padsGeometry::CoordinatesCenterOfPad() " << endl
<< " Invalid pad number " << pad
<< " (0 or larger than maximum pad number)" << endl;
TVector3 vec(0,0,0); //HAPOL IS THIS RIGHT? SHOULD IT BE FAR AWAY?
return vec;
}
Int_t row = CalculateRow(pad);
Int_t column = CalculateColumn(pad);
if(geoType == 0 && padType == 0){ //box and square pad
//TVector3 vec(-xLength + (row-0.5)*padSize, -yLength,(column-0.5)*padSize);
TVector3 vec(-xLength + (row-0.5)*padSize, -yBeamShift-yLength,-zLength + (column-0.5)*padSize);//Piotr : Now that origin is at the middle of the GasBox
if(DIGI_DEBUG>2)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::CoordinatesCenterOfPad(" << pad << ") " << endl
<< " row = "<< row << ", column = " << column << endl
<< " x = "<< vec.x() << ", y = " << vec.y() << ", z = " << vec.z() << endl
<< "________________________________________________________"<< endl;
return vec;
}
else if(geoType == 0 && padType == 1 && padLayout == 0){ //box and hexagonal pad with MAYA-type layout
TVector3 vec(-xLength + sideBlankSpaceX + padSize*((row*1.5)-0.5),
-yBeamShift-yLength,
(2*column-1)*rHexagon);
if(row%2==0) vec.SetZ(vec.Z()-rHexagon);
if(DIGI_DEBUG>2)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::CoordinatesCenterOfPad(" << pad << ") " << endl
<< " row = "<< row << ", column = " << column << endl
<< " x = "<< vec.x() << ", y = " << vec.y() << ", z = " << vec.z() << endl
<< "________________________________________________________"<< endl;
return vec;
}
else if(geoType == 0 && padType == 1 && padLayout == 1){ //box and hexagonal pad
TVector3 vec(-xLength + ((2*row)-1)*rHexagon,
-yBeamShift-yLength,
padSize*((column*1.5)-0.5)+sideBlankSpaceZ);
if(column%2==0) vec.SetX(vec.X()-rHexagon);
if(DIGI_DEBUG>2)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::CoordinatesCenterOfPad(" << pad << ") " << endl
<< " row = "<< row << ", column = " << column << endl
<< " x = "<< vec.x() << ", y = " << vec.y() << ", z = " << vec.z() << endl
<< "________________________________________________________"<< endl;
return vec;
}
else if(geoType == 1 && padType == 0){ //cylinder and square pad
TVector3 vec(radius, radius, (column-0.5)*padSize);
vec.SetPerp(radius);
vec.SetPhi( (row-0.5) * 2 * TMath::Pi() / numberOfRows );
if(DIGI_DEBUG>2)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::CoordinatesCenterOfPad(" << pad << ") " << endl
<< " row = "<< row << ", column = " << column << endl
<< " x = "<< vec.x() << ", y = " << vec.y() << ", z = " << vec.z() << endl
<< "________________________________________________________"<< endl;
return vec;
}
else if(geoType == 1 && padType == 1){ //cylinder and hexagonal pad
TVector3 vec(radius, radius, padSize*((column*1.5)-0.5));
vec.SetPerp(radius);
if(column%2==1) vec.SetPhi( (row-0.5) * 2 * TMath::Pi() / numberOfRows ) ;
else vec.SetPhi( (row-1) * 2 * TMath::Pi() / numberOfRows);
if(DIGI_DEBUG>2)
cout << "________________________________________________________" << endl
<< " Output of padsGeometry::CoordinatesCenterOfPad(" << pad << ") " << endl
<< " row = "<< row << ", column = " << column << endl
<< " x = "<< vec.x() << ", y = " << vec.y() << ", z = " << vec.z() << endl
<< "________________________________________________________"<< endl;
return vec;
}
else {
if(DIGI_DEBUG)
cout << "No valid geometry... Have you called "
<<"SetGeometryValues() with valid arguments?" <<endl<<endl;
TVector3 vec3(1.,1.,1.); //HAPOL IS THIS RIGHT? SHOULD IT BE FAR AWAY?
return vec3;
}
}
class amplificationManager{
private:
Int_t isWire;
Double_t radiusOfAmpliWire; // radius of amplification wire (ra in Mathieson)
Double_t pitchOfAmpliWire; // distance between two neighbouring amplification wires, (s in Mathieson)
Double_t ACseparation; // anode (Wire) and cathode (pads) separation, (h in Mathieson)
Double_t K1P, K2P, K3P; // K1, K2, and K3 in Mathieson, NIMA270(1988)602 for X directions
Double_t K1N, K2N, K3N; // K1, K2, and K3 for Y direction
Double_t lambdaP, lambdaN; // lambda in Mathieson, NIMA270(1988)602,
// for x (parallel to the wire) and
// y (perpendicular to the wire), respectively
Double_t rhoP, rhoN; // relative induction charge, rho in Mathieson, for X and Y
public:
amplificationManager();
virtual ~amplificationManager();
void SetIsWireOn(){
isWire=1;
}
void SetIsWireOff(){
isWire=0;
}
Int_t GetIsWire(){
return isWire;
}
void SetWireAmplificationParameters(Double_t ra, Double_t s, Double_t h);
void SetRadiusOfAmpliWire(Double_t ra) {radiusOfAmpliWire = ra;}
void SetPitchOfAmpliWire(Double_t s) {pitchOfAmpliWire = s;}
void SetACseparation(Double_t h) {ACseparation = h;}
void SetMathiesonFactorK1P(Double_t k1p) {K1P = k1p;}
void SetMathiesonFactorK2P(Double_t k2p) {K2P = k2p;}
void SetMathiesonFactorK3P(Double_t k3p) {K3P = k3p;}
void SetMathiesonFactorK1N(Double_t k1n) {K1N = k1n;}
void SetMathiesonFactorK2N(Double_t k2n) {K2N = k2n;}
void SetMathiesonFactorK3N(Double_t k3n) {K3N = k3n;}
Double_t GetRadiusOfAmpliWire() {return radiusOfAmpliWire;}
Double_t GetPitchOfAmpliWire() {return pitchOfAmpliWire;}
Double_t GetACseparation() {return ACseparation;}
Double_t GetMathiesonFactorK1P() {return K1P;}
Double_t GetMathiesonFactorK2P() {return K2P;}
Double_t GetMathiesonFactorK3P() {return K3P;}
Double_t GetMathiesonFactorK1N() {return K1N;}
Double_t GetMathiesonFactorK2N() {return K2N;}
Double_t GetMathiesonFactorK3N() {return K3N;}
Double_t CalculateRhoP(Double_t x){
//calculation of the relative induction charge for X (see Mathieson paper)
if(DIGI_DEBUG>3) cout << "Enters amplificationManager::CalculateRhoP()" << endl;
lambdaP= x/ACseparation;
Double_t commonFactor=tanh(K2P*lambdaP)*tanh(K2P*lambdaP);
rhoP=K1P*(1.-commonFactor)/(1.+K3P*commonFactor);
return rhoP;
}
Double_t CalculateRhoN(Double_t y){
//calculation of the relative induction charge for Y (see Mathieson paper)
if(DIGI_DEBUG>3) cout << "Enters amplificationManager::CalculateRhoN()" << endl;
lambdaN= y/ACseparation;
Double_t commonFactor=tanh(K2N*lambdaN)*tanh(K2N*lambdaN);
rhoN=K1N*(1.-commonFactor)/(1.+K3N*commonFactor);
return rhoN;
}
ClassDef(amplificationManager,1);
};
amplificationManager::amplificationManager(){
if(DIGI_DEBUG>3) cout << "Enters amplificationManager::amplificationManager()" << endl;
isWire=0;
radiusOfAmpliWire=0.02; // 20 mu
pitchOfAmpliWire=2.0; // 2 mm
ACseparation=10.0; // 10 mm
K1P=1.; K2P=1.; K3P=1.; // K1, K2, and K3 in Mathieson, NIMA270(1988)602 for X directions
K1N=1.; K2N=1.; K3N=1.; // K1, K2, and K3 for Y direction
lambdaP=1.; lambdaN=1.; // lambda in Mathieson, NIMA270(1988)602,
// for x (parallel to the wire) and
// y (perpendicular to the wire), respectively
rhoP=0.; rhoN=0.; // relative induction charge, rho in Mathieson, for X and Y
if(DIGI_DEBUG>3) cout << "Exits amplificationManager::amplificationManager()" << endl;
}
amplificationManager::~amplificationManager(){
}
void amplificationManager::SetWireAmplificationParameters(Double_t ra, Double_t s, Double_t h){
// radiusOfAmpliWire = ra;
// pitchOfAmpliWire = s;