Jpp  18.3.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 id detector identifier
364  * \param run run number
365  */
366  getSelector(const int id,
367  const int run)
368  {
369  this->add(&T::DETID, id);
370  this->add(&T::RUN, run);
371  }
372 
373  /**
374  * Get selector for the given table based on the detector and run number.
375  *
376  * \param detoid detector identifier
377  * \param run run number
378  */
379  getSelector(const std::string& detoid,
380  const int run)
381  {
382  this->add(&T::DETOID, detoid);
383  this->add(&T::RUN, run);
384  }
385  };
386 
387 
388  /**
389  * Template specialisation for getting table specific selector.
390  */
391  template<class T>
392  struct getSelector<T, JVendorHV, true> :
393  public JSelector
394  {
395  /**
396  * Get selector for the given table based on the detector identifier.
397  *
398  * \param detid detector identifier
399  */
400  getSelector(const int detid)
401  {
402  this->add(&T::DETID, detid);
403  }
404  };
405 
406 
407  /**
408  * Template specialisation for getting table specific selector.
409  */
410  template<class T>
411  struct getSelector<T, JCLBID, true> :
412  public JSelector
413  {
414  /**
415  * Get selector for the given table.
416  */
418  {
419  this->add(&T::CLBID, -1, Selector::RelOp::Different);
420  }
421  };
422 
423 
424  /**
425  * Template specialisation for getting table specific selector.
426  */
427  template<class T>
428  struct getSelector<T, JUPI, true> :
429  public JSelector
430  {
431  /**
432  * Get selector for the given table based on the detector identifier.
433  *
434  * \param pbs %PBS
435  */
436  getSelector(const JPBS_t pbs)
437  {
438  this->add(&T::PBS, pbs);
439  }
440  };
441 
442 
443  /**
444  * Template specialisation for getting table specific selector.
445  */
446  template<class T>
447  struct getSelector<T, JAHRS, true> :
448  public JSelector
449  {
450  /**
451  * Get selector for the given table based on the detector identifier and a run range.
452  *
453  * \param detid detector identifier
454  * \param minrun minimal run number
455  * \param maxrun maximal run number
456  */
457  getSelector(const int detid,
458  const int minrun,
459  const int maxrun)
460  {
461  this->add(&T::DETID, detid);
462  this->add("MINRUN", minrun);
463  this->add("MAXRUN", maxrun);
464  }
465  };
466 
467 
468  /**
469  * Template specialisation for getting table specific selector.
470  */
471  template<class T>
473  public JSelector
474  {
475  /**
476  * Get selector for the given table based on the detector and run number.
477  *
478  * \param detoid detector identifier
479  */
480  getSelector(const std::string& detoid)
481  {
482  this->add(&T::DETOID, detoid);
483  }
484  };
485 
486 
487  /**
488  * Template specialisation for getting table specific selector.
489  */
490  template<class T>
491  struct getSelector<T, APIV2::JCalibration_t, true> :
492  public JSelector
493  {
494  /**
495  * Get selector for the given table based on the detector and run number.
496  *
497  * \param detoid detector identifier
498  * \param operation operation identifier
499  */
500  getSelector(const std::string& detoid,
501  const std::string& operation)
502  {
503  this->add(&T::DetOID, detoid);
504  this->add(&T::OperationId, operation);
505  }
506  };
507 
508 
509  /**
510  * Template specialisation for getting table specific selector.
511  */
512  template<class T>
513  struct getSelector<T, APIV2::JRunCalibration, true> :
514  public JSelector
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  */
522  getSelector(const std::string& detoid,
523  const int run)
524  {
525  this->add(&T::DetOID, detoid);
526  this->add(&T::Run, run);
527  }
528 
529  /**
530  * Get selector for the given table based on the detector and run number.
531  *
532  * \param detoid detector identifier
533  * \param run run number
534  * \param ranking ranking
535  */
536  getSelector(const std::string& detoid,
537  const int run,
538  const int ranking)
539  {
540  this->add(&T::DetOID, detoid);
541  this->add(&T::Run, run);
542  this->add(&T::Ranking, ranking);
543  }
544  };
545 }
546 
547 #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.
This file is automatically created by make.
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
Template class test for polymorphism.
Definition: JConversion.hh:22
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 int id, const int run)
Get selector for the given table based on the detector and run number.
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