1 Int_t AliTOFanalyzeSDigitsV2(Int_t ndump=0, Int_t iEvNum=-1, Int_t nEvent=0)
4 /////////////////////////////////////////////////////////////////////////
6 // Analyzes the TOF sdigits and fills QA-histograms
7 // iEvNum=-1 and nEvent=0 means all events in the file
9 // root[0] .L AliTOFanalyzeSDigitsV2.C
10 // root[1] AliTOFanalyzeSDigitsV2()
12 // If you want analyze only the sdigits in the 2th event
13 // (existing int the header file), see in the following:
15 // root[0] .L AliTOFanalyzeSDigitsV2.C
16 // root[1] AliTOFanalyzeSDigitsV2(0,2,1)
18 // Updated to the new I/O by: A. De Caro, C. Zampolli
20 // Report problems to: decaro@sa.infn.it
22 /////////////////////////////////////////////////////////////////////////
27 TH1F *htdc = new TH1F("htdc","TDC [bin]",5000,0.,150000.);
28 TH1F *hadc = new TH1F("hadc","ADC [bin]",100,0., 3000.);
30 TH1F *hsector = new TH1F("hsector","Sector",18,0.,18.);
31 TH1F *hplate = new TH1F("hplate","Plate ", 5,0., 5.);
32 TH1F *hstrip = new TH1F("hstrip","Strip ",20,0.,20.);
33 TH1F *hpadz = new TH1F("hpadz","Pad along z ",2,0.,2.);
34 TH1F *hpadx = new TH1F("hpadx","Pad along x",48,0.,48.);
35 // ADC-TDC correlation
36 TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",500,0.,150000.,100,0.,3000.);
38 // Dynamically link some shared libs
39 if (gClassTable->GetID("AliRun") < 0) {
40 gROOT->LoadMacro("loadlibs.C");
46 delete AliRunLoader::Instance();
51 AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
54 cerr<<"Can't load RunLoader from file"<<"!\n";
60 gAlice = rl->GetAliRun();
64 cerr << "<AliTOFanalyzeSDigits> AliRun object not found on file\n ";
71 AliLoader *tofl = rl->GetLoader("TOFLoader");
72 AliTOF *tof = (AliTOF *) rl->GetAliRun()->GetDetector("TOF");
74 if (tof==0x0 || tofl==0x0)
76 cerr << "<AliTOFanalyzeSDigits> no TOF detector found" << endl;
81 cout << "First " << ndump << " SDigits found in TOF TreeS branch have: \n";
86 if (iEvNum<0) bottomLimit=0;
87 else bottomLimit = iEvNum;
89 if (nEvent == 0) upperLimit = (Int_t)(rl->GetNumberOfEvents());
90 else upperLimit = nEvent+bottomLimit;
92 AliTOFSDigit *tofsdigit;
94 for (Int_t ievent = bottomLimit; ievent < upperLimit; ievent++) {
97 printf ("Processing event %d \n", ievent);
99 // Get the pointer SDigit tree
100 tofl->LoadSDigits("read");
101 TTree *TS=tofl->TreeS();
102 tof->SetTreeAddress();
106 cout << "<AliTOFanalyzeSDigits> No TreeS found \n";
111 TClonesArray * TOFsdigits = new TClonesArray("AliTOFSDigit",1000);
112 //TOFsdigits = tof->SDigits();
114 TOFsdigits = TS->GetBranch("TOF")->SetAddress(&TOFsdigits);
116 Int_t nEntries = TS->GetEntries();
118 for (Int_t iEntry = 0; iEntry < nEntries; iEntry ++)
121 TS->GetEvent(iEntry);
122 Int_t ndig = TOFsdigits->GetEntriesFast();
123 cout << "<AliTOFanalyzeSDigits> found " << ndig
124 << " TOF sdigits for event " << ievent << endl;
126 for (Int_t k=0; k<ndig; k++) {
127 tofsdigit = (AliTOFSDigit*) TOFsdigits->UncheckedAt(k);
128 Float_t firstTDC = tofsdigit->GetTdc(0);
129 Float_t firstADC = tofsdigit->GetAdc(0);
130 htdc->Fill(firstTDC);
131 hadc->Fill(firstADC);
132 // TOF sdigit volumes
133 Int_t sector = tofsdigit->GetSector(); // range [0-17]
134 Int_t plate = tofsdigit->GetPlate(); // range [0- 4]
135 Int_t strip = tofsdigit->GetStrip(); // range [0-19]
136 Int_t padz = tofsdigit->GetPadz(); // range [0- 1]
137 Int_t padx = tofsdigit->GetPadx(); // range [0-47]
138 // it is QA, then I perform QA!
139 Bool_t isSDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
143 cout << "<AliTOFanalyzeSDigits> strange sdigit found \n";
149 cout << k << "-th | Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
150 cout << k << "-th | ADC " << firstADC << " [bin] | TDC " << firstTDC << " [bin] \n";
151 cout << "---------------------------------------------------- \n";
154 // filling sdigit volume histos
155 hsector->Fill(sector);
160 h2tdcVSadc->Fill(firstTDC,firstADC);
165 tofl->UnloadSDigits();
167 } // end loop on events
172 TFile *fout = new TFile("TOF_sdigitsQA.root","RECREATE");
194 delete AliRunLoader::Instance();