]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/data/station345/GCToBerg.C
From Laurent:
[u/mrichter/AliRoot.git] / MUON / mapping / data / station345 / GCToBerg.C
1 #include <map>
2 #include <fstream>
3 #include <iostream>
4 #include <string>
5 #include <cctype>
6 #include <iomanip>
7
8 bool GCToBerg()
9 {
10   bool debug = false;
11
12   std::ifstream in("bergToGC.dat");
13   if (!in)
14     {
15       std::cerr << "Could not open bergToGC.dat" << std::endl;
16       return false;
17     }
18   std::map<int,int> gctoberg;
19
20   int berg;
21   std::string manu;;
22   while ( in >> berg >> manu )
23     {
24       if (debug) std::cout << berg << " -> " << manu;
25       if ( std::isdigit(manu[0]) )
26         {
27           int imanu = std::atoi(manu.c_str());
28           if ( debug ) std::cout << " = " << imanu;
29           gctoberg[imanu] = berg;
30         }
31       if ( debug ) std::cout << std::endl;
32     }
33
34   in.close();
35
36   std::map<int,int>::const_iterator it;
37
38   for ( it = gctoberg.begin(); it != gctoberg.end(); ++it )
39     {
40       std::cout << std::setw(2) << it->first 
41                 << std::setw(4) << it->second
42                 << std::endl;
43     }
44   return true;
45 }