1 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include "../STEER/AliRun.h"
9 #include "../STEER/AliRunDigitizer.h"
10 //#include "ITS/AliITSDigitizer.h"
11 #include "ITS/AliITS.h"
12 #include "ITS/AliITSDetType.h"
13 #include "ITS/AliITSresponseSDD.h"
14 #include "TStopwatch.h"
17 TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
18 void writeAR(TFile * fin, TFile *fou);
19 Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
26 Int_t AliITSh2d(TString hf="galice.root",TString df="",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, *dfp = 0;
38 // gAlice not define. Must open a file and read it in.
39 if(hf.CompareTo(df) == 0 || df.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 dfp = gAlice->InitTreeFile("D",df);
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(dfp) writeAR(hfp,dfp);
56 Int_t evNumber2 = gAlice->GetEventsPerRun();
58 for(Int_t event = evNumber1; event < evNumber2; event++){
59 gAlice->GetEvent(event);
60 if(!gAlice->TreeD() && dfp == 0){
61 cout << "Having to create the Digits Tree." << endl;
62 gAlice->MakeTree("S");
63 } // end if !gAlice->TreeS()
64 if(dfp) gAlice->MakeTree("D",dfp);
67 ITS->SetTreeAddress();
69 cout<<"Making ITS Digits for event "<<event<<endl;
76 cout <<"After Digitization "<<df<< " size =" << dfp->GetSize() << endl;
78 cout <<"After digitization "<<hf<< " size =" << hfp->GetSize() << endl;