CMS 3D CMS Logo

DTMapGenerator Class Reference

Class which creates a textual map of the hardware channels in the software detIds
Date
2007/07/11 12:21:00
Revision
1.1
. More...

#include <CalibMuon/DTCalibration/plugins/DTMapGenerator.h>

Inheritance diagram for DTMapGenerator:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
virtual void beginJob (const edm::EventSetup &setup)
 DTMapGenerator (const edm::ParameterSet &pset)
 Constructor.
virtual void endJob ()
virtual ~DTMapGenerator ()
 Destructor.

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


Detailed Description

Class which creates a textual map of the hardware channels in the software detIds
Date
2007/07/11 12:21:00
Revision
1.1
.

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 GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::ParameterSet::getUntrackedParameter(), inputMapName, outputMapName, and rosType.

00020                                                        {
00021   // The output file with the map
00022   outputMapName = pset.getUntrackedParameter<string>("outputFileName","output.map");
00023   // The input file with the base map (DDU ROS -> Wheel, Station, Sector)
00024   inputMapName = pset.getUntrackedParameter<string>("inputFileName","basemap.txt");
00025   //The ros type: ROS8 for commissioning, ROS25 otherwise
00026   rosType =  pset.getUntrackedParameter<int>("rosType",25);
00027   if(rosType != 8 && rosType != 25){
00028     cout<<"[DTMapGenerator]: wrong ros type (8 for commissioning, 25 otherwise)"<<endl;
00029     abort();
00030   }
00031 }

DTMapGenerator::~DTMapGenerator (  )  [virtual]

Destructor.

Definition at line 33 of file DTMapGenerator.cc.

00033 {}


Member Function Documentation

virtual void DTMapGenerator::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [inline, virtual]

Implements edm::EDAnalyzer.

Definition at line 34 of file DTMapGenerator.h.

00034 {}

virtual void DTMapGenerator::beginJob ( const edm::EventSetup setup  )  [inline, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 32 of file DTMapGenerator.h.

00032 {}

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

Referenced by endJob().

void DTMapGenerator::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 35 of file DTMapGenerator.cc.

References checkWireExist(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), aod_PYTHIA_cfg::fileName, inputMapName, parsecf::pyparsing::line(), outputMapName, rosType, sl, and muonGeometry::wheel.

00035                             {
00036 
00037   cout << "DTMapGenerator: Output Map: " << outputMapName << " ROS Type: " << rosType << endl;
00038 
00039   // Read the existing wires
00040   ifstream existingChannels("/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/existing_channels.txt");
00041   
00042   set<DTWireId> wireMap; //FIXME:MAYBE YOU NEED THE > and == operators to use set?
00043 
00044   // Read the map between DDU - ROS and Chambers
00045   string lineMap;
00046   while (getline(existingChannels,lineMap)) {
00047     if( lineMap == "" || lineMap[0] == '#' ) continue; // Skip comments and empty lines
00048     stringstream linestr;
00049     linestr << lineMap;
00050     int wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx;
00051     linestr >> wheelEx >> sectorEx >> stationEx >> slEx >> layerEx >> wireEx;
00052     DTWireId wireIdEx(wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx);
00053     wireMap.insert(wireIdEx);
00054   }
00055   cout << "Map size: " << wireMap.size() << endl;
00056 
00057   // The map between DDU - ROS and Chambers
00058   ifstream skeletonMap(inputMapName.c_str());
00059   
00060   // The output map in the CMSSW format
00061   ofstream outputMap(outputMapName.c_str());
00062 
00063   // Read the map between DDU - ROS and Chambers
00064   string line;
00065   while (getline(skeletonMap,line)) {
00066     if( line == "" || line[0] == '#' ) continue; // Skip comments and empty lines
00067     stringstream linestr;
00068     linestr << line;
00069     int ddu, ros, wheel, station, sector;
00070     linestr >> ddu >> ros >> wheel >> station >> sector;
00071     cout << "DDU: " << ddu << endl
00072          << "ROS: " << ros << endl
00073          << "Connected to chamber in Wh: " << wheel << " St: " << station << " Sec: " << sector << endl;
00074 
00075     int previousROB = -1;
00076     int robCounter = -1;
00077     // The chamber map in ORCA commissioning format    
00078     string fileName;
00079     stringstream nameTmp;
00080     nameTmp << "/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/templates/MB" << station << "_" <<  sector << ".map";
00081     nameTmp >> fileName;
00082     ifstream chamberMap(fileName.c_str());
00083 
00084     string lineChamberMap;
00085     while (getline(chamberMap,lineChamberMap)) {
00086       if( lineChamberMap == "" || lineChamberMap[0] == '#' ) continue; // Skip comments and empty lines
00087       stringstream chamberMapStr;
00088       chamberMapStr << lineChamberMap;
00089       
00090       int rob, tdc, tdcChannel, sl, layer, wire;
00091       int unusedRos, unusedChamberCode;
00092       int outRob = -1;
00093       chamberMapStr >> unusedRos  >> rob >> tdc >> tdcChannel >> unusedChamberCode >> sl >> layer >> wire;
00094       
00095       // Check if the channel really exists
00096       if(!checkWireExist(wireMap, wheel, station, sector, sl, layer, wire))
00097         continue;
00098 
00099       if(rob > previousROB) {
00100         previousROB = rob;
00101         robCounter++;
00102       } else if(rob < previousROB) {
00103         cout << "Error: ROB number is not uniformly increasing!" << endl;
00104         abort();
00105       }
00106       // Set the ROB id within the ros
00107       if(rosType == 25) {
00108         if(station == 1) {//MB1
00109           outRob = robCounter;
00110         } else if(station == 2) {//MB2
00111           outRob = robCounter + 6;
00112         } else if(station == 3) {//MB3
00113           if(robCounter < 3) 
00114             outRob = robCounter + 12;
00115           else if(robCounter == 3)
00116             outRob = 24;
00117           else if(robCounter > 3)
00118             outRob = robCounter + 11;
00119         } else if(station == 4) {//MB4
00120           if(sector == 14)  {
00121             if(robCounter == 3) {
00122               continue;
00123             }
00124             outRob = robCounter + 18;
00125           } else if(sector == 10) {
00126             if(robCounter == 3) {
00127               continue;
00128             } else if(robCounter == 0) {
00129               outRob = 21;
00130             } else {
00131               outRob = robCounter + 21;
00132             }
00133           }
00134           if(sector == 4 )  {
00135             if(robCounter == 3 || robCounter == 4 ) {
00136               continue;
00137             }
00138             outRob = robCounter + 18;
00139           } else if(sector == 13) {
00140             if(robCounter == 3 || robCounter == 4) {
00141               continue;
00142             } else if(robCounter == 0) {
00143               outRob = 21;
00144             } else {
00145               outRob = robCounter + 21;
00146             }
00147           } else if(sector == 11 || sector == 9) {
00148             outRob = robCounter + 18;
00149             if(robCounter == 3) {
00150               continue;
00151             }
00152           }
00153           //else if(sector==12 || sector == 8 || sector == 7 || sector == 6 || sector == 5 ||  sector == 3 || sector == 2 ||sector == 1 ){
00154           else{
00155             outRob = robCounter + 18;
00156           }
00157         }
00158       } else {
00159         outRob = rob;
00160       }
00161       outputMap << ddu << " "
00162                 << ros << " "
00163                 << outRob << " "
00164                 << tdc << " "
00165                 << tdcChannel << " "
00166                 << wheel << " "
00167                 << station << " "
00168                 << sector << " "
00169                 << sl << " "
00170                 << layer << " "
00171                 << wire << endl;
00172     }
00173   }
00174 }


Member Data Documentation

std::string DTMapGenerator::inputMapName [private]

Definition at line 48 of file DTMapGenerator.h.

Referenced by DTMapGenerator(), and endJob().

std::string DTMapGenerator::outputMapName [private]

Definition at line 46 of file DTMapGenerator.h.

Referenced by DTMapGenerator(), and endJob().

int DTMapGenerator::rosType [private]

Definition at line 50 of file DTMapGenerator.h.

Referenced by DTMapGenerator(), and endJob().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:57 2009 for CMSSW by  doxygen 1.5.4