forked from ActarSimGroup/Actarsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnalysis_Reduce.C
1924 lines (1693 loc) · 61.9 KB
/
Analysis_Reduce.C
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 : Piotr Konczykowski
//*-- Date: 10/2015
//*-- Last Update: 29/10/15
//*-- Copyright: GENP (Univ. Santiago de Compostela)
//
// --------------------------------------------------------------
//
// --------------------------------------------------------------
//
// Common analysis program for ActarSim and Actar data.
// Adapted for the IPNO experiment on the Actar demonstrator
// for the particle identification.
// Select tracks corresponding to a silicon hit, fit it and
// calculate the energy deposit
//
// --------------------------------------------------------------
// How to run this program:
// 1 - Run the simulation
// 2 - Run the digitization
// 3 - Run the Reducer
// 4 - Run this macro inside root
// .L Analysis_Reduce.C;
// Run("inputFile","outputFile")
#include "TROOT.h"
#include "TFile.h"
#include "TTree.h"
#include "TBrowser.h"
#include "TH2.h"
#include "TRandom.h"
#include <TCanvas.h>
#include <iostream>
#include "TVector3.h"
#include "MTrack.h"
using namespace std;
#if defined(__MAKECINT__)
#pragma link C++ class MTrack;
#endif
void Run(char* inputFile, char* outputFile){
//For the Particle Identification, choose the portion of track from which the energy deposit is calculated
Double_t DeltaL=20.;//size of the track portion
Double_t LOutMax=80.;//distance from the end point on the silicon
///FLAGS///
//Event by event
Bool_t Track3DVisuFlag=0;
Bool_t TrackVisuFlag=1;
Bool_t TrackSourcePosFlag=0;
Bool_t TrackAngleFlag=0;
Bool_t TrackBragFlag=1;
Bool_t TrackRangeFlag=0;
Bool_t MultiThetaFlag=0;
Bool_t EventFlag=0;// 0: all event, 1: event by event
Bool_t ReadWriteFlag=0;// 0: Read, 1: Write
Int_t DEBUGFLAG=1;// 0: quiet, 1: general, 2: precise
//At the end of analysis
Bool_t DeltaTimeFlag=0;
Bool_t SigmaFlag=0;
Bool_t ChiFlag=0;
Bool_t RangeFlag=0;
Bool_t AngleFlag=0;
Bool_t DistFlag=0;
Bool_t RangeVsAngleFlag=0;
Bool_t SourceFlag=0;
Bool_t EndTrackFlag=0;
Bool_t VertexFlag=0;
Bool_t IdentFlag=1;
Bool_t PIdentFlag=1;
Double_t driftVelocity=6.865e-3;
Bool_t simuFlag;
Bool_t gasflag;
Char_t *gasname;
Double_t sampling;
char* dEvsETitle;
cout << "Reading Simulation (1) or real data (0)? ";
cin >> simuFlag;
if(simuFlag){
dEvsETitle="dE vs E, 80 MeV 12C, Track_length>80mm+DeltaL, dl=20mm, ionGasModel, Pad & Si Res";
gSystem->Load("libactar.sl");
TFile *f = new TFile(inputFile);
TTree *t2 = (TTree*)f->Get("out_tree");
Int_t nentries=t2->GetEntries();
cout<<"Number of entries : "<<nentries<<endl;
sampling=1.;
}
else if(!simuFlag){
dEvsETitle="dE vs E, Track_length>80mm+#deltal, #deltal=20mm";
TFile *f = new TFile(inputFile);
TTree *t2 = (TTree*)f->Get("pad_signal");
Int_t nentries=t2->GetEntries();
cout<<"Number of entries : "<<nentries<<endl;
sampling=80.;
//Calibration parameters for the IPNO experiment
Double_t MAYACAL[12][2];
Double_t tmpCAL0[12]={0.006281,0.006195,0.006505,0.006501,0.006290,0.007061,0.006469,0.006497,0.006662,0.006555,0.006574,0.006419};
Double_t tmpCAL1[12]={0.13,0.18,-0.10,-0.04,0.14,-0.38,0.11,0.13,-0.06,0.01,0.00,0.13};
for(Int_t i=0;i<12;i++){
MAYACAL[i][0]=tmpCAL0[i];
MAYACAL[i][1]=tmpCAL1[i];
}
driftVelocity*=sampling;
}
const Int_t numberOfRows=32;
const Int_t numberOfColumns=64;
Int_t beamWidth = 2;
Int_t marginWidth = 1;
Double_t PI=3.1415926535897932384626433;
Double_t deg=180./PI;
Double_t rad=PI/180.;
//
for(const Int_t t=0;t<2;t++) MTrack* T[t]=new MTrack();
if(ReadWriteFlag){
TFile *outfile = new TFile(outputFile,"RECREATE");
TTree *out_tree = new TTree("out_tree","out_tree");
}
//Canvas
if(Track3DVisuFlag) Can_3D=new TCanvas("Can_3D","Can_3D",900,900);
if(TrackVisuFlag){
Can_track=new TCanvas("Can_track","Can_track",900,900);
Can_track->Divide(1,2);
}
if(TrackSourcePosFlag){
Can_source=new TCanvas("Can_source","Can_source",900,900);
Can_source->Divide(2,2);
}
if(TrackAngleFlag){
Can_angle=new TCanvas("Can_angle","Can_angle",900,900);
Can_angle->Divide(2,1);
}
if(TrackBragFlag){
Can_brag=new TCanvas("Can_brag","Can_brag",900,600);
Can_brag->Divide(1,2);
}
if(TrackRangeFlag){
Can_range=new TCanvas("Can_range","Can_range",1800,900);
Can_range->Divide(1,2);
}
if(MultiThetaFlag){
TCanvas *Can_multi;
Can_multi=new TCanvas("Can_multi","Can_multi",900,900);
Can_multi->Divide(5,2);
}
//
Double_t Energy_in_silicon=0.;
Double_t EnergySil;
Int_t detectorID;
Double_t SilPosX, SilPosY, SilPosZ;
Double_t Qtot;
TSpline3 *bragR, *bragR1, *bragR2;
Int_t minRowtmp=0, maxRowtmp=31;
Int_t minColumntmp=0, maxColumntmp=63;
Int_t minRow[2],maxRow[2],minColumn[2],maxColumn[2];
Double_t Vertex_posX,Vertex_posY;
Double_t maxZ=170.;
if(simuFlag==0) maxZ=600.;
Double_t threshold = 0;
Double_t timeThreshold = 1.;
Double_t outThresh=10000.;
if(simuFlag==0) {
threshold = 0.;
outThresh=1000.;
}
Double_t tSourceX,tSourceY,t0;
Double_t SourcePosX,SourcePosZ,SourcePosY;
Double_t range,range2,rangeX,rangeY;
Double_t Rm,Cm,Zcor,Zm;
Int_t min_col,max_col,ncol;
Int_t min_row,max_row,nrow;
Bool_t out_track;
Double_t PadToSilX=51.8;
Double_t PadToSilY=58.8;
Double_t a,b;
Double_t IniPoint[2][2],FinPoint[2][2],IniFitPoint[2][2],FinFitPoint[2][2];
Double_t IniPoint1[2],FinPoint1[2],IniFitPoint1[2],FinFitPoint1[2];
Double_t IniPoint2[2],FinPoint2[2],IniFitPoint2[2],FinFitPoint2[2];
Double_t Start[3],Out[3],End[3];
Double_t PointA[3][2],PointB[3][2];
Double_t xv,yv,zv;
Double_t RangeA[2],RangeB[2],RangeO[2];
Double_t dist_VO,dist_VF,dist_FO;
Double_t phi;
Double_t theta;
Double_t VAngle;
Double_t HAngle;
Double_t Angle3D;
Double_t xmaxval, xmax, ymaxval, ymax, zmaxval, zmax;
Double_t range_calcX, range_calcZ, range_calcY;
Double_t trackX,trackZ,trackY,trackZ2;
Double_t trackPadX,trackPadZ,trackPadY;
Double_t track_range,track_rangeXY,track_rangePadXY;
//3 alphas source position inside Actar
Double_t SourceX=64;
Double_t SourceY=-37.43;
//Matrix for the charge map
Double_t **padCharge=new Double_t*[numberOfRows];
Double_t **padTime=new Double_t*[numberOfRows];
Double_t **padHeight=new Double_t*[numberOfRows];
for(Int_t j=0;j<numberOfRows;j++){
padCharge[j]=new Double_t[numberOfColumns];
padTime[j]=new Double_t[numberOfColumns];
padHeight[j]=new Double_t[numberOfColumns];
}
Double_t PadESig;
TMatrixD *padChargeTest;
TMatrixD *padTimeTest;
Bool_t DSSD_1,DSSD_2,DSSD_3,DSSD_4;
Bool_t SilLeft,SilRight,SilFront;
Int_t SilHitID;
Int_t NTrackOut;
// Parameters of the tracks on the left and right of beam
Int_t minpadout=2;
Int_t maxpadout=6;
Bool_t StopLeft=1;
Bool_t StopRight=1;
Int_t tmp;
Bool_t scatside,trackleft,trackright,trackfront1,trackfront2,outbeamtrackleft,outbeamtrackright,GOOD_EVENT;
Int_t config=0;
// Particle identification
Int_t particleID;
Int_t smin,smax;
Bool_t track1,track2;
Int_t trackout[2];//0:track left, 1:track right, 2:track front left, 3:track front left
Int_t SilWall[2];//0:DSSD1_2, 1:DSSD3_4, 2:MAYA LEFT, 3:MAYA RIGHT
//Silicon charge
Int_t SilID[16];
TVectorD *SilCharge;
TVectorD *SilIDV;
Int_t nbsiliconhits;
t2->SetBranchAddress("PadCharge",&padChargeTest);
t2->SetBranchAddress("PadTime",&padTimeTest);
t2->SetBranchAddress("SilCharge",&SilCharge);
if(simuFlag) t2->SetBranchAddress("SilID",&SilIDV);
if(ReadWriteFlag){
out_tree->Branch("Energy",&Qtot,"energy/D");
out_tree->Branch("HAngle",&HAngle,"angle/D");
out_tree->Branch("VAngle",&VAngle,"angle/D");
out_tree->Branch("range",&track_range,"rangeProj/D");
out_tree->Branch("rangeXY",&track_rangeXY,"rangeProjXY/D");
out_tree->Branch("sourceX",&SourcePosX,"sourceX/D");
out_tree->Branch("sourceY",&SourcePosY,"sourceY/D");
out_tree->Branch("sourceZ",&SourcePosZ,"sourceZ/D");
out_tree->Branch("range_calcX",&range_calcX,"range_calcX/D");
out_tree->Branch("range_calcY",&range_calcY,"range_calcY/D");
out_tree->Branch("range_calcZ",&range_calcZ,"range_calcZ/D");
}
//create histograms
if(simuFlag==1){
TH2F *visu_chargeYZ=new TH2F("visu_chargeYZ","visu_chargeYZ",32,0,32,85,0,85);
TH3F *h3DTrack=new TH3F("h3DTrack","h3DTrack",64,0,64,32,0,32,85,0,85);
}
else{
TH2F *visu_chargeYZ=new TH2F("visu_chargeYZ","visu_chargeYZ",32,0,32,300,0.,300.);
TH3F *h3DTrack=new TH3F("h3DTrack","h3DTrack",64,0,64,32,0,32,300,0.,300.);
}
TH1F *h_DeltaTime=new TH1F("h_DeltaTime","Pad_Tmax - PadTmin",512,0.,512.);
TH1F *h_DeltaHeight=new TH1F("h_DeltaHeight","#Delta t * Vdrift (mm)",500,0.,500.);
TH1F *h_Vertex_X=new TH1F("h_Vertex_X","Reaction X vertex in mm",200,0.,128.);
TH1F *h_Vertex_Y=new TH1F("h_Vertex_Y","Reaction Y vertex in mm",200,0.,64.);
//TH2F* h_dEvsE=new TH2F("h_dEvsE","h_dEvsE",100,10.,80.,100,1.,5.);
TH2F* h_dEvsE_MAYA=new TH2F("h_dEvsE_MAYA","h_dEvsE_MAYA",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_DSSD=new TH2F("h_dEvsE_DSSD","h_dEvsE_DSSD",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_DSSD1=new TH2F("h_dEvsE_DSSD1","h_dEvsE_DSSD1",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_DSSD2=new TH2F("h_dEvsE_DSSD2","h_dEvsE_DSSD2",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_DSSD3=new TH2F("h_dEvsE_DSSD3","h_dEvsE_DSSD3",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_DSSD4=new TH2F("h_dEvsE_DSSD4","h_dEvsE_DSSD4",1000,0.,60.,1000,0.,10.);
TH1F *h_SilCharge=new TH1F("h_SilCharge","Silicon charge (MeV)",200,0,100);
TH1F *h_SilCharge0=new TH1F("h_SilCharge0","DSSD0 charge (MeV)",200,0,100);
TH1F *h_SilCharge1=new TH1F("h_SilCharge1","DSSD1 charge (MeV)",200,0,100);
TH1F *h_SilCharge2=new TH1F("h_SilCharge2","DSSD2 charge (MeV)",200,0,100);
TH1F *h_SilCharge3=new TH1F("h_SilCharge3","DSSD3 charge (MeV)",200,0,100);
TH1F *h_SilMult=new TH1F("h_SilMult","Silicon multiplicity",16,0,16);
TH2F* h_dEvsE_ALL2=new TH2F("h_dEvsE_ALL2","dEvsE, dE(Pad)/TrackLength",1000,0.,60.,1000,0.,1.);
TH2F* h_dEvsE_ALL=new TH2F("h_dEvsE_ALL",dEvsETitle,1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_p=new TH2F("h_dEvsE_p","h_dEvsE_p",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_3He=new TH2F("h_dEvsE_3He","h_dEvsE_3He",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_4He=new TH2F("h_dEvsE_4He","h_dEvsE_4He",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_12C=new TH2F("h_dEvsE_12C","h_dEvsE_12C",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_13C=new TH2F("h_dEvsE_13C","h_dEvsE_13C",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_MAYA_rej=new TH2F("h_dEvsE_MAYA_rej","h_dEvsE_MAYA_rej",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_DSSD_rej=new TH2F("h_dEvsE_DSSD_rej","h_dEvsE_DSSD_rej",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_ALL_rej=new TH2F("h_dEvsE_ALL_rej","h_dEvsE_ALL_rej",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_p_rej=new TH2F("h_dEvsE_p_rej","h_dEvsE_p_rej",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_3He_rej=new TH2F("h_dEvsE_3He_rej","h_dEvsE_3He_rej",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_4He_rej=new TH2F("h_dEvsE_4He_rej","h_dEvsE_4He_rej",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_12C_rej=new TH2F("h_dEvsE_12C_rej","h_dEvsE_12C_rej",1000,0.,60.,1000,0.,10.);
TH2F* h_dEvsE_13C_rej=new TH2F("h_dEvsE_13C_rej","h_dEvsE_13C_rej",1000,0.,60.,1000,0.,10.);
TH1F *h_scat_range=new TH1F("TrackBragg","Track Bragg",200, 0.,200.);
TH1F *h_scat_range1=new TH1F("TrackBragg1","Track Bragg1",200, 0.,200.);
TH1F *h_scat_range2=new TH1F("TrackBragg2","Track Bragg2",200, 0.,200.);
TH1F *h_energy=new TH1F("Energy","Total Charge Deposited",1000, 3000., 5000.);
TH2F* visu_multiplicity=new TH2F("visu_multiplicity","visu_multiplicity",64,0,64,32,0,32);
TH2F* visu_totcharge=new TH2F("visu_totcharge","visu_totcharge",64,0,64,32,0,32);
TH1F *hSourceX=new TH1F("hSourceX","X track position at Y=-37.43mm",500,1,128);
TH1F *hSourceY=new TH1F("hSourceY","Y track position at X=64mm",400,-100,0);
TH2F *visu_charge=new TH2F("visu_charge","visu_charge",64,0,64,32,0,32);
TH2F *visu_time=new TH2F("visu_time","visu_time",64,0,64,32,0,32);
TH1F *hHorizAngle=new TH1F("hHorizAngle","Horizontal Angle",720,-180,180);
TH1F *hVertiAngle=new TH1F("hVertiAngle","Vertical Angle",360,-90,90);
TH1F *h3DAngle=new TH1F("h3DAngle","3D Angle",720,-180,180);
TH1F *hdistVO=new TH1F("hdistVO","Dist VO",1000,0,500);
TH1F *hdistVF=new TH1F("hdistVF","Dist VF",1000,0,500);
TH1F *hdistOF=new TH1F("hdistOF","Dist OF",1000,0,200);
TH2F *hdistOFvsVO=new TH2F("hdistOFvsVO","Dist OF vs Dist VO",1000,0,500,1000,0,500);
TH2F *hdistOFvsVF=new TH2F("hdistOFvsVF","Dist OF vs Dist VF",1000,0,500,1000,0,500);
TH2F *hdistOFvsTheta=new TH2F("hdistOFvsTheta","Dist OF vs Theta 3D",1000,0,360,1000,0,500);
TH1F *hRange = new TH1F("hRange","Alpha range in mm",200,50.,150.);
TH1F *hRangeRest = new TH1F("hRangeRest","Alpha range in mm, |vert angle| < 10 deg",200,50.,150.);
TH2F *hRangeVsHoriz = new TH2F("hRangeVsHoriz","Range vs Horizontal angle",180,-90.,90.,200,50,150);
TH1F *hEndTrackX = new TH1F("hEndTrackX","End track X (mm)",200,0.,128.);
TH1F *hEndTrackY = new TH1F("hEndTrackY","End track Y (mm)",200,0.,64.);
TH1F *hEndTrackZ = new TH1F("hEndTrackZ","End track Z (mm)",600,300.,600.);
TH2F *hEndTrackXY=new TH2F("hEndTrackXY","XY track final position",64,0,128,32,0,64);
TH2F *hEndTrackXZ=new TH2F("hEndTrackXZ","XZ track final position",64,0,128,60,190,250);
//Event Loop
for (Long64_t jentry=0;jentry<nentries;jentry++) {
if(jentry%500==0) cout << "Event " << jentry << endl;
if(DEBUGFLAG>0) cout << "¡¡¡¡¡¡¡¡¡¡¡¡¡¡ NEW EVENT : " << jentry << " !!!!!!!!!" << endl << endl;
t2->GetEntry(jentry);
// ActarSim DSSD map (beam view): 1=bottom right, 2=top right, 3=bottom left, 4=top left
DSSD_1=DSSD_2=DSSD_3=DSSD_4=0;
SilLeft=SilRight=SilFront=0;
nbsiliconhits=0;
Bool_t StopTrack=false;
for(Int_t s=0;s<16;s++){//Loop on the 12 MAYA Si & 4 DSSD
SilHitID=0;
SilID[s]=0;
if(SilCharge(s)!=0){
nbsiliconhits++;
if(s+1==1){DSSD_1=1;SilFront=1;SilFront=1;}
else if(s+1==2){DSSD_2=1;SilFront=1;}
else if(s+1==3){DSSD_3=1;SilFront=1;}
else if(s+1==4){DSSD_4=1;SilFront=1;}
else if(s+1<11)SilLeft=1;
else if(s+1>10)SilRight=1;
if(simuFlag){
SilID[s]=SilIDV(s);
if(s+1<5) SilCharge(s)=gRandom->Gaus(SilCharge(s),0.0116*SilCharge(s));//150keV FWHM
else if(s+1>4) SilCharge(s)=gRandom->Gaus(SilCharge(s),0.0116*SilCharge(s));//150keV FWHM
}
else if(!simuFlag){
if(s<4) SilCharge(s)=SilCharge(s)*5.256*1e-3+0.4312;//run177 dssd 140V
else if(s>3) SilCharge(s)=SilCharge(s)*MAYACAL[s-4][0]+MAYACAL[s-4][1];
h_SilMult->Fill(s);
if(s==0) h_SilCharge0->Fill(SilCharge(s));
else if(s==1) h_SilCharge1->Fill(SilCharge(s));
else if(s==2) h_SilCharge2->Fill(SilCharge(s));
else if(s==3) h_SilCharge3->Fill(SilCharge(s));
}
}//end of if(SilCharge(s)!=0)
}//end of Loop on the 12 MAYA Si & 4 DSSD
visu_charge->Reset();
visu_chargeYZ->Reset();
visu_time->Reset();
h3DTrack->Reset();
h_scat_range->Reset();
h_scat_range1->Reset();
h_scat_range2->Reset();
T[0]->ResetLines();
T[1]->ResetLines();
// Loop on columns & rows //////////////
Double_t maxtime=0;
Double_t mintime=0;
for(Int_t c=0;c<numberOfColumns;c++){
for(Int_t r=0;r<numberOfRows;r++){
if(padChargeTest(r,c)>threshold){
if(simuFlag){
//Pad energy resolution estimation (to be measured)
if(padChargeTest(r,c)*30/1e6<20) PadESig=0.085;
else if(padChargeTest(r,c)*30/1e6>=20 && padChargeTest(r,c)*30/1e6<=5000)
PadESig=-1.6215*1e-5*(padChargeTest(r,c)*30/1e6-20)+0.085;
else if(padChargeTest(r,c)*30/1e6>5000) PadESig=0.00425;
padCharge[r][c]=gRandom->Gaus(padChargeTest(r,c),PadESig*padChargeTest(r,c));
padCharge[r][c]*=30/1e9;
padTime[r][c]=padTimeTest(r,c);
//We left the middle pad band shadowed
if(r>13 && r<18)padCharge[r][c]=0;
}
else if(!simuFlag){
//Pad chargeto energy (MeV) convertion
padCharge[r][c]=padChargeTest(r,c)*3.299*1e-5+0.0537;
padTime[r][c]=padTimeTest(r,c);
//Next are noisy channels that I noticed in the end of 1st part. Check if is still the case in the run to analyse
if(r==13 && (c==0 || c==1 || c==2)) {
padCharge[r][c]=0;
padTime[r][c]=0;
}
}
padHeight[r][c]=padTime[r][c]*driftVelocity;
if(maxtime==0){
maxtime=mintime=padTime[r][c];
}
else if(padTime[r][c]>maxtime) maxtime=padTime[r][c];
else if(padTime[r][c]<mintime && padTime[r][c]!=0) mintime=padTime[r][c];
if(simuFlag || (!simuFlag && !(r==13 && (c==0 || c==2))))
visu_charge->SetBinContent(c+1.,r+1,padCharge[r][c]);
visu_time->SetBinContent(c+1.,r+1.,padTime[r][c]);
h3DTrack->SetBinContent(c+1.,r+1.,padTime[r][c]*driftVelocity/2+1,padCharge[r][c]);
} //end of if(padChargeTest(r,c)>threshold){
else{
padCharge[r][c]=-1;
padTime[r][c]=-1;
padHeight[r][c]=-1;
}
}//End of Loop on Rows
}//End of Loop on Columns
h_DeltaTime->Fill(maxtime-mintime);
h_DeltaHeight->Fill((maxtime-mintime)*driftVelocity);
//Begining of reaction analysis
// Calculating the Tracks exit pads on the left & right part of the beam
Int_t minColumnleft,minColumnright,maxColumnleft,maxColumnright;
Int_t minColumnbeamleft,minColumnbeamright,maxColumnbeamleft,maxColumnbeamright;//min max columns of track going out of beam
Int_t tmpminColumnbeamleft,tmpminColumnbeamright,tmpmaxColumnbeamleft,tmpmaxColumnbeamright;
Int_t minColumnoutleft,minColumnoutright,maxColumnoutleft,maxColumnoutright;//min max columns of track going out of gasbox
Int_t NCBeamoutleft,NCBeamoutright,NCoutleft,NCoutright;
minColumnleft=minColumnright=maxColumnleft=maxColumnright=0;
minColumnbeamleft=minColumnbeamright=maxColumnbeamleft=maxColumnbeamright=0;
tmpminColumnbeamleft=tmpminColumnbeamright=tmpmaxColumnbeamleft=tmpmaxColumnbeamright=0;
minColumnoutleft=minColumnoutright=maxColumnoutleft=maxColumnoutright=0;
NCBeamoutleft=NCBeamoutright=NCoutleft=NCoutright=0;
trackleft=trackright=trackfront1=trackfront2=outbeamtrackleft=outbeamtrackright=GOOD_EVENT=0;
for(Int_t m=0;m<numberOfColumns;m++){
if(padCharge[numberOfRows/2+beamWidth][m]>threshold) { //LEFT SIDE
if(m==tmpmaxColumnbeamleft+1){
NCBeamoutleft++;
maxColumnbeamleft=m;
minColumnbeamleft=tmpminColumnbeamleft;
}
else {
tmpminColumnbeamleft=m;
NCBeamoutleft=1;
}
tmpmaxColumnbeamleft=m;
}
if(padCharge[numberOfRows-1][m]>threshold) {
if(m==maxColumnoutleft+1) NCoutleft++;
else {
minColumnoutleft=m;
NCoutleft=1;
}
maxColumnoutleft=m;
}
if(padCharge[numberOfRows/2-beamWidth-1][m]>threshold) { //RIGHT SIDE
if(m==tmpmaxColumnbeamright+1){
NCBeamoutright++;
maxColumnbeamright=m;
minColumnbeamright=tmpminColumnbeamright;
}
else {
tmpminColumnbeamright=m;
NCBeamoutright=1;
}
tmpmaxColumnbeamright=m;
}
if(padCharge[0][m]>threshold) {
if(m==maxColumnoutright+1) NCoutright++;
else {
minColumnoutright=m;
NCoutright=1;
}
maxColumnoutright=m;
}
} //end of loop on columns
if(NCBeamoutleft>minpadout) outbeamtrackleft=1;
if(NCBeamoutright>minpadout) outbeamtrackright=1;
if(NCoutleft>minpadout){
trackleft=1;
NTrackOut++;
minColumnleft=TMath::Min(minColumnbeamleft,minColumnoutleft);
maxColumnleft=TMath::Max(maxColumnbeamleft,maxColumnoutleft);
}
if(NCoutright>minpadout){
trackright=1;
NTrackOut++;
minColumnright=TMath::Min(minColumnbeamright,minColumnoutright);
maxColumnright=TMath::Max(maxColumnbeamright,maxColumnoutright);
}
// Calculating the Scatter Exit Pads (and if there's one, the recoil's exit pad) from the last Column's Rows
Int_t minRow1,maxRow1;
Int_t minRow2,maxRow2;
Int_t NRout1,NRout2;
minRow1=maxRow1=NRout1=0;
minRow2=maxRow2=NRout2=0;
for(Int_t l=0;l<numberOfRows;l++){
if(padCharge[l][numberOfColumns-1]>threshold) {
if(l==maxRow1+1) {
NRout1++;
maxRow1=l;
}
else if(NRout1<minpadout) {
maxRow1=l;
minRow1=l;
NRout1=1;
}
else if(NRout1>minpadout-1&&l==maxRow2+1) {
NRout2++;
maxRow2=l;
}
else if(NRout1>minpadout-1&&NRout2<minpadout) {
maxRow2=l;
minRow2=l;
NRout2=1;
}
}
} //end of loop on number of rows
if(NRout1>minpadout-1 && (NRout1<maxpadout || minRow1==0 || maxRow1==numberOfColumns-1)) {
trackfront1=1;
NTrackOut++;
}//If track goes in the corner number of pads can be higher than 5
if(NRout2>minpadout-1 && (NRout2<maxpadout || maxRow2==numberOfColumns-1)){
trackfront2=1;
NTrackOut++;
}
if(DEBUGFLAG>2)
cout << "maxRowoutright " << maxRowoutright << " maxRowoutleft " << maxRowoutleft
<< " minRow1 " << minRow1 << " maxRow1 " << maxRow1 << " maxRow2 " << maxRow2 << endl;
if(DEBUGFLAG>2)
cout << "NCoutright " << NCoutright << " NCoutleft " << NCoutleft
<< " NRout1 " << NRout1 << " NRout2 " << NRout2 << endl;
// Corner Case
if(maxColumnoutright==numberOfColumns-1 && minRow1==0){
if(NCoutright>NRout1){
trackfront1=0;
NTrackOut--;
if(trackfront2){
trackfront1=1;
trackfront2=0;
}
}
else if(NCoutright<=NRout1){
trackright=0;
NTrackOut--;
}
}
if(maxColumnoutleft==numberOfColumns-1 && maxRow1==numberOfRows-1){
if(NCoutleft>NRout1){
trackfront1=0;
NTrackOut--;
if(trackfront2){
trackfront1=1;
trackfront2=0;
}
}
else if(NCoutleft<=NRout1){
trackleft=0;
NTrackOut--;
}
}
if(maxColumnoutleft==numberOfColumns-1 && maxRow2==numberOfRows-1){
if(NCoutleft>NRout2){
trackfront2=0;
NTrackOut--;
}
else if(NCoutleft<=NRout2){
trackleft=0;
NTrackOut--;
}
}
if(DEBUGFLAG>1)
cout << "NTrackOut: " << NTrackOut << " trackleft " << trackleft << " trackright "
<< trackright << " trackfront1 " << trackfront1 << " trackfront2 " << trackfront2 << endl;
if(DEBUGFLAG>1)
cout << "DSSD_1: " << DSSD_1 << " DSSD_2: " << DSSD_2
<< " DSSD_3: " << DSSD_3 << " DSSD_4: " << DSSD_4 << endl;
if(DEBUGFLAG>1)
cout << "MAYA LEFT " << SilLeft << " MAYA RIGHT " << SilRight << endl;
// 1 Silicon hit configurations
// Config 1 : left silicon hitted & track exit by the left side
// Config 2 : right silicon hitted & track exit by the right side
// Config 3 : dssd hitted & track exit by the back side
// 2 Silcon hits configurations
// Config 4 : left and right silicon hits & 2 tracks exit by left and right sides
// Config 5 : left and right silicon hits & 2 tracks exit by left and front sides
// Config 6 : left and right silicon hits & 2 tracks exit by right and front sides
// Config 7 : left and right dssd hits & 2 tracks exit by front sides
if(nbsiliconhits==1){
if((SilLeft || DSSD_3 || DSSD_4) && trackleft) config=1;
else if((SilRight || DSSD_1 || DSSD_2) && trackright) config=2;
else if((DSSD_1 || DSSD_2) && trackfront1 && !trackright) config=3;
else if((DSSD_3 || DSSD_4) && trackfront1 && !trackleft) config=3;
}
else if(nbsiliconhits==2) {
if(SilLeft && SilRight && trackleft && trackright) config=4;
if(SilLeft && (DSSD_1 || DSSD_2) && trackleft && trackright) config=4;
if(SilRight && (DSSD_3 || DSSD_4) && trackright && trackleft) config=4;
if((DSSD_1 || DSSD_2) && (DSSD_3 || DSSD_4) && trackright && trackleft) config=4;
if(SilLeft && (DSSD_1 || DSSD_2) && trackleft && trackfront1) config=5;
if((DSSD_1 || DSSD_2) && (DSSD_3 || DSSD_4) && trackleft && trackfront1 && !trackfront2) config=5;
if(SilRight && (DSSD_3 || DSSD_4) && trackright && trackfront1) config=6;
if((DSSD_1 || DSSD_2) && (DSSD_3 || DSSD_4) && trackright && trackfront1 && !trackfront2) config=6;
if((DSSD_1 || DSSD_2) && (DSSD_3 || DSSD_4) && trackfront1 && trackfront2) config=7;
}
if(config!=0) GOOD_EVENT=1;
if(simuFlag){ //In the case when the scatter & recoil overlap
if(NTrackOut==1 && (DSSD_1||DSSD_2) && !outbeamtrackleft) GOOD_EVENT=0;
if(NTrackOut==1 && (DSSD_3||DSSD_4) && !outbeamtrackright) GOOD_EVENT=0;
}
// Determination of the fit boundaries for the tracks depending on the configuration
if(GOOD_EVENT) {
if(DEBUGFLAG>0) cout << "Config " << config << endl;
a=b=0.;
// If there is no track on left or right of beam, consider it as beam
if(maxColumnright==0) maxColumnright=numberOfColumns-1;
if(maxColumnleft==0) maxColumnleft=numberOfColumns-1;
if(maxColumnbeamright==0) maxColumnbeamright=numberOfColumns-1;
if(maxColumnbeamleft==0) maxColumnbeamleft=numberOfColumns-1;
track1=track2=0;
for(Int_t t=0;t<2;t++){
minRow[t]=maxRow[t]=minColumn[t]=maxColumn[t]=0;
trackout[t]=SilWall[t]=-1;
for(Int_t j=0;j<3;j++){
PointA[j][t]=PointA[j][t]=0.;
}
}
for(Int_t i=0;i<3;i++){
Start[i]=Out[i]=End[i]=0.;
}
if(config==1 || config==4 || config==5) {
if(DEBUGFLAG>1) cout << "Config " << config << endl;
minRowtmp=numberOfRows/2+2;
maxRowtmp=numberOfRows-1;
minColumntmp=minColumnleft;
if(SilLeft){
if(DEBUGFLAG>2) cout << "MAYA" << endl;
maxColumntmp=maxColumnleft;
}
else if(DSSD_3 || DSSD_4){
if(DEBUGFLAG>2) cout << "DSSD" << endl;
maxColumntmp=numberOfColumns-1;
}
if(minColumntmp==maxColumntmp) minColumntmp=maxColumntmp-3;
if(!track1){
minRow[0]=minRowtmp;
maxRow[0]=maxRowtmp;
minColumn[0]=minColumntmp;
maxColumn[0]=maxColumntmp;
if(SilLeft) SilWall[0]=2;
else if(DSSD_3 || DSSD_4) SilWall[0]=1;
}
else{
minRow[1]=minRowtmp;
maxRow[1]=maxRowtmp;
minColumn[1]=minColumntmp;
maxColumn[1]=maxColumntmp;
if(SilLeft)SilWall[1]=2;
else if(DSSD_3 || DSSD_4)SilWall[1]=1;
}
track1=1; trackout[0] = 0;
DSSD_3 = DSSD_4 = 0;
}//end of config1
if(config==2 || config==4 || config==6) {
if(DEBUGFLAG>1) cout << "Config " << config << endl;
minRowtmp=0;
minColumntmp=minColumnright;
if(SilRight){
if(DEBUGFLAG>2) cout << "MAYA" << endl;
maxRowtmp=numberOfRows/2-beamWidth;
maxColumntmp=maxColumnright;
}
else if(DSSD_1 || DSSD_2){
if(DEBUGFLAG>2)cout<<"DSSD"<<endl;
// Fit parameters depends if tracks are closed to beam or not
maxRowtmp=numberOfRows/2-3;
maxColumntmp=numberOfColumns-1;
}
if(minColumntmp==maxColumntmp) minColumntmp=maxColumntmp-3;
if(!track1){
minRow[0]=minRowtmp;
maxRow[0]=maxRowtmp;
minColumn[0]=minColumntmp;
maxColumn[0]=maxColumntmp;
track1=1;
trackout[0]=1;
if(SilRight) SilWall[0]=3;
else if(DSSD_1 || DSSD_2) SilWall[0]=0;
}
else {
minRow[1]=minRowtmp;
maxRow[1]=maxRowtmp;
minColumn[1]=minColumntmp;
maxColumn[1]=maxColumntmp;
track2=1;
trackout[1]=1;
if(SilRight) SilWall[1]=3;
else if(DSSD_1 || DSSD_2) SilWall[1]=0;
}
DSSD_1 = DSSD_2 = 0;
}//end of config2
if(config==3 || config==5 || config==6) {
if(DEBUGFLAG>1) cout << "Config " << config << endl;
minColumntmp=TMath::Min(maxColumnbeamleft,maxColumnbeamright);
maxColumntmp=numberOfColumns-1;
if(DSSD_1||DSSD_2) {
minRowtmp=0;
if(maxColumnbeamright<numberOfColumns-1){
minColumntmp=minColumnbeamright;
maxRowtmp=numberOfRows/2-3;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft<numberOfColumns-1){
minColumntmp=(maxColumnbeamleft+minColumnbeamleft)/2;
maxRowtmp=numberOfRows/2;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright!=0 && minColumnbeamleft!=0){
minColumntmp=minColumnbeamright;
maxRowtmp=numberOfRows/2-2;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright!=0 && minColumnbeamleft==0){
minColumntmp=(maxColumnbeamright+minColumnbeamright)/2;
maxRowtmp=numberOfRows/2-2;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright==0 && minColumnbeamleft!=0){
minColumntmp=(maxColumnbeamleft+minColumnbeamleft)/2;
maxRowtmp=numberOfRows/2-2;
}
}
else if(DSSD_3||DSSD_4){
maxRowtmp=numberOfRows-1;
if(maxColumnbeamleft<numberOfColumns-1){
minColumntmp=minColumnbeamleft;
minRowtmp=numberOfRows/2+2;
}
else if(maxColumnbeamleft==numberOfColumns-1 && maxColumnbeamright<numberOfColumns-1){
minColumntmp=(maxColumnbeamright+minColumnbeamright)/2;
minRowtmp=numberOfRows/2-2;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright!=0 && minColumnbeamleft!=0){
minColumntmp=minColumnbeamleft;
minRowtmp=numberOfRows/2+1;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright!=0 && minColumnbeamleft==0){
minColumntmp=(maxColumnbeamright+minColumnbeamright)/2;
minRowtmp=numberOfRows/2+1;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright==0 && minColumnbeamleft!=0){
minColumntmp=(maxColumnbeamleft+minColumnbeamleft)/2;
minRowtmp=numberOfRows/2+1;
}
}
if(DSSD_1||DSSD_2) minColumntmp=(2*maxColumnbeamright+minColumnbeamright)/3;//IPNO experiment has a middle blind band so fits going wrong and this is needed
else if(DSSD_3||DSSD_4) minColumntmp=(2*maxColumnbeamleft+minColumnbeamleft)/3;
if(minColumntmp==maxColumntmp) minColumntmp=maxColumntmp-3;
if(!track1){
minRow[0]=minRowtmp;
maxRow[0]=maxRowtmp;
minColumn[0]=minColumntmp;
maxColumn[0]=maxColumntmp;
track1=1;
if(DSSD_1 || DSSD_2){
SilWall[0]=0;
trackout[0]=3;
}
else if(DSSD_3 || DSSD_4){
SilWall[0]=1;
trackout[0]=2;
}
}
else {
minRow[1]=minRowtmp;
maxRow[1]=maxRowtmp;
minColumn[1]=minColumntmp;
maxColumn[1]=maxColumntmp;
track2=1;
if(DSSD_1 || DSSD_2){
SilWall[1]=0;
trackout[1]=3;
}
else if(DSSD_3 || DSSD_4){
SilWall[1]=1;
trackout[1]=2;
}
}
}//end of config3
if(config==7) {
if(DEBUGFLAG>1) cout << "Config " << config << endl;
if(maxColumnbeamright<numberOfColumns-1 && maxColumnbeamleft<numberOfColumns-1){
minColumn[0]=minColumnbeamright;
minColumn[1]=minColumnbeamleft;
maxRow[0]=numberOfRows/2-3;
minRow[1]=numberOfRows/2+2;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft<numberOfColumns-1){
minColumn[0]=(maxColumnbeamleft+minColumnbeamleft)/2;
minColumn[1]=minColumnbeamleft;
maxRow[0]=numberOfRows/2;
minRow[1]=numberOfRows/2+2;
}
else if(maxColumnbeamright<numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1){
minColumn[0]=minColumnbeamright;
minColumn[1]=(maxColumnbeamright+minColumnbeamright)/2;
maxRow[0]=numberOfRows/2-3;
minRow[1]=numberOfRows/2-2;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright!=0 && minColumnbeamleft!=0){
minColumn[0]=minColumnbeamright;
minColumn[1]=minColumnbeamleft;
maxRow[0]=numberOfRows/2-2;
minRow[1]=numberOfRows/2+1;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright!=0 && minColumnbeamleft==0){
minColumn[0]=minColumnbeamright;
minColumn[1]=(maxColumnbeamright+minColumnbeamright)/2;
maxRow[0]=numberOfRows/2-2;
minRow[1]=numberOfRows/2+1;
}
else if(maxColumnbeamright==numberOfColumns-1 && maxColumnbeamleft==numberOfColumns-1 &&
minColumnbeamright==0 && minColumnbeamleft!=0){
minColumn[0]=(maxColumnbeamleft+minColumnbeamleft)/2;
minColumn[1]=minColumnbeamleft;
maxRow[0]=numberOfRows/2-2;
minRow[1]=numberOfRows/2+1;
}
maxColumn[0]=numberOfColumns-1;
maxColumn[1]=numberOfColumns-1;
minRow[0]=0;
maxRow[1]=numberOfRows-1;
if(minColumn[0]==maxColumn[0]) minColumn[0]=maxColumn[0]-3;
else if(minColumn[1]==maxColumn[1]) minColumn[1]=maxColumn[1]-3;
if(!track1){ // Right track
track1=1;
trackout[0]=3;
SilWall[0]=0;
}
else {
track2=1;
trackout[1]=3;
SilWall[1]=0;
}
if(!track1){ // Left track
track1=1;
trackout[0]=2;
SilWall[0]=1;
}
else {
track2=1;
trackout[1]=2;
SilWall[1]=1;
}
} //End config 7
// Fitting and calculating the starting and exit points as well as
// the energy deposit from a delta L part of the track
for(Int_t t=0;t<track1+track2;t++){
if(DEBUGFLAG>0)
cout << "minRow " << minRow[t] << " maxRow " << maxRow[t]
<< " minColumn " << minColumn[t] << " maxColumn " << maxColumn[t] << endl;
FitMat(padCharge,minRow[t],maxRow[t],minColumn[t],maxColumn[t],threshold,a,b);
IniPoint[0][t]=0;
IniPoint[1][t]=a*IniPoint[0][t]+b/2;
FinPoint[0][t]=64;
FinPoint[1][t]=FinPoint[0][t]*a+b/2;
Double_t chi2=FitMat3D(padCharge,padHeight,minRow[t],maxRow[t],minColumn[t],maxColumn[t],threshold,T[t]);
//tstart: parameter to calculate the point Start where the track pass the middle blind band
//t0: parameter to calculate the point Out where the track exit the pad plane
//tf: parameter to calculate the point End where the track hit the silicon
xv=2*minColumn[t]+1.;
if(T[t]->Ym-T[t]->Yh!=0){
if(trackout[t]==0){
Double_t t0=(64-T[t]->Yh)/(T[t]->Ym-T[t]->Yh);
yv=2*minRow[t]+1.;
zv=padHeight[minRow[t]][minColumn[t]];
}//track left
else if(trackout[t]==1){
Double_t t0=(-T[t]->Yh)/(T[t]->Ym-T[t]->Yh);
yv=2*maxRow[t]+1.;
zv=padHeight[maxRow[t]][minColumn[t]];
}//track right