]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSFDigitizer.cxx
Merging the VirtualMC branch to the main development branch (HEAD)
[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 Revision 1.1.2.1  2002/07/24 09:27:50  alibrary
19 Updating on VirtualMC
20
21 Revision 1.1  2002/06/10 17:32:17  nilsen
22 New Fastpoint merger added.
23
24 */
25
26 #include <stdlib.h>
27 #include <iostream.h>
28 #include <TObjArray.h>
29 #include <TClonesArray.h>
30 #include <TTree.h>
31 #include <TBranch.h>
32 #include <TFile.h>
33
34 #include <AliRun.h>
35 #include <AliRunDigitizer.h>
36
37 #include "AliITSFDigitizer.h"
38 // #include "AliITSpList.h"
39 #include "AliITSmodule.h"
40 #include "AliITSgeom.h"
41 #include "AliITSsimulationFastPoints.h"
42
43 ClassImp(AliITSFDigitizer)
44
45 //______________________________________________________________________
46 AliITSFDigitizer::AliITSFDigitizer() : AliDigitizer(){
47 //
48 // Default constructor.
49 //
50     fITS      = 0;
51     fInit     = kFALSE;
52 }
53 //______________________________________________________________________
54 AliITSFDigitizer::AliITSFDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){
55 //
56 // Standard constructor.
57 //
58     fITS      = 0;
59     fInit     = kFALSE;
60 }
61 //______________________________________________________________________
62 AliITSFDigitizer::~AliITSFDigitizer(){
63 //
64 // Default destructor. 
65 //
66     fITS = 0; // don't delete fITS. Done else where.
67 }
68 //______________________________________________________________________
69 Bool_t AliITSFDigitizer::Init(){
70 //
71 // Initialization. 
72 // loads ITS and ITSgeom.
73 // Inputs:
74 //      none.
75 // Outputs:
76 //      none.
77
78   
79   fInit = kFALSE;
80   if(!gAlice) {
81     fITS      = 0;
82     Warning("Init","gAlice not found");
83     return fInit;
84   }
85   fITS = (AliITS *)(gAlice->GetDetector("ITS"));
86   if(!fITS){
87     Warning("Init","ITS not found");
88     return fInit;
89   } 
90   if(!fITS->GetITSgeom()){
91     Warning("Init","ITS geometry not found");
92     return fInit;
93   }
94   return fInit = kTRUE;
95 }
96 ////////////////////////////////////////////////////////////////////////
97 void AliITSFDigitizer::Exec(Option_t* opt){
98 //
99 // Main digitization function. 
100 // Inputs:
101 //      Option_t * opt  "deb" ... more verbose output 
102 //
103
104   AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
105
106   TTree *outputTreeR = fManager->GetTreeR();
107   TClonesArray *recPoints = fITS->RecPoints();
108 //  TBranch *branch =
109       fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF",
110                                            &recPoints,4000,0);
111   
112   Int_t nModules;
113   fITS->InitModules(-1,nModules);
114
115 // load hits into modules
116
117   for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++) {
118     fITS->FillModules(fManager->GetInputTreeH(iFile),
119                       fManager->GetMask(iFile));
120   }
121   
122 // transform hits to fast rec points
123
124   AliITSgeom *geom = fITS->GetITSgeom();
125   for(Int_t moduleIndex = 0; moduleIndex < geom->GetIndexMax(); moduleIndex++){
126     sim->CreateFastRecPoints(moduleIndex);
127 //    branch->Fill();
128     outputTreeR->Fill();
129     fITS->ResetRecPoints();
130   }
131   outputTreeR->AutoSave();
132
133 }
134 ////////////////////////////////////////////////////////////////////////