LCOV - code coverage report
Current view: top level - T0/T0sim - AliT0QADataMakerSim.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 81 98 82.7 %
Date: 2016-06-14 17:26:59 Functions: 9 12 75.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             : 
      17             : /* $Id$ */
      18             : 
      19             : //---
      20             : //  Produces the data needed to calculate the quality assurance. 
      21             : //  Alla.Maevskaya@cern.ch
      22             : //  
      23             : //---
      24             : 
      25             : // --- ROOT system ---
      26             : #include <TClonesArray.h>
      27             : #include <TFile.h> 
      28             : #include <TH1F.h> 
      29             : #include <TH2F.h> 
      30             : #include <TDirectory.h>
      31             : // --- Standard library ---
      32             : 
      33             : // --- AliRoot header files ---
      34             : #include "AliESDEvent.h"
      35             : #include "AliLog.h"
      36             : #include "AliT0digit.h" 
      37             : #include "AliT0hit.h"
      38             : #include "AliT0RecPoint.h"
      39             : #include "AliT0QADataMakerSim.h"
      40             : #include "AliQAChecker.h"
      41             : #include "AliT0RawReader.h"
      42             : 
      43             : #include <Riostream.h>
      44             : 
      45          12 : ClassImp(AliT0QADataMakerSim)
      46             :            
      47             : //____________________________________________________________________________ 
      48             :   AliT0QADataMakerSim::AliT0QADataMakerSim() : 
      49           3 :   AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kT0), "T0 Quality Assurance Data Maker")
      50             : 
      51           5 : {
      52             :   // ctor
      53             :  //   fDetectorDir = fOutput->GetDirectory(GetName()) ;  
      54             : //   if (!fDetectorDir) 
      55             : //     fDetectorDir = fOutput->mkdir(GetName()) ;  
      56           2 : }
      57             : 
      58             : //____________________________________________________________________________ 
      59             : AliT0QADataMakerSim::AliT0QADataMakerSim(const AliT0QADataMakerSim& qadm) :
      60           0 :   AliQADataMakerSim() 
      61           0 : {
      62             :   //copy ctor 
      63           0 :   SetName((const char*)qadm.GetName()) ; 
      64           0 :   SetTitle((const char*)qadm.GetTitle()); 
      65           0 : }
      66             : 
      67             : //__________________________________________________________________
      68             : AliT0QADataMakerSim& AliT0QADataMakerSim::operator = (const AliT0QADataMakerSim& qadm )
      69             : {
      70             :   // Equal operator.
      71           0 :   this->~AliT0QADataMakerSim();
      72           0 :   new(this) AliT0QADataMakerSim(qadm);
      73           0 :   return *this; 
      74           0 : }
      75             : //____________________________________________________________________________
      76             : void AliT0QADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
      77             : {
      78             :   //Detector specific actions at end of cycle
      79             :   // do the QA checking
      80          18 :   AliQAChecker::Instance()->Run(AliQAv1::kT0, task, list) ;
      81           9 : }
      82             : 
      83             : //____________________________________________________________________________
      84             : void AliT0QADataMakerSim::StartOfDetectorCycle()
      85             : {
      86             :   //Detector specific actions at start of cycle
      87             : 
      88          12 : }
      89             :  
      90             : //____________________________________________________________________________ 
      91             : void AliT0QADataMakerSim::InitHits()
      92             : {
      93             :   // create Hits histograms in Hits subdir
      94             :   // create Hits histograms in Hits subdir
      95             :   const Bool_t expert   = kTRUE ; 
      96             :   const Bool_t image    = kTRUE ; 
      97             : 
      98           2 :   TString timename;
      99             :   
     100           2 :   TH2F *fhHitsTimeA = new TH2F("hHitsTimeA", "Hits Efficiency;#PMT; Time [ns];", 13, 12, 25, 100,12,15 );
     101           1 :   fhHitsTimeA->SetOption("COLZ");
     102           1 :   Add2HitsList(fhHitsTimeA,0, !expert, image);
     103           2 :   TH2F *fhHitsTimeC = new TH2F("hHitsTimeC", "Hits Efficiency;#PMT; Time [ns];", 13, 0, 13, 100,2,5 );
     104           1 :   fhHitsTimeC->SetOption("COLZ");
     105           1 :   Add2HitsList(fhHitsTimeC,1, !expert, image);
     106             :   //
     107           1 :   ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
     108           1 : }
     109             : 
     110             : //____________________________________________________________________________ 
     111             : void AliT0QADataMakerSim::InitDigits()
     112             : {
     113             :   // create Digits histograms in Digits subdir
     114             :   const Bool_t expert   = kTRUE ; 
     115             :   const Bool_t image    = kTRUE ; 
     116             :   
     117           2 :   TH2F * fhDigCFD = new TH2F("fhDigCFD", " CFD digits; #PMT; CFD time [#channel]",25,-0.5,24.5,100,0,1000);
     118           1 :   fhDigCFD->SetOption("COLZ");
     119           1 :   Add2DigitsList( fhDigCFD,0);
     120           1 :   TH2F *fhDigLEDamp = new TH2F("fhDigLEDamp", " LED-CFD digits; #PMT; amplitude  LED-CFD [#channel]",25,-0.5,24.5,100,100,1000);
     121           1 :   fhDigLEDamp->SetOption("COLZ");
     122           1 :   Add2DigitsList( fhDigLEDamp,1, !expert, image);
     123           1 :   TH2F * fhDigQTC = new TH2F("fhDigQTC", " QTC digits; #PMT; amplitude QTC [#channel]",25,-0.5,24.5,200,500,10000);
     124           1 :   fhDigQTC->SetOption("COLZ");
     125           1 :   Add2DigitsList( fhDigQTC,2, !expert, image);
     126             :   //
     127           1 :   ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line 
     128           1 : }
     129             : 
     130             : //____________________________________________________________________________
     131             : 
     132             : void AliT0QADataMakerSim::MakeHits(TTree *hitTree)
     133             : {
     134             :   //fills QA histos for Hits
     135           8 :   if (fHitsArray) 
     136           3 :     fHitsArray->Clear() ; 
     137             :   else 
     138           2 :     fHitsArray = new TClonesArray("AliT0hit", 1000);
     139             :   
     140           4 :   TBranch * branch = hitTree->GetBranch("T0") ;
     141           4 :   if ( ! branch ) {
     142           0 :     AliWarning("T0 branch in Hit Tree not found") ;
     143           0 :   } else {
     144             : 
     145           4 :    if (branch) {
     146           4 :       branch->SetAddress(&fHitsArray);
     147             :     }else{
     148           0 :       AliError("Branch T0 hit not found");
     149           0 :       exit(111);
     150             :     } 
     151           4 :     Int_t ntracks    = (Int_t) hitTree->GetEntries();
     152             :     
     153           4 :     if (ntracks<=0) return;
     154             :     // Start loop on tracks in the hits containers
     155             : 
     156         232 :     for (Int_t track=0; track<ntracks;track++) {
     157         112 :       branch->GetEntry(track);
     158         112 :       Int_t nhits = fHitsArray->GetEntriesFast();
     159        5712 :       for (Int_t ihit=0;ihit<nhits;ihit++) 
     160             :         {
     161        2744 :           AliT0hit  * startHit   = (AliT0hit*) fHitsArray->UncheckedAt(ihit);
     162        2744 :           if (!startHit) {
     163           0 :             AliError("The unchecked hit doesn't exist");
     164           0 :             continue;
     165             :           }
     166        2744 :           Int_t pmt=startHit->Pmt();
     167        2744 :           Float_t time = 0.001 * startHit->Time();
     168        3167 :           if(pmt<13) FillHitsData(1,pmt,time) ;
     169        5065 :           if(pmt>12) FillHitsData(0,pmt,time) ;
     170        2744 :         }
     171             :     }
     172           4 :   }
     173             :   //
     174           4 :   IncEvCountCycleHits();
     175           4 :   IncEvCountTotalHits();
     176             :   //
     177           8 : }
     178             : 
     179             : //____________________________________________________________________________
     180             : void AliT0QADataMakerSim::MakeDigits( TTree *digitsTree)
     181             : {
     182             :   //fills QA histos for Digits
     183             :  
     184           8 :   TArrayI *digCFD = new TArrayI(24);
     185           4 :   TArrayI *digLED = new TArrayI(24);
     186           4 :   TArrayI *digQT0 = new TArrayI(24);
     187           4 :   TArrayI *digQT1 = new TArrayI(24);
     188             :   Int_t refpoint=0;
     189             : 
     190           4 :   TBranch *brDigits=digitsTree->GetBranch("T0");
     191           8 :   AliT0digit *fDigits = new AliT0digit() ;
     192           4 :   if (brDigits) {
     193           4 :     brDigits->SetAddress(&fDigits);
     194             :   }else{
     195           0 :     AliError(Form("EXEC Branch T0 digits not found"));
     196           0 :      return;
     197             :   }
     198             : 
     199           4 :   digitsTree->GetEvent(0);
     200           4 :   digitsTree->GetEntry(0);
     201           4 :   brDigits->GetEntry(0);
     202           4 :   fDigits->GetTimeCFD(*digCFD);
     203           4 :   fDigits->GetTimeLED(*digLED);
     204           4 :   fDigits->GetQT0(*digQT0);
     205           4 :   fDigits->GetQT1(*digQT1);
     206           4 :   refpoint = fDigits->RefPoint();
     207             : 
     208         200 :    for (Int_t i=0; i<24; i++)
     209             :     {
     210          96 :       if (digCFD->At(i)>0) {
     211           6 :         Int_t cfd=digCFD->At(i)- refpoint;
     212           6 :         FillDigitsData(0, i,cfd);
     213           6 :         FillDigitsData(1, i,(digLED->At(i) - digCFD->At(i)));
     214           6 :         FillDigitsData(2, i, (digQT1->At(i) - digQT0->At(i)));
     215             : 
     216           6 :       }
     217             :     }  
     218             :       
     219           8 :   delete digCFD;
     220           8 :   delete digLED;
     221           8 :   delete digQT0;
     222           8 :   delete digQT1;
     223             :   //
     224           4 :   IncEvCountCycleDigits();
     225           4 :   IncEvCountTotalDigits();
     226             :   //
     227           8 : }

Generated by: LCOV version 1.11