LCOV - code coverage report
Current view: top level - TRD/TRDrec - AliTRDQADataMakerRec.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 429 0.9 %
Date: 2016-06-14 17:26:59 Functions: 3 20 15.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : ////////////////////////////////////////////////////////////////////////////
      19             : //                                                                        //
      20             : //  Produces the data needed to calculate the quality assurance.          //
      21             : //  All data must be mergeable objects.                                   //
      22             : //                                                                        //
      23             : //  Author:                                                               //
      24             : //    Sylwester Radomski (radomski@physi.uni-heidelberg.de)               //
      25             : //                                                                        //
      26             : ////////////////////////////////////////////////////////////////////////////
      27             : 
      28             : // --- ROOT system ---
      29             : #include <TClonesArray.h>
      30             : #include <TFile.h> 
      31             : #include <TH1F.h> 
      32             : #include <TH2F.h>
      33             : #include <TH3F.h>
      34             : #include <TProfile.h>
      35             : #include <TF1.h>
      36             : #include <TCanvas.h>
      37             : 
      38             : // --- AliRoot header files ---
      39             : #include "AliESDEvent.h"
      40             : #include "AliLog.h"
      41             : #include "AliRawReader.h"
      42             : #include "AliTRDcluster.h"
      43             : #include "AliTRDQADataMakerRec.h"
      44             : #include "AliTRDgeometry.h"
      45             : #include "AliTRDrawStream.h"
      46             : 
      47             : #include "AliTRDdigitsManager.h"
      48             : #include "AliTRDSignalIndex.h"
      49             : #include "AliTRDarrayADC.h"
      50             : 
      51             : #include "AliQAChecker.h"
      52             : 
      53          16 : ClassImp(AliTRDQADataMakerRec)
      54             : 
      55             : //____________________________________________________________________________ 
      56             :   AliTRDQADataMakerRec::AliTRDQADataMakerRec() : 
      57           6 :   AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTRD), "TRD Quality Assurance Data Maker")
      58          10 : {
      59             :   //
      60             :   // Default constructor
      61           4 : }
      62             : 
      63             : //____________________________________________________________________________ 
      64             : AliTRDQADataMakerRec::AliTRDQADataMakerRec(const AliTRDQADataMakerRec& qadm) :
      65           0 :   AliQADataMakerRec()
      66           0 : {
      67             :   //
      68             :   // Copy constructor 
      69             :   //
      70             : 
      71           0 :   SetName((const char*)qadm.GetName()) ; 
      72           0 :   SetTitle((const char*)qadm.GetTitle()); 
      73             : 
      74           0 : }
      75             : 
      76             : //__________________________________________________________________
      77             : AliTRDQADataMakerRec& AliTRDQADataMakerRec::operator=(const AliTRDQADataMakerRec& qadm)
      78             : {
      79             :   //
      80             :   // Equal operator.
      81             :   //
      82             : 
      83           0 :   this->~AliTRDQADataMakerRec();
      84           0 :   new(this) AliTRDQADataMakerRec(qadm);
      85           0 :   return *this;
      86             : 
      87           0 : }
      88             : 
      89             : //____________________________________________________________________________ 
      90             : void AliTRDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
      91             : {
      92             :   //
      93             :   // Detector specific actions at end of cycle
      94             :   //
      95             :   //TStopwatch watch;
      96             :   //watch.Start();
      97           0 :   ResetEventTrigClasses();
      98           0 :   AliDebug(AliQAv1::GetQADebugLevel(), "End of TRD cycle");
      99             :   //
     100           0 :   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {  // loop over event types
     101             :     //
     102           0 :     if (!IsValidEventSpecie(specie, list)) continue;
     103           0 :     SetEventSpecie(AliRecoParam::ConvertIndex(specie));
     104             :     //
     105           0 :     for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
     106             :       //
     107           0 :       if (task == AliQAv1::kRAWS) {             
     108           0 :         TH2 *mnCls   = (TH2*)GetRawsData(1, itc);
     109           0 :         TH2 *mClsDet = (TH2*)GetRawsData(2, itc); 
     110           0 :         if (mnCls && mClsDet) mClsDet->Divide(mnCls);
     111           0 :       }
     112             :       //      
     113           0 :       if (task == AliQAv1::kRECPOINTS) {
     114             :         //
     115           0 :         TH1F * hist = new TH1F("fitHist", "", 200, -0.5, 199.5);
     116           0 :         TObjArray& arrRP = *GetRecPointsDataOfTrigClass(itc); // RS Histos matching to trigger class
     117             :         // fill detector map;
     118           0 :         TH1* h0     = (TH1*) arrRP[0];
     119           0 :         TH1* detMap = (TH1*) arrRP[87];
     120           0 :         if (h0 && detMap) {
     121           0 :           for(Int_t i = 0 ; i < 540 ; i++) {
     122           0 :             Double_t v = h0->GetBinContent(i+1);
     123           0 :             Int_t sm = i/30;
     124           0 :             Int_t det = i%30;
     125           0 :             Int_t bin = detMap->FindBin(sm, det);
     126           0 :             detMap->SetBinContent(bin, v);
     127             :           }
     128           0 :         }
     129             :         //        
     130             :         // Rec points full chambers
     131           0 :         TH2* h2tmp = (TH2*) arrRP[1];
     132           0 :         TH1* h12   = (TH1*) arrRP[12];
     133           0 :         TH1* h13   = (TH1*) arrRP[13];
     134           0 :         if (h2tmp && h12 && h13) {
     135           0 :           for (Int_t i = 0 ; i < 540 ; i++) {
     136             :             //AliDebug(AliQAv1::GetQADebugLevel(), Form("I = %d", i));
     137           0 :             hist->Reset();       
     138             :             // project TH2F into TH1F 
     139           0 :             for(Int_t b = 1 ; b < hist->GetXaxis()->GetNbins()-1 ; b++) {
     140           0 :               Double_t xvalue = hist->GetBinCenter(b);
     141           0 :               Int_t bin = h2tmp->FindBin(i,xvalue);
     142           0 :               Double_t value =  h2tmp->GetBinContent(bin);
     143           0 :               hist->SetBinContent(b, value);
     144             :             }
     145             :             //AliDebug(AliQAv1::GetQADebugLevel(), Form("Sum = %d %f\n", i, hist->GetSum()));
     146           0 :             if (hist->GetSum() < 100) continue; // not enougth data in a chamber
     147             :             //
     148           0 :             hist->Fit("landau", "q0", "goff", 10, 180);
     149           0 :             TF1 *fit = hist->GetFunction("landau");
     150           0 :             h12->Fill(fit->GetParameter(1));
     151           0 :             h13->Fill(fit->GetParameter(2));
     152           0 :           }
     153           0 :         }
     154             :         //        
     155             :         // time-bin by time-bin sm by sm
     156           0 :         TH3* h3tmp = (TH3*) arrRP[10]; 
     157           0 :         if (h3tmp) {
     158           0 :           for(Int_t i=0; i<18; i++) { // loop over super-modules      
     159           0 :             for(Int_t j=0; j<kTimeBin; j++) { // loop over time bins   
     160           0 :               hist->Reset();
     161           0 :               for(Int_t b = 1 ; b < hist->GetXaxis()->GetNbins()-1 ; b++) {
     162           0 :                 Double_t xvalue = hist->GetBinCenter(b);
     163             :                 Double_t svalue = 0.0;
     164           0 :                 for(Int_t det = i*30 ; det < (i+1)*30 ; det++) { // loop over detectors
     165           0 :                   Int_t bin = h3tmp->FindBin(det,j,xvalue);
     166           0 :                   Double_t value =  h3tmp->GetBinContent(bin);
     167           0 :                   svalue += value;
     168             :                 }
     169             :                 //AliDebug(AliQAv1::GetQADebugLevel(), Form("v = %f\n", value));
     170           0 :                 hist->SetBinContent(b, svalue);
     171             :               }
     172             :               //
     173           0 :               if (hist->GetSum() < 100) continue;
     174             :               //
     175           0 :               hist->Fit("landau", "q0", "goff", 10, 180);
     176           0 :               TF1 *fit = hist->GetFunction("landau");
     177             :               //
     178           0 :               TH1 *hi = (TH1*)arrRP[14+18+i];
     179           0 :               if (!hi) continue;
     180           0 :               hi->SetMarkerStyle(20);
     181           0 :               Int_t bin = hi->FindBin(j);
     182             :               // printf("%d %d %d\n", det, j, bin);
     183             :               //
     184           0 :               Double_t value = TMath::Abs(fit->GetParameter(1));
     185           0 :               Double_t error = TMath::Abs(fit->GetParError(1));
     186             :               //
     187           0 :               if (value/error < 3) continue; // insuficient statistics
     188             :               //
     189           0 :               hi->SetBinContent(bin, value);
     190           0 :               hi->SetBinError(bin, error);   
     191           0 :             } // j
     192             :           } // i
     193             :           //
     194             :           // for numerical convergence
     195           0 :           TF1 *form = new TF1("formLandau", "landau", 0, 200);
     196             :           //
     197             :           // time-bin by time-bin chamber by chamber
     198           0 :           for (Int_t i=0; i<540; i++) {
     199           0 :             for(Int_t j=0; j<kTimeBin; j++) {
     200             :               //            
     201           0 :               hist->Reset();
     202           0 :               for(Int_t b = 1 ; b < hist->GetXaxis()->GetNbins()-1 ; b++) {
     203           0 :                 Double_t xvalue = hist->GetBinCenter(b);
     204           0 :                 Int_t bin = h3tmp->FindBin(i,j,xvalue);
     205           0 :                 Double_t value =  h3tmp->GetBinContent(bin);
     206             :                 //AliDebug(AliQAv1::GetQADebugLevel(), Form("v = %f\n", value));
     207           0 :                 hist->SetBinContent(b, value);
     208             :               }
     209             :               //
     210           0 :               if (hist->GetSum() < 100) continue;
     211             :               
     212           0 :               form->SetParameters(1000, 60, 20);
     213           0 :               hist->Fit(form, "q0", "goff", 20, 180);
     214             :               
     215           0 :               Int_t sm = i/30;
     216           0 :               Int_t det = i%30;
     217           0 :               TH1 *hi = (TH1*)arrRP[14+sm];
     218           0 :               if (!hi) continue;
     219           0 :               Int_t bin = hi->FindBin(det,j);
     220             :               // printf("%d %d %d\n", det, j, bin);
     221             :               //
     222           0 :               Double_t value = TMath::Abs(form->GetParameter(1));
     223           0 :               Double_t error = TMath::Abs(form->GetParError(1));
     224             :               //
     225           0 :               if (value/error < 3) continue;
     226             :               //
     227           0 :               hi->SetBinContent(bin, value);
     228           0 :               hi->SetBinError(bin, error);
     229           0 :             } // j
     230             :           } // i
     231           0 :         } // h3tmp      
     232           0 :         if (hist) delete hist;
     233           0 :       } // RECPOINTS
     234             :       //
     235             :       //////////////////////////
     236             :       // const Int_t knbits = 6;
     237             :       // const char *suf[knbits] = {"TPCi", "TPCo", "TPCz", "TRDo", "TRDr", "TRDz"};
     238             :       //const char *sufRatio[4] = {"TRDrTRDo", "TRDoTPCo", "TRDrTPCo", "TRDzTPCo"};
     239             :       
     240           0 :       if (task == AliQAv1::kESDS) {
     241             :         //
     242             :         const Int_t knRatio = 4;
     243             :         const Int_t kN[knRatio] = {4,3,4,5};
     244             :         const Int_t kD[knRatio] = {3,1,1,3}; 
     245             :         //
     246           0 :         TObjArray& arrES = *GetESDsDataOfTrigClass(itc); // RS Histos matching to trigger class
     247             :         // create ratios
     248           0 :         for(Int_t type = 0 ; type < 2 ; type++) {
     249           0 :           for(Int_t i = 0 ; i < knRatio ; i++) {         
     250           0 :             TH1 *ratio = (TH1*)arrES[19 + 2*i + type];
     251           0 :             TH1 *histN = (TH1*)arrES[3 + 2*kN[i] + type];
     252           0 :             TH1 *histD = (TH1*)arrES[3 + 2*kD[i] + type];
     253           0 :             if ( ! (ratio && histN && histD) ) continue;
     254           0 :             BuildRatio(ratio, histN, histD);
     255             :             //ratio->Reset();
     256             :             //ratio->Add(histN);
     257             :             //ratio->Divide(histD);
     258           0 :           }
     259             :         }
     260             :         // ratio for the fraction of electrons per stack
     261           0 :         TH1 *histN = (TH1*)arrES[33];
     262           0 :         TH1 *histD = (TH1*)arrES[32];
     263           0 :         TH1 *ratio = (TH1*)arrES[34];
     264           0 :         BuildRatio(ratio, histN, histD);
     265           0 :       } // ESDs
     266             :     } // RS: loop over eventual clones per trigger class
     267           0 :   } // loop over species
     268             :   // call the checker
     269           0 :   AliQAChecker::Instance()->Run(AliQAv1::kTRD, task, list) ;    
     270             :   //
     271           0 : }
     272             : 
     273             : //____________________________________________________________________________ 
     274             : void AliTRDQADataMakerRec::InitESDs()
     275             : {
     276             :   //
     277             :   // Create ESDs histograms in ESDs subdir
     278             :   //
     279             :   const Bool_t expert   = kTRUE ; 
     280             :   const Bool_t image    = kTRUE ; 
     281             :   
     282             :   const Int_t kNhist = 36+5+4;
     283             : 
     284           0 :   TH1 *hist[kNhist];
     285             :   Int_t histoCounter = -1 ;
     286             : 
     287           0 :   hist[++histoCounter] = new TH1F("qaTRD_esd_ntracks", "TRD esd ntracks;Number of tracks;Counts", 300, -0.5, 299.5);
     288           0 :   hist[++histoCounter] = new TH1F("qaTRD_esd_sector", "TRD esd sector;Sector;Counts", 18, -0.5, 17.7);
     289           0 :   hist[++histoCounter] = new TH1F("qaTRD_esd_bits", "TRD esd bits;Bits;Counts", 64, -0.5, 63.5);
     290             : 
     291             :   const Int_t knbits = 6;
     292           0 :   const char *suf[knbits] = {"TPCi", "TPCo", "TPCz", "TRDo", "TRDr", "TRDz"};
     293             : 
     294             :   // histo = 3
     295           0 :   for(Int_t i=0; i<knbits; i++) { 
     296           0 :     hist[++histoCounter] = new TH1F(Form("qaTRD_esd_pt%s",suf[i]), Form("qaTRD_esd_pt%s;p_{T} (GeV/c);Counts",suf[i]), 100, 0, 10);
     297           0 :     hist[++histoCounter] = new TH1F(Form("qaTRD_esd_trdz%s", suf[i]), ";z (cm)", 200, -400, 400); 
     298             :   }
     299             : 
     300           0 :   hist[++histoCounter] = new TH1F("qaTRD_esd_clsTRDo", "TRDo;number of clusters;Counts", 180, -0.5, 179.5);;
     301           0 :   hist[++histoCounter] = new TH1F("qaTRD_esd_clsTRDr", "TRDr;number of clusters;Counts", 180, -0.5, 179.5);;
     302           0 :   hist[++histoCounter] = new TH1F("qaTRD_esd_clsTRDz", "TRDz;number of clusters;Counts", 180, -0.5, 179.5);;
     303             :   //hist[++histoCounter] = new TH1F("qaTRD_esd_clsRatio", ";cluster ratio", 100, 0., 1.3);;
     304             : 
     305           0 :   hist[++histoCounter] = new TH2F("qaTRD_esd_sigMom", "TRD esd sig Mom;momentum (GeV/c);signal", 100, 0, 5, 200, 0, 1e3);
     306             : 
     307             :   // end of cycle plots (hist 19)
     308           0 :   const char *sufRatio[4] = {"TRDrTRDo", "TRDoTPCo", "TRDrTPCo", "TRDzTPCo"};
     309             : 
     310           0 :   for(int i=0; i<4; i++) {
     311           0 :     hist[++histoCounter] = new TH1F(Form("qaTRD_esd_pt%s",sufRatio[i]), 
     312           0 :                                     Form("Efficiency in Pt %s;p_{T};eff", sufRatio[i]),
     313             :                                     100, 0, 10);
     314             : 
     315           0 :     hist[++histoCounter] = new TH1F(Form("qaTRD_esd_trdz%s",sufRatio[i]), 
     316           0 :                                     Form("Efficiency in Z %s;z (cm);eff", sufRatio[i]),
     317             :                                     200, -400, 400);
     318             :   }
     319             : 
     320             :   // 27 - 31
     321           0 :   hist[27] = new TH1F("qaTRD_esd_quality", "TRD esd quality;quality;Counts", 120, 0, 12);
     322           0 :   hist[28] = new TH1F("qaTRD_esd_budget", "TRD esd budget;NN;Counts", 110, -1000, 100);
     323           0 :   hist[29] = new TH1F("qaTRD_esd_chi2", "TRD esd chi2;chi2;Counts", 200, 0, 100);
     324           0 :   hist[30] = new TH1F("qaTRD_esd_timeBin", "TRD esd timeBin;time bin;Counts", 7, -0.5, 6.5);
     325           0 :   hist[31] = new TH1F("qaTRD_esd_pidQuality", "pid Quality;quality;;Counts", 7, -0.5, 6.5);
     326             : 
     327             :   // stack by stack electron identyfication
     328           0 :   hist[32] = new TH1F("qaTRD_esd_tracksStack", "number of all tracks;stack;Counts", 90, -0.5, 89.5);
     329           0 :   hist[33] = new TH1F("qaTRD_esd_electronStack", "number of electron tracks;stack;Counts", 90, -0.5, 89.5);
     330           0 :   hist[34] = new TH1F("qaTRD_esd_elRatioStack", "fraction of electron tracks;stack;Counts", 90, -0.5, 89.5);
     331           0 :   hist[35] = new TH1F("qaTRD_esd_thetaOut", ";tan(theta);", 100, -1, 1);
     332             :   
     333           0 :   const char *partType[5] = {"Electron", "Muon", "Pion", "Kaon", "Proton"}; 
     334             : 
     335           0 :   for(Int_t i=0; i<AliPID::kSPECIES; i++)
     336           0 :     hist[36+i] = new TH1F(Form("qaTRD_esd_pid%d",i),
     337           0 :                           Form("%s;probability;Counts",partType[i]), 100, 0, 1);
     338             :  
     339             :   // dE/dX vs momentum in three regions
     340           0 :   const char *zoneName[4] = {"total charge", "ampilification range", "plateau", "TR range"};
     341             :  
     342             :   // prepare the scale from 0.1 to 10 GeV
     343             :   const Int_t nscalex= 50;
     344           0 :   Double_t scalex[nscalex+1];
     345           0 :   Double_t dd = (TMath::Log(10) - TMath::Log(0.5)) / nscalex;
     346           0 :   for(Int_t ix=0; ix<nscalex+1; ix++) {
     347           0 :     scalex[ix] = 0.5 * TMath::Exp(dd * ix);
     348             :   }
     349             : 
     350             :   const Int_t nscaley = 50;
     351           0 :   Double_t scaley[nscaley+1];
     352           0 :   for(Int_t iy=0; iy<nscaley+1; iy++) {
     353           0 :     scaley[iy] = iy * (3e3/nscaley);
     354             :   }
     355             :     
     356             : 
     357           0 :   for(Int_t i=0; i<4; i++) {
     358           0 :     hist[41+i] = new TH2F(Form("qaTRD_esd_signalPzone_%d",i), 
     359           0 :                           Form("%s;momentum (GeV/c);signal (a.u.)", zoneName[i]),
     360           0 :                           nscalex, scalex, nscaley, scaley);
     361             :   }
     362             : 
     363           0 :   for(Int_t i=0; i<kNhist; i++) {
     364             :     //hist[i]->Sumw2();
     365           0 :     Add2ESDsList(hist[i], i, !expert, image);
     366             :   }
     367             :   //
     368           0 :   ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
     369           0 : }
     370             : 
     371             : //____________________________________________________________________________ 
     372             : void AliTRDQADataMakerRec::InitRecPoints()
     373             : {
     374             :   //
     375             :   // Create Reconstructed Points histograms in RecPoints subdir
     376             :   //
     377             :   const Bool_t expert   = kTRUE ; 
     378             :   const Bool_t image    = kTRUE ; 
     379             :   
     380             :   //printf("Helo from Init rec points\n");
     381             : 
     382             :   const Int_t kNhist = 14 + 4 * 18 + 2 + 9;// + 540;
     383           0 :   TH1 *hist[kNhist];
     384             : 
     385           0 :   hist[0] = new TH1F("qaTRD_recPoints_det", "RRD recPoints det;Detector ID of the cluster;Counts", 540, -0.5, 539.5);
     386           0 :   hist[1] = new TH2F("qaTRD_recPoints_amp", "TRD recPoints amp;Amplitude;??", 540, -0.5, 539, 200, -0.5, 199.5);
     387           0 :   hist[2] = new TH1F("qaTRD_recPoints_npad", "TRD recPoints npad;Number of Pads;Counts", 12, -0.5, 11.5);
     388             : 
     389           0 :   hist[3] = new TH1F("qaTRD_recPoints_dist2", "TRD recPoints dist2;residuals [2pad];Counts", 100, -1, 1);
     390           0 :   hist[4] = new TH1F("qaTRD_recPoints_dist3", "TRD recPoints dist3;residuals [3pad];Counts", 100, -1, 1);
     391           0 :   hist[5] = new TH1F("qaTRD_recPoints_dist4", "TRD recPoints dist4;residuals [4pad];Counts", 100, -1, 1);
     392           0 :   hist[6] = new TH1F("qaTRD_recPoints_dist5", "TRD recPoints dist5;residuals [5pad];Counts", 100, -1, 1);
     393             : 
     394           0 :   hist[7] = new TH2F("qaTRD_recPoints_rowCol", "TRDrecPointsrowCol;row;col", 16, -0.5, 15.5, 145, -0.5, 144.5);
     395           0 :   hist[8] = new TH1F("qaTRD_recPoints_time", "TRDrecPoints time;time bin;Counts", kTimeBin, -0.5, kTimeBin-0.5);
     396           0 :   hist[9] = new TH1F("qaTRD_recPoints_nCls", "TRD recPoints nCls;number of clusters;Counts", 500, -0.5, 499.5);
     397             : 
     398           0 :   hist[10] = new TH3F("qaTRD_recPoints_sigTime", "TRD recPoints sigTime;chamber;time bin;signal", 
     399             :                       540, -0.5, 539.5, kTimeBin, -0.5, kTimeBin-0.5, 200, -0.5, 199.5);
     400           0 :   hist[11] = new TProfile("qaTRD_recPoints_prf", "TRD recPoints prf;distance;center of gravity;Counts"
     401             :                          , 120, -0.6, 0.6, -1.2, 1.2, "");
     402             : 
     403           0 :   hist[12] = new TH1F("qaTRD_recPoints_ampMPV", "TRD recPoints ampMPV;amplitude MPV;Counts", 150, 0, 150);
     404           0 :   hist[13] = new TH1F("qaTRD_recPoints_ampSigma", "TRD recPoints ampSigma;amplitude Sigma;Counts", 200, 0, 200); 
     405             :   
     406             :   // chamber by chamber
     407           0 :   for(Int_t i=0; i<18; i++) {
     408           0 :     hist[14+i] = new TH2F(Form("qaTRD_recPoints_sigTime_sm%d",i), Form("sm%d;det;time bin",i), 
     409             :                         30, -0.5, 29.5, kTimeBin, -0.5, kTimeBin-0.5);
     410           0 :     hist[14+i]->SetMinimum(0);
     411           0 :     hist[14+i]->SetMaximum(150);
     412             :   }
     413             :  
     414             :   // time bin by time bin sm-by-sm
     415           0 :   for(Int_t i=0; i<18; i++) {
     416           0 :     hist[14+18+i] = new TH1F(Form("qaTRD_recPoints_sigTimeShape_sm%d", i), 
     417           0 :                              Form("sm%d;time bin;signal",i),
     418             :                              kTimeBin, -0.5, kTimeBin-0.5);
     419             : 
     420           0 :     hist[14+18+i]->SetMaximum(150);    
     421             :   }
     422             : 
     423             :   // str = 50
     424           0 :   for(Int_t i=0; i<18; i++) {
     425           0 :     hist[50+i] = new TH1F(Form("qaTRD_recPoints_nCls_sm%d",i),
     426           0 :                           Form("sm%d;time bin;number of clusters",i),
     427             :                           kTimeBin, -0.5, kTimeBin-0.5);
     428             :   }
     429             : 
     430             :   // str = 68
     431           0 :   for(Int_t i=0; i<18; i++) {
     432           0 :     hist[68+i] = new TH1F(Form("qaTRD_recPoints_totalCharge_sm%d", i),
     433           0 :                           Form("sm%d;time bin;total charge", i),
     434             :                           kTimeBin, -0.5, kTimeBin-0.5);
     435             :   }
     436             : 
     437           0 :   hist[86] = new TH1F("qaTRD_recPoints_signal", "TRD recPoints signal;amplitude;Counts", 400, -0.5, 399.5);
     438           0 :   hist[87] = new TH2F("qaTRD_recPoints_detMap", "TRD recPoints detMap;sm;chamber;Counts", 18, -0.5, 17.5, 30, -0.5, 29.5);
     439             : 
     440             :   
     441             :   // amplitude as a function of the pad size
     442           0 :   for(Int_t i=0; i<9; i++) {
     443           0 :     hist[88+i] = new TH1F(Form("qaTRD_recPoints_signalNpad_%d", i+2), Form("qaTRD_recPoints_signalNpad_%d;amplitude, ADC", i+2), 400, -0.5, 399.5); 
     444             :   }
     445             :   
     446             :   // one 2D histogram per chamber
     447             :   //  for(Int_t i=0; i<540; i++) {
     448             :   //  hist[88+i] = new TH2F(Form("qaTRD_recPoints_map%d", i), ";col;row", 16, -0.5, 15.5, 144, -0.5, 143.5);
     449             :   //}
     450             : 
     451             : 
     452           0 :   for(Int_t i=0; i<kNhist; i++) {
     453             :     //hist[i]->Sumw2();
     454           0 :     Add2RecPointsList(hist[i], i, !expert, image);
     455             :   }
     456             :   //
     457           0 :   ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
     458           0 : }
     459             : 
     460             : //____________________________________________________________________________ 
     461             : void AliTRDQADataMakerRec::InitRaws()
     462             : {
     463             :   //
     464             :   // create Raws histograms in Raws subdir
     465             :   //
     466             :   const Bool_t expert   = kTRUE ; 
     467             :   const Bool_t saveCorr = kTRUE ; 
     468             :   const Bool_t image    = kTRUE ; 
     469             :   
     470           0 :   AliInfo("Initialization of QA for Raw Data");
     471             :   
     472             :   const Int_t kNhist = 7;
     473           0 :   TH1 *hist[kNhist];
     474             : 
     475           0 :   hist[0] = new TH2F("qaTRD_raws_nADC","number of ADC channels;sector;detector", 18, -0.5, 17.5, 30, -0.5, 29.5);
     476           0 :   hist[1] = new TH2F("qaTRD_raws_nCls", "number of clusters;sector;detector", 18, -0.5, 17.5, 30, -0.5, 29.5);
     477           0 :   hist[2] = new TH2F("qaTRD_raws_meanSig", "mean signal;sector;detector", 18, -0.5, 17.5, 30, -0.5, 29.5);
     478             :   
     479           0 :   hist[3] = new TH1F("qaTRD_raws_ADC", "ADC amplitude;ADC counts", 100, -0.5, 99.5);
     480           0 :   hist[4] = new TH1F("qaTRD_raws_Cls", "Cluster amplitude; ADC counts", 100, -0.5, 199.5);
     481           0 :   hist[5] = new TH2F("qaTRD_raws_ClsTb", "Clusters vs Time Bin;time bin;amoplitude", 30, -0.5, 29.5, 200, -0.5, 199.5);
     482             :   
     483           0 :   hist[6] = new TH2F("qaTRD_raws_ClsAmpDet", ";detector;amplitude", 540, -0.5, 539.5, 100, 0, 200);
     484             :   
     485             : 
     486             :   /*
     487             :     hist[0] = new TH2F("qaTRD_raws_DataVolume", ";Sector;Data Volume, kB", 18, -0.5, 17.5, 100, 0, 30);
     488             :     hist[1] = new TH2F("qaTRD_raws_HC", "Data Headers;Sector;HC", 18, -0.5, 17.5, 60, -0.5, 59.5);
     489             :     hist[2] = new TH2F("qaTRD_raws_LME", "Link Monitor Error;Sector;HC", 18, -0.5, 17.5, 60, -0.5, 59.5);
     490             :     
     491             :     hist[3] = new TH1F("qaTRD_rawd_cls", "Clusters amplitude;ADC counts", 100, 0, 200);
     492             :     hist[4] = new TH2F("qaTRD_raws_clsTB", "amplitude - time bins;time bin;amplitude"
     493             :     30, -0.5, 29.5, 100, 0, 200);
     494             :     hist[5] = new TH2F("qaTRD_raws_clsSec", "amplitude in sectors;Sector;amplitude, ADCs"
     495             :     18, -0.5, 17.5);
     496             :   */
     497             : 
     498             : 
     499             :   // register
     500           0 :   for(Int_t i=0; i<kNhist; i++) {
     501             :     //hist[i]->Sumw2();
     502           0 :     Add2RawsList(hist[i], i, !expert, image, !saveCorr);
     503             :   }
     504             :   //
     505           0 :   ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
     506           0 : }
     507             : 
     508             : //____________________________________________________________________________
     509             : void AliTRDQADataMakerRec::MakeESDs(AliESDEvent * esd)
     510             : {
     511             :   //
     512             :   // Make QA data from ESDs
     513             :   //
     514             :   
     515           0 :   Int_t nTracks = esd->GetNumberOfTracks();
     516           0 :   FillESDsData(0,nTracks);
     517             : 
     518             :   // track loop
     519           0 :   for (Int_t iTrack = 0; iTrack<nTracks; iTrack++) {
     520             : 
     521           0 :     AliESDtrack *track = esd->GetTrack(iTrack);
     522           0 :     const AliExternalTrackParam *paramOut = track->GetOuterParam();
     523           0 :     const AliExternalTrackParam *paramIn = track->GetInnerParam();
     524             : 
     525             :     // long track ..
     526           0 :     if (!paramIn) continue;
     527           0 :     if (!paramOut) continue;
     528             : 
     529             :     // not a kink
     530           0 :     if (track->GetKinkIndex(0) > 0) continue; 
     531             : 
     532           0 :     Double_t extZ = GetExtZ(paramIn);
     533           0 :     if (TMath::Abs(extZ) > 320) continue; // acceptance cut
     534             : 
     535             :     // .. in the acceptance
     536           0 :     Int_t sector = GetSector(paramOut->GetAlpha());
     537           0 :     Int_t stack = GetStack(paramOut);
     538             : 
     539             :     UInt_t u = 1;
     540           0 :     UInt_t status = track->GetStatus();
     541           0 :     for(Int_t bit=0; bit<32; bit++) 
     542           0 :       if (u<<bit & status) FillESDsData(2,bit);
     543             : 
     544             :     const Int_t knbits = 6; 
     545           0 :     Int_t bit[6] = {0,0,0,0,0,0};    
     546           0 :     bit[0] = status & AliESDtrack::kTPCin;
     547           0 :     bit[1] = status & AliESDtrack::kTPCout;
     548           0 :     bit[2] = (status & AliESDtrack::kTPCout) && !(status & AliESDtrack::kTRDout);
     549           0 :     bit[3] = status & AliESDtrack::kTRDout;
     550           0 :     bit[4] = status & AliESDtrack::kTRDrefit;
     551           0 :     bit[5] = (status & AliESDtrack::kTRDout) && !(status & AliESDtrack::kTRDrefit);
     552             : 
     553             :     // transverse momentum
     554             :     //const Double_t *val = paramOut->GetParameter(); // parameters at the Outer plane
     555           0 :     Double_t pt = paramOut->Pt(); //1./TMath::Abs(val[4]);
     556             : 
     557           0 :     for(Int_t b=0; b<knbits; b++) {
     558           0 :       if (bit[b]) {
     559           0 :         FillESDsData(2*b+3,pt); 
     560           0 :         FillESDsData(2*b+4,extZ);
     561           0 :       }
     562             :     }
     563             : 
     564             :     // clusters
     565           0 :     for(Int_t b=0; b<3; b++) 
     566           0 :       if (bit[3+b]) FillESDsData(b+15,track->GetTRDncls0());
     567             : 
     568             :     // refitted only
     569           0 :     if (!bit[4]) continue;
     570             : 
     571             :     //fQuality->Fill(track->GetTRDQuality());
     572             :     //fBudget->Fill(track->GetTRDBudget());
     573             :     //fSignal->Fill(track->GetTRDsignal());
     574             : 
     575           0 :     FillESDsData(1,sector);
     576           0 :     FillESDsData(18,track->GetP(), track->GetTRDsignal());
     577             : 
     578           0 :     FillESDsData(27,track->GetTRDQuality());
     579           0 :     FillESDsData(28,track->GetTRDBudget());
     580           0 :     FillESDsData(29,track->GetTRDchi2());
     581           0 :     FillESDsData(30,track->GetTRDTimBin(0));
     582           0 :     FillESDsData(31,track->GetTRDntrackletsPID());
     583             :     
     584             :     
     585             :     // dedx
     586           0 :     for(Int_t k=0; k<4; ++k) {
     587             :       Double_t dedx = 0;
     588           0 :       for(Int_t j=0; j<6; j++) {
     589           0 :         dedx += track->GetTRDslice(j, k-1);
     590             :       }
     591           0 :       FillESDsData(41+k,paramOut->GetP(), dedx/6.);
     592             :     }
     593             : 
     594             :     // probabilities
     595           0 :     if (status & AliESDtrack::kTRDpid) {
     596           0 :       for(Int_t k=0; k<AliPID::kSPECIES; ++k) 
     597           0 :         FillESDsData(36+k,track->GetTRDpid(k));
     598           0 :     }
     599             : 
     600             :     // probabilities uniformity
     601           0 :     if (track->GetTRDntrackletsPID() < 6) continue;
     602           0 :     FillESDsData(35,paramOut->GetZ()/paramOut->GetX());
     603             :     
     604           0 :     Int_t idx = 5 * sector + stack;
     605           0 :     FillESDsData(32,idx); // all tracks
     606           0 :     if (track->GetTRDpid(AliPID::kElectron) > 0.9) 
     607           0 :       FillESDsData(33,idx); // electrons only
     608             : 
     609             :     
     610             : 
     611             :     /*
     612             :     hist[27] = new TH1F("qaTRD_esd_quality", ";quality", 120, 0, 12);
     613             :     hist[28] = new TH1F("qaTRD_esd_budget", ";NN", 110, -1000, 100);
     614             :     hist[29] = new TH1F("qaTRD_esd_chi2", ";chi2", 300, 0, 100);
     615             :     hist[30] = new TH1F("qaTRD_esd_timeBin", 7, -0.5, 6.5);
     616             :     hist[31] = new TH1F("qaTRD_esd_pidQuality", 7, -0.5, 6.5);
     617             :     */
     618             : 
     619             :     /*
     620             :     // PID only
     621             :     if (status & AliESDtrack::kTRDpid) {
     622             : 
     623             :       for(Int_t l=0; l<6; l++) fTime->Fill(track->GetTRDTimBin(l));
     624             : 
     625             :       // fill pid histograms
     626             :       Double_t trdr0 = 0; //, tpcr0 = 0;
     627             :       Int_t trdBestPid = 5; //, tpcBestPid = 5;  // charged
     628             :       const Double_t kminPidValue = 0.9;
     629             : 
     630             :       //Double_t pp[5];
     631             :       //track->GetTPCpid(pp); // ESD inconsequence
     632             : 
     633             :       for(Int_t pid=0; pid<5; pid++) {
     634             :         
     635             :         trdr0 += track->GetTRDpid(pid);
     636             :         //tpcr0 += pp[pid];
     637             :         
     638             :         fTrdPID[pid]->Fill(track->GetTRDpid(pid));
     639             :         //fTpcPID[pid]->Fill(pp[pid]);
     640             :         
     641             :         if (track->GetTRDpid(pid) > kminPidValue) trdBestPid = pid;
     642             :         //if (pp[pid] > kminPidValue) tpcBestPid = pid;
     643             :       }
     644             : 
     645             :       fTrdPID[5]->Fill(trdr0); // check unitarity
     646             :       fTrdSigMomPID[trdBestPid]->Fill(track->GetP(), track->GetTRDsignal());
     647             : 
     648             :       //fTpcPID[5]->Fill(tpcr0); // check unitarity
     649             :       //fTpcSigMomPID[tpcBestPid]->Fill(track->GetP(), track->GetTPCsignal());
     650             :     }
     651             :     */
     652             : 
     653           0 :   }
     654             :   //
     655           0 :   IncEvCountCycleESDs();
     656           0 :   IncEvCountTotalESDs();
     657             :   //
     658           0 : }
     659             : 
     660             : //______________________________________________________________________________
     661             : Int_t AliTRDQADataMakerRec::GetSector(Double_t alpha) const 
     662             : {
     663             :   //
     664             :   // Gets the sector number 
     665             :   //
     666             : 
     667           0 :   Double_t size = TMath::DegToRad() * 20.; // shall use TRDgeo
     668           0 :   if (alpha < 0) alpha += 2*TMath::Pi();
     669           0 :   Int_t sector = (Int_t)(alpha/size);
     670           0 :   return sector;
     671             : 
     672             : }
     673             : //______________________________________________________________________________
     674             : 
     675             : Int_t AliTRDQADataMakerRec::GetStack(const AliExternalTrackParam *paramOut) const
     676             : {
     677             :   //
     678             :   // calculates the stack the track is in
     679             :   //
     680             :   
     681             :   const Double_t L = -0.9;
     682             :   const Double_t W = (2*L)/5;
     683             : 
     684           0 :   Double_t tan = paramOut->GetZ() / paramOut->GetX();
     685           0 :   Double_t pos = (tan - L) / W;
     686           0 :   return (Int_t) pos;
     687             : }
     688             : 
     689             : //______________________________________________________________________________
     690             : Double_t AliTRDQADataMakerRec::GetExtZ(const AliExternalTrackParam *in) const 
     691             : {
     692             :   //
     693             :   // Returns the Z position at the entry to TRD
     694             :   // using parameters from the TPC in
     695             :   //
     696             : 
     697             :   const Double_t kX0 = 300;
     698             : 
     699           0 :   Double_t x = in->GetX();
     700           0 :   const Double_t *par = in->GetParameter();
     701           0 :   Double_t theta = par[3];
     702           0 :   Double_t z = in->GetZ();
     703             : 
     704           0 :   Double_t zz = z + (kX0-x) * TMath::Tan(theta);
     705           0 :   return zz;
     706             : 
     707             : }
     708             : 
     709             : //____________________________________________________________________________
     710             : void AliTRDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
     711             : {
     712             :   //
     713             :   // Makes QA data from raw data
     714             :   //
     715             : 
     716           0 :   AliInfo("Making QA for Raws");
     717             : 
     718             :   // take histograms (RS: arrays of histos)
     719           0 :   static TObjArray mnADC,mnCls,mClsDet,mADC,mCls,mClsTb,mClsDetAmp;
     720           0 :   GetMatchingRawsData(0,&mnADC);
     721           0 :   GetMatchingRawsData(1,&mnCls); 
     722           0 :   GetMatchingRawsData(2,&mClsDet);
     723           0 :   GetMatchingRawsData(3,&mADC);
     724           0 :   GetMatchingRawsData(4,&mCls);
     725           0 :   GetMatchingRawsData(5,&mClsTb);
     726           0 :   GetMatchingRawsData(6,&mClsDetAmp);
     727             : 
     728             :   const Int_t baseline = 10;
     729             : 
     730             :   // configure the reader
     731           0 :   rawReader->Reset();
     732           0 :   rawReader->SelectEquipment(0, 1024, 1041);
     733           0 :   rawReader->Select("TRD");
     734             : 
     735           0 :   AliTRDrawStream *data = new AliTRDrawStream(rawReader);
     736             : 
     737             :   // build data manager  
     738             :   AliTRDdigitsManager *digitsManager;
     739           0 :   digitsManager = new AliTRDdigitsManager(kTRUE);
     740           0 :   digitsManager->CreateArrays();
     741             : 
     742             :   // error container 
     743             :   const UShort_t kErrorChmb = 1411;
     744           0 :   UShort_t **fErrorContainer = new UShort_t *[2];
     745           0 :   fErrorContainer[0] = new UShort_t[kErrorChmb];
     746           0 :   fErrorContainer[1] = new UShort_t[kErrorChmb];
     747             :   
     748             :   Int_t det = 0;
     749           0 :   Int_t row, col;
     750             : 
     751           0 :   while ((det = data->NextChamber(digitsManager, NULL, fErrorContainer)) >= 0){
     752             :     
     753             :     //printf("DET = %d\n", det);
     754             : 
     755           0 :     AliTRDSignalIndex* indexes = digitsManager->GetIndexes(det);
     756           0 :     if (indexes->HasEntry()) {
     757             :       
     758           0 :       AliTRDarrayADC *digits = (AliTRDarrayADC*) digitsManager->GetDigits(det);
     759             : 
     760           0 :       while(indexes->NextRCIndex(row, col))  {
     761             : 
     762           0 :         for (int ih=mnADC.GetEntriesFast();ih--;) ((TH2*)mnADC.UncheckedAt(ih))->Fill(det/30, det%30);
     763             :         
     764           0 :         for(Int_t tb = 0; tb < digits->GetNtime(); tb++) {
     765           0 :           Int_t value = digits->GetData(row, col, tb);
     766           0 :           for (int ih=mADC.GetEntriesFast();ih--;) ((TH1*)mADC.UncheckedAt(ih))->Fill(value);
     767             :           
     768             :           // simple clusterizer
     769           0 :           if (col < 1 || col > digits->GetNcol()-2) continue;
     770           0 :           if (tb < 1 || tb > digits->GetNtime()-2) continue;
     771             :           
     772           0 :           value -= baseline;
     773             : 
     774           0 :           Int_t valueL = digits->GetData(row, col-1, tb) - baseline;
     775           0 :           if (valueL >= value) continue;
     776             :           
     777           0 :           Int_t valueR = digits->GetData(row, col+1, tb) - baseline;
     778           0 :           if (valueR >= value) continue;
     779             :           
     780           0 :           Int_t valueUp = digits->GetData(row, col-1, tb+1) + 
     781           0 :             digits->GetData(row, col, tb+1) + digits->GetData(row, col+1, tb+1) - 3 * baseline;
     782           0 :           if (valueUp < 10) continue;
     783             :           
     784           0 :           Int_t valueDown = digits->GetData(row, col-1, tb-1) + 
     785           0 :             digits->GetData(row, col, tb-1) + digits->GetData(row, col+1, tb-1) - 3 * baseline;
     786           0 :           if (valueDown < 10) continue;
     787             :           
     788           0 :           Int_t valueTot = value + valueL + valueR;
     789           0 :           if (valueTot < 0) continue;
     790             : 
     791           0 :           for (int ih=mCls.GetEntriesFast();ih--;) ((TH1*)mCls.UncheckedAt(ih))->Fill(valueTot);
     792           0 :           for (int ih=mClsTb.GetEntriesFast();ih--;) ((TH2*)mClsTb.UncheckedAt(ih))->Fill(tb, valueTot);
     793           0 :           for (int ih=mClsDetAmp.GetEntriesFast();ih--;) ((TH2*)mClsDetAmp.UncheckedAt(ih))->Fill(det, valueTot);
     794             : 
     795           0 :           if (valueTot < 200) {
     796           0 :             for (int ih=mnCls.GetEntriesFast();ih--;) ((TH2*)mnCls.UncheckedAt(ih))->Fill(det/30, det%30); 
     797           0 :             for (int ih=mClsDet.GetEntriesFast();ih--;) ((TH2*)mClsDet.UncheckedAt(ih))->Fill(det/30, det%30, valueTot); 
     798           0 :           }
     799             :         
     800           0 :         }
     801             :       }
     802             : 
     803           0 :       digitsManager->ClearArrays(det); // do we need this if object will be deleted ??
     804           0 :     }    
     805             :   }
     806             :   
     807           0 :   delete [] fErrorContainer[0];
     808           0 :   delete [] fErrorContainer[1];
     809           0 :   delete [] fErrorContainer;
     810             :   fErrorContainer = NULL;
     811             :   
     812           0 :   delete digitsManager;  
     813           0 :   delete data;
     814             :   //
     815           0 :   IncEvCountCycleRaws();
     816           0 :   IncEvCountTotalRaws();
     817             :   //
     818           0 : }
     819             : 
     820             : //____________________________________________________________________________
     821             : void AliTRDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
     822             : {
     823             :   //  
     824             :   // Makes data from RecPoints
     825             :   // 
     826             :   
     827             :   //  Info("MakeRecPoints", "making");
     828             :  
     829           0 :   Int_t nsize = Int_t(clustersTree->GetTotBytes() / (sizeof(AliTRDcluster))); 
     830           0 :   TObjArray *clusterArray = new TObjArray(nsize+1000); 
     831             : 
     832           0 :   TBranch *branch = clustersTree->GetBranch("TRDcluster");
     833           0 :   if (!branch) {
     834           0 :     AliError("Can't get the branch !");
     835           0 :     return;
     836             :   }
     837           0 :   branch->SetAddress(&clusterArray); 
     838             : 
     839             :   // Loop through all entries in the tree
     840           0 :   Int_t nEntries   = (Int_t)TMath::Ceil( clustersTree->GetEntries() );
     841             :   Int_t nbytes     = 0;
     842             :   AliTRDcluster *c = 0;
     843           0 :   Int_t nDet[540];
     844           0 :   for (Int_t i=0; i<540; i++) nDet[i] = 0;
     845             : 
     846             :   Int_t nCls = 0;
     847             :   
     848             :   //printf("nEntries = %d\n", nEntries);
     849             :   //nEntries++;
     850             :   
     851             :   /*
     852             :   // select the event 
     853             :   for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {    
     854             : 
     855             :     // Import the tree
     856             :     nbytes += clustersTree->GetEvent(iEntry);  
     857             :     Int_t nCluster = clusterArray->GetEntries();  
     858             :     
     859             :     for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) { 
     860             :       c = (AliTRDcluster *) clusterArray->At(iCluster);
     861             :       nCls++;
     862             :     }
     863             :   }
     864             : 
     865             :   if (nCls < 100) {
     866             :     delete clusterArray;
     867             :     return;
     868             :   }
     869             :   */
     870             : 
     871             :   /////
     872           0 :   TObjArray *hists3D = GetMatchingRecPointsData(10);       //RS no alias for 3d histo filling, to directly
     873             :   //
     874           0 :   for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {    
     875             : 
     876             :     // Import the tree
     877           0 :     nbytes += clustersTree->GetEvent(iEntry);  
     878             : 
     879             :     // Get the number of points in the detector
     880           0 :     Int_t nCluster = clusterArray->GetEntries();  
     881             : 
     882             :   
     883             :     // Loop through all TRD digits
     884           0 :     for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) { 
     885             : 
     886           0 :       nCls++;
     887           0 :       c = (AliTRDcluster *) clusterArray->At(iCluster);
     888             : 
     889           0 :       Int_t iDet = c->GetDetector();
     890           0 :       Int_t nPads = c->GetNPads();
     891             : 
     892           0 :       nDet[iDet]++;
     893           0 :       FillRecPointsData(0,iDet);
     894           0 :       FillRecPointsData(86,c->GetQ());
     895           0 :       FillRecPointsData(1,iDet, c->GetQ());
     896           0 :       FillRecPointsData(2,nPads);
     897           0 :       if (nPads < 6)
     898           0 :         FillRecPointsData(1+c->GetNPads(),c->GetCenter());
     899             :       
     900           0 :       if (nPads < 10)
     901           0 :         FillRecPointsData(88+nPads-2,c->GetQ());
     902           0 :       else FillRecPointsData(96,c->GetQ());
     903             : 
     904             :       //if (c->GetPadTime() < 5)
     905           0 :       FillRecPointsData(7,c->GetPadRow(), c->GetPadCol());
     906           0 :       FillRecPointsData(8,c->GetPadTime());
     907             :       //
     908           0 :       if (hists3D) {
     909           0 :         for (int ih=hists3D->GetEntriesFast();ih--;) {
     910           0 :           TH3F * ahist = dynamic_cast<TH3F*>(hists3D->At(ih));
     911           0 :           if (ahist) ahist->Fill(iDet, c->GetPadTime(), c->GetQ());
     912             :         }
     913           0 :       }
     914             :       
     915           0 :       Int_t iSM = iDet / 30;
     916           0 :       FillRecPointsData(50+iSM,c->GetPadTime());
     917           0 :       FillRecPointsData(68+iSM,c->GetPadTime(), c->GetQ());
     918             :       
     919             :       // total charge sm / det / timeBin
     920             :       // FillRecPointsData(14+iSM,iDet-iSM*30, c->GetPadTime(), c->GetQ());
     921             : 
     922             : 
     923             :       // PRF for 2pad
     924             :       //if (c->GetNPads() == 2) {
     925           0 :       Short_t *sig = c->GetSignals();
     926             :       Double_t frac = -10;
     927             : 
     928           0 :       if (sig[0] == 0 && sig[1] == 0 && sig[2] == 0 && sig[5] == 0 && sig[6] == 0) 
     929           0 :         frac = 1. * sig[4] / (sig[3] + sig[4]);
     930             : 
     931           0 :       if (sig[0] == 0 && sig[1] == 0 && sig[4] == 0 && sig[5] == 0 && sig[6] == 0)
     932           0 :         frac = -1. * sig[2] / (sig[2] + sig[3]);
     933             : 
     934           0 :       if (frac > -10) FillRecPointsData(11,c->GetCenter(), frac);
     935             :         
     936             :       //}
     937             :     }
     938           0 :     clusterArray->Delete();
     939             :   }
     940             : 
     941             :   /*
     942             :   for(Int_t i=0; i<540; i++) 
     943             :     if (nDet[i] > 0) FillRecPointsData(9,nDet[i]);
     944             :   */
     945           0 :   FillRecPointsData(9,nCls);
     946             :   
     947           0 :   delete clusterArray;
     948             :   //
     949           0 :  IncEvCountCycleRecPoints();
     950           0 :  IncEvCountTotalRecPoints();
     951             :   //
     952           0 : }
     953             : 
     954             : //____________________________________________________________________________ 
     955             : void AliTRDQADataMakerRec::StartOfDetectorCycle()
     956             : {
     957             :   //
     958             :   // Detector specific actions at start of cycle
     959             :   //
     960             : 
     961           0 : }
     962             : 
     963             : //__________________________________________________________________________
     964             : Int_t AliTRDQADataMakerRec::CheckPointer(TObject *obj, const char *name) 
     965             : {
     966             :   //
     967             :   // Checks initialization of pointers
     968             :   //
     969             : 
     970           0 :   if (!obj) AliWarning(Form("null pointer: %s", name));
     971           0 :   return !!obj;
     972             : }
     973             : //__________________________________________________________________________
     974             : void AliTRDQADataMakerRec::BuildRatio(TH1 *ratio, TH1 *histN, TH1* histD) {
     975             :   //
     976             :   // Calculate the ratio of two histograms 
     977             :   // error are calculated assuming the histos have the same counts
     978             :   //
     979             : 
     980             :   // calclate
     981             : 
     982           0 :   Int_t nbins = histN->GetXaxis()->GetNbins();
     983           0 :   for(Int_t i=1; i<nbins+2; i++) {
     984             :     
     985           0 :     Double_t valueN = histN->GetBinContent(i);
     986           0 :     Double_t valueD = histD->GetBinContent(i);
     987             :     
     988           0 :     if (valueD < 1) {
     989           0 :       ratio->SetBinContent(i, 0);
     990           0 :       ratio->SetBinError(i, 0);
     991           0 :       continue;
     992             :     }
     993             : 
     994           0 :     Double_t eps = (valueN < valueD-valueN)? valueN : valueD-valueN;
     995             :     
     996           0 :     ratio->SetBinContent(i, valueN/valueD);
     997           0 :     ratio->SetBinError(i, TMath::Sqrt(eps)/valueD);
     998           0 :   }
     999             : 
    1000             :   // style
    1001           0 :   ratio->SetMinimum(-0.1);
    1002           0 :   ratio->SetMaximum(1.1);
    1003           0 :   ratio->SetMarkerStyle(20);
    1004           0 : }
    1005             : //__________________________________________________________________________
    1006             : 
    1007             : Int_t AliTRDQADataMakerRec::FillBits(TH1F *hist, Int_t code, Int_t offset) {
    1008             : 
    1009             :   Int_t nb = 0;
    1010             :   UInt_t test = 1;
    1011           0 :   for(Int_t i=0; i<8; i++) {
    1012           0 :     if (code & test) {
    1013           0 :       hist->Fill(i+offset);
    1014           0 :       nb++;
    1015           0 :     }
    1016           0 :     test *= 2;       
    1017             :   }
    1018             :   
    1019           0 :   return nb;
    1020             : }
    1021             : 
    1022             : //__________________________________________________________________________

Generated by: LCOV version 1.11