Jpp  18.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSelectorSupportkit.hh
Go to the documentation of this file.
1 #ifndef __JDB_JSELECTORSUPPORTKIT__
2 #define __JDB_JSELECTORSUPPORTKIT__
3 
4 #include <string>
5 
6 #include "JLang/JConversion.hh"
7 
8 #include "JDB/JSelector.hh"
9 #include "JDB/JDBTypes.hh"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JDATABASE {};
17 namespace JPP { using namespace JDATABASE; }
18 
19 namespace JDATABASE {
20 
21  namespace APIV2 {}
22 
23  using JLANG::JConversion;
24 
25  /**
26  * Template definition for getting table specific selector.\n
27  * Note that the template argument
28  * <tt>T</tt> refers to the targeted table and
29  * <tt>JTable_t</tt> to the actual table.\n
30  * This allows to use pointers to data members for column names rather than text strings.
31  */
32  template<class T, class JTable_t = T, bool is_same = JConversion<T, JTable_t>::is_same>
33  struct getSelector;
34 
35  /**
36  * Template specialisation for getting table specific selector.
37  */
38  template<class T>
39  struct getSelector<T, JPersons, true> :
40  public JSelector
41  {
42  /**
43  * Get selector for the given table based on the location identifier.
44  *
45  * \param locID location identifier
46  */
47  getSelector(const JDBString& locID)
48  {
49  this->add(&T::LOCATIONID, locID);
50  }
51 
52  /**
53  * Get selector for the given table based on the login name.
54  *
55  * \param login login string
56  */
57  getSelector(const std::string& login)
58  {
59  this->add(&T::LOGIN, login);
60  }
61  };
62 
63 
64  /**
65  * Template specialisation for getting table specific selector.
66  */
67  template<class T>
68  struct getSelector<T, JDetectors, true> :
69  public JSelector
70  {
71  /**
72  * Get selector for the given table based on the serial number.
73  *
74  * \param id serial number
75  */
76  getSelector(const int id)
77  {
78  this->add(&T::SERIALNUMBER, id);
79  }
80 
81 
82  /**
83  * Get selector for the given table based on the object identifier.
84  *
85  * \param detid detector identifier
86  */
87  getSelector(const std::string& detid)
88  {
89  this->add(&T::OID, detid);
90  }
91  };
92 
93 
94  /**
95  * Template specialisation for getting table specific selector.
96  */
97  template<class T>
98  struct getSelector<T, JRuns, true> :
99  public JSelector
100  {
101  /**
102  * Get selector for the given table based on the detector serial number.
103  *
104  * \param id detector serial number
105  */
106  getSelector(const int id)
107  {
108  this->add(&T::DETID, id);
109  }
110 
111 
112  /**
113  * Get selector for the given table based on the detector serial number and run number.
114  *
115  * \param id detector serial number
116  * \param run run number
117  */
118  getSelector(const int id,
119  const int run)
120  {
121  this->add(&T::DETID, id);
122  this->add(&T::RUN, run);
123  }
124 
125 
126  /**
127  * Get selector for the given table based on the detector serial number and run number.
128  *
129  * \param id detector serial number
130  * \param minrun minimal run number
131  * \param maxrun maximal run number
132  */
133  getSelector(const int id,
134  const int minrun,
135  const int maxrun)
136  {
137  this->add(&T::DETID, id);
138  this->add(&T::RUN, minrun, Selector::RelOp::GreaterEqual);
139  this->add(&T::RUN, maxrun, Selector::RelOp::LessEqual);
140  }
141  };
142 
143 
144  /**
145  * Template specialisation for getting table specific selector.
146  */
147  template<class T>
148  struct getSelector<T, JDatalogNumbers, true> :
149  public JSelector
150  {
151  /**
152  * Get selector for the given table based on the detector identifier and a run range.
153  *
154  * \param detid detector identifier
155  * \param minrun minimal run number
156  * \param maxrun maximal run number
157  */
158  getSelector(const std::string& detid,
159  const int minrun,
160  const int maxrun)
161  {
162  this->add(&T::DETID, detid);
163  this->add("MINRUN", minrun);
164  this->add("MAXRUN", maxrun);
165  }
166  };
167 
168 
169  /**
170  * Template specialisation for getting table specific selector.
171  */
172  template<class T>
173  struct getSelector<T, JAllParams, true> :
174  public JSelector
175  {
176  /**
177  * Get selector for the given table based on the sub-system identifier.
178  *
179  * \param ssid ssid
180  */
182  {
183  this->add(&T::SUBSYSTEMID, ssid);
184  }
185  };
186 
187 
188  /**
189  * Template specialisation for getting table specific selector.
190  */
191  template<class T>
192  struct getSelector<T, JToAshort, true> :
193  public JSelector
194  {
195  /**
196  * Get selector for the given table based on the detector identifier and a run range.
197  *
198  * \param detid detector identifier
199  * \param minrun minimal run number
200  * \param maxrun maximal run number
201  */
202  getSelector(const std::string& detid,
203  const int minrun,
204  const int maxrun)
205  {
206  this->add(&T::DETID, detid);
207  this->add("MINRUN", minrun);
208  this->add("MAXRUN", maxrun);
209  }
210  };
211 
212 
213  /**
214  * Template specialisation for getting table specific selector.
215  */
216  template<class T>
217  struct getSelector<T, JCLBMap, true> :
218  public JSelector
219  {
220  /**
221  * Get selector for the given table based on the detector identifier.
222  *
223  * \param detoid detector identifier
224  */
225  getSelector(const std::string& detoid)
226  {
227  this->add(&T::DETOID, detoid);
228  }
229  };
230 
231 
232  /**
233  * Template specialisation for getting table specific selector.
234  */
235  template<class T>
237  public JSelector
238  {
239  /**
240  * Get selector for the given table based on the serial number.
241  *
242  * \param id serial number
243  */
244  getSelector(const int id)
245  {
246  this->add(&T::DETID, id);
247  }
248 
249 
250  /**
251  * Get selector for the given table based on the detector identifier and a run range.
252  *
253  * \param detoid detector identifier
254  */
255  getSelector(const std::string& detoid)
256  {
257  this->add(&T::DETOID, detoid);
258  }
259  };
260 
261 
262  /**
263  * Template specialisation for getting table specific selector.
264  */
265  template<class T>
267  public JSelector
268  {
269  /**
270  * Get selector for the given table based on the detector identifier and a run range.
271  *
272  * \param detid detector identifier
273  * \param minrun minimal run number
274  * \param maxrun maximal run number
275  */
276  getSelector(const std::string& detid,
277  const int minrun,
278  const int maxrun)
279  {
280  this->add(&T::DETID, detid);
281  this->add("MINRUN", minrun);
282  this->add("MAXRUN", maxrun);
283  }
284  };
285 
286 
287  /**
288  * Template specialisation for getting table specific selector.
289  */
290  template<class T>
291  struct getSelector<T, JRunQuality, true> :
292  public getSelector<JRunSummaryNumbers>
293  {
294  /**
295  * Get selector for the given table based on the detector identifier and a run range.
296  *
297  * \param detid detector identifier
298  * \param minrun minimal run number
299  * \param maxrun maximal run number
300  */
301  getSelector(const std::string& detid,
302  const int minrun,
303  const int maxrun) :
304  getSelector<JRunSummaryNumbers>(detid, minrun, maxrun)
305  {}
306  };
307 
308 
309  /**
310  * Template specialisation for getting table specific selector.
311  */
312  template<class T>
313  struct getSelector<T, JRunsetupParams, true> :
314  public JSelector
315  {
316  /**
317  * Get selector for the given table based on the detector and run-setup identifier.
318  *
319  * \param detid detector identifier
320  * \param rs_oid runsetup identifier
321  */
322  getSelector(const std::string& detid,
323  const std::string& rs_oid)
324  {
325  this->add(&T::DETID, detid);
326  this->add(&T::RS_OID, rs_oid);
327  }
328  };
329 
330 
331  /**
332  * Template specialisation for getting table specific selector.
333  */
334  template<class T>
335  struct getSelector<T, JPMTHVSettings, true> :
336  public JSelector
337  {
338  /**
339  * Get selector for the given table based on the detector and run number.
340  *
341  * \param detoid detector identifier
342  * \param cg_name cg_name
343  */
344  getSelector(const std::string& detoid,
345  const std::string& cg_name)
346  {
347  this->add(&T::DETOID, detoid);
348  this->add(&T::CG_NAME, cg_name);
349  }
350  };
351 
352 
353  /**
354  * Template specialisation for getting table specific selector.
355  */
356  template<class T>
357  struct getSelector<T, JPMTHVRunSettings, true> :
358  public JSelector
359  {
360  /**
361  * Get selector for the given table based on the detector and run number.
362  *
363  * \param detoid detector identifier
364  * \param run run number
365  */
366  getSelector(const std::string& detoid,
367  const int run)
368  {
369  this->add(&T::DETOID, detoid);
370  this->add(&T::RUN, run);
371  }
372  };
373 
374 
375  /**
376  * Template specialisation for getting table specific selector.
377  */
378  template<class T>
379  struct getSelector<T, JVendorHV, true> :
380  public JSelector
381  {
382  /**
383  * Get selector for the given table based on the detector identifier.
384  *
385  * \param detid detector identifier
386  */
387  getSelector(const int detid)
388  {
389  this->add(&T::DETID, detid);
390  }
391  };
392 
393 
394  /**
395  * Template specialisation for getting table specific selector.
396  */
397  template<class T>
398  struct getSelector<T, JCLBID, true> :
399  public JSelector
400  {
401  /**
402  * Get selector for the given table.
403  */
405  {
406  this->add(&T::CLBID, -1, Selector::RelOp::Different);
407  }
408  };
409 
410 
411  /**
412  * Template specialisation for getting table specific selector.
413  */
414  template<class T>
415  struct getSelector<T, JUPI, true> :
416  public JSelector
417  {
418  /**
419  * Get selector for the given table based on the detector identifier.
420  *
421  * \param pbs %PBS
422  */
423  getSelector(const JPBS_t pbs)
424  {
425  this->add(&T::PBS, pbs);
426  }
427  };
428 
429 
430  /**
431  * Template specialisation for getting table specific selector.
432  */
433  template<class T>
434  struct getSelector<T, JAHRS, true> :
435  public JSelector
436  {
437  /**
438  * Get selector for the given table based on the detector identifier and a run range.
439  *
440  * \param detid detector identifier
441  * \param minrun minimal run number
442  * \param maxrun maximal run number
443  */
444  getSelector(const int detid,
445  const int minrun,
446  const int maxrun)
447  {
448  this->add(&T::DETID, detid);
449  this->add("MINRUN", minrun);
450  this->add("MAXRUN", maxrun);
451  }
452  };
453 
454 
455  /**
456  * Template specialisation for getting table specific selector.
457  */
458  template<class T>
460  public JSelector
461  {
462  /**
463  * Get selector for the given table based on the detector and run number.
464  *
465  * \param detoid detector identifier
466  */
467  getSelector(const std::string& detoid)
468  {
469  this->add(&T::DETOID, detoid);
470  }
471  };
472 
473 
474  /**
475  * Template specialisation for getting table specific selector.
476  */
477  template<class T>
478  struct getSelector<T, APIV2::JCalibration_t, true> :
479  public JSelector
480  {
481  /**
482  * Get selector for the given table based on the detector and run number.
483  *
484  * \param detoid detector identifier
485  * \param operation operation identifier
486  */
487  getSelector(const std::string& detoid,
488  const std::string& operation)
489  {
490  this->add(&T::DetOID, detoid);
491  this->add(&T::OperationId, operation);
492  }
493  };
494 
495 
496  /**
497  * Template specialisation for getting table specific selector.
498  */
499  template<class T>
500  struct getSelector<T, APIV2::JRunCalibration, true> :
501  public JSelector
502  {
503  /**
504  * Get selector for the given table based on the detector and run number.
505  *
506  * \param detoid detector identifier
507  * \param run run number
508  */
509  getSelector(const std::string& detoid,
510  const int run)
511  {
512  this->add(&T::DetOID, detoid);
513  this->add(&T::Run, run);
514  }
515 
516  /**
517  * Get selector for the given table based on the detector and run number.
518  *
519  * \param detoid detector identifier
520  * \param run run number
521  * \param ranking ranking
522  */
523  getSelector(const std::string& detoid,
524  const int run,
525  const int ranking)
526  {
527  this->add(&T::DetOID, detoid);
528  this->add(&T::Run, run);
529  this->add(&T::Ranking, ranking);
530  }
531  };
532 }
533 
534 #endif
set_variable LOCATIONID(getLocationID-L ${LOGIN}) if(($
Definition: JEditTuneHV.sh:80
getSelector(const int id, const int run)
Get selector for the given table based on the detector serial number and run number.
getSelector(const std::string &detoid, const int run)
Get selector for the given table based on the detector and run number.
getSelector(const std::string &detoid, const int run)
Get selector for the given table based on the detector and run number.
getSelector(const int id)
Get selector for the given table based on the serial number.
Wrapper class to read string until end-of-line.
Definition: JDBString.hh:19
getSelector(const std::string &detoid, const int run, const int ranking)
Get selector for the given table based on the detector and run number.
Template class test for polymorphism.
Definition: JConversion.hh:21
getSelector()
Get selector for the given table.
getSelector(const JDBString &locID)
Get selector for the given table based on the location identifier.
getSelector(const int detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
Auxiliary class for specifying selection of database data.
getSelector(const JPBS_t pbs)
Get selector for the given table based on the detector identifier.
getSelector(const std::string &detoid)
Get selector for the given table based on the detector identifier.
then set_variable DETID
Definition: JEditTuneHV.sh:63
getSelector(const std::string &detoid)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &login)
Get selector for the given table based on the login name.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then rm i $OUTPUT_FILE fi let RUN
then awk string
getSelector(const std::string &detoid, const std::string &operation)
Get selector for the given table based on the detector and run number.
getSelector(const int detid)
Get selector for the given table based on the detector identifier.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &detid)
Get selector for the given table based on the object identifier.
getSelector(const int id)
Get selector for the given table based on the detector serial number.
getSelector(const std::string &ssid)
Get selector for the given table based on the sub-system identifier.
then error Missing CDF files error Run
Definition: JSirene.sh:58
getSelector(const int id, const int minrun, const int maxrun)
Get selector for the given table based on the detector serial number and run number.
Product breakdown structure (PBS).
Definition: JPBS_t.hh:27
getSelector(const std::string &detoid)
Get selector for the given table based on the detector and run number.
getSelector(const std::string &detoid, const std::string &cg_name)
Get selector for the given table based on the detector and run number.
getSelector(const int id)
Get selector for the given table based on the serial number.
getSelector(const std::string &detid, const std::string &rs_oid)
Get selector for the given table based on the detector and run-setup identifier.
Template definition for getting table specific selector.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
Auxiliary data structure for data quality.
Definition: JRunQuality.hh:34