Export hit structure header
[u/mrichter/AliRoot.git] / FMD / FMDUtilda.h
CommitLineData
e0c60e77 1#ifndef FMDUTILDA_H
2#define FMDUTILDA_H
3#include "AliFMDBaseDA.h"
4#include "daqDA.h"
5#include <stdexcept>
6#include <iostream>
7#ifdef ALI_AMORE
8# include <AmoreDA.h>
9# include <TH2.h>
10# include <TSystem.h>
11#endif
12
13void
14PostSummaries(AliFMDBaseDA& da, const char* prefix, Int_t runNumber)
15{
16#ifndef ALI_AMORE
17 std::cerr << "AMORE not found - nothing posted" << std::endl;
18 return;
19#else
20 try {
21 TString daName(gSystem->Getenv("AMORE_DA_NAME"));
22 if (daName.IsNull()) {
23 daName = gSystem->Getenv("DATE_ROLE_NAME");
24 if (daName.IsNull())
25 gSystem->Setenv("AMORE_DA_NAME", "FMD");
26 }
27 amore::da::AmoreDA myAmore(amore::da::AmoreDA::kSender);
28
29 for (UShort_t det = 1; det <= 3; det++) {
30 if (!da.HasSeenDetector(det)) continue;
31 TObject* runNo = new TObject;
32 runNo->SetUniqueID(runNumber);
33 myAmore.Send(Form("%sRunNoFMD%d", prefix, det), runNo);
34 }
35
36 TIter next(&da.GetSummaries());
37 TObject* obj = 0;
38 while ((obj = next()))
39 myAmore.Send(obj->GetName(), obj);
40
41 }
42 catch (std::exception& e) {
43 std::cerr << "Failed to make AMORE instance: " << e.what() << std::endl;
44 }
45#endif
46}
47
48Int_t
49UploadFiles(const char** files, const char** ids)
50{
51 const char** pFile = files;
52 const char** pId = ids;
53
54 Int_t ret = 0;
55 while (*pFile && *pId) {
56 Int_t lret = daqDA_FES_storeFile(*pFile, *pId);
57 if (lret != 0) {
58 std::cerr << "Failed to upload " << *pFile << " to FES id "
59 << *pId << std::endl;
60 ret++;
61 }
62 pFile++;
63 pId++;
64 }
65 return ret;
66}
67
68
69
70#endif // FMDUTILDA_H
71// Local Variables:
72// mode: C++
73// End:
74