Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:46

0001 /** \class DTExpandMap
0002  *
0003  *  See header file for a description of this class.
0004  *
0005  *  $Date: 2009/03/26 14:11:04 $
0006  *  $Revision: 1.1 $
0007  *  \author Paolo Ronchese INFN Padova
0008  *
0009  */
0010 
0011 //----------------------
0012 // This Class' Header --
0013 //----------------------
0014 #include "CondTools/DT/interface/DTExpandMap.h"
0015 
0016 //-------------------------------
0017 // Collaborating Class Headers --
0018 //-------------------------------
0019 
0020 //---------------
0021 // C++ Headers --
0022 //---------------
0023 #include <iostream>
0024 #include <fstream>
0025 #include <vector>
0026 
0027 class DTMapEntry {
0028 public:
0029   DTMapEntry();
0030   DTMapEntry(int xk1, int xk2, int xk3, int xk4, int xk5, int xv1, int xv2, int xv3, int xv4, int xv5, int xv6);
0031   ~DTMapEntry();
0032   int k1;
0033   int k2;
0034   int k3;
0035   int k4;
0036   int k5;
0037   int v1;
0038   int v2;
0039   int v3;
0040   int v4;
0041   int v5;
0042   int v6;
0043 };
0044 
0045 DTMapEntry::DTMapEntry() : k1(0), k2(0), k3(0), k4(0), k5(0), v1(0), v2(0), v3(0), v4(0), v5(0), v6(0) {}
0046 
0047 DTMapEntry::DTMapEntry(int xk1, int xk2, int xk3, int xk4, int xk5, int xv1, int xv2, int xv3, int xv4, int xv5, int xv6)
0048     : k1(xk1), k2(xk2), k3(xk3), k4(xk4), k5(xk5), v1(xv1), v2(xv2), v3(xv3), v4(xv4), v5(xv5), v6(xv6) {}
0049 
0050 DTMapEntry::~DTMapEntry() {}
0051 
0052 void DTExpandMap::expandSteering(std::ifstream& file) {
0053   std::vector<int> key;
0054   int k1;
0055   int k2;
0056   int k3;
0057   int k4;
0058   int k5;
0059   int v1;
0060   int v2;
0061   int v3;
0062   int v4;
0063   int v5;
0064   int v6;
0065 
0066   std::vector<DTMapEntry> entryList;
0067   while (file >> k1 >> k2 >> k3 >> k4 >> k5 >> v1 >> v2 >> v3 >> v4 >> v5 >> v6) {
0068     std::vector<int> key;
0069     key.push_back(k1);
0070     key.push_back(k2);
0071     key.push_back(k3);
0072     key.push_back(k4);
0073     key.push_back(k5);
0074     DTMapEntry currentEntry(k1, k2, k3, k4, k5, v1, v2, v3, v4, v5, v6);
0075     entryList.push_back(currentEntry);
0076   }
0077 
0078   int ddu;
0079   int ros;
0080   int rch;
0081   int tdc;
0082   int tch;
0083   int whe;
0084   int sta;
0085   int sec;
0086   int rob;
0087   int qua;
0088   int lay;
0089   int cel;
0090   int mt1;
0091   int mi1;
0092   int mt2;
0093   int mi2;
0094   int def;
0095   int wha;
0096   int sea;
0097   std::vector<DTMapEntry>::const_iterator iter = entryList.begin();
0098   std::vector<DTMapEntry>::const_iterator iend = entryList.end();
0099   std::vector<DTMapEntry>::const_iterator iros = entryList.end();
0100   std::vector<DTMapEntry>::const_iterator irob = entryList.end();
0101   while (iter != iend) {
0102     const DTMapEntry& rosEntry(*iter++);
0103     if (rosEntry.k1 > 0x3fffffff)
0104       continue;
0105     ddu = rosEntry.k1;
0106     ros = rosEntry.k2;
0107     whe = rosEntry.v1;
0108     def = rosEntry.v2;
0109     sec = rosEntry.v3;
0110     rob = rosEntry.v4;
0111     mt1 = rosEntry.v5;
0112     mi1 = rosEntry.v6;
0113     iros = entryList.begin();
0114     while (iros != iend) {
0115       wha = whe;
0116       sea = sec;
0117       const DTMapEntry& rchEntry(*iros++);
0118       if ((rchEntry.k1 != mt1) || (rchEntry.k2 != mi1))
0119         continue;
0120       rch = rchEntry.k3;
0121       if (rchEntry.v1 != def)
0122         wha = rchEntry.v1;
0123       sta = rchEntry.v2;
0124       if (rchEntry.v3 != def)
0125         sea = rchEntry.v3;
0126       rob = rchEntry.v4;
0127       mt2 = rchEntry.v5;
0128       mi2 = rchEntry.v6;
0129       irob = entryList.begin();
0130       while (irob != iend) {
0131         const DTMapEntry& robEntry(*irob++);
0132         if ((robEntry.k1 != mt2) || (robEntry.k2 != mi2))
0133           continue;
0134         if (robEntry.k3 != rob) {
0135           std::cout << "ROB mismatch " << rob << " " << robEntry.k3 << std::endl;
0136         }
0137         tdc = robEntry.k4;
0138         tch = robEntry.k5;
0139         qua = robEntry.v4;
0140         lay = robEntry.v5;
0141         cel = robEntry.v6;
0142         std::cout << ddu << " " << ros << " " << rch << " " << tdc << " " << tch << " " << wha << " " << sta << " "
0143                   << sea << " " << qua << " " << lay << " " << cel << std::endl;
0144       }
0145     }
0146   }
0147 
0148   return;
0149 }