- // Hits analysis (if requested)
- if (HITS)
- GetModuleHits(ITS, ID, hist[2][L]);
-
- // Digits analysis (if requested)
- if (DIGS)
- GetModuleDigits(ITS, ID, DType(L), hist[1][L]);
-
- // Recpoints analysis (if requested)
- if (RECS)
- GetModuleRecPoints(ITS, ID, hist[3][L]);
- }
-
- hist[1][L]->Divide(hist[0][L]);
- hist[2][L]->Divide(hist[0][L]);
- hist[3][L]->Divide(hist[0][L]);
- cout << "DONE" << endl;
- }
-
- // Write on the screen the total means
- cout << endl;
- cout << "********* MEAN OCCUPANCIES *********" << endl;
- for (Int_t L = 0; L < 6; L++) {
- Double_t mean[3];
- cout << " LAYER " << L << ": " << endl;
- for (Int_t i = 0; i < 3; i++) {
- mean[i] = hist[i+1][L]->GetSumOfWeights() / hist[i+1][L]->GetNbinsX();
- Text_t title[50];
- sprintf(title, " - Layer %d, mean %4.2f - ", L + 1, mean[i]);
- hist[i+1][L]->SetTitle(title);
- cout.setf(ios::fixed);
- cout.precision(3);
- if (HITS && i == 1) {
- cout << " hits occupancy = ";
- if (mean[i] < 10.0) cout << ' ';
- cout << mean[i] << "%" << endl;
- }
- else if (DIGS && i == 0) {
- cout << " digits occupancy = ";
- if (mean[i] < 10.0) cout << ' ';
- cout << mean[i] << "%" << endl;
- }
- if (RECS && i == 2) {
- cout << " recpts occupancy = ";
- if (mean[i] < 10.0) cout << ' ';
- cout << mean[i] << "%" << endl;
- }
- }
- cout << "------------------------------------" << endl;
- }
-
- // ----------------------
- // Plots (if requested)
- // ----------------------
- if (!PLOT) return 1;
-
- TCanvas *view[4];
- if (HITS) {
- view[2] = new TCanvas("viewH", "Occupancy view (HITS)", 0, 0, 1050, 700);
- view[2]->Divide(3,2, 0.001, 0.001);
- }
- if (DIGS) {
- view[1] = new TCanvas("viewD", "Occupancy view (DIGITS)", 20, 40, 1050, 700);
- view[1]->Divide(3,2, 0.001, 0.001);
- }
- if (RECS) {
- view[3] = new TCanvas("viewR", "Occupancy view (RECPOINTS)", 40, 60, 1050, 700);
- view[3]->Divide(3,2, 0.001, 0.001);
- }
-
- for (Int_t L = 0; L < 6; L++) {
- for (Int_t i = 1; i <= 3; i++) {
- if (DIGS && i == 1)
- hist[i][L]->SetFillColor(kBlue);
- else if (HITS && i == 2)
- hist[i][L]->SetFillColor(kRed);
- else if (RECS && i == 3)
- hist[i][L]->SetFillColor(kGreen);
-
- if ((HITS && i == 2) || (DIGS && i == 1) || (RECS && i == 3)) {
- view[i]->cd(L+1);
- hist[i][L]->SetStats(kFALSE);
- hist[i][L]->Draw();
- hist[i][L]->GetXaxis()->SetTitle("zeta");
- hist[i][L]->GetYaxis()->SetTitle("%");
- view[i]->Update();
- }
- }
- }
-
- if (HITS) view[2]->SaveAs(gifH);
- if (DIGS) view[1]->SaveAs(gifD);
- if (RECS) view[3]->SaveAs(gifR);
-
- return 1;
-}
-
-void GetModuleDigits(TObject *its, Int_t ID, Int_t dtype, TH1D *counter) {
- // First of all, the macro selects the specified module,
- // then gets the array of recpoints in it and their number.
- AliITS *ITS = (AliITS*)its;
- TTree *TD = gAlice->TreeD();
- ITS->ResetDigits();
- TD->GetEvent(ID);
- TClonesArray *digits_array = ITS->DigitsAddress(dtype);
- AliITSgeom *gm = ITS->GetITSgeom();
- AliITSDetType *det = ITS->DetType(dtype);
- AliITSsegmentation *seg = det->GetSegmentationModel();
- Int_t digits_num = digits_array->GetEntries();
-
- // Get the coordinates of the module
- for (Int_t j = 0; j < digits_num; j++) {
- Float_t lx[] = {0.0,0.0,0.0}, gx[] = {0.0,0.0,0.0};
- AliITSdigit *digit = (AliITSdigit*)digits_array->UncheckedAt(j);
- Int_t iz=digit->fCoord1; // cell number z
- Int_t ix=digit->fCoord2; // cell number x
- // Get local coordinates of the element (microns)
- seg->GetPadCxz(ix, iz, lx[0], lx[2]);
- if (dtype != 1) {
- // !!!THIS CONVERSION TO HIT LRS SHOULD BE REMOVED AS SOON AS THE CODE IS FIXED
- if (!dtype) {
- lx[0] -= seg->Dx() / 2.0;
- lx[2] -= seg->Dz() / 2.0;