Separating well and badly reconstructed pileup vertices. Adding statistics of associa...
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSPDscanMultiple.cxx
CommitLineData
b15de2d2 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
b15de2d2 11AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple():AliITSOnlineSPDscan(){
12// Default constructor
13}
6ddf3d66 14AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple(const Char_t *fileName, Bool_t readFromGridFile) {
b15de2d2 15 // constructor
53ae21ce 16 fFileName=fileName;
6ddf3d66 17 fModified=kFALSE;
18 fInfoModified=kFALSE;
b15de2d2 19 // look for a previously saved info object
20 // (if file not found create a new one and return, else read)
6ddf3d66 21
22 Bool_t bRead = readFromGridFile;
23
24 if (!bRead) {
25 FILE* fp0 = fopen(fFileName.Data(), "r");
26 if (fp0 != NULL) {
27 bRead=kTRUE;
28 fclose(fp0);
29 }
30 }
31
32 if (bRead) { // open file for reading
33 fFile = TFile::Open(fFileName.Data(), "READ");
34 if (fFile==NULL) { // grid file not found, create new local default file
35 printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data());
36 // create default empty file:
37 fFileName = "test999.root";
38 fScanInfo = new AliITSOnlineSPDscanInfoMultiple();
39 fInfoModified=kTRUE;
40 fFile = new TFile(fFileName.Data(), "RECREATE");
41 fWrite=kTRUE;
42 }
43 else { // read from file (grid or local)
44 fWrite=kFALSE;
45 fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo);
46 }
47 }
48 else { // create new local file
b15de2d2 49 fScanInfo = new AliITSOnlineSPDscanInfoMultiple();
6ddf3d66 50 fInfoModified=kTRUE;
53ae21ce 51 fFile = new TFile(fFileName.Data(), "RECREATE");
b15de2d2 52 fWrite=kTRUE;
53 }
6ddf3d66 54
b15de2d2 55 Init();
56}
57
58AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple(const AliITSOnlineSPDscanMultiple& scan) :
59 AliITSOnlineSPDscan(scan)
60{}
61
62AliITSOnlineSPDscanMultiple::~AliITSOnlineSPDscanMultiple() {}
63
64AliITSOnlineSPDscanMultiple& AliITSOnlineSPDscanMultiple::operator=(const AliITSOnlineSPDscanMultiple& scan) {
65 // Assignment operator, should not be called!!!
66 printf("This object should not be copied!");
67 if (this!=&scan) {
68 // still do nothing...
69 }
70 return *this;
71}
72
b15de2d2 73UInt_t AliITSOnlineSPDscanMultiple::AddScanStep() {
74 CreateNewStep();
75 return ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->AddScanStep();
76}
77
78void AliITSOnlineSPDscanMultiple::SetDacId(Int_t val) {
79 ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->SetDacId(val);
80 fInfoModified=kTRUE;
81}
82void AliITSOnlineSPDscanMultiple::SetDacValue(UInt_t nsi, Int_t val) {
83 // set dac value for step nsi
84 SwitchToStep(nsi);
85 ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->SetDacValue(nsi,val);
86 fInfoModified=kTRUE;
87}
88Int_t AliITSOnlineSPDscanMultiple::GetDacId() {
89 return ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->GetDacId();
90}
91Int_t AliITSOnlineSPDscanMultiple::GetDacValue(UInt_t nsi) {
92 return ((AliITSOnlineSPDscanInfoMultiple*)fScanInfo)->GetDacValue(nsi);
93}