LCOV - code coverage report
Current view: top level - PHOS/PHOSbase - AliPHOSEmcBadChannelsMap.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 11 51 21.6 %
Date: 2016-06-14 17:26:59 Functions: 4 9 44.4 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 2007, 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             : /* $Id$ */
      17             :  
      18             : ///////////////////////////////////////////////////////////////////////////////
      19             : //                                                                           //
      20             : // PHOS EmCal bad channels map.                                              //
      21             : //                                                                           //
      22             : ///////////////////////////////////////////////////////////////////////////////
      23             :  
      24             : #include "AliPHOSEmcBadChannelsMap.h"
      25             : #include "AliPHOSGeometry.h"
      26             :  
      27          22 : ClassImp(AliPHOSEmcBadChannelsMap)
      28             :  
      29             : //________________________________________________________________
      30             : 
      31           6 :   AliPHOSEmcBadChannelsMap::AliPHOSEmcBadChannelsMap() : fBads(-1)
      32          15 : {
      33           3 :   Reset();
      34           6 : }
      35             : 
      36             : //________________________________________________________________
      37             : 
      38             : void AliPHOSEmcBadChannelsMap::Reset()
      39             : {
      40             :   //Set all channels as good.
      41             :   
      42          39 :   for(Int_t module=0; module<5; module++) 
      43        1710 :     for(Int_t column=0; column<56; column++) 
      44      109200 :       for(Int_t row=0; row<64; row++) 
      45       53760 :         fBadChannelEmc[module][column][row] = kFALSE;
      46             :  
      47           3 :   fBads=0;
      48             : 
      49           3 : }
      50             : 
      51             : //________________________________________________________________
      52             : 
      53             : AliPHOSEmcBadChannelsMap::AliPHOSEmcBadChannelsMap(const AliPHOSEmcBadChannelsMap &map):
      54           0 :   TObject(map),fBads(map.fBads)
      55           0 : {
      56             :   //Copy constructor.
      57             : 
      58           0 :   for(Int_t module=0; module<5; module++) 
      59           0 :     for(Int_t column=0; column<56; column++) 
      60           0 :       for(Int_t row=0; row<64; row++) 
      61           0 :         fBadChannelEmc[module][column][row] = map.fBadChannelEmc[module][column][row];
      62             :  
      63           0 : }
      64             : 
      65             : //________________________________________________________________
      66             : 
      67             : AliPHOSEmcBadChannelsMap& AliPHOSEmcBadChannelsMap::operator= (const AliPHOSEmcBadChannelsMap &map) 
      68             : {
      69             :   //Assignment operator.
      70             : 
      71           0 :   if(this != &map) {
      72           0 :     fBads = map.fBads;
      73           0 :     for(Int_t module=0; module<5; module++) 
      74           0 :       for(Int_t column=0; column<56; column++) 
      75           0 :         for(Int_t row=0; row<64; row++) 
      76           0 :           fBadChannelEmc[module][column][row] = map.fBadChannelEmc[module][column][row]; 
      77           0 :   }
      78             : 
      79           0 :   return *this;
      80             : }
      81             : 
      82             : //_________________________________________________________________
      83             : 
      84             : void AliPHOSEmcBadChannelsMap::SetBadChannel(Int_t module, Int_t col, Int_t row)
      85             : {
      86             :   // Declare a channel (module,col,row) as a bad, if it was not set before
      87             : 
      88           0 :   if (!fBadChannelEmc[module-1][col-1][row-1]) {
      89           0 :     fBadChannelEmc[module-1][col-1][row-1] = kTRUE;
      90           0 :     ++fBads; 
      91           0 :   }
      92           0 : }
      93             : //_________________________________________________________________
      94             : 
      95             : void AliPHOSEmcBadChannelsMap::BadChannelIds(Int_t *badIds)
      96             : {
      97             :   //Fill array badIds by the Ids of bad channels.
      98             :   //Array badIds of length GetNumOfBadChannels() should be prepared in advance. 
      99             : 
     100           0 :   if(!badIds) return;
     101           0 :   if(!fBads>0) return;
     102             : 
     103           0 :   AliPHOSGeometry* geom = AliPHOSGeometry::GetInstance();
     104             : 
     105           0 :   if(!geom)
     106           0 :     geom = AliPHOSGeometry::GetInstance("IHEP");
     107             : 
     108           0 :   Int_t absId;
     109           0 :   Int_t relId[4];
     110             : 
     111             :   Int_t iBad = 0;
     112           0 :   relId[1] =  0; // EMC crystal
     113             : 
     114           0 :   for(Int_t mod=1; mod<6; mod++) { 
     115           0 :     for(Int_t col=1; col<57; col++) { 
     116           0 :       for(Int_t row=1; row<65; row++) {
     117           0 :         if(IsBadChannel(mod,col,row)) {
     118           0 :           relId[0] = mod;
     119           0 :           relId[3] = col;
     120           0 :           relId[2] = row;
     121           0 :           geom->RelToAbsNumbering(relId,absId);
     122           0 :           badIds[iBad]=absId;
     123           0 :           iBad++;
     124           0 :         }
     125             :       }
     126             :     }
     127             :   }
     128             : 
     129           0 : }

Generated by: LCOV version 1.11