Line data Source code
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 0 : AliITSOnlineSPDscanMeanTh::AliITSOnlineSPDscanMeanTh(const Char_t *fileName, Bool_t readFromGridFile) {
12 : // constructor
13 0 : fFileName=fileName;
14 0 : fModified=kFALSE;
15 0 : 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 0 : Bool_t bRead = readFromGridFile;
20 :
21 0 : if (!bRead) {
22 0 : FILE* fp0 = fopen(fFileName.Data(), "r");
23 0 : if (fp0 != NULL) {
24 : bRead=kTRUE;
25 0 : fclose(fp0);
26 : }
27 0 : }
28 :
29 0 : if (bRead) { // open file for reading
30 0 : fFile = TFile::Open(fFileName.Data(), "READ");
31 0 : if (fFile==NULL) { // grid file not found, create new local default file
32 0 : printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data());
33 : // create default empty file:
34 0 : fFileName = "test999.root";
35 0 : fScanInfo = new AliITSOnlineSPDscanInfoMeanTh();
36 0 : fInfoModified=kTRUE;
37 0 : fFile = new TFile(fFileName.Data(), "RECREATE");
38 0 : fWrite=kTRUE;
39 0 : }
40 : else { // read from file (grid or local)
41 0 : fWrite=kFALSE;
42 0 : fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo);
43 : }
44 : }
45 : else { // create new local file
46 0 : fScanInfo = new AliITSOnlineSPDscanInfoMeanTh();
47 0 : fInfoModified=kTRUE;
48 0 : fFile = new TFile(fFileName.Data(), "RECREATE");
49 0 : fWrite=kTRUE;
50 : }
51 :
52 0 : Init();
53 0 : }
54 :
55 : AliITSOnlineSPDscanMeanTh::AliITSOnlineSPDscanMeanTh(const AliITSOnlineSPDscanMeanTh& scan) :
56 0 : AliITSOnlineSPDscanMultiple(scan)
57 0 : {}
58 :
59 0 : AliITSOnlineSPDscanMeanTh::~AliITSOnlineSPDscanMeanTh() {}
60 :
61 : AliITSOnlineSPDscanMeanTh& AliITSOnlineSPDscanMeanTh::operator=(const AliITSOnlineSPDscanMeanTh& scan) {
62 : // assignment operator (should not be used)
63 0 : printf("This object should not be copied!");
64 : if (this!=&scan) {
65 : // still do nothing...
66 : }
67 0 : return *this;
68 : }
69 :
70 : UInt_t AliITSOnlineSPDscanMeanTh::AddScanStep() {
71 0 : CreateNewStep();
72 0 : 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 0 : SwitchToStep(nsi);
78 0 : ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->SetDacLow(nsi,hs,val);
79 0 : fInfoModified=kTRUE;
80 0 : }
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 0 : SwitchToStep(nsi);
84 0 : ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->SetDacHigh(nsi,hs,val);
85 0 : fInfoModified=kTRUE;
86 0 : }
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 0 : SwitchToStep(nsi);
90 0 : ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->SetTPAmp(nsi,hs,val);
91 0 : fInfoModified=kTRUE;
92 0 : }
93 :
94 : Int_t AliITSOnlineSPDscanMeanTh::GetDacLow(UInt_t nsi, UInt_t hs) {
95 0 : return ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->GetDacLow(nsi,hs);
96 : }
97 : Int_t AliITSOnlineSPDscanMeanTh::GetDacHigh(UInt_t nsi, UInt_t hs) {
98 0 : return ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->GetDacHigh(nsi,hs);
99 : }
100 : Int_t AliITSOnlineSPDscanMeanTh::GetTPAmp(UInt_t nsi, UInt_t hs) {
101 0 : return ((AliITSOnlineSPDscanInfoMeanTh*)fScanInfo)->GetTPAmp(nsi,hs);
102 : }
|