]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSh2d.C
Added new plots
[u/mrichter/AliRoot.git] / ITS / AliITSh2d.C
CommitLineData
cd002758 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
3#include "iostream.h"
4#include "TDatime.h"
5#include "TDatime.h"
6#include "TFile.h"
7#include "TString.h"
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"
15
16Bool_t GaliceITSok();
17TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
18void writeAR(TFile * fin, TFile *fou);
19Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
20void loadlibs();
21
22#endif
23
24//#define DEBUG
25
26Int_t AliITSh2d(TString hf="galice.root",TString df="",TString opt=""){
27 // Produce ITS SDigits from Hits.
28
29 // Dynamically link some shared libs
30 if (gClassTable->GetID("AliRun") < 0) {
31 gROOT->LoadMacro("loadlibs.C");
32 loadlibs();
33 } // end if
34 gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
35
36 TFile *hfp = 0, *dfp = 0;
37 if(!GaliceITSok()){
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);
46 } // end if
47 } // end if !GALICEITSOK()
48 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
49
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);
53
54 TStopwatch timer;
55 Int_t evNumber1 = 0;
56 Int_t evNumber2 = gAlice->GetEventsPerRun();
57 timer.Start();
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);
65 // make branch
66 ITS->MakeBranch("D");
67 ITS->SetTreeAddress();
68#ifdef DEBUG
69 cout<<"Making ITS Digits for event "<<event<<endl;
70#endif
71 ITS->Hits2Digits();
72 } // end for event
73 timer.Stop();
74 timer.Print();
75 if(dfp!=0){
76 cout <<"After Digitization "<<df<< " size =" << dfp->GetSize() << endl;
77 }else if(hfp!=0){
78 cout <<"After digitization "<<hf<< " size =" << hfp->GetSize() << endl;
79 } // end if dfp!=0
80 return 0;
81}