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 ClassImp(AliITSsDigitize)
34 //______________________________________________________________________
35 AliITSsDigitize::AliITSsDigitize(){
36 // Default constructor.
42 // A zero-ed constructed AliITSsDigitize class.
46 fDet[0] = fDet[1] = fDet[2] = kTRUE;
49 //______________________________________________________________________
50 AliITSsDigitize::AliITSsDigitize(const char* filename){
51 // Standard constructor.
53 // const char* filename filename containing the digits to be
54 // reconstructed. If filename = 0 (nil)
55 // then no file is opened but a file is
56 // assumed to already be opened. This
57 // already opened file will be used.
61 // A standardly constructed AliITSsDigitize class.
68 fRunLoader = AliRunLoader::Open(filename);
69 fRunLoader->LoadgAlice();
70 fRunLoader->LoadHeader();
75 //______________________________________________________________________
76 AliITSsDigitize::~AliITSsDigitize(){
77 // Default constructor.
83 // A destroyed AliITSsDigitize class.
85 if(fRunLoader) delete fRunLoader;
89 //______________________________________________________________________
90 Bool_t AliITSsDigitize::Init(){
97 // kTRUE if no errors initilizing this class occurse else kFALSE
100 fITS = (AliITS*) gAlice->GetDetector("ITS");
102 cout << "ITS not found aborting. fITS=" << fITS << endl;
106 if(!(fITS->GetITSgeom())){
107 cout << "ITSgeom not found aborting."<< endl;
110 } // end if !GetITSgeom()
111 // Now ready to init.
113 fDet[0] = fDet[1] = fDet[2] = kTRUE;
115 fEnt = gAlice->GetEventsPerRun();
117 AliLoader* loader = fRunLoader->GetLoader("ITSLoader");
119 if(!loader->TreeS()){
120 cout << "Having to create the SDigits Tree." << endl;
121 loader->MakeTree("S");
122 } // end if !gAlice->TreeS()
124 fITS->MakeBranch("S");
125 fITS->SetTreeAddress();
127 fRunLoader->GetEvent(fEnt0);
132 //______________________________________________________________________
133 Bool_t AliITSsDigitize::InitSDig(){
134 // Sets up SDigitization part of AliITSDetType..
145 //______________________________________________________________________
146 void AliITSsDigitize::Exec(const Option_t *opt){
147 // Main SDigitization function.
149 // Option_t * opt list of subdetector to digitize. =0 all.
155 // Int_t nparticles,evnt;
157 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
158 fDet[0] = fDet[1] = fDet[2] = kTRUE;
161 fDet[0] = fDet[1] = fDet[2] = kFALSE;
162 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
163 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
164 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
165 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
167 } // end if strstr(opt,...)
170 cout << "Initilization Failed, Can't run Exec." << endl;
174 fITS->HitsToSDigits(fRunLoader->GetHeader()->GetEvent(),0,-1," ",lopt," ");