CMS 3D CMS Logo

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

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void beginJob () override
 
 DTMapGenerator (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob () override
 
 ~DTMapGenerator () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Author
G. Cerminara S. Bolognesi - INFN Torino

Definition at line 18 of file DTMapGenerator.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 18 of file DTMapGenerator.cc.

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

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

Destructor.

Definition at line 31 of file DTMapGenerator.cc.

31 {}

Member Function Documentation

void DTMapGenerator::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
inlineoverride
void DTMapGenerator::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 30 of file DTMapGenerator.h.

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

Definition at line 174 of file DTMapGenerator.cc.

References gather_cfg::cout.

Referenced by analyze().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file DTMapGenerator.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::fileName, mps_splice::line, relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

Referenced by analyze(), and o2olib.O2ORunMgr::executeJob().

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

Member Data Documentation

std::string DTMapGenerator::inputMapName
private

Definition at line 46 of file DTMapGenerator.h.

std::string DTMapGenerator::outputMapName
private

Definition at line 44 of file DTMapGenerator.h.

int DTMapGenerator::rosType
private

Definition at line 48 of file DTMapGenerator.h.