LCOV - code coverage report
Current view: top level - STEER/AOD - AliAODCaloTrigger.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 72 189 38.1 %
Date: 2016-06-14 17:26:59 Functions: 6 28 21.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             :  
      18             : 
      19             :  
      20             : 
      21             : Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
      22             : */
      23             : 
      24             : #include "AliAODCaloTrigger.h"
      25             : #include "AliLog.h"
      26             : 
      27             : #include "TArrayI.h"
      28             : #include "Riostream.h"
      29             : #include <cstdlib>
      30             : 
      31         170 : ClassImp(AliAODCaloTrigger)
      32             : 
      33             : //_______________
      34           4 : AliAODCaloTrigger::AliAODCaloTrigger() : AliVCaloTrigger(),
      35           4 : fNEntries(0),
      36           4 : fCurrent(-1),
      37           4 : fColumn(0x0),
      38           4 : fRow(0x0),
      39           4 : fAmplitude(0x0),
      40           4 : fTime(0x0),
      41           4 : fNL0Times(0x0),
      42          12 : fL0Times(new TArrayI()),
      43           4 : fL1TimeSum(0x0),
      44           4 : fTriggerBits(0x0),
      45           4 : fL1Threshold(),
      46           4 : fL1V0(),
      47           4 : fL1FrameMask(0),
      48           4 : fL1DCALThreshold(),
      49           4 : fL1SubRegion(0x0),
      50           4 : fL1DCALFrameMask(0),
      51           4 : fMedian(),
      52           4 : fTriggerBitWord(0),
      53           4 : fL1DCALV0()
      54          20 : {
      55             :         //
      56          40 :   for (int i = 0; i < 4; i++) {fL1Threshold[i] = fL1DCALThreshold[i] = 0;}
      57           4 :   fL1V0[0] = fL1V0[1] = 0;
      58           4 :   fL1DCALV0[0] = fL1DCALV0[1] = 0;
      59           4 :   fMedian[0] = fMedian[1] = 0;
      60           8 : }
      61             : 
      62             : //_______________
      63           0 : AliAODCaloTrigger::AliAODCaloTrigger(const char* name, const char* title) : AliVCaloTrigger(name, title),
      64           0 :         fNEntries(0),
      65           0 :         fCurrent(-1),
      66           0 :         fColumn(0x0),
      67           0 :         fRow(0x0),
      68           0 :         fAmplitude(0x0),
      69           0 :         fTime(0x0),
      70           0 :         fNL0Times(0x0),
      71           0 :         fL0Times(new TArrayI()),
      72           0 :         fL1TimeSum(0x0),
      73           0 :         fTriggerBits(0x0),
      74           0 :         fL1Threshold(),
      75           0 :         fL1V0(),
      76           0 :         fL1FrameMask(0),
      77           0 :         fL1DCALV0()
      78           0 : {
      79             :         //
      80           0 :         fL1Threshold[0] = fL1Threshold[1] = 0;
      81           0 :         fL1V0[0] = fL1V0[1] = 0;        
      82           0 :         fL1DCALV0[0] = fL1DCALV0[1] = 0;
      83           0 :         fMedian[0] = fMedian[1] = 0;
      84           0 : }
      85             : 
      86             : //_______________
      87           0 : AliAODCaloTrigger::AliAODCaloTrigger(const AliAODCaloTrigger& src) : AliVCaloTrigger(src),
      88           0 : fNEntries(0),
      89           0 : fCurrent(-1),
      90           0 : fColumn(0x0),
      91           0 : fRow(0x0),
      92           0 : fAmplitude(0x0),
      93           0 : fTime(0x0),
      94           0 : fNL0Times(0x0),
      95           0 : fL0Times(new TArrayI()),
      96           0 : fL1TimeSum(0x0),
      97           0 : fTriggerBits(0x0),
      98           0 : fL1Threshold(),
      99           0 : fL1V0(),
     100           0 : fL1FrameMask(0),
     101           0 : fL1DCALV0()
     102           0 : {
     103             :         //
     104           0 :         src.Copy(*this);
     105           0 : }
     106             : 
     107             : //_______________
     108             : AliAODCaloTrigger::~AliAODCaloTrigger()
     109           0 : {
     110             :         //
     111           0 :         if (fNEntries) DeAllocate();
     112             :         
     113           0 :         delete fL0Times; fL0Times = 0x0;
     114           0 : }
     115             : 
     116             : //_______________
     117             : void AliAODCaloTrigger::DeAllocate()
     118             : {
     119             :         //
     120         100 :         delete [] fColumn;      fColumn      = 0x0;
     121          68 :         delete [] fRow;         fRow         = 0x0;     
     122          68 :         delete [] fAmplitude;   fAmplitude   = 0x0;
     123          68 :         delete [] fTime;        fTime        = 0x0;   
     124          68 :         delete [] fNL0Times;    fNL0Times    = 0x0;
     125          68 :         delete [] fL1TimeSum;   fL1TimeSum   = 0x0;
     126          68 :   delete [] fL1SubRegion; fL1SubRegion = 0x0;
     127          68 :         delete [] fTriggerBits; fTriggerBits = 0x0;
     128             : 
     129          32 :         fNEntries =  0;
     130          32 :         fCurrent  = -1;
     131             : 
     132          32 :         fL0Times->Reset();
     133          32 : }
     134             : 
     135             : //_______________
     136             : AliAODCaloTrigger& AliAODCaloTrigger::operator=(const AliAODCaloTrigger& src)
     137             : {
     138             :         //
     139           0 :         if (this != &src) src.Copy(*this);
     140             :         
     141           0 :         return *this;
     142             : }
     143             : 
     144             : //_______________
     145             : void AliAODCaloTrigger::Copy(TObject &obj) const 
     146             : {    
     147           0 :    AliVCaloTrigger::Copy(obj);
     148             :     
     149           0 :    AliAODCaloTrigger& dest = static_cast<AliAODCaloTrigger&>(obj);
     150             : 
     151           0 :    if (dest.fNEntries) dest.DeAllocate();
     152             :     
     153           0 :    dest.Allocate(fNEntries);
     154             :     
     155           0 :    for (Int_t i = 0; i < fNEntries; i++) {
     156           0 :     Int_t times[10];
     157           0 :     for (Int_t j = 0; j < 10; j++) {
     158           0 :       times[j] = fL0Times->At(10 * i + j);
     159             :     }
     160           0 :     dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], 
     161           0 :              fL1TimeSum[i], fL1SubRegion[i], fTriggerBits[i]);
     162           0 :   }
     163             : 
     164           0 :   for (int i = 0; i < 4; i++) dest.SetL1Threshold(i, fL1Threshold[i]);
     165           0 :   for (int i = 0; i < 4; i++) dest.SetL1Threshold(1, i, fL1DCALThreshold[i]);
     166             :   
     167           0 :   dest.SetL1V0(fL1V0);
     168           0 :   dest.SetL1V0(1, fL1DCALV0);
     169           0 :   dest.SetL1FrameMask(fL1FrameMask);
     170           0 :   dest.SetL1FrameMask(1, fL1DCALFrameMask);
     171           0 : }
     172             : 
     173             : //_______________
     174             : void AliAODCaloTrigger::Allocate(Int_t size)
     175             : {
     176             :         //
     177          32 :         if (!size) return;
     178             :         
     179           4 :         fNEntries = size;
     180             :         
     181           4 :         fColumn      = new   Int_t[fNEntries];
     182           4 :         fRow         = new   Int_t[fNEntries];
     183           4 :         fAmplitude   = new Float_t[fNEntries];
     184           4 :         fTime        = new Float_t[fNEntries];
     185           4 :         fNL0Times    = new   Int_t[fNEntries];
     186           4 :         fL1TimeSum   = new   Int_t[fNEntries];
     187           4 :   fL1SubRegion = new   Int_t[fNEntries];
     188           4 :         fTriggerBits = new   Int_t[fNEntries];
     189             : 
     190         292 :         for (Int_t i = 0; i < fNEntries; i++) 
     191             :         {
     192         142 :           fColumn[i]      = 0;
     193         142 :           fRow[i]         = 0;
     194         142 :           fAmplitude[i]   = 0;
     195         142 :           fTime[i]        = 0;
     196         142 :           fNL0Times[i]    = 0;
     197         142 :           fL1TimeSum[i]   = 0;
     198         142 :     fL1SubRegion[i] = 0;
     199         142 :           fTriggerBits[i] = 0;
     200             :         }
     201             :         
     202           4 :         fL0Times->Set(fNEntries * 10);
     203          20 : }
     204             : 
     205             : //_______________
     206             : Bool_t AliAODCaloTrigger::Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts, Int_t trgbits)
     207             : {
     208             :         //
     209         284 :         fCurrent++;
     210             :         
     211         142 :              fColumn[fCurrent] = col;
     212         142 :                 fRow[fCurrent] = row;
     213         142 :           fAmplitude[fCurrent] = amp;
     214         142 :                fTime[fCurrent] = time;
     215         142 :            fNL0Times[fCurrent] = ntrgtimes;
     216         142 :           fL1TimeSum[fCurrent] = trgts; 
     217         142 :         fTriggerBits[fCurrent] = trgbits;
     218             :         
     219         142 :         if (ntrgtimes > 9) 
     220             :         {
     221           0 :                 AliError("Should not have more than 10 L0 times");
     222           0 :                 return kFALSE;
     223             :         }
     224             :         
     225         336 :         for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) fL0Times->AddAt(trgtimes[i], 10 * fCurrent + i);
     226             : 
     227         142 :         return kTRUE;
     228         142 : }
     229             : 
     230             : //_______________
     231             : Bool_t AliAODCaloTrigger::Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts, Int_t subra, Int_t trgbits)
     232             : {
     233             :   //
     234           0 :   Add(col, row, amp, time, trgtimes, ntrgtimes, trgts, trgbits);
     235           0 :   fL1SubRegion[fCurrent] = subra; 
     236             :   
     237           0 :   return kTRUE;
     238             : }
     239             : 
     240             : //_______________
     241             : Bool_t AliAODCaloTrigger::Next()
     242             : {
     243             :         //
     244           0 :         if (fCurrent >= fNEntries - 1 || !fNEntries) return kFALSE;
     245             :         
     246           0 :         fCurrent++;
     247             :         
     248           0 :         return kTRUE;
     249           0 : }
     250             : 
     251             : //_______________
     252             : void AliAODCaloTrigger::GetPosition(Int_t& col, Int_t& row) const
     253             : {
     254             :         //
     255           0 :         if (fCurrent == -1) return;
     256             :         
     257           0 :         col = fColumn[fCurrent];
     258           0 :         row =    fRow[fCurrent];
     259           0 : }
     260             : 
     261             : //_______________
     262             : void AliAODCaloTrigger::GetAmplitude(Float_t& amp) const
     263             : {
     264             :         //
     265           0 :         if (fCurrent == -1) return;
     266             : 
     267           0 :         amp = fAmplitude[fCurrent];
     268           0 : }
     269             : 
     270             : //_______________
     271             : void AliAODCaloTrigger::GetTime(Float_t& time) const
     272             : {
     273             :         //
     274           0 :         if (fCurrent == -1) return;
     275             : 
     276           0 :         time = fTime[fCurrent];
     277           0 : }
     278             : 
     279             : //_______________
     280             : void AliAODCaloTrigger::GetL1TimeSum(Int_t& amp) const
     281             : {
     282             :         //      
     283           0 :         if (fCurrent == -1) return;
     284             : 
     285           0 :         amp = fL1TimeSum[fCurrent];
     286           0 : }
     287             : 
     288             : //_______________
     289             : Int_t AliAODCaloTrigger::GetL1TimeSum() const
     290             : {
     291             :   //      
     292           0 :   if (fCurrent == -1) return -1;
     293             :   
     294           0 :   return ((fL1TimeSum)?fL1TimeSum[fCurrent]:0);
     295           0 : }
     296             : 
     297             : //_______________
     298             : void AliAODCaloTrigger::GetL1SubRegion(Int_t& sb) const
     299             : {
     300             :   //      
     301           0 :   if (fCurrent == -1) return;
     302             :   
     303           0 :   sb = fL1SubRegion?fL1SubRegion[fCurrent]:0;
     304           0 : }
     305             : 
     306             : //_______________
     307             : Int_t AliAODCaloTrigger::GetL1SubRegion() const
     308             : {
     309             :   //      
     310           0 :   if (fCurrent == -1) return -1;
     311             :   
     312           0 :   return ((fL1SubRegion)?fL1SubRegion[fCurrent]:0);
     313           0 : }
     314             : 
     315             : //_______________
     316             : void AliAODCaloTrigger::GetNL0Times(Int_t& ntimes) const
     317             : {
     318             :         //
     319           0 :         if (fCurrent == -1) return;
     320             : 
     321           0 :         ntimes = fNL0Times[fCurrent];
     322           0 : }
     323             : 
     324             : //_______________
     325             : void AliAODCaloTrigger::GetTriggerBits(Int_t& bits) const
     326             : {
     327             :         //
     328           0 :         if (fCurrent == -1) return;
     329             : 
     330           0 :         bits = fTriggerBits[fCurrent];
     331           0 : }
     332             : 
     333             : //_______________
     334             : void AliAODCaloTrigger::GetL0Times(Int_t times[]) const
     335             : {
     336             :         //
     337           0 :         if (fCurrent == -1) return;
     338             : 
     339           0 :         for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) times[i] = fL0Times->At(10 * fCurrent + i);
     340           0 : }
     341             : 
     342             : //_______________
     343             : void AliAODCaloTrigger::Print(const Option_t* /*opt*/) const
     344             : {
     345             :         //
     346           0 :         if (fCurrent == -1) return;
     347             : 
     348           0 :         printf("============\n");
     349           0 :         printf("--L0:\n");
     350           0 :         printf("\tPOSITION (X: %2d Y: %2d) / FITTED F-ALTRO (AMP: %4f TIME: %3f)\n", 
     351           0 :                    fColumn[fCurrent], fRow[fCurrent], fAmplitude[fCurrent], fTime[fCurrent]);
     352           0 :         printf("\t%d L0 TIMES (", fNL0Times[fCurrent]); 
     353           0 :         for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) printf("%2d ",fL0Times->At(10 * fCurrent + i));
     354           0 :         printf(")\n");
     355           0 :         printf("--L1:\n");
     356           0 :         printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
     357           0 :         printf("\tHIGH THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
     358           0 :         printf("\tLOW THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[2], fL1Threshold[3]);
     359           0 :         printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);
     360           0 : }       

Generated by: LCOV version 1.11