]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSFDigitizer.cxx
Modified plots and made jet finder use SDigits
[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
18#include <stdlib.h>
4ae5bbc4 19#include <Riostream.h>
7dab88d3 20#include <TObjArray.h>
21#include <TClonesArray.h>
22#include <TTree.h>
23#include <TBranch.h>
24#include <TFile.h>
25
26#include <AliRun.h>
88cb7938 27#include <AliRunLoader.h>
28#include <AliLoader.h>
7dab88d3 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
37ClassImp(AliITSFDigitizer)
38
39//______________________________________________________________________
40AliITSFDigitizer::AliITSFDigitizer() : AliDigitizer(){
41//
42// Default constructor.
43//
44 fITS = 0;
45 fInit = kFALSE;
46}
47//______________________________________________________________________
48AliITSFDigitizer::AliITSFDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){
49//
50// Standard constructor.
51//
52 fITS = 0;
53 fInit = kFALSE;
54}
55//______________________________________________________________________
56AliITSFDigitizer::~AliITSFDigitizer(){
57//
58// Default destructor.
59//
60 fITS = 0; // don't delete fITS. Done else where.
61}
62//______________________________________________________________________
63Bool_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////////////////////////////////////////////////////////////////////////
91void AliITSFDigitizer::Exec(Option_t* opt){
92//
93// Main digitization function.
94// Inputs:
95// Option_t * opt "deb" ... more verbose output
96//
97
ac74f489 98 AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
99 AliRunLoader* outrl = AliRunLoader::GetRunLoader(
100 fManager->GetOutputFolderName());
101 if (outrl == 0x0){
102 Error("Exec","Can not find Run Loader in output folder.");
103 return;
104 }
105 AliLoader* outgime = outrl->GetLoader("ITSLoader");
106 if (outgime == 0x0){
107 Error("Exec","Can not get TOF Loader from Output Run Loader.");
108 return;
109 }
8574bce2 110 if(strstr(opt,"deb")){
ac74f489 111 Info("Exec","sim=%p, outrl=%p, outgime=%p",sim,outrl,outgime);
112 }
113 TTree* outputTreeR = outgime->TreeR();
114 if (outputTreeR == 0x0){
115 outgime->MakeTree("R");
116 outputTreeR = outgime->TreeR();
117 }
118 TClonesArray *recPoints = fITS->RecPoints();
7dab88d3 119// TBranch *branch =
ac74f489 120 fITS->MakeBranchInTree(outputTreeR,"ITSRecPointsF",&recPoints,4000,0);
7dab88d3 121
ac74f489 122 Int_t nModules;
123 fITS->InitModules(-1,nModules);
7dab88d3 124
125// load hits into modules
ac74f489 126 for (Int_t iFile = 0; iFile < fManager->GetNinputs(); iFile++){
127 AliRunLoader* rl = AliRunLoader::GetRunLoader(
128 fManager->GetInputFolderName(iFile));
129 if (rl == 0x0){
130 Error("Exec","Can not find Run Loader in input %d folder.",iFile);
131 return;
132 }
7dab88d3 133
ac74f489 134 AliLoader* gime = rl->GetLoader("ITSLoader");
135 if (gime == 0x0){
136 Error("Exec","Can not get TOF Loader from Input %d Run Loader.",
137 iFile);
138 return;
139 }
88cb7938 140
ac74f489 141 gime->LoadHits();
142 fITS->FillModules(gime->TreeH(),fManager->GetMask(iFile));
143 gime->UnloadHits();
144 }
7dab88d3 145
146// transform hits to fast rec points
147
ac74f489 148 AliITSgeom *geom = fITS->GetITSgeom();
149 for(Int_t moduleIndex = 0; moduleIndex<geom->GetIndexMax(); moduleIndex++){
150 sim->CreateFastRecPoints(moduleIndex);
151// branch->Fill();
152 outputTreeR->Fill();
153 fITS->ResetRecPoints();
154 }
155 outrl->WriteRecPoints("OVERWRITE");
88cb7938 156// outputTreeR->AutoSave();
7dab88d3 157}
158////////////////////////////////////////////////////////////////////////