1 Int_t AliTOFanalyzeSDigitsV2(TString headersFile, Int_t ndump=15, Int_t iEvNum=0)
3 // V2: to be used with transient fSDigits data member
5 // Analyzes the TOF sdigits and fills QA-histograms
6 // report problems to pierella@bo.infn.it
7 // iEvNum=0 means all events in the file
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();
38 AliTOF * tof = (AliTOF *) gAlice->GetDetector("TOF") ;
41 cout << "<AliTOFanalyzeSDigitsV2> No TOF detector found" << endl;
47 TH1F *htdc = new TH1F("htdc","TDC [bin]",500,0.,15000.);
48 TH1F *hadc = new TH1F("hadc","ADC [bin]",100,0., 3000.);
50 // number of slot for each sdigits
51 TH1F *hndigits = new TH1F("hndigits","fNDigits",5,0.,5.);
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 << " SDigits found in TOF TreeS branch have:" << endl;
65 for (Int_t ievent = 0; ievent < iEvNum; ievent++) {
67 char tname[100]; sprintf(tname,"TreeS%d",ievent);
69 TTree *sdigitstree=(TTree*)file->Get(tname);
71 TClonesArray * fSDigits= new TClonesArray("AliTOFSDigit", 1000);
72 sdigitstree->GetBranch("TOF")->SetAddress(&fSDigits);
74 Int_t nEntries = sdigitstree->GetEntries();
75 //cout << nEntries << endl;
77 // Loop through all entries in the tree
79 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
82 nbytes += sdigitstree->GetEvent(iEntry);
84 // Get the number of sdigits
85 Int_t ndig = fSDigits->GetEntriesFast();
86 cout << "------------------<AliTOFanalyzeSDigitsV2>------------------" << endl;
87 cout << "Found " << ndig << " TOF SDigits for event " << ievent << endl;
88 cout << "------------------------------------------------------------" << endl;
90 // start loop on sdigits
91 for (Int_t k = 0; k < ndig; k++) {
93 // Get the information for this digit
94 AliTOFSDigit *tofsdigit = (AliTOFSDigit *) fSDigits->UncheckedAt(k);
95 Float_t firstTDC=tofsdigit->GetTdc(0);
96 Float_t firstADC=tofsdigit->GetAdc(0);
97 Int_t nslot=tofsdigit->GetNDigits();
98 hndigits->Fill(nslot);
100 hadc->Fill(firstADC);
101 // TOF sdigit volumes
102 Int_t sector = tofsdigit->GetSector(); // range [1-18]
103 Int_t plate = tofsdigit->GetPlate(); // range [1- 5]
104 Int_t strip = tofsdigit->GetStrip(); // range [1-20]
105 Int_t padz = tofsdigit->GetPadz(); // range [1- 2]
106 Int_t padx = tofsdigit->GetPadx(); // range [1-48]
107 // it is QA, then I perform QA!
108 Bool_t isSDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
111 cout << "<AliTOFanalyzeSDigitsV2> strange sdigit found" << endl;
117 cout << k << "-th | " << "Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
118 cout << k << "-th | ADC " << firstADC << " [bin] | TDC " << firstTDC << " [bin]" << endl;
119 cout << "----------------------------------------------------"<< endl;
122 // filling sdigit volume histos
123 hsector->Fill(sector);
128 h2tdcVSadc->Fill(firstADC,firstTDC);
130 //cout << "firstTDC " << firstTDC << " firstADC " << firstADC << endl;
131 } // end loop on sdigits
133 } // end loop on entries
135 } // end loop on events
137 TFile *fout = new TFile("TOF_sdigitsQA.root","RECREATE");