1 Int_t AliTOFanalyzeDigits(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)
8 // Updated to the new I/O by: A. De Caro, C. Zampolli
13 TH1F *htdc = new TH1F("htdc","TDC [bin]",500,0.,15000.);
14 TH1F *hadc = new TH1F("hadc","ADC [bin]",100,0., 3000.);
16 TH1F *hsector = new TH1F("hsector","Sector",20,0.,20.);
17 TH1F *hplate = new TH1F("hplate","Plate ", 6,0., 6.);
18 TH1F *hstrip = new TH1F("hstrip","Strip ",25,0.,25.);
19 TH1F *hpadz = new TH1F("hpadz","Pad along z ",3,0.,3.);
20 TH1F *hpadx = new TH1F("hpadx","Pad along x",50,0.,50.);
21 // ADC-TDC correlation
22 TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",100,0.,3000.,500,0.,15000.);
24 // Dynamically link some shared libs
25 if (gClassTable->GetID("AliRun") < 0) {
26 gROOT->LoadMacro("loadlibs.C");
32 delete gAlice->GetRunLoader();
37 AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
40 cerr<<"Can't load RunLoader from file"<<"!\n";
46 gAlice = rl->GetAliRun();
50 cerr << "<AliTOFanalyzeDigits> AliRun object not found on file\n ";
55 AliLoader* tofl = rl->GetLoader("TOFLoader");
56 AliTOF* tof = (AliTOF*) rl->GetAliRun()->GetDetector("TOF");
58 if (tof==0x0 || tofl==0x0)
60 cerr << "<AliTOFanalyzeDigits> No TOF detector found" << endl;
65 cout << "First " << ndump << " Digits found in TOF TreeD branch have:" << endl;
70 TTree *TE = rl->TreeE();
71 iEvNum = (Int_t)TE->GetEntries();
74 AliTOFdigit *tofdigit;
76 for (Int_t ievent = 0; ievent < iEvNum; ievent++) {
77 printf ("Processing event %d \n", ievent);
80 // Get the pointer Digit tree
82 TTree *TD=tofl->TreeD();
83 tof->SetTreeAddress();
87 cout << "<AliTOFanalyzeDigits> No TreeD found" << endl;
92 TClonesArray * TOFdigits = new TClonesArray("AliTOFdigit",1000);
93 TOFdigits = tof->Digits();
94 TOFdigits = TD->GetBranch("TOF")->SetAddress(&TOFdigits);
96 Int_t nEntries = TD->GetEntries();
98 for (Int_t iEntry = 0; iEntry < nEntries; iEntry ++)
101 TD->GetEvent(iEntry);
102 Int_t ndig = TOFdigits->GetEntriesFast();
103 cout << "<AliTOFanalyzeDigits> found " << ndig
104 << " TOF digits for event " << ievent << endl;
106 for (Int_t k=0; k<ndig; k++) {
107 tofdigit = (AliTOFdigit*) TOFdigits->UncheckedAt(k);
108 Float_t tdc = tofdigit->GetTdc();
109 Float_t adc = tofdigit->GetAdc();
113 Int_t sector = tofdigit->GetSector(); // range [1-18]
114 Int_t plate = tofdigit->GetPlate(); // range [1- 5]
115 Int_t strip = tofdigit->GetStrip(); // range [1-20]
116 Int_t padz = tofdigit->GetPadz(); // range [1- 2]
117 Int_t padx = tofdigit->GetPadx(); // range [1-48]
118 // it is QA, then I perform QA!
119 Bool_t isDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
123 cout << "<AliTOFanalyzeDigits> strange digit found" << endl;
129 cout << k << "-th | " << "Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
130 cout << k << "-th | ADC " << adc << " [bin] | TDC " << tdc << " [bin]" << endl;
131 cout << "----------------------------------------------------"<< endl;
134 // filling digit volume histos
135 hsector->Fill(sector);
140 h2tdcVSadc->Fill(adc,tdc);
145 tofl->UnloadDigits();
149 } // end loop on events
151 TFile *fout = new TFile("TOF_digitsQA.root","RECREATE");
173 delete gAlice->GetRunLoader();