]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSFDigitizer.cxx
modifications to satisfy the coding conventions
[u/mrichter/AliRoot.git] / ITS / AliITSFDigitizer.cxx
index f57ca900ec132e47367db43abaa11766546e5b22..e67e5ce1da3a6209ad3cdbc49dbb656eb6098295 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
  
-/*
-$Log$
-Revision 1.2  2002/10/14 14:57:00  hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
+/* $Id$ */
 
-Revision 1.1.2.1  2002/07/24 09:27:50  alibrary
-Updating on VirtualMC
-
-Revision 1.1  2002/06/10 17:32:17  nilsen
-New Fastpoint merger added.
-
-*/
+//////////////////////////////////////////////////////////////////
+// Class for fast reconstruction of recpoints                   //
+//                                                              //
+//                                                              //
+//////////////////////////////////////////////////////////////////
 
 #include <stdlib.h>
-#include <Riostream.h>
-#include <TObjArray.h>
-#include <TClonesArray.h>
 #include <TTree.h>
-#include <TBranch.h>
-#include <TFile.h>
 
 #include <AliRun.h>
+#include <AliRunLoader.h>
+#include <AliLoader.h>
 #include <AliRunDigitizer.h>
 
 #include "AliITSFDigitizer.h"
-// #include "AliITSpList.h"
-#include "AliITSmodule.h"
 #include "AliITSgeom.h"
 #include "AliITSsimulationFastPoints.h"
 
 ClassImp(AliITSFDigitizer)
 
 //______________________________________________________________________
-AliITSFDigitizer::AliITSFDigitizer() : AliDigitizer(){
+AliITSFDigitizer::AliITSFDigitizer() : AliDigitizer(),
+fITS(0),
+fInit(kFALSE){
 //
 // Default constructor.
 //
-    fITS      = 0;
-    fInit     = kFALSE;
 }
 //______________________________________________________________________
-AliITSFDigitizer::AliITSFDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){
+AliITSFDigitizer::AliITSFDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr),
+fITS(0),
+fInit(kFALSE){
 //
 // Standard constructor.
 //
-    fITS      = 0;
-    fInit     = kFALSE;
 }
+//______________________________________________________________________
+AliITSFDigitizer::AliITSFDigitizer(const AliITSFDigitizer &rec):AliDigitizer(rec),
+fITS(rec.fITS),
+fInit(rec.fInit){
+    // Copy constructor. 
+  
+}
+//______________________________________________________________________
+AliITSFDigitizer& AliITSFDigitizer::operator=(const AliITSFDigitizer& /*source*/){
+
+    // Assignment operator. This is a function which is not allowed to be
+    // done.
+    Error("operator=","Assignment operator not allowed\n");
+    return *this; 
+}
+
 //______________________________________________________________________
 AliITSFDigitizer::~AliITSFDigitizer(){
 //
@@ -104,34 +110,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();
-//  TBranch *branch =
-      fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF",
-                                          &recPoints,4000,0);
-  
-  Int_t nModules;
-  fITS->InitModules(-1,nModules);
+    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 = new TClonesArray("AliITSRecPoint",1000);
+    TBranch* branch = outputTreeR->GetBranch("ITSRecPointsF");
+    if(branch) branch->SetAddress(recPoints);
+    else outputTreeR->Branch("ITSRecPointsF",&recPoints);
+    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,recPoints);
+       outputTreeR->Fill();
+       recPoints->Clear();
+    }
+    outrl->WriteRecPoints("OVERWRITE");
+//  outputTreeR->AutoSave();
 }
 ////////////////////////////////////////////////////////////////////////