]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/XtAnalysis/AliJBaseCard.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / XtAnalysis / AliJBaseCard.h
1 //=================================================
2 // AliJBaseCard.h
3 // last modified FK 6.NOV 2009
4 //=================================================
5
6 #ifndef ALIJBASECARD_H
7 #define ALIJBASECARD_H
8
9 #include <TObject.h>
10
11 #include <iostream>
12 #include <fstream>
13
14 #include <TString.h>
15 #include <TVector.h>
16 #include <TMath.h>
17 #include <TObjArray.h>
18 #include <TObjString.h>
19 #include <TFile.h>
20 #include <TF1.h>
21 #include <vector>
22 #include <THashList.h>
23 #include <TNamed.h>
24
25 using namespace std;
26 #ifndef AliJMaxDimBuffer
27 #define AliJMaxDimBuffer
28 const int kMaxDimBuffer = 300;//max length of a line read to a buffe
29 #endif
30
31 class AliJBaseCard {
32
33   //====   M e m b e r    F u n c t i o n s   ========
34
35 public:
36
37   AliJBaseCard(); // constructor
38   AliJBaseCard(const char *filename); // constructor
39   AliJBaseCard& operator=(const AliJBaseCard& obj);
40
41   virtual ~AliJBaseCard();
42
43   void AddToKeyTable( TString key, int index ){
44     TNamed * ko = new TNamed(key.Data(),"");
45     ko->SetUniqueID(index);
46     fKeyTable.Add(ko);// TODO check duplicate
47   }
48
49   float  Get(TString keyword, int VectorComponent=0); //get TVector component 
50   TString  GetStr(TString keyword ); //get TVector component 
51   TVector* GetVector( TString keyword );
52   int    GetN(TString keyword);       //get TVector dimension
53   void   PrintOut(); 
54   void   WriteCard(TFile *file);  
55
56   virtual void InitCard();
57   void FinishCard() const {cout << "card finished" << endl;};
58   void ReadInputLine( const char* buffer );
59
60 protected:
61   void    ReadInputCard();
62
63   int     GetNwithIndex(int i){ return fValuesVector[i].GetNrows(); }
64
65   unsigned int GetTVectorIndex(TString keyword, int tol=0);
66
67   //====   D a t a    M e m b e r s  ========
68
69   char fcardname[255];   // file name
70   int  fnentry;                   //Number of lines in cfg file
71   std::vector< TString >   fKeyWordVector;    //array of key words
72   std::vector< TVector >   fValuesVector;     //array of float number confg parameter vectors 
73   std::vector< TString >   fValueString;      // Storage of raw inut string for each item
74   //std::map< TString, unsigned int > MapKeyWordToTVector;//mapping keywords to TVector
75   THashList           fKeyTable;              // key map with hash algorithm
76
77   //ClassDef(AliJBaseCard, 1); // EMCAL for jcorran
78 };
79
80 #endif
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102