CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
bak_ReadCosmicRayData-00-00-15/src/StripMapper.cxx
Go to the documentation of this file.
1// **************************************************************************/
2// authors: L. Lavezzi (univ. of Torino & INFN, Italy)
3//
4
5
6//include system lib
7#include <fstream>
8#include <iostream>
9#include <iomanip>
10#include <string>
11#include <cmath>
12#include <csignal>
13
14#include "TSystem.h"
15
16#include "ReadCosmicRayData/StripMapper.h"
17
18//using namespace std;
19
20StripMapper::StripMapper(TString dataset) {
21 CosmicRayDataSetID = dataset;
22}
23
25
27
28
29 if(CosmicRayDataSetID == "CR201909") {
30
31 TString dir = gSystem->ExpandPathName("$READCOSMICRAYDATAROOT");
32 dir += "/dat/CR201909/";
33
34 // L1
35 TString mapname = dir;
36 ifstream input;
37 std::string titleline;
38
39 const int nlayer = 3; // CHECK hardcoded
40 const int nsheet[nlayer] = {1, 2, 2}; // CHECK hardcoded
41 const int nview = 2; // CHECK hardcoded
42 int nstrip[nlayer][nview] = {{856, 1173}, {630, 1077}, {832, 1395}}; // CHECK hardcoded
43
44
45 for(int ilayer = 0; ilayer < nlayer; ilayer++) {
46 for(int isheet = 0; isheet < nsheet[ilayer]; isheet++) {
47 for(int iview = 0; iview < nview; iview++) {
48
49 int layerid = ilayer + 1;
50 int sheetid = isheet + 1;
51
52 mapname = dir;
53 mapname += "mapping_L";
54 mapname += layerid;
55 mapname += "_S";
56 mapname += sheetid;
57 if(iview == 0) mapname += "_x.csv";
58 else mapname += "_v.csv";
59 std::cout << "StripMapper::FillMap, reading " << mapname << std::endl;
60
61 input.open(mapname);
62 if(!input.good()) {
63 std::cout << "StripMapper::FillMap, file not there!" << std::endl;
64 continue;
65 }
66
67 std::getline(input, titleline);
68
69 /**
70 std::cout << mapname << std::endl;
71 std::cout << "layer " << ilayer << std::endl;
72 std::cout << "sheet " << isheet << std::endl;
73 std::cout << "view " << iview << std::endl;
74 std::cout << "titleline " << titleline << std::endl;
75 **/
76
77 for(int istrip = 0; istrip < nstrip[ilayer][iview]; istrip++) {
78
79 // strip id / GEMROC / FEB / TIGER
80 int stripid;
81 input >> stripid
82 >> mapping[istrip][ilayer][isheet][iview][0] // gemroc
83 >> mapping[istrip][ilayer][isheet][iview][1] // feb
84 >> mapping[istrip][ilayer][isheet][iview][2]; // tiger
85
86 // std::cout << istrip << " <---> " << stripid << " " << mapping[istrip][ilayer][isheet][iview][0] << " " << mapping[istrip][ilayer][isheet][iview][1] << " " << mapping[istrip][ilayer][isheet][iview][2] << std::endl;
87 }
88
89 input.close();
90 }
91 }
92 }
93
94 return true;
95 }
96
97 return false;
98
99
100}
101
102
103int StripMapper::GetGEMROC(int strip, int type, int layer, int sheet) {
104 return mapping[strip][layer][sheet][type][0];
105}
106
107int StripMapper::GetFEB(int strip, int type, int layer, int sheet) {
108 return mapping[strip][layer][sheet][type][1];
109}
110
111int StripMapper::GetTIGER(int strip, int type, int layer, int sheet) {
112 return mapping[strip][layer][sheet][type][2];
113}
int GetFEB(int stripid, int striptype, int layerid, int sheetid)
int GetTIGER(int stripid, int striptype, int layerid, int sheetid)
int GetGEMROC(int stripid, int striptype, int layerid, int sheetid)