]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSFDigitizer.cxx
introducing SDD, SSD layer misal (Andrea) + helper methods for hierarchical alignment...
[u/mrichter/AliRoot.git] / ITS / AliITSFDigitizer.cxx
CommitLineData
7dab88d3 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
803d1ab0 16/* $Id$ */
7dab88d3 17
7d62fb64 18//////////////////////////////////////////////////////////////////
19// Class for fast reconstruction of recpoints //
20// //
21// //
22//////////////////////////////////////////////////////////////////
23
7dab88d3 24#include <stdlib.h>
7dab88d3 25#include <TTree.h>
7dab88d3 26
27#include <AliRun.h>
88cb7938 28#include <AliRunLoader.h>
29#include <AliLoader.h>
7dab88d3 30#include <AliRunDigitizer.h>
31
32#include "AliITSFDigitizer.h"
7dab88d3 33#include "AliITSgeom.h"
34#include "AliITSsimulationFastPoints.h"
35
36ClassImp(AliITSFDigitizer)
37
38//______________________________________________________________________
7537d03c 39AliITSFDigitizer::AliITSFDigitizer() : AliDigitizer(),
40fITS(0),
41fInit(kFALSE){
7dab88d3 42//
43// Default constructor.
44//
7dab88d3 45}
46//______________________________________________________________________
7537d03c 47AliITSFDigitizer::AliITSFDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr),
48fITS(0),
49fInit(kFALSE){
7dab88d3 50//
51// Standard constructor.
52//
7dab88d3 53}
7d62fb64 54//______________________________________________________________________
7537d03c 55AliITSFDigitizer::AliITSFDigitizer(const AliITSFDigitizer &rec):AliDigitizer(rec),
56fITS(rec.fITS),
57fInit(rec.fInit){
7d62fb64 58 // Copy constructor.
7d62fb64 59
60}
61//______________________________________________________________________
62AliITSFDigitizer& AliITSFDigitizer::operator=(const AliITSFDigitizer& /*source*/){
63
64 // Assignment operator. This is a function which is not allowed to be
65 // done.
66 Error("operator=","Assignment operator not allowed\n");
67 return *this;
68}
69
7dab88d3 70//______________________________________________________________________
71AliITSFDigitizer::~AliITSFDigitizer(){
72//
73// Default destructor.
74//
75 fITS = 0; // don't delete fITS. Done else where.
76}
77//______________________________________________________________________
78Bool_t AliITSFDigitizer::Init(){
79//
80// Initialization.
81// loads ITS and ITSgeom.
82// Inputs:
83// none.
84// Outputs:
85// none.
86
87
88 fInit = kFALSE;
89 if(!gAlice) {
90 fITS = 0;
91 Warning("Init","gAlice not found");
92 return fInit;
93 }
94 fITS = (AliITS *)(gAlice->GetDetector("ITS"));
95 if(!fITS){
96 Warning("Init","ITS not found");
97 return fInit;
98 }
99 if(!fITS->GetITSgeom()){
100 Warning("Init","ITS geometry not found");
101 return fInit;
102 }
103 return fInit = kTRUE;
104}
105////////////////////////////////////////////////////////////////////////
106void AliITSFDigitizer::Exec(Option_t* opt){
107//
108// Main digitization function.
109// Inputs:
110// Option_t * opt "deb" ... more verbose output
111//
112
ac74f489 113 AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
114 AliRunLoader* outrl = AliRunLoader::GetRunLoader(
115 fManager->GetOutputFolderName());
116 if (outrl == 0x0){
117 Error("Exec","Can not find Run Loader in output folder.");
118 return;
119 }
120 AliLoader* outgime = outrl->GetLoader("ITSLoader");
121 if (outgime == 0x0){
122 Error("Exec","Can not get TOF Loader from Output Run Loader.");
123 return;
124 }
8574bce2 125 if(strstr(opt,"deb")){
ac74f489 126 Info("Exec","sim=%p, outrl=%p, outgime=%p",sim,outrl,outgime);
127 }
128 TTree* outputTreeR = outgime->TreeR();
129 if (outputTreeR == 0x0){
130 outgime->MakeTree("R");
131 outputTreeR = outgime->TreeR();
132 }
7d62fb64 133
134 TClonesArray* recPoints = new TClonesArray("AliITSRecPoint",1000);
135 TBranch* branch = outputTreeR->GetBranch("ITSRecPointsF");
136 if(branch) branch->SetAddress(recPoints);
137 else outputTreeR->Branch("ITSRecPointsF",&recPoints);
ac74f489 138 Int_t nModules;
139 fITS->InitModules(-1,nModules);
7dab88d3 140
141// load hits into modules
ac74f489 142 for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++){
143 AliRunLoader* rl = AliRunLoader::GetRunLoader(
144 fManager->GetInputFolderName(iFile));
145 if (rl == 0x0){
146 Error("Exec","Can not find Run Loader in input %d folder.",iFile);
147 return;
148 }
7dab88d3 149
ac74f489 150 AliLoader* gime = rl->GetLoader("ITSLoader");
151 if (gime == 0x0){
152 Error("Exec","Can not get TOF Loader from Input %d Run Loader.",
153 iFile);
154 return;
155 }
88cb7938 156
ac74f489 157 gime->LoadHits();
158 fITS->FillModules(gime->TreeH(),fManager->GetMask(iFile));
159 gime->UnloadHits();
160 }
7dab88d3 161
162// transform hits to fast rec points
163
ac74f489 164 AliITSgeom *geom = fITS->GetITSgeom();
165 for(Int_t moduleIndex = 0; moduleIndex<geom->GetIndexMax(); moduleIndex++){
7d62fb64 166 sim->CreateFastRecPoints(moduleIndex,recPoints);
ac74f489 167 outputTreeR->Fill();
7d62fb64 168 recPoints->Clear();
ac74f489 169 }
170 outrl->WriteRecPoints("OVERWRITE");
88cb7938 171// outputTreeR->AutoSave();
7dab88d3 172}
173////////////////////////////////////////////////////////////////////////