]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/VZERORaw2Digits.C
CMake: prepend_prefix() to every elm in a list
[u/mrichter/AliRoot.git] / VZERO / VZERORaw2Digits.C
CommitLineData
c7c9b520 1//_____________________________________________________//
2// //
3// This macro reads VZERO DDL Raw Data and //
4// converts it into Digits //
5// //
6//____________________________________________________ //
7
8
9void VZERORaw2Digits(Int_t nEvent = 1)
10{
11 for(int i=0;i<nEvent;i++) {
12 printf("=========== EVENT %d ===========\n",i);
13 TString DirName = "raw";
14 DirName += i;
15 RawStreamEvent(DirName.Data()); }
16}
17
18
19Bool_t RawStreamEvent(TString fileName = "./")
20{
21 // Reads DDL data from fileName
22
23 TStopwatch timer;
24 timer.Start();
25
26// Creates a TreeD to dump Digits
27
28 AliRunLoader* rl = AliRunLoader::Open("galice.root");
29
30 AliVZEROLoader* loader = (AliVZEROLoader*) rl->GetLoader("VZEROLoader");
31
32 if(!loader) {
33 AliError("no VZERO loader found");
34 return kFALSE; }
35
36 TTree* treeD = loader->TreeD();
37 if(!treeD) {
38 loader->MakeTree("D");
39 treeD = loader->TreeD(); }
40
41 AliVZEROdigit digit;
42 AliVZEROdigit* pdigit = &digit;
43 const Int_t kBufferSize = 4000;
44
45 treeD->Branch("VZERO", "AliVZERODigit", &pdigit, kBufferSize);
46
47 AliRawReader* rawReader = 0x0;
48 rawReader = new AliRawReaderFile(fileName); // DDL files
49
50 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
51
52 rawReader->NextEvent();
53
54 rawStream->Next();
55
56 for(Int_t i=0; i<64; i++) {
57 new(pdigit) AliVZEROdigit(i, (Int_t)rawStream->GetADC(i), (Int_t)rawStream->GetTime(i));
58 treeD->Fill();
59 }
60
61// Checks if everything is OK by printing results
62
63// for(int i=0;i<64;i++) {
64// printf("Channel %d : %d %d \n",i,rawStream->GetADC(i),rawStream->GetTime(i)); }
65// treeD->Print(); printf(" \n");
66
67 loader->WriteDigits("OVERWRITE");
68 loader->UnloadDigits();
69
70 delete rawReader;
71 delete rawStream;
72
73 timer.Stop();
74 timer.Print();
75}
76
77