This update is a step in the continuous development of EMCAL.
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Dec 2001 16:05:55 +0000 (16:05 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Dec 2001 16:05:55 +0000 (16:05 +0000)
20 files changed:
EMCAL/AliEMCAL.cxx
EMCAL/AliEMCAL.h
EMCAL/AliEMCALDigit.cxx
EMCAL/AliEMCALDigit.h
EMCAL/AliEMCALDigitizer.cxx
EMCAL/AliEMCALDigitizer.h
EMCAL/AliEMCALGeometry.cxx
EMCAL/AliEMCALGeometry.h
EMCAL/AliEMCALGetter.cxx [new file with mode: 0644]
EMCAL/AliEMCALGetter.h [new file with mode: 0644]
EMCAL/AliEMCALHit.cxx
EMCAL/AliEMCALHit.h
EMCAL/AliEMCALSDigitizer.cxx
EMCAL/AliEMCALSDigitizer.h
EMCAL/AliEMCALv0.cxx
EMCAL/AliEMCALv0.h
EMCAL/AliEMCALv1.cxx
EMCAL/AliEMCALv1.h
EMCAL/EMCALLinkDef.h
EMCAL/Makefile

index cda534cd451283032acbd43f225225a378e8ba6d..bc3a9238b7cb6f3e264283506cc3b858d18a3fba 100644 (file)
@@ -17,8 +17,8 @@
 
 //_________________________________________________________________________
 // Base Class for EMCAL description:
-//    
-// 
+// This class contains material definitions    
+// for the EMCAL - It does not place the detector in Alice
 //*-- Author: Yves Schutz (SUBATECH) 
 //
 //*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
@@ -123,23 +123,20 @@ void AliEMCAL::CreateMaterials(){
 // --- 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[1600],"CUTGAM",0.00008) ;
+  gMC->Gstpar(idtmed[1600],"CUTELE",0.001) ;
+  gMC->Gstpar(idtmed[1600],"BCUTE",0.0001) ;
 
   // --- Generate explicitly delta rays in Lead ---
   gMC->Gstpar(idtmed[1600], "LOSS",3.) ;
   gMC->Gstpar(idtmed[1600], "DRAY",1.) ;
  
-  gMC->Gstpar(idtmed[1600],"CUTGAM",0.00008) ;
-  gMC->Gstpar(idtmed[1600],"CUTELE",0.001) ;
-  gMC->Gstpar(idtmed[1600],"BCUTE",0.0001) ;
-
 // --- and in aluminium parts ---
   gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
   gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
 
 
-// --- and finally in the scintillator ---
+// --- and finally thresholds for photons and electrons in the scintillator ---
   gMC->Gstpar(idtmed[1601],"CUTGAM",0.00008) ;
   gMC->Gstpar(idtmed[1601],"CUTELE",0.001) ;
   gMC->Gstpar(idtmed[1601],"BCUTE",0.0001) ;
index 1be224da3842773f789b4bfcd28e536c223c8091..467938d7345242da09f3ebbcb676b10e964d9ceb 100644 (file)
@@ -43,7 +43,7 @@ class AliEMCAL : public AliDetector {
 
 
   virtual void   CreateMaterials() ;                     
-  virtual AliEMCALGeometry * GetGeometry()  = 0 ;   
+  //virtual AliEMCALGeometry * GetGeometry()  = 0 ;   
   Int_t   IsVersion(void) const { return -1 ; } 
   virtual void  SetTreeAddress() ;               
   virtual TString Version() {return TString(" ") ; }  
index 49ecc78f3cb4bef985a27306aa8649492f5e811c..54e3819bef1a51047729a029753de881ca2407a0 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
+/* $Id */
 
 //_________________________________________________________________________
-//  EMCAL digit: Id
-//              energy
-//              3 identifiers for the primary particle(s) at the origine of the digit
-//  The digits are made in FinishEvent() by summing all the hits in a single EMCAL crystal or PPSD gas cell
-//  It would be nice to replace the 3 identifiers by an array, but, because digits are kept in a TClonesQArray,
-//   it is not possible to stream such an array... (beyond my understqnding!)
+//  EMCAL digit: 
+//      A Digit is the sum of the energy lost in an EMCAL Tower
+//      It also stores information on Primary, and enterring particle
+//      tracknumbers Digits are created using AliEMCALSDigitizer, followed
+//      by AliEMCALDigitizer 
 //
-//*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH)
+//*-- Author: Sahal Yacoob (LBL)
+// based on : AliPHOSDigit
+//__________________________________________________________________________ 
 
 
 // --- ROOT system ---
index 439f8e32c5a305d8c77853438a2010d39d40db6c..f7c58b9876134e16edcc0fb1dcec881744ae1716 100644 (file)
@@ -6,14 +6,14 @@
 /* $Id$ */
 
 //_________________________________________________________________________
-//  EMCAL digit: Id
-//              energy
-//              3 identifiers for the primary particle(s) at the origine of the digit
-//  The digits are made in FinishEvent() by summing all the hits in a single EMCAL crystal or PPSD gas cell
-//  It would be nice to replace the 3 identifiers by an array, but, because digits are kept in a TClonesQArray,
-//   it is not possible to stream such an array... (beyond my understqnding!)
+//  EMCAL digit: 
+// 
+//  A  Digit is the sum of energy in a Tower (Hit sum) and stores information, about primaries
+//  and enterring particle contributing to a Digit
 //
-//*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH)
+//*-- Author: Sahal Yacoob (LBL)
+// based on : AliPHOSDigit
+//___________________________________________________________________________
 
 // --- ROOT system ---
 
@@ -51,7 +51,7 @@ class AliEMCALDigit : public AliDigitNew {
     return kTRUE ; }
   void    SetAmp(Int_t Amp) { 
     // sets the amplitude data member 
-    fAmp=Amp ; } 
+    fAmp= Amp ; } 
   void ShiftPrimary(Int_t shift); // shift to semarate different TreeK in merging
   
  private:
index 4a3c71cb81556e3fc28633e1206a35c53997ce90..21dd58d9d8ebeed28849b9fa0f05a1082b0882b6 100644 (file)
 /* $Id$ */
 
 //_________________________________________________________________________
-//*-- Author :  Dmitri Peressounko (SUBATECH & Kurchatov Institute) 
+// 
 //////////////////////////////////////////////////////////////////////////////
-// Class performs digitization of Summable digits (in the EMCAL case this is just
-// sum of contributions of all primary particles into given cell). 
+// Class performs digitization of Summable digits 
+//  
 // In addition it performs mixing of summable digits from different events.
 //
 // For each event two branches are created in TreeD:
 //                       // deb - prints number of produced digits
 //                       // deb all - prints list of produced digits
 //                       // timing  - prints time used for digitization
+////////////////////////////////////////////////////////////////////////////////////
 //
+//*-- Author: Sahal Yacoob (LBL)
+// based on : AliPHOSDigitizer
+//_________________________________________________________________________________
 
 // --- ROOT system ---
 #include "TFile.h"
@@ -81,8 +85,8 @@ ClassImp(AliEMCALDigitizer)
 
   fSDigitizer = 0 ;
   fNinputs = 1 ;
-  fPinNoise = 0.01 ;
-  fEMCDigitThreshold = 0.01 ;
+  fPinNoise = 0.00 ;
+  fEMCDigitThreshold = 0.00 ;
   fInitialized = kFALSE ;
 
   fHeaderFiles = 0;
@@ -114,14 +118,14 @@ void AliEMCALDigitizer::Init(){
     file->cd() ;
     
     fSDigitsTitles = new TClonesArray("TObjString",1);
-    new((*fSDigitsTitles)[0]) TObjString("") ;   
+    new((*fSDigitsTitles)[0]) TObjString("Default") ;   
     
     fSDigits      = new TClonesArray("TClonesArray",1) ;
     new((*fSDigits)[0]) TClonesArray("AliEMCALDigit",1000) ;
 
     fSDigitizer = 0 ;
     
-    fDigitsTitle = "" ;
+    fDigitsTitle = "Default" ;
     
     fDigits = new TClonesArray("AliEMCALDigit",200000) ;
     
@@ -168,7 +172,7 @@ AliEMCALDigitizer::AliEMCALDigitizer(const char *headerFile,const char *sDigitsT
     
   fDigits = new TClonesArray("AliEMCALDigit",200000) ;
   
-  fDigitsTitle = "" ; 
+  fDigitsTitle = "Default" ; 
 
   
   fSDigitizer = 0 ;
@@ -182,8 +186,8 @@ AliEMCALDigitizer::AliEMCALDigitizer(const char *headerFile,const char *sDigitsT
   
   fNinputs = 1 ;
   
-  fPinNoise = 0.01 ;
-  fEMCDigitThreshold = 0.01 ;
+  fPinNoise = 0.0001 ;
+  fEMCDigitThreshold = 0.001 ;
   
   // add Task to //root/Tasks folder
   TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; 
@@ -258,11 +262,11 @@ void AliEMCALDigitizer::Digitize(Option_t *option) {
 
   fDigits->Clear() ;
 
-  AliEMCAL * EMCAL = (AliEMCAL *) gAlice->GetDetector("EMCAL") ;   
+  AliEMCALv0 * EMCAL = (AliEMCALv0 *) gAlice->GetDetector("EMCAL") ;   
   AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance( EMCAL->GetGeometry()->GetName(), EMCAL->GetGeometry()->GetTitle() );
 
   //Making digits with noise, first EMC
-  Int_t nEMC = geom->GetNPhi()*geom->GetNZ();
+  Int_t nEMC = 2*geom->GetNPhi()*geom->GetNZ();
   Int_t absID ;
   TString name      =  geom->GetName() ;
   
@@ -285,9 +289,10 @@ void AliEMCALDigitizer::Digitize(Option_t *option) {
     Int_t nSDigits = sdigits->GetEntries() ;     
     for(isdigit=0;isdigit< nSDigits; isdigit++){
       curSDigit = (AliEMCALDigit *)sdigits->At(isdigit) ;
-      if(inputs)                                       //Shift primaries for non-background sdigits
+     if(inputs)                                       //Shift primaries for non-background sdigits
        curSDigit->ShiftPrimary(inputs) ;
       digit = (AliEMCALDigit *)fDigits->At(curSDigit->GetId() - 1);
+     cout << curSDigit->GetAmp() << "   and   "  << digit->GetAmp() << endl ; 
       *digit = *digit + *curSDigit ;
     }  
   }
@@ -295,7 +300,7 @@ void AliEMCALDigitizer::Digitize(Option_t *option) {
 
   //remove digits below thresholds
   for(absID = 0; absID < nEMC ; absID++)
-    if(fSDigitizer->Calibrate(((AliEMCALDigit*)fDigits->At(absID))->GetAmp()) < fEMCDigitThreshold)
+   if(fSDigitizer->Calibrate(((AliEMCALDigit*)fDigits->At(absID))->GetAmp()) < fEMCDigitThreshold)
       fDigits->RemoveAt(absID) ;
   
   fDigits->Compress() ;  
@@ -310,9 +315,29 @@ void AliEMCALDigitizer::Digitize(Option_t *option) {
   for (i = 0 ; i < ndigits ; i++) { 
     AliEMCALDigit * digit = (AliEMCALDigit *) fDigits->At(i) ; 
     digit->SetIndexInList(i) ;     
+    cout << digit->GetAmp() << "is amp" << endl;    
+    Float_t energy = fSDigitizer->Calibrate(digit->GetAmp()) ;
+    cout << energy << " = energy " << endl;
+    energy = energy*1000 ;
+    cout << energy << " = energy " << endl;
+    digit->SetAmp(DigitizeEnergy(energy,digit->GetId()) ) ;
+    cout << digit->GetAmp() << "is amp" << endl;    
+    cout << 100*energy/12.9 << endl ;
   }
 }
 //____________________________________________________________________________
+
+Int_t AliEMCALDigitizer::DigitizeEnergy(Float_t energy, Int_t absId)
+ { Int_t chanel ;
+  //if(absId <= fEmcCrystals){ //digitize as EMC
+    chanel = (Int_t) TMath::Ceil(energy) ;
+    //if(chanel > fNADCemc ) chanel =  fNADCemc ;
+ // }
+  return chanel ;
+}
+//____________________________________________________________________________
+
+
 void AliEMCALDigitizer::WriteDigits(){
 
   // Made TreeD in the output file. Check if branch already exists: if yes, exits 
index cb6978c1f7fae03d54f0b53701ddbf13389ca372..3acd700932e9ab0851b5c3ecc5db156f211aebfc 100644 (file)
@@ -6,9 +6,11 @@
 /* $Id$ */
 
 //_________________________________________________________________________
-//  Task Class for making SDigits in EMCAL      
+//  Task Class for making Digits in EMCAL      
 //                  
-//*-- Author: Dmitri Peressounko(SUBATECH & KI)
+//*-- Author: Sahal Yacoob (LBL)
+// based on : AliPHOSDigit
+//_________________________________________________________________________ 
 
 
 // --- ROOT system ---
@@ -25,7 +27,7 @@ class AliEMCALDigitizer: public TTask {
 
 public:
   AliEMCALDigitizer() ;          // ctor
-  AliEMCALDigitizer(const char *headerFile,const char * sDigitsBranchTitle = 0) ; 
+  AliEMCALDigitizer(const char *headerFile,const char * sDigitsBranchTitle = "Default") ; 
   virtual ~AliEMCALDigitizer() ;       
 
   void    Digitize(Option_t *option);            // Make Digits from SDigits stored in fSDigits
@@ -38,7 +40,7 @@ public:
   char *  GetDigitsBranch ()const { return (char*)fDigitsTitle.Data() ;}
   TClonesArray * GetHeadersFiles(){ return fHeaderFiles ;}
   TArrayI*    GetCurrentEvents()  { return fIevent ;}
-
+  Int_t   DigitizeEnergy(Float_t energy, Int_t absId) ;
   void    MixWith(char* HeaderFile, char* SDigitsTitle =0) ; // Add another one file to mix
   virtual void    Print(Option_t* option)const ;
   void    Reset() ;   //restarts starts event processing from 0 event(s)
@@ -62,7 +64,7 @@ private:
   TString        fDigitsTitle ;     // Title of the Digits Branch  
   TClonesArray * fSDigits ;         // ! Lists of SDigits 
   TClonesArray * fDigits ;          // ! Final list of digits
-  AliEMCALSDigitizer * fSDigitizer ; // ! SDigitizer to extarct some sdigitizing parameters
+  AliEMCALSDigitizer * fSDigitizer ; // ! SDigitizer to extract some sdigitizing parameters
   Int_t   fNinputs ;                // Number of input files
   Bool_t  fInitialized ;            // 
   TArrayI * fIevent ;               // events to read at the next ReadSDigits() call
index 6e51537ddbe1e504c1092e013b8aa429249e7765..35b048e6905818264b42eca39f75e2265176c9f0 100644 (file)
 //_________________________________________________________________________
 // Geometry class  for EMCAL : singleton  
 // EMCAL consists of layers of scintillator and lead
-//                  
+// Places the the Barrel Geometry of The EMCAL at Midrapidity
+// between 0 and 120 degrees of Phi and
+// -0.7 to 0.7 in eta 
+// Number of Modules and Layers may be controlled by 
+// the name of the instance defined               
+// EMCALArch2x has more modules along both phi and eta
+// EMCALArchxa has less Layers in the Radial Direction
 //*-- Author: Sahal Yacoob (LBL / UCT)
 //     and  : Yves Schutz (SUBATECH)
 //     and  : Jennifer Klay (LBL)
index 5da870e5fc92b0e1859730cc8afab963f77b67ee..06a1b693a0e28be48e9910707e232105c8c1b82c 100644 (file)
@@ -63,7 +63,6 @@ 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 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 ; }
@@ -88,12 +87,11 @@ private:
 
   // geometry
   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 fArm1ZOffset ;             // Distance from z = 0 of Arm 1
+  Float_t fArm1PhiMin ;              // Minimum angular position of EMCAL in Phi (degrees)
+  Float_t fArm1PhiMax ;              // Maximum angular position of EMCAL in Phi (degrees)
 
 // 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 fEnvelop[3] ;              // the GEANT TUB for the detector 
   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
@@ -102,7 +100,7 @@ private:
   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 
+  ClassDef(AliEMCALGeometry,2)       // EMCAL geometry class 
 
 } ;
 
diff --git a/EMCAL/AliEMCALGetter.cxx b/EMCAL/AliEMCALGetter.cxx
new file mode 100644 (file)
index 0000000..bb995e0
--- /dev/null
@@ -0,0 +1,967 @@
+/**************************************************************************
+ * 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:  */
+
+/* $Log:
+*/
+
+//_________________________________________________________________________
+//  A singleton. This class should be used in the analysis stage to get 
+//  reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
+//  instead of directly reading them from galice.root file. This container 
+//  ensures, that one reads Digits, made of these particular digits, RecPoints, 
+//  made of these particular RecPoints, TrackSegments and RecParticles. 
+//  This becomes non trivial if there are several identical branches, produced with
+//  different set of parameters. Currently This class only Retrieves Hits, Digits, and SDigits. 
+//
+//  An example of how to use (see also class AliEMCALAnalyser):
+//  AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
+//     ................
+//  please->GetEvent(event) ;    // reads new event from galice.root
+//                  
+//*-- Author: Sahal Yacoob (LBL) 
+// based on : AliPHOSGetter
+//////////////////////////////////////////////////////////////////////////////
+
+
+// --- ROOT system ---
+
+#include "TFile.h"
+#include "TTree.h"
+#include "TROOT.h"
+#include "TObjString.h"
+#include "TFolder.h"
+
+// --- Standard library ---
+#include <iostream.h>
+
+// --- AliRoot header files ---
+
+#include "AliRun.h"
+#include "AliConfig.h"
+#include "AliEMCALGetter.h"
+#include "AliEMCALv1.h"
+#include "AliEMCALDigitizer.h"
+#include "AliEMCALSDigitizer.h"
+#include "AliEMCALGeometry.h"
+
+ClassImp(AliEMCALGetter)
+  
+  AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; 
+
+//____________________________________________________________________________ 
+AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle )
+{
+  //Initialize  all lists
+
+  fHeaderFile         = headerFile ; 
+  fBranchTitle        = branchTitle ;
+  fSDigitsTitle       = branchTitle ; 
+  fDigitsTitle        = branchTitle ; 
+
+  fPrimaries = new TObjArray(1) ;
+  fModuleFolder  = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
+  fHitsFolder    = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits")); 
+  fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits")); 
+  fDigitsFolder  = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data")); 
+  fTasksFolder   = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ; 
+
+  if ( fHeaderFile != "aliroot"  ) { // to call the getter without a file
+
+    //open headers file
+    TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
+    
+    if(file == 0){    //if file was not opened yet, read gAlice
+      if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
+       file =  TFile::Open(fHeaderFile.Data(),"update") ;
+      else
+       file = new TFile(fHeaderFile.Data(),"update") ;
+      
+      if (!file->IsOpen()) {
+       cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ; 
+       abort() ; 
+      }
+      
+      gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
+      
+      if (!gAlice) {
+       cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ; 
+       abort() ; 
+      }
+      if (!EMCAL()) {
+         cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ; 
+       AliConfig * conf = AliConfig::Instance() ; 
+       conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ; 
+       conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ; 
+     }
+    }
+
+  }
+}
+//____________________________________________________________________________ 
+AliEMCALGetter::~AliEMCALGetter(){
+
+}
+
+//____________________________________________________________________________ 
+void AliEMCALGetter::CreateWhiteBoard() const
+{
+
+}
+
+//____________________________________________________________________________ 
+AliEMCALGetter * AliEMCALGetter::GetInstance()
+{
+  // Returns the pointer of the unique instance already defined
+  
+  AliEMCALGetter * rv = 0 ;
+  if ( fgObjGetter )
+    rv = fgObjGetter ;
+  else
+    cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
+
+  return rv ;
+}
+
+//____________________________________________________________________________ 
+AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
+                                          const char* branchTitle)
+{
+  // Creates and returns the pointer of the unique instance
+  // Must be called only when the environment has changed 
+
+  if ( fgObjGetter )    
+    if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) && 
+       (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
+      return fgObjGetter ;
+    else
+      fgObjGetter->~AliEMCALGetter() ;  // delete it if already exists another version
+  
+  fgObjGetter = new AliEMCALGetter(headerFile,branchTitle) ; 
+  
+  // Posts a few item to the white board (folders)
+  // fgObjGetter->CreateWhiteBoard() ;
+    
+  return fgObjGetter ; 
+  
+}
+
+//____________________________________________________________________________ 
+const AliEMCALv0 * AliEMCALGetter::EMCAL() 
+{
+  // returns the EMCAL object 
+  //AliEMCALv0 * emcal = dynamic_cast<AliEMCALv0 *>(gAlice->GetDetector("EMCAL")) ; 
+  AliEMCALv0 * emcal = dynamic_cast<AliEMCALv1 *>(fModuleFolder->FindObject("EMCAL")) ;  
+  if (!emcal) 
+      cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ; 
+  return emcal ; 
+}  
+
+//____________________________________________________________________________ 
+const AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() 
+{
+  AliEMCALGeometry * rv = 0 ; 
+  if (EMCAL() )
+   rv =  EMCAL()->GetGeometry() ;
+  return rv ; 
+} 
+
+//____________________________________________________________________________ 
+Bool_t AliEMCALGetter::PostHits(void) const 
+{  //------- Hits ----------------------
+
+  // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
+  
+  TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ; 
+  if ( !emcalFolder ) {
+      cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
+      cout << "INFO:    AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/"  << endl;
+    emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ; 
+  }    
+  TClonesArray *hits=  new TClonesArray("AliEMCALHit",1000) ;
+  hits->SetName("Hits") ;
+  emcalFolder->Add(hits) ; 
+  
+  return kTRUE;
+} 
+
+//____________________________________________________________________________ 
+void * AliEMCALGetter::HitsRef(void) const 
+{  //------- Hits ----------------------
+
+  
+  // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
+  if ( !fHitsFolder ) {
+    cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
+    return 0;
+  }    
+  TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
+  if ( !emcalFolder ) {
+    cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;  
+    return 0;
+  }
+  TObject * h = emcalFolder->FindObject("Hits") ;
+  if(!h) {
+    cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ; 
+    return 0 ;
+  }
+  else
+    return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(h)) ;
+}
+
+//____________________________________________________________________________ 
+Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const 
+{  //---------- SDigits -------------------------
+
+  
+  // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
+  // because you can have sdigits from several hit files for mixing
+  
+  TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
+  if ( !emcalFolder ) {
+      cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
+      cout << "INFO:    AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
+    emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; 
+  }    
+  TString subdir(headerFile) ;
+  TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ; 
+  if ( !emcalSubFolder ) 
+    emcalSubFolder = emcalFolder->AddFolder(subdir, ""); 
+  
+  TObject * sd  = emcalSubFolder->FindObject(name); 
+  if ( sd ) {
+      cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir 
+          << " already exists!" << endl ;  
+  }else{
+    TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1000) ;
+    sdigits->SetName(name) ;
+    emcalSubFolder->Add(sdigits) ;
+  }
+  
+  return kTRUE;
+} 
+//____________________________________________________________________________ 
+void * AliEMCALGetter::SDigitsRef(const char * name, const char * file) const 
+{  //------- SDigits ----------------------
+  
+  // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
+
+  if ( !fSDigitsFolder ) {
+    cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
+    return 0;
+  }    
+  TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
+  if ( !emcalFolder ) {
+    cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
+    return 0;
+  }
+
+  TFolder * emcalSubFolder = 0 ;
+  if(file)
+    emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
+  else
+    emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
+  
+  if(!emcalSubFolder) {
+    cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
+    return 0;
+  }
+
+  TObject * dis = emcalSubFolder->FindObject(name) ;
+  if(!dis)
+    return 0 ;
+  else
+    return static_cast<void *>(emcalSubFolder->GetListOfFolders()->GetObjectRef(dis)) ;
+
+}
+
+//____________________________________________________________________________ 
+Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const 
+{  //---------- SDigitizer -------------------------
+    
+  // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
+
+
+  TTask * sd  = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; 
+
+  if ( !sd ) {
+    cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
+    return kFALSE ;
+  }        
+  TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; 
+  if ( !emcal )  {
+      cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;  
+      cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
+    emcal = new TTask("EMCAL", "") ; 
+    sd->Add(emcal) ; 
+  } 
+  AliEMCALSDigitizer * emcalsd  = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() )); 
+  if (emcalsd) { 
+      cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ; 
+    emcal->GetListOfTasks()->Remove(emcalsd) ;
+  }
+  emcal->Add(sdigitizer) ;     
+  return kTRUE; 
+  
+}
+
+//____________________________________________________________________________ 
+void * AliEMCALGetter::SDigitizerRef(const char * name) const 
+{  
+
+  TTask * sd  = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; 
+  if ( !sd ) {
+    cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
+    abort();
+  }        
+
+  TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; 
+  if ( !emcal )  {
+    cerr <<"ERROR: AliEMCALGetter::Post SerRef ->  //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
+    abort();
+  }        
+
+  TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; 
+
+  return static_cast<void *>(emcal->GetListOfTasks()->GetObjectRef(task)) ;
+
+}
+
+//____________________________________________________________________________ 
+Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const 
+{  //---------- SDigitizer -------------------------
+  
+ // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
+
+
+  TTask * sd  = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; 
+  if ( !sd ) {
+    cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
+    return kFALSE ;
+  }        
+
+  TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; 
+  if ( !emcal )  {
+      cout <<"WARNING: AliEMCALGetter::Post Ser ->  //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
+      cout <<"INFO: AliEMCALGetter::Post Ser -> Adding  //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
+    emcal = new TTask("EMCAL", "") ; 
+    sd->Add(emcal) ; 
+  } 
+
+  TString sdname(name) ;
+  sdname.Append(":") ;
+  sdname.Append(file);
+  AliEMCALSDigitizer * emcalsd  = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname )); 
+  if (!emcalsd) {
+    emcalsd = new AliEMCALSDigitizer() ;  
+    //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
+    emcalsd->SetName(sdname) ;
+    emcalsd->SetTitle(file) ;
+    emcal->Add(emcalsd) ;      
+  }
+  return kTRUE; 
+  
+}
+
+//____________________________________________________________________________ 
+Bool_t AliEMCALGetter::PostDigits(const char * name) const 
+{  //---------- Digits -------------------------
+
+  // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
+
+  TFolder * emcalFolder  = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
+
+  if ( !emcalFolder ) {
+      cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
+      cout << "INFO:    AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
+    emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;  
+  }    
+  TObject*  dig = emcalFolder->FindObject( name ) ;
+  if ( !dig ) {
+    TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
+    digits->SetName(name) ;
+    emcalFolder->Add(digits) ;  
+  }
+  return kTRUE; 
+}
+
+//____________________________________________________________________________ 
+void * AliEMCALGetter::DigitsRef(const char * name) const 
+{ //------- Digits ----------------------
+  
+  // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
+
+  if ( !fDigitsFolder ) {
+    cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
+    return 0;
+  }    
+  
+  TFolder * emcalFolder  = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; 
+  if ( !emcalFolder ) {
+    cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
+    return 0;
+  }    
+
+  TObject * d = emcalFolder->FindObject(name) ;
+  if(!d)
+    return 0 ;
+  else
+    return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(d)) ;
+
+}
+
+//____________________________________________________________________________ 
+Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const 
+{  //---------- Digitizer -------------------------
+  
+  TTask * sd  = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; 
+
+  if ( !sd ) {
+    cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
+    return kFALSE ;
+  }        
+  TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; 
+  if ( !emcal )  {
+      cout <<"WARNING: AliEMCALGetter::Post Der ->  //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
+      cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; 
+    emcal = new TTask("EMCAL", "") ; 
+    sd->Add(emcal) ; 
+  } 
+
+    AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ; 
+    if (emcald) { 
+      emcald->Delete() ;
+      emcal->GetListOfTasks()->Remove(emcald) ;
+    }
+    emcal->Add(digitizer) ; 
+    return kTRUE; 
+}  
+
+//____________________________________________________________________________ 
+Bool_t AliEMCALGetter::PostDigitizer(const char * name) const 
+{  //---------- Digitizer -------------------------
+  
+ // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
+
+  TTask * d  = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; 
+  if ( !d ) {
+    cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
+    return kFALSE ;
+  }        
+
+  TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ; 
+  if ( !emcal )  {
+      cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; 
+      cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
+    emcal = new TTask("EMCAL", "") ; 
+    d->Add(emcal) ; 
+} 
+
+  AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ; 
+  if (!emcald) { 
+    emcald = new AliEMCALDigitizer() ;
+    emcald->SetName(fDigitsTitle) ;
+    emcald->SetTitle(fHeaderFile) ;
+    emcal->Add(emcald) ;
+  }
+  return kTRUE;  
+}
+
+//____________________________________________________________________________ 
+void * AliEMCALGetter::DigitizerRef(const char * name) const 
+{  
+  TTask * sd  = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; 
+  if ( !sd ) {
+    cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
+    abort();
+  }        
+
+  TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; 
+  if ( !emcal )  {
+    cerr <<"ERROR: AliEMCALGetter::Post DerRef ->  //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
+    abort();
+  }        
+
+  TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; 
+
+  return static_cast<void *>(emcal->GetListOfTasks()->GetObjectRef(task)) ;
+
+}
+//____________________________________________________________________________ 
+const TParticle * AliEMCALGetter::Primary(Int_t index) const
+{
+  // Return primary particle numbered by <index>
+
+  if(index < 0) 
+    return 0 ;
+  
+  Int_t primaryIndex = index % 10000000 ; 
+  Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.)  ;
+  
+  if ( primaryList > 0  ) {
+      cout << " Getter does not support currently Mixing of primary " << endl ;
+      cout << "   can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
+    return 0;
+  }
+  
+  return gAlice->Particle(primaryIndex) ;
+  
+}
+
+//____________________________________________________________________________ 
+void AliEMCALGetter::ReadTreeD()
+{
+  // Read the digit tree gAlice->TreeD()  
+  if(gAlice->TreeD()== 0){
+    cerr <<   "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
+  return ;
+  }
+ cout << "hello" << endl;  
+  TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
+  TIter next(lob) ; 
+  TBranch * branch = 0 ; 
+  TBranch * digitsbranch = 0 ; 
+  TBranch * digitizerbranch = 0 ; 
+  Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ; 
+  
+  while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
+    if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
+      digitsbranch = branch ; 
+      emcalfound = kTRUE ;
+    }
+    else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
+      digitizerbranch = branch ; 
+      digitizerfound = kTRUE ; 
+    }
+  }
+
+  if ( !emcalfound || !digitizerfound ) {
+      cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name " 
+          << fDigitsTitle << endl ;
+    return ; 
+  }   
+  //read digits
+  if(!Digits(fDigitsTitle) ) 
+    PostDigits(fDigitsTitle);
+  digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
+  digitsbranch->GetEntry(0) ;
+  
+  
+  // read  the Digitizer
+  if(!Digitizer(fDigitsTitle))
+    PostDigitizer(fDigitsTitle) ;
+  digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
+  digitizerbranch->GetEntry(0) ;
+  
+}
+
+//____________________________________________________________________________ 
+void AliEMCALGetter::ReadTreeH()
+{
+  // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
+
+  if(gAlice->TreeH()== 0){
+    cerr <<   "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
+    return ;
+  }
+  
+  TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
+  if ( !hitsbranch ) {
+      cout << "WARNING:  AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; 
+    return ;
+  }
+  if(!Hits())
+    PostHits() ;
+
+  hitsbranch->SetAddress(HitsRef()) ;
+
+  hitsbranch->GetEntry(0) ;
+
+}
+
+//____________________________________________________________________________ 
+void AliEMCALGetter::Track(Int_t itrack)
+{
+  // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
+
+  if(gAlice->TreeH()== 0){
+    cerr <<   "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
+    return ;
+  }
+  
+  TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
+  if ( !hitsbranch ) {
+      cout << "WARNING:  AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; 
+    return ;
+  }  
+  if(!Hits())
+    PostHits() ;
+  hitsbranch->SetAddress(HitsRef()) ;
+  hitsbranch->GetEntry(itrack) ;
+
+
+}
+//____________________________________________________________________________ 
+void AliEMCALGetter::ReadTreeS(Int_t event)
+{
+  // Read the summable digits tree gAlice->TreeS()  
+  
+  // loop over all opened files and read their SDigits to the White Board
+  TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
+  if (!emcalF) 
+    emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; 
+  TCollection * folderslist = emcalF->GetListOfFolders() ; 
+  
+  //Add current file to list if it is not there yet
+  if ( (fHeaderFile != "aliroot") && ( !folderslist->Contains(fHeaderFile) ) ){
+    emcalF->AddFolder(fHeaderFile, ""); 
+  }
+    
+  TIter next(folderslist) ; 
+  TFolder * folder = 0 ; 
+  TFile * file; 
+  TTree * treeS = 0;
+  while ( (folder = static_cast<TFolder*>(next())) ) {
+    if(fHeaderFile.CompareTo(folder->GetName()) == 0 ) 
+      {treeS=gAlice->TreeS() ;
+        cout << "ReadTreeS  "<<  gAlice->TreeS()  <<endl ;}
+    else{
+     cout << " AliEMCALGetter::ReadTreeS 2 " <<  folder->GetName() << endl ; 
+     file = static_cast<TFile*>(gROOT->GetFile(folder->GetName())); 
+      file->cd() ;
+      
+      // Get SDigits Tree header from file
+      TString treeName("TreeS") ;
+      treeName += event ; 
+      treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
+    }
+    if(treeS==0){
+      cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
+      return ;
+    }
+    
+    //set address of the SDigits and SDigitizer
+    TBranch   * sdigitsBranch    = 0;
+    TBranch   * sdigitizerBranch = 0;
+    TBranch   * branch           = 0 ;  
+    TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
+    TIter next(lob) ; 
+    Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; 
+    
+    while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
+     if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
+       emcalfound = kTRUE ;
+       sdigitsBranch = branch ; 
+       cout << "sdigitsbranch found = " << branch << endl ; 
+       }
+      
+      else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
+       sdigitizerfound = kTRUE ; 
+       sdigitizerBranch = branch ;
+       cout << "sdigitizerbranch found = " << branch << endl ; 
+      }
+    }
+    if ( !emcalfound || !sdigitizerfound ) {
+       cout << "WARNING: AliEMCALDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName() 
+            << " not found" << endl ;
+      return ; 
+    }   
+    
+    if ( !folder->FindObject(fSDigitsTitle) )  
+     { PostSDigits(fSDigitsTitle,folder->GetName()) ;
+       cout << "Posting SDigits " << endl << endl ;}  
+    sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
+    
+    sdigitsBranch->GetEntry(0) ;
+    
+    TString sdname(fSDigitsTitle) ;
+    cout << sdname << endl ;
+    sdname+=":" ;
+    sdname+=folder->GetName() ;
+    if(!SDigitizer(sdname) ) 
+      PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
+    sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
+    sdigitizerBranch->GetEntry(0) ;
+    
+  }    
+  
+  // After SDigits have been read from all files, return to the first one
+  
+  next.Reset();
+  folder = static_cast<TFolder*>(next());
+  if(folder){
+    file   = static_cast<TFile*>(gROOT->GetFile(folder->GetName())); 
+    file   ->cd() ;
+  }
+  
+}
+//____________________________________________________________________________ 
+void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
+{  // Read the summable digits fron treeS()  
+
+
+  TString filename("mergefile") ;
+  filename+= input ;
+
+  TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; 
+  if ( !emcalFolder ) { 
+   emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; 
+  } 
+  TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
+  //set address of the SDigits and SDigitizer
+  TBranch   * sdigitsBranch    = 0;
+  TBranch   * sdigitizerBranch = 0;
+  TBranch   * branch           = 0 ;  
+  TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
+  TIter next(lob) ; 
+  Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; 
+  
+  while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
+    if ( strcmp(branch->GetName(), "EMCAL")==0) {
+      emcalfound = kTRUE ;
+      sdigitsBranch = branch ; 
+    }
+    
+    else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
+      sdigitizerfound = kTRUE ; 
+      sdigitizerBranch = branch ;
+    }
+  }
+  if ( !emcalfound || !sdigitizerfound ) {
+      cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
+    return ; 
+  }   
+  
+  if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
+    PostSDigits(sdigitsBranch->GetTitle(),filename) ;
+
+  sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
+  
+  TString sdname(sdigitsBranch->GetTitle()) ;
+  sdname+=":" ;
+  sdname+=filename ;
+  if(!SDigitizer(sdigitsBranch->GetTitle()) )
+    PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
+  sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
+  
+  sdigitsBranch->GetEntry(0) ;
+  sdigitizerBranch->GetEntry(0) ;
+  
+}    
+
+
+//____________________________________________________________________________ 
+void AliEMCALGetter::ReadPrimaries()
+{
+  // Reads specific branches of primaries
+  
+  fNPrimaries = gAlice->GetNtrack();
+  
+  //   //Check, is it necessary to open new files
+  //   TArrayI* events = fDigitizer->GetCurrentEvents() ; 
+  //   TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
+//   Int_t input ;
+//   for(input = 0; input < filenames->GetEntriesFast(); input++){
+
+//     TObjString * filename = (TObjString *) filenames->At(input) ;
+
+//     //Test, if this file already open
+//     TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
+//     if(file == 0)
+//       file = new TFile( filename->GetString()) ;
+//     file->cd() ;
+    
+//     // Get Kine Tree from file
+// //     char treeName[20];
+// //     sprintf(treeName,"TreeK%d",events->At(input));
+// //     TTree * treeK = (TTree*)gDirectory->Get(treeName);
+// //     if (treeK) 
+// //       treeK->SetBranchAddress("Particles", &fParticleBuffer);
+// //     else    
+// //       cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
+
+// //     // Create the particle stack
+// //     if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
+// //     // Build the pointer list
+// //     if(fParticleMap) {     <----
+// //       fParticleMap->Clear();
+// //       fParticleMap->Expand(treeK->GetEntries());
+// //     } else
+// //       fParticleMap = new TObjArray(treeK->GetEntries());
+    
+//     // From gAlice->Particle(i) 
+
+
+// //   if(!(*fParticleMap)[i]) {
+// //     Int_t nentries = fParticles->GetEntries();
+    
+// //     // algorithmic way of getting entry index
+// //     // (primary particles are filled after secondaries)
+// //     Int_t entry;
+// //     if (i<fHeader.GetNprimary())
+// //       entry = i+fHeader.GetNsecondary();
+// //     else 
+// //       entry = i-fHeader.GetNprimary();
+      
+// //     // only check the algorithmic way and give
+// //     // the fatal error if it is wrong
+// //     if (entry != fParticleFileMap[i]) {
+// //       Fatal("Particle",
+// //         "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
+// //  entry, fParticleFileMap[i]); 
+// //     }  
+      
+// //     fTreeK->GetEntry(fParticleFileMap[i]);
+// //     new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
+// //     fParticleMap->AddAt((*fParticles)[nentries],i);
+// //   }
+// //   return (TParticle *) (*fParticleMap)[i];
+
+   
+    
+//   }
+
+
+//   //scan over opened files and read corresponding TreeK##
+
+  return ;
+}
+//____________________________________________________________________________ 
+void AliEMCALGetter::Event(const Int_t event, const char* opt)
+{
+  // Reads the content of all Tree's S, D and R
+  
+  if (event >= gAlice->TreeE()->GetEntries() ) {
+    cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ; 
+    return ; 
+  }
+  gAlice->GetEvent(event) ;
+
+  if(strstr(opt,"H") )
+   {cout<<"Reading TreeH" << endl ; 
+   ReadTreeH() ;}
+  
+  if(strstr(opt,"S") )
+    { cout << "Reading TreeS" << endl ;
+    ReadTreeS(event) ;}
+
+  if( strstr(opt,"D") )
+    ReadTreeD() ;
+
+  if( strstr(opt,"R") )
+//    ReadTreeR() ;
+
+  if( strstr(opt,"Q") )
+//    ReadTreeQA() ;
+
+  if( strstr(opt,"P") )
+    ReadPrimaries() ;
+
+}
+
+//____________________________________________________________________________ 
+const TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const 
+{
+  // get the object named "what" from the folder
+  // folders are named like //Folders
+
+  if ( file.IsNull() ) 
+    file = fHeaderFile ; 
+
+  TFolder * folder = 0 ;
+  TObject * emcalO  = 0 ; 
+
+  //  if ( name.IsNull() ) {
+  if ( what.CompareTo("Hits") == 0 ) {
+    folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ; 
+    if (folder) 
+      emcalO  = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;  
+  }
+  else if ( what.CompareTo("SDigits") == 0 ) { 
+    TString path = "EMCAL/" + file  ; 
+    folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ; 
+    if (folder) { 
+    cout << "folder found" << endl ;
+    if (name.IsNull())
+       name = fSDigitsTitle ; 
+      emcalO  = dynamic_cast<TObject *>(folder->FindObject(name)) ; 
+    }
+  }
+  else if ( what.CompareTo("Digits") == 0 ){
+    folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ; 
+    if (folder) { 
+      if (name.IsNull())
+       name = fDigitsTitle ; 
+      emcalO  = dynamic_cast<TObject *>(folder->FindObject(name)) ; 
+    } 
+  }
+  if (!emcalO) {
+      cerr << "ERROR : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ; 
+    return 0 ;
+  }
+  return emcalO ;
+}
+  
+//____________________________________________________________________________ 
+const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const 
+{
+  // get the TTask named "what" from the folder
+  // folders are named like //Folders/Tasks/what/EMCAL/name
+
+  TString search(what) ; 
+
+  TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ; 
+
+  if (!tasks) {
+    cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;  
+    return 0 ; 
+  }
+
+  TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; 
+  if (!emcalT) { 
+    cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;  
+    return 0 ; 
+  }
+  
+  TList * list = emcalT->GetListOfTasks() ; 
+  if (what.CompareTo("SDigitizer") == 0) {  
+    if ( name.IsNull() )
+      name =  fSDigitsTitle ; 
+  } else  if (what.CompareTo("Digitizer") == 0){ 
+    if ( name.IsNull() )
+      name =  fDigitsTitle ;
+  }
+  
+  TIter it(list) ;
+  TTask * task = 0 ; 
+  while((task = static_cast<TTask *>(it.Next()) )){
+    TString taskname(task->GetName()) ;
+    if(taskname.BeginsWith(name))
+      return task ;
+  }
+  
+    cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ; 
+  return 0 ;
+}
diff --git a/EMCAL/AliEMCALGetter.h b/EMCAL/AliEMCALGetter.h
new file mode 100644 (file)
index 0000000..5e8e8b2
--- /dev/null
@@ -0,0 +1,155 @@
+#ifndef ALIEMCALGETTER_H
+#define ALIEMCALGETTER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+//  A singleton that returns various objects 
+//  Should be used on the analysis stage to avoid confusing between different
+//  branches of reconstruction tree: e.g. reading RecPoints and TS made from 
+//  another set of RecPoints.
+//  At this stage the Getter class handles only Hits, Digits, and SDigits.
+//  The objects are retrived from folders.  
+//*-- Author: Sahal Yacoob (LBL)
+// based on : AliPHOSGetter    
+
+
+// --- ROOT system ---
+#include "TClonesArray.h"
+#include "TFolder.h"  
+#include "TTree.h"
+class TString ;
+class TParticle ;
+class TTask ;
+
+// --- Standard library ---
+#include <stdlib.h>
+#include <iostream.h>
+
+// --- AliRoot header files ---
+
+#include "AliRun.h"
+#include "AliEMCALv1.h" 
+class AliEMCALGeometry ;
+class AliEMCALHit ;
+class AliEMCALDigit ;
+class AliEMCALDigitizer ;
+class AliEMCALSDigitizer ;
+
+class AliEMCALGetter : public TObject {
+  
+ public:
+  
+  AliEMCALGetter(){ 
+    // ctor: this is a singleton, the ctor should never be called but cint needs it as public
+    cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
+    abort() ; 
+  } 
+  AliEMCALGetter(const AliEMCALGetter & obj) {
+    // cpy ctor requested by Coding Convention 
+    // but not yet needed
+    abort() ; 
+  } 
+  
+  virtual ~AliEMCALGetter() ; 
+  
+  Bool_t PostHits(void ) const ;  
+  Bool_t PostSDigits(      const char * name,  const char * file = 0) const ;  
+  Bool_t PostDigits(       const char * name ) const ;  
+
+  Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;  
+  Bool_t PostSDigitizer ( const char * name, const char * file ) const ;  
+  Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;  
+  Bool_t PostDigitizer  ( const char * name) const ;  
+  
+
+  void   Event(const Int_t event, const char * opt = "HSD") ;    
+  void   Track(Int_t itrack) ;
+
+  //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
+  void   ReadTreeS(TTree * treeS,Int_t input) ;
+  
+  Int_t  EventNumber()       { return (Int_t) gAlice->GetEvNumber() ; }
+  Int_t  MaxEvent()          { return (Int_t) gAlice->TreeE()->GetEntries() ; }
+  static AliEMCALGetter * GetInstance(const char* headerFile,
+                                    const char* branchTitle = "Default" ) ; 
+  static AliEMCALGetter *   GetInstance() ; 
+
+  const AliEMCALv0 *         EMCAL()  ;  
+  const  AliEMCALGeometry * EMCALGeometry() ; 
+
+  // Hits
+        TClonesArray *  Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
+
+  // SDigits
+        TClonesArray *  SDigits(const char * name = 0, const char * file=0) const 
+                                     { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
+
+   AliEMCALSDigitizer *  SDigitizer(const char * name =0) const 
+                                      { return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ; }
+
+  // Digits
+        TClonesArray *  Digits(const char * name = 0)   const 
+                             { return (TClonesArray*)(ReturnO("Digits", name)) ; }
+    AliEMCALDigitizer *  Digitizer(const char * name =0) const 
+                             { return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; }
+
+  // Primaries
+  const TParticle *           Primary(Int_t index) const ;
+  const Int_t                 NPrimaries()const { return fNPrimaries; }
+
+
+  AliEMCALGetter & operator = (const AliEMCALGetter & ) {
+    // assignement operator requested by coding convention, but not needed
+    abort() ;
+    return *this ; 
+  }
+  
+  TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
+
+ private:
+
+  AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default") ; 
+  void CreateWhiteBoard() const ; 
+  const TObject * ReturnO(TString what, TString name=0, TString file=0) const ; 
+  const TTask * ReturnT(TString what,TString name=0) const ; 
+  void DefineBranchTitles(char* branch, char* branchTitle) ;
+  void ReadTreeD() ;
+  void ReadTreeH() ;
+  void ReadTreeS(Int_t event) ;
+  void ReadPrimaries() ;
+
+  void * HitsRef(void) const ;
+  void * SDigitsRef(const char * name, const char * file = 0 ) const;
+  void * DigitsRef (const char * name)   const ;
+
+  void * SDigitizerRef (const char * name) const ; 
+  void * DigitizerRef  (const char * name) const ; 
+
+ private:
+
+  TString        fHeaderFile ;        //! File in which gAlice lives
+  TString        fBranchTitle ;       //!
+  TString        fDigitsTitle ;       //!
+  TString        fSDigitsTitle ;      //!
+
+  Int_t          fDebug ;             // Debug level
+
+  Int_t          fNPrimaries ;        //! # of primaries
+  
+  TObjArray *    fPrimaries ;         //! list of lists of primaries-for the case of mixing
+
+  TFolder *      fHitsFolder ;        //!Folder that contains the Hits 
+  TFolder *      fSDigitsFolder ;     //!Folder that contains the SDigits 
+  TFolder *      fDigitsFolder ;      //!Folder that contains the Digits 
+  TFolder *      fTasksFolder ;       //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
+  TFolder *      fModuleFolder ;     //!
+  static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton 
+
+  ClassDef(AliEMCALGetter,1)  // Algorithm class that provides methods to retrieve objects from a list knowing the index 
+
+};
+
+#endif // AliEMCALGETTER_H
index f0f522c2fefcfb8024f090193de3ddd74258a55d..1003cd72dc77cc16cc4668651ac5b2f135f1317b 100644 (file)
@@ -17,8 +17,8 @@
 
 //_________________________________________________________________________
 //  Hits class for EMCAL    
-//  A hit in EMCAL is the sum of all hits in a single crystal
-//               
+//  A hit in EMCAL is the sum of all hits in a single segment
+//  from a single enterring particle             
 //*-- Author: Sahal Yacoob (LBL / UCT)
 // Based on AliPHOSHit
 
@@ -80,7 +80,7 @@ AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit){
 AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent, Float_t ienergy, Int_t id,
                         Float_t *hits,Float_t *p):AliHit(shunt, track){
     //
-    // Create a CPV hit object
+    // Create an EMCAL  hit object
     //
     fX          = hits[0];
     fY          = hits[1];
@@ -98,7 +98,7 @@ AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent,
 //______________________________________________________________________
 Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{ 
     // Two hits are identical if they have the same Id and originat
-    // from the same primary
+    // from the same enterring Particle 
     Bool_t rv = kFALSE;
 
     if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetIparent()) )
index 974bd0bdd8fc1dbbfa1b2e5e4c71ee63afcd4c4b..985c2d37a5f79fd6fafb707ae15bff3cee4c9576 100644 (file)
@@ -7,7 +7,7 @@
 
 //_________________________________________________________________________
 //  Hits class for EMCAL    
-//  A hit in EMCAL is the sum of all hits from the same primary
+//  A hit in EMCAL is the sum of all hits from the same Entering particle 
 //  in the same segment of scintillator. 
 //               
 //*-- Author: Sahal Yacoob (LBL /UCT) 
@@ -46,12 +46,12 @@ class AliEMCALHit : public AliHit {
  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
+    Int_t          fPrimary;   // Primary particles at the origin of the hit
     Float_t        fPx;      // Primary partical enetrence momentum/energy
     Float_t        fPy;      // Primary partical enetrence momentum/energy
     Float_t        fPz;      // Primary partical enetrence momentum/energy
     Float_t        fPe;      // Primary partical enetrence momentum/energy
-    Int_t          fIparent;   // Parent particle that enterred emcal
+    Int_t          fIparent;   // Parent particle that entered emcal
     Float_t        fIenergy;   // Initial energy of parent particle that enterred the emcal
     ClassDef(AliEMCALHit,2)  // Hit for EMCAL
 
index 0961a29c87ff624328fa5442739b5987dcfba4d5..2bf60b37c7568ec680191c852cb8aa97727a663e 100644 (file)
@@ -1,4 +1,4 @@
-/**************************************************************************
+/*************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
@@ -18,7 +18,7 @@
 //_________________________________________________________________________
 // This is a TTask that makes SDigits out of Hits
 // A Summable Digits is the sum of all hits originating 
-// from one primary in one active cell
+// from one in one tower of the EMCAL 
 // A threshold for assignment of the primary to SDigit is applied 
 // SDigits are written to TreeS, branch "EMCAL"
 // AliEMCALSDigitizer with all current parameters is written 
@@ -41,7 +41,8 @@
 //             deb all  - print # and list of produced SDigits
 //             tim - print benchmarking information
 //
-//*-- Author :  Dmitri Peressounko (SUBATECH & KI) 
+//*-- Author : Sahal Yacoob (LBL)
+// based on  : AliPHOSSDigitzer 
 //////////////////////////////////////////////////////////////////////////////
 
 
@@ -73,7 +74,7 @@ ClassImp(AliEMCALSDigitizer)
   // ctor
   fA = 0;
   fB = 10000000. ;
-  fPrimThreshold = 0.001 ;
+  fPrimThreshold = 0.01 ;
   fNevents = 0 ;     
   fSDigits = 0 ;
   fHits = 0 ;
@@ -87,7 +88,7 @@ AliEMCALSDigitizer::AliEMCALSDigitizer(const char* headerFile, const char *sDigi
   // ctor
   fA = 0;
   fB = 10000000.;
-  fPrimThreshold = 0.001 ;
+  fPrimThreshold = 0.01 ;
   fNevents = 0 ;      
   fSDigitsTitle = sDigitsTitle ;
   fHeadersFile = headerFile ;
@@ -191,51 +192,59 @@ void AliEMCALSDigitizer::Exec(Option_t *option) {
       
       //=========== Get the EMCAL branch from Hits Tree for the Primary track itrack
       branch->GetEntry(itrack,0);
-      AliEMCAL * EMCAL = (AliEMCAL *) gAlice->GetDetector("EMCAL") ;
+      AliEMCALv0 * EMCAL = (AliEMCALv0 *) gAlice->GetDetector("EMCAL") ;
       AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance( EMCAL->GetGeometry()->GetName(), EMCAL->GetGeometry()->GetTitle() );
  
       Int_t i;
       for ( i = 0 ; i < fHits->GetEntries() ; i++ ) {
        AliEMCALHit * hit = (AliEMCALHit*)fHits->At(i) ;
-        AliEMCALDigit curSDigit = AliEMCALDigit(1,1,1,1);
-        AliEMCALDigit *sdigit ;
-       // Assign primary number only if contribution is significant
-     
+        AliEMCALDigit  * curSDigit = 0  ;
+        AliEMCALDigit * sdigit ;
+        Bool_t newsdigit = kTRUE; 
+// Assign primary number only if contribution is significant
         if( hit->GetEnergy() > fPrimThreshold)
-          curSDigit =  AliEMCALDigit( hit->GetPrimary(), hit->GetIparent(), (((hit->GetId()/geom->GetNPhi())%geom->GetNZ()+1) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
+   curSDigit =  new AliEMCALDigit( hit->GetPrimary(), hit->GetIparent(), (((hit->GetId()/geom->GetNPhi())%geom->GetNZ()+1 ) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
         else
-          curSDigit =  AliEMCALDigit( -1               , -1               ,(((hit->GetId()/geom->GetNPhi())%geom->GetNZ()+1) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
-       
-        for(Int_t check= 0; check < nSdigits; check++) {
+   curSDigit =  new AliEMCALDigit( -1               , -1               ,(((hit->GetId()/geom->GetNPhi())%geom->GetNZ() + 1 ) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
+     cout << "Hit ID = " <<hit->GetId() << endl ; 
+     cout << "ID for detector = " << curSDigit->GetId() << endl ;  
+           cout << hit->GetEnergy() << " - hit energy   -   Digit Energy - " << curSDigit->GetAmp() << endl;
+      for(Int_t check= 0; check < nSdigits ; check++) {
           sdigit = (AliEMCALDigit *)fSDigits->At(check);
-          if( (((hit->GetId()/geom->GetNPhi())%geom->GetNZ()) == ((sdigit->GetId()/geom->GetNPhi())%geom->GetNZ()))  && ((hit->GetId()%geom->GetNPhi()) == (sdigit->GetId()%geom->GetNPhi()))) 
-           { 
-             *sdigit = *sdigit + curSDigit ;
+          if( sdigit->GetId() == curSDigit->GetId())   
+            { cout << "SDigit - Get Amp  " << sdigit->GetAmp() << endl ; 
+             *sdigit = *sdigit + *curSDigit ;
+              newsdigit = kFALSE;
+            cout << " and after addition " << sdigit->GetAmp() << endl ; 
            }
-     else 
-         { new((*fSDigits)[nSdigits])  AliEMCALDigit(curSDigit);
-         nSdigits++ ; } 
-       }
-  
+          }
+     if (newsdigit) 
+         { new((*fSDigits)[nSdigits])  AliEMCALDigit(*curSDigit);
+         nSdigits++ ;  
+       cout << "Detector nsdigits = " << nSdigits << endl ; }
+        newsdigit = kTRUE;  
+         
 
         if( hit->GetEnergy() > fPrimThreshold)
-          curSDigit =  AliEMCALDigit( hit->GetPrimary(), hit->GetIparent(), ((geom->GetNZ() * geom->GetNPhi()) + ((hit->GetId()/geom->GetNPhi())%geom->GetNZ()+1) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
+      curSDigit =  new AliEMCALDigit( hit->GetPrimary(), hit->GetIparent(), ((geom->GetNZ() * geom->GetNPhi()) + ((hit->GetId()/geom->GetNPhi())%geom->GetNZ() + 1) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
         else
-          curSDigit =  AliEMCALDigit( -1               , -1               ,((geom->GetNZ() * geom->GetNPhi()) + ((hit->GetId()/geom->GetNPhi())%geom->GetNZ()+1) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
+    curSDigit =  new AliEMCALDigit( -1               , -1               ,((geom->GetNZ() * geom->GetNPhi()) + ((hit->GetId()/geom->GetNPhi())%geom->GetNZ()+1) * (hit->GetId()%(geom->GetNPhi()+1))), Digitize( hit->GetEnergy() ) ) ;
  
       if((hit->GetId()/geom->GetNPhi()) < (2*geom->GetNZ())) 
-       {
+       { cout << "ID for Preshower = " << curSDigit->GetId()  << endl ;
         for(Int_t check= 0; check < nSdigits; check++) {
           sdigit = (AliEMCALDigit *)fSDigits->At(check);
-          if( (((hit->GetId()/geom->GetNPhi())%geom->GetNZ()) == ((sdigit->GetId()/geom->GetNPhi())%geom->GetNZ()))  && ((hit->GetId()%geom->GetNPhi()) == (sdigit->GetId()%geom->GetNPhi()))) 
+          if( sdigit->GetId() == curSDigit->GetId())   
            { 
-             *sdigit = *sdigit + curSDigit ;
+             *sdigit = *sdigit + *curSDigit ;
+             newsdigit = kFALSE ;
+            }
            }
-     else 
-         { new((*fSDigits)[nSdigits])  AliEMCALDigit(curSDigit);
-         nSdigits++ ; } 
-       }
+     if (newsdigit) 
+         { new((*fSDigits)[nSdigits])  AliEMCALDigit(*curSDigit);
+         nSdigits++ ;  
+       cout << "Preshower nsdigits = " << nSdigits << endl ;}
+        newsdigit=kTRUE;       
       } 
      } 
     } // loop over tracks
index 543b9e45c8111b094b15cd6a4fe96e0ee7b6e18a..51f7936df26f2f0dd578b4ba679079a15640588f 100644 (file)
@@ -8,7 +8,9 @@
 //_________________________________________________________________________
 //  Task Class for making SDigits in EMCAL      
 //                  
-//*-- Author: Dmitri Peressounko(SUBATECH & KI)
+//*-- Author: Sahal Yacoob (LBL)
+// based on : AliPHOSSDigitizer
+//_________________________________________________________________________
 
 
 // --- ROOT system ---
@@ -22,7 +24,7 @@ class AliEMCALSDigitizer: public TTask {
 
 public:
   AliEMCALSDigitizer() ;          // ctor
-  AliEMCALSDigitizer(const char* HeaderFile,const char *SdigitsTitle = 0) ; 
+  AliEMCALSDigitizer(const char* HeaderFile,const char *SdigitsTitle = "Default") ; 
   virtual ~AliEMCALSDigitizer() ; // dtor
 
   Float_t  Calibrate(Int_t amp)const {return (amp - fA)/fB ; }
@@ -55,7 +57,7 @@ private:
   TString fHeadersFile ;    //input file
   Bool_t         fIsInitialized ; 
   TClonesArray * fSDigits ; //! list of SDigits
-  TClonesArray * fHits ;    //!
+  TClonesArray * fHits ;    //! 
 
   ClassDef(AliEMCALSDigitizer,1)  // description 
 
index 112577e883f855c7aa95b9d30a79cc5a630b8422..40cecba5bdbcff91b971e30bde8a0661d364b89a 100644 (file)
@@ -19,7 +19,7 @@
 // Implementation version v0 of EMCAL Manager class 
 // An object of this class does not produce hits nor digits
 // It is the one to use if you do not want to produce outputs in TREEH or TREED
-//                  
+// This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx                 
 //*-- Author: Yves Schutz (SUBATECH)
 //*-- and   : Sahal Yacoob (LBL / UCT)
 
@@ -64,7 +64,7 @@ void AliEMCALv0::BuildGeometry(){
 
     const Int_t kColorArm1   = kBlue ;
 
-    // make the container of  Arm1
+    // Difine the shape of the Calorimeter 
   
     new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
              fGeom->GetEnvelop(0),     // rmin 
@@ -73,7 +73,7 @@ void AliEMCALv0::BuildGeometry(){
              fGeom->GetArm1PhiMin(),   // minimun phi angle
              fGeom->GetArm1PhiMax()    // maximun phi angle
        );
-    // Arm 1 inside alice
+    // Place the Node
     TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
     envelop1node->SetLineColor(kColorArm1) ;
     fNodes->Add(envelop1node) ;
@@ -91,7 +91,7 @@ void AliEMCALv0::CreateGeometry(){
     // Get pointer to the array containing media indices
     Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
 
-    // Create tube sectors that contains Arm 1 & 2 
+    // Create an Envelope within which to place the Detector 
  
     Float_t envelopA[5] ; 
     envelopA[0] = fGeom->GetEnvelop(0) ;         // rmin
@@ -102,55 +102,55 @@ void AliEMCALv0::CreateGeometry(){
 
     gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
 
-    // Create a tube sector that contains active material Arm 1 & 2
+    // Create the shapes of active material (LEAD/Aluminium/Scintillator) to be placed 
 
-    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() -
+    Float_t envelopB[10]; // First Layer of Aluminium
+    Float_t envelopC[10]; // Scintillator Layers
+    Float_t envelopD[10]; //  Lead Layers
+    
+    envelopC[0] = envelopD[0] =  envelopB[0] = fGeom->GetArm1PhiMin(); //starting position in Phi
+    envelopC[1] = envelopD[1] =  envelopB[1] = fGeom->GetArm1PhiMax() -  // Angular size of the Detector in Phi
                                               fGeom->GetArm1PhiMin();
-    envelopC[2] = envelopD[2] =  envelopB[2] = fGeom->GetNPhi() ;       
-    envelopD[3] = 2;
-    envelopC[3] = 2;
-    envelopB[3] = 2;
+    envelopC[2] = envelopD[2] =  envelopB[2] = fGeom->GetNPhi() ; // Number of Section in Phi
+    envelopD[3] = envelopC[3] = envelopB[3] = 2; // each section will be passed 2 z coordinates    
 
     envelopB[4] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active()) /
-                  (tan(2*atan(exp(0.7)))) ;
-    envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin
-    envelopD[6] = envelopB[6] = envelopB[5] + 3.18;  //rmax
+                  (tan(2*atan(exp(0.7)))) ;                          // z co-ordinate 1
+    envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin at z1
+    envelopD[6] = envelopB[6] = envelopB[5] + 3.18;  //rmax at z1
     envelopB[7] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active()) /
-                 (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
+                 (tan(2*atan(exp(-0.7)))) ;              // z co-ordinate 2
+    envelopB[8] = envelopB[5] ; //
+    envelopB[9] = envelopB[6] ; // radii are the same.
+
+    // filled shapes wit hactive material 
+    gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10); // Define Aluminium volume completely
+    gMC->Gsvolu("XPST", "PGON", idtmed[1601], 0, 0) ;  // The polystyrene layers will be defined when placed 
+    gMC->Gsvolu("XPBX", "PGON", idtmed[1600], 0, 0) ; //  as will the lead layers 
+    gMC->Gsdvn("XPHI", "XPST", fGeom->GetNPhi(), 2) ; //  Dividind eta polystyrene divisions into phi segments.
     
     Int_t idrotm = 1;
     AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
 
-    // Position  ENV1 container in ALIC
+    // Position the Envelope in Alice  
     gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "MANY") ;
-    // Position  ARM1  into ENV1
+    // Position Aluminium Layer in the Envelope 
     gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ;
 
+// The loop below places the scintillator in Lead Layers alternately.
     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[6] = envelopD[6] + ((i > +2)  ? 0.5 : 0.6)  ;  //rmax larger for first two layers (preshower)
        envelopC[8] = envelopD[6] ; //rmin
-       envelopC[9] = envelopD[6] + ((i > 2 ) ? 0.5 : 0.6)  ;  //rmax
+       envelopC[9] = envelopD[6] + ((i > 2 ) ? 0.5 : 0.6)  ;  //rmax larger for first two layers (preshower)
        for (int j =0; j < (fGeom->GetNZ()) ; j++){
            envelopC[4] = envelopD[6]/tan(2*atan(exp(0.7-(j*1.4/
-                                                      (fGeom->GetNZ())))));  
+                                                      (fGeom->GetNZ()))))); //z begin  
            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);
+                                                      (fGeom->GetNZ()))))); // z end 
+           gMC->Gsposp("XPST",1+j+i*(fGeom->GetNZ()), "XEN1", 
+                       0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
        } // end for j
        if (i < (fGeom->GetNLayers()-1)){
            envelopD[5] = envelopC[6] ; //rmin
@@ -159,11 +159,11 @@ void AliEMCALv0::CreateGeometry(){
            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())))));  
+                                                       (fGeom->GetNZ()))))); // z begin 
                envelopD[7] = envelopC[6]/tan(2*atan(exp(0.7-((j+1)*1.4/
-                                                        (fGeom->GetNZ())))));
+                                                        (fGeom->GetNZ()))))); // z end
                gMC->Gsposp("XPBX",1+ j+i*(fGeom->GetNZ()), "XEN1", 
-                           0.0, 0.0, 0.0 , idrotm, "MANY", envelopD, 10) ;
+                           0.0, 0.0, 0.0 , idrotm, "MANY", envelopD, 10) ; // Position and Define Layer
            } // end for j
        } // end if i
     }  // for i
index e1297b3741a21ce5c31209aca32337cf782d0520..ee3c7f40f2690e4dc3b6c4c0b5c51bccac4e09aa 100644 (file)
@@ -42,7 +42,7 @@ class AliEMCALv0 : public AliEMCAL {
   virtual void BuildGeometry();// creates the geometry for the ROOT display
   virtual void CreateGeometry() ;// creates the geometry for GEANT
 
-  virtual AliEMCALGeometry * GetGeometry() {
+  virtual AliEMCALGeometry * GetGeometry() const {
     // gets the pointer to the AliEMCALGeometry unique instance
     return fGeom ;
   }
@@ -67,7 +67,7 @@ class AliEMCALv0 : public AliEMCAL {
   
  protected:
 
-  ClassDef(AliEMCALv0,1)  // Implementation of EMCAL manager class for layout EMC+PPSD
+  ClassDef(AliEMCALv0,1)  // Implementation of EMCAL manager class for midrapidity barrel layout between 0 and 120 degrees 
     
     };
     
index c401e43004262a8503c2ed011e3d265f538d0f86..64169c4f81bdb4bd7beac36f09f5c028e62fc332 100644 (file)
@@ -66,7 +66,7 @@ AliEMCALv1::AliEMCALv1(const char *name, const char *title):
     gAlice->AddHitList(fHits);
 
     fNhits = 0;
-
+    fSamplingFraction = 12.9 ; 
     fIshunt     =  1; // All hits are associated with primary particles
 }
 //______________________________________________________________________
@@ -83,8 +83,8 @@ AliEMCALv1::~AliEMCALv1(){
 void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy, 
                        Int_t id, Float_t * hits,Float_t * 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
+    // An EMCAL hit is the sum of all hits in a single segment 
+    //   originating from the same enterring particle 
     Int_t hitCounter;
     
     AliEMCALHit *newHit;
@@ -122,19 +122,19 @@ void AliEMCALv1::StepManager(void){
     TLorentzVector pos; // Lorentz vector of the track current position.
     TLorentzVector mom; // Lorentz vector of the track current momentum.
     Int_t tracknumber =  gAlice->CurrentTrack();
-    Int_t primary;
+    Int_t primary = 0;
     static Int_t iparent = 0;
     static Float_t ienergy = 0;
-    Int_t copy;
+    Int_t copy = 0;
 
 
- if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)) 
+ if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)) // This Particle in enterring the Calorimeter 
  {
     iparent = tracknumber;
     gMC->TrackMomentum(mom);
     ienergy = mom[3]; 
 }
- if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { //  We are inside a PBWO crysta
+ if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer 
 
     gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
     gMC->CurrentVolID(id[1]); // get the phi number inside the layer
@@ -144,7 +144,7 @@ void AliEMCALv1::StepManager(void){
     xyze[0] = pos[0];
     xyze[1] = pos[1];
     xyze[2] = pos[2];
-    xyze[3] = gMC->Edep();
+    xyze[3] = fSamplingFraction*(gMC->Edep()); // Correct for sampling calorimeter
     pmom[0] = mom[0];
     pmom[1] = mom[1];
     pmom[2] = mom[2];
@@ -152,7 +152,9 @@ void AliEMCALv1::StepManager(void){
     
     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, iparent, ienergy, absid, xyze, pmom);
+        if((absid/fGeom->GetNPhi()) < (2*fGeom->GetNZ()))
+        {xyze[3] = 5*xyze[3]/6 ;}  //                                             Preshower readout must be scaled
+        AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyze, pmom);
     } // there is deposited energy
 }
 }
index 186c0b3fe5e3a795834fb155ce0d0b29b25a6e65..c3f145bf88e2fdec74d240ab3e2afe1c9795f98c 100644 (file)
@@ -9,7 +9,7 @@
 // Implementation version v1 of EMCAL Manager class 
 //*--                  
 //*-- Author: Sahal Yacoob (LBL / UCT) 
-//*--  and  : Jennifer Klay
+//*--  and  : Jennifer Klay (LBL)
 //#include <assert.h>
 
 // --- ROOT system ---
@@ -38,7 +38,10 @@ class AliEMCALv1 : public AliEMCALv0 {
     AliEMCALv1 & operator = (const AliEMCALv0 & rvalue){abort();return *this;}
   
  protected:
-    ClassDef(AliEMCALv1,1)//Implementation of EMCAL manager class for layout EMC+PPSD
+    ClassDef(AliEMCALv1,2)//Implementation of EMCAL manager class to produce hits in a Central Calorimeter 
+
+ private:
+    Double_t fSamplingFraction ; // Sampling Fraction of Calorimeter E = f*Elos  
 
 };
 #endif // AliEMCALV1_H
index 2655c88e4a17feb8ad40c7511cd6e1defa01b0af..2819f1f131d44b0d2dede302c21d0e7ab9820066 100644 (file)
@@ -12,4 +12,5 @@
 #pragma link C++ class AliEMCALDigit+;
 #pragma link C++ class AliEMCALSDigitizer+;
 #pragma link C++ class AliEMCALDigitizer+;
+#pragma link C++ class AliEMCALGetter+;
 #endif
index c423be621f72684475ff7d2bc9b7ff3d64a2ea43..19e29b88d12d3d7ab654f9d00cdde565d43d5d8e 100644 (file)
@@ -11,7 +11,7 @@ PACKAGE = EMCAL
 
 SRCS          =  AliEMCAL.cxx  AliEMCALGeometry.cxx AliEMCALv0.cxx \
                 AliEMCALv1.cxx AliEMCALHit.cxx AliEMCALDigit.cxx \
-                 AliEMCALSDigitizer.cxx AliEMCALDigitizer.cxx 
+                 AliEMCALSDigitizer.cxx AliEMCALDigitizer.cxx  AliEMCALGetter.cxx 
 
 # C++ Headers