CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

popcon::SiStripPopConHandlerUnitTestNoise< T > Class Template Reference

#include <SiStripPopConHandlerUnitTestNoise.h>

Inheritance diagram for popcon::SiStripPopConHandlerUnitTestNoise< T >:
popcon::PopConSourceHandler< T >

List of all members.

Public Types

enum  DataType {
  UNDEFINED = 0, _Cabling = 1, _Pedestal = 2, _Noise = 3,
  _Threshold = 4, _BadStrip = 5, _Gain = 6
}

Public Member Functions

void getNewObjects ()
std::string id () const
 SiStripPopConHandlerUnitTestNoise (const edm::ParameterSet &pset)
 ~SiStripPopConHandlerUnitTestNoise ()

Private Member Functions

void fillObject (T *&obj)
DataType getDataType ()
bool isTransferNeeded ()
void setForTransfer ()

Private Attributes

edm::Service
< SiStripCondObjBuilderFromDb
condObjBuilder
bool m_debugMode
std::string m_name
unsigned long long m_since

Detailed Description

template<typename T>
class popcon::SiStripPopConHandlerUnitTestNoise< T >

Definition at line 36 of file SiStripPopConHandlerUnitTestNoise.h.


Member Enumeration Documentation

Enumerator:
UNDEFINED 
_Cabling 
_Pedestal 
_Noise 
_Threshold 
_BadStrip 
_Gain 

Definition at line 39 of file SiStripPopConHandlerUnitTestNoise.h.


Constructor & Destructor Documentation

Definition at line 43 of file SiStripPopConHandlerUnitTestNoise.h.

                                                                  :
      m_name(pset.getUntrackedParameter<std::string>("name","SiStripPopPopConConfigDbObjHandler")),
      m_since(pset.getUntrackedParameter<uint32_t>("since",5)),
      m_debugMode(pset.getUntrackedParameter<bool>("debug",false)){}; 

Definition at line 50 of file SiStripPopConHandlerUnitTestNoise.h.

{}; 

Member Function Documentation

template<typename T >
void popcon::SiStripPopConHandlerUnitTestNoise< T >::fillObject ( T *&  obj) [inline, private]

Definition at line 178 of file SiStripPopConHandlerUnitTestNoise.h.

References prof2calltree::count, edm::FileInPath::fullPath(), matplotRender::reader, and strip().

Referenced by popcon::SiStripPopConHandlerUnitTestNoise< T >::setForTransfer().

                            {

     
      if(typeid(T)==typeid(SiStripNoises)){


        obj = new SiStripNoises();

        edm::FileInPath fp_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat");
        SiStripDetInfoFileReader reader(fp_.fullPath());
        
        const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos  = reader.getAllData();
        
        int count=-1;
        for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){    
          count++;
          //Generate Noise for det detid
          SiStripNoises::InputVector theSiStripVector;
          for(int strip=0; strip<128*it->second.nApvs; ++strip){
            
            float MeanNoise = 5;
            float RmsNoise  = 1;

            float noise =  CLHEP::RandGauss::shoot(MeanNoise,RmsNoise);
                  
            //double badStripProb = .5;
            //bool disable = (CLHEP::RandFlat::shoot(1.) < badStripProb ? true:false);
          
            obj->setData(noise,theSiStripVector);
            if (count<6)
              edm::LogInfo("SiStripNoisesBuilder") << "detid " << it->first << " \t"
                                                   << " strip " << strip << " \t"
                                                   << noise     << " \t" 
                                                   << theSiStripVector.back()/10 << " \t" 
                                                   << std::endl;            
          }    
      
          if ( ! obj->put(it->first,theSiStripVector) )
            edm::LogError("SiStripNoisesBuilder")<<"[SiStripNoisesBuilder::analyze] detid already exists"<<std::endl;
        }
      }
    }
template<typename T >
DataType popcon::SiStripPopConHandlerUnitTestNoise< T >::getDataType ( ) [inline, private]

Definition at line 100 of file SiStripPopConHandlerUnitTestNoise.h.

References popcon::SiStripPopConHandlerUnitTestNoise< T >::_Cabling, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_name, mergeVDriftHistosByStation::name, and popcon::SiStripPopConHandlerUnitTestNoise< T >::UNDEFINED.

                          {
      
      if(typeid(T)==typeid(SiStripFedCabling)){
        edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[getDataType] for PopCon application " << m_name << " " << typeid(T).name();
        return _Cabling;
      }
      return UNDEFINED;
    }
template<typename T >
void popcon::SiStripPopConHandlerUnitTestNoise< T >::getNewObjects ( ) [inline, virtual]

Implements popcon::PopConSourceHandler< T >.

Definition at line 54 of file SiStripPopConHandlerUnitTestNoise.h.

References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, popcon::SiStripPopConHandlerUnitTestNoise< T >::isTransferNeeded(), cond::TagInfo::lastInterval, cond::TagInfo::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry::logId, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_name, cond::TagInfo::name, cond::LogDBEntry::payloadClass, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, popcon::SiStripPopConHandlerUnitTestNoise< T >::setForTransfer(), findQualityFiles::size, cond::TagInfo::size, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo::token, cond::LogDBEntry::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

                        {
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name;
     
      if (m_debugMode){
        std::stringstream ss;
        ss << "\n\n------- " << m_name 
           << " - > getNewObjects\n"; 
        if (this->tagInfo().size){
          //check whats already inside of database
          ss << "got offlineInfo"<<
            this->tagInfo().name << ", size " << this->tagInfo().size << " " << this->tagInfo().token 
             << " , last object valid since " 
             << this->tagInfo().lastInterval.first << " token "   
             << this->tagInfo().lastPayloadToken << "\n\n UserText " << this->userTextLog() 
             << "\n LogDBEntry \n" 
             << this->logDBEntry().logId<< "\n"
             << this->logDBEntry().destinationDB<< "\n"   
             << this->logDBEntry().provenance<< "\n"
             << this->logDBEntry().usertext<< "\n"
             << this->logDBEntry().iovtag<< "\n"
             << this->logDBEntry().iovtimetype<< "\n"
             << this->logDBEntry().payloadIdx<< "\n"
             << this->logDBEntry().payloadClass<< "\n"
             << this->logDBEntry().payloadToken<< "\n"
             << this->logDBEntry().exectime<< "\n"
             << this->logDBEntry().execmessage<< "\n"
             << "\n\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
        } else {
          ss << " First object for this tag ";
        }
        edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << ss.str();
      }
      if (isTransferNeeded())
        setForTransfer();
  
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
    }
template<typename T >
std::string popcon::SiStripPopConHandlerUnitTestNoise< T >::id ( void  ) const [inline, virtual]
template<typename T >
bool popcon::SiStripPopConHandlerUnitTestNoise< T >::isTransferNeeded ( ) [inline, private]

Definition at line 113 of file SiStripPopConHandlerUnitTestNoise.h.

References cond::LogDBEntry::destinationDB, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::PopConSourceHandler< T >::m_userTextLog, cond::LogDBEntry::payloadClass, findQualityFiles::size, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry::usertext.

Referenced by popcon::SiStripPopConHandlerUnitTestNoise< T >::getNewObjects().

                           {


      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[isTransferNeeded] checking for transfer"  << std::endl;
      std::stringstream ss_logdb, ss;
      std::stringstream ss1; 

      //get log information from previous upload
      if (this->tagInfo().size)
        ss_logdb << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@"));
      else
        ss_logdb << "";

      ss  << "@ " << clock() ;     
  
      if (!strcmp(ss.str().c_str(),ss_logdb.str().c_str())){
        //string are equal, no need to do transfer
        edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") 
          << "[isTransferNeeded] the selected conditions are already uploaded in the last iov ("  
          << this->tagInfo().lastInterval.first << ") open for the object " 
          << this->logDBEntry().payloadClass << " in the db " 
          << this->logDBEntry().destinationDB << " parameters: "  << ss.str() << "\n NO TRANSFER NEEDED";
        return false;
      }
      this->m_userTextLog = ss.str();
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") 
        << "[isTransferNeeded] the selected conditions will be uploaded: " << ss.str() 
        << "\n A- "<< ss.str()  << "\n B- " << ss_logdb.str() << "\n Fine";

      return true;
    }
template<typename T >
void popcon::SiStripPopConHandlerUnitTestNoise< T >::setForTransfer ( ) [inline, private]

Definition at line 148 of file SiStripPopConHandlerUnitTestNoise.h.

References popcon::SiStripPopConHandlerUnitTestNoise< T >::fillObject(), cond::TagInfo::lastInterval, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_name, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, mergeVDriftHistosByStation::name, getGTfromDQMFile::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

Referenced by popcon::SiStripPopConHandlerUnitTestNoise< T >::getNewObjects().

                         {
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] " << m_name << " getting data to be transferred "  << std::endl;
      
      T *obj=0; 

      fillObject(obj);

      if(!this->tagInfo().size)
        m_since=1;
      else
        if (m_debugMode)
          m_since=this->tagInfo().lastInterval.first+1; 

      if (obj!=0){

        edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") <<"setting since = "<< m_since <<std::endl;
        this->m_to_transfer.push_back(std::make_pair(obj,m_since));
      }else{
        edm::LogError   ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] " << m_name << "  : NULL pointer of obj " << typeid(T).name() << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl;
      }
    }

Member Data Documentation

Definition at line 175 of file SiStripPopConHandlerUnitTestNoise.h.

template<typename T >
bool popcon::SiStripPopConHandlerUnitTestNoise< T >::m_debugMode [private]
template<typename T >
std::string popcon::SiStripPopConHandlerUnitTestNoise< T >::m_name [private]
template<typename T >
unsigned long long popcon::SiStripPopConHandlerUnitTestNoise< T >::m_since [private]