1 #if !defined(__CINT__) || defined(__MAKECINT__)
7 #include "../STEER/AliRun.h"
8 #include "../STEER/AliRunDigitizer.h"
9 #include "ITS/AliITSDigitizer.h"
10 #include "ITS/AliITS.h"
11 #include "ITS/AliITSDetType.h"
12 #include "ITS/AliITSresponseSDD.h"
13 #include "TStopwatch.h"
16 TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
17 void writeAR(TFile * fin, TFile *fou);
18 Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
24 Int_t AliITSsd2d(TString df="galice.root",TString sf1="galice.root",
25 TString sf2="",TString opt=""){
26 // Produce ITS Digits from SDigits, with psible merging.
28 // Dynamically link some shared libs
29 if (gClassTable->GetID("AliRun") < 0) {
30 gROOT->LoadMacro("loadlibs.C");
33 gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
35 TFile *sfp1 = 0, *sfp2 = 0, *dfp = 0;
37 // gAlice not define. Must open a file and read it in.
38 if(df.CompareTo(sf1) == 0 || df.CompareTo("") == 0) {
39 // Input file = output file
40 sfp1 = AccessFile(sf1,"U"); // input file open for update.
41 }else{ // Input file different from output file.
42 sfp1 = AccessFile(sf1,"R"); // input file open as read only
43 // open output file and create TreeR on it
44 dfp = gAlice->InitTreeFile("S",df);
46 } // end if !GALICEITSOK()
47 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
49 ChangeITSDefaults(sfp1,ITS,opt);
50 // write the AliRun object to the output file if different from input file.
53 dfp->Close(); // Manager will open in update mode.
56 AliRunDigitizer *manager;
57 if(sf2.CompareTo("")==0) { // do not merge.
58 manager = new AliRunDigitizer(1,1);
59 manager->SetInputStream(0,sf1);
61 manager = new AliRunDigitizer(2,1);
62 manager->SetInputStream(0,sf1.Data());
63 manager->SetInputStream(1,sf2.Data());
65 if (df.CompareTo(sf1) !=0) {
66 manager->SetOutputFile(df);
68 AliITSDigitizer *dITS = new AliITSDigitizer(manager);
69 if(opt.Contains("ROI")==0) dITS->SetByRegionOfInterestFlag(1);
79 cout << df << " size =" << df->GetSize() << endl;
81 cout << sf1 << " size =" << sf1->GetSize() << endl;