4ee23d3d |
1 | /************************************************************************** |
2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * |
3 | * * |
4 | * Author: The ALICE Off-line Project. * |
5 | * Contributors are mentioned in the code where appropriate. * |
6 | * * |
7 | * Permission to use, copy, modify and distribute this software and its * |
8 | * documentation strictly for non-commercial purposes is hereby granted * |
9 | * without fee, provided that the above copyright notice appears in all * |
10 | * copies and that both the copyright notice and this permission notice * |
11 | * appear in the supporting documentation. The authors make no claims * |
12 | * about the suitability of this software for any purpose. It is * |
13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ |
15 | |
16 | /* $Id$ */ |
17 | |
b15de2d2 |
18 | //////////////////////////////////////////////////////////// |
19 | // Author: Henrik Tydesjo // |
20 | // Interface class to the containers of an online scan // |
21 | // with only one step. // |
22 | //////////////////////////////////////////////////////////// |
23 | |
4ee23d3d |
24 | |
b15de2d2 |
25 | #include <TFile.h> |
26 | #include "AliITSOnlineSPDscanSingle.h" |
27 | #include "AliITSOnlineSPDscanInfo.h" |
28 | |
6ddf3d66 |
29 | AliITSOnlineSPDscanSingle::AliITSOnlineSPDscanSingle(const Char_t *fileName, Bool_t readFromGridFile) { |
b15de2d2 |
30 | // constructor |
53ae21ce |
31 | fFileName=fileName; |
6ddf3d66 |
32 | fModified=kFALSE; |
33 | fInfoModified=kFALSE; |
b15de2d2 |
34 | // look for a previously saved info object |
35 | // (if file not found create a new one and return, else read) |
6ddf3d66 |
36 | |
37 | Bool_t bRead = readFromGridFile; |
38 | |
39 | if (!bRead) { |
40 | FILE* fp0 = fopen(fFileName.Data(), "r"); |
41 | if (fp0 != NULL) { |
42 | bRead=kTRUE; |
43 | fclose(fp0); |
44 | } |
45 | } |
46 | |
47 | if (bRead) { // open file for reading |
48 | fFile = TFile::Open(fFileName.Data(), "READ"); |
49 | if (fFile==NULL) { // grid file not found, create new local default file |
50 | printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data()); |
51 | // create default empty file: |
52 | fFileName = "test999.root"; |
53 | fScanInfo = new AliITSOnlineSPDscanInfo(); |
54 | fInfoModified=kTRUE; |
55 | fFile = new TFile(fFileName.Data(), "RECREATE"); |
56 | fWrite=kTRUE; |
57 | } |
58 | else { // read from file (grid or local) |
59 | fWrite=kFALSE; |
60 | fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); |
61 | } |
62 | } |
63 | else { // create new local file |
b15de2d2 |
64 | fScanInfo = new AliITSOnlineSPDscanInfo(); |
6ddf3d66 |
65 | fInfoModified=kTRUE; |
53ae21ce |
66 | fFile = new TFile(fFileName.Data(), "RECREATE"); |
b15de2d2 |
67 | fWrite=kTRUE; |
68 | } |
6ddf3d66 |
69 | |
b15de2d2 |
70 | Init(); |
b15de2d2 |
71 | } |
72 | AliITSOnlineSPDscanSingle::~AliITSOnlineSPDscanSingle() {} |
73 | |
74 | // call the corresponding methods in SPDscan with nsi=0 ****************** |
71abf6b7 |
75 | void AliITSOnlineSPDscanSingle::SetTriggers(UInt_t val) |
b15de2d2 |
76 | {AliITSOnlineSPDscan::SetTriggers(0,val);} |
71abf6b7 |
77 | void AliITSOnlineSPDscanSingle::SetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi, UInt_t val) |
b15de2d2 |
78 | {AliITSOnlineSPDscan::SetHits(0,hs,chipi,coli,rowi,val);} |
71abf6b7 |
79 | void AliITSOnlineSPDscanSingle::IncrementTriggers() |
b15de2d2 |
80 | {AliITSOnlineSPDscan::IncrementTriggers(0);} |
71abf6b7 |
81 | void AliITSOnlineSPDscanSingle::IncrementHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) |
b15de2d2 |
82 | {AliITSOnlineSPDscan::IncrementHits(0,hs,chipi,coli,rowi);} |
71abf6b7 |
83 | void AliITSOnlineSPDscanSingle::SetHitEvents(UInt_t hs, UInt_t chipi, UInt_t val) |
b15de2d2 |
84 | {AliITSOnlineSPDscan::SetHitEvents(0,hs,chipi,val);} |
71abf6b7 |
85 | void AliITSOnlineSPDscanSingle::SetHitEventsTot(UInt_t hs, UInt_t val) |
b15de2d2 |
86 | {AliITSOnlineSPDscan::SetHitEventsTot(0,hs,val);} |
71abf6b7 |
87 | void AliITSOnlineSPDscanSingle::IncrementHitEvents(UInt_t hs, UInt_t chipi) |
b15de2d2 |
88 | {AliITSOnlineSPDscan::IncrementHitEvents(0,hs,chipi);} |
71abf6b7 |
89 | void AliITSOnlineSPDscanSingle::IncrementHitEventsTot(UInt_t hs) |
b15de2d2 |
90 | {AliITSOnlineSPDscan::IncrementHitEventsTot(0,hs);} |
54ad6e27 |
91 | UInt_t AliITSOnlineSPDscanSingle::GetTriggers() const |
b15de2d2 |
92 | {return AliITSOnlineSPDscan::GetTriggers(0);} |
71abf6b7 |
93 | UInt_t AliITSOnlineSPDscanSingle::GetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) |
b15de2d2 |
94 | {return AliITSOnlineSPDscan::GetHits(0,hs,chipi,coli,rowi);} |
71abf6b7 |
95 | Float_t AliITSOnlineSPDscanSingle::GetHitsEfficiency(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) |
b15de2d2 |
96 | {return AliITSOnlineSPDscan::GetHitsEfficiency(0,hs,chipi,coli,rowi);} |
71abf6b7 |
97 | Float_t AliITSOnlineSPDscanSingle::GetHitsEfficiencyError(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) |
b15de2d2 |
98 | {return AliITSOnlineSPDscan::GetHitsEfficiencyError(0,hs,chipi,coli,rowi);} |
71abf6b7 |
99 | UInt_t AliITSOnlineSPDscanSingle::GetHitEvents(UInt_t hs, UInt_t chipi) |
b15de2d2 |
100 | {return AliITSOnlineSPDscan::GetHitEvents(0,hs,chipi);} |
71abf6b7 |
101 | UInt_t AliITSOnlineSPDscanSingle::GetHitEventsTot(UInt_t hs) |
b15de2d2 |
102 | {return AliITSOnlineSPDscan::GetHitEventsTot(0,hs);} |
71abf6b7 |
103 | Float_t AliITSOnlineSPDscanSingle::GetHitEventsEfficiency(UInt_t hs, UInt_t chipi) |
b15de2d2 |
104 | {return AliITSOnlineSPDscan::GetHitEventsEfficiency(0,hs,chipi);} |
71abf6b7 |
105 | Float_t AliITSOnlineSPDscanSingle::GetHitEventsTotEfficiency(UInt_t hs) |
b15de2d2 |
106 | {return AliITSOnlineSPDscan::GetHitEventsTotEfficiency(0,hs);} |
71abf6b7 |
107 | Float_t AliITSOnlineSPDscanSingle::GetHitEventsEfficiencyError(UInt_t hs, UInt_t chipi) |
b15de2d2 |
108 | {return AliITSOnlineSPDscan::GetHitEventsEfficiencyError(0,hs,chipi);} |
71abf6b7 |
109 | Float_t AliITSOnlineSPDscanSingle::GetHitEventsTotEfficiencyError(UInt_t hs) |
b15de2d2 |
110 | {return AliITSOnlineSPDscan::GetHitEventsTotEfficiencyError(0,hs);} |
71abf6b7 |
111 | Float_t AliITSOnlineSPDscanSingle::GetAverageMultiplicity(UInt_t hs, UInt_t chipi) |
b15de2d2 |
112 | {return AliITSOnlineSPDscan::GetAverageMultiplicity(0,hs,chipi);} |
71abf6b7 |
113 | Float_t AliITSOnlineSPDscanSingle::GetAverageMultiplicityTot(UInt_t hs) |
b15de2d2 |
114 | {return AliITSOnlineSPDscan::GetAverageMultiplicityTot(0,hs);} |