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 #include <Riostream.h>
22 #include <TSeqCollection.h>
24 #include <TClonesArray.h>
26 #include "AliHeader.h"
30 #include "AliITSsDigitize.h"
31 #include "AliITSgeom.h"
33 /////////////////////////////////////////////////////////
37 /////////////////////////////////////////////////////////
41 ClassImp(AliITSsDigitize)
42 //______________________________________________________________________
43 AliITSsDigitize::AliITSsDigitize():
49 // Default constructor.
55 // A zero-ed constructed AliITSsDigitize class.
57 fDet[0] = fDet[1] = fDet[2] = kTRUE;
59 //______________________________________________________________________
60 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.
83 fRunLoader = AliRunLoader::Open(filename);
84 fRunLoader->LoadgAlice();
85 fRunLoader->LoadHeader();
90 //______________________________________________________________________
91 AliITSsDigitize::~AliITSsDigitize(){
92 // Default constructor.
98 // A destroyed AliITSsDigitize class.
100 if(fRunLoader) delete fRunLoader;
104 //______________________________________________________________________
105 Bool_t AliITSsDigitize::Init(){
112 // kTRUE if no errors initilizing this class occurse else kFALSE
115 fITS = (AliITS*) gAlice->GetDetector("ITS");
117 cout << "ITS not found aborting. fITS=" << fITS << endl;
121 if(!(fITS->GetITSgeom())){
122 cout << "ITSgeom not found aborting."<< endl;
125 } // end if !GetITSgeom()
126 // Now ready to init.
128 fDet[0] = fDet[1] = fDet[2] = kTRUE;
130 fEnt = AliRunLoader::Instance()->GetNumberOfEvents();
132 AliLoader* loader = fRunLoader->GetLoader("ITSLoader");
134 if(!loader->TreeS()){
135 cout << "Having to create the SDigits Tree." << endl;
136 loader->MakeTree("S");
137 } // end if !gAlice->TreeS()
139 fITS->MakeBranch("S");
140 fITS->SetTreeAddress();
142 fRunLoader->GetEvent(fEnt0);
147 //______________________________________________________________________
148 Bool_t AliITSsDigitize::InitSDig() const {
149 // Sets up SDigitization part of AliITSDetType..
160 //______________________________________________________________________
161 void AliITSsDigitize::Digitize(const Option_t *opt){
162 // Main SDigitization function.
164 // Option_t * opt list of subdetector to digitize. =0 all.
170 Bool_t condition =kFALSE;
172 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE;
178 fDet[0] = fDet[1] = fDet[2] = kTRUE;
181 fDet[0] = fDet[1] = fDet[2] = kFALSE;
182 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
183 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
184 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
185 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
187 } // end if strstr(opt,...)
190 cout << "Initilization Failed, Can't run Digitize." << endl;
194 fITS->HitsToSDigits(fRunLoader->GetHeader()->GetEvent(),0,-1," ",lopt," ");