1 Int_t AliTOFanalyzeDigits(TString headersFile, Int_t ndump=15, Int_t iEvNum=0)
4 // Analyzes the TOF digits and fills QA-histograms
5 // report problems to pierella@bo.infn.it
6 // iEvNum=0 means all events in the file
7 // Author: F. Pierella (Bologna University)
9 // Dynamically link some shared libs
10 if (gClassTable->GetID("AliRun") < 0) {
11 gROOT->LoadMacro("loadlibs.C");
21 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(headersFile.Data());
23 cout<<"headerFile already open \n";
26 if(!file)file=TFile::Open(headersFile.Data());
29 // Get AliRun object from file
31 gAlice = (AliRun*)file->Get("gAlice");
32 if (gAlice) printf("AliRun object found on file\n");
36 if (iEvNum == 0) iEvNum = (Int_t) gAlice->TreeE()->GetEntries();
39 AliTOFdigit *tofdigit;
41 AliTOF * tof = (AliTOF *) gAlice->GetDetector("TOF") ;
44 cout << "<AliTOFanalyzeDigits> No TOF detector found" << endl;
50 TH1F *htdc = new TH1F("htdc","TDC [bin]",500,0.,15000.);
51 TH1F *hadc = new TH1F("hadc","ADC [bin]",100,0., 3000.);
54 TH1F *hsector = new TH1F("hsector","Sector",20,0.,20.);
55 TH1F *hplate = new TH1F("hplate","Plate ", 6,0., 6.);
56 TH1F *hstrip = new TH1F("hstrip","Strip ",25,0.,25.);
57 TH1F *hpadz = new TH1F("hpadz","Pad along z ",3,0.,3.);
58 TH1F *hpadx = new TH1F("hpadx","Pad along x",50,0.,50.);
59 // ADC-TDC correlation
60 TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",100,0.,3000.,500,0.,15000.);
62 cout << "First " << ndump << " Digits found in TOF TreeD branch have:" << endl;
64 for (Int_t ievent = 0; ievent < iEvNum; ievent++) {
66 gAlice->GetEvent(ievent) ;
67 if(gAlice->TreeD()==0) {
68 cout << "<AliTOFanalyzeDigits> No TreeD found" << endl;
76 gAlice->ResetDigits();
77 gAlice->TreeD()->GetEvent(ievent);
78 TClonesArray * TOFdigits = tof->Digits();
80 ndig=TOFdigits->GetEntries();
82 cout << "<AliTOFanalyzeDigits> found " << ndig
83 << " TOF digits for event " << ievent << endl;
85 for (k=0; k<ndig; k++) {
86 tofdigit= (AliTOFdigit*) TOFdigits->UncheckedAt(k);
87 Float_t tdc=tofdigit->GetTdc();
88 Float_t adc=tofdigit->GetAdc();
92 Int_t sector = tofdigit->GetSector(); // range [1-18]
93 Int_t plate = tofdigit->GetPlate(); // range [1- 5]
94 Int_t strip = tofdigit->GetStrip(); // range [1-20]
95 Int_t padz = tofdigit->GetPadz(); // range [1- 2]
96 Int_t padx = tofdigit->GetPadx(); // range [1-48]
97 // it is QA, then I perform QA!
98 Bool_t isDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
101 cout << "<AliTOFanalyzeDigits> strange digit found" << endl;
107 cout << k << "-th | " << "Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
108 cout << k << "-th | ADC " << adc << " [bin] | TDC " << tdc << " [bin]" << endl;
109 cout << "----------------------------------------------------"<< endl;
112 // filling digit volume histos
113 hsector->Fill(sector);
118 h2tdcVSadc->Fill(adc,tdc);
122 } // end loop on events
124 TFile *fout = new TFile("TOF_digitsQA.root","RECREATE");