LCOV - code coverage report
Current view: top level - ITS/ITSsim - AliITSFOGeneratorSPD.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 27 52 51.9 %
Date: 2016-06-14 17:26:59 Functions: 9 16 56.2 %

          Line data    Source code
       1             : /////////////////////////////////////////////////////////////////////
       2             : // Author: Henrik Tydesjo                                          //
       3             : //                                                                 //
       4             : // This class is used to generate Fast-OR signals from SPD chips.  //
       5             : //                                                                 //
       6             : // This procedure is meant to be used during the digitization,     //
       7             : // and will be based on the number of pixels firing in each chip.  //
       8             : // The method 'ProcessPixelHit' should be used for each fired      //
       9             : // pixel. An efficiency value on Fast-Or signal creation upon a    //
      10             : // single fired pixel will then be used. Optionally, there may be  //
      11             : // one value per chip or even one value per column. These values   //
      12             : // are taken from the class AliITSFOEfficiencySPD, normally placed //
      13             : // in OCDB.                                                        //
      14             : //                                                                 //
      15             : // Through a similar class, AliITSFONoiseSPD, there is a           //
      16             : // possibility to apply random noise to the generation of fast-or  //
      17             : // signals. This will then be performed by method 'ProcessNoise',  //
      18             : // normally called after the processing of the fired pixels.       //
      19             : //                                                                 //
      20             : // The output signals are represented by the AliITSFOsignalsSPD    //
      21             : // class. Basically, it contains a bit map with all the 1200 pixel //
      22             : // chips.                                                          //
      23             : /////////////////////////////////////////////////////////////////////
      24             : 
      25             : #include "AliITSFOGeneratorSPD.h"
      26             : #include "AliITSRawStreamSPD.h"
      27             : #include <TRandom.h>
      28             : 
      29             : AliITSFOGeneratorSPD::AliITSFOGeneratorSPD() :
      30          13 :   fSignals(), fOCDBEff(NULL), fOCDBNoise(NULL)
      31          52 : {
      32             :   // default constructor
      33          26 : }
      34             : //______________________________________________________________________
      35             : AliITSFOGeneratorSPD::AliITSFOGeneratorSPD(AliITSFOEfficiencySPD* ocdbEff, AliITSFONoiseSPD* ocdbNoise) :
      36           0 :     fSignals(), fOCDBEff(ocdbEff), fOCDBNoise(ocdbNoise)
      37           0 : {
      38             :   // constructor
      39           0 : }
      40             : //______________________________________________________________________
      41             : AliITSFOGeneratorSPD::AliITSFOGeneratorSPD(const AliITSFOGeneratorSPD& handle): 
      42           0 :   fSignals(handle.fSignals), fOCDBEff(handle.fOCDBEff), fOCDBNoise(handle.fOCDBNoise)
      43           0 : {
      44             :   // copy constructor
      45           0 : }
      46             : //______________________________________________________________________
      47          52 : AliITSFOGeneratorSPD::~AliITSFOGeneratorSPD() {
      48             :   // destructor
      49          26 : }
      50             : //______________________________________________________________________
      51             : AliITSFOGeneratorSPD& AliITSFOGeneratorSPD::operator=(const AliITSFOGeneratorSPD& handle) {
      52             :   // assignment operator
      53           0 :   if (this!=&handle) {
      54           0 :     fSignals = handle.fSignals;
      55           0 :     fOCDBEff = handle.fOCDBEff;
      56           0 :     fOCDBNoise = handle.fOCDBNoise;
      57           0 :   }
      58           0 :   return *this;
      59             : }
      60             : //______________________________________________________________________
      61             : void AliITSFOGeneratorSPD::SetEfficiencyAndNoise(AliITSFOEfficiencySPD* ocdbEff, AliITSFONoiseSPD* ocdbNoise) {
      62             :   // Method to give pointers to the OCDB entries, needed by methods ProcessPixelHit and ProcessNoise
      63           0 :   SetEfficiency(ocdbEff);
      64           0 :   SetNoise(ocdbNoise);
      65           0 : }
      66             : //______________________________________________________________________
      67             : void AliITSFOGeneratorSPD::SetEfficiency(AliITSFOEfficiencySPD* ocdbEff) {
      68             :   // Method to give pointer to the OCDB efficiency entry
      69           4 :   fOCDBEff = ocdbEff;
      70           2 : }
      71             : //______________________________________________________________________
      72             : void AliITSFOGeneratorSPD::SetNoise(AliITSFONoiseSPD* ocdbNoise) {
      73             :   // Method to give pointer to the OCDB noise entry
      74           4 :   fOCDBNoise = ocdbNoise;
      75           2 : }
      76             : //______________________________________________________________________
      77             : void AliITSFOGeneratorSPD::ProcessPixelHit(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
      78             :   // Here it will be decided wether a fired pixel will give rise to a fast-or signal or not
      79         296 :   if (eq>=20 || hs>=6 || chip>=10 || col>=32 || row>=256) {
      80           0 :     Error("AliITSFOGeneratorSPD::ProcessPixelHit", "eq,hs,chip,col,row (%d,%d,%d,%d,%d) out of bounds.",
      81             :           eq,hs,chip,col,row);
      82           0 :     return;
      83             :   }
      84         148 :   if (fOCDBEff==NULL) {
      85           0 :     Error("AliITSFOGeneratorSPD::ProcessPixelHit", "No AliITSFOEfficiencySPD entry has been provided.");
      86           0 :     return;
      87             :   }
      88             :   // simulate if this fired pixel gives rise to a fast-or signal:
      89         148 :   if (gRandom->Rndm() < fOCDBEff->GetColumnEfficiency(eq,hs,chip,col)) {
      90         148 :     fSignals.SetSignal(eq,hs,chip);
      91         148 :   }
      92         148 : }
      93             : //______________________________________________________________________
      94             : void AliITSFOGeneratorSPD::ProcessPixelHitM(UInt_t module, UInt_t colM, UInt_t rowM) {
      95             :   // Converts offline coordinates to online, and calls ProcessPixelHit
      96         296 :   if (module>=240 || colM>=160 || rowM>=256) {
      97           0 :     Error("AliITSFOGeneratorSPD::ProcessPixelHitM", "module,colM,rowM (%d,%d,%d) out of bounds.",
      98             :           module,colM,rowM);
      99           0 :     return;
     100             :   }
     101         148 :   UInt_t eq,hs,chip,col,row;
     102         148 :   if (AliITSRawStreamSPD::OfflineToOnline(module,colM,rowM,eq,hs,chip,col,row)) {
     103         148 :     ProcessPixelHit(eq,hs,chip,col,row);
     104         148 :   }
     105         296 : }
     106             : //______________________________________________________________________
     107             : void AliITSFOGeneratorSPD::ProcessNoise() {
     108             :   // 
     109           8 :   if (fOCDBNoise==NULL) {
     110           0 :     Error("AliITSFOGeneratorSPD::ProcessNoise", "No AliITSFONoiseSPD entry has been provided.");
     111           0 :     return;
     112             :   }
     113             :   // simulate if each pixel chip will give rise to a random noise induced fast-or signal:
     114         168 :   for (UInt_t eq=0; eq<20; eq++) {
     115        1120 :     for (UInt_t hs=0; hs<6; hs++) {
     116       10560 :       for (UInt_t chip=0; chip<10; chip++) {
     117        4800 :         if (gRandom->Rndm() < fOCDBNoise->GetChipNoise(eq,hs,chip)) {
     118           0 :           fSignals.SetSignal(eq,hs,chip);
     119           0 :         }
     120             :       }
     121             :     }
     122             :   }
     123           4 : }

Generated by: LCOV version 1.11