1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
22 #include <TObjArray.h>
27 #include <AliRunDigitizer.h>
29 #include "AliITSDigitizer.h"
30 #include "AliITShit.h"
31 #include "AliITSmodule.h"
32 #include "AliITSsimulation.h"
33 #include "AliITSDetType.h"
34 #include "AliITSgeom.h"
36 ClassImp(AliITSDigitizer)
38 //______________________________________________________________________
39 AliITSDigitizer::AliITSDigitizer() : AliDigitizer(){
40 // Default constructor. Assign fITS since it is never written out from
43 // Option_t * opt Not used
47 // A blank AliITSDigitizer class.
51 //______________________________________________________________________
52 AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){
53 // Standard constructor. Assign fITS since it is never written out from
56 // Option_t * opt Not used
60 // An AliItSDigitizer class.
64 //______________________________________________________________________
65 AliITSDigitizer::~AliITSDigitizer(){
66 // Default destructor.
68 // Option_t * opt Not used
74 fITS = 0; // don't delete fITS. Done else where.
77 //______________________________________________________________________
78 Bool_t AliITSDigitizer::Init(){
87 // if(GetHits()) fITS->fHits = new TClonesArray("AliITSHit",1000);
90 //______________________________________________________________________
91 void AliITSDigitizer::Exec(Option_t* opt){
92 // Main digitizing function.
94 // Option_t * opt list of subdetector to digitize. =0 all.
99 Int_t size=0,ifls=0,trk=0,ntracks=0,h=0,nhit=0;
103 char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
105 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
107 if(!det[0] && !det[1] && !det[2]) all = "All";
109 AliITSsimulation *sim = 0;
110 AliITSDetType *iDetType = 0;
111 AliITSmodule *mod = 0;
112 Int_t id=0,module=0,nfls=0,mask=0;
113 static Bool_t setDef=kTRUE;
115 if(!fITS) fITS = (AliITS*)(gAlice->GetDetector("ITS"));
116 if(!(fITS->GetITSgeom())){
117 Warning("Exec","Need ITS geometry to be properly defined first.");
118 return; // need transformations to do digitization.
119 } // end if !GetITSgeom()
120 if (setDef) fITS->SetDefaultSimulation();
122 sprintf(name,"%s",fITS->GetName());
124 fITS->InitModules(0,size);
127 nfls = GetManager()->GetNinputs();
128 for(ifls=0;ifls<nfls;ifls++){
129 treeH = GetManager()->GetInputTreeH(ifls);
130 if(!(treeH && GetHits())) continue;
131 brchHits = treeH->GetBranch(name);
134 fITS->SetHitsAddressBranch(brchHits);
136 Error("Exec","branch ITS not found");
139 ntracks = (Int_t) treeH->GetEntries();
140 for(trk=0;trk<ntracks;trk++){
142 brchHits->GetEntry(trk);
143 nhit = GetHits()->GetEntries();
144 mask = GetManager()->GetMask(ifls);
147 mod = GetModule(itsHit->GetModule());
148 id = fITS->GetITSgeom()->GetModuleType(module);
149 if (!all && !det[id]) continue;
150 mod->AddHit(itsHit,trk+mask,h);
156 fITS->MakeBranchInTreeD(GetManager()->GetTreeD());
157 for(module=0;module<size;module++){
158 id = fITS->GetITSgeom()->GetModuleType(module);
159 if (!all && !det[id]) continue;
160 iDetType = fITS->DetType(id);
161 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
163 Error("Exec","The simulation class was not instanciated!");
166 mod = GetModule(module);
167 sim->DigitiseModule(mod,module,0);
168 // fills all branches - wasted disk space
169 GetManager()->GetTreeD()->Fill();
173 fITS->ClearModules();
175 GetManager()->GetTreeD()->GetEntries();
176 GetManager()->GetTreeD()->Write(0,TObject::kOverwrite);
178 GetManager()->GetTreeD()->Reset();