CMS 3D CMS Logo

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

popcon::SiStripPopConHandlerUnitTestGain< T > Class Template Reference

#include <SiStripPopConHandlerUnitTestGain.h>

Inheritance diagram for popcon::SiStripPopConHandlerUnitTestGain< 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
 SiStripPopConHandlerUnitTestGain (const edm::ParameterSet &pset)
 ~SiStripPopConHandlerUnitTestGain ()

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::SiStripPopConHandlerUnitTestGain< T >

Definition at line 36 of file SiStripPopConHandlerUnitTestGain.h.


Member Enumeration Documentation

Enumerator:
UNDEFINED 
_Cabling 
_Pedestal 
_Noise 
_Threshold 
_BadStrip 
_Gain 

Definition at line 39 of file SiStripPopConHandlerUnitTestGain.h.


Constructor & Destructor Documentation

Definition at line 43 of file SiStripPopConHandlerUnitTestGain.h.

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

Definition at line 50 of file SiStripPopConHandlerUnitTestGain.h.

{}; 

Member Function Documentation

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

Definition at line 178 of file SiStripPopConHandlerUnitTestGain.h.

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

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

                            {
            std::cout << __LINE__ << std::endl;

        if(typeid(T)==typeid(SiStripApvGain)){
            std::cout << __LINE__ << std::endl;

          obj = new SiStripApvGain();
          
          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 Gains for det detid
          SiStripApvGain::InputVector inputApvGain;
          for(int apv=0; apv<it->second.nApvs; ++apv){
            
            float MeanTick = 555.;
            float RmsTick  = 55.;

      
            float tick =  CLHEP::RandGauss::shoot(MeanTick,RmsTick);

          
            
            if (count<6)
              edm::LogInfo("SiStripGainBuilder") << "detid " << it->first << " \t"
                                                   << " APV " << apv << " \t"
                                                   << tick     << " \t" 
                                                   << std::endl;            
            inputApvGain.push_back(tick); //APV0
            inputApvGain.push_back(tick); //APV1
            apv++;
          }    
          
          
          SiStripApvGain::Range gain_range( inputApvGain.begin(), inputApvGain.end() );
          if ( ! obj->put(it->first,gain_range) )
            edm::LogError("SiStripGainBuilder")<<"[SiStripGainBuilder::analyze] detid already exists"<<std::endl;
        }

          
        }

     
    }
template<typename T >
DataType popcon::SiStripPopConHandlerUnitTestGain< T >::getDataType ( ) [inline, private]

Definition at line 100 of file SiStripPopConHandlerUnitTestGain.h.

References popcon::SiStripPopConHandlerUnitTestGain< T >::_Cabling, popcon::SiStripPopConHandlerUnitTestGain< T >::m_name, mergeVDriftHistosByStation::name, and popcon::SiStripPopConHandlerUnitTestGain< 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::SiStripPopConHandlerUnitTestGain< T >::getNewObjects ( ) [inline, virtual]

Implements popcon::PopConSourceHandler< T >.

Definition at line 54 of file SiStripPopConHandlerUnitTestGain.h.

References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, popcon::SiStripPopConHandlerUnitTestGain< T >::isTransferNeeded(), cond::TagInfo::lastInterval, cond::TagInfo::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry::logId, popcon::SiStripPopConHandlerUnitTestGain< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTestGain< T >::m_name, cond::TagInfo::name, cond::LogDBEntry::payloadClass, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, popcon::SiStripPopConHandlerUnitTestGain< 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::SiStripPopConHandlerUnitTestGain< T >::id ( void  ) const [inline, virtual]
template<typename T >
bool popcon::SiStripPopConHandlerUnitTestGain< T >::isTransferNeeded ( ) [inline, private]

Definition at line 113 of file SiStripPopConHandlerUnitTestGain.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::SiStripPopConHandlerUnitTestGain< 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::SiStripPopConHandlerUnitTestGain< T >::setForTransfer ( ) [inline, private]

Definition at line 148 of file SiStripPopConHandlerUnitTestGain.h.

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

Referenced by popcon::SiStripPopConHandlerUnitTestGain< 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 SiStripPopConHandlerUnitTestGain.h.

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