Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UploadChanMap.C
Go to the documentation of this file.
1 
8 R__LOAD_LIBRARY(geom_svc)
9 
10 int UploadChanMap(const std::string type="taiwan", const std::string map_id="2019091301")
11 {
12  gSystem->Load("libgeom_svc.so");
13  ChanMapBase* map;
14  if (type == "taiwan") map = new ChanMapTaiwan();
15  else if (type == "v1495" ) map = new ChanMapV1495 ();
16  else if (type == "scaler") map = new ChanMapScaler();
17  else {
18  cerr << "!!ERROR!! '" << type << "' is not supported." << endl;
19  return 1;
20  }
21  map->SetMapIDbyFile(map_id);
22  map->ReadFromFile();
23  //map->Print(cout);
24  map->WriteToLocalFile("output_for_check.tsv");
25  map->WriteToDB();
26  map->WriteRangeToDB();
27  return 0;
28 }
29 
30 int CheckChanMap(const std::string type="taiwan", const int run=25000)
31 {
32  gSystem->Load("libgeom_svc.so");
33  ChanMapBase* map;
34  if (type == "taiwan") map = new ChanMapTaiwan();
35  else if (type == "v1495" ) map = new ChanMapV1495 ();
36  else if (type == "scaler") map = new ChanMapScaler();
37  else {
38  cerr << "!!ERROR!! '" << type << "' is not supported." << endl;
39  return 1;
40  }
41  map->SetMapIDbyDB(run);
42  map->ReadFromDB();
43  //map->Print(cout);
44  map->WriteToLocalFile("check_chan_map.tsv");
45  return 0;
46 }
47 
50 {
51  gSystem->Load("libgeom_svc.so");
52  ChanMapTaiwan map;
53 
55  map.Add(10, 100, 1, "D1X", 123);
56  map.Add(11, 101, 2, "D2X", 321);
57 
58  map.Print(cout);
59  map.WriteToLocalFile("make_chan_map.tsv");
60  return 0;
61 }
void WriteToDB()
void Add(const short roc, const short board, const short chan, const std::string det, const short ele)
int UploadChanMap(const std::string type="taiwan", const std::string map_id="2019091301")
UploadChanMap.C: Macro to upload the channel mapping from tsv file to MySQL DB.
Definition: UploadChanMap.C:10
void WriteToLocalFile(const std::string fn_tsv)
Definition: RunParamBase.cc:83
void WriteRangeToDB()
int run(const int nEvents=1)
Definition: run.C:10
void SetMapIDbyDB(const std::string map_id)
Definition: RunParamBase.cc:31
void SetMapIDbyFile(const std::string map_id)
Definition: RunParamBase.cc:21
void ReadFromDB()
Definition: RunParamBase.cc:97
int MakeChanMap()
Test function to make a channel mapping by hand.
Definition: UploadChanMap.C:49
void ReadFromFile()
Definition: RunParamBase.cc:53
int CheckChanMap(const std::string type="taiwan", const int run=25000)
Definition: UploadChanMap.C:30
void Print(std::ostream &os)