Line data Source code
1 : ////////////////////////////////////////////////////////////
2 : // Author: Henrik Tydesjo //
3 : // Interface class to the containers of an online scan //
4 : // with multiple steps. //
5 : ////////////////////////////////////////////////////////////
6 :
7 : #include <TFile.h>
8 : #include "AliITSOnlineSPDscanMultiple.h"
9 : #include "AliITSOnlineSPDscanInfoMultiple.h"
10 :
11 0 : AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple():AliITSOnlineSPDscan(){
12 : // Default constructor
13 0 : }
14 0 : AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple(const Char_t *fileName, Bool_t readFromGridFile) {
15 : // constructor
16 0 : fFileName=fileName;
17 0 : fModified=kFALSE;
18 0 : fInfoModified=kFALSE;
19 : // look for a previously saved info object
20 : // (if file not found create a new one and return, else read)
21 :
22 0 : Bool_t bRead = readFromGridFile;
23 :
24 0 : if (!bRead) {
25 0 : FILE* fp0 = fopen(fFileName.Data(), "r");
26 0 : if (fp0 != NULL) {
27 : bRead=kTRUE;
28 0 : fclose(fp0);
29 : }
30 0 : }
31 :
32 0 : if (bRead) { // open file for reading
33 0 : fFile = TFile::Open(fFileName.Data(), "READ");
34 0 : if (fFile==NULL) { // grid file not found, create new local default file
35 0 : printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data());
36 : // create default empty file:
37 0 : fFileName = "test999.root";
38 0 : fScanInfo = new AliITSOnlineSPDscanInfoMultiple();
39 0 : fInfoModified=kTRUE;
40 0 : fFile = new TFile(fFileName.Data(), "RECREATE");
41 0 : fWrite=kTRUE;
42 0 : }
43 : else { // read from file (grid or local)
44 0 : fWrite=kFALSE;
45 0 : fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo);
46 : }
47 : }
48 : else { // create new local file
49 0 : fScanInfo = new AliITSOnlineSPDscanInfoMultiple();
50 0 : fInfoModified=kTRUE;
51 0 : fFile = new TFile(fFileName.Data(), "RECREATE");
52 0 : fWrite=kTRUE;
53 : }
54 :
55 0 : Init();
56 0 : }
57 :
58 : AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple(const AliITSOnlineSPDscanMultiple& scan) :
59 0 : AliITSOnlineSPDscan(scan)
60 0 : {}
61 :
62 0 : AliITSOnlineSPDscanMultiple::~AliITSOnlineSPDscanMultiple() {}
63 :
64 : AliITSOnlineSPDscanMultiple& AliITSOnlineSPDscanMultiple::operator=(const AliITSOnlineSPDscanMultiple& scan) {
65 : // Assignment operator, should not be called!!!
66 0 : printf("This object should not be copied!");
67 : if (this!=&scan) {
68 : // still do nothing...
69 : }
70 0 : return *this;
71 : }
72 :
73 : UInt_t AliITSOnlineSPDscanMultiple::AddScanStep() {
74 0 : CreateNewStep();
75 0 : return ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->AddScanStep();
76 : }
77 :
78 : void AliITSOnlineSPDscanMultiple::SetDacId(Int_t val) {
79 0 : ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->SetDacId(val);
80 0 : fInfoModified=kTRUE;
81 0 : }
82 : void AliITSOnlineSPDscanMultiple::SetDacValue(UInt_t nsi, Int_t val) {
83 : // set dac value for step nsi
84 0 : SwitchToStep(nsi);
85 0 : ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->SetDacValue(nsi,val);
86 0 : fInfoModified=kTRUE;
87 0 : }
88 : Int_t AliITSOnlineSPDscanMultiple::GetDacId() {
89 0 : return ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->GetDacId();
90 : }
91 : Int_t AliITSOnlineSPDscanMultiple::GetDacValue(UInt_t nsi) {
92 0 : return ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->GetDacValue(nsi);
93 : }
|