1 Int_t AliTOFanalyzeDigits(Int_t ndump=0, Int_t numberOfEvents=0)
4 /////////////////////////////////////////////////////////////////////////
6 // Analyzes the TOF digits and fills QA-histograms
7 // numberOfEvents=0 means all events in the file
9 // Author: F. Pierella (Bologna University)
10 // Updated to the new I/O by: A. De Caro, C. Zampolli
12 // Report problems to decaro@sa.infn.it
14 /////////////////////////////////////////////////////////////////////////
19 TH1F *htdc = new TH1F("htdc","TDC [bin]",500,0.,15000.);
20 TH1F *hadc = new TH1F("hadc","ADC [bin]",100,0., 3000.);
22 TH1F *hsector = new TH1F("hsector","Sector",18,0.,18.);
23 TH1F *hplate = new TH1F("hplate","Plate ", 5,0., 5.);
24 TH1F *hstrip = new TH1F("hstrip","Strip ",20,0.,20.);
25 TH1F *hpadz = new TH1F("hpadz","Pad along z ",2,0.,2.);
26 TH1F *hpadx = new TH1F("hpadx","Pad along x",48,0.,48.);
27 // ADC-TDC correlation
28 TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",100,0.,3000.,500,0.,15000.);
30 // Dynamically link some shared libs
31 if (gClassTable->GetID("AliRun") < 0) {
32 gROOT->LoadMacro("loadlibs.C");
38 delete AliRunLoader::Instance();
43 AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
46 cerr<<"Can't load RunLoader from file"<<"!\n";
52 gAlice = rl->GetAliRun();
56 cerr << "<AliTOFanalyzeDigits> AliRun object not found on file\n ";
61 AliLoader* tofl = rl->GetLoader("TOFLoader");
62 AliTOF* tof = (AliTOF*) rl->GetAliRun()->GetDetector("TOF");
64 if (tof==0x0 || tofl==0x0)
66 cerr << "<AliTOFanalyzeDigits> No TOF detector found" << endl;
71 if (ndump) cout << "First " << ndump << " Digits found in TOF TreeD branch have: \n";
74 if (numberOfEvents == 0) numberOfEvents = (Int_t)(rl->GetNumberOfEvents());
76 AliTOFdigit *tofdigit;
78 for (Int_t ievent = 0; ievent < numberOfEvents; ievent++) {
79 printf ("Processing event %d \n", ievent);
82 // Get the pointer Digit tree
84 TTree *TD=tofl->TreeD();
85 tof->SetTreeAddress();
89 cout << "<AliTOFanalyzeDigits> No TreeD found" << endl;
94 TClonesArray * TOFdigits = new TClonesArray("AliTOFdigit",1000);
95 TOFdigits = tof->Digits();
96 TOFdigits = TD->GetBranch("TOF")->SetAddress(&TOFdigits);
98 Int_t nEntries = TD->GetEntries();
100 for (Int_t iEntry = 0; iEntry < nEntries; iEntry ++)
103 TD->GetEvent(iEntry);
104 Int_t ndig = TOFdigits->GetEntriesFast();
105 cout << "<AliTOFanalyzeDigits> found " << ndig
106 << " TOF digits for event " << ievent << endl;
108 for (Int_t k=0; k<ndig; k++) {
109 tofdigit = (AliTOFdigit*) TOFdigits->UncheckedAt(k);
110 Float_t tdc = tofdigit->GetTdc();
111 Float_t adc = tofdigit->GetAdc();
115 Int_t sector = tofdigit->GetSector(); // range [0-17]
116 Int_t plate = tofdigit->GetPlate(); // range [0- 4]
117 Int_t strip = tofdigit->GetStrip(); // range [0-19]
118 Int_t padz = tofdigit->GetPadz(); // range [0- 1]
119 Int_t padx = tofdigit->GetPadx(); // range [0-47]
120 // it is QA, then I perform QA!
121 Bool_t isDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
125 cout << "<AliTOFanalyzeDigits> strange digit found" << endl;
131 cout << k << "-th | Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
132 cout << k << "-th | ADC " << adc << " [bin] | TDC " << tdc << " [bin] \n";
133 cout << "---------------------------------------------------- \n";
136 // filling digit volume histos
137 hsector->Fill(sector);
142 h2tdcVSadc->Fill(adc,tdc);
147 tofl->UnloadDigits();
149 } // end loop on events
154 TFile *fout = new TFile("TOF_digitsQA.root","RECREATE");
176 delete AliRunLoader::Instance();