CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions

ECALRegFEDSelector Class Reference

#include <ECALRegFEDSelector.h>

Inheritance diagram for ECALRegFEDSelector:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Public Attributes

double delta_
const EcalElectronicsMappingec_mapping
bool fedSaved [1200]
edm::InputTag rawInLabel_
edm::InputTag seedLabel_

Private Member Functions

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

Detailed Description

Definition at line 29 of file ECALRegFEDSelector.h.


Constructor & Destructor Documentation

ECALRegFEDSelector::ECALRegFEDSelector ( const edm::ParameterSet iConfig)

Definition at line 8 of file ECALRegFEDSelector.cc.

References delta_, ec_mapping, fedSaved, edm::ParameterSet::getParameter(), AlCaHLTBitMon_ParallelJobs::p, rawInLabel_, and seedLabel_.

{
  seedLabel_=iConfig.getParameter<edm::InputTag>("regSeedLabel");
  delta_=iConfig.getParameter<double>("delta");
  
  rawInLabel_=iConfig.getParameter<edm::InputTag>("rawInputLabel");

  ec_mapping = new EcalElectronicsMapping();

  produces<FEDRawDataCollection>();
  produces<EcalListOfFEDS>();

  for (int p=0; p<1200; p++)
    {
      fedSaved[p]=false;
    }
}
ECALRegFEDSelector::~ECALRegFEDSelector ( )

Definition at line 27 of file ECALRegFEDSelector.cc.

{
}

Member Function Documentation

void ECALRegFEDSelector::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 117 of file ECALRegFEDSelector.cc.

                                  {
}
void ECALRegFEDSelector::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 121 of file ECALRegFEDSelector.cc.

                                {
}
void ECALRegFEDSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 32 of file ECALRegFEDSelector.cc.

References data, FEDRawData::data(), delta_, ec_mapping, FEDRawDataCollection::FEDData(), EcalRegionCabling::fedIndex(), fedSaved, edm::Event::getByLabel(), EcalElectronicsMapping::GetListofFEDs(), j, gen::k, FEDNumbering::MAXFEDID, FEDNumbering::MAXPreShowerFEDID, FEDNumbering::MINPreShowerFEDID, AlCaHLTBitMon_ParallelJobs::p, edm::Handle< T >::product(), edm::Event::put(), rawInLabel_, FEDRawData::resize(), seedLabel_, findQualityFiles::size, FEDRawData::size(), and trigger::TriggerTrack.

{
  for (int p=0; p<1200; p++)
    {
      fedSaved[p]=false;
    }

  std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);

  std::auto_ptr<EcalListOfFEDS> fedList(new EcalListOfFEDS);  

  edm::Handle<trigger::TriggerFilterObjectWithRefs> trigSeedTrks;
  iEvent.getByLabel(seedLabel_,trigSeedTrks);

  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
  trigSeedTrks->getObjects(trigger::TriggerTrack, isoPixTrackRefs);

  edm::Handle<FEDRawDataCollection> rawIn;
  iEvent.getByLabel(rawInLabel_,rawIn);

  //  std::vector<int> EC_FED_IDs;
  
  for (uint32_t p=0; p<isoPixTrackRefs.size(); p++)
    {
      double etaObj_=isoPixTrackRefs[p]->track()->eta();
      double phiObj_=isoPixTrackRefs[p]->track()->phi();

      EcalEtaPhiRegion ecEtaPhi(etaObj_-delta_,etaObj_+delta_,phiObj_-delta_,phiObj_+delta_);
      
      const std::vector<int> EC_FED_IDs=ec_mapping->GetListofFEDs(ecEtaPhi);
      
      const FEDRawDataCollection *rdc=rawIn.product();
      
      for ( int j=0; j< FEDNumbering::MAXFEDID; j++ ) 
        {
          bool rightFED=false;
          for (uint32_t k=0; k<EC_FED_IDs.size(); k++)
            {
              if (j==EcalRegionCabling::fedIndex(EC_FED_IDs[k])) 
                {
                  if (!fedSaved[j]) 
                    {
                      fedList->AddFED(j);
                      rightFED=true;
                      fedSaved[j]=true;
                    }
                }
            }
          if (j>=FEDNumbering::MINPreShowerFEDID&&j<=FEDNumbering::MAXPreShowerFEDID) 
            {
              fedSaved[j]=true;
              rightFED=true;
            }
          if (!rightFED) continue;
          const FEDRawData & fedData = rdc->FEDData(j);
          size_t size=fedData.size();
          
          if ( size > 0 ) 
            {
              // this fed has data -- lets copy it
              FEDRawData & fedDataProd = producedData->FEDData(j);
              if ( fedDataProd.size() != 0 ) 
                {
//                std::cout << " More than one FEDRawDataCollection with data in FED ";
//                std::cout << j << " Skipping the 2nd\n";
                  continue;
                }
              fedDataProd.resize(size);
              unsigned char *dataProd=fedDataProd.data();
              const unsigned char *data=fedData.data();
              for ( unsigned int k=0; k<size; ++k ) 
                {
                  dataProd[k]=data[k];
                }
            }
          
        }
    }

  iEvent.put(producedData);  
  iEvent.put(fedList);
  
}

Member Data Documentation

Definition at line 36 of file ECALRegFEDSelector.h.

Referenced by ECALRegFEDSelector(), and produce().

Definition at line 33 of file ECALRegFEDSelector.h.

Referenced by ECALRegFEDSelector(), and produce().

Definition at line 37 of file ECALRegFEDSelector.h.

Referenced by ECALRegFEDSelector(), and produce().

Definition at line 39 of file ECALRegFEDSelector.h.

Referenced by ECALRegFEDSelector(), and produce().

Definition at line 35 of file ECALRegFEDSelector.h.

Referenced by ECALRegFEDSelector(), and produce().