]>
Commit | Line | Data |
---|---|---|
ea7a588a | 1 | Int_t AliTOFanalyzeSDigits(TString headersFile, Int_t iEvNum=0) |
2 | { | |
3 | // | |
4 | // Analyzes the TOF sdigits and fills QA-histograms | |
5 | // | |
6 | // iEvNum=0 means all events in the file | |
7 | ||
8 | Int_t rc=0; | |
9 | ||
10 | TFile * file = (TFile*) gROOT->GetFile(headersFile.Data() ) ; | |
11 | ||
12 | //File was not opened yet | |
13 | ||
14 | if(file == 0){ | |
15 | if(headersFile.Contains("rfio")) | |
16 | file = TFile::Open(headersFile,"update") ; | |
17 | else | |
18 | file = new TFile(headersFile.Data(),"update") ; | |
19 | gAlice = (AliRun *) file->Get("gAlice") ; | |
20 | } | |
21 | ||
22 | ||
23 | if (iEvNum == 0) iEvNum = (Int_t) gAlice->TreeE()->GetEntries(); | |
24 | ||
25 | ||
26 | AliTOFSDigit *tofsdigit; | |
27 | ||
28 | AliTOF * tof = (AliTOF *) gAlice->GetDetector("TOF") ; | |
29 | ||
30 | if (!tof) { | |
31 | cout << "<AliTOFanalyzeSDigits> No TOF detector found" << endl; | |
32 | rc = 2; | |
33 | return rc; | |
34 | } | |
35 | ||
36 | // adc and tdc | |
37 | TH1F *htdc = new TH1F("htdc","TDC [bin]",5000,0.,150000.); | |
38 | TH1F *hadc = new TH1F("hadc","ADC [bin]",100,0., 3000.); | |
39 | ||
40 | // TOF sdigit volumes | |
41 | TH1F *hsector = new TH1F("hsector","Sector",20,0.,20.); | |
42 | TH1F *hplate = new TH1F("hplate","Plate ", 6,0., 6.); | |
43 | TH1F *hstrip = new TH1F("hstrip","Strip ",25,0.,25.); | |
44 | TH1F *hpadz = new TH1F("hpadz","Pad along z ",3,0.,3.); | |
45 | TH1F *hpadx = new TH1F("hpadx","Pad along x",50,0.,50.); | |
46 | // ADC-TDC correlation | |
47 | TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",500,0.,150000.,100,0.,3000.); | |
48 | ||
49 | ||
50 | for (Int_t ievent = 0; ievent < iEvNum; ievent++) { | |
51 | ||
52 | gAlice->GetEvent(ievent) ; | |
53 | if(gAlice->TreeS()==0) { | |
54 | cout << "<AliTOFanalyzeSDigits> No TreeS found" << endl; | |
55 | rc = 4; | |
56 | return rc; | |
57 | } | |
58 | ||
59 | ||
60 | ||
61 | Int_t ndig, k; | |
62 | gAlice->ResetDigits(); | |
63 | gAlice->TreeS()->GetEvent(ievent); | |
64 | TClonesArray * TOFdigits = tof->SDigits(); | |
65 | ||
66 | ndig=TOFdigits->GetEntries(); | |
67 | ||
68 | cout << "<AliTOFanalyzeSDigits> found " << ndig | |
69 | << " TOF sdigits for event " << ievent << endl; | |
70 | ||
71 | for (k=0; k<ndig; k++) { | |
72 | tofsdigit= (AliTOFSDigit*) TOFdigits->UncheckedAt(k); | |
73 | Float_t firstTDC=tofsdigit->GetTdc(0); | |
74 | Float_t firstADC=tofsdigit->GetAdc(0); | |
75 | htdc->Fill(firstTDC); | |
76 | hadc->Fill(firstADC); | |
77 | // TOF sdigit volumes | |
78 | Int_t sector = tofsdigit->GetSector(); // range [1-18] | |
79 | Int_t plate = tofsdigit->GetPlate(); // range [1- 5] | |
80 | Int_t strip = tofsdigit->GetStrip(); // range [1-20] | |
81 | Int_t padz = tofsdigit->GetPadz(); // range [1- 2] | |
82 | Int_t padx = tofsdigit->GetPadx(); // range [1-48] | |
83 | // it is QA, then I perform QA! | |
84 | Bool_t isSDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48); | |
85 | ||
86 | if (isSDigitBad) { | |
87 | cout << "<AliTOFanalyzeHits> strange hit found" << endl; | |
88 | rc = 3; | |
89 | return rc; | |
90 | } | |
91 | ||
92 | // filling sdigit volume histos | |
93 | hsector->Fill(sector); | |
94 | hplate->Fill(plate); | |
95 | hstrip->Fill(strip); | |
96 | hpadx->Fill(padx); | |
97 | hpadz->Fill(padz); | |
98 | h2tdcVSadc->Fill(firstTDC,firstADC); | |
99 | ||
100 | //cout << "firstTDC " << firstTDC << " firstADC " << firstADC << endl; | |
101 | } | |
102 | ||
103 | } | |
104 | ||
105 | TFile *fout = new TFile("TOF_sdigitsQA.root","RECREATE"); | |
106 | htdc->Write(); | |
107 | hadc->Write(); | |
108 | h2tdcVSadc->Write(); | |
109 | hsector->Write(); | |
110 | hplate->Write(); | |
111 | hstrip->Write(); | |
112 | hpadz->Write(); | |
113 | hpadx->Write(); | |
114 | fout->Close(); | |
115 | ||
116 | ||
117 | return rc; | |
118 | ||
119 | } | |
120 |