]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliSDigits2Digits.C
Typo corrected
[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);
03f98c58 66 if (iITS == 1) AliITSDigitizer *dITS = new AliITSDigitizer(manager);
67 if (iITS == 2) AliITSFDigitizer *dITS = new AliITSFDigitizer(manager);
1b147a75 68 if (iTPC) AliTPCDigitizer *dTPC = new AliTPCDigitizer(manager);
69 if (iTRD) AliTRDdigitizer *dTRD = new AliTRDdigitizer(manager);
70 if (iPHOS) AliPHOSDigitizer *dPHOS = new AliPHOSDigitizer(manager);
71 if (iMUON) AliMUONDigitizer *dMUON = new AliMUONDigitizer(manager);
72 if (iRICH) AliRICHDigitizer *dRICH = new AliRICHDigitizer(manager);
73 TStopwatch timer;
74 timer.Start();
75 manager->Exec("deb all");
76 timer.Stop();
77 timer.Print();
78 delete manager;
79}
80
81
82////////////////////////////////////////////////////////////////////////
83void AliCopyN(TString inputFileName, TString outputFileName) {
84// copy some objects
85
86 TFile *inputFile = OpenFile(inputFileName);
87 if (!inputFile) return;
88
89 TFile *outputFile = TFile::Open(outputFileName.Data(),"update");
90 if (!outputFile->IsOpen()) {
91 cerr<<"Can't open "<<outputFileName.Data()<<" !\n";
92 return;
93 }
94 if (!ImportgAlice(inputFile)) return;
95 AliCopy(inputFile, outputFile);
96 inputFile->Close();
97 delete inputFile;
98 outputFile->Close();
99 delete outputFile;
100}
101////////////////////////////////////////////////////////////////////////