test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalCalibFEDSelector Class Reference
Inheritance diagram for HcalCalibFEDSelector:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HcalCalibFEDSelector (const edm::ParameterSet &)
 
 ~HcalCalibFEDSelector ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< int > extraFEDs_
 
edm::EDGetTokenT
< FEDRawDataCollection
tok_fed_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file HcalCalibFEDSelector.cc.

Constructor & Destructor Documentation

HcalCalibFEDSelector::HcalCalibFEDSelector ( const edm::ParameterSet iConfig)

Definition at line 37 of file HcalCalibFEDSelector.cc.

References extraFEDs_, edm::ParameterSet::getParameter(), and tok_fed_.

38 {
39  tok_fed_ = consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("rawInputLabel"));
40  extraFEDs_ = iConfig.getParameter< std::vector<int> >("extraFEDsToKeep") ;
41  produces<FEDRawDataCollection>();
42 }
T getParameter(std::string const &) const
std::vector< int > extraFEDs_
edm::EDGetTokenT< FEDRawDataCollection > tok_fed_
HcalCalibFEDSelector::~HcalCalibFEDSelector ( )

Definition at line 44 of file HcalCalibFEDSelector.cc.

45 {
46 }

Member Function Documentation

void HcalCalibFEDSelector::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 126 of file HcalCalibFEDSelector.cc.

127 {
128 }
void HcalCalibFEDSelector::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 131 of file HcalCalibFEDSelector.cc.

131  {
132 }
void HcalCalibFEDSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 49 of file HcalCalibFEDSelector.cc.

References diJetCalib::calibType, FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, extraFEDs_, edm::false, FEDRawDataCollection::FEDData(), edm::Event::getByToken(), HcalFEDList::getListOfFEDs(), i, j, relval_2017::k, FEDNumbering::lastFEDId(), FEDNumbering::MAXHCALFEDID, FEDNumbering::MINHCALFEDID, edm::Handle< T >::product(), edm::Event::put(), FEDRawData::resize(), FEDRawData::size(), findQualityFiles::size, tok_fed_, funct::true, and relativeConstraints::value.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

50 {
51 
52  std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);
53 
55  iEvent.getByToken(tok_fed_,rawIn);
56 
57  std::vector<int> selFEDs;
58 
59  //--- Get the list of FEDs to be kept ---//
60  int calibType = -1 ;
63  const FEDRawData& fedData = rawIn->FEDData(i) ;
64  if ( fedData.size() < 24 ) continue ; // FED is empty
65  int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType() ;
66  if ( calibType < 0 ) {
67  calibType = value ;
68  } else {
69  if ( calibType != value )
70  edm::LogWarning("HcalCalibFEDSelector") << "Conflicting calibration types found: "
71  << calibType << " vs. " << value
72  << ". Staying with " << calibType ;
73  }
74  }
75 
76  HcalFEDList calibFeds(calibType) ;
77  selFEDs = calibFeds.getListOfFEDs() ;
78  for (unsigned int i=0; i<extraFEDs_.size(); i++) {
79  bool duplicate = false ;
80  for (unsigned int j=0; j<selFEDs.size(); j++) {
81  if (extraFEDs_.at(i) == selFEDs.at(j)) {
82  duplicate = true ;
83  break ;
84  }
85  }
86  if ( !duplicate ) selFEDs.push_back( extraFEDs_.at(i) ) ;
87  }
88 
89  // Copying:
90  const FEDRawDataCollection *rdc=rawIn.product();
91 
92  for ( int j=0; j< FEDNumbering::lastFEDId(); ++j )
93  {
94  bool rightFED=false;
95  for (uint32_t k=0; k<selFEDs.size(); k++)
96  {
97  if (j==selFEDs[k])
98  {
99  rightFED=true;
100  }
101  }
102  if (!rightFED) continue;
103  const FEDRawData & fedData = rdc->FEDData(j);
104  size_t size=fedData.size();
105 
106  if ( size > 0 )
107  {
108  // this fed has data -- lets copy it
109  FEDRawData & fedDataProd = producedData->FEDData(j);
110  if ( fedDataProd.size() != 0 ) {
111  continue;
112  }
113  fedDataProd.resize(size);
114  unsigned char *dataProd=fedDataProd.data();
115  const unsigned char *data=fedData.data();
116  // memcpy is at-least-as-fast as assignment and can be much faster
117  memcpy(dataProd, data, size);
118  }
119  }
120 
121  iEvent.put(producedData);
122 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
tuple calibType
Definition: diJetCalib.py:20
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
std::vector< int > extraFEDs_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:32
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< FEDRawDataCollection > tok_fed_
int j
Definition: DBlmapReader.cc:9
static int lastFEDId()
Definition: FEDNumbering.cc:17
T const * product() const
Definition: Handle.h:81
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
volatile std::atomic< bool > shutdown_flag false
tuple size
Write out results.

Member Data Documentation

std::vector<int> HcalCalibFEDSelector::extraFEDs_
private

Definition at line 30 of file HcalCalibFEDSelector.cc.

Referenced by HcalCalibFEDSelector(), and produce().

edm::EDGetTokenT<FEDRawDataCollection> HcalCalibFEDSelector::tok_fed_
private

Definition at line 29 of file HcalCalibFEDSelector.cc.

Referenced by HcalCalibFEDSelector(), and produce().