1 Int_t AliTOFanalyzeSDigitsV2(Int_t ndump=15, Int_t iEvNum=0)
4 // Analyzes the TOF sdigits and fills QA-histograms
5 // report problems to pierella@bo.infn.it
6 // iEvNum=0 means all events in the file
8 // Updated to the new I/O by: A. De Caro, C. Zampolli
13 TH1F *htdc = new TH1F("htdc","TDC [bin]",5000,0.,150000.);
14 TH1F *hadc = new TH1F("hadc","ADC [bin]",100,0., 3000.);
16 TH1F *hsector = new TH1F("hsector","Sector",18,0.,18.);
17 TH1F *hplate = new TH1F("hplate","Plate ", 5,0., 5.);
18 TH1F *hstrip = new TH1F("hstrip","Strip ",20,0.,20.);
19 TH1F *hpadz = new TH1F("hpadz","Pad along z ",2,0.,2.);
20 TH1F *hpadx = new TH1F("hpadx","Pad along x",48,0.,48.);
21 // ADC-TDC correlation
22 TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",500,0.,150000.,100,0.,3000.);
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 << "<AliTOFanalyzeSDigits> 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 << "<AliTOFanalyzeSDigits> no TOF detector found" << endl;
65 cout << "First " << ndump << " SDigits found in TOF TreeS branch have:" << endl;
70 TTree *TE = rl->TreeE();
71 iEvNum = (Int_t)TE->GetEntries();
74 AliTOFSDigit *tofsdigit;
76 for (Int_t ievent = 0; ievent < iEvNum; ievent++) {
77 printf ("Processing event %d \n", ievent);
80 // Get the pointer SDigit tree
82 TTree *TS=tofl->TreeS();
83 tof->SetTreeAddress();
87 cout << "<AliTOFanalyzeSDigits> No TreeS found" << endl;
92 TClonesArray * TOFsdigits = new TClonesArray("AliTOFSDigit",1000);
93 TOFsdigits = tof->SDigits();
94 TOFsdigits = TS->GetBranch("TOF")->SetAddress(&TOFsdigits);
96 Int_t nEntries = TS->GetEntries();
98 for (Int_t iEntry = 0; iEntry < nEntries; iEntry ++)
101 TS->GetEvent(iEntry);
102 Int_t ndig = TOFsdigits->GetEntriesFast();
103 cout << "<AliTOFanalyzeSDigits> found " << ndig
104 << " TOF sdigits for event " << ievent << endl;
106 for (Int_t k=0; k<ndig; k++) {
107 tofsdigit = (AliTOFSDigit*) TOFsdigits->UncheckedAt(k);
108 Float_t firstTDC = tofsdigit->GetTdc(0);
109 Float_t firstADC = tofsdigit->GetAdc(0);
110 htdc->Fill(firstTDC);
111 hadc->Fill(firstADC);
112 // TOF sdigit volumes
113 Int_t sector = tofsdigit->GetSector(); // range [0-17]
114 Int_t plate = tofsdigit->GetPlate(); // range [0- 4]
115 Int_t strip = tofsdigit->GetStrip(); // range [0-19]
116 Int_t padz = tofsdigit->GetPadz(); // range [0- 1]
117 Int_t padx = tofsdigit->GetPadx(); // range [0-47]
118 // it is QA, then I perform QA!
119 Bool_t isSDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
123 cout << "<AliTOFanalyzeSDigits> strange sdigit found" << endl;
129 cout << k << "-th | " << "Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
130 cout << k << "-th | ADC " << firstADC << " [bin] | TDC " << firstTDC << " [bin]" << endl;
131 cout << "----------------------------------------------------"<< endl;
134 // filling sdigit volume histos
135 hsector->Fill(sector);
140 h2tdcVSadc->Fill(firstTDC,firstADC);
145 tofl->UnloadSDigits();
147 } // end loop on events
152 TFile *fout = new TFile("TOF_sdigitsQA.root","RECREATE");
174 delete gAlice->GetRunLoader();