]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCAL.cxx
final geometry and cleanup
[u/mrichter/AliRoot.git] / EMCAL / AliEMCAL.cxx
index 8546a66cee4ff5be847957fb1c2dc94349fdb003..8c3e475b6e5232ef04aa5d0ed9754ea05b10af90 100644 (file)
 
 // --- ROOT system ---
 class TFile;
-#include "TBranch.h" 
-#include "TClonesArray.h" 
-#include "TTree.h" 
+#include <TFolder.h> 
+#include <TTree.h>
+#include <TVirtualMC.h> 
 
 // --- Standard library ---
-#include <Rstrstream.h>
 
 // --- AliRoot header files ---
-#include "AliEMCAL.h"
-#include "AliRun.h"
 #include "AliMagF.h"
+#include "AliEMCAL.h"
 #include "AliEMCALGeometry.h"
-//#include "AliEMCALQAChecker.h" 
+#include "AliEMCALLoader.h"
+#include "AliRun.h"
+#include "AliEMCALSDigitizer.h"
+#include "AliEMCALDigitizer.h"
 
 ClassImp(AliEMCAL)
 //____________________________________________________________________________
@@ -47,8 +48,6 @@ AliEMCAL::AliEMCAL():AliDetector()
 {
   // Default ctor 
   fName="EMCAL";
-  //fQATask = 0;
-  fTreeQA = 0;
   fGeom = 0 ; 
 }
 
@@ -56,10 +55,7 @@ AliEMCAL::AliEMCAL():AliDetector()
 AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title)
 {
   //   ctor : title is used to identify the layout
-  
-  fGeom = AliEMCALGeometry::GetInstance(GetTitle(),"") ; 
-  //fQATask = 0;
-  fTreeQA = 0;
+  fGeom = 0;
 }
 
 //____________________________________________________________________________
@@ -94,11 +90,6 @@ void AliEMCAL::CreateMaterials()
   AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
   // ---         Absorption length is ignored ^
 
-  // --- Copper ---
-  AliMaterial(4, "Cu$", 63.546, 29, 8.96, 1.43, 14.8, 0, 0) ; 
-  // ---         Absorption length is ignored ^
-
-
   // DEFINITION OF THE TRACKING MEDIA
 
   // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
@@ -117,7 +108,6 @@ void AliEMCAL::CreateMaterials()
   AliMedium(1, "Lead      $", 1, 0,
             isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
 
  // The scintillator of the CPV made of Polystyrene scintillator                   -> idtmed[1601]
   AliMedium(2, "CPV scint.   $", 2, 1,
             isxfld, sxmgmx, 10.0, 0.001, 0.1, 0.001, 0.001, 0, 0) ;
@@ -126,11 +116,6 @@ void AliEMCAL::CreateMaterials()
   AliMedium(3, "Al parts     $", 3, 0,
              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
 
-  // Copper for HCal (post shower)                                                 -> idtmed[1603]
-  AliMedium(4, "Copper       $", 4, 0,
-             isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
-
-
 
 // --- Set decent energy thresholds for gamma and electron tracking
 
@@ -151,20 +136,11 @@ void AliEMCAL::CreateMaterials()
   gMC->Gstpar(idtmed[1602], "DCUTE",0.00001) ;
   gMC->Gstpar(idtmed[1602], "DCUTM",0.00001) ;
 
-// --- in copper parts ---
-  gMC->Gstpar(idtmed[1603], "LOSS",3.) ;
-  gMC->Gstpar(idtmed[1603], "DRAY",1.) ;
-  gMC->Gstpar(idtmed[1603], "DCUTE",0.00001) ;
-  gMC->Gstpar(idtmed[1603], "DCUTM",0.00001) ;
-
-
-
 // --- 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) ;
 
-
 }
 
 //____________________________________________________________________________
@@ -181,37 +157,49 @@ AliEMCALGeometry * AliEMCAL::GetGeometry() const
 //____________________________________________________________________________
 void AliEMCAL::SetTreeAddress()
 { 
-
+  // Linking Hits in Tree to Hits array
   TBranch *branch;
   char branchname[20];
   sprintf(branchname,"%s",GetName());
   
   // Branch address for hit tree
-  TTree *treeH = gAlice->TreeH();
-  if (treeH && fHits) {
+  TTree *treeH = TreeH();
+  if (treeH) {
     branch = treeH->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fHits);
+    if (branch) 
+      { 
+       if (fHits == 0x0) 
+         fHits= new TClonesArray("AliEMCALHit",1000);
+       branch->SetAddress(&fHits);
+      }
+    else
+      {
+       Warning("SetTreeAddress","<%s> Failed",GetName());
+      }
   }
 }
 
 //____________________________________________________________________________
-void AliEMCAL::WriteQA()
+AliLoader* AliEMCAL::MakeLoader(const char* topfoldername)
 {
+//different behaviour than standard (singleton getter)
+// --> to be discussed and made eventually coherent
+ fLoader = new AliEMCALLoader(GetName(),topfoldername);
+ return fLoader;
+}
 
-  // Make TreeQA in the output file. 
-
-  if(fTreeQA == 0)
-    fTreeQA = new TTree("TreeQA", "QA Alarms") ;    
-  // Create Alarms branches
-//   Int_t bufferSize = 32000 ;    
-//   Int_t splitlevel = 0 ; 
-//   TFolder * alarmsF = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS") ; 
-//   TString branchName(alarmsF->GetName());  
-//   TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel);
-//   TString branchTitle = branchName + " QA alarms" ; 
-//   alarmsBranch->SetTitle(branchTitle);
-//   alarmsBranch->Fill() ; 
-
-  //fTreeQA->Fill() ; 
+//____________________________________________________________________________
+void AliEMCAL::Hits2SDigits()  
+{ 
+// create summable digits
+
+  AliEMCALSDigitizer* emcalDigitizer = 
+    new AliEMCALSDigitizer(fLoader->GetRunLoader()->GetFileName().Data());
+  emcalDigitizer->ExecuteTask();
 }
 
+//____________________________________________________________________________
+AliDigitizer* AliEMCAL::CreateDigitizer(AliRunDigitizer* manager) const
+{
+  return new AliEMCALDigitizer(manager);
+}