Line data Source code
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 :
18 : ////////////////////////////////////////////////////////////
19 : // Author: Henrik Tydesjo //
20 : // Interface class to the containers of an online scan //
21 : // with only one step. //
22 : ////////////////////////////////////////////////////////////
23 :
24 :
25 : #include <TFile.h>
26 : #include "AliITSOnlineSPDscanSingle.h"
27 : #include "AliITSOnlineSPDscanInfo.h"
28 :
29 0 : AliITSOnlineSPDscanSingle::AliITSOnlineSPDscanSingle(const Char_t *fileName, Bool_t readFromGridFile) {
30 : // constructor
31 0 : fFileName=fileName;
32 0 : fModified=kFALSE;
33 0 : fInfoModified=kFALSE;
34 : // look for a previously saved info object
35 : // (if file not found create a new one and return, else read)
36 :
37 0 : Bool_t bRead = readFromGridFile;
38 :
39 0 : if (!bRead) {
40 0 : FILE* fp0 = fopen(fFileName.Data(), "r");
41 0 : if (fp0 != NULL) {
42 : bRead=kTRUE;
43 0 : fclose(fp0);
44 : }
45 0 : }
46 :
47 0 : if (bRead) { // open file for reading
48 0 : fFile = TFile::Open(fFileName.Data(), "READ");
49 0 : if (fFile==NULL) { // grid file not found, create new local default file
50 0 : printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data());
51 : // create default empty file:
52 0 : fFileName = "test999.root";
53 0 : fScanInfo = new AliITSOnlineSPDscanInfo();
54 0 : fInfoModified=kTRUE;
55 0 : fFile = new TFile(fFileName.Data(), "RECREATE");
56 0 : fWrite=kTRUE;
57 0 : }
58 : else { // read from file (grid or local)
59 0 : fWrite=kFALSE;
60 0 : fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo);
61 : }
62 : }
63 : else { // create new local file
64 0 : fScanInfo = new AliITSOnlineSPDscanInfo();
65 0 : fInfoModified=kTRUE;
66 0 : fFile = new TFile(fFileName.Data(), "RECREATE");
67 0 : fWrite=kTRUE;
68 : }
69 :
70 0 : Init();
71 0 : }
72 0 : AliITSOnlineSPDscanSingle::~AliITSOnlineSPDscanSingle() {}
73 :
74 : // call the corresponding methods in SPDscan with nsi=0 ******************
75 : void AliITSOnlineSPDscanSingle::SetTriggers(UInt_t val)
76 0 : {AliITSOnlineSPDscan::SetTriggers(0,val);}
77 : void AliITSOnlineSPDscanSingle::SetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi, UInt_t val)
78 0 : {AliITSOnlineSPDscan::SetHits(0,hs,chipi,coli,rowi,val);}
79 : void AliITSOnlineSPDscanSingle::IncrementTriggers()
80 0 : {AliITSOnlineSPDscan::IncrementTriggers(0);}
81 : void AliITSOnlineSPDscanSingle::IncrementHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi)
82 0 : {AliITSOnlineSPDscan::IncrementHits(0,hs,chipi,coli,rowi);}
83 : void AliITSOnlineSPDscanSingle::SetHitEvents(UInt_t hs, UInt_t chipi, UInt_t val)
84 0 : {AliITSOnlineSPDscan::SetHitEvents(0,hs,chipi,val);}
85 : void AliITSOnlineSPDscanSingle::SetHitEventsTot(UInt_t hs, UInt_t val)
86 0 : {AliITSOnlineSPDscan::SetHitEventsTot(0,hs,val);}
87 : void AliITSOnlineSPDscanSingle::IncrementHitEvents(UInt_t hs, UInt_t chipi)
88 0 : {AliITSOnlineSPDscan::IncrementHitEvents(0,hs,chipi);}
89 : void AliITSOnlineSPDscanSingle::IncrementHitEventsTot(UInt_t hs)
90 0 : {AliITSOnlineSPDscan::IncrementHitEventsTot(0,hs);}
91 : UInt_t AliITSOnlineSPDscanSingle::GetTriggers() const
92 0 : {return AliITSOnlineSPDscan::GetTriggers(0);}
93 : UInt_t AliITSOnlineSPDscanSingle::GetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi)
94 0 : {return AliITSOnlineSPDscan::GetHits(0,hs,chipi,coli,rowi);}
95 : Float_t AliITSOnlineSPDscanSingle::GetHitsEfficiency(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi)
96 0 : {return AliITSOnlineSPDscan::GetHitsEfficiency(0,hs,chipi,coli,rowi);}
97 : Float_t AliITSOnlineSPDscanSingle::GetHitsEfficiencyError(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi)
98 0 : {return AliITSOnlineSPDscan::GetHitsEfficiencyError(0,hs,chipi,coli,rowi);}
99 : UInt_t AliITSOnlineSPDscanSingle::GetHitEvents(UInt_t hs, UInt_t chipi)
100 0 : {return AliITSOnlineSPDscan::GetHitEvents(0,hs,chipi);}
101 : UInt_t AliITSOnlineSPDscanSingle::GetHitEventsTot(UInt_t hs)
102 0 : {return AliITSOnlineSPDscan::GetHitEventsTot(0,hs);}
103 : Float_t AliITSOnlineSPDscanSingle::GetHitEventsEfficiency(UInt_t hs, UInt_t chipi)
104 0 : {return AliITSOnlineSPDscan::GetHitEventsEfficiency(0,hs,chipi);}
105 : Float_t AliITSOnlineSPDscanSingle::GetHitEventsTotEfficiency(UInt_t hs)
106 0 : {return AliITSOnlineSPDscan::GetHitEventsTotEfficiency(0,hs);}
107 : Float_t AliITSOnlineSPDscanSingle::GetHitEventsEfficiencyError(UInt_t hs, UInt_t chipi)
108 0 : {return AliITSOnlineSPDscan::GetHitEventsEfficiencyError(0,hs,chipi);}
109 : Float_t AliITSOnlineSPDscanSingle::GetHitEventsTotEfficiencyError(UInt_t hs)
110 0 : {return AliITSOnlineSPDscan::GetHitEventsTotEfficiencyError(0,hs);}
111 : Float_t AliITSOnlineSPDscanSingle::GetAverageMultiplicity(UInt_t hs, UInt_t chipi)
112 0 : {return AliITSOnlineSPDscan::GetAverageMultiplicity(0,hs,chipi);}
113 : Float_t AliITSOnlineSPDscanSingle::GetAverageMultiplicityTot(UInt_t hs)
114 0 : {return AliITSOnlineSPDscan::GetAverageMultiplicityTot(0,hs);}
|