]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - BCM/AliBCM.cxx
change to prepare for the faster SDD cluster finder (offline). Will be
[u/mrichter/AliRoot.git] / BCM / AliBCM.cxx
index 4bf2ef112268bf589cc11eeab6799fd794154079..5fda6f7b4e812d167734b747c80c0ccfc213766f 100644 (file)
 //  andreas.morsch@cern.ch                                                   // 
 ///////////////////////////////////////////////////////////////////////////////
  
-#include <TVirtualMC.h>
 #include <TClonesArray.h>
+#include <TGeoCompositeShape.h>
+#include <TGeoGlobalMagField.h>
+#include <TGeoManager.h>
 #include <TGeoMaterial.h>
-#include <TGeoMedium.h>
-#include <TGeoVolume.h>
 #include <TGeoMatrix.h>
+#include <TGeoMedium.h>
 #include <TGeoPgon.h>
+#include <TGeoVolume.h>
 #include <TGeoXtru.h>
-#include <TGeoCompositeShape.h>
-#include <TGeoManager.h>
+#include <TVirtualMC.h>
 
 #include "AliBCM.h"
 #include "AliBCMHit.h"
+#include "AliBCMLoader.h"
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliMC.h"
@@ -76,7 +78,7 @@ void AliBCM::StepManager()
 //    
 
     static Float_t edepT;    
-    static Double_t xh[3] = {0., 0., 0.};
+    static Double_t xh[4] = {0., 0., 0., 0.};
     Float_t edep = 0.;
     Int_t   copy = -1; 
     
@@ -88,7 +90,8 @@ void AliBCM::StepManager()
        // Entering
        if (gMC->IsTrackEntering()) {
            edepT = 0.;
-           gMC->TrackPosition(xh[0],xh[1],xh[2]); 
+           gMC->TrackPosition(xh[0],xh[1],xh[2]);
+           xh[3] = gMC->TrackTime();
        }
        
        //
@@ -167,8 +170,8 @@ void AliBCM::CreateMaterials()
     Float_t tmaxfd = -20. ;  // Maximum angle due to field deflection 
     Float_t deemax = -.01;   // Maximum fractional energy loss, DLS 
     Float_t stmin  = -.8;
-    Int_t   isxfld = gAlice->Field()->Integ();
-    Float_t sxmgmx = gAlice->Field()->Max();
+    Int_t   isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+    Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
 
     AliMaterial(1, "PCD", 12.011, 6., rho, radl, absl);
     //
@@ -208,10 +211,10 @@ void AliBCM::MakeBranch(Option_t* option)
 //  const char *cR = strstr(option,"R");
 //  const char *cS = strstr(option,"S");
 
-  if(cH && TreeH() && (fHits == 0x0)){
+  if(cH && fLoader->TreeH() && (fHits == 0x0)){
       fHits  = new TClonesArray("AliBCMHit");
       fNhits = 0;    
-      MakeBranchInTree(TreeH(), "BCM" ,&fHits ,kBufSize, 0);
+      MakeBranchInTree(fLoader->TreeH(), "BCM" ,&fHits ,kBufSize, 0);
   }
   AliDetector::MakeBranch(option);
 }
@@ -220,7 +223,17 @@ void AliBCM::SetTreeAddress()
 {
   // Set branch address
 
-    if (TreeH() && fHits==0x0)
+    if (fLoader->TreeH() && fHits==0x0)
        fHits   = new TClonesArray("AliBCMHit",  4000);
     AliDetector::SetTreeAddress();
 }
+
+//_____________________________________________________________________________
+AliLoader* AliBCM::MakeLoader(const char* topfoldername)
+{ 
+  //
+  // Builds BCM getter (AliLoader type)
+  AliDebug(1,Form("Creating AliBCMLoader, Top folder is %s ",topfoldername));
+  fLoader = new AliBCMLoader(GetName(),topfoldername);
+  return fLoader;
+}