Jpp  15.0.0
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  using JLANG::JConversion;
22 
23  /**
24  * Template definition for getting table specific selector.\n
25  * Note that the template argument
26  * <tt>T</tt> refers to the targeted table and
27  * <tt>JTable_t</tt> to the actual table.\n
28  * This allows to use pointers to data members for column names rather than text strings.
29  */
30  template<class T, class JTable_t = T, bool is_same = JConversion<T, JTable_t>::is_same>
31  struct getSelector;
32 
33  /**
34  * Template specialisation for getting table specific selector.
35  */
36  template<class T>
37  struct getSelector<T, JPersons, true> :
38  public JSelector
39  {
40  /**
41  * Get selector for the given table based on the location identifier.
42  *
43  * \param locID location identifier
44  * \return selector
45  */
46  getSelector(const JDBString& locID)
47  {
48  this->add(&T::LOCATIONID, locID);
49  }
50 
51  /**
52  * Get selector for the given table based on the login name.
53  *
54  * \param login login string
55  */
56  getSelector(const std::string& login)
57  {
58  this->add(&T::LOGIN, login);
59  }
60  };
61 
62 
63  /**
64  * Template specialisation for getting table specific selector.
65  */
66  template<class T>
67  struct getSelector<T, JDetectors, true> :
68  public JSelector
69  {
70  /**
71  * Get selector for the given table based on the serial number.
72  *
73  * \param id serial number
74  */
75  getSelector(const int id)
76  {
77  this->add(&T::SERIALNUMBER, id);
78  }
79 
80 
81  /**
82  * Get selector for the given table based on the object identifier.
83  *
84  * \param detid detector identifier
85  * \return selector
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  * \return selector
118  */
119  getSelector(const int id,
120  const int run)
121  {
122  this->add(&T::DETID, id);
123  this->add(&T::RUN, run);
124  }
125  };
126 
127 
128  /**
129  * Template specialisation for getting table specific selector.
130  */
131  template<class T>
132  struct getSelector<T, JDatalogNumbers, true> :
133  public JSelector
134  {
135  /**
136  * Get selector for the given table based on the detector identifier and a run range.
137  *
138  * \param detid detector identifier
139  * \param minrun minimal run number
140  * \param maxrun maximal run number
141  */
142  getSelector(const std::string& detid,
143  const int minrun,
144  const int maxrun)
145  {
146  this->add(&T::DETID, detid);
147  this->add("MINRUN", minrun);
148  this->add("MAXRUN", maxrun);
149  }
150  };
151 
152 
153  /**
154  * Template specialisation for getting table specific selector.
155  */
156  template<class T>
157  struct getSelector<T, JAllParams, true> :
158  public JSelector
159  {
160  /**
161  * Get selector for the given table based on the sub-system identifier.
162  *
163  * \param ssid ssid
164  */
165  getSelector(const std::string& ssid)
166  {
167  this->add(&T::SUBSYSTEMID, ssid);
168  }
169  };
170 
171 
172  /**
173  * Template specialisation for getting table specific selector.
174  */
175  template<class T>
176  struct getSelector<T, JToAshort, true> :
177  public JSelector
178  {
179  /**
180  * Get selector for the given table based on the detector identifier and a run range.
181  *
182  * \param detid detector identifier
183  * \param minrun minimal run number
184  * \param maxrun maximal run number
185  */
186  getSelector(const std::string& detid,
187  const int minrun,
188  const int maxrun)
189  {
190  this->add(&T::DETID, detid);
191  this->add("MINRUN", minrun);
192  this->add("MAXRUN", maxrun);
193  }
194  };
195 
196 
197  /**
198  * Template specialisation for getting table specific selector.
199  */
200  template<class T>
201  struct getSelector<T, JCLBMap, true> :
202  public JSelector
203  {
204  /**
205  * Get selector for the given table based on the detector identifier.
206  *
207  * \param detoid detector identifier
208  */
209  getSelector(const std::string& detoid)
210  {
211  this->add(&T::DETOID, detoid);
212  }
213  };
214 
215 
216  /**
217  * Template specialisation for getting table specific selector.
218  */
219  template<class T>
221  public JSelector
222  {
223  /**
224  * Get selector for the given table based on the serial number.
225  *
226  * \param id serial number
227  */
228  getSelector(const int id)
229  {
230  this->add(&T::DETID, id);
231  }
232 
233 
234  /**
235  * Get selector for the given table based on the detector identifier and a run range.
236  *
237  * \param detoid detector identifier
238  */
239  getSelector(const std::string& detoid)
240  {
241  this->add(&T::DETOID, detoid);
242  }
243  };
244 
245 
246  /**
247  * Template specialisation for getting table specific selector.
248  */
249  template<class T>
251  public JSelector
252  {
253  /**
254  * Get selector for the given table based on the detector identifier and a run range.
255  *
256  * \param detid detector identifier
257  * \param minrun minimal run number
258  * \param maxrun maximal run number
259  */
260  getSelector(const std::string& detid,
261  const int minrun,
262  const int maxrun)
263  {
264  this->add(&T::DETID, detid);
265  this->add("MINRUN", minrun);
266  this->add("MAXRUN", maxrun);
267  }
268  };
269 
270 
271  /**
272  * Template specialisation for getting table specific selector.
273  */
274  template<class T>
275  struct getSelector<T, JRunQuality, true> :
276  public getSelector<JRunSummaryNumbers>
277  {
278  /**
279  * Get selector for the given table based on the detector identifier and a run range.
280  *
281  * \param detid detector identifier
282  * \param minrun minimal run number
283  * \param maxrun maximal run number
284  */
285  getSelector(const std::string& detid,
286  const int minrun,
287  const int maxrun) :
288  getSelector<JRunSummaryNumbers>(detid, minrun, maxrun)
289  {}
290  };
291 
292 
293  /**
294  * Template specialisation for getting table specific selector.
295  */
296  template<class T>
297  struct getSelector<T, JRunsetupParams, true> :
298  public JSelector
299  {
300  /**
301  * Get selector for the given table based on the detector and run-setup identifier.
302  *
303  * \param detid detector identifier
304  * \param rs_oid runsetup identifier
305  */
306  getSelector(const std::string& detid,
307  const std::string& rs_oid)
308  {
309  this->add(&T::DETID, detid);
310  this->add(&T::RS_OID, rs_oid);
311  }
312  };
313 
314 
315  /**
316  * Template specialisation for getting table specific selector.
317  */
318  template<class T>
319  struct getSelector<T, JPMTHVSettings, true> :
320  public JSelector
321  {
322  /**
323  * Get selector for the given table based on the detector and run number.
324  *
325  * \param detoid detector identifier
326  * \param cg_name cg_name
327  */
328  getSelector(const std::string& detoid,
329  const std::string& cg_name)
330  {
331  this->add(&T::DETOID, detoid);
332  this->add(&T::CG_NAME, cg_name);
333  }
334  };
335 
336 
337  /**
338  * Template specialisation for getting table specific selector.
339  */
340  template<class T>
341  struct getSelector<T, JPMTHVRunSettings, true> :
342  public JSelector
343  {
344  /**
345  * Get selector for the given table based on the detector and run number.
346  *
347  * \param detoid detector identifier
348  * \param run run number
349  */
350  getSelector(const std::string& detoid,
351  const int run)
352  {
353  this->add(&T::DETOID, detoid);
354  this->add(&T::RUN, run);
355  }
356  };
357 
358 
359  /**
360  * Template specialisation for getting table specific selector.
361  */
362  template<class T>
363  struct getSelector<T, JVendorHV, true> :
364  public JSelector
365  {
366  /**
367  * Get selector for the given table based on the detector identifier.
368  *
369  * \param detid detector identifier
370  */
371  getSelector(const int detid)
372  {
373  this->add(&T::DETID, detid);
374  }
375  };
376 
377 
378  /**
379  * Template specialisation for getting table specific selector.
380  */
381  template<class T>
382  struct getSelector<T, JCLBID, true> :
383  public JSelector
384  {
385  /**
386  * Get selector for the given table.
387  */
389  {
390  this->add(&T::CLBID, -1, Selector::RelOp::Different);
391  }
392  };
393 
394 
395  /**
396  * Template specialisation for getting table specific selector.
397  */
398  template<class T>
399  struct getSelector<T, JUPI, true> :
400  public JSelector
401  {
402  /**
403  * Get selector for the given table based on the detector identifier.
404  *
405  * \param pbs %PBS
406  */
407  getSelector(const JPBS_t pbs)
408  {
409  this->add(&T::PBS, pbs);
410  }
411  };
412 
413 
414  /**
415  * Template specialisation for getting table specific selector.
416  */
417  template<class T>
418  struct getSelector<T, JAHRS, true> :
419  public JSelector
420  {
421  /**
422  * Get selector for the given table based on the detector identifier and a run range.
423  *
424  * \param detid detector identifier
425  * \param minrun minimal run number
426  * \param maxrun maximal run number
427  */
428  getSelector(const int detid,
429  const int minrun,
430  const int maxrun)
431  {
432  this->add(&T::DETID, detid);
433  this->add("MINRUN", minrun);
434  this->add("MAXRUN", maxrun);
435  }
436  };
437 
438 
439  /**
440  * Template specialisation for getting table specific selector.
441  */
442  template<class T>
444  public JSelector
445  {
446  /**
447  * Get selector for the given table based on the detector and run number.
448  *
449  * \param detoid detector identifier
450  */
451  getSelector(const std::string& detoid)
452  {
453  this->add(&T::DETOID, detoid);
454  }
455  };
456 }
457 
458 #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 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
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
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.
Product breakdown structure (PBS).
Definition: JPBS_t.hh:25
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