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 **************************************************************************/
18 Revision 1.1 2002/03/28 16:25:26 nilsen
19 New TTask method for creating SDigits from Hits.
27 #include <TSeqCollection.h>
29 #include <TClonesArray.h>
31 #include "AliHeader.h"
35 #include "AliITSsDigitize.h"
36 #include "AliITSgeom.h"
38 ClassImp(AliITSsDigitize)
39 //______________________________________________________________________
40 AliITSsDigitize::AliITSsDigitize(){
41 // Default constructor.
47 // A zero-ed constructed AliITSsDigitize class.
52 fDet[0] = fDet[1] = fDet[2] = kTRUE;
55 //______________________________________________________________________
56 AliITSsDigitize::AliITSsDigitize(const char* filename){
57 // Standard constructor.
59 // const char* filename filename containing the digits to be
60 // reconstructed. If filename = 0 (nil)
61 // then no file is opened but a file is
62 // assumed to already be opened. This
63 // already opened file will be used.
67 // A standardly constructed AliITSsDigitize class.
72 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
73 if(fFile) fFile->Close();
74 fFile = new TFile(fFilename.Data(),"UPDATE");
80 gAlice = (AliRun*)fFile->Get("gAlice");
82 cout << "gAlice not found on file. Aborting." << endl;
86 } // end if !filename.
90 //______________________________________________________________________
91 AliITSsDigitize::~AliITSsDigitize(){
92 // Default constructor.
98 // A destroyed AliITSsDigitize class.
100 if(fFile) fFile->Close();
105 //______________________________________________________________________
106 Bool_t AliITSsDigitize::Init(){
113 // kTRUE if no errors initilizing this class occurse else kFALSE
116 fITS = (AliITS*) gAlice->GetDetector("ITS");
118 cout << "ITS not found aborting. fITS=" << fITS << endl;
122 if(!(fITS->GetITSgeom())){
123 cout << "ITSgeom not found aborting."<< endl;
126 } // end if !GetITSgeom()
127 // Now ready to init.
129 fDet[0] = fDet[1] = fDet[2] = kTRUE;
131 fEnt = gAlice->GetEventsPerRun();
133 if(!gAlice->TreeS()){
134 cout << "Having to create the SDigits Tree." << endl;
135 gAlice->MakeTree("S");
136 } // end if !gAlice->TreeS()
138 fITS->MakeBranch("S");
139 fITS->SetTreeAddress();
140 nparticles = gAlice->GetEvent(fEnt0);
146 //______________________________________________________________________
147 Bool_t AliITSsDigitize::InitSDig(){
148 // Sets up SDigitization part of AliITSDetType..
159 //______________________________________________________________________
160 void AliITSsDigitize::Exec(const Option_t *opt){
161 // Main SDigitization function.
163 // Option_t * opt list of subdetector to digitize. =0 all.
169 // Int_t nparticles,evnt;
171 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
172 fDet[0] = fDet[1] = fDet[2] = kTRUE;
175 fDet[0] = fDet[1] = fDet[2] = kFALSE;
176 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
177 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
178 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
179 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
181 } // end if strstr(opt,...)
184 cout << "Initilization Failed, Can't run Exec." << endl;
188 fITS->HitsToSDigits(gAlice->GetHeader()->GetEvent(),0,-1," ",lopt," ");