]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSFDigitizer.cxx
Added macro for visualization of the TOF ROOT geometry
[u/mrichter/AliRoot.git] / ITS / AliITSFDigitizer.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15  
16 /*
17 $Log$
18 */
19
20 #include <stdlib.h>
21 #include <iostream.h>
22 #include <TObjArray.h>
23 #include <TClonesArray.h>
24 #include <TTree.h>
25 #include <TBranch.h>
26 #include <TFile.h>
27
28 #include <AliRun.h>
29 #include <AliRunDigitizer.h>
30
31 #include "AliITSFDigitizer.h"
32 // #include "AliITSpList.h"
33 #include "AliITSmodule.h"
34 #include "AliITSgeom.h"
35 #include "AliITSsimulationFastPoints.h"
36
37 ClassImp(AliITSFDigitizer)
38
39 //______________________________________________________________________
40 AliITSFDigitizer::AliITSFDigitizer() : AliDigitizer(){
41 //
42 // Default constructor.
43 //
44     fITS      = 0;
45     fInit     = kFALSE;
46 }
47 //______________________________________________________________________
48 AliITSFDigitizer::AliITSFDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){
49 //
50 // Standard constructor.
51 //
52     fITS      = 0;
53     fInit     = kFALSE;
54 }
55 //______________________________________________________________________
56 AliITSFDigitizer::~AliITSFDigitizer(){
57 //
58 // Default destructor. 
59 //
60     fITS = 0; // don't delete fITS. Done else where.
61 }
62 //______________________________________________________________________
63 Bool_t AliITSFDigitizer::Init(){
64 //
65 // Initialization. 
66 // loads ITS and ITSgeom.
67 // Inputs:
68 //      none.
69 // Outputs:
70 //      none.
71
72   
73   fInit = kFALSE;
74   if(!gAlice) {
75     fITS      = 0;
76     Warning("Init","gAlice not found");
77     return fInit;
78   }
79   fITS = (AliITS *)(gAlice->GetDetector("ITS"));
80   if(!fITS){
81     Warning("Init","ITS not found");
82     return fInit;
83   } 
84   if(!fITS->GetITSgeom()){
85     Warning("Init","ITS geometry not found");
86     return fInit;
87   }
88   return fInit = kTRUE;
89 }
90 ////////////////////////////////////////////////////////////////////////
91 void AliITSFDigitizer::Exec(Option_t* opt){
92 //
93 // Main digitization function. 
94 // Inputs:
95 //      Option_t * opt  "deb" ... more verbose output 
96 //
97
98   AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
99
100   TTree *outputTreeR = fManager->GetTreeR();
101   TClonesArray *recPoints = fITS->RecPoints();
102 //  TBranch *branch =
103       fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF",
104                                            &recPoints,4000,0);
105   
106   Int_t nModules;
107   fITS->InitModules(-1,nModules);
108
109 // load hits into modules
110
111   for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++) {
112     fITS->FillModules(fManager->GetInputTreeH(iFile),
113                       fManager->GetMask(iFile));
114   }
115   
116 // transform hits to fast rec points
117
118   AliITSgeom *geom = fITS->GetITSgeom();
119   for(Int_t moduleIndex = 0; moduleIndex < geom->GetIndexMax(); moduleIndex++){
120     sim->CreateFastRecPoints(moduleIndex);
121 //    branch->Fill();
122     outputTreeR->Fill();
123     fITS->ResetRecPoints();
124   }
125   outputTreeR->AutoSave();
126
127 }
128 ////////////////////////////////////////////////////////////////////////