LCOV - code coverage report
Current view: top level - HMPID/HMPIDsim - AliHMPIDQADataMakerSim.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 78 89 87.6 %
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             : // --- ROOT system ---
      20             : #include <TClonesArray.h>
      21             : #include <TFile.h> 
      22             : #include <TH1F.h> 
      23             : #include <TH2F.h>
      24             : #include <Riostream.h>
      25             : // --- Standard library ---
      26             : 
      27             : // --- AliRoot header files ---
      28             : #include "AliESDCaloCluster.h"
      29             : #include "AliESDEvent.h"
      30             : #include "AliQAChecker.h"
      31             : #include "AliLog.h"
      32             : #include "AliHMPIDDigit.h"
      33             : #include "AliHMPIDHit.h"
      34             : #include "AliHMPIDCluster.h"
      35             : #include "AliHMPIDQADataMakerSim.h"
      36             : #include "AliHMPIDParam.h"
      37             : #include "AliHMPIDRawStream.h"
      38             : #include "AliLog.h"
      39             : 
      40             : //.
      41             : // HMPID AliHMPIDQADataMakerSim base class
      42             : // for QA of simulation
      43             : // here also errors are calculated
      44             : //.
      45             : 
      46          12 : ClassImp(AliHMPIDQADataMakerSim)
      47             :            
      48             : //____________________________________________________________________________ 
      49             :   AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() : 
      50           4 :   AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kHMPID), "HMPID Quality Assurance Data Maker"), fChannel(0)
      51           5 : {
      52             :   // ctor
      53           2 : }
      54             : 
      55             : //____________________________________________________________________________ 
      56             : AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
      57           0 :   AliQADataMakerSim(),fChannel(0)
      58           0 : {
      59             :   //copy ctor 
      60           0 :   SetName((const char*)qadm.GetName()) ; 
      61           0 :   SetTitle((const char*)qadm.GetTitle()); 
      62           0 : }
      63             : 
      64             : //__________________________________________________________________
      65             : AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
      66             : {
      67             :   // Equal operator.
      68           0 :   this->~AliHMPIDQADataMakerSim();
      69           0 :   new(this) AliHMPIDQADataMakerSim(qadm);
      70           0 :   return *this;
      71           0 : }
      72             :  
      73             : //____________________________________________________________________________ 
      74             : void AliHMPIDQADataMakerSim::InitHits()
      75             : {
      76             :   // create Hits histograms in Hits subdir
      77             :   const Bool_t expert   = kTRUE ; 
      78             :   const Bool_t image    = kTRUE ; 
      79             :   
      80           2 :   TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC;Entries",500,0,4000);
      81           1 :   Add2HitsList(hHitQdc,0, !expert, image);
      82           1 :   TH2F *hHitMap[7];
      83          16 :   for(Int_t iCh=0;iCh<7;iCh++) {
      84          28 :     hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit};Entries",iCh),162,-1,161,146,-1,145);   
      85           7 :     Add2HitsList(hHitMap[iCh],iCh+1,expert,!image);
      86             :   }
      87             :   //
      88           1 :   ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
      89           1 : }
      90             : 
      91             : //____________________________________________________________________________ 
      92             : void AliHMPIDQADataMakerSim::InitDigits()
      93             : {
      94             :   // create Digits histograms in Digits subdir
      95             :   const Bool_t expert   = kTRUE ; 
      96             :   const Bool_t image    = kTRUE ; 
      97             :   
      98           2 :   TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event;Occupanc [%];Entries",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
      99           1 :   TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
     100           1 :   TH2F *hDigMap[7];
     101           1 :   TH1F *hDigQ[42];
     102          16 :   for(Int_t iCh =0; iCh < 7; iCh++){
     103          28 :     hDigMap[iCh] = new TH2F(Form("MapCh%i",iCh),Form("Digit Map in Chamber %i;Digit #;Entries",iCh),159,0,159,143,0,143);
     104          98 :     for(Int_t iPc =0; iPc < 6; iPc++ ){
     105         168 :       hDigQ[iCh*6+iPc] = new TH1F(Form("QCh%iPc%i        ",iCh,iPc),Form("Charge of digits (ADC) in Chamber %i and PC %i;Charge;Entries",iCh,iPc),4100,0,4100);
     106             :     }
     107             :   }
     108             :   
     109           1 :   Add2DigitsList(hDigChEvt,0, !expert, image);
     110           1 :   Add2DigitsList(hDigPcEvt,1,expert, !image);
     111          16 :   for(Int_t iMap=0; iMap < 7; iMap++) Add2DigitsList(hDigMap[iMap],2+iMap,expert, !image);
     112          86 :   for(Int_t iH =0; iH < 42 ; iH++) Add2DigitsList(hDigQ[iH]    ,9+iH,expert,!image);
     113             :   //
     114           1 :   ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
     115           1 : }
     116             : 
     117             : //____________________________________________________________________________ 
     118             : void AliHMPIDQADataMakerSim::InitSDigits()
     119             : {
     120             :   // create SDigits histograms in SDigits subdir
     121             :   const Bool_t expert   = kTRUE ; 
     122             :   const Bool_t image    = kTRUE ; 
     123             : 
     124           2 :   TH1F   *hSDigits     = new TH1F("hHmpidSDigits",    "SDigits Q  distribution in HMPID;QDC;Entries",  500, 0., 5000.) ; 
     125           1 :   Add2SDigitsList(hSDigits,0, !expert, image);
     126             :   //
     127           1 :   ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line}
     128           1 : }
     129             : 
     130             : //____________________________________________________________________________ 
     131             : 
     132             : void AliHMPIDQADataMakerSim::MakeHits()
     133             : {
     134             :  //
     135             :  //filling QA histos for Hits
     136             :  //
     137             :   
     138         224 :   TIter next(fHitsArray); 
     139             :   AliHMPIDHit * hit ; 
     140        1624 :   while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
     141         329 :     if(hit->Pid()<500000) FillHitsData(0,hit->Q()) ;
     142         329 :     if(hit->Pid()<500000) FillHitsData(hit->Ch()+1,hit->LorsX(),hit->LorsY());
     143             :   }
     144         112 : } 
     145             : 
     146             : //___________________________________________________________________________
     147             : void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
     148             : {
     149             : //
     150             : //Opening of the Hit TTree 
     151             : //
     152           8 :  if (fHitsArray) 
     153           3 :    fHitsArray->Clear() ; 
     154             :   else 
     155           2 :     fHitsArray=new TClonesArray("AliHMPIDHit");  
     156           4 :   data->SetBranchAddress("HMPID",&fHitsArray);
     157         232 :   for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
     158         112 :     data->GetEntry(iEnt);
     159         112 :     MakeHits();
     160             :   }//entries loop
     161           4 : }
     162             : //___________________________________________________________________________
     163             : void AliHMPIDQADataMakerSim::MakeDigits()
     164             : {
     165             :   //
     166             :   //filling QA histos for Digits
     167             :   //
     168             :    
     169          56 :   Int_t i = fChannel ; 
     170          28 :   FillDigitsData(0,i,fDigitsArray->GetEntriesFast()/(48.*80.*6.));
     171          28 :   TIter next(fDigitsArray); 
     172             :   AliHMPIDDigit * digit; 
     173        2236 :   while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
     174        1062 :     FillDigitsData(1,10.*i+digit->Pc(),1./(48.*80.));
     175        1593 :     FillDigitsData(2+i,digit->PadChX(),digit->PadChY());
     176        1062 :     FillDigitsData(9+i*6+digit->Pc(),digit->Q());
     177             :   }  
     178          28 : }  
     179             : //___________________________________________________________________________
     180             : void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
     181             : {
     182             :   //
     183             :   //Opening the Digit Tree
     184             :   //
     185             :   
     186           8 :   if(fDigitsArray) 
     187           3 :     fDigitsArray->Clear() ; 
     188             :   else
     189           2 :     fDigitsArray=new TClonesArray("AliHMPIDDigit");
     190             :   
     191          64 :   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
     192          28 :     fChannel = iCh ; 
     193          28 :     data->SetBranchAddress(Form("HMPID%i",iCh),&fDigitsArray);
     194          28 :     data->GetEntry(0);
     195          28 :     MakeDigits();
     196          28 :     fDigitsArray->Clear() ; 
     197             :   }
     198           4 : }
     199             : 
     200             : //____________________________________________________________________________
     201             : 
     202             : void AliHMPIDQADataMakerSim::MakeSDigits()
     203             : {
     204             :  //
     205             :  //filling QA histos for SDigits
     206             :  //
     207             :  
     208           8 :   TIter next(fSDigitsArray) ; 
     209             :   AliHMPIDDigit * sdigit ; 
     210       10480 :   while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
     211        2616 :     FillSDigitsData(0,sdigit->Q());
     212             :   } 
     213           4 : }
     214             : //___________________________________________________________________________
     215             : void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
     216             : {
     217             :  //
     218             :  // Opening the SDigit Tree
     219             :  //
     220           8 :  if (fSDigitsArray)
     221           3 :    fSDigitsArray->Clear() ; 
     222             :   else 
     223           2 :     fSDigitsArray = new TClonesArray("AliHMPIDDigit", 1000) ;
     224             : 
     225           4 :   TBranch * branch = data->GetBranch("HMPID") ;
     226           4 :   if ( ! branch ) {
     227           0 :     AliError("HMPID SDigit Tree not found") ;
     228           0 :     return;
     229             :   }
     230           4 :   branch->SetAddress(&fSDigitsArray) ;
     231           4 :   branch->GetEntry(0) ;
     232           4 :   MakeSDigits() ;
     233           8 : }
     234             : //____________________________________________________________________________
     235             : void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
     236             : {
     237             :   //Detector specific actions at start of cycle
     238             :   
     239          12 : }
     240             : 
     241             : void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray **obj)
     242             : {
     243             :   //Detector specific actions at end of cycle
     244             :   // do the QA checking
     245          18 :   ResetEventTrigClasses(); // reset triggers list to select all histos
     246           9 :   AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;  
     247           9 : }
     248             : 

Generated by: LCOV version 1.11