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

Generated by: LCOV version 1.11