CMS 3D CMS Logo

SiPixelFedCablingMapBuilder Class Reference

#include <CalibTracker/SiPixelConnectivity/interface/SiPixelFedCablingMapBuilder.h>

List of all members.

Public Member Functions

SiPixelFedCablingMapproduce (const edm::EventSetup &setup)
 SiPixelFedCablingMapBuilder (const std::string &associatorName)

Private Member Functions

std::string myprint (const PixelGeomDetUnit *pxUnit)

Private Attributes

std::string theAssociatorName

Classes

struct  FedSpec


Detailed Description

Definition at line 14 of file SiPixelFedCablingMapBuilder.h.


Constructor & Destructor Documentation

SiPixelFedCablingMapBuilder::SiPixelFedCablingMapBuilder ( const std::string &  associatorName  ) 


Member Function Documentation

std::string SiPixelFedCablingMapBuilder::myprint ( const PixelGeomDetUnit pxUnit  )  [private]

Definition at line 146 of file SiPixelFedCablingMapBuilder.cc.

References lat::endl(), PixelTopology::ncolumns(), PixelTopology::nrows(), PV3DBase< T, PVType, FrameType >::perp(), phi, r, PixelGeomDetUnit::specificTopology(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and z.

00147 {
00148   std::ostringstream str;
00149   const PixelTopology & tpl = pxUnit->specificTopology();
00150   LocalPoint local;
00151   GlobalPoint global;
00152 
00153   local = LocalPoint(0,0,0); global = (*pxUnit).toGlobal(local);
00154   // phi measured from Y axis
00155   float phi = 180*atan2(global.x(),global.y())/M_PI;  if (phi > 180.) phi = phi-360;
00156   float r = global.perp();
00157   float z = global.z();
00158   str <<"    POSITION: "<<" r="<<r<<" phi="<<phi<<" z="<<z;
00159   str <<"   (rows,coll:"<<tpl.nrows()<<","<<tpl.ncolumns()<<")";
00160   str <<endl; 
00161   local = LocalPoint(0,0,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
00162   local = LocalPoint(1,0,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
00163   local = LocalPoint(0,1,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
00164   local = LocalPoint(0,0,1); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
00165       
00166   return str.str();
00167 }

SiPixelFedCablingMap * SiPixelFedCablingMapBuilder::produce ( const edm::EventSetup setup  ) 

Definition at line 37 of file SiPixelFedCablingMapBuilder.cc.

References SiPixelFedCablingMap::addFed(), SiPixelFedCablingMap::addItem(), GeomDetEnumerators::barrel, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), PixelToFEDAssociate::CablingRocId::fedId, PixelGeomDetUnit::geographicalId(), edm::EventSetup::get(), id, TRange< T >::inside(), it, PixelToFEDAssociate::CablingRocId::linkId, LogDebug, TRange< T >::max(), TRange< T >::min(), PixelToFEDAssociate::DetectorRocId::module, name, PixelModuleName::name(), names, DetId::rawId(), HLT_VtxMuL3::result, PixelToFEDAssociate::DetectorRocId::rocDetId, PixelToFEDAssociate::CablingRocId::rocLinkId, sipixelobjects::PixelFEDCabling::setLinks(), DetId::subdetId(), theAssociatorName, asciidump::UNITS, version(), and PixelToFEDAssociate::version().

00038 {
00039   FEDNumbering fednum;
00040 //  TRange<int> fedIds = fednum.getSiPixelFEDIds();
00041   TRange<int> fedIds(0,39);
00042   edm::LogInfo("SiPixelFedCablingMapBuilder")<<"pixel fedid range: "<<fedIds;
00043 
00044 
00045   edm::ESHandle<PixelToFEDAssociate> associator;
00046   setup.get<TrackerDigiGeometryRecord>().get(theAssociatorName,associator);
00047   const PixelToFEDAssociate & name2fed = *associator; 
00048   
00049   string version = name2fed.version();
00050   SiPixelFedCablingMap * result = new SiPixelFedCablingMap(version);
00051 
00052 
00053   LogDebug("read tracker geometry...");
00054   edm::ESHandle<TrackerGeometry> pDD;
00055   setup.get<TrackerDigiGeometryRecord>().get( pDD );
00056   LogDebug("tracker geometry read")<<"There are: "<<  pDD->dets().size() <<" detectors";
00057 
00058   typedef TrackerGeometry::DetContainer::const_iterator ITG;
00059   int npxdets = 0;
00060 
00061   typedef  std::vector<pair<PixelModuleName* , uint32_t> > UNITS;
00062   UNITS units;
00063 
00064   for (ITG it = pDD->dets().begin(); it != pDD->dets().end(); it++){
00065     const PixelGeomDetUnit * pxUnit = dynamic_cast<const PixelGeomDetUnit*>(*it);
00066     if (pxUnit  ==0 ) continue;
00067     npxdets++;
00068     DetId geomid = pxUnit->geographicalId();
00069     PixelModuleName * name =  0;
00070     if (1 == geomid.subdetId()) {
00071       name = new PixelBarrelName(geomid);
00072     } else {
00073       name = new PixelEndcapName(geomid);
00074 //      cout << " NAME: "<<name->name()<<myprint(pxUnit)<<endl;
00075     } 
00076     units.push_back( std::make_pair( name, geomid.rawId() ) );
00077   }
00078 
00079 
00080   if (theAssociatorName=="PixelToFEDAssociateFromAscii") {
00081   cout <<" HERE PixelToFEDAssociateFromAscii"<<endl;
00082   vector<FedSpec> fedSpecs(fedIds.max()-fedIds.min()+1); 
00083   for (int id=fedIds.first; id<=fedIds.second; id++) {
00084     FedSpec fs={ id, vector<PixelModuleName* >(), vector<uint32_t>()};
00085     int idx = id - fedIds.min();
00086     fedSpecs[idx]= fs;
00087   }
00088   for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) {
00089     PixelModuleName* name = (*iu).first;
00090     uint32_t rawId = (*iu).second;
00091     int fedId = name2fed( *name);
00092     if ( fedIds.inside(fedId) ) {
00093       int idx = fedId - fedIds.min();
00094       fedSpecs[idx].rawids.push_back(rawId);
00095       fedSpecs[idx].names.push_back(name);
00096     } else edm::LogError("SiPixelFedCablingMapBuilder")
00097           <<"problem with numbering! "<<fedId<<" name: " << name->name();
00098   }
00099 
00100   LogDebug("tracker geometry read")<<"There are: "<< npxdets<<" pixel detetors";
00101   // construct FEDs
00102   typedef vector<FedSpec>::iterator FI;
00103   for ( FI it = fedSpecs.begin(); it != fedSpecs.end(); it++) {
00104     int fedId = it->fedId;
00105     vector<PixelModuleName* > names = it->names;
00106     vector<uint32_t> units = it->rawids;
00107     if ( names.size() == 0) continue;
00108     PixelFEDCabling fed(fedId);
00109     bool barrel = it->names.front()->isBarrel();
00110     if (barrel) {
00111       PixelFEDCabling::Links links = 
00112           PixelBarrelLinkMaker(&fed).links(names,units);
00113       fed.setLinks(links);
00114       result->addFed(fed);
00115     } else {
00116       PixelFEDCabling::Links links =
00117           PixelEndcapLinkMaker(&fed).links(names,units);
00118       fed.setLinks(links);
00119       result->addFed(fed);
00120     }
00121   }
00122   } else {
00123     PixelToFEDAssociate::DetectorRocId detectorRocId;
00124     cout <<" HERE PixelToLNKAssociateFromAscii"<<endl;
00125     for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) {
00126       PixelModuleName * name =  (*iu).first; 
00127       detectorRocId.module = name;
00128       for (int rocDetId=0; rocDetId<=16; rocDetId++) {
00129         detectorRocId.rocDetId = rocDetId;
00130         const PixelToFEDAssociate::CablingRocId * cablingRocId =  name2fed(detectorRocId);
00131         if (cablingRocId) {
00132           sipixelobjects::PixelROC roc( iu->second, rocDetId, cablingRocId->rocLinkId ); 
00133           result->addItem(cablingRocId->fedId, cablingRocId->linkId, roc);
00134         }
00135       }
00136     }
00137   }
00138 
00139   //clear names:
00140   for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) delete iu->first;
00141 
00142 
00143   return result;
00144 
00145 }


Member Data Documentation

std::string SiPixelFedCablingMapBuilder::theAssociatorName [private]

Definition at line 25 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce().


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