Adding macros to create Calibration objects
[u/mrichter/AliRoot.git] / TRD / TRDbase / AliTRDCreateDummyCDB_DCS.C
CommitLineData
3c3cc352 1#if !defined( __CINT__) || defined(__MAKECINT__)
2
3#include <iostream>
4
5#include <AliCDBManager.h>
6#include <AliCDBStorage.h>
7#include <AliCDBEntry.h>
8#include <AliCDBMetaData.h>
9
10#include "AliTRDgeometry.h"
11
12#include "AliTRDCalDCS.h"
13#include "AliTRDCalDCSFEE.h"
14
15#endif
16
17// ===================================================
18// Modified version of the macro AliTRDCreateDummyCDB
19// to create the default object for the DCS CDB entry
20// Modifications done by Frederick Kramer 2010-05-11
21// ===================================================
22
23
24
25// Run numbers for the dummy file
26const Int_t gkDummyRunBeg = 0;
27const Int_t gkDummyRunEnd = 999999999;
28AliCDBStorage *gStorLoc = 0;
29
30
31
32//_____________________________________________________________________________
33TObjArray *CreateDCSObject()
34{
35 const Int_t nROC = 540;
36 const Int_t nROB = 8;
37 const Int_t nMCM = 18;
38
39
40 AliTRDCalDCS* fCalDCSObjSOR = new AliTRDCalDCS();
41 AliTRDCalDCS* fCalDCSObjEOR = new AliTRDCalDCS();
42 TObjArray* fFEEArrSOR = new TObjArray(nROC);
43 TObjArray* fFEEArrEOR = new TObjArray(nROC);
44 fFEEArrSOR->SetOwner();
45 fFEEArrEOR->SetOwner();
46 fCalDCSObjSOR->SetObjectStat(1);
47 fCalDCSObjEOR->SetObjectStat(1);
48 fFEEArrSOR->SetObjectStat(1);
49 fFEEArrEOR->SetObjectStat(1);
50
51
52 for (Int_t iROC=0; iROC<nROC; iROC++) {
53 AliTRDCalDCSFEE* fDCSFEEObjSOR = new AliTRDCalDCSFEE();
54 fDCSFEEObjSOR->SetObjectStat(1);
55 AliTRDgeometry aliGeo;
56 Int_t sm = aliGeo.GetSector(iROC);
57 Int_t stack = aliGeo.GetStack(iROC);
58 Int_t layer = aliGeo.GetLayer(iROC);
59
60 fDCSFEEObjSOR->SetConfigName("cf_p_zs-s16-deh_tb30_csmtrk_ptrg");
61 fDCSFEEObjSOR->SetConfigTag(1681);
62 fDCSFEEObjSOR->SetConfigVersion("r3303");
63 fDCSFEEObjSOR->SetNumberOfTimeBins(30);
64 fDCSFEEObjSOR->SetSM(sm);
65 fDCSFEEObjSOR->SetStack(stack);
66 fDCSFEEObjSOR->SetLayer(layer);
67 fDCSFEEObjSOR->SetFilterType("p");
68 fDCSFEEObjSOR->SetReadoutParam("zs");
69 fDCSFEEObjSOR->SetTrackletMode("csmtrk");
70 fDCSFEEObjSOR->SetTriggerSetup("ptrg");
71
72 AliTRDCalDCSFEE* fDCSFEEObjEOR = (AliTRDCalDCSFEE*)fDCSFEEObjSOR->Clone();
73
74 for (Int_t iROB=0; iROB<nROB; iROB++) {
75 for (Int_t iMCM=0; iMCM<nMCM; iMCM++) {
76 // SOR
77 fDCSFEEObjSOR->SetMCMGlobalState(iROB, iMCM, 3);
78 fDCSFEEObjSOR->SetMCMStateNI(iROB, iMCM, 0);
79 fDCSFEEObjSOR->SetMCMEventCnt(iROB, iMCM, 0);
80 fDCSFEEObjSOR->SetMCMPtCnt(iROB, iMCM, 0);
81 // EOR
82 fDCSFEEObjEOR->SetMCMGlobalState(iROB, iMCM, 3);
83 fDCSFEEObjEOR->SetMCMStateNI(iROB, iMCM, 0);
84 fDCSFEEObjEOR->SetMCMEventCnt(iROB, iMCM, 1000);
85 fDCSFEEObjEOR->SetMCMPtCnt(iROB, iMCM, 1000);
86 } //iMCM
87 } // iROB
88
89 fFEEArrSOR->AddAt(fDCSFEEObjSOR, iROC);
90 fFEEArrEOR->AddAt(fDCSFEEObjEOR, iROC);
91 } // iROC
92
93
94 fCalDCSObjSOR->SetFEEArr(fFEEArrSOR);
95 fCalDCSObjSOR->EvaluateGlobalParameters();
96 fCalDCSObjEOR->SetFEEArr(fFEEArrEOR);
97 fCalDCSObjEOR->EvaluateGlobalParameters();
98
99 TObjArray* fCalObjArray = new TObjArray(2);
100 fCalObjArray->SetOwner();
101 fCalObjArray->AddAt(fCalDCSObjSOR,0);
102 fCalObjArray->AddAt(fCalDCSObjEOR,1);
103
104
105 return fCalObjArray;
106}
107
108
109//_____________________________________________________________________________
110AliCDBMetaData *CreateMetaObject(const char *objectClassName)
111{
112
113 AliCDBMetaData *md1= new AliCDBMetaData();
114 md1->SetObjectClassName(objectClassName);
115 md1->SetResponsible("Frederick Kramer");
116 md1->SetBeamPeriod(1);
117 md1->SetAliRootVersion("05-26-00b"); //root version
118 md1->SetComment("Ideal DCS configuration data in two AliTRDCalDCS objects in one TObjArray (0:SOR, 1:EOR).");
119
120 return md1;
121
122}
123
124//_____________________________________________________________________________
125void StoreObject(const char *cdbPath, TObjArray *object, AliCDBMetaData *metaData)
126{
127
128 AliCDBId id1(cdbPath,gkDummyRunBeg,gkDummyRunEnd);
129 gStorLoc->Put(object,id1,metaData);
130
131}
132
133
134//_____________________________________________________________________________
135void AliTRDCreateDummyCDB_DCS()
136{
137
138 cout << endl
139 << "TRD :: Creating dummy CDB for the runs "
140 << gkDummyRunBeg
141 << " -- "
142 << gkDummyRunEnd
143 << endl;
144
145 AliCDBManager *man = AliCDBManager::Instance();
146 gStorLoc = man->GetStorage("local://$ALICE_ROOT/OCDB");
147 if (!gStorLoc) {
148 return;
149 }
150
151 TObjArray *obj = 0;
152 AliCDBMetaData *metaData = 0;
153
154 //
155 // Status objects
156 //
157
158 metaData = CreateMetaObject("DCS");
159 obj = CreateDCSObject();
160 StoreObject("TRD/Calib/DCS", obj, metaData);
161
162}
163