]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSFDigitizer.cxx
Mods for the xlc compiler on the Mac OS X
[u/mrichter/AliRoot.git] / ITS / AliITSFDigitizer.cxx
index 6cabedf291461d6d40b3a70cb1d75125362f2d56..26cf0108301109d200146f947c764a4c3957dc9d 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
  
-/*
-$Log$
-*/
+/* $Id$ */
 
 #include <stdlib.h>
-#include <iostream.h>
+#include <Riostream.h>
 #include <TObjArray.h>
 #include <TClonesArray.h>
 #include <TTree.h>
@@ -26,6 +24,8 @@ $Log$
 #include <TFile.h>
 
 #include <AliRun.h>
+#include <AliRunLoader.h>
+#include <AliLoader.h>
 #include <AliRunDigitizer.h>
 
 #include "AliITSFDigitizer.h"
@@ -95,34 +95,64 @@ void AliITSFDigitizer::Exec(Option_t* opt){
 //      Option_t * opt  "deb" ... more verbose output 
 //
 
-  AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
-
-  TTree *outputTreeR = fManager->GetTreeR();
-  TClonesArray *recPoints = fITS->RecPoints();
+    AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
+    AliRunLoader* outrl = AliRunLoader::GetRunLoader(
+                                        fManager->GetOutputFolderName());
+    if (outrl == 0x0){
+       Error("Exec","Can not find Run Loader in output folder.");
+       return;
+    }
+    AliLoader* outgime = outrl->GetLoader("ITSLoader");
+    if (outgime == 0x0){
+       Error("Exec","Can not get TOF Loader from Output Run Loader.");
+       return;
+    }
+    if(strstr(opt,"deb")){
+       Info("Exec","sim=%p, outrl=%p, outgime=%p",sim,outrl,outgime);
+    }
+    TTree* outputTreeR = outgime->TreeR();
+    if (outputTreeR == 0x0){
+       outgime->MakeTree("R");
+       outputTreeR = outgime->TreeR();
+    }
+    TClonesArray *recPoints = fITS->RecPoints();
 //  TBranch *branch =
-      fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF",
-                                          &recPoints,4000,0);
+    fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF",&recPoints,4000,0);
   
-  Int_t nModules;
-  fITS->InitModules(-1,nModules);
+    Int_t nModules;
+    fITS->InitModules(-1,nModules);
 
 // load hits into modules
+    for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++){
+       AliRunLoader* rl = AliRunLoader::GetRunLoader(
+                                       fManager->GetInputFolderName(iFile));
+       if (rl == 0x0){
+           Error("Exec","Can not find Run Loader in input %d folder.",iFile);
+           return;
+       }
 
-  for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++) {
-    fITS->FillModules(fManager->GetInputTreeH(iFile),
-                     fManager->GetMask(iFile));
-  }
+       AliLoader* gime = rl->GetLoader("ITSLoader");
+       if (gime == 0x0){
+           Error("Exec","Can not get TOF Loader from Input %d Run Loader.",
+                 iFile);
+           return;
+       }
+
+       gime->LoadHits();
+       fITS->FillModules(gime->TreeH(),fManager->GetMask(iFile));
+       gime->UnloadHits();
+    }
   
 // transform hits to fast rec points
 
-  AliITSgeom *geom = fITS->GetITSgeom();
-  for(Int_t moduleIndex = 0; moduleIndex < geom->GetIndexMax(); moduleIndex++){
-    sim->CreateFastRecPoints(moduleIndex);
-//    branch->Fill();
-    outputTreeR->Fill();
-    fITS->ResetRecPoints();
-  }
-  outputTreeR->AutoSave();
-
+    AliITSgeom *geom = fITS->GetITSgeom();
+    for(Int_t moduleIndex = 0; moduleIndex<geom->GetIndexMax(); moduleIndex++){
+       sim->CreateFastRecPoints(moduleIndex);
+//      branch->Fill();
+       outputTreeR->Fill();
+       fITS->ResetRecPoints();
+    }
+    outrl->WriteRecPoints("OVERWRITE");
+//  outputTreeR->AutoSave();
 }
 ////////////////////////////////////////////////////////////////////////