CMS 3D CMS Logo

CastorRawToDigi Class Reference

CastorRawToDigi is the EDProducer subclass which runs the Hcal Unpack algorithm. More...

#include <EventFilter/CastorRawToDigi/plugins/CastorRawToDigi.h>

Inheritance diagram for CastorRawToDigi:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CastorRawToDigi (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~CastorRawToDigi ()

Private Attributes

bool complainEmptyData_
edm::InputTag dataTag_
std::vector< intfedUnpackList_
CastorDataFrameFilter filter_
int firstFED_
bool unpackCalib_
CastorUnpacker unpacker_


Detailed Description

CastorRawToDigi is the EDProducer subclass which runs the Hcal Unpack algorithm.

Author:
Alan Campbell
Version:
1st Version April 18, 2008

Definition at line 27 of file CastorRawToDigi.h.


Constructor & Destructor Documentation

CastorRawToDigi::CastorRawToDigi ( const edm::ParameterSet ps  )  [explicit]

Definition at line 12 of file CastorRawToDigi.cc.

References fedUnpackList_, FEDNumbering::getHcalFEDIds(), i, and ss.

00012                                                            :
00013   dataTag_(conf.getParameter<edm::InputTag>("InputLabel")),
00014   unpacker_(conf.getUntrackedParameter<int>("CastorFirstFED",FEDNumbering::getHcalFEDIds().first),conf.getParameter<int>("firstSample"),conf.getParameter<int>("lastSample")),
00015   // unpacker_(conf.getUntrackedParameter<int>("CastorFirstFED",FEDNumbering::getCastorFEDIds().first),conf.getParameter<int>("firstSample"),conf.getParameter<int>("lastSample")),
00016   filter_(conf.getParameter<bool>("FilterDataQuality"),conf.getParameter<bool>("FilterDataQuality"),
00017           false,
00018           0, 0, 
00019           -1),
00020   fedUnpackList_(conf.getUntrackedParameter<std::vector<int> >("FEDs", std::vector<int>())),
00021   firstFED_(conf.getUntrackedParameter<int>("CastorFirstFED",FEDNumbering::getHcalFEDIds().first)),
00022 //  firstFED_(conf.getUntrackedParameter<int>("CastorFirstFED",FEDNumbering::getCastorFEDIds().first)),
00023 //  unpackCalib_(conf.getUntrackedParameter<bool>("UnpackCalib",false)),
00024 
00025   complainEmptyData_(conf.getUntrackedParameter<bool>("ComplainEmptyData",false))
00026 {
00027   if (fedUnpackList_.empty()) {
00028     for (int i=FEDNumbering::getHcalFEDIds().first; i<=FEDNumbering::getHcalFEDIds().second; i++)
00029     // for (int i=FEDNumbering::getCastorFEDIds().first; i<=FEDNumbering::getCastorFEDIds().second; i++)
00030       fedUnpackList_.push_back(i);
00031   } 
00032   
00033   std::ostringstream ss;
00034   for (unsigned int i=0; i<fedUnpackList_.size(); i++) 
00035     ss << fedUnpackList_[i] << " ";
00036   edm::LogInfo("CASTOR") << "CastorRawToDigi will unpack FEDs ( " << ss.str() << ")";
00037     
00038   // products produced...
00039   produces<CastorDigiCollection>();
00040 //  produces<CastorTrigPrimDigiCollection>();
00041   produces<HcalUnpackerReport>();
00042 //  if (unpackCalib_)
00043 //    produces<HcalCalibDigiCollection>();
00044 
00045 }

CastorRawToDigi::~CastorRawToDigi (  )  [virtual]

Definition at line 48 of file CastorRawToDigi.cc.

00048 { }  


Member Function Documentation

void CastorRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

calib

zdc

Implements edm::EDProducer.

Definition at line 51 of file CastorRawToDigi.cc.

References CastorDataFrameFilter::active(), CastorUnpacker::Collections::castorCont, complainEmptyData_, dataTag_, fedUnpackList_, CastorDataFrameFilter::filter(), filter_, edm::EventSetup::get(), edm::Event::getByLabel(), i, edm::Event::put(), WenuSkim_TriggerBit_cff::report, FEDRawData::size(), edm::SortedCollection< T, SORT >::swap(), CastorUnpacker::unpack(), unpacker_, and cms::Exception::what().

00052 {
00053   // Step A: Get Inputs 
00054   edm::Handle<FEDRawDataCollection> rawraw;  
00055   e.getByLabel(dataTag_,rawraw);
00056   // get the mapping
00057   edm::ESHandle<CastorDbService> pSetup;
00058   es.get<CastorDbRecord>().get( pSetup );
00059   const CastorElectronicsMap* readoutMap=pSetup->getCastorMapping();
00060   
00061   // Step B: Create empty output  : three vectors for three classes...
00062   std::vector<CastorDataFrame> castor;
00063   //std::vector<CastorTriggerPrimitiveDigi> htp;
00064   //std::vector<CastorCalibDataFrame> hc;
00065   //std::auto_ptr<CastorUnpackerReport> report(new CastorUnpackerReport);
00066   std::auto_ptr<HcalUnpackerReport> report(new HcalUnpackerReport);
00067 
00068   CastorUnpacker::Collections colls;
00069   colls.castorCont=&castor;
00070   //colls.tpCont=&htp;
00071   //colls.calibCont=&hc;
00072  
00073   // Step C: unpack all requested FEDs
00074   for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
00075     const FEDRawData& fed = rawraw->FEDData(*i);
00076     if (fed.size()==0) {
00077       if (complainEmptyData_) {
00078         edm::LogWarning("EmptyData") << "No data for FED " << *i;
00079         report->addError(*i);
00080       }
00081     } else if (fed.size()<8*3) {
00082       edm::LogWarning("EmptyData") << "Tiny data " << fed.size() << " for FED " << *i;
00083       report->addError(*i);
00084     } else {
00085       try {
00086         unpacker_.unpack(fed,*readoutMap,colls, *report);
00087         report->addUnpacked(*i);
00088       } catch (cms::Exception& e) {
00089         edm::LogWarning("Unpacking error") << e.what();
00090         report->addError(*i);
00091       } catch (...) {
00092         edm::LogWarning("Unpacking exception");
00093         report->addError(*i);
00094       }
00095     }
00096   }
00097 
00098   // Step B: encapsulate vectors in actual collections
00099   std::auto_ptr<CastorDigiCollection> castor_prod(new CastorDigiCollection()); 
00100   // std::auto_ptr<CastorTrigPrimDigiCollection> htp_prod(new CastorTrigPrimDigiCollection());  
00101 
00102   castor_prod->swap_contents(castor);
00103   // htp_prod->swap_contents(htp);
00104 
00105   // Step C2: filter FEDs, if required
00106   if (filter_.active()) {
00107     CastorDigiCollection filtered_castor=filter_.filter(*castor_prod,*report);
00108     
00109     castor_prod->swap(filtered_castor);
00110   }
00111 
00112 
00113   // Step D: Put outputs into event
00114   // just until the sorting is proven
00115   castor_prod->sort();
00116   // htp_prod->sort();
00117 
00118   e.put(castor_prod);
00119   // e.put(htp_prod);
00120 
00122 //  if (unpackCalib_) {
00123 //    std::auto_ptr<CastorCalibDigiCollection> hc_prod(new CastorCalibDigiCollection());
00124 //    hc_prod->swap_contents(hc);
00125 //    hc_prod->sort();
00126 //    e.put(hc_prod);
00127 //  }
00128 
00130 
00131   e.put(report);
00132 }


Member Data Documentation

bool CastorRawToDigi::complainEmptyData_ [private]

Definition at line 40 of file CastorRawToDigi.h.

Referenced by produce().

edm::InputTag CastorRawToDigi::dataTag_ [private]

Definition at line 34 of file CastorRawToDigi.h.

Referenced by produce().

std::vector<int> CastorRawToDigi::fedUnpackList_ [private]

Definition at line 37 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

CastorDataFrameFilter CastorRawToDigi::filter_ [private]

Definition at line 36 of file CastorRawToDigi.h.

Referenced by produce().

int CastorRawToDigi::firstFED_ [private]

Definition at line 38 of file CastorRawToDigi.h.

bool CastorRawToDigi::unpackCalib_ [private]

Definition at line 39 of file CastorRawToDigi.h.

CastorUnpacker CastorRawToDigi::unpacker_ [private]

Definition at line 35 of file CastorRawToDigi.h.

Referenced by produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:14 2009 for CMSSW by  doxygen 1.5.4