]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOS.cxx
First attempt to use systemtically TFolders: the geometry object posts itself to...
[u/mrichter/AliRoot.git] / PHOS / AliPHOS.cxx
index bcb9d65367da1ac1a7c4335c09fe73148b6cb888..6e09cddf14f8abf0f997a2d102b30c4b54d542c8 100644 (file)
 //*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH) 
 //////////////////////////////////////////////////////////////////////////////
 
 //*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH) 
 //////////////////////////////////////////////////////////////////////////////
 
+
 // --- ROOT system ---
 // --- ROOT system ---
+class TFile;
+#include "TROOT.h"
+#include "TTree.h"
+#include "TFolder.h" 
 
 // --- Standard library ---
 
 
 // --- Standard library ---
 
+#include <strstream.h>
 // --- AliRoot header files ---
 
 #include "AliPHOS.h"
 #include "AliMC.h"
 #include "AliRun.h"
 // --- AliRoot header files ---
 
 #include "AliPHOS.h"
 #include "AliMC.h"
 #include "AliRun.h"
+#include "AliMagF.h"
+#include "AliPHOSGeometry.h"
+#include "AliPHOSQAChecker.h" 
 
 ClassImp(AliPHOS)
 
 ClassImp(AliPHOS)
+//____________________________________________________________________________
+AliPHOS:: AliPHOS() : AliDetector()
+{
+  // Create folder and task hierarchy
+  fName="PHOS";
+  CreatePHOSFolders();
+}
 
 //____________________________________________________________________________
 
 //____________________________________________________________________________
-AliPHOS::~AliPHOS()
+AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title) 
 {
 {
-  delete fHits ;
-  delete fDigits ;
+  // Create folder and task hierarchy
+  CreatePHOSFolders();
+}
+
+//____________________________________________________________________________
+void AliPHOS::CreatePHOSFolders()
+{
+  // create the ALICE TFolder
+  // create the ALICE TTasks
+  //  add the Alice QA TTAsks 
+  // create the ALICE main TFolder
+  //  add the Alice QA Alarms
+  // this should be done of course by AliRun
+
+  TFolder * alice = new TFolder(); 
+  alice->SetNameTitle("YSAlice", "Alice Folder") ; 
+  gROOT->GetListOfBrowsables()->Add(alice) ;
+
+  TFolder * aliceF  = alice->AddFolder("folders", "Alice memory Folder") ; 
+  //  make it the owner of the objects that it contains
+  aliceF->SetOwner() ;
+  // geometry folder 
+  TFolder * geomF = aliceF->AddFolder("Geometry", "Geometry objects") ; 
+  // alarms folder
+  TFolder * alarmsF = aliceF->AddFolder("QAAlarms", "Alarms raised by QA check") ; 
+  //  make it the owner of the objects that it contains
+  alarmsF->SetOwner() ;
+  TFolder * aliceT  = alice->AddFolder("tasks", "Alice tasks Folder") ; 
+  //  make it the owner of the objects that it contains
+  aliceT->SetOwner() ;
+
+  TTask * aliceQA = new TTask("QA", "Alice QA tasks") ;
+  aliceT->Add(aliceQA); 
+  TTask * aliceDi = new TTask("(S)Digitizer", "Alice SDigitizer & Digitizer") ;
+  aliceT->Add(aliceDi); 
+
+  TTask * aliceRe = new TTask("Reconstructioner", "Alice Reconstructioner") ;
+  aliceT->Add(aliceRe); 
+
+  char * tempo = new char[80] ; 
+
+  // creates the PHOSQA (QAChecker knows how to add itself in the tasks list)
+  sprintf(tempo, "%sCheckers container",GetName() ) ; 
+  fQATask = new AliPHOSQAChecker(GetName(), tempo);  
+
+  // creates the PHOS(S)Digitizer and adds it to alice main (S)Digitizer task 
+  sprintf(tempo, "%sDigitizers container",GetName() ) ; 
+  fSDTask = new TTask(GetName(), tempo);   
+  aliceDi->Add(fSDTask) ; 
+
+  // creates the PHOS reconstructioner and adds it to alice main Reconstructioner task 
+  sprintf(tempo, "%sReconstructioner container",GetName() ) ; 
+  fReTask = new TTask(GetName(), tempo); 
+  aliceRe->Add(fReTask) ; 
+
+  delete tempo ;  
+
+  // creates the PHOS geometry  folder
+  geomF->AddFolder("PHOS", "Geometry for PHOS") ; 
+  // creates the PHOSQA alarm folder
+  alarmsF->AddFolder("PHOS", "QA alarms from PHOS") ; 
+}
+//____________________________________________________________________________
+AliPHOS::~AliPHOS() 
+{  
+  // remove the alice folder and alice QA task that PHOS creates instead of AliRun
+  
+  // remove and delete the PHOS QA tasks
+  TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ; 
+  TTask * aliceQA = (TTask*)alice->FindObject("tasks/QA") ; 
+  fQATask->GetListOfTasks()->Delete() ;
+  aliceQA->GetListOfTasks()->Remove(fQATask) ; 
+  delete fQATask ;  
+  
+  // remove and delete aliceQA (should be done by AliRun) 
 }
 
 //____________________________________________________________________________
 }
 
 //____________________________________________________________________________
@@ -184,6 +274,8 @@ void AliPHOS::CreateMaterials()
 
   AliMixture(16, "ArCO2$", aGM, zGM, dGM,  2, wGM) ;
 
 
   AliMixture(16, "ArCO2$", aGM, zGM, dGM,  2, wGM) ;
 
+  // --- Stainless steel (let it be pure iron) ---
+  AliMaterial(17, "Steel$", 55.845, 26, 7.87, 1.76, 0., 0, 0) ;
  
   // --- Air ---
   AliMaterial(99, "Air$", 14.61, 7.3, 0.001205, 30420., 67500., 0, 0) ;
  
   // --- Air ---
   AliMaterial(99, "Air$", 14.61, 7.3, 0.001205, 30420., 67500., 0, 0) ;
@@ -260,6 +352,10 @@ void AliPHOS::CreateMaterials()
   AliMedium(16, "ArCo2      $", 16, 1,
             isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.01, 0, 0) ;
  
   AliMedium(16, "ArCo2      $", 16, 1,
             isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.01, 0, 0) ;
  
+  // Stainless steel                                                                -> idtmed[716]
+  AliMedium(17, "Steel     $", 17, 0,
+            isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 0, 0) ;
+
   // Air                                                                            -> idtmed[798] 
   AliMedium(99, "Air          $", 99, 0,
             isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
   // Air                                                                            -> idtmed[798] 
   AliMedium(99, "Air          $", 99, 0,
             isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
@@ -297,7 +393,41 @@ void AliPHOS::CreateMaterials()
   gMC->Gstpar(idtmed[715], "DRAY",0.) ;
   gMC->Gstpar(idtmed[715], "STRA",2.) ;
 
   gMC->Gstpar(idtmed[715], "DRAY",0.) ;
   gMC->Gstpar(idtmed[715], "STRA",2.) ;
 
+}
+//____________________________________________________________________________
+AliPHOSGeometry * AliPHOS::GetGeometry() const 
+{  
+  // gets the pointer to the AliPHOSGeometry unique instance from the folder
   
   
+  AliPHOSGeometry * rv ; 
+  
+  TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
+  TString path("folders/Geometry/PHOS/") ; 
+  path += GetTitle() ; 
+  rv = (AliPHOSGeometry*)alice->FindObject(path) ; 
+  if ( !rv )
+    rv = fGeom ; 
+  return rv ; 
+}
+
+//____________________________________________________________________________
+void AliPHOS::SetTreeAddress()
+{ 
+
 
 
+  // TBranch *branch;
+  //  AliDetector::SetTreeAddress();
+
+  TBranch *branch;
+  char branchname[20];
+  sprintf(branchname,"%s",GetName());
+  
+  // Branch address for hit tree
+  TTree *treeH = gAlice->TreeH();
+  if (treeH && fHits) {
+    branch = treeH->GetBranch(branchname);
+    if (branch) branch->SetAddress(&fHits);
+  }
 }
 }
+
+