Using getter instead of global constant
[u/mrichter/AliRoot.git] / ITS / AliITSspdTestBeam2Digits.C
CommitLineData
37c3bb97 1void AliITSspdTestBeam2Digits(const Char_t *filename="run001dat"){
2 // Macro to convert spd Test Beam data to ITS SPD Digits.
3 // fCoord1 = Row
4 // fCoord2 = Columb
5 Int_t i;
6
7 if(gClassTable->GetID("AliRun") <0){
8 gRoot->ProcessLine(".x $(ALICE_ROOT)/macros/loadlibs.C");
9 } else if(gAlice) {
10 delete gAlice->GetRunLoader();
11 delete gAlice;
12 gAlice = 0;
13 } // end if
14 if(!gAlice) { // most create it separatly?
15 gAlice = new AliRun("gAlice",
16 "The ALICE Off-line Reconstruction Framework");
17 } // end if
18
19 AliRunLoader *rl = AliRunLoader::Open("galice.root",
f5a857b2 20 AliConfig::GetDefaultEventFolderName(),"new");
37c3bb97 21 gAlice->SetRunLoader(rl);
22 rl->SetNumberOfEventsPerFile(1000);
23
24 rl->SetEventFolderName();
25 rl->MakeTree("E");
26 AliITSvSPD02 *its = (AliITS*)gAlice->GetDetector("ITS");
27 if(!its){
28 its = new AliITSvSPD02("SPD testbeam Run001");
29 gAlice->AddModule(its);
30 its->Init();
31 its->SetDefaults();
32 } // end if
33 rl->AddLoader(its);
34 AliITSLoader *ldr = (AliITSLoader*) rl->GetLoader("ITSLoader");
35 ldr->SetEventFolder(rl->GetEventFolder());
36
37 //rl->WriteGeometry();
38
39 AliITSspdTestBeam *spd = new AliITSspdTestBeam(filename);
40 spd->Read();
41 spd->Decode();
42 spd->SetLoader(ldr);
43 spd->SetITS(its);
44 AliHeader *hdr;
45 for(i=0;i<spd->GetNumberOfEvents();i++){
46 spd->Digitize(i);
47 rl->MakeHeader();
48 hdr = rl->GetHeader();
49 hdr->Reset(001,i,i);
50 } // end for i
51 rl->WriteHeader("OVERWRITE");
52 rl->WriteRunLoader("OVERWRITE");
53 rl->WriteAliRun("OVERWRITE");
54 delete rl;
55}