1 ////////////////////////////////////////////////////////////////////////
5 // last update: 11.4.2002
7 // author: Jiri Chudoba
8 // update by Bjorn Nilsen
12 // creates digits from sdigits for several detectors
13 // stores sdigits in separate file (or in the source file
14 // with sdigits). Stores gAlice object and copies TE to the
16 // ITS region of Interest is set
20 // TString fileNameSDigits ... input file with sdigits
21 // TString fileNameDigits ... output file with digits
22 // Int_t nEvents ... how many events to process
23 // Int_t ITS, many flags for diff. detectors
27 // 04.04.02 - first version
29 ////////////////////////////////////////////////////////////////////////
31 #if !defined(__CINT__) || defined(__MAKECINT__)
33 #include "TDatetime.h"
34 #include "STEER/AliRun.h"
35 #include "STEER/AliRunDigitizer.h"
36 #include "ITS/AliITSDigitizer.h"
37 #include "ITS/AliITS.h"
38 #include "ITS/AliITSDetType.h"
39 #include "ITS/AliITSresponseSDD.h"
40 #include "TStopwatch.h"
43 // #include "AliHits2SDigits.C"
45 Int_t AliITSMerge(TString fileNameDigits="digits.root",
46 TString fileNameSDigitsSig="sig.sdigits.root",
47 TString fileNameSDigitsBgr="bgr.sdigits.root",
48 Int_t nEvents = 1, Int_t iITS = 2){
49 // delete the current gAlice object, the one from input file
57 // Connect the Root Galice file containing Geometry, Kine and Hits
58 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(fileNameSDigitsSig.Data());
59 if(!file) file = new TFile(fileNameSDigitsSig.Data());
60 TDatime *ct0 = new TDatime(2002,04,26,00,00,00), ct = file->GetCreationDate();
63 // Get AliRun object from file or create it if not on file
65 gAlice = (AliRun*)file->Get("gAlice");
66 if(gAlice) printf("AliRun object found on file\n");
67 if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
70 AliRunDigitizer * manager = new AliRunDigitizer(2,1);
71 manager->SetInputStream(0,fileNameSDigitsSig.Data());
72 manager->SetInputStream(1,fileNameSDigitsBgr.Data());
73 if (fileNameDigits != "") {
74 manager->SetOutputFile(fileNameDigits);
76 manager->SetNrOfEventsToWrite(nEvents);
79 AliITSDigitizer *dITS = new AliITSDigitizer(manager);
80 if (iITS == 2) dITS->SetByRegionOfInterestFlag(1);
81 // For old files, must change SDD noise.
82 // and for new file we will do it anyway for simplicity.
83 AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
84 AliITSresponseSDD *resp1 = ITS->DetType(1)->GetResponseModel();
85 resp1->SetNoiseParam();
86 resp1->SetNoiseAfterElectronics();
89 resp1->GetNoiseParam(n,b);
90 n = resp1->GetNoiseAfterElectronics();
93 cPar[2]=(Int_t)(b + 2.*n + 0.5);
94 cPar[3]=(Int_t)(b + 2.*n + 0.5);
99 resp1->SetCompressParam(cPar);
103 manager->Exec("deb all");
106 // gAlice may need to be deleted but not if as part of larger production.