CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DetStatus Class Reference

#include <DetStatus.h>

Inheritance diagram for DetStatus:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 DetStatus (const edm::ParameterSet &)
 ~DetStatus ()

Private Member Functions

bool filter (edm::Event &, edm::EventSetup const &)

Private Attributes

bool AndOr_
bool applyfilter_
unsigned int DetMap_
std::vector< std::string > DetNames_
bool verbose_

Detailed Description

Definition at line 7 of file DetStatus.h.


Constructor & Destructor Documentation

DetStatus::DetStatus ( const edm::ParameterSet pset)

Definition at line 13 of file DetStatus.cc.

References gather_cfg::cout, funct::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), DcsStatus::nPartitions, DcsStatus::partitionList, and DcsStatus::partitionName.

                                                   {
   verbose_      = pset.getUntrackedParameter<bool>( "DebugOn", false );
   AndOr_      = pset.getParameter<bool>( "AndOr");
   applyfilter_      = pset.getParameter<bool>( "ApplyFilter");
   DetNames_ = pset.getParameter<std::vector<std::string> >( "DetectorType" );

  // build a map
  DetMap_=0;
  for (unsigned int detreq=0;detreq<DetNames_.size();detreq++)
    {
      for (unsigned int detlist=0;detlist<DcsStatus::nPartitions;detlist++)
        {
          
          if (DetNames_[detreq]==DcsStatus::partitionName[detlist])
            {
              DetMap_|=(1 << DcsStatus::partitionList[detlist]);
              if (verbose_)
                  std::cout << "DCSStatus filter: asked partition " << DcsStatus::partitionName[detlist] << " bit " << DcsStatus::partitionList[detlist] << std::endl; 

            }
        }
    }
} 
DetStatus::~DetStatus ( )

Definition at line 40 of file DetStatus.cc.

                      {
}

Member Function Documentation

bool DetStatus::filter ( edm::Event evt,
edm::EventSetup const &  es 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 43 of file DetStatus.cc.

References gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), DcsStatus::nPartitions, DcsStatus::partitionList, and DcsStatus::partitionName.

                                                               {
  
  bool accepted=false;

  edm::Handle<DcsStatusCollection> dcsStatus;
  evt.getByLabel("scalersRawToDigi", dcsStatus);

  if (dcsStatus.isValid()) 
    {
      if ((*dcsStatus).size()==0)
        {
          // it's probably a MC event, accepet it in any case
          edm::LogError("DetStatus") << "Error! dcsStatus has size 0, accept in any case" ;
          accepted=true;
        }
      else 
        {
          unsigned int curr_dcs=(*dcsStatus)[0].ready();
          if (verbose_)
            std::cout << "curr_dcs = " << curr_dcs << std::endl;
          if(AndOr_)
            accepted=((DetMap_ & curr_dcs)== DetMap_);
          else
            accepted=((DetMap_ & curr_dcs)!= 0);
            
          if (verbose_)

            {
              std::cout << "DCSStatus filter: requested map: " << DetMap_ << " dcs in event: " <<curr_dcs << " filter: " << accepted << std::endl; 
              std::cout << "Partitions ON: " ;
              for (unsigned int detlist=0;detlist<DcsStatus::nPartitions;detlist++)
                {
                  if ((*dcsStatus)[0].ready(DcsStatus::partitionList[detlist]))
                    {
                      std::cout << " " << DcsStatus::partitionName[detlist];
                    }
                }
              std::cout << std::endl ;
            }
        }
    }
  else
    {
      edm::LogError("DetStatus") << "Error! can't get the product: scalersRawToDigi, accept in any case" ;
      accepted=true;
    }

  if (! applyfilter_) accepted=true;
  return accepted;
}

Member Data Documentation

bool DetStatus::AndOr_ [private]

Definition at line 16 of file DetStatus.h.

bool DetStatus::applyfilter_ [private]

Definition at line 15 of file DetStatus.h.

unsigned int DetStatus::DetMap_ [private]

Definition at line 18 of file DetStatus.h.

std::vector<std::string> DetStatus::DetNames_ [private]

Definition at line 17 of file DetStatus.h.

bool DetStatus::verbose_ [private]

Definition at line 14 of file DetStatus.h.