]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSOnlineSPDscanMeanTh.cxx
Add new global configuration for prod shuttle.
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSPDscanMeanTh.cxx
1 ////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo                                 //
3 // Interface class to the containers of an online mean    //
4 // threshold scan.                                        //
5 ////////////////////////////////////////////////////////////
6
7 #include <TFile.h>
8 #include "AliITSOnlineSPDscanMeanTh.h"
9 #include "AliITSOnlineSPDscanInfoMeanTh.h"
10
11 AliITSOnlineSPDscanMeanTh::AliITSOnlineSPDscanMeanTh(const Char_t *fileName, Bool_t readFromGridFile) {
12   // constructor
13   fFileName=fileName;
14   fModified=kFALSE;
15   fInfoModified=kFALSE;
16   // look for a previously saved info object 
17   // (if file not found create a new one and return, else read)
18
19   Bool_t bRead = readFromGridFile;
20
21   if (!bRead) {
22     FILE* fp0 = fopen(fFileName.Data(), "r");
23     if (fp0 != NULL) {
24       bRead=kTRUE;
25       fclose(fp0);
26     }
27   }
28
29   if (bRead) { // open file for reading
30     fFile = TFile::Open(fFileName.Data(), "READ");
31     if (fFile==NULL) { // grid file not found, create new local default file
32       printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data());
33       // create default empty file:
34       fFileName = "test999.root";
35       fScanInfo = new AliITSOnlineSPDscanInfoMeanTh();
36       fInfoModified=kTRUE;
37       fFile = new TFile(fFileName.Data(), "RECREATE");
38       fWrite=kTRUE;
39     }
40     else { // read from file (grid or local)
41       fWrite=kFALSE;
42       fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo);
43     }
44   }
45   else { // create new local file
46     fScanInfo = new AliITSOnlineSPDscanInfoMeanTh();
47     fInfoModified=kTRUE;
48     fFile = new TFile(fFileName.Data(), "RECREATE");
49     fWrite=kTRUE;
50   }
51
52   Init();
53 }
54
55 AliITSOnlineSPDscanMeanTh::AliITSOnlineSPDscanMeanTh(const AliITSOnlineSPDscanMeanTh& scan) :
56   AliITSOnlineSPDscanMultiple(scan)
57 {}
58
59 AliITSOnlineSPDscanMeanTh::~AliITSOnlineSPDscanMeanTh() {}
60
61 AliITSOnlineSPDscanMeanTh& AliITSOnlineSPDscanMeanTh::operator=(const AliITSOnlineSPDscanMeanTh& scan) {
62   // assignment operator (should not be used)
63   printf("This object should not be copied!");
64   if (this!=&scan) {
65     // still do nothing...
66   }
67   return *this;
68 }
69
70 UInt_t AliITSOnlineSPDscanMeanTh::AddScanStep() {
71   CreateNewStep();
72   return ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->AddScanStep();
73 }
74
75 void AliITSOnlineSPDscanMeanTh::SetDacLow(UInt_t nsi, UInt_t hs, Int_t val) {
76   // set dac low value for step nsi and half stave hs
77   SwitchToStep(nsi);
78   ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->SetDacLow(nsi,hs,val); 
79   fInfoModified=kTRUE;
80 }
81 void AliITSOnlineSPDscanMeanTh::SetDacHigh(UInt_t nsi, UInt_t hs, Int_t val) {
82   // set dac high value for step nsi and half stave hs
83   SwitchToStep(nsi);
84   ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->SetDacHigh(nsi,hs,val); 
85   fInfoModified=kTRUE;
86 }
87 void AliITSOnlineSPDscanMeanTh::SetTPAmp(UInt_t nsi, UInt_t hs, Int_t val) {
88   // set test pulse amplitude for step nsi and half stave hs
89   SwitchToStep(nsi);
90   ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->SetTPAmp(nsi,hs,val); 
91   fInfoModified=kTRUE;
92 }
93
94 Int_t AliITSOnlineSPDscanMeanTh::GetDacLow(UInt_t nsi, UInt_t hs) {
95   return ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->GetDacLow(nsi,hs);
96 }
97 Int_t AliITSOnlineSPDscanMeanTh::GetDacHigh(UInt_t nsi, UInt_t hs) {
98   return ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->GetDacHigh(nsi,hs);
99 }
100 Int_t AliITSOnlineSPDscanMeanTh::GetTPAmp(UInt_t nsi, UInt_t hs) {
101   return ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->GetTPAmp(nsi,hs);
102 }