From faafc0eb7f8b5ecb75e6d0847a7f5b883d690a01 Mon Sep 17 00:00:00 2001 From: barbera Date: Mon, 14 May 2001 17:47:29 +0000 Subject: [PATCH] Modified to work with DetToLocal --- ITS/ITSOccupancy.C | 538 +++++++++++++----------------------------- ITS/ITSReadPlotData.C | 24 +- ITS/ITSgeoplot.C | 16 +- 3 files changed, 178 insertions(+), 400 deletions(-) diff --git a/ITS/ITSOccupancy.C b/ITS/ITSOccupancy.C index b6666cbdfe3..70c7314136e 100644 --- a/ITS/ITSOccupancy.C +++ b/ITS/ITSOccupancy.C @@ -2,25 +2,32 @@ "ITSOccupancy.C" - this macro calculates the mean occupancy of each ITS layer, - making also a distribution in function of the z-value of the - "fired" digits for each layer + this macro calculates the mean occupancy of each ITS layer, counting the + "fired" digits of each module, and making two overall calculi: + 1) the calculus of the mean overall layer occupancy (as the ratio + between the total number of active digits and the total number of + channels in the module; + 2) a distribution of the occupancies as a funcion of z, to obtain some + kind of most significand data for this value, along the z axis + + The macro creates also the GIF of the TCanvas where the histograms are plotted + + The arguments that must be inserted are the following: + 1) the answer to the following question (as a Bool_t) + "Can I get the total channels distribution from the file totals.root?" + if the answer is NO (false) these histograms are re-created and re-stored + in that file. + + 2) the name of the file to analyze; + NOTE: in this argument you MUST omit the ".root" extension, because the + macro uses this argument to recall the file, but also to name the + GIF & PS of the output canvas, in order to save the plot of the + distributions to the disk. If you put, as argument, the string + "file.root", the macro will look for an unexisting file named + "file.root.root"... - Because of evaluation problems, it is necessary to permit the - analysis for both hits, digits and recpoints, so it's provided an - option data which must contain - - "H" for hits - - "D" for digits - - "R" for recpoints - but it's possible to use several option in the same time - (like "HD", "HRD", and so on...) - - to avoid the problem of drawing unrequested windows, the graph are - plotted only if it is explictly requested with the option "P", that - can be inserted together to the ones described above. - - It is also possible to compile this macro, to execute it faster. - To do this, it is necessary to: + It is also possible (and recommended) to compile this macro, + to execute it faster. To do this, it is necessary to: 1) make sure that de "#define __COMPILED__" instruction below is UNcommented and the "#define __NOCOMPILED__" instruction is commented (remember that if you comment or uncomment both these instructions, the macro can't work) @@ -33,10 +40,6 @@ ".L ITSOccupancy.C+" instruction (note the number of '+' signs in each case 4) call the function with only its name, es: ITSOccupancy("HP", "galice.root") - NOTE 1: option interpretation is case-insensitive ("h" eqv "H", etc.) - NOTE 2: if you insert a filename as argument, it must be inserted only the name - (the macro attaches the extension ".root" to it, every time) - Author: Alberto Pulvirenti ******************************************************************************/ @@ -71,137 +74,117 @@ #include #endif -Int_t ITSOccupancy(char* opt, char *name = "galice", Int_t evNum = 0) { - - extern void GetModuleDigits(TObject *its, Int_t ID, Int_t dtype, TH1D *counter); - extern void GetModuleHits (TObject* its, Int_t ID, TH1D *counter); - extern void GetModuleRecPoints (TObject *its, Int_t ID, TH1D *counter); - extern Int_t DType(Int_t layer); +Int_t ITSOccupancy(char *name = "galice", Bool_t recreate = kFALSE, Int_t evNum = 0) { - // Evaluating options - TString option(opt); - Bool_t HITS = (option.Contains("h") || option.Contains("H")); - Bool_t DIGS = (option.Contains("d") || option.Contains("D")); - Bool_t RECS = (option.Contains("r") || option.Contains("R")); - Bool_t PLOT = (option.Contains("p") || option.Contains("P")); - - Text_t filename[100]; - char gifH[100], gifD[100], gifR[100]; - strcpy (filename, name); - strcpy (gifH, name); - strcpy (gifD, name); - strcpy (gifR, name); - strcat (filename, ".root"); - strcat (gifH, "H.gif"); - strcat (gifD, "D.gif"); - strcat (gifR, "R.gif"); - - if (!HITS && !DIGS && !RECS) { - cout << "\n\n--- NO DATA-TYPE SPECIFIED!!! ---\n\n"; - return 0; - } - - // -------------------------------- - // 1. ALICE objects setting phase - // -------------------------------- - - // Load the gAlice shared libs if not already in memory + // Evaluate the name of the file to open... + Int_t filelen = strlen(name); + Text_t *fileroot = new Text_t[filelen + 6]; + // ...and copy this name to the data ROOT file + strcpy (fileroot, name); + strcat (fileroot, ".root"); + + // Open the Root input file containing the AliRun data and + // the Root output data file + TFile *froot = (TFile*)gROOT->GetListOfFiles()->FindObject(fileroot); + if (!froot) froot = new TFile(fileroot, "READ"); + // Load the gAlice shared libs if not already in memory and + // clears an eventually existing AliRun object #ifdef __NOCOMPILED__ if (gClassTable->GetID("AliRun") < 0) { gROOT->LoadMacro("loadlibs.C"); loadlibs(); } #endif - if(gAlice){ + if (gAlice) { delete gAlice; - gAlice=0; + gAlice = 0; } - // Open the Root input file containing the AliRun data - // (default name is "galice.root") - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); - if (!file) file = new TFile(filename); - file->ls(); // Get the AliRun object from file (if there's none, the macro is stopped) - cout << "\nSearching in '" << filename << "'" << endl; - gAlice = (AliRun*)file->Get("gAlice"); - if (gAlice) - cout << "Ok, I found an AliRun object..." << endl; - else { - cout<<"Sorry, there isn't any AliRun object here..." << endl; - return 0; + Int_t nparticles = 0; + gAlice = (AliRun*)froot->Get("gAlice"); + if (gAlice) { + cout << "Found an AliRun object in `" << fileroot << "'" << endl; + // In this case, select the event number specified (default is 0) + nparticles = gAlice->GetEvent(evNum); + if (nparticles) + cout << "\nNumber of particles = " << nparticles << endl; + else { + cout << "NO PARTICLES!!!!" << endl; + return 0; + } } - // Select the event number specified. Default is 0. - Int_t nparticles = gAlice->GetEvent(evNum); - cout << "\nNumber of particles = " << nparticles << endl; - if (!nparticles) { - cout << "With no particles I can't do much..." << endl; + else { + cout<<"Not found any AliRun object in `" << fileroot << "'" << endl; return 0; } // Initialize the ITS and its geometry AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); AliITSgeom *gm = ITS->GetITSgeom(); - // Fill the AliITSmodule objects (only for hits) - Int_t nmodules; - if (HITS) { - ITS->InitModules(-1, nmodules); - cout << "Number of ITS modules = " << nmodules << endl; - cout << "\nFilling modules (it takes a while, now)..." << flush; - ITS->FillModules(0, 0, nmodules, " ", " "); - cout << "DONE!" << endl; - } - // ------------------------------------------------- - // B. Variables and objects definition and setting - // ------------------------------------------------- - - Double_t zmax[6] = {16.5, 16.5, 22.2, 29.7, 45.1, 50.8}; // max z measured (cm) - Double_t binw[] = {2., 2., 2., 2., 5., 5.}; // bin width for TH1Ds (cm) - - Double_t tot[6]; // total number of channels - - // Histos for plotting hits [1], digits [2] and points [3], and divisor [0] - TH1D *hist[4][6]; - - // Histograms initialization: - // Using the AliITSsegmentation object, here is deduced - // the maximum z that can be measurable for each layer, simply - // obtaining the globar coordinates of the first digit of the first module - // of each layer (that is placed at the maximum z). - for (Int_t i = 0; i < 6; i++) { - AliITSDetType *det = ITS->DetType(DType(i)); - AliITSsegmentation *seg = det->GetSegmentationModel(); - tot[i] = gm->GetNladders(i+1) * gm->GetNdetectors(i+1) * seg->GetNPads(); - cout.setf(ios::fixed); - cout << tot[i] << endl; - Text_t hname[7]; - for (Int_t j = 0; j < 4; j++) { - hname[0] = 'h'; - hname[1] = 'i'; - hname[2] = 's'; - hname[3] = 't'; - hname[4] = '0' + j; - hname[5] = '0' + i; - hname[6] = '\0'; - Int_t nbins = (Int_t)(2. * zmax[i] / binw[i]); - hist[j][i] = new TH1D(hname, "histo", nbins, -zmax[i], zmax[i]); + // Variables and objects definition and setting + Float_t zmax[] = {20.0,20.0,25.0,35.0,49.5,54.0}; // z edges for TH1F (cm) + Int_t nbins[] = {20,20,20,28,22,24}; // bins number for TH1Fs + + // Histos for plotting occupancy distributions + TH1F *above[6], *below[6]; + + if (recreate) { + // This work is done if the "recreate" option is true + TFile *file = new TFile("totals.root", "RECREATE"); + file->cd(); + for (Int_t lay = 0; lay < 6; lay++) { + Int_t nlads = gm->GetNladders(lay+1); + Int_t ndets = gm->GetNdetectors(lay+1); + Int_t dtype = lay / 2; + Int_t minID = gm->GetModuleIndex(lay+1, 1, 1); + Int_t maxID = gm->GetModuleIndex(lay+1, nlads, ndets); + Text_t ffname[20]; + sprintf(ffname, "h_%d", lay+1); + below[lay] = new TH1F(ffname, "Total z distribution of digits", nbins[lay], -zmax[lay], zmax[lay]); + cout << "Evaluating total channels number of layer " << lay+1 << endl; + for (Int_t I = minID; I <= maxID; I++) { + AliITSDetType *det = ITS->DetType(dtype); + AliITSsegmentation *seg = det->GetSegmentationModel(); + Int_t NX = seg->Npx(); + Int_t NZ = seg->Npz(); + for (Int_t ix = 0; ix <= NX; ix++) { + for (Int_t iz = 0; iz <= NZ; iz++) { + Float_t lx[] = {0.0,0.0,0.0}, gx[] = {0.0,0.0,0.0}; + seg->DetToLocal(ix, iz, lx[0], lx[2]); + gm->LtoG(I, lx, gx); + below[lay]->Fill(gx[2]); + } + } + } + // every generated histogram is written to the file + below[lay]->Write(); + // and every counter histogram is created + sprintf(ffname, "H_%d", lay+1); + above[lay] = new TH1F(ffname, "histo", nbins[lay], -zmax[lay], zmax[lay]); } } - // Here is put the value of the density for each bin of each layer's TH1D - for (Int_t i = 0; i < 6; i++) { - for (Int_t j = 0; j < hist[0][i]->GetNbinsX(); j++) { - Double_t z = hist[0][i]->GetBinLowEdge(j); - Double_t bincontent = tot[i] / (zmax[i] * 2.0) * hist[0][i]->GetBinWidth(j); - hist[0][i]->Fill(z + 0.1, bincontent / 100.0); - z += hist[0][i]->GetBinWidth(j); + else { + // Thi other work is done if the recreate option is false + TFile *file = new TFile("totals.root", "READ"); + file->ls(); + for (Int_t i = 0; i < 6; i++) { + Text_t ffname[20]; + sprintf(ffname, "h_%d", i+1); + below[i] = (TH1F*)file->Get(ffname); + sprintf(ffname, "H_%d", i+1); + above[i] = new TH1F(ffname, "histo", nbins[i], -zmax[i], zmax[i]); } } - // -------------------------------------------------------------- - // Counting the hits, digits and recpoints contained in the ITS - // -------------------------------------------------------------- + // Counting the hits, digits and recpoints contained in the ITS + TTree *TD = gAlice->TreeD(); + ITS->ResetDigits(); + Float_t mean[6]; for (Int_t L = 0; L < 6; L++) { + cout << "Layer " << L + 1 << ": " << flush; + // To avoid two nested loops, are calculated // the ID of the first and last module of the L // (remember the L goest from 0 to 5 (not from 1 to 6) @@ -210,260 +193,59 @@ Int_t ITSOccupancy(char* opt, char *name = "galice", Int_t evNum = 0) { last = gm->GetModuleIndex(L + 1, gm->GetNladders(L + 1), gm->GetNdetectors(L + 1)); // Start loop on modules - cout << "Examinating layer " << L + 1 << " ... " << flush; for (Int_t ID = first; ID <= last; ID++) { + Int_t dtype = L / 2; + AliITSDetType *det = ITS->DetType(dtype); + AliITSsegmentation *seg = det->GetSegmentationModel(); + if (dtype == 2) seg->SetLayer(L+1); - // 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; + TD->GetEvent(ID); + TClonesArray *digits_array = ITS->DigitsAddress(dtype); + 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->DetToLocal(ix, iz, lx[0], lx[2]); + gm->LtoG(ID, lx, gx); + above[L]->Fill(gx[2]); } - lx[0] /= 10000.0; // convert from microns to cm (if not SDD) - lx[2] /= 10000.0; // convert from microns to cm (if not SDD) } - gm->LtoG(ID, lx, gx); - counter->Fill(gx[2]); - } -} - -/*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(); - TArrayI ssdone(5000); // used to match p and n side digits of strips - TArrayI pair(5000); // as above - Int_t digits_num = digits_array->GetEntries(); + + above[L]->Divide(above[L], below[L], 100.0, 1.0); + mean[L] = above[L]->GetSumOfWeights() / above[L]->GetNbinsX(); + cout.setf(ios::fixed); + cout.precision(2); + cout << " digits occupancy = " << mean[L] << "%" << endl; + } + + TCanvas *view = new TCanvas("view", "Digits occupancy distributions", 600, 900); + view->Divide(2, 3); + + for (Int_t I = 1; I < 7; I++) { + view->cd(I); + Text_t title[50]; + sprintf(title, "Layer %d: %4.2f%c", I, mean[I-1], '%'); + title[6] = (Text_t)I + '0'; + above[I-1]->SetTitle(title); + above[I-1]->SetStats(kFALSE); + above[I-1]->SetXTitle("z (cm)"); + above[I-1]->SetYTitle("%"); + above[I-1]->Draw(); + view->Update(); + } + Text_t *filegif = new Text_t[filelen + 11]; + Text_t *fileps = new Text_t[filelen + 11]; + strcpy (filegif, name); + strcpy (fileps, name); + strcat (filegif, "_digs.gif"); + strcat (fileps, "_digs.ps"); + view->SaveAs(filegif); + view->SaveAs(fileps); - // Get the coordinates of the module - if (dtype == 2) { - for (Int_t j = 0; j < digits_num; j++) { - ssdone[j] = 0; - pair[j] = 0; - } - } - for (Int_t j = 0; j < digits_num; j++) { - Double_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) - if(dtype < 2) { - seg->GetPadCxz(ix, iz, lx[0], lx[2]); - if (dtype == 0) { - // !!!THIS CONVERSION TO HIT LRS SHOULD BE REMOVED AS SOON AS THE CODE IS FIXED - lx[0] -= seg->Dx() / 2.0; - lx[2] -= seg->Dz() / 2.0; - lx[0] /= 10000.0; // convert from microns to cm (SPD) - lx[2] /= 10000.0; // convert from microns to cm (SPD) - } - gm->LtoG(ID, lx, gx); - counter->Fill(gx[2]); - } - else { - // SSD: if iz==0 ---> N side; if iz==1 P side - if (ssdone[j] == 0) { - ssdone[j]=1; - pair[j]=-1; - Bool_t pside = (iz == 1); - Bool_t impaired = kTRUE; - Int_t pstrip = 0; - Int_t nstrip = 0; - if (pside) pstrip = ix; else nstrip = ix; - for (Int_t k = 0; k < digits_num; k++) { - if (ssdone[k] == 0 && impaired) { - AliITSdigitSSD *sdigit=(AliITSdigitSSD*)digits_array->UncheckedAt(k); - if (sdigit->fCoord1 != iz && sdigit->GetTracks()[0] == digit->GetTracks()[0]) { - ssdone[k]=2; - pair[j]=k; - if (pside) nstrip = sdigit->fCoord2; else pstrip = sdigit->fCoord2; - impaired=kFALSE; - } - } - } - if (!impaired) { - seg->GetPadCxz(pstrip, nstrip, lx[0], lx[2]); - lx[0] /= 10000.0; - lx[2] /= 10000.0; - gm->LtoG(ID, lx, gx); - counter->Fill(gx[2]); - } - } - } - } -}*/ -void GetModuleHits (TObject* its, Int_t ID, TH1D *counter) { - // First of all, the macro selects the specified module, - // then gets the array of hits in it and their number. - AliITS *ITS = (AliITS*) its; - AliITSmodule *module = ITS->GetModule(ID); - TObjArray *hits_array = module->GetHits(); - Int_t hits_num = hits_array->GetEntriesFast(); - // next, fills the counters with the hits coordinates' calcula - for (Int_t j = 0; j < hits_num; j++) { - AliITShit *hit = (AliITShit*) hits_array->At(j); - Double_t Z = hit->GetZG(); - if (!hit->StatusEntering()) counter->Fill(Z); - } -} - -void GetModuleRecPoints (TObject *its, Int_t ID, 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; - AliITSgeom *gm = ITS->GetITSgeom(); - TTree *TR = gAlice->TreeR(); - if (!TR || TR->GetEntries() == 0) { - cout << "The ITS wasn't clustered..." << endl; - return; - } - ITS->ResetRecPoints(); - TR->GetEvent(ID); - TClonesArray *recs_array = ITS->RecPoints(); - Int_t recs_num = recs_array->GetEntries(); - - for(Int_t j = 0; j < recs_num; j++) { - Double_t lx[3] = {0.,0.,0.}, gx[3] = {0.,0.,0.}; - AliITSRecPoint *recp = (AliITSRecPoint*)recs_array->At(j); - lx[0] = recp->GetX(); - lx[1] = 0.0; - lx[2] = recp->GetZ(); - gm->LtoG(ID, lx, gx); - counter->Fill(gx[2]); - } -} - -Int_t DType(Int_t layer) { - if (layer == 0 || layer == 1) - return 0; - else if (layer == 2 || layer == 3) - return 1; - else - return 2; + return 1; } diff --git a/ITS/ITSReadPlotData.C b/ITS/ITSReadPlotData.C index 44ac6c73bfe..c26ede82119 100644 --- a/ITS/ITSReadPlotData.C +++ b/ITS/ITSReadPlotData.C @@ -117,7 +117,7 @@ Int_t ITSReadPlotData(char *filename = "galice.root", Int_t evNum = 0) { // Detector type: 0 --> SPD, 1 --> SDD, 2 --> SSD. // Layer 1,2 --> 0 / Layer 3,4 --> 1 / Layer 5,6 --> 2 - dtype = ID[1] / 3; + dtype = (ID[1] - 1) / 2; // Once fixed the layer number, the macro calculates the max number // for ladder and detector from geometry, and accepts only suitable values. @@ -159,7 +159,8 @@ Int_t ITSReadPlotData(char *filename = "galice.root", Int_t evNum = 0) { // Defines the histograms inside the `for' cycle, so they are destroyed at the end // of every read sequqnce, in order to mek another withour segmentation faults - Text_t msg[250], xm = 0.0, ym = 0.0; + Text_t msg[250]; + Float_t xm = 0.0, ym = 0.0, zm = 0.0; switch (dtype) { case 0: xm = 1.5; zm = 7.0; break; case 1: xm = 7.5; zm = 8.0; break; @@ -322,6 +323,12 @@ Int_t GetModuleDigits(TObject *its, Int_t ID, Int_t dtype, Float_t*& X, Float_t* // while, if it doesn't, the first thing to do is dimensioning // the coordinate and energy loss arrays, and then the loop can start. + if(dtype==2){ + Int_t layer, ladder, detec; + gm->GetModuleId(ID,layer,ladder,detec); + seg->SetLayer(layer); + } + if (!digits_num) return 0; else { @@ -345,7 +352,7 @@ Int_t GetModuleDigits(TObject *its, Int_t ID, Int_t dtype, Float_t*& X, Float_t* Int_t ix=digit->fCoord2; // cell number x // Get local coordinates of the element (microns) if(dtype < 2) - seg->GetPadCxz(ix, iz, X[j], Z[j]); + seg->DetToLocal(ix, iz, X[j], Z[j]); else { // SSD: if iz==0 ---> N side; if iz==1 P side if (ssdone[j] == 0) { @@ -368,17 +375,10 @@ Int_t GetModuleDigits(TObject *its, Int_t ID, Int_t dtype, Float_t*& X, Float_t* } } if (!impaired) seg->GetPadCxz(pstrip, nstrip, X[j], Z[j]); + X[j] /= 10000.0; // convert microns to cm + Z[j] /= 10000.0; // convert microns to cm } } - if (dtype == 0) { - // !!!THIS CONVERSION TO HIT LRS SHOULD BE REMOVED AS SOON AS THE CODE IS FIXED - X[j] = X[j]-seg->Dx() / 2.0; - Z[j] = Z[j]-seg->Dz() / 2.0; - } - if (dtype != 1) { - X[j] /= 10000.0; - Z[j] /= 10000.0; - } } return digits_num; } diff --git a/ITS/ITSgeoplot.C b/ITS/ITSgeoplot.C index e37f56871bc..bc3a469a419 100644 --- a/ITS/ITSgeoplot.C +++ b/ITS/ITSgeoplot.C @@ -64,7 +64,8 @@ Int_t ITSgeoplot (char *opt="All+Rec", char *filename="galice.root") { * --- .L ITSgeoplot.C++ * --- ITSgeoplot("ListOfParametersIfAny"); * - * M.Masera 04/05/2001 19:00 + * M.Masera 14/05/2001 18:30 + * Use DetToLocal instead of GetCxz for SPD and SDD ********************************************************************/ extern void GetHitsCoor(TObject *its, Int_t mod, TObjArray & histos, Int_t subd,Bool_t verb); @@ -444,9 +445,9 @@ void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, In digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit); Int_t iz=digs->fCoord1; // cell number z Int_t ix=digs->fCoord2; // cell number x - // Get local coordinates of the element (microns) + // Get local coordinates of the element if(subd<2){ - seg->GetPadCxz(ix,iz,lcoor[0],lcoor[2]); + seg->DetToLocal(ix,iz,lcoor[0],lcoor[2]); } else{ // SSD: if iz==0 ---> N side; if iz==1 P side @@ -474,11 +475,6 @@ void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, In if(!impaired)seg->GetPadCxz(pstrip,nstrip,lcoor[0],lcoor[2]); } } - if(subd==0){ - // !!!THIS CONVERSION TO HIT LRS SHOULD BE REMOVED AS SOON AS THE CODE IS FIXED - lcoor[0]=lcoor[0]-seg->Dx()/2; - lcoor[2]=lcoor[2]-seg->Dz()/2; - } if(subd<2 || (subd==2 && ssdone[digit]==1)){ Int_t coor1=digs->fCoord1; Int_t coor2=digs->fCoord2; @@ -504,8 +500,8 @@ void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, In } if(subd<2 || (subd==2 && pair[digit]!=-1)){ // Global coordinates of the element - //SDD uses cm, SPD and SSD microns - if(subd!=1)for(Int_t j=0;j<3;j++)lcoor[j]=lcoor[j]/10000.; + //SDD and SPD use cm, SSD microns (GetPadCxz) + if(subd==2)for(Int_t j=0;j<3;j++)lcoor[j]=lcoor[j]/10000.; lcoor[1]=0.; geom->LtoG(mod,lcoor,gcoor); // global coord. in cm ragdig=sqrt(gcoor[0]*gcoor[0]+gcoor[1]*gcoor[1]); -- 2.43.0