LCOV - code coverage report
Current view: top level - AD/ADrec - AliADTrending.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 70 1.4 %
Date: 2016-06-14 17:26:59 Functions: 1 19 5.3 %

          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             : // 
      17             : // Class AliADTrending
      18             : // ---------------------------
      19             : // 
      20             : //  class used in QA to publish variables evolution versus time in AMORE. 
      21             : //  These histo are the one which will be looked at by QA Shifter
      22             : // 
      23             : #include "TGraph.h"
      24             : #include "TMultiGraph.h"
      25             : #include "TLegend.h"
      26             : #include "TString.h"
      27             : 
      28             : #include "AliLog.h"
      29             : #include "AliADTrending.h"
      30             : 
      31          16 : ClassImp(AliADTrending)
      32             : 
      33             : //_____________________________________________________________________________
      34           0 : AliADTrending::AliADTrending() : TH1(), fNEntries(0), fMultiGraphs(NULL)
      35           0 : {
      36             :         // Default constructor
      37           0 :         for(int i=0; i<4;i++) fGraphs[i] = NULL;
      38           0 :         for (int i = 0; i < kDataSize; i++) {
      39           0 :                 fTime[i] = 0;
      40           0 :                 for (int j = 0; j < 4; j++) {
      41           0 :                   fData[j][i] = 0;
      42             :                 }
      43             :         }
      44           0 : }
      45             : //_____________________________________________________________________________
      46           0 : AliADTrending::AliADTrending(const char* name, const char* title) : TH1(), fNEntries(0), fMultiGraphs(NULL)
      47           0 : {
      48           0 :         SetName(name);
      49           0 :         SetTitle(title);
      50           0 :         for(int i=0; i<4;i++) fGraphs[i] = NULL;
      51           0 :         for (int i = 0; i < kDataSize; i++) {
      52           0 :                 fTime[i] = 0;
      53           0 :                 for (int j = 0; j < 4; j++) {
      54           0 :                   fData[j][i] = 0;
      55             :                 }
      56             :         }
      57           0 : }
      58             : //_____________________________________________________________________________
      59             : AliADTrending::AliADTrending(const AliADTrending &trend) : 
      60           0 :         TH1(), fNEntries(trend.fNEntries), fMultiGraphs(NULL)
      61           0 : {
      62             :         // Copy constructor
      63           0 :         for(int i=0; i<4;i++) fGraphs[i] = NULL;
      64           0 :         SetName(trend.GetName());
      65           0 :         SetTitle(trend.GetTitle());
      66           0 :         for (int i = 0; i < kDataSize; i++) {
      67           0 :                 fTime[i] = trend.fTime[i];
      68           0 :                 for (int j = 0; j < 4; j++) {
      69           0 :                         fData[j][i] = trend.fData[j][i];
      70             :                 }
      71             :         }
      72           0 : }
      73             : 
      74             : //_____________________________________________________________________________
      75           0 : AliADTrending::~AliADTrending(){
      76           0 :   for (Int_t i=0; i<4; ++i) delete fGraphs[i];
      77           0 :   delete fMultiGraphs;
      78           0 : }
      79             : // -----------------------------------------------------------------                    
      80             : void AliADTrending::AddEntry(Double_t * data, UInt_t time)
      81             : {
      82             : 
      83           0 :         if(fNEntries<kDataSize){
      84           0 :                 for (int i = 0; i < 4; i++)
      85             :                 {
      86           0 :                         fData[i][fNEntries] = data[i];
      87           0 :                         fTime[fNEntries] = (double) time;
      88             :                 }
      89           0 :                 fNEntries++;    
      90           0 :         }else{
      91             : 
      92           0 :                 for (int i = 0; i < kDataSize-1; i++){
      93           0 :                         fTime[i] = fTime[i+1];
      94           0 :                         for (int ich = 0; ich < 4; ich++){           
      95           0 :                                 fData[ich][i] = fData[ich][i+1];
      96             :                         }       
      97             :                 }
      98           0 :                 for (int i = 0; i < 4; i++)
      99             :                 {
     100           0 :                         fData[i][fNEntries-1] = data[i];
     101           0 :                         fTime[fNEntries-1] = (double) time;
     102             :                 }
     103             :                 
     104             :         }
     105             : //      printf("sizeof UInt_t Double_t %d %d\n",sizeof(UInt_t),sizeof(Double_t));
     106             : //      printf("Add Entry %d @ %f : %f %f %f %f %f %f %f %f \n",fNEntries,fTime[fNEntries-1], 
     107             : //              data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
     108           0 : }                       
     109             : // -----------------------------------------------------------------                    
     110             : void AliADTrending::PrintEntry(UInt_t entry)
     111             : {
     112             : 
     113           0 :         if(entry>=fNEntries){
     114           0 :                 AliError(Form("maximum entry is %d\n",fNEntries-1));
     115           0 :         }else{
     116           0 :                 AliInfo(Form("Entry %d @ %f : %f %f %f %f %f %f %f %f \n",entry, fTime[entry],
     117             :                         fData[0][entry],fData[1][entry],fData[2][entry],fData[3][entry],fData[4][entry],fData[5][entry],fData[6][entry],fData[7][entry]));
     118             : 
     119             :         }
     120           0 : }                       
     121             : 
     122             : // -----------------------------------------------------------------                    
     123             : void AliADTrending::Draw(Option_t *option){
     124           0 :     TString opt = option;       
     125           0 :         fMultiGraphs = new TMultiGraph();
     126           0 :         fMultiGraphs->SetTitle(GetTitle());
     127             :         
     128           0 :         for(int i=0;i<4;i++) {
     129           0 :                 fGraphs[i] = new TGraph(GetNEntries(), GetTime(), GetChannel(i));
     130           0 :                 fGraphs[i]->SetLineWidth(2);
     131             :                 //fGraphs[i]->SetLineColor(i<4 ? i+1 : i -3);
     132             :                 //fGraphs[i]->SetLineStyle(i<4 ? 1 : 2);
     133           0 :                 fMultiGraphs->Add(fGraphs[i]);
     134             :         }
     135             : 
     136           0 :         fMultiGraphs->Draw("AL");
     137           0 :         fMultiGraphs->GetXaxis()->SetTimeDisplay(1);
     138           0 :         fMultiGraphs->GetXaxis()->SetNdivisions(505,kFALSE);
     139           0 :         fMultiGraphs->Draw("AL");
     140           0 :         TLegend * legend = new TLegend(0.7,0.65,0.86,0.88);
     141           0 :         legend->AddEntry(fGraphs[0],"ADA - Layer0","l");
     142           0 :         legend->AddEntry(fGraphs[1],"ADA - Layer1","l");
     143           0 :         legend->AddEntry(fGraphs[2],"ADC - Layer0","l");
     144           0 :         legend->AddEntry(fGraphs[3],"ADC - Layer1","l");
     145             : 
     146           0 :         legend->Draw();
     147           0 : }

Generated by: LCOV version 1.11