CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/CalibFormats/SiStripObjects/interface/SiStripDetCabling.h

Go to the documentation of this file.
00001 #ifndef SiStripObjects_SiStripDetCabling_h
00002 #define SiStripObjects_SiStripDetCabling_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     CalibFormats/SiStripObjects
00006 // Class  :     SiStripDetCabling
00011 // Original Author:  dkcira
00012 //         Created:  Wed Mar 22 12:24:20 CET 2006
00013 // $Id: SiStripDetCabling.h,v 1.10 2011/09/16 13:49:22 demattia Exp $
00014 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
00015 #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
00016 #include <boost/cstdint.hpp>
00017 #include <vector>
00018 #include <string>
00019 #include <map>
00020 class SiStripDetCabling
00021 {
00022  public:
00023   SiStripDetCabling();
00024   virtual ~SiStripDetCabling();
00025   SiStripDetCabling(const SiStripFedCabling &);
00026   void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector<const FedChannelConnection *> >&);
00027   void addDevices(const FedChannelConnection &); // special case of above addDevices
00028   // getters
00029   inline const  std::map< uint32_t, std::vector<const FedChannelConnection *> >& getDetCabling() const { return fullcabling_; }
00030   // for DQM use: all detectors that have at least one connected APV
00031   void  addActiveDetectorsRawIds(std::vector<uint32_t> &) const;                    // add to vector Ids of connected modules (active == connected)
00032   void  addAllDetectorsRawIds(std::vector<uint32_t> & vector_to_fill_with_detids ) const; // add to vector Ids of all modules
00033   void  getAllDetectorsContiguousIds(std::map<uint32_t, unsigned int>&) const;    // map of all connected, detected, undetected to contiguous Ids - map is reset first!
00034   void  getActiveDetectorsContiguousIds(std::map<uint32_t, unsigned int>&) const; // map of all connected to contiguous Ids - map is reset first!
00035   // for RECO use
00036   void  addConnected ( std::map<uint32_t, std::vector<int> > &) const; // map of detector to list of APVs for APVs seen from FECs and FEDs
00037   void  addDetected  ( std::map<uint32_t, std::vector<int> > &) const; // map of detector to list of APVs for APVs seen from FECs but not from FEDs
00038   void  addUnDetected( std::map<uint32_t, std::vector<int> > &) const; // map of detector to list of APVs for APVs seen neither from FECS or FEDs
00039   void  addNotConnectedAPVs( std::map<uint32_t, std::vector<int> > &) const; // map of detector to list of APVs that are not connected - combination of addDetected and addUnDetected
00040   // other
00041   const std::vector<const FedChannelConnection *>& getConnections( uint32_t det_id ) const;
00042   const FedChannelConnection& getConnection( uint32_t det_id, unsigned short apv_pair ) const;
00043   const unsigned int getDcuId( uint32_t det_id ) const;
00044   const uint16_t nApvPairs(uint32_t det_id) const; // maximal nr. of apvpairs a detector can have (2 or 3)
00045   bool IsConnected(const uint32_t& det_id) const;
00046   bool IsDetected(const uint32_t& det_id) const;
00047   bool IsUndetected(const uint32_t& det_id) const;
00048 
00050   void print( std::stringstream& ) const;
00051 
00053   void printSummary(std::stringstream& ss) const;
00055   void printDebug(std::stringstream& ss) const;
00056 
00057   // Methods to get the number of connected, detected and undetected modules for each layer of each subdetector.
00058   uint32_t connectedNumber(const std::string & subDet, const uint16_t layer) const { return detNumber(subDet, layer, 0); }
00059   uint32_t detectedNumber(const std::string & subDet, const uint16_t layer) const { return detNumber(subDet, layer, 1); }
00060   uint32_t undetectedNumber(const std::string & subDet, const uint16_t layer) const { return detNumber(subDet, layer, 2); }
00061   inline const SiStripFedCabling * fedCabling() const {return fedCabling_;}
00062 
00063  private:
00064   SiStripDetCabling(const SiStripDetCabling&); // stop default
00065   const SiStripDetCabling& operator=(const SiStripDetCabling&); // stop default
00066   void addFromSpecificConnection( std::map<uint32_t, std::vector<int> > & , const std::map< uint32_t, std::vector<int> >  &, const int connectionType = -1 ) const;
00067   bool IsInMap(const uint32_t& det_id, const std::map<uint32_t, std::vector<int> > &) const;
00068   int16_t layerSearch( const uint32_t detId ) const;
00069   uint32_t detNumber(const std::string & subDet, const uint16_t layer, const int connectionType) const;
00070 
00071   // ---------- member data --------------------------------
00072   // map of KEY=detid DATA=vector<FedChannelConnection>
00073   std::map< uint32_t, std::vector<const FedChannelConnection *> > fullcabling_;
00074   // map of KEY=detid DATA=vector of apvs, maximum 6 APVs per detector module : 0,1,2,3,4,5
00075   std::map< uint32_t, std::vector<int> > connected_; // seen from FECs and FEDs
00076   std::map< uint32_t, std::vector<int> > detected_; // seen from FECs but not from FEDs
00077   std::map< uint32_t, std::vector<int> > undetected_; // seen from neither FECs or FEDs, DetIds inferred from static Look-Up-Table in the configuration database
00078 
00079   // Map containing the number of detectors for each connectionType
00080   // 0 = connected
00081   // 1 = detected
00082   // 2 = undetected
00083   // Note: it is mutable because the method changing it must be const.
00084   mutable std::map< int16_t, uint32_t > connectionCount[3];
00085   const SiStripFedCabling * fedCabling_;
00086 };
00087 #endif