]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliDBPPR.cxx
cover case for AOD analysis
[u/mrichter/AliRoot.git] / PHOS / AliDBPPR.cxx
CommitLineData
ba230b91 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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// DB Class for table PPR:
20//
21//*-- Author: Yves Schutz (SUBATECH)
22//////////////////////////////////////////////////////////////////////////////
23
24#include <stdlib.h>
ba230b91 25
26// --- ROOT system ---
27#include "TSQLServer.h"
28#include "TSQLRow.h"
29#include "TSQLResult.h"
30#include "TDatime.h"
31
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliDBPPR.h"
36
37ClassImp(AliDBPPR)
38//____________________________________________________________________________
39AliDBPPR::AliDBPPR()
40{
41 fCurrentEntry = 1 ; // first valid entry (0 = labels)
42 fNfields = 6 ;
43 fFields = new TString[6];
44 fFields[0] = "RUN";
45 fFields[1] = "EVENT";
46 fFields[2] = "DATE";
47 fFields[3] = "SIMULATION";
48 fFields[4] = "DIGITIZATION";
49 fFields[5] = "RECONSTRUCTION";
50}
51//____________________________________________________________________________
52AliDBPPR::~AliDBPPR()
53{
54 delete[] fFields ;
55}
56//____________________________________________________________________________
57void AliDBPPR::GetEntry(Option_t * opt)
58{
59 // Retrieves one single row from the table // opt = first : retrieves first entry
60 // opt = last : retrieves last entry
61 // opt = next : retrieves next to current entry
62 TSQLServer * mysql = TSQLServer::Connect("mysql://ccmysql.in2p3.fr:3306/alice", "schutz", "po2hgwy") ;
63 TSQLResult * result = mysql->Query("SELECT * FROM PPR") ;
64 Int_t count = result->GetRowCount() ;
65 if ( !strcmp(opt, "first") ) fCurrentEntry = 1 ;
66 if ( !strcmp(opt, "last") ) fCurrentEntry = count ;
67 if ( fCurrentEntry > count ) fCurrentEntry = 1 ;
68 Int_t i;
69 Int_t end = fCurrentEntry ;
70 TSQLRow * row = 0 ;
71 for ( i = 0 ; i < end ; i++ ) {
72 fCurrentEntry++ ;
73 row = result->Next() ;
74 }
75 fRUN = atoi(row->GetField(0)) ;
76 fEVENT = atoi(row->GetField(1)) ;
7bac2111 77 fDATE = TDatime(row->GetField(2)) ;
ba230b91 78 fSIMULATION = row->GetField(3) ;
79 fDIGITIZATION = row->GetField(4) ;
80 fRECONSTRUCTION = row->GetField(5) ;
81}