1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 Patch object implementation: one patch is made of subregions (Olivier's nomenclature)
21 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
24 #include "AliEMCALTriggerPatch.h"
25 #include "AliRunLoader.h"
27 #include "AliEMCALGeometry.h"
32 ClassImp(AliEMCALTriggerPatch)
35 AliEMCALTriggerPatch::AliEMCALTriggerPatch() : TObject(),
39 // Default constructor
43 AliEMCALTriggerPatch::AliEMCALTriggerPatch( Int_t i, Int_t j, Int_t k ) : TObject(),
44 fPosition(new TVector2( i , j )),
51 //____________________________________________________________________
52 AliEMCALTriggerPatch::AliEMCALTriggerPatch(const AliEMCALTriggerPatch& other) : TObject(other),
53 fPosition( new TVector2(*other.fPosition) ),
60 AliEMCALTriggerPatch::~AliEMCALTriggerPatch()
62 if (fPosition) delete fPosition;
66 void AliEMCALTriggerPatch::Print(const Option_t*) const
68 printf("]> Patch at (%2d , %2d) w/ sum %3d\n",
69 (int)fPosition->X(),(int)fPosition->Y(),fSum);
73 void AliEMCALTriggerPatch::GetAbsCellIdsFromPatchPosition( TVector2& pSize, TVector2& sSize, TArrayI& absid )
75 AliRunLoader* runLoader = AliRunLoader::Instance();
76 AliEMCALGeometry* geom = dynamic_cast<AliEMCAL*>(runLoader->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
78 Int_t nTowersinpatch = (Int_t) (pSize.X() * pSize.Y() * sSize.X() * sSize.Y() * 4);
80 absid.Set( nTowersinpatch );
82 // fPosition: patch position in the STU region
83 Int_t ix = (Int_t)(( fPosition->X() + pSize.X() ) * sSize.X());
84 Int_t iy = (Int_t)(( fPosition->Y() + pSize.Y() ) * sSize.Y());
88 for (Int_t i=(Int_t) (fPosition->X() * sSize.X()); i<ix; i++) // Loop over subregions FastOR
90 for (Int_t j=(Int_t) (fPosition->Y() * sSize.Y()); j<iy; j++)
92 Int_t nSupMod = int(i/24) + 2 * int(j/12);
97 nModule = ( i < 24 ) ? 12 * ( 23 - i ) + 11 - j%12 : 12 * ( i%24 ) + 11 - j%12;
99 nModule = ( i < 24 ) ? 6 * ( 23 - i ) + 5 - j%12 : 6 * ( i%24 ) + 5 - j;
101 // Convert (TRU,eta,phi) to Id
102 for (Int_t k=0;k<2;k++)
104 for (Int_t l=0;l<2;l++)
107 geom->GetCellPhiEtaIndexInSModule(nSupMod, nModule, k, l, iphi, ieta);
109 absid.SetAt( geom->GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta) , it++ );