1 #if !defined(__CINT__) || defined(__MAKECINT__)
7 #include "../STEER/AliRun.h"
8 #include "../STEER/AliRunDigitizer.h"
9 //#include "AliITSDigitizer.h"
11 #include "AliITSDetType.h"
12 #include "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="");
26 Int_t AliITSh2sd(TString hf="galice.root",TString sf="",TString opt=""){
27 // Produce ITS SDigits from Hits.
29 // Dynamically link some shared libs
30 if (gClassTable->GetID("AliRun") < 0) {
31 gROOT->LoadMacro("loadlibs.C");
34 gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
36 TFile *hfp = 0, *sfp = 0;
38 // gAlice not define. Must open a file and read it in.
39 if(hf.CompareTo(sf) == 0 || sf.CompareTo("") == 0) {
40 // Input file = output file
41 hfp = AccessFile(hf,"U"); // input file open for update.
42 }else{ // Input file different from output file.
43 hfp = AccessFile(hf,"R"); // input file open as read only
44 // open output file and create TreeR on it
45 sfp = gAlice->InitTreeFile("S",sf);
47 } // end if !GALICEITSOK()
48 AliITS *ITS = (AliITS*) (gAlice->GetDetector("ITS"));
50 ChangeITSDefaults(hfp,ITS,opt);
51 // write the AliRun object to the output file if different from input file.
52 if(sfp) writeAR(hfp,sfp);
56 Int_t evNumber2 = gAlice->GetEventsPerRun();
58 for(Int_t event = evNumber1; event < evNumber2; event++){
59 gAlice->GetEvent(event);
60 if(!gAlice->TreeS() && sfp == 0){
61 cout << "Having to create the SDigits Tree." << endl;
62 gAlice->MakeTree("S");
63 } // end if !gAlice->TreeS()
64 if(sfp) gAlice->MakeTree("S",sfp);
67 ITS->SetTreeAddress();
69 cout<<"Making ITS SDigits for event "<<event<<endl;
76 cout << sf << " size =" << sfp->GetSize() << endl;
78 cout << hfp << " size =" << hfp->GetSize() << endl;