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.3 2002/10/14 14:57:03 hristov
19 Merging the VirtualMC branch to the main development branch (HEAD)
21 Revision 1.2.4.1 2002/06/10 17:51:15 hristov
24 Revision 1.2 2002/05/19 18:17:03 hristov
25 Changes needed by ICC/IFC compiler (Intel)
27 Revision 1.1 2002/03/28 16:25:26 nilsen
28 New TTask method for creating SDigits from Hits.
32 #include <Riostream.h>
36 #include <TSeqCollection.h>
38 #include <TClonesArray.h>
40 #include "AliHeader.h"
44 #include "AliITSsDigitize.h"
45 #include "AliITSgeom.h"
47 ClassImp(AliITSsDigitize)
48 //______________________________________________________________________
49 AliITSsDigitize::AliITSsDigitize(){
50 // Default constructor.
56 // A zero-ed constructed AliITSsDigitize class.
61 fDet[0] = fDet[1] = fDet[2] = kTRUE;
64 //______________________________________________________________________
65 AliITSsDigitize::AliITSsDigitize(const char* filename){
66 // Standard constructor.
68 // const char* filename filename containing the digits to be
69 // reconstructed. If filename = 0 (nil)
70 // then no file is opened but a file is
71 // assumed to already be opened. This
72 // already opened file will be used.
76 // A standardly constructed AliITSsDigitize class.
81 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
82 if(fFile) fFile->Close();
83 fFile = new TFile(fFilename.Data(),"UPDATE");
89 gAlice = (AliRun*)fFile->Get("gAlice");
91 cout << "gAlice not found on file. Aborting." << endl;
95 } // end if !filename.
99 //______________________________________________________________________
100 AliITSsDigitize::~AliITSsDigitize(){
101 // Default constructor.
107 // A destroyed AliITSsDigitize class.
109 if(fFile) fFile->Close();
114 //______________________________________________________________________
115 Bool_t AliITSsDigitize::Init(){
122 // kTRUE if no errors initilizing this class occurse else kFALSE
125 fITS = (AliITS*) gAlice->GetDetector("ITS");
127 cout << "ITS not found aborting. fITS=" << fITS << endl;
131 if(!(fITS->GetITSgeom())){
132 cout << "ITSgeom not found aborting."<< endl;
135 } // end if !GetITSgeom()
136 // Now ready to init.
138 fDet[0] = fDet[1] = fDet[2] = kTRUE;
140 fEnt = gAlice->GetEventsPerRun();
142 if(!gAlice->TreeS()){
143 cout << "Having to create the SDigits Tree." << endl;
144 gAlice->MakeTree("S");
145 } // end if !gAlice->TreeS()
147 fITS->MakeBranch("S");
148 fITS->SetTreeAddress();
149 nparticles = gAlice->GetEvent(fEnt0);
155 //______________________________________________________________________
156 Bool_t AliITSsDigitize::InitSDig(){
157 // Sets up SDigitization part of AliITSDetType..
168 //______________________________________________________________________
169 void AliITSsDigitize::Exec(const Option_t *opt){
170 // Main SDigitization function.
172 // Option_t * opt list of subdetector to digitize. =0 all.
178 // Int_t nparticles,evnt;
180 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
181 fDet[0] = fDet[1] = fDet[2] = kTRUE;
184 fDet[0] = fDet[1] = fDet[2] = kFALSE;
185 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
186 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
187 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
188 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
190 } // end if strstr(opt,...)
193 cout << "Initilization Failed, Can't run Exec." << endl;
197 fITS->HitsToSDigits(gAlice->GetHeader()->GetEvent(),0,-1," ",lopt," ");