CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTMapGenerator Class Reference

#include <DTMapGenerator.h>

Inheritance diagram for DTMapGenerator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
virtual void beginJob ()
 
 DTMapGenerator (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual void endJob ()
 
virtual ~DTMapGenerator ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool checkWireExist (const std::set< DTWireId > &wireMap, int wheel, int station, int sector, int sl, int layer, int wire)
 

Private Attributes

std::string inputMapName
 
std::string outputMapName
 
int rosType
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Class which creates a textual map of the hardware channels in the software detIds

Date:
2010/01/19 09:51:31
Revision:
1.2
Author
G. Cerminara S. Bolognesi - INFN Torino

Definition at line 20 of file DTMapGenerator.h.

Constructor & Destructor Documentation

DTMapGenerator::DTMapGenerator ( const edm::ParameterSet pset)

Constructor.

Definition at line 20 of file DTMapGenerator.cc.

References gather_cfg::cout, and edm::ParameterSet::getUntrackedParameter().

20  {
21  // The output file with the map
22  outputMapName = pset.getUntrackedParameter<string>("outputFileName","output.map");
23  // The input file with the base map (DDU ROS -> Wheel, Station, Sector)
24  inputMapName = pset.getUntrackedParameter<string>("inputFileName","basemap.txt");
25  //The ros type: ROS8 for commissioning, ROS25 otherwise
26  rosType = pset.getUntrackedParameter<int>("rosType",25);
27  if(rosType != 8 && rosType != 25){
28  cout<<"[DTMapGenerator]: wrong ros type (8 for commissioning, 25 otherwise)"<<endl;
29  abort();
30  }
31 }
std::string outputMapName
T getUntrackedParameter(std::string const &, T const &) const
std::string inputMapName
tuple cout
Definition: gather_cfg.py:121
DTMapGenerator::~DTMapGenerator ( )
virtual

Destructor.

Definition at line 33 of file DTMapGenerator.cc.

33 {}

Member Function Documentation

virtual void DTMapGenerator::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
inlinevirtual

Implements edm::EDAnalyzer.

Definition at line 34 of file DTMapGenerator.h.

34 {}
virtual void DTMapGenerator::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 32 of file DTMapGenerator.h.

32 {}
bool DTMapGenerator::checkWireExist ( const std::set< DTWireId > &  wireMap,
int  wheel,
int  station,
int  sector,
int  sl,
int  layer,
int  wire 
)
private

Definition at line 176 of file DTMapGenerator.cc.

References gather_cfg::cout.

176  {
177  DTWireId wireId(wheel, station, sector, sl, layer, wire);
178  if(wireMap.find(wireId) == wireMap.end()) {
179  cout << "Skipping channel: Wh: " << wheel
180  << ", st: " << station
181  << ", sec: " << sector
182  << ", sl: " << sl
183  << ", lay: " << layer
184  << ", wire: " << wire << endl;
185  return false;
186  }
187 
188  return true;
189 }
tuple cout
Definition: gather_cfg.py:121
void DTMapGenerator::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 35 of file DTMapGenerator.cc.

References gather_cfg::cout, convertXMLtoSQLite_cfg::fileName, geometryCSVtoXML::line, and relativeConstraints::station.

35  {
36 
37  cout << "DTMapGenerator: Output Map: " << outputMapName << " ROS Type: " << rosType << endl;
38 
39  // Read the existing wires
40  ifstream existingChannels("/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/existing_channels.txt");
41 
42  set<DTWireId> wireMap; //FIXME:MAYBE YOU NEED THE > and == operators to use set?
43 
44  // Read the map between DDU - ROS and Chambers
45  string lineMap;
46  while (getline(existingChannels,lineMap)) {
47  if( lineMap == "" || lineMap[0] == '#' ) continue; // Skip comments and empty lines
48  stringstream linestr;
49  linestr << lineMap;
50  int wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx;
51  linestr >> wheelEx >> sectorEx >> stationEx >> slEx >> layerEx >> wireEx;
52  DTWireId wireIdEx(wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx);
53  wireMap.insert(wireIdEx);
54  }
55  cout << "Map size: " << wireMap.size() << endl;
56 
57  // The map between DDU - ROS and Chambers
58  ifstream skeletonMap(inputMapName.c_str());
59 
60  // The output map in the CMSSW format
61  ofstream outputMap(outputMapName.c_str());
62 
63  // Read the map between DDU - ROS and Chambers
64  string line;
65  while (getline(skeletonMap,line)) {
66  if( line == "" || line[0] == '#' ) continue; // Skip comments and empty lines
67  stringstream linestr;
68  linestr << line;
69  int ddu, ros, wheel, station, sector;
70  linestr >> ddu >> ros >> wheel >> station >> sector;
71  cout << "DDU: " << ddu << endl
72  << "ROS: " << ros << endl
73  << "Connected to chamber in Wh: " << wheel << " St: " << station << " Sec: " << sector << endl;
74 
75  int previousROB = -1;
76  int robCounter = -1;
77  // The chamber map in ORCA commissioning format
78  string fileName;
79  stringstream nameTmp;
80  nameTmp << "/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/templates/MB" << station << "_" << sector << ".map";
81  nameTmp >> fileName;
82  ifstream chamberMap(fileName.c_str());
83 
84  string lineChamberMap;
85  while (getline(chamberMap,lineChamberMap)) {
86  if( lineChamberMap == "" || lineChamberMap[0] == '#' ) continue; // Skip comments and empty lines
87  stringstream chamberMapStr;
88  chamberMapStr << lineChamberMap;
89 
90  int rob, tdc, tdcChannel, sl, layer, wire;
91  int unusedRos, unusedChamberCode;
92  int outRob = -1;
93  chamberMapStr >> unusedRos >> rob >> tdc >> tdcChannel >> unusedChamberCode >> sl >> layer >> wire;
94 
95  // Check if the channel really exists
96  if(!checkWireExist(wireMap, wheel, station, sector, sl, layer, wire))
97  continue;
98 
99  if(rob > previousROB) {
100  previousROB = rob;
101  robCounter++;
102  } else if(rob < previousROB) {
103  cout << "Error: ROB number is not uniformly increasing!" << endl;
104  abort();
105  }
106  // Set the ROB id within the ros
107  if(rosType == 25) {
108  if(station == 1) {//MB1
109  outRob = robCounter;
110  } else if(station == 2) {//MB2
111  outRob = robCounter + 6;
112  } else if(station == 3) {//MB3
113  if(robCounter < 3)
114  outRob = robCounter + 12;
115  else if(robCounter == 3)
116  outRob = 24;
117  else if(robCounter > 3)
118  outRob = robCounter + 11;
119  } else if(station == 4) {//MB4
120  if(sector == 14) {
121  if(robCounter == 3) {
122  continue;
123  }
124  outRob = robCounter + 18;
125  } else if(sector == 10) {
126  if(robCounter == 3) {
127  continue;
128  } else if(robCounter == 0) {
129  outRob = 21;
130  } else {
131  outRob = robCounter + 21;
132  }
133  }
134  if(sector == 4 ) {
135  if(robCounter == 3 || robCounter == 4 ) {
136  continue;
137  }
138  outRob = robCounter + 18;
139  } else if(sector == 13) {
140  if(robCounter == 3 || robCounter == 4) {
141  continue;
142  } else if(robCounter == 0) {
143  outRob = 21;
144  } else {
145  outRob = robCounter + 21;
146  }
147  } else if(sector == 11 || sector == 9) {
148  outRob = robCounter + 18;
149  if(robCounter == 3) {
150  continue;
151  }
152  }
153  //else if(sector==12 || sector == 8 || sector == 7 || sector == 6 || sector == 5 || sector == 3 || sector == 2 ||sector == 1 ){
154  else{
155  outRob = robCounter + 18;
156  }
157  }
158  } else {
159  outRob = rob;
160  }
161  outputMap << ddu << " "
162  << ros << " "
163  << outRob << " "
164  << tdc << " "
165  << tdcChannel << " "
166  << wheel << " "
167  << station << " "
168  << sector << " "
169  << sl << " "
170  << layer << " "
171  << wire << endl;
172  }
173  }
174 }
std::string outputMapName
bool checkWireExist(const std::set< DTWireId > &wireMap, int wheel, int station, int sector, int sl, int layer, int wire)
std::string inputMapName
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::string DTMapGenerator::inputMapName
private

Definition at line 48 of file DTMapGenerator.h.

std::string DTMapGenerator::outputMapName
private

Definition at line 46 of file DTMapGenerator.h.

int DTMapGenerator::rosType
private

Definition at line 50 of file DTMapGenerator.h.