New code for EMCAL (B.Nilsen)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 4 Nov 2001 17:31:56 +0000 (17:31 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 4 Nov 2001 17:31:56 +0000 (17:31 +0000)
14 files changed:
EMCAL/AliEMCAL.cxx
EMCAL/AliEMCAL.h
EMCAL/AliEMCALGeometry.cxx
EMCAL/AliEMCALGeometry.h
EMCAL/AliEMCALHit.cxx [new file with mode: 0644]
EMCAL/AliEMCALHit.h [new file with mode: 0644]
EMCAL/AliEMCALLinkDef.h [new file with mode: 0644]
EMCAL/AliEMCALv0.cxx
EMCAL/AliEMCALv0.h
EMCAL/AliEMCALv1.cxx [new file with mode: 0644]
EMCAL/AliEMCALv1.h [new file with mode: 0644]
EMCAL/EMCALLinkDef.h
EMCAL/Makefile
EMCAL/libEMCAL.pkg

index 08ba931fd5d9c025cb086f169d9ed9fe3afef2af..1063b605d946d9318671d97acabef23bf0df5862 100644 (file)
 //    
 // 
 //*-- Author: Yves Schutz (SUBATECH) 
+//
+//*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
+//
 //////////////////////////////////////////////////////////////////////////////
 
 // --- Standard library ---
 #include <strstream.h>
 
 // --- ROOT system ---
+class TFile;
 #include "TBranch.h" 
 #include "TClonesArray.h" 
 #include "TTree.h" 
@@ -45,45 +49,46 @@ AliEMCAL::AliEMCAL():AliDetector()
 {
   // ctor 
   //We do not create objects, because these pointers will be overwritten during reading from file.
-  fGeom = 0;
-  fSDigits       = 0 ;
-  fDigits = 0;
+  fGeom     = 0;
 }
 //____________________________________________________________________________
-AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title) 
-{
-  // ctor : title is used to identify the layout
-  
-  // gets an instance of the geometry parameters class  
-  if (strcmp(GetTitle(),"") != 0 ) 
-    fGeom =  AliEMCALGeometry::GetInstance(GetTitle(), "") ; 
+AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title) {
+//   ctor : title is used to identify the layout
+  fGeom     = 0;
+//   gets an instance of the geometry parameters class  
 }
 //____________________________________________________________________________
-AliEMCAL::~AliEMCAL()
-{
+AliEMCAL::~AliEMCAL(){
   // dtor
-
+    delete fHits;
 }
 
 //____________________________________________________________________________
-void AliEMCAL::CreateMaterials()
-{
+void AliEMCAL::CreateMaterials(){
   // Definitions of materials to build EMCAL and associated tracking media.
   // media number in idtmed are 1599 to 1698.
 
   // --- Air ---
   AliMaterial(0, "Air$", 14.61, 7.3, 0.001205, 30420., 67500., 0, 0) ;
 
+
   // --- Lead ---                                                                     
   AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
 
-  // --- Average properties of the active material ---                                                                     
-  AliMaterial(2, "EmcalMat$", fGeom->GetAmat(), 
-                             fGeom->GetZmat(),
-                             fGeom->GetDmat(),
-                             fGeom->GetRmat(), 
-                             0) ;
+
+  // --- The polysterene scintillator (CH) ---
+  Float_t aP[2] = {12.011, 1.00794} ;
+  Float_t zP[2] = {6.0, 1.0} ;
+  Float_t wP[2] = {1.0, 1.0} ;
+  Float_t dP = 1.032 ;
+
+  AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
+
+  // --- Aluminium ---
+  AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
+  // ---         Absorption length is ignored ^
+
+
 
   // DEFINITION OF THE TRACKING MEDIA
 
@@ -91,6 +96,8 @@ void AliEMCAL::CreateMaterials()
   Int_t * idtmed = fIdtmed->GetArray() - 1599 ; 
   Int_t   isxfld = gAlice->Field()->Integ() ;
   Float_t sxmgmx = gAlice->Field()->Max() ;
+
 
    // Air                                                                           -> idtmed[1599] 
   AliMedium(0, "Air          $", 0, 0,
@@ -101,25 +108,32 @@ void AliEMCAL::CreateMaterials()
   AliMedium(1, "Lead      $", 1, 0,
             isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
 
-  // The Average properties of the active material                                  -> idtmed[1601]
+ // The scintillator of the CPV made of Polystyrene scintillator                   -> idtmed[1601]
+  AliMedium(2, "CPV scint.   $", 2, 1,
+            isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
+
+  // Various Aluminium parts made of Al                                             -> idtmed[1602]
+  AliMedium(3, "Al parts     $", 3, 0,
+             isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
+
+
 
-  AliMedium(2, "EmcalMat  $", 2, 0,
-            isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
 
- // --- Set decent energy thresholds for gamma and electron tracking
+// --- Set decent energy thresholds for gamma and electron tracking
 
   // Tracking threshold for photons and electrons in Lead 
   gMC->Gstpar(idtmed[1600], "CUTGAM",0.5E-4) ; 
   gMC->Gstpar(idtmed[1600], "CUTELE",1.0E-4) ;
-  gMC->Gstpar(idtmed[1601], "CUTGAM",0.5E-4) ; 
-  gMC->Gstpar(idtmed[1601], "CUTELE",1.0E-4) ;
 
   // --- Generate explicitly delta rays in Lead ---
   gMC->Gstpar(idtmed[1600], "LOSS",3.) ;
   gMC->Gstpar(idtmed[1600], "DRAY",1.) ;
-  gMC->Gstpar(idtmed[1601], "LOSS",3.) ;
-  gMC->Gstpar(idtmed[1601], "DRAY",1.) ;
  
+// --- and in aluminium parts ---
+  gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
+  gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
+
 }
 //____________________________________________________________________________
 void AliEMCAL::SetTreeAddress()
@@ -136,24 +150,6 @@ void AliEMCAL::SetTreeAddress()
     if (branch) branch->SetAddress(&fHits);
   }
  
-  // Branch address for digit tree
-  TTree *treeD = gAlice->TreeD();
-  
-  if(fDigits)
-    fDigits->Clear();
-
-  if (treeD && fDigits) {
-    branch = treeD->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fDigits);
-  }
-
-  if(fSDigits)
-    fSDigits->Clear();
-
-  if (gAlice->TreeS()  && fSDigits ) {
-    branch = gAlice->TreeS()->GetBranch("EMCAL");
-    if (branch) branch->SetAddress(&fSDigits) ;
-  } 
 }
 
 
index 1005caa65f1deb8dda4ebdb0d6d8c1af45586f45..1be224da3842773f789b4bfcd28e536c223c8091 100644 (file)
@@ -17,42 +17,48 @@ class TString ;
 class TClonesArray ;
 
 // --- AliRoot header files ---
-
+#include <stdlib.h>
 #include "AliDetector.h"
+#include "AliEMCALGeometry.h"
 class AliEMCALGeometry ; 
 
 class AliEMCAL : public AliDetector {
 
  public:
 
-  AliEMCAL() ;
+  AliEMCAL()
   AliEMCAL(const char* name, const char* title="");
   AliEMCAL(const AliEMCAL & emcal) {
     // cpy ctor: no implementation yet
     // requested by the Coding Convention
-    assert(0==1) ; 
+    abort() ; 
   }
   virtual ~AliEMCAL() ; 
+  virtual void   AddHit(Int_t, Int_t*, Float_t *) {
+    // do not use this definition but the one below
+    abort() ;
+  }
+  virtual void   AddHit( Int_t shunt, Int_t primary, Int_t track, 
+                        Int_t id, Float_t *hits ) = 0 ;
+
+
   virtual void   CreateMaterials() ;                     
-  virtual AliEMCALGeometry * GetGeometry() { return fGeom ; }  
+  virtual AliEMCALGeometry * GetGeometry()  = 0 ;   
   Int_t   IsVersion(void) const { return -1 ; } 
   virtual void  SetTreeAddress() ;               
-  TClonesArray *SDigits() const {return fSDigits;}
   virtual TString Version() {return TString(" ") ; }  
   AliEMCAL & operator = (const AliEMCAL & rvalue)  {
     // assignement operator requested by coding convention
     // but not needed
-    assert(0==1) ;
+    abort() ;
     return *this ; 
   }
  
 protected:
 
   AliEMCALGeometry * fGeom ;                       // Geometry definition
-  TClonesArray   *fSDigits      ; // List of summable digits
-  TClonesArray   *fDigits      ;  // List of digits
 
-  ClassDef(AliEMCAL,2) // Electromagnetic calorimeter (base class)
+  ClassDef(AliEMCAL,1) // Electromagnetic calorimeter (base class)
 
 } ;
 
index a6480122a12973a6ff7dba4c54dcf50c4791e035..6e51537ddbe1e504c1092e013b8aa429249e7765 100644 (file)
 
 //_________________________________________________________________________
 // Geometry class  for EMCAL : singleton  
-// EMCAL consists of a shell of Pb 
+// EMCAL consists of layers of scintillator and lead
 //                  
-//*-- Author: Yves Schutz (SUBATECH)
+//*-- Author: Sahal Yacoob (LBL / UCT)
+//     and  : Yves Schutz (SUBATECH)
+//     and  : Jennifer Klay (LBL)
 
 // --- ROOT system ---
 
 #include "AliEMCALGeometry.h"
 #include "AliConst.h"
 
-ClassImp(AliEMCALGeometry) ;
+ClassImp(AliEMCALGeometry);
 
-AliEMCALGeometry * AliEMCALGeometry::fgGeom = 0 ;
-Bool_t            AliEMCALGeometry::fgInit = kFALSE ;
-
-//____________________________________________________________________________
-AliEMCALGeometry::~AliEMCALGeometry(void)
-{
-  // dtor
+AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0;
+Bool_t            AliEMCALGeometry::fgInit = kFALSE;
 
+//______________________________________________________________________
+AliEMCALGeometry::~AliEMCALGeometry(void){
+    // dtor
 }
-
-//____________________________________________________________________________
-
-void AliEMCALGeometry::Init(void)
-{
-  // Initializes the EMCAL parameters
-
-  fgInit = kTRUE ; 
-
-  // geometry 
-  fAirGap     = 5.0 ; 
-  fArm1PhiMin = 130.0 ; 
-  fArm1PhiMax = 210.0 ; 
-  fArm2PhiMin = 330.0 ; 
-  fArm2PhiMax = 410.0 ; 
-  fIPDistance = 423.0 ; 
-  fShellThickness = 50.0 ; 
-  fZLength = 817.0 ; 
-  fEnvelop[0] = fIPDistance ; 
-  fEnvelop[1] = fIPDistance + fShellThickness ;
-  fEnvelop[2] = fZLength ; 
-  fGap2Active = 1.0 ; 
-  // material
-  fAmat = 207.2;  
-  fZmat = 82.;   
-  fDmat = 5.798167 ;  
-  fRmat = 1.261061;  
-  fEmat = 23 ;  
+//______________________________________________________________________
+void AliEMCALGeometry::Init(void){
+    // Initializes the EMCAL parameters
+
+    if(!(  (strcmp( fName, "EMCALArch1a" ) == 0) |
+          (strcmp( fName, "EMCALArch1b" ) == 0) | 
+          (strcmp( fName, "EMCALArch2a" ) == 0) | 
+          (strcmp( fName, "EMCALArch2b" ) == 0) )){
+       fgInit = kFALSE;
+       cout <<"Instance " << fName << " undefined" << endl;
+    } // end if
+    fgInit = kTRUE; 
+
+    // geometry 
+    fAirGap     = 5.0; 
+    fArm1PhiMin = 0.0; 
+    fArm1PhiMax = 120.0; 
+
+    fIPDistance = 454.0; 
+    fZLength = 817.0; 
+    fEnvelop[0] = fIPDistance; 
+    fEnvelop[2] = fZLength; 
+    fGap2Active = 1.0; 
+    fShellThickness = 3.18 + 1.2 + (double)((2*fNLayers -3)/2);   
+    fEnvelop[1] = fIPDistance + fShellThickness;
+
+    if (((strcmp( fName, "EMCALArch1a" ))    == 0) |
+       ((strcmp( fName, "EMCALArch1b" ))    == 0)){
+       fNZ         = 96;
+       fNPhi       = 144;
+    } // end if
+    if (((strcmp( fName, "EMCALArch2a" ))    == 0) |
+       ((strcmp( fName, "EMCALArch2b" ))    == 0)){
+       fNZ         = 112;
+       fNPhi       = 168;
+    } // end if
+    if (((strcmp( fName, "EMCALArch1a" ))    == 0) |
+       ((strcmp( fName, "EMCALArch2a" ))    == 0)){
+       fNLayers    = 21;
+    } // end if
+    if (((strcmp( fName, "EMCALArch1b" ))    == 0) |
+       ((strcmp( fName, "EMCALArch2b" ))    == 0)){
+       fNLayers    = 25;
+    } // end if
 }
+//______________________________________________________________________
+AliEMCALGeometry *  AliEMCALGeometry::GetInstance(){ 
+    // Returns the pointer of the unique instance
 
-//____________________________________________________________________________
-AliEMCALGeometry *  AliEMCALGeometry::GetInstance() 
-{ 
-  // Returns the pointer of the unique instance
-  return (AliEMCALGeometry *) fgGeom ; 
+    return (AliEMCALGeometry *) fgGeom; 
 }
-
-//____________________________________________________________________________
-AliEMCALGeometry *  AliEMCALGeometry::GetInstance(const Text_t* name, const Text_t* title) 
-{
-  // Returns the pointer of the unique instance
-  AliEMCALGeometry * rv = 0  ; 
-  if ( fgGeom == 0 ) {
-    if ( strcmp(name,"") == 0 ) 
-      rv = 0 ;
-    else {    
-      fgGeom = new AliEMCALGeometry(name, title) ;
-      if ( fgInit )
-       rv = (AliEMCALGeometry * ) fgGeom ;
-      else {
-       rv = 0 ; 
-       delete fgGeom ; 
-       fgGeom = 0 ; 
-      }
-    }
-  }
-  else {
-    if ( strcmp(fgGeom->GetName(), name) != 0 ) {
-      cout << "AliEMCALGeometry <E> : current geometry is " << fgGeom->GetName() << endl
-          << "                      you cannot call     " << name << endl ; 
-    }
-    else
-      rv = (AliEMCALGeometry *) fgGeom ; 
-  } 
-  return rv ; 
+//______________________________________________________________________
+AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,
+                                               const Text_t* title){
+    // Returns the pointer of the unique instance
+
+    AliEMCALGeometry * rv = 0; 
+    if ( fgGeom == 0 ) {
+       if ( strcmp(name,"") == 0 ) rv = 0;
+       else {    
+           fgGeom = new AliEMCALGeometry(name, title);
+           if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom;
+           else {
+               rv = 0; 
+               delete fgGeom; 
+               fgGeom = 0; 
+           } // end if fgInit
+       } // end if strcmp(name,"")
+    }else{
+       if ( strcmp(fgGeom->GetName(), name) != 0 ) {
+           cout << "AliEMCALGeometry <E> : current geometry is " 
+                << fgGeom->GetName() << endl
+                << "                      you cannot call     " << name 
+                << endl; 
+       }else{
+           rv = (AliEMCALGeometry *) fgGeom; 
+       } // end if
+    }  // end if fgGeom
+    return rv; 
 }
-
index b78f8ae35676c120dbad57ff8654ac2b2e5a9490..5da870e5fc92b0e1859730cc8afab963f77b67ee 100644 (file)
@@ -7,17 +7,21 @@
 
 //_________________________________________________________________________
 // Geometry class  for EMCAL : singleton
-// EMCAL consists of a shell of Pb
+// EMCAL consists of a layers of scintillator, and lead.
 //                  
-//*-- Author: Yves Schutz (SUBATECH)
-
+//*-- Author: Sahal Yacoob (LBL / UCT)
+//*--   and : Yves Schutz (Subatech)
+        
 #include <assert.h> 
 
 // --- ROOT system ---
+#include "TString.h"
+#include "TObjArray.h"
+#include "TVector3.h"
 
-class TObjArray ;  
-class TVector3; 
-class TMatrix ; 
+//class TObjArray ;  
+//class TVector3; 
+//class TMatrix ; 
 
 // --- AliRoot header files ---
 
@@ -59,21 +63,16 @@ public:
   const Float_t GetAirGap() const { return fAirGap ; }
   const Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
   const Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
-  const Float_t GetArm2PhiMin() const { return fArm2PhiMin ; }
-  const Float_t GetArm2PhiMax() const { return fArm2PhiMax ; }
+  const Float_t GetArm1ZOffset() const {return fArm1ZOffset ;}
   const Float_t GetIPDistance()   const { return  fIPDistance  ; } 
   const Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }  
   const Float_t GetShellThickness() const { return fShellThickness ; }
   const Float_t GetZLength() const { return fZLength ; } 
   const Float_t GetGap2Active() const {return  fGap2Active ; }
-  // material 
-  const Float_t GetAmat()   const { return  fAmat ; }  
-  const Float_t GetZmat()   const { return  fZmat ; }   
-  const Float_t GetDmat()   const { return  fDmat ; }  
-  const Float_t GetRmat()   const { return  fRmat ; }  
-  const Float_t GetEmat()   const { return  fEmat ; }  
-  const Float_t GetLmat()   const { return  fEmat * fRmat ; }  
-
+  const Int_t   GetNLayers() const {return fNLayers ;}
+  const Int_t   GetNZ() const {return fNZ ;}
+  const Int_t   GetNPhi() const {return fNPhi ;}
+  
 protected:
 
   AliEMCALGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) { 
@@ -91,21 +90,17 @@ private:
   Float_t fAirGap ;                  // Distance between envelop and active material 
   Float_t fArm1PhiMin ;              // Minimum phi angle covered by Arm 1 
   Float_t fArm1PhiMax ;              // Maximum phi angle covered by Arm 1       
-  Float_t fArm2PhiMin ;              // Minimum phi angle covered by Arm 2        
-  Float_t fArm2PhiMax ;              // Maximum phi angle covered by Arm 2
-  // It is assumed that Arm1 and Arm2 have the same following parameters
+  Float_t fArm1ZOffset ;             // Distance from z = 0 of Arm 1
+
+// It is assumed that Arm1 and Arm2 have the same following parameters
   Float_t fEnvelop[3] ;              // the GEANT TUB that contains the 2 arms
   Float_t fIPDistance ;              // Distance of the inner surface to the interaction point
   Float_t fShellThickness ;          // Total thickness in (x,y) direction
   Float_t fZLength ;                 // Total length in z direction
   Float_t fGap2Active ;              // Gap between the envelop and the active material
-
-  //material
-  Float_t fAmat ;  // average atomic weight of the active material
-  Float_t fZmat ;  // average atomic number of the active material 
-  Float_t fDmat ;  // average density of the active material
-  Float_t fRmat ;  // average radiation length of the active material
-  Float_t fEmat ;  // thickness of the active material in radiation length units
+  Int_t fNLayers ;                  // Number of layers of material in the R direction
+  Int_t fNZ ;                      // Number of Towers in the Z direction
+  Int_t fNPhi ;                    //Number of Towers in the Phi Direction
  
   ClassDef(AliEMCALGeometry,1)       // EMCAL geometry class 
 
diff --git a/EMCAL/AliEMCALHit.cxx b/EMCAL/AliEMCALHit.cxx
new file mode 100644 (file)
index 0000000..5616adf
--- /dev/null
@@ -0,0 +1,119 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: */
+
+//_________________________________________________________________________
+//  Hits class for EMCAL    
+//  A hit in EMCAL is the sum of all hits in a single crystal
+//               
+//*-- Author: Sahal Yacoob (LBL / UCT)
+// Based on AliPHOSHit
+
+// --- Standard library ---
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <strstream.h>
+#include <iostream.h>
+
+// --- ROOT system ---
+#include <TLorentzVector.h>
+
+// --- AliRoot header files ---
+#include "AliEMCALHit.h"
+#include "AliRun.h"
+#include "AliConst.h"
+
+
+ClassImp(AliEMCALHit)
+
+//______________________________________________________________________
+AliEMCALHit::AliEMCALHit(){
+    // Default ctor
+   
+    fId      = 0;
+    fELOS    = 0.0;
+    fPrimary = 0;
+    fTrack   = 0;
+    fX       = 0.0;
+    fY       = 0.0;
+    fZ       = 0.0;
+    fP       = 0.0;
+}
+//______________________________________________________________________
+AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit){
+    // copy ctor
+   
+    fId      = hit.fId ; 
+    fELOS    = hit.fELOS ;
+    fPrimary = hit.fPrimary ; 
+    fTrack   = hit.fTrack ; 
+    fX       = hit.fX;
+    fY       = hit.fY;
+    fZ       = hit.fZ;
+    fP       = hit.fP;
+}
+//______________________________________________________________________
+AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t id,
+                        Float_t *hits,TLorentzVector *p):AliHit(shunt, track){
+    //
+    // Create a CPV hit object
+    //
+
+    fX          = hits[0];
+    fY          = hits[1];
+    fZ          = hits[2];
+    fId         = id;
+    fELOS       = hits[3];
+    fPrimary    = primary;
+    fP          = *p;
+}
+//______________________________________________________________________
+Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{ 
+    // Two hits are identical if they have the same Id and originat
+    // from the same primary
+    Bool_t rv = kFALSE;
+
+    if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary()) )
+       rv = kTRUE;
+
+    return rv;
+}
+//______________________________________________________________________
+AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
+    // Add the energy of the hit
+
+    fELOS += rValue.GetEnergy() ;
+
+    return *this;
+
+}
+//______________________________________________________________________
+ostream& operator << (ostream& out,AliEMCALHit& hit){
+    // Print out Id and energy
+
+    out << "AliEMCALHit:";
+    out << "id=" <<  hit.GetId();
+    out << ", Eloss=" <<  hit.GetEnergy();
+    out << "GeV , Track no.=" << hit.GetPrimary();
+    out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
+    out << ", fTrack=" << hit.GetTrack();
+    out << ", P=(" << hit.GetP().Px() << "," << hit.GetP().Py() <<","
+                   << hit.GetP().Pz() << "," << hit.GetP().E();
+    out << endl;
+
+    return out;
+}
diff --git a/EMCAL/AliEMCALHit.h b/EMCAL/AliEMCALHit.h
new file mode 100644 (file)
index 0000000..a415de8
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef ALIEMCALHIT_H
+#define ALIEMCALHIT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: */
+
+//_________________________________________________________________________
+//  Hits class for EMCAL    
+//  A hit in EMCAL is the sum of all hits from the same primary
+//  in the same segment of scintillator. 
+//               
+//*-- Author: Sahal Yacoob (LBL /UCT) 
+// Based on AliPHOSHit
+#include <TLorentzVector.h>
+// --- AliRoot header files ---
+#include "AliHit.h"
+
+class ostream;
+
+class AliEMCALHit : public AliHit {
+    friend ostream& operator << (ostream&,AliEMCALHit&);
+ public:
+    AliEMCALHit(); // default ctor
+    AliEMCALHit(const AliEMCALHit & hit);
+    AliEMCALHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t id,
+               Float_t *hits,TLorentzVector *p);
+    virtual ~AliEMCALHit(void) {}// dtor
+    //returns the energy loss for this hit
+    Float_t GetEnergy(void) const{return fELOS;}
+    // return the identificator of this his
+    Int_t   GetId(void) const { return fId;}
+    // returns the primary particle id at the origine of this hit 
+    Int_t   GetPrimary(void) const{return fPrimary;}
+    // returns the energy/momentum LorentzVector of the enetering particle.
+    TLorentzVector& GetP(void) {return fP;}
+    Bool_t operator == (AliEMCALHit const &rValue) const;
+    AliEMCALHit operator + (const AliEMCALHit& rValue);
+
+ private:
+    Int_t          fId;        // Absolute Id number EMCAL segment
+    Float_t        fELOS;      // Energy deposited
+    Int_t          fPrimary;   // Primary particles at the origine of the hit
+    TLorentzVector fP;         // Primary partical enetrence momentum/energy
+
+    ClassDef(AliEMCALHit,1)  // Hit for EMCAL
+
+};
+#endif // ALIEMCALHIT_H
diff --git a/EMCAL/AliEMCALLinkDef.h b/EMCAL/AliEMCALLinkDef.h
new file mode 100644 (file)
index 0000000..c43a0e7
--- /dev/null
@@ -0,0 +1,12 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliEMCAL+;
+#pragma link C++ class AliEMCALGeometry+;
+#pragma link C++ class AliEMCALv0+;
+
+#endif
+
index 2152e65bc3c51cc422023095f8eed5c1e83b789b..a8f75449d7c9a0bd647b46b0a5f01a07b48fd13e 100644 (file)
 // It is the one to use if you do not want to produce outputs in TREEH or TREED
 //                  
 //*-- Author: Yves Schutz (SUBATECH)
-
+//*-- and   : Sahal Yacoob (LBL / UCT)
 
 // --- ROOT system ---
-
+#include "TPGON.h"
 #include "TTUBS.h"
 #include "TNode.h"
 #include "TRandom.h"
 
 // --- Standard library ---
 
-#include <iostream.h> 
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <strstream.h>
+#include <iostream.h>
 
 // --- AliRoot header files ---
 
 #include "AliEMCALv0.h"
 #include "AliEMCALGeometry.h"
+#include "AliConst.h"
 #include "AliRun.h"
 #include "AliMC.h"
 
 ClassImp(AliEMCALv0)
 
-//____________________________________________________________________________
+//______________________________________________________________________
 AliEMCALv0::AliEMCALv0(const char *name, const char *title):
-  AliEMCAL(name,title)
-{
-  // ctor/* $Id$ */
-
-  cout << " $Id$ " << endl ; 
+    AliEMCAL(name,title){
+    // Standard Constructor
 
+    if (strcmp(GetTitle(),"") != 0 )
+       fGeom =  AliEMCALGeometry::GetInstance(GetTitle(), "") ;
 }
+//______________________________________________________________________
+void AliEMCALv0::BuildGeometry(){
+    // Display Geometry for display.C
 
-//____________________________________________________________________________
-void AliEMCALv0::BuildGeometry()
-{
-
-  const Int_t kColorEmcal   = kGreen ;
-  const Int_t kColorArm1    = kBlue ;
-  const Int_t kColorArm2    = kBlue ;
-  const Int_t kColorArm1Active   = kRed ;
-  const Int_t kColorArm2Active   = kRed ;
-
-  // make the container of entire calorimeter
+    const Int_t kColorArm1   = kBlue ;
 
-  new TTUBS("EMCAL", "Tubs that contains the calorimeter", "void", 
-           fGeom->GetEnvelop(0),     // rmin 
-           fGeom->GetEnvelop(1),     // rmax
-           fGeom->GetEnvelop(2)/2.0, // half length in Z
-           0., 
-           360.
-           ) ; 
-
-  // make the container of  Arm1
-  
-  new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
-           fGeom->GetEnvelop(0),     // rmin 
-           fGeom->GetEnvelop(1),     // rmax
-           fGeom->GetEnvelop(2)/2.0, // half length in Z
-           fGeom->GetArm1PhiMin(),   // minimun phi angle
-           fGeom->GetArm1PhiMax()    // maximun phi angle
-           ) ; 
-   // Active material of  Arm1
-  new TTUBS("Arm1", "Active material of  arm 1", "void", 
-           fGeom->GetEnvelop(0) + fGeom->GetGap2Active(),                   // rmin 
-           fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax 
-           fGeom->GetEnvelop(2)/2.0, // half length in Z
-           fGeom->GetArm1PhiMin(),   // minimun phi angle
-           fGeom->GetArm1PhiMax()    // maximun phi angle
-           ) ; 
-  // make the container of  Arm2
-  new TTUBS("Envelop2", "Tubs that contains arm 2", "void", 
-           fGeom->GetEnvelop(0),     // rmin 
-           fGeom->GetEnvelop(1),     // rmax
-           fGeom->GetEnvelop(2)/2.0, // half length in Z
-           fGeom->GetArm2PhiMin(),   // minimun phi angle
-           fGeom->GetArm2PhiMax()    // maximun phi angle
-           ) ;
-          
-  // Active material of  Arm2
-  new TTUBS("Arm2", "Active material of  arm 2", "void", 
-           fGeom->GetEnvelop(0) + fGeom->GetGap2Active(),                   // rmin 
-           fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax 
-           fGeom->GetEnvelop(2)/2.0, // half length in Z
-           fGeom->GetArm2PhiMin(),   // minimun phi angle
-           fGeom->GetArm2PhiMax()    // maximun phi angle
-           ) ;
-
-  TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
-  top->cd();
-  
-  // Calorimeter inside alice 
-  TNode * emcanode = new TNode("EMCAL", "EMCAL Envelop", "EMCAL") ;
-  emcanode->SetLineColor(kColorEmcal) ;
-  fNodes->Add(emcanode) ;
-
-  // Arm 1 inside Calorimeter
-  emcanode->cd(); 
-  TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
-  envelop1node->SetLineColor(kColorArm1) ;
-  fNodes->Add(envelop1node) ;
-
-  // Arm 2 inside alice
-  TNode * envelop2node = new TNode("Envelop2", "Arm2 Envelop", "Envelop2") ;
-  envelop2node->SetLineColor(kColorArm2) ;
-  fNodes->Add(envelop2node) ;
-
-  // active material inside Arm 1
-  envelop1node->cd() ; 
-  TNode * arm1node = new TNode("Arm1", "Arm1 with Mat", "Arm1") ;
-  arm1node->SetLineColor(kColorArm1Active) ;
-  fNodes->Add(arm1node) ; 
-
-  // active material inside Arm 2
-  envelop2node->cd() ; 
-  TNode * arm2node = new TNode("Arm2", "Arm2 with Mat", "Arm2") ;
-  arm2node->SetLineColor(kColorArm2Active) ;
-  fNodes->Add(arm2node) ; 
+    // make the container of  Arm1
   
+    new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
+             fGeom->GetEnvelop(0),     // rmin 
+             fGeom->GetEnvelop(1) +30 ,     // rmax
+             fGeom->GetEnvelop(2)/2.0, // half length in Z
+             fGeom->GetArm1PhiMin(),   // minimun phi angle
+             fGeom->GetArm1PhiMax()    // maximun phi angle
+       );
+    // Arm 1 inside alice
+    TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
+    envelop1node->SetLineColor(kColorArm1) ;
+    fNodes->Add(envelop1node) ;
 }
+//______________________________________________________________________
+void AliEMCALv0::CreateGeometry(){
+    // Create the EMCAL geometry for Geant
 
-//____________________________________________________________________________
-void AliEMCALv0::CreateGeometry()
-{
-  // Create the EMCAL geometry for Geant
-
-  AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ;
-
-  if ( emcaltmp == NULL ) {
-    
-    fprintf(stderr, "EMCAL detector not found!\n") ;
-    return;
-    
-  }
-  // Get pointer to the array containing media indices
-  Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
-
-  // Create the EMCA volume that contains entirely EMCAL
-
-  Float_t envelopA[5] ; 
-  envelopA[0] = fGeom->GetEnvelop(0) ;         // rmin
-  envelopA[1] = fGeom->GetEnvelop(1) ;         // rmax
-  envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ;   // dz
-  envelopA[3] = 0. ;      
-  envelopA[4] = 360.;      
-
-  gMC->Gsvolu("EMCA", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
-
-  // Create tube sectors that contains Arm 1 & 2 
-  envelopA[3] = fGeom->GetArm1PhiMin() ;       // minimun phi angle
-  envelopA[4] = fGeom->GetArm1PhiMax() ;       // maximun phi angle
-
-  gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
+    AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ;
 
-  envelopA[3] = fGeom->GetArm2PhiMin() ;       // minimun phi angle
-  envelopA[4] = fGeom->GetArm2PhiMax() ;       // maximun phi angle
-  
-  gMC->Gsvolu("XEN2", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
-
-  // Create a tube sector that contains active material Arm 1 & 2 
-
-  envelopA[0] = fGeom->GetEnvelop(0) +  fGeom->GetGap2Active() ;
-  envelopA[1] = envelopA[0] + fGeom->GetLmat() ;
-  envelopA[3] = fGeom->GetArm1PhiMin() ;       // minimun phi angle
-  envelopA[4] = fGeom->GetArm1PhiMax() ;       // maximun phi angle
+    if ( emcaltmp == NULL ) {
+       Warning("CreateGeometry","detector not found!");
+       return;
+    } // end if
+    // Get pointer to the array containing media indices
+    Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
 
-  gMC->Gsvolu("XAR1", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
-
-  envelopA[3] = fGeom->GetArm2PhiMin() ;       // minimun phi angle
-  envelopA[4] = fGeom->GetArm2PhiMax() ;       // maximun phi angle
+    // Create tube sectors that contains Arm 1 & 2 
  
-  gMC->Gsvolu("XAR2", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
-  
-  Int_t idrotm = 1;
-  AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
-
-  // Position Calorimeter in ALICE
-  gMC->Gspos("EMCA", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-
-  // Position  ENV1 container in EMCA
-  gMC->Gspos("XEN1", 1, "EMCA", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-  
-  // Position  ARM1  into ENV1
-  gMC->Gspos("XAR1", 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-
-  // Position  ENV2 container in ALIC  
-  gMC->Gspos("XEN2", 1, "EMCA", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-
-  // Position  ARM2  into ENV2
-  gMC->Gspos("XAR2", 1, "XEN2", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-  
+    Float_t envelopA[5] ; 
+    envelopA[0] = fGeom->GetEnvelop(0) ;         // rmin
+    envelopA[1] = fGeom->GetEnvelop(1) + 30 ;    // rmax
+    envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ;   // dz
+    envelopA[3] = fGeom->GetArm1PhiMin() ;       // minimun phi angle
+    envelopA[4] = fGeom->GetArm1PhiMax() ;       // maximun phi angle
+
+    gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
+
+    // Create a tube sector that contains active material Arm 1 & 2
+
+    Float_t envelopB[10];
+    Float_t envelopC[10];
+    Float_t envelopD[10];
+    envelopC[0] = envelopD[0] =  envelopB[0] = fGeom->GetArm1PhiMin();
+    envelopC[1] = envelopD[1] =  envelopB[1] = fGeom->GetArm1PhiMax() -
+                                              fGeom->GetArm1PhiMin();
+    envelopC[2] = envelopD[2] =  envelopB[2] = fGeom->GetNPhi() ;       
+    envelopD[3] = 2;
+    envelopC[3] = 2;
+    envelopB[3] = 2;
+
+    envelopB[4] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + 1.59) /
+                  (tan(2*atan(exp(-0.7)))) ;
+    envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin
+    envelopD[6] = envelopB[6] = envelopB[5] + 3.18;  //rmax
+    envelopB[7] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active()+ 1.59) /
+                 (tan(2*atan(exp(0.7)))) ;
+    envelopB[8] = envelopB[5] ;
+    envelopB[9] = envelopB[6] ;
+
+    // filled with active material (average)
+    gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
+    // filled with active material (Polystyrene)
+    gMC->Gsvolu("XPST", "PGON", idtmed[1601], 0, 0) ;
+    gMC->Gsvolu("XPBX", "PGON", idtmed[1600], 0, 0) ; // filled with Lead
+    gMC->Gsdvn("XPHI", "XPST", fGeom->GetNPhi(), 2) ; // Naming Phi divisions
+
+    Int_t idrotm = 1;
+    AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
+
+    // Position  ENV1 container in ALIC
+    gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
+    // Position  ARM1  into ENV1
+    gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "MANY") ;
+
+    for (int i = 0; i < (fGeom->GetNLayers()); i++ ){
+       envelopC[5] = envelopD[6] ; //rmin
+       envelopC[6] = envelopD[6] + ((i > +2)  ? 0.5 : 0.6)  ;  //rmax
+       envelopC[8] = envelopD[6] ; //rmin
+       envelopC[9] = envelopD[6] + ((i > 2 ) ? 0.5 : 0.6)  ;  //rmax
+       for (int j =0; j < (fGeom->GetNZ()) ; j++){
+           envelopC[4] = envelopD[6]/tan(2*atan(exp(0.7-(j*1.4/
+                                                      (fGeom->GetNZ())))));  
+           envelopC[7] = envelopD[6]/tan(2*atan(exp(0.7-((j+1)*1.4/
+                                                      (fGeom->GetNZ())))));  
+           gMC->Gsposp("XPST",1+j+i*(fGeom->GetNZ()), "XEN1",
+                       0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10);
+       } // end for j
+       if (i < (fGeom->GetNLayers()-1)){
+           envelopD[5] = envelopC[6] ; //rmin
+           envelopD[6] = envelopC[6] + 0.5;  //rmax
+           envelopD[8] = envelopC[6] ; //rmin
+           envelopD[9] = envelopC[6] + 0.5;  //rmax
+           for (int j =0; j < (fGeom->GetNZ()) ; j++){
+               envelopD[4] = envelopC[6]/tan(2*atan(exp(0.7-(j*1.4/
+                                                       (fGeom->GetNZ())))));  
+               envelopD[7] = envelopC[6]/tan(2*atan(exp(0.7-((j+1)*1.4/
+                                                        (fGeom->GetNZ())))));
+               gMC->Gsposp("XPBX",1+ j+i*(fGeom->GetNZ()), "XEN1", 
+                           0.0, 0.0, 0.0 , idrotm, "MANY", envelopD, 10) ;
+           } // end for j
+       } // end if i
+    } // for i
 }
-
-//____________________________________________________________________________
-void AliEMCALv0::Init(void)
-{
-  // Just prints an information message
-  
-  Int_t i;
-
-  printf("\n");
-  for(i=0;i<35;i++) printf("*");
-  printf(" EMCAL_INIT ");
-  for(i=0;i<35;i++) printf("*");
-  printf("\n");
-
-  // Here the EMCAL initialisation code (if any!)
-
-  if (fGeom!=0)  
-    cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for " << fGeom->GetName() << endl ;
-  else
-    cout << "AliEMCAL" << Version() << " : EMCAL geometry initialization failed !" << endl ;   
-  
-  for(i=0;i<80;i++) printf("*");
-  printf("\n");
-  
+//______________________________________________________________________
+void AliEMCALv0::Init(void){
+    // Just prints an information message
+    Int_t i;
+
+    cout << endl;
+    for(i=0;i<35;i++) cout <<"*";
+    cout << " EMCAL_INIT ";
+    for(i=0;i<35;i++) cout << "*";
+    cout << endl;
+
+    // Here the EMCAL initialisation code (if any!)
+
+    if (fGeom!=0)  
+       cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for "
+            << fGeom->GetName() << endl ;
+    else
+       cout << "AliEMCAL" << Version() << 
+           " : EMCAL geometry initialization failed !" << endl ;
+    for(i=0;i<80;i++) printf("*");
+    cout << endl;
 }
-
index 16c8aed92e35adfff6697d697d514de456d03252..e1297b3741a21ce5c31209aca32337cf782d0520 100644 (file)
@@ -9,30 +9,45 @@
 // Implementation version v0 of EMCAL Manager class 
 //*--                  
 //*-- Author: Yves Schutz (SUBATECH)
-
-#include <assert.h>
+//*-- and   : Sahal Yacoob (LBL / UCT) 
+//#include <assert.h>
 
 // --- ROOT system ---
 
+class TFile;
+
 // --- AliRoot header files ---
 #include "AliEMCAL.h"
-class AliEMCALGeometry ; 
+
+//class AliEMCALGeometry ; 
 
 class AliEMCALv0 : public AliEMCAL {
 
  public:
 
-  AliEMCALv0() {fGeom=0;}
+  AliEMCALv0():AliEMCAL() {}
   AliEMCALv0(const char *name, const char *title="") ;
   AliEMCALv0(const AliEMCALv0 & emcal) {
     // cpy ctor: no implementation yet
     // requested by the Coding Convention
-    assert(0==1) ; 
+    abort() ; 
   } 
-  virtual ~AliEMCALv0(void){} 
+  virtual ~AliEMCALv0(){} 
+
+  virtual void  AddHit( Int_t shunt, Int_t primary, Int_t track, 
+                       Int_t id, Float_t *hits ) {
+    // no hits - useless
+  }
+
+  virtual void BuildGeometry();// creates the geometry for the ROOT display
+  virtual void CreateGeometry() ;// creates the geometry for GEANT
+
+  virtual AliEMCALGeometry * GetGeometry() {
+    // gets the pointer to the AliEMCALGeometry unique instance
+    return fGeom ;
+  }
+
 
-  virtual void   BuildGeometry(void) ;             // creates the geometry for the ROOT display
-  virtual void   CreateGeometry(void) ;            // creates the geometry for GEANT
 
   virtual void   Init(void) ;                                       // does nothing
   virtual Int_t  IsVersion(void) const { 
@@ -46,12 +61,12 @@ class AliEMCALv0 : public AliEMCAL {
   
   AliEMCALv0 & operator = (const AliEMCALv0 & rvalue)  {
     // assignement operator requested by coding convention but not needed
-    assert(0==1) ;
+    abort() ;
     return *this ; 
   }
   
  protected:
-    
+
   ClassDef(AliEMCALv0,1)  // Implementation of EMCAL manager class for layout EMC+PPSD
     
     };
diff --git a/EMCAL/AliEMCALv1.cxx b/EMCAL/AliEMCALv1.cxx
new file mode 100644 (file)
index 0000000..ba5cddc
--- /dev/null
@@ -0,0 +1,144 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Implementation version v1 of EMCAL Manager class 
+// An object of this class does not produce digits
+// It is the one to use if you do want to produce outputs in TREEH 
+//                  
+//*-- Author: Sahal Yacoob (LBL /UCT)
+//*--       : Jennifer Klay (LBL)
+
+
+// --- ROOT system ---
+#include "TPGON.h"
+#include "TTUBS.h"
+#include "TNode.h"
+#include "TRandom.h"
+#include "TTree.h"
+#include "TGeometry.h"
+
+
+// --- Standard library ---
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <strstream.h>
+#include <iostream.h>
+#include <math.h>
+// --- AliRoot header files ---
+
+#include "AliEMCALv1.h"
+#include "AliEMCALHit.h"
+#include "AliEMCALGeometry.h"
+#include "AliConst.h"
+#include "AliRun.h"
+#include "AliMC.h"
+
+ClassImp(AliEMCALv1)
+
+
+//______________________________________________________________________
+AliEMCALv1::AliEMCALv1():AliEMCALv0(){
+  // ctor
+}
+//______________________________________________________________________
+AliEMCALv1::AliEMCALv1(const char *name, const char *title):
+    AliEMCALv0(name,title){
+    // Standard Creator.
+
+    fHits= new TClonesArray("AliEMCALHit",1000);
+    gAlice->AddHitList(fHits);
+
+    fNhits = 0;
+
+    fIshunt     =  1; // All hits are associated with primary particles
+}
+//______________________________________________________________________
+AliEMCALv1::~AliEMCALv1(){
+    // dtor
+
+    if ( fHits) {
+       fHits->Delete();
+       delete fHits;
+       fHits = 0;
+    }
+}
+//______________________________________________________________________
+void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, 
+                       Int_t id, Float_t * hits,TLorentzVector *p){
+    // Add a hit to the hit list.
+    // A PHOS hit is the sum of all hits in a single crystal
+    //   or in a single PPSD gas cell
+    Int_t hitCounter;
+    
+    AliEMCALHit *newHit;
+    AliEMCALHit *curHit;
+    Bool_t deja = kFALSE;
+
+    newHit = new AliEMCALHit(shunt, primary, tracknumber, id, hits, p);
+
+    for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) {
+       curHit = (AliEMCALHit*) (*fHits)[hitCounter];
+       // We add hits with the same primary, while GEANT treats
+       // primaries succesively
+       if(curHit->GetPrimary() != primary) break;
+       if( *curHit == *newHit ) {
+           *curHit = *curHit + *newHit;
+           deja = kTRUE;
+       } // end if
+    } // end for hitCounter
+
+    if ( !deja ) {
+       new((*fHits)[fNhits]) AliEMCALHit(*newHit);
+       fNhits++;
+    } // end if
+
+    delete newHit;
+}
+//______________________________________________________________________
+void AliEMCALv1::StepManager(void){
+    // Accumulates hits as long as the track stays in a single
+    // crystal or PPSD gas Cell
+    Int_t          id[2];           // (layer, phi, Eta) indices
+    Int_t          absid;
+    // position wrt MRS and energy deposited
+    Float_t        xyze[4]={0.,0.,0.,0.};
+    TLorentzVector pos; // Lorentz vector of the track current position.
+    TLorentzVector mom; // Lorentz vector of the track current momentum.
+    Int_t tracknumber =  gAlice->CurrentTrack();
+    static Int_t primary;
+
+    gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
+    gMC->CurrentVolID(id[1]); // get the phi number inside the layer
+    primary = gAlice->GetPrimary(tracknumber);
+    if(gMC->IsTrackEntering()&&id[0]==1) primary = tracknumber;
+//    tracknumber = primary;
+    gMC->TrackPosition(pos);
+    gMC->TrackMomentum(mom);
+    xyze[0] = pos[0];
+    xyze[1] = pos[1];
+    xyze[2] = pos[2];
+    xyze[3] = gMC->Edep();
+
+    if(xyze[3] > 0.){// Track is inside the crystal and deposits some energy
+       absid = (id[0]-1)*(fGeom->GetNPhi()) + id[1];
+       AddHit(fIshunt, primary,tracknumber, absid, xyze, &mom);
+    } // there is deposited energy
+
+}
diff --git a/EMCAL/AliEMCALv1.h b/EMCAL/AliEMCALv1.h
new file mode 100644 (file)
index 0000000..1e94de2
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALIEMCALV1_H
+#define ALIEMCALV1_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                      
+         */
+/* $Id$ */
+
+//_________________________________________________________________________
+// Implementation version v1 of EMCAL Manager class 
+//*--                  
+//*-- Author: Sahal Yacoob (LBL / UCT) 
+//*--  and  : Jennifer Klay
+//#include <assert.h>
+
+// --- ROOT system ---
+class TClonesArray;
+class TLorentzVector;
+class TFile;
+
+// --- AliRoot header files ---
+#include "AliEMCALv0.h"
+
+class AliEMCALv1 : public AliEMCALv0 {
+ public:
+    AliEMCALv1(void) ; 
+    AliEMCALv1(const char *name, const char *title="") ;
+    // cpy ctor: no implementation yet
+    // requested by the Coding Convention
+    AliEMCALv1(const AliEMCALv0 & emcal) {abort();}
+    virtual ~AliEMCALv1(void) ;
+    virtual void  AddHit( Int_t shunt, Int_t primary, Int_t track,
+                         Int_t id, Float_t *hits, TLorentzVector *p);
+    // Gives the version number 
+    virtual Int_t  IsVersion(void) const {return 1;}
+    virtual void StepManager(void) ;
+    virtual TString Version(void){return TString("v0");}
+    // assignement operator requested by coding convention but not needed  
+    AliEMCALv1 & operator = (const AliEMCALv0 & rvalue){abort();return *this;}
+  
+ protected:
+    ClassDef(AliEMCALv1,1)//Implementation of EMCAL manager class for layout EMC+PPSD
+
+};
+#endif // AliEMCALV1_H
index 836c8b3a7ed319b02d2f78c6d7969d95d746a3ab..ad897608ebd92ebc6cc18b33947260f8d0520e8f 100644 (file)
@@ -7,5 +7,6 @@
 #pragma link C++ class AliEMCAL+;
 #pragma link C++ class AliEMCALGeometry+; 
 #pragma link C++ class AliEMCALv0+;
-
+#pragma link C++ class AliEMCALv1+;
+#pragma link C++ class AliEMCALHit+;
 #endif
index 0341f8db7c6ad300ae0c29cfca1893dd60c508cd..3913ac2baa2f4ab405052e2569302719f5fad09e 100644 (file)
@@ -9,7 +9,8 @@ PACKAGE = EMCAL
 
 # C++ sources
 
-SRCS          =  AliEMCAL.cxx  AliEMCALGeometry.cxx AliEMCALv0.cxx 
+SRCS          =  AliEMCAL.cxx  AliEMCALGeometry.cxx AliEMCALv0.cxx \
+                AliEMCALv1.cxx AliEMCALHit.cxx
 
 # C++ Headers
 
index 1b8bb7f7cbd187e14db630dc6e58c958c3628969..8647874cc64bf18cd2ff4c1244118f1faf43742d 100644 (file)
@@ -1,11 +1,15 @@
 SRCS= \
 AliEMCAL.cxx  \
 AliEMCALGeometry.cxx \
-AliEMCALv0.cxx 
+AliEMCALHit.cxx \
+AliEMCALv0.cxx \
+AliEMCALv1.cxx
 
 HDRS= \
 AliEMCAL.h  \
 AliEMCALGeometry.h \
-AliEMCALv0.h 
+AliEMCALHit.h \
+AliEMCALv0.h \
+AliEMCALv1.h 
 
 DHDR:=EMCALLinkDef.h