]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSHits2Digits.C
for non-miscalibrated digits, set an ad-hoc conversion factor fAdC->fToT to have...
[u/mrichter/AliRoot.git] / ITS / AliITSHits2Digits.C
CommitLineData
02a71a71 1#if !defined(__CINT__) || defined(__MAKECINT__)
cc2535cd 2
d2e7afa1 3#include "Riostream.h"
4#include "TDatime.h"
5#include "TClassTable.h"
6#include "AliRun.h"
7#include "AliRunDigitizer.h"
8#include "AliITSDigitizer.h"
9#include "AliITS.h"
10#include "AliITSDetType.h"
11#include "AliITSLoader.h"
12#include "AliITSresponseSDD.h"
02a71a71 13#include "TStopwatch.h"
cc2535cd 14
02a71a71 15#endif
16
02a71a71 17//#define DEBUG
d2e7afa1 18Int_t AliITSHits2Digits(TString inFile = "galice.root"){
19 // Standard ITS Hits to Digits, excluding creation of SDigits.
02a71a71 20
21 // Dynamically link some shared libs
d2e7afa1 22 if (gClassTable->GetID("AliRun") < 0) {
23 gROOT->ProcessLine(".x $(ALICE_ROOT)/macros/loadlibs.C");
24 }else if (gAlice){
25 delete gAlice->GetRunLoader();
26 delete gAlice;
27 gAlice=0;
28 }
02a71a71 29
d2e7afa1 30 AliRunLoader* rl = AliRunLoader::Open(inFile.Data());
31 if (rl == 0x0)
32 {
33 cerr<<"AliITSHits2Digits.C : Can not open session RL=NULL"
34 << endl;
35 return 3;
36 }
37
38 Int_t retval = rl->LoadgAlice();
39 if (retval)
40 {
41 cerr<<"AliITSHits2Digits.C : LoadgAlice returned error"
42 << endl;
43 return 3;
44 }
45 gAlice=rl->GetAliRun();
46 AliITSLoader* gime = (AliITSLoader*)rl->GetLoader("ITSLoader");
47 if (gime == 0x0)
48 {
49 cerr<<"AliITSHits2Digits.C : can not get ITS loader"
50 << endl;
51 }
02a71a71 52 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
53 if (!ITS) {
d2e7afa1 54 cerr<<"AliITSHits2Digit.C : AliITS object not found on file"
cc2535cd 55 << endl;
56 return 3;
02a71a71 57 } // end if !ITS
d2e7afa1 58
02a71a71 59 if(!(ITS->GetITSgeom())){
d2e7afa1 60 cerr << " AliITSgeom not found. Can't digitize without it." << endl;
cc2535cd 61 return 4;
02a71a71 62 } // end if
63
d2e7afa1 64
02a71a71 65
66 TStopwatch timer;
67 Int_t evNumber1 = 0;
68 Int_t evNumber2 = gAlice->GetEventsPerRun();
69 timer.Start();
d2e7afa1 70 retval = gime->LoadHits();
71 if (retval)
72 {
73 cerr<<"AliITSHits2Digits.C : ITSLoader::LoadHits returned error"
74 << endl;
75 return 3;
76 }
77
78 retval = gime->LoadDigits("recreate");
79 if (retval)
80 {
81 cerr<<"AliITSHits2Digits.C : ITSLoader::LoadDigits returned error"
82 << endl;
83 return 3;
84 }
02a71a71 85 for(Int_t nevent = evNumber1; nevent < evNumber2; nevent++){
86 // cout<<"Producing Digits for event n."<<nevent<<endl;
d2e7afa1 87
88 rl->GetEvent(nevent);
89 if(!gime->TreeD()){
02a71a71 90 cout << "Having to create the Digits Tree." << endl;
d2e7afa1 91 gime->MakeTree("D");
02a71a71 92 } // end if creating digits tree
02a71a71 93 ITS->MakeBranch("D");
94 ITS->SetTreeAddress();
95 ITS->Hits2Digits();
96 } // end for nevent
97 timer.Stop();
98 timer.Print();
02a71a71 99
d2e7afa1 100 delete rl;
101 return 0;
02a71a71 102}