]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliSDigits2Digits.C
Updated AliTOFSDigitizer
[u/mrichter/AliRoot.git] / STEER / AliSDigits2Digits.C
CommitLineData
1b147a75 1////////////////////////////////////////////////////////////////////////
2//
3// name: AliSDigits2Digits
4// date: 4.4.2002
5// last update: 4.4.2002
6// author: Jiri Chudoba
7// version: 1.0
8//
9// description:
10// creates digits from sdigits for several detectors
11// stores sdigits in separate file (or in the source file
12// with sdigits). Stores gAlice object and copies TE to the
13// file with digits
14//
15// input:
16// TString fileNameSDigits ... input file with sdigits
17// TString fileNameDigits ... output file with digits
18// Int_t nEvents ... how many events to process
19// Int_t ITS, TPC, ... many flags for diff. detectors
20//
21// History:
22//
23// 04.04.02 - first version
24//
25////////////////////////////////////////////////////////////////////////
26
27#if !defined(__CINT__) || defined(__MAKECINT__)
28#include "iostream.h"
29#include "STEER/AliRun.h"
30#include "STEER/AliRunDigitizer.h"
31#include "ITS/AliITSDigitizer.h"
32#include "TPC/AliTPCDigitizer.h"
33#include "TRD/AliTRDdigitizer.h"
34#include "PHOS/AliPHOSDigitizer.h"
35#include "MUON/AliMUONDigitizer.h"
36#include "RICH/AliRICHDigitizer.h"
37#include "TStopwatch.h"
38#endif
39
40#include "AliHits2SDigits.C"
41
42void AliCopyN(TString inputFile, TString outputFile);
43
44Int_t AliSDigits2Digits(TString fileNameDigits="digits.root",
45 TString fileNameSDigits="rfio:sdigits.root",
46 Int_t nEvents = 1, Int_t iITS = 0, Int_t iTPC = 0,
47 Int_t iTRD = 0, Int_t iPHOS = 0, Int_t iMUON = 0,
48 Int_t iRICH = 0, Int_t iCopy = 1)
49{
50// delete the current gAlice object, the one from input file
51// will be used
52
53 if(gAlice){
54 delete gAlice;
55 gAlice = 0;
56 } // end if gAlice
57 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
58 manager->SetInputStream(0,fileNameSDigits.Data());
59 if (fileNameDigits != "") {
60 if (iCopy) {
61 AliCopyN(fileNameSDigits,fileNameDigits);
62 }
63 manager->SetOutputFile(fileNameDigits);
64 }
65 manager->SetNrOfEventsToWrite(nEvents);
66 if (iITS) AliITSDigitizer *dITS = new AliITSDigitizer(manager);
67 if (iTPC) AliTPCDigitizer *dTPC = new AliTPCDigitizer(manager);
68 if (iTRD) AliTRDdigitizer *dTRD = new AliTRDdigitizer(manager);
69 if (iPHOS) AliPHOSDigitizer *dPHOS = new AliPHOSDigitizer(manager);
70 if (iMUON) AliMUONDigitizer *dMUON = new AliMUONDigitizer(manager);
71 if (iRICH) AliRICHDigitizer *dRICH = new AliRICHDigitizer(manager);
72 TStopwatch timer;
73 timer.Start();
74 manager->Exec("deb all");
75 timer.Stop();
76 timer.Print();
77 delete manager;
78}
79
80
81////////////////////////////////////////////////////////////////////////
82void AliCopyN(TString inputFileName, TString outputFileName) {
83// copy some objects
84
85 TFile *inputFile = OpenFile(inputFileName);
86 if (!inputFile) return;
87
88 TFile *outputFile = TFile::Open(outputFileName.Data(),"update");
89 if (!outputFile->IsOpen()) {
90 cerr<<"Can't open "<<outputFileName.Data()<<" !\n";
91 return;
92 }
93 if (!ImportgAlice(inputFile)) return;
94 AliCopy(inputFile, outputFile);
95 inputFile->Close();
96 delete inputFile;
97 outputFile->Close();
98 delete outputFile;
99}
100////////////////////////////////////////////////////////////////////////