LCOV - code coverage report
Current view: top level - PHOS/PHOSsim - AliPHOSQADataMakerSim.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 82 91 90.1 %
Date: 2016-06-14 17:26:59 Functions: 14 17 82.4 %

          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             : /* $Id$ */
      18             : 
      19             : /*
      20             :   Produces the data needed to calculate the quality assurance. 
      21             :   All data must be mergeable objects.
      22             :   Y. Schutz CERN July 2007
      23             : */
      24             : 
      25             : // --- ROOT system ---
      26             : #include <TClonesArray.h>
      27             : #include <TFile.h> 
      28             : #include <TH1F.h> 
      29             : #include <TH1I.h> 
      30             : #include <TH2F.h> 
      31             : #include <TTree.h>
      32             : 
      33             : // --- Standard library ---
      34             : 
      35             : // --- AliRoot header files ---
      36             : #include "AliESDCaloCluster.h"
      37             : #include "AliLog.h"
      38             : #include "AliPHOSDigit.h"
      39             : #include "AliPHOSHit.h"
      40             : #include "AliPHOSQADataMakerSim.h"
      41             : #include "AliQAChecker.h"
      42             : 
      43          20 : ClassImp(AliPHOSQADataMakerSim)
      44             :            
      45             : //____________________________________________________________________________ 
      46             : AliPHOSQADataMakerSim::AliPHOSQADataMakerSim() : 
      47           3 :   AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kPHOS), "PHOS Quality Assurance Data Maker")
      48           5 : {
      49             :   // ctor
      50           2 : }
      51             : 
      52             : //____________________________________________________________________________ 
      53             : AliPHOSQADataMakerSim::AliPHOSQADataMakerSim(const AliPHOSQADataMakerSim& qadm) :
      54           0 :   AliQADataMakerSim()
      55           0 : {
      56             :   //copy ctor 
      57           0 :   SetName((const char*)qadm.GetName()) ; 
      58           0 :   SetTitle((const char*)qadm.GetTitle()); 
      59           0 : }
      60             : 
      61             : //__________________________________________________________________
      62             : AliPHOSQADataMakerSim& AliPHOSQADataMakerSim::operator = (const AliPHOSQADataMakerSim& qadm )
      63             : {
      64             :   // Assign operator.
      65           0 :   this->~AliPHOSQADataMakerSim();
      66           0 :   new(this) AliPHOSQADataMakerSim(qadm);
      67           0 :   return *this;
      68           0 : }
      69             :  
      70             : //____________________________________________________________________________ 
      71             : void AliPHOSQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
      72             : {
      73             :   //Detector specific actions at end of cycle
      74             :   // do the QA checking
      75          18 :   AliQAChecker::Instance()->Run(AliQAv1::kPHOS, task, list) ;  
      76           9 : }
      77             : 
      78             : //____________________________________________________________________________ 
      79             : void AliPHOSQADataMakerSim::InitHits()
      80             : {
      81             :   // create Hits histograms in Hits subdir
      82             :   const Bool_t expert   = kTRUE ; 
      83             :   const Bool_t image    = kTRUE ; 
      84           2 :   TH1F * h0 = new TH1F("hPhosHits",    "Hits energy distribution in PHOS;Energy [MeV];Counts",       100, 0., 100.) ; 
      85           1 :   h0->Sumw2() ;
      86           1 :   Add2HitsList(h0, kHits, !expert, image) ;
      87           1 :   TH1I * h1 = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS;# of Hits;Entries", 500, 0., 10000) ; 
      88           1 :   h1->Sumw2() ;
      89           1 :   Add2HitsList(h1, kHitsMul, !expert, image) ;
      90             :   //
      91           1 :   ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line  
      92           1 : }
      93             : 
      94             : //____________________________________________________________________________ 
      95             : void AliPHOSQADataMakerSim::InitDigits()
      96             : {
      97             :   // create Digits histograms in Digits subdir
      98             :   const Bool_t expert   = kTRUE ; 
      99             :   const Bool_t image    = kTRUE ; 
     100           2 :   TH1I * h0 = new TH1I("hPhosDigits",    "Digits amplitude distribution in PHOS;Amplitude [ADC counts];Counts",    500, 0, 1000) ; 
     101           1 :   h0->Sumw2() ;
     102           1 :   Add2DigitsList(h0, kDigits, !expert, image) ;
     103           1 :   TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS;# of Digits;Entries", 2000, 0, 10000) ; 
     104           1 :   h1->Sumw2() ;
     105           1 :   Add2DigitsList(h1, kDigitsMul, !expert, image) ;
     106             :   //
     107           1 :   ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
     108           1 : }
     109             : 
     110             : //____________________________________________________________________________ 
     111             : void AliPHOSQADataMakerSim::InitSDigits()
     112             : {
     113             :   // create SDigits histograms in SDigits subdir
     114             :   const Bool_t expert   = kTRUE ; 
     115             :   const Bool_t image    = kTRUE ; 
     116           2 :   TH1F * h0 = new TH1F("hPhosSDigits",    "SDigits energy distribution in PHOS; Energy [MeV];Counts",       500, 0., 1000.) ; 
     117           1 :   h0->Sumw2() ;
     118           1 :   Add2SDigitsList(h0, kSDigits, !expert, image) ;
     119           1 :   TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS;# of SDigits;Entries", 500, 0,  1000) ; 
     120           1 :   h1->Sumw2() ;
     121           1 :   Add2SDigitsList(h1, kSDigitsMul, !expert, image) ;
     122             :   //
     123           1 :   ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
     124           1 : }
     125             : 
     126             : //____________________________________________________________________________
     127             : void AliPHOSQADataMakerSim::MakeHits()
     128             : {
     129             :   //make QA data from Hits
     130             :   
     131         224 :   TIter next(fHitsArray) ; 
     132             :   AliPHOSHit * hit ; 
     133        1908 :   while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
     134         365 :     FillHitsData(kHits, hit->GetEnergy()) ;
     135             :   }
     136         112 : }
     137             : 
     138             : //____________________________________________________________________________
     139             : void AliPHOSQADataMakerSim::MakeHits(TTree * hitTree)
     140             : {
     141             :   // make QA data from Hit Tree
     142             :   
     143           8 :   if (fHitsArray)
     144           3 :     fHitsArray->Clear() ; 
     145             :   else
     146           2 :     fHitsArray = new TClonesArray("AliPHOSHit", 1000);
     147             : 
     148           4 :   TBranch * branch = hitTree->GetBranch("PHOS") ;
     149           4 :   if ( ! branch ) { AliWarning("PHOS branch in Hit Tree not found"); return;}
     150             :   //
     151             :   Int_t nHits = 0;
     152           4 :   branch->SetAddress(&fHitsArray) ;
     153         232 :   for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
     154         112 :     branch->GetEntry(ientry) ;
     155         112 :     nHits += fHitsArray->GetEntriesFast();
     156         112 :     MakeHits() ; 
     157         112 :     fHitsArray->Clear();
     158             :   }     
     159           4 :   FillHitsData(1,nHits) ;
     160             :   //  
     161           4 :   IncEvCountCycleHits();
     162           4 :   IncEvCountTotalHits();
     163             :   //
     164           8 : }
     165             : 
     166             : //____________________________________________________________________________
     167             : void AliPHOSQADataMakerSim::MakeDigits()
     168             : {
     169             :   // makes data from Digits
     170             :  
     171           8 :   FillDigitsData(1,fDigitsArray->GetEntriesFast()) ; 
     172           4 :   TIter next(fDigitsArray) ; 
     173             :   AliPHOSDigit * digit ; 
     174         512 :   while ( (digit = dynamic_cast<AliPHOSDigit *>(next())) ) {
     175         124 :     FillDigitsData(kDigits, digit->GetEnergy()) ;
     176             :   }  
     177           4 : }
     178             : 
     179             : //____________________________________________________________________________
     180             : void AliPHOSQADataMakerSim::MakeDigits(TTree * digitTree)
     181             : {
     182             :   // makes data from Digit Tree
     183           8 :   if (fDigitsArray) 
     184           3 :     fDigitsArray->Clear() ; 
     185             :   else
     186           2 :     fDigitsArray = new TClonesArray("AliPHOSDigit", 1000) ; 
     187             :   
     188           4 :   TBranch * branch = digitTree->GetBranch("PHOS") ;
     189           4 :   if ( ! branch ) {AliWarning("PHOS branch in Digit Tree not found"); return;}
     190           4 :   branch->SetAddress(&fDigitsArray) ;
     191           4 :   branch->GetEntry(0) ; 
     192           4 :   MakeDigits() ; 
     193             :   //
     194           4 :   IncEvCountCycleDigits();
     195           4 :   IncEvCountTotalDigits();
     196             :   //
     197           8 : }
     198             : 
     199             : //____________________________________________________________________________
     200             : void AliPHOSQADataMakerSim::MakeSDigits()
     201             : {
     202             :   // makes data from SDigits
     203             : 
     204           8 :   FillSDigitsData(1,fSDigitsArray->GetEntriesFast()) ; 
     205           4 :   TIter next(fSDigitsArray) ; 
     206             :   AliPHOSDigit * sdigit ; 
     207        1476 :   while ( (sdigit = dynamic_cast<AliPHOSDigit *>(next())) ) {
     208         365 :     FillSDigitsData(kSDigits, sdigit->GetEnergy()) ;
     209             :   } 
     210           4 : }
     211             : 
     212             : //____________________________________________________________________________
     213             : void AliPHOSQADataMakerSim::MakeSDigits(TTree * sdigitTree)
     214             : {
     215             :         // makes data from SDigit Tree
     216           8 :   if (fSDigitsArray) 
     217           3 :     fSDigitsArray->Clear() ; 
     218             :   else
     219           2 :     fSDigitsArray = new TClonesArray("AliPHOSDigit", 1000) ; 
     220             :   
     221           4 :   TBranch * branch = sdigitTree->GetBranch("PHOS") ;
     222           4 :   if ( ! branch ) {AliWarning("PHOS branch in SDigit Tree not found"); return;}
     223           4 :   branch->SetAddress(&fSDigitsArray) ;
     224           4 :   branch->GetEntry(0) ;
     225           4 :   MakeSDigits() ; 
     226             :   //
     227           4 :   IncEvCountCycleSDigits();
     228           4 :   IncEvCountTotalSDigits();
     229             :   //
     230           8 : }
     231             : 
     232             : //____________________________________________________________________________ 
     233             : void AliPHOSQADataMakerSim::StartOfDetectorCycle()
     234             : {
     235             :   //Detector specific actions at start of cycle
     236             :   
     237          12 : }

Generated by: LCOV version 1.11