1 MakeCDBEntryProblematic(Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity(), const Char_t *filename = NULL, const Char_t *dbString = "local://$ALICE_ROOT/OCDB")
5 TH1C *obj = new TH1C("hProblematic", "", 157248, 0., 157248.);
9 printf("PROBLEMATIC HISTO WILL BE UPDATED ACCORDING TO INPUT LIST\n");
10 printf("inputList: %s\n", filename);
11 UpdateProblematicHisto(obj, filename);
14 printf("EMPTY PROBLEMATIC HISTO WILL BE GENERATED\n");
18 AliCDBId id("TOF/Calib/Problematic", startRun, endRun);
19 AliCDBMetaData *md = new AliCDBMetaData();
20 md->SetResponsible("Roberto Preghenella");
21 md->SetComment("Problematic");
22 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
25 /* put object in cdb */
26 AliCDBManager *cdb = AliCDBManager::Instance();
27 cdb->SetDefaultStorage(dbString);
28 cdb->GetDefaultStorage()->Put(obj, id, md);
33 UpdateProblematicHisto(TH1C *histo, const Char_t *filename)
36 * this routine updates the problematic histo taking
37 * problematic channels from a list specified in the
38 * file written in ASCII format according to the
39 * following formats based on electronics-oriented indices:
41 * # disable single crate
44 * # disable single TRM
45 * # crate[0-71] trm[3-12]
47 * # disable single chain
48 * # crate[0-71] trm[3-12] chain[0-1]
50 * # disable single TDC
51 * # crate[0-71] trm[3-12] chain[0-1] tdc[0-14]
53 * # disable single channel
54 * # crate[0-71] trm[3-12] chain[0-1] tdc[0-14] channel[0-7]
58 * # this list will set as problematics:
59 * # - all channels of crate-39
60 * # - all channels of TRM-03 crate-40
61 * # - all channels of chain-A TRM-07 crate-04
62 * # - all channels of TDC-04 chain-B TRM-09 crate-07
63 * # - channel-03 TDC-02 chain-A TRM-04 crate-00
74 printf("WARNING: NULL histo, will just run in DUMMY mode\n");
79 filein.open(filename, ifstream::in);
81 /* loop over lines in file */
86 Int_t crate, trm, chain, tdc, channel;
87 Int_t irequest = 0, nflagged;
88 printf("processing requests to flag problematic channels:\n");
89 while (filein.good()) {
90 filein.getline(buf, 1024);
91 /* check whether we got to EOF */
92 if (filein.eof()) break;
93 /* put buffer in a TString */
95 /* check whether commented line */
96 if (str.BeginsWith("#")) continue;
99 oa = str.Tokenize(" ");
100 switch (oa->GetEntries()) {
102 ostr = (TObjString *)oa->At(0);
103 crate = atoi(ostr->GetName());
104 if (crate < 0 || crate > 71) {
105 printf("%d.) invalid crate number: %d\n", irequest, crate);
108 nflagged = FlagAsProblematic(histo, crate);
109 printf("%d.) crate flagged as problematic (%d channels): crate-%02d\n", irequest, nflagged, crate);
112 ostr = (TObjString *)oa->At(0);
113 crate = atoi(ostr->GetName());
114 if (crate < 0 || crate > 71) {
115 printf("%d.) invalid crate number: %d\n", irequest, crate);
118 ostr = (TObjString *)oa->At(1);
119 trm = atoi(ostr->GetName());
120 if (trm < 3 || trm > 12) {
121 printf("%d.) invalid TRM number: %d\n", irequest, trm);
124 nflagged = FlagAsProblematic(histo, crate, trm);
125 printf("%d.) TRM flagged as problematic (%d channels): crate-%02d TRM-%02d\n", irequest, nflagged, crate, trm);
128 ostr = (TObjString *)oa->At(0);
129 crate = atoi(ostr->GetName());
130 if (crate < 0 || crate > 71) {
131 printf("%d.) invalid crate number: %d\n", irequest, crate);
134 ostr = (TObjString *)oa->At(1);
135 trm = atoi(ostr->GetName());
136 if (trm < 3 || trm > 12) {
137 printf("%d.) invalid TRM number: %d\n", irequest, trm);
140 ostr = (TObjString *)oa->At(2);
141 chain = atoi(ostr->GetName());
142 if (chain < 0 || chain > 1) {
143 printf("%d.) invalid chain number: %d\n", irequest, chain);
146 nflagged = FlagAsProblematic(histo, crate, trm, chain);
147 printf("%d.) chain flagged as problematic (%d channels): crate-%02d TRM-%02d chain-%s\n", irequest, nflagged, crate, trm, chain == 0 ? "A" : "B");
150 ostr = (TObjString *)oa->At(0);
151 crate = atoi(ostr->GetName());
152 if (crate < 0 || crate > 71) {
153 printf("%d.) invalid crate number: %d\n", irequest, crate);
156 ostr = (TObjString *)oa->At(1);
157 trm = atoi(ostr->GetName());
158 if (trm < 3 || trm > 12) {
159 printf("%d.) invalid TRM number: %d\n", irequest, trm);
162 ostr = (TObjString *)oa->At(2);
163 chain = atoi(ostr->GetName());
164 if (chain < 0 || chain > 1) {
165 printf("%d.) invalid chain number: %d\n", irequest, chain);
168 ostr = (TObjString *)oa->At(3);
169 tdc = atoi(ostr->GetName());
170 if (tdc < 0 || tdc > 14) {
171 printf("%d.) invalid chain number: %d\n", irequest, chain);
174 nflagged = FlagAsProblematic(histo, crate, trm, chain, tdc);
175 printf("%d.) TDC flagged as problematic (%d channels): crate-%02d TRM-%02d chain-%s TDC-%02d\n", irequest, nflagged, crate, trm, chain == 0 ? "A" : "B", tdc);
178 ostr = (TObjString *)oa->At(0);
179 crate = atoi(ostr->GetName());
180 if (crate < 0 || crate > 71) {
181 printf("%d.) invalid crate number: %d\n", irequest, crate);
184 ostr = (TObjString *)oa->At(1);
185 trm = atoi(ostr->GetName());
186 if (trm < 3 || trm > 12) {
187 printf("invalid TRM number: %d\n", irequest, trm);
190 ostr = (TObjString *)oa->At(2);
191 chain = atoi(ostr->GetName());
192 if (chain < 0 || chain > 1) {
193 printf("%d.) invalid chain number: %d\n", irequest, chain);
196 ostr = (TObjString *)oa->At(3);
197 tdc = atoi(ostr->GetName());
198 if (tdc < 0 || tdc > 14) {
199 printf("%d.) invalid chain number: %d\n", irequest, chain);
202 ostr = (TObjString *)oa->At(4);
203 channel = atoi(ostr->GetName());
204 if (channel < 0 || channel > 7) {
205 printf("%d.) invalid channel number: %d\n", irequest, channel);
208 nflagged = FlagAsProblematic(histo, crate, trm, chain, tdc, channel);
209 printf("%d.) channel flagged as problematic (%d channels): crate-%02d TRM-%02d chain-%s TDC-%02d, channel-%d\n", irequest, nflagged, crate, trm, chain == 0 ? "A" : "B", tdc, channel);
212 printf("%d.) invalid format: %s\n", irequest, str.Data());
224 FlagAsProblematic(TH1C *histo, Int_t crate = -1, Int_t trm = -1, Int_t chain = -1, Int_t tdc = -1, Int_t channel = -1)
228 * flag as problematic according to parameters
231 /* loop over everything checking request */
232 Int_t det[5], dummy, index, nflagged = 0;
233 for (Int_t icrate = 0; icrate < 72; icrate++) {
234 if (crate != -1 && icrate != crate) continue;
235 for (Int_t itrm = 3; itrm <= 12; itrm++) {
236 if (trm != -1 && itrm != trm) continue;
237 for (Int_t ichain = 0; ichain < 2; ichain++) {
238 if (chain != -1 && ichain != chain) continue;
239 for (Int_t itdc = 0; itdc < 15; itdc++) {
240 if (tdc != -1 && itdc != tdc) continue;
241 for (Int_t ichannel = 0; ichannel < 8; ichannel++) {
242 if (channel != -1 && ichannel != channel) continue;
243 AliTOFRawStream::EquipmentId2VolumeId(icrate, itrm, ichain, itdc, ichannel, det);
247 if (det[0] < 0 || det[0] > 17 ||
248 det[1] < 0 || det[1] > 4 ||
249 det[2] < 0 || det[2] > 18 ||
250 det[3] < 0 || det[3] > 1 ||
251 det[4] < 0 || det[4] > 47) {
252 // printf("invalid volume indices: EO = (%d %d %d %d %d), VOL = (%d %d %d %d %d)\n", icrate, itrm, ichain, itdc, ichannel, det[0], det[1], det[2], det[3], det[4]);
255 index = AliTOFGeometry::GetIndex(det);
256 if (index < 0 || index > 157248) {
257 // printf("invalid calib index: EO = (%d %d %d %d %d), VOL = (%d %d %d %d %d), CAL = %d\n", icrate, itrm, ichain, itdc, ichannel, det[0], det[1], det[2], det[3], det[4], index);
261 if (!histo) continue;
262 histo->SetBinContent(index + 1, 0x1);