]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDetector.cxx
New steering class ro run QA stand alone
[u/mrichter/AliRoot.git] / STEER / AliDetector.cxx
index 3acb9b0955933155c73d50cac033140d4e21278b..861207382106681165faf0760db228afd29cc7ff 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include <TBrowser.h>
+#include <TClonesArray.h>
 #include <TTree.h>
 
+#include "AliLog.h"
 #include "AliConfig.h"
 #include "AliDetector.h"
 #include "AliHit.h"
@@ -49,11 +51,14 @@ ClassImp(AliDetector)
  
 //_______________________________________________________________________
 AliDetector::AliDetector():
+  AliModule(),
   fTimeGate(200.e-9),
   fIshunt(0),
   fNhits(0),
   fNdigits(0),
   fBufferSize(1600),
+  fMaxIterHit(0),
+  fCurIterHit(0),
   fHits(0),
   fDigits(0),
   fPoints(0),
@@ -64,22 +69,6 @@ AliDetector::AliDetector():
   //
 }
  
-//_______________________________________________________________________
-AliDetector::AliDetector(const AliDetector &det):
-  AliModule(det),
-  fTimeGate(200.e-9),
-  fIshunt(0),
-  fNhits(0),
-  fNdigits(0),
-  fBufferSize(1600),
-  fHits(0),
-  fDigits(0),
-  fPoints(0),
-  fLoader(0x0)
-{
-  det.Copy(*this);
-}
-
 //_____________________________________________________________________________
 AliDetector::AliDetector(const char* name,const char *title):
   AliModule(name,title),
@@ -88,6 +77,8 @@ AliDetector::AliDetector(const char* name,const char *title):
   fNhits(0),
   fNdigits(0),
   fBufferSize(1600),
+  fMaxIterHit(0),
+  fCurIterHit(0),
   fHits(0),
   fDigits(0),
   fPoints(0),
@@ -140,6 +131,13 @@ void AliDetector::Publish(const char */*dir*/, void */*address*/, const char */*
   MayNotUse("Publish");
 }
 
+//_______________________________________________________________________
+void AliDetector::AddAlignableVolumes() const
+{
+  // 
+  AliWarning(Form("%s still has to implement the AddAlignableVolumes method!",GetName()));
+}
+
 //_______________________________________________________________________
 TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, 
                                        void* address, Int_t size,
@@ -159,17 +157,17 @@ TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name,
 // 
 //
 //
-// if (GetDebug()>1)
if(GetDebug()) Info("MakeBranch","Making Branch %s",name);
+    
AliDebug(2,Form("Making Branch %s",name));
  if (tree == 0x0) 
   {
-   Error("MakeBranch","Making Branch %s Tree is NULL",name);
+   AliError(Form("Making Branch %s Tree is NULL",name));
    return 0x0;
   }
  TBranch *branch = tree->GetBranch(name);
  if (branch) 
   {  
-    if(GetDebug()) Info("MakeBranch","Branch %s is already in tree.",name);
+    AliDebug(2,Form("Branch %s is already in tree.",name));
     return branch;
   }
     
@@ -179,9 +177,9 @@ TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name,
   } 
  else 
   {
-    branch = tree->Branch(name,address,size);
+    branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
   }
if(GetDebug()) Info("MakeBranch","Branch %s returning branch %#x",name,branch);
AliDebug(2,Form("Branch %s returning branch %#x",name,branch));
  return branch;
 }
 
@@ -204,15 +202,6 @@ void AliDetector::Browse(TBrowser *b)
   }
 }
 
-//_______________________________________________________________________
-void AliDetector::Copy(TObject &) const
-{
-  //
-  // Copy *this onto det -- not implemented
-  //
-  Fatal("Copy","Not implemented\n");
-}
-
 //_______________________________________________________________________
 void AliDetector::FinishRun()
 {
@@ -254,7 +243,7 @@ AliHit* AliDetector::NextHit()
     else        
       return 0;
   } else {
-    printf("* AliDetector::NextHit * Hit Iterator called without calling FistHit before\n");
+    AliWarning("Hit Iterator called without calling FistHit before");
     return 0;
   }
 }
@@ -267,7 +256,7 @@ void AliDetector::LoadPoints(Int_t)
   //
   if (fHits == 0) 
    {
-    Error("LoadPoints","fHits == 0. Name is %s",GetName());
+    AliError(Form("fHits == 0. Name is %s",GetName()));
     return;
    }
   //
@@ -299,7 +288,10 @@ void AliDetector::LoadPoints(Int_t)
   for (Int_t hit=0;hit<nhits;hit++) {
     ahit = dynamic_cast<AliHit*>(fHits->UncheckedAt(hit));
     trk=ahit->GetTrack();
-    if(trk>tracks) Fatal("LoadPoints","Found track number %d, max track %d\n",trk, tracks);
+    if(trk>tracks) {
+      AliError(Form("Found track number %d, max track %d",trk, tracks));
+      continue;
+    }
     if(ntrk[trk]==limi[trk])
      {
       //
@@ -326,11 +318,11 @@ void AliDetector::LoadPoints(Int_t)
   for(trk=0; trk<tracks; ++trk) {
     if(ntrk[trk]) {
       points = new AliPoints();
-      points->SetMarkerColor(GetMarkerColor());
-      points->SetMarkerSize(GetMarkerSize());
+      points->SetMarkerColor(3); //PH color=3 was set in AliModule
+      points->SetMarkerSize(1);  //PH size-1 is the default value
       points->SetDetector(this);
       points->SetParticle(trk);
-      points->SetPolyMarker(ntrk[trk],coor[trk],GetMarkerStyle());
+      points->SetPolyMarker(ntrk[trk],coor[trk],1);//PH style=1 is the default value
       fPoints->AddAt(points,trk);
       delete [] coor[trk];
       coor[trk]=0;
@@ -348,7 +340,7 @@ void AliDetector::MakeBranch(Option_t *option)
   // Create a new branch for this detector in its treeH
   //
 
-  if(GetDebug()) Info("MakeBranch"," for %s",GetName());
+  AliDebug(2,Form(" for %s",GetName()));
   const char *cH = strstr(option,"H");
 
   if (fHits && TreeH() && cH) 
@@ -405,12 +397,12 @@ void AliDetector::SetTreeAddress()
     branch = tree->GetBranch(GetName());
     if (branch) 
      {
-       if(GetDebug()) Info("SetTreeAddress","(%s) Setting for Hits",GetName());
+       AliDebug(2,Form("(%s) Setting for Hits",GetName()));
        branch->SetAddress(&fHits);
      }
     else
      { //can be invoked before branch creation
-       if(GetDebug()) Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
+       AliDebug(2,Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
      }
   }
   
@@ -421,8 +413,6 @@ void AliDetector::SetTreeAddress()
     branch = treeD->GetBranch(GetName());
     if (branch) branch->SetAddress(&fDigits);
   }
-  
-  AliModule::SetTreeAddress();
 }
 
 //_______________________________________________________________________
@@ -437,7 +427,7 @@ void AliDetector::MakeTree(Option_t *option)
     AliLoader* loader = GetLoader();
     if (loader == 0x0)
      {
-       Error("MakeTree","Can not get loader for %s",GetName());
+       AliError(Form("Can not get loader for %s",GetName()));
        return;
      }
     loader->MakeTree(option); //delegate this job to getter
@@ -449,10 +439,8 @@ AliLoader* AliDetector::MakeLoader(const char* topfoldername)
 //builds standard getter (AliLoader type)
 //if detector wants to use castomized getter, it must overload this method
 
- if (GetDebug())
-   Info("MakeLoader",
-        "Creating standard getter for detector %s. Top folder is %s.",
-         GetName(),topfoldername);
+ AliDebug(1,Form("Creating standard getter for detector %s. Top folder is %s.",
+         GetName(),topfoldername));
      
  fLoader = new AliLoader(GetName(),topfoldername);
  return fLoader;
@@ -465,7 +453,7 @@ TTree* AliDetector::TreeH() const
   if (GetLoader() == 0x0) 
     {
     //sunstitude this with make getter when we can obtain the event folder name 
-     Error("TreeH","Can not get the getter");
+     AliError("Can not get the getter");
      return 0x0;
     }