StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PrintCosmicsMap.C
1 #include <iostream>
2 #include <fstream>
3 #include <string>
4 using namespace std;
5 
6 void PrintCosmicsMap()
7 {
8 
9  ifstream f;
10  f.open("fgtMapDump.csv");
11  if (!f) return;
12 
13  Int_t electId,geoId,rdo,arm,apv,chan,disk,quad,strip,stat;
14  Double_t ord,low,high,ped,sigped;
15  string layer,geo,;
16  string line;
17  Int_t newEid,mapping[51280];
18 
19  for (int xx = 0;xx<51280; xx++) mapping[xx]=-1;
20 
21  getline(f,line);
22  cout<<line<<endl;
23  getline(f,line);
24  cout<<line<<endl;
25 
26  Int_t ii = 0;
27  while ((f.is_open())&&(ii<26879))
28  {
29 
30 
31  f>>electId>>geoId>>rdo>>arm>>apv>>chan>>disk>>quad>>layer>>strip>>ord>>low>>high>>geo>>stat>>ped>>sigped;
32  ii++;
33 
34 
35  //find electronic id of old location
36  //eId = channel + 128 * ( apv + 20 * (arm + 6 * ( rdo - 1) ) );
37  //1B short was at RDO 2,ARM 0, APV 5-9 which ranges from 125*128 - 130*128 (16000-16639)
38  // now at RDO 1,ARM 0, APV 5-9 which ranges from 5*128 - 10*128 (640-1279)
39  //1C short was at RDO 2,ARM 0, APV 17-21 which ranges from 135*128 - 140*128 (17280-17919)
40  // now at RDO 1,ARM 0, APV 17-21 which ranges from 15*128 - 20*128 ( 1920-2559)
41  //1D short was at RDO 1,ARM 0, APV 5-9 which ranges from 5*128 - 10*128 (640-1279)
42  // now at RDO 1,ARM 1, APV 5-9 which ranges from 25*128 - 30*128 (3200-3839)
43 
44 
45  // if (electId%1000==0) cout<< electId<<endl;
46 
47  if ((electId>=16000)&&(electId<=16639))//disk 1Bshort
48  {
49 
50  if (apv > 11) apv = apv-2;
51  newEid = chan + 128 * ( apv + 20 * (arm + 6 * ( 1 - 1) ) );//set rdo = 1
52  //cout<<electId<<", "<<geoId<<", "<<rdo<<", "<<arm<<", "<<apv<<", "<<chan<<", "<<disk<<", "<<quad<<", "<<layer<<", "<<strip<<", "<<ord<<", "<<low<<", "<<high<<", "<<geo<<", "<<stat<<", "<<ped<<", "<<sigped<<", "<<endl;
53  //cout<<newEid<<endl;
54  mapping[newEid]=geoId;
55  }
56 
57  if ((electId<=17919)&&(electId>=17280))//disk 1Cshort
58  {
59 
60  if (apv > 11) apv = apv-2;
61  newEid = chan + 128 * ( apv + 20 * (arm + 6 * ( 1 - 1) ) );//set rdo = 1
62  //cout<<electId<<", "<<geoId<<", "<<rdo<<", "<<arm<<", "<<apv<<", "<<chan<<", "<<disk<<", "<<quad<<", "<<layer<<", "<<strip<<", "<<ord<<", "<<low<<", "<<high<<", "<<geo<<", "<<stat<<", "<<ped<<", "<<sigped<<", "<<endl;
63  //cout<<newEid<<endl;
64  mapping[newEid]=geoId;
65  }
66 
67  if ((electId<=1279)&&(electId>=640))//disk 1Dshort
68  {
69 
70  if (apv > 11) apv = apv-2;
71  newEid = chan + 128 * ( apv + 20 * (1 + 6 * ( rdo - 1) ) );//set rdo = 1
72  //cout<<electId<<", "<<geoId<<", "<<rdo<<", "<<arm<<", "<<apv<<", "<<chan<<", "<<disk<<", "<<quad<<", "<<layer<<", "<<strip<<", "<<ord<<", "<<low<<", "<<high<<", "<<geo<<", "<<stat<<", "<<ped<<", "<<sigped<<", "<<endl;
73  //cout<<newEid<<endl;
74  mapping[newEid]=geoId;
75  }
76 
77  }
78 
79 
80  for (int xx = 0;xx<51280; xx++) cout<<xx<<" "<<mapping[xx]<<endl;;
81 
82  f.close();
83 }