AliTPCcalibTimeGain.cxx - Adding the Gamma conversion selected electorns
[u/mrichter/AliRoot.git] / TPC / AliTPCclusterKr.cxx
CommitLineData
d0a2ea5a 1/**************************************************************************
2
3
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5
6
7 * *
8
9
10 * Author: The ALICE Off-line Project. *
11
12
13 * Contributors are mentioned in the code where appropriate. *
14
15
16 * *
17
18
19 * Permission to use, copy, modify and distribute this software and its *
20
21
22 * documentation strictly for non-commercial purposes is hereby granted *
23
24
25 * without fee, provided that the above copyright notice appears in all *
26
27
28 * copies and that both the copyright notice and this permission notice *
29
30
31 * appear in the supporting documentation. The authors make no claims *
32
33
34 * about the suitability of this software for any purpose. It is *
35
36
37 * provided "as is" without express or implied warranty. *
38
39
40 **************************************************************************/
41
42
43
44
45
46/* $Id: AliTPCclusterKr.cxx,v 1.7 2008/01/22 17:24:53 matyja Exp $ */
47
48
49
50
51
52//-----------------------------------------------------------------
53
54
55// Implementation of the TPC Kr cluster class
56
57
58//
59
60
61// Origin: Adam Matyja, INP PAN, adam.matyja@ifj.edu.pl
62
63
64//-----------------------------------------------------------------
65
66
67
68
69
70#include "AliTPCclusterKr.h"
71
72
73#include "AliCluster.h"
74
75
76#include "AliTPCvtpr.h"
77
78
79#include "TObjArray.h"
80
81
82//#include "TH1F.h"
83
84
85#include "TMath.h"
86
87
88#include "TArrayI.h"
89
90
91
92
93
94ClassImp(AliTPCclusterKr)
95
96
97
98
99
100
101
102
103AliTPCclusterKr::AliTPCclusterKr()
104
105
106:AliCluster(),
107
108
109 fMax(),
110
111
112 fADCcluster(0),
113
114
115 fSec(0),
116
117
118 fNPads(0),
119
120
121 fNRows(0),
122
123
124 fTimebins1D(0),
125
126
127 fPads1D(0),
128
129
130 fPadRMS(0),
131
132
133 fRowRMS(0),
134
135
136 fTimebinRMS(0),
137
138
139 fSize(0),
140
141
142 fCenterX(0),
143
144
145 fCenterY(0),
146
147
148 fCenterT(0),
149
150
151 fCluster(0),
152
153
154 fTimeStamp(0),
155 fRun(0)
156
157
158{
159
160
161//
162
163
164// default constructor
165
166
167//
168
169
170 fCluster=new TObjArray();
171
172
173}
174
175
176
177
178
179AliTPCclusterKr::AliTPCclusterKr(const AliTPCclusterKr &param)
180
181
182:AliCluster(param),
183
184
185 fMax(),
186
187
188 fADCcluster(0),
189
190
191 fSec(0),
192
193
194 fNPads(0),
195
196
197 fNRows(0),
198
199
200 fTimebins1D(0),
201
202
203 fPads1D(0),
204
205
206 fPadRMS(0),
207
208
209 fRowRMS(0),
210
211
212 fTimebinRMS(0),
213
214
215 fSize(0),
216
217
218 fCenterX(0),
219
220
221 fCenterY(0),
222
223
224 fCenterT(0),
225
226
227 fCluster(0),
228
229
230 fTimeStamp(0),
231 fRun(0)
232
233
234{
235
236
237//
238
239
240// copy constructor
241
242
243//
244
245
246 fADCcluster = param.fADCcluster;
247
248
249 fSec = param.fSec ;
250
251
252 fNPads = param.fNPads;
253
254
255 fNRows = param.fNRows;
256
257
258 fMax = param.fMax;
259
260
261 // fCluster = param.fCluster;
262
263
264 fCenterX = param.fCenterX;
265
266
267 fCenterY = param.fCenterY;
268
269
270 fCenterT = param.fCenterT;
271
272
273 fCluster=new TObjArray(*(param.fCluster));
274
275
276 fSize = param.fSize;
277
278
279 fTimebins1D = param.fTimebins1D;
280
281
282 fPads1D = param.fPads1D;
283
284
285 fPadRMS = param.fPadRMS;
286
287
288 fRowRMS = param.fRowRMS;
289
290
291 fTimebinRMS = param.fTimebinRMS;
292
293
294 fTimeStamp = param.fTimeStamp;
295 fRun = param.fRun;
296
297
298}
299
300
301
302
303
304AliTPCclusterKr &AliTPCclusterKr::operator = (const AliTPCclusterKr & param)
305
306
307{
308
309
310 //
311
312
313 // assignment operator
314
315
316 //
317
318
319 (AliCluster&)(*this) = (AliCluster&)param;
320
321
322 fADCcluster = param.fADCcluster;
323
324
325 fSec = param.fSec ;
326
327
328 fNPads = param.fNPads;
329
330
331 fNRows = param.fNRows;
332
333
334 fMax = param.fMax;
335
336
337 // fCluster=param.fCluster;
338
339
340 fCenterX = param.fCenterX;
341
342
343 fCenterY = param.fCenterY;
344
345
346 fCenterT = param.fCenterT;
347
348
349 delete fCluster;
350
351
352 fCluster=new TObjArray(*(param.fCluster));
353
354
355 fSize=param.fSize;
356
357
358 fTimebins1D = param.fTimebins1D;
359
360
361 fPads1D = param.fPads1D;
362
363
364 fPadRMS = param.fPadRMS;
365
366
367 fRowRMS = param.fRowRMS;
368
369
370 fTimebinRMS = param.fTimebinRMS;
371
372
373 fTimeStamp = param.fTimeStamp;
374 fRun = param.fRun;
375
376
377 return (*this);
378
379
380}
381
382
383
384
385
386AliTPCclusterKr::~AliTPCclusterKr()
387
388
389{
390
391
392 //
393
394
395 // destructor
396
397
398 //
399
400
401 if(fCluster) {
402
403
404 fCluster->SetOwner(kTRUE);
405
406
407 fCluster->Delete();
408
409
410 delete fCluster;
411
412
413 }
414
415
416 fCluster=0;
417
418
419}
420
421
422
423
424
425////____________________________________________________________________________
426
427
428void AliTPCclusterKr::SetCenter(){
429
430
431 //
432
433
434 // calculate geometrical center of the cluster
435
436
437 //
438
439
440 Double_t rX=0;
441
442
443 Double_t rY=0;
444
445
446 Double_t rT=0;
447
448
449
450
451
452 Short_t adc;
453
454
455 fADCcluster=0;
456
457
458 for(Int_t iter = 0; iter < fCluster->GetEntriesFast(); ++iter) {
459
460
461 AliTPCvtpr *iclus=(AliTPCvtpr *)fCluster->At(iter);
462
463
464
465
466
467 //for( std::vector<AliTPCvtpr*>::iterator iclus = fCluster.begin();
468
469
470 //iclus != fCluster.end(); ++iclus ) {
471
472
473 adc = (iclus)->GetAdc();
474
475
476 fADCcluster+=adc;
477
478
479 rX += ((iclus)->GetX() * adc);
480
481
482 rY += ((iclus)->GetY() * adc);
483
484
485 rT += ((iclus)->GetT() * adc);
486
487
488 }
489
490
491 fCenterX=rX/fADCcluster;
492
493
494 fCenterY=rY/fADCcluster;
495
496
497 fCenterT=rT/fADCcluster;
498
499
500
501
502
503 return;
504
505
506}
507
508
509
510
511
512void AliTPCclusterKr::SetPadRMS(){
513
514
515 //
516
517
518 // calculate RMS in pad direction
519
520
521 //
522
523
524 // TH1F *histo= new TH1F("","",200,0,200);
525
526
527 TArrayI *array= new TArrayI(fCluster->GetEntriesFast());
528
529
530 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)
531
532
533 {
534
535
536 array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetPad(),i);
537
538
539 //histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetPad() );
540
541
542 }
543
544
545 // fPadRMS=histo->GetRMS();
546
547
548 fPadRMS=TMath::RMS(array->GetSize(),array->GetArray());
549
550
551 // delete histo;
552
553
554 delete array;
555
556
557 return;
558
559
560}
561
562
563
564
565
566void AliTPCclusterKr::SetRowRMS(){
567
568
569 //
570
571
572 // calculate RMS in row direction
573
574
575 //
576
577
578 TArrayI *array= new TArrayI(fCluster->GetEntriesFast());
579
580
581 // TH1F *histo= new TH1F("","",120,0,120);
582
583
584 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)
585
586
587 {
588
589
590 array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetRow(),i);
591
592
593 // histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetRow() );
594
595
596 }
597
598
599 // fRowRMS=histo->GetRMS();
600
601
602 fRowRMS=TMath::RMS(array->GetSize(),array->GetArray());
603
604
605 // delete histo;
606
607
608 delete array;
609
610
611 return;
612
613
614}
615
616
617
618
619
620void AliTPCclusterKr::SetTimebinRMS(){
621
622
623 //
624
625
626 // calculate RMS in timebin direction
627
628
629 //
630
631
632 TArrayI *array= new TArrayI(fCluster->GetEntriesFast());
633
634
635 // TH1F *histo= new TH1F("","",1000,0,1000);
636
637
638 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)
639
640
641 {
642
643
644 array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetTime(),i);
645
646
647 // histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetTime() );
648
649
650 }
651
652
653 fTimebinRMS=TMath::RMS(array->GetSize(),array->GetArray());
654
655
656 //histo->GetRMS();
657
658
659 // delete histo;
660
661
662 delete array;
663
664
665 return;
666
667
668}
669
670
671
672
673
674void AliTPCclusterKr::SetRMS(){
675
676
677 //
678
679
680 // calculate RMS in pad,row,timebin direction
681
682
683 //
684
685
686 TArrayI *arrayPad = new TArrayI(fCluster->GetEntriesFast());
687
688
689 TArrayI *arrayRow = new TArrayI(fCluster->GetEntriesFast());
690
691
692 TArrayI *arrayTime= new TArrayI(fCluster->GetEntriesFast());
693
694
695 // TH1F *histoPad= new TH1F("p","p",200,0,200);
696
697
698 // TH1F *histoRow= new TH1F("r","r",120,0,120);
699
700
701 // TH1F *histoTime= new TH1F("t","t",1000,0,1000);
702
703
704 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)
705
706
707 {
708
709
710 arrayPad->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetPad(),i);
711
712
713 arrayRow->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetRow(),i);
714
715
716 arrayTime->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetTime(),i);
717
718
719
720
721
722 //histoPad->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetPad() );
723
724
725 //histoRow->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetRow() );
726
727
728 //histoTime->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetTime() );
729
730
731 }
732
733
734 // fPadRMS=histoPad->GetRMS();
735
736
737 fPadRMS=TMath::RMS(arrayPad->GetSize(),arrayPad->GetArray());
738
739
740 fRowRMS=TMath::RMS(arrayRow->GetSize(),arrayRow->GetArray());
741
742
743 //histoRow->GetRMS();
744
745
746 fTimebinRMS=TMath::RMS(arrayTime->GetSize(),arrayTime->GetArray());
747
748
749 //histoTime->GetRMS();
750
751
752
753
754
755 delete arrayPad;
756
757
758 delete arrayRow;
759
760
761 delete arrayTime;
762
763
764 // delete histoPad;
765
766
767 // delete histoRow;
768
769
770 // delete histoTime;
771
772
773
774
775
776 return;
777
778
779}
780
781
782
783
784
785
786
787
788void AliTPCclusterKr::Set1D(){
789
790
791 //
792
793
794 //
795
796
797 //
798
799
800 Short_t maxTime=0;
801
802
803 Short_t minTime=1000;
804
805
806 Short_t maxPad=0;
807
808
809 Short_t minPad=1000;
810
811
812
813
814
815 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)
816
817
818 {
819
820
821 if(((AliTPCvtpr *)(fCluster->At(i)))->GetPad()>maxPad)maxPad =((AliTPCvtpr *)(fCluster->At(i)))->GetPad();
822
823
824 if(((AliTPCvtpr *)(fCluster->At(i)))->GetPad()<minPad)minPad =((AliTPCvtpr *)(fCluster->At(i)))->GetPad();
825
826
827 if(((AliTPCvtpr *)(fCluster->At(i)))->GetTime()>maxTime)maxTime=((AliTPCvtpr *)(fCluster->At(i)))->GetTime();
828
829
830 if(((AliTPCvtpr *)(fCluster->At(i)))->GetTime()<minTime)minTime=((AliTPCvtpr *)(fCluster->At(i)))->GetTime();
831
832
833 }
834
835
836 fPads1D=maxPad-minPad+1;
837
838
839 fTimebins1D=maxTime-minTime+1;
840
841
842 return;
843
844
845}
846
847