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 <TSeqCollection.h>
24 #include <TClonesArray.h>
26 #include "AliHeader.h"
30 #include "AliITSsDigitize.h"
31 #include "AliITSgeom.h"
33 ClassImp(AliITSsDigitize)
34 //______________________________________________________________________
35 AliITSsDigitize::AliITSsDigitize(){
36 // Default constructor.
42 // A zero-ed constructed AliITSsDigitize class.
47 fDet[0] = fDet[1] = fDet[2] = kTRUE;
50 //______________________________________________________________________
51 AliITSsDigitize::AliITSsDigitize(const char* filename){
52 // Standard constructor.
54 // const char* filename filename containing the digits to be
55 // reconstructed. If filename = 0 (nil)
56 // then no file is opened but a file is
57 // assumed to already be opened. This
58 // already opened file will be used.
62 // A standardly constructed AliITSsDigitize class.
67 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
68 if(fFile) fFile->Close();
69 fFile = new TFile(fFilename.Data(),"UPDATE");
75 gAlice = (AliRun*)fFile->Get("gAlice");
77 cout << "gAlice not found on file. Aborting." << endl;
81 } // end if !filename.
85 //______________________________________________________________________
86 AliITSsDigitize::~AliITSsDigitize(){
87 // Default constructor.
93 // A destroyed AliITSsDigitize class.
95 if(fFile) fFile->Close();
100 //______________________________________________________________________
101 Bool_t AliITSsDigitize::Init(){
108 // kTRUE if no errors initilizing this class occurse else kFALSE
111 fITS = (AliITS*) gAlice->GetDetector("ITS");
113 cout << "ITS not found aborting. fITS=" << fITS << endl;
117 if(!(fITS->GetITSgeom())){
118 cout << "ITSgeom not found aborting."<< endl;
121 } // end if !GetITSgeom()
122 // Now ready to init.
124 fDet[0] = fDet[1] = fDet[2] = kTRUE;
126 fEnt = gAlice->GetEventsPerRun();
128 if(!gAlice->TreeS()){
129 cout << "Having to create the SDigits Tree." << endl;
130 gAlice->MakeTree("S");
131 } // end if !gAlice->TreeS()
133 fITS->MakeBranch("S");
134 fITS->SetTreeAddress();
135 nparticles = gAlice->GetEvent(fEnt0);
141 //______________________________________________________________________
142 Bool_t AliITSsDigitize::InitSDig(){
143 // Sets up SDigitization part of AliITSDetType..
154 //______________________________________________________________________
155 void AliITSsDigitize::Exec(const Option_t *opt){
156 // Main SDigitization function.
158 // Option_t * opt list of subdetector to digitize. =0 all.
164 // Int_t nparticles,evnt;
166 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
167 fDet[0] = fDet[1] = fDet[2] = kTRUE;
170 fDet[0] = fDet[1] = fDet[2] = kFALSE;
171 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
172 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
173 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
174 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
176 } // end if strstr(opt,...)
179 cout << "Initilization Failed, Can't run Exec." << endl;
183 fITS->HitsToSDigits(gAlice->GetHeader()->GetEvent(),0,-1," ",lopt," ");