]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/oldmacros/AliITSsd2d.C
Print removed
[u/mrichter/AliRoot.git] / ITS / oldmacros / AliITSsd2d.C
CommitLineData
b3d9d240 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
3#include "iostream.h"
4#include "TDatime.h"
5#include "TFile.h"
6#include "TString.h"
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"
14
15Bool_t GaliceITSok();
16TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
17void writeAR(TFile * fin, TFile *fou);
18Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
19
20#endif
21
22//#define DEBUG
23
24Int_t AliITSsd2d(TString df="galice.root",TString sf1="galice.root",
25 TString sf2="",TString opt=""){
26 // Produce ITS Digits from SDigits, with psible merging.
27
28 // Dynamically link some shared libs
29 if (gClassTable->GetID("AliRun") < 0) {
30 gROOT->LoadMacro("loadlibs.C");
31 loadlibs();
32 } // end if
33 gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
34
35 TFile *sfp1 = 0, *sfp2 = 0, *dfp = 0;
36 if(!GaliceITSok()){
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);
45 } // end if
46 } // end if !GALICEITSOK()
47 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
48
49 ChangeITSDefaults(sfp1,ITS,opt);
50 // write the AliRun object to the output file if different from input file.
51 if(dfp) {
52 writeAR(sfp1,dfp);
53 dfp->Close(); // Manager will open in update mode.
54 } // end if
55
56 AliRunDigitizer *manager;
57 if(sf2.CompareTo("")==0) { // do not merge.
58 manager = new AliRunDigitizer(1,1);
59 manager->SetInputStream(0,sf1);
60 }else{
61 manager = new AliRunDigitizer(2,1);
62 manager->SetInputStream(0,sf1.Data());
63 manager->SetInputStream(1,sf2.Data());
64 } // end if
65 if (df.CompareTo(sf1) !=0) {
66 manager->SetOutputFile(df);
67 } // end if
68 AliITSDigitizer *dITS = new AliITSDigitizer(manager);
69 if(opt.Contains("ROI")==0) dITS->SetByRegionOfInterestFlag(1);
70
71 TStopwatch timer;
72 timer.Start();
73 manager->Exec("all");
74 timer.Stop();
75 timer.Print();
76 delete manager;
77
78 if(dfp!=0){
79 cout << df << " size =" << df->GetSize() << endl;
80 }else if(sfp1!=0){
81 cout << sf1 << " size =" << sf1->GetSize() << endl;
82 } // end if sf1!=0
83 return 0;
84}