CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions

SubdetFEDSelector Class Reference

#include <SubdetFEDSelector.h>

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

List of all members.

Public Member Functions

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

Public Attributes

bool getEcal_
bool getHcal_
bool getMuon_
bool getPixel_
bool getStrip_
bool getTrigger_
edm::InputTag rawInLabel_

Private Member Functions

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

Detailed Description

Definition at line 20 of file SubdetFEDSelector.h.


Constructor & Destructor Documentation

SubdetFEDSelector::SubdetFEDSelector ( const edm::ParameterSet iConfig)

Definition at line 4 of file SubdetFEDSelector.cc.

References getEcal_, getHcal_, getMuon_, edm::ParameterSet::getParameter(), getPixel_, getStrip_, getTrigger_, and rawInLabel_.

{
  getEcal_=iConfig.getParameter<bool>("getECAL");
  getStrip_=iConfig.getParameter<bool>("getSiStrip");
  getPixel_=iConfig.getParameter<bool>("getSiPixel");
  getHcal_=iConfig.getParameter<bool>("getHCAL");
  getMuon_=iConfig.getParameter<bool>("getMuon");
  getTrigger_=iConfig.getParameter<bool>("getTrigger");
  
  rawInLabel_=iConfig.getParameter<edm::InputTag>("rawInputLabel");

  produces<FEDRawDataCollection>();
  
}
SubdetFEDSelector::~SubdetFEDSelector ( )

Definition at line 19 of file SubdetFEDSelector.cc.

{
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 226 of file SubdetFEDSelector.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 230 of file SubdetFEDSelector.cc.

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

Implements edm::EDProducer.

Definition at line 24 of file SubdetFEDSelector.cc.

References FEDRawData::data(), runTheMatrix::data, FEDRawDataCollection::FEDData(), edm::Event::getByLabel(), getEcal_, getHcal_, getMuon_, getPixel_, getStrip_, getTrigger_, i, j, gen::k, FEDNumbering::MAXCSCContingencyFEDID, FEDNumbering::MAXCSCDDUFEDID, FEDNumbering::MAXCSCFEDID, FEDNumbering::MAXCSCTFFEDID, FEDNumbering::MAXCSCTFSPFEDID, FEDNumbering::MAXDAQeFEDFEDID, FEDNumbering::MAXDTFEDID, FEDNumbering::MAXDTTFFEDID, FEDNumbering::MAXECALFEDID, FEDNumbering::MAXFEDID, FEDNumbering::MAXHCALFEDID, FEDNumbering::MAXPreShowerFEDID, FEDNumbering::MAXRPCFEDID, FEDNumbering::MAXSiPixelFEDID, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MAXTriggerEGTPFEDID, FEDNumbering::MAXTriggerGCTFEDID, FEDNumbering::MAXTriggerGTPFEDID, FEDNumbering::MAXTriggerLTCCSCFEDID, FEDNumbering::MAXTriggerLTCDTFEDID, FEDNumbering::MAXTriggerLTCECALFEDID, FEDNumbering::MAXTriggerLTCFEDID, FEDNumbering::MAXTriggerLTCHCALFEDID, FEDNumbering::MAXTriggerLTCmtccFEDID, FEDNumbering::MAXTriggerLTCRPCFEDID, FEDNumbering::MAXTriggerLTCSiPixelFEDID, FEDNumbering::MAXTriggerLTCSiStripFEDID, FEDNumbering::MAXTriggerLTCTotemCastorFEDID, FEDNumbering::MAXTriggerLTCTriggerFEDID, FEDNumbering::MINCSCContingencyFEDID, FEDNumbering::MINCSCDDUFEDID, FEDNumbering::MINCSCFEDID, FEDNumbering::MINCSCTFFEDID, FEDNumbering::MINCSCTFSPFEDID, FEDNumbering::MINDAQeFEDFEDID, FEDNumbering::MINDTFEDID, FEDNumbering::MINDTTFFEDID, FEDNumbering::MINECALFEDID, FEDNumbering::MINHCALFEDID, FEDNumbering::MINPreShowerFEDID, FEDNumbering::MINRPCFEDID, FEDNumbering::MINSiPixelFEDID, FEDNumbering::MINSiStripFEDID, FEDNumbering::MINTriggerEGTPFEDID, FEDNumbering::MINTriggerGCTFEDID, FEDNumbering::MINTriggerGTPFEDID, FEDNumbering::MINTriggerLTCCSCFEDID, FEDNumbering::MINTriggerLTCDTFEDID, FEDNumbering::MINTriggerLTCECALFEDID, FEDNumbering::MINTriggerLTCFEDID, FEDNumbering::MINTriggerLTCHCALFEDID, FEDNumbering::MINTriggerLTCmtccFEDID, FEDNumbering::MINTriggerLTCRPCFEDID, FEDNumbering::MINTriggerLTCSiPixelFEDID, FEDNumbering::MINTriggerLTCSiStripFEDID, FEDNumbering::MINTriggerLTCTotemCastorFEDID, FEDNumbering::MINTriggerLTCTriggerFEDID, edm::Handle< T >::product(), edm::Event::put(), rawInLabel_, FEDRawData::resize(), findQualityFiles::size, and FEDRawData::size().

{

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

  edm::Handle<FEDRawDataCollection> rawIn;
  iEvent.getByLabel(rawInLabel_,rawIn);
 
  std::vector<int> selFEDs;

  if (getEcal_)
    {
      for (int i=FEDNumbering::MINECALFEDID; i<=FEDNumbering::MAXECALFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINPreShowerFEDID; i<=FEDNumbering::MAXPreShowerFEDID; i++)
        {
          selFEDs.push_back(i);
        }
    }

  if (getMuon_)
    {
      for (int i=FEDNumbering::MINCSCFEDID; i<=FEDNumbering::MAXCSCFEDID; i++)
        {
          selFEDs.push_back(i);
        }
  for (int i=FEDNumbering::MINCSCTFFEDID; i<=FEDNumbering::MAXCSCTFFEDID; i++)
        {
          selFEDs.push_back(i);
        }
  for (int i=FEDNumbering::MINDTFEDID; i<=FEDNumbering::MAXDTFEDID; i++)
        {
          selFEDs.push_back(i);
        }
  for (int i=FEDNumbering::MINDTTFFEDID; i<=FEDNumbering::MAXDTTFFEDID; i++)
        {
          selFEDs.push_back(i);
        }
  for (int i=FEDNumbering::MINRPCFEDID; i<=FEDNumbering::MAXRPCFEDID; i++)
        {
          selFEDs.push_back(i);
        }
  for (int i=FEDNumbering::MINCSCDDUFEDID; i<=FEDNumbering::MAXCSCDDUFEDID; i++)
        {
          selFEDs.push_back(i);
        }
  for (int i=FEDNumbering::MINCSCContingencyFEDID; i<=FEDNumbering::MAXCSCContingencyFEDID; i++)
        {
          selFEDs.push_back(i);
        }
  for (int i=FEDNumbering::MINCSCTFSPFEDID; i<=FEDNumbering::MAXCSCTFSPFEDID; i++)
        {
          selFEDs.push_back(i);
        }
    }


  if (getHcal_)
    {
      for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++)
        {
          selFEDs.push_back(i);
        }
    }

  
  if (getStrip_)
    {
      for (int i=FEDNumbering::MINSiStripFEDID;  i<=FEDNumbering::MAXSiStripFEDID; i++)
        {
          selFEDs.push_back(i);
        }
    }

  
  if (getPixel_)
    {
      for (int i=FEDNumbering::MINSiPixelFEDID;  i<=FEDNumbering::MAXSiPixelFEDID; i++)
        {
          selFEDs.push_back(i);
        }
    }
  
  if (getTrigger_)
    {
      for (int i=FEDNumbering::MINTriggerEGTPFEDID;  i<=FEDNumbering::MAXTriggerEGTPFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINTriggerGTPFEDID;  i<=FEDNumbering::MAXTriggerGTPFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINTriggerLTCFEDID;  i<=FEDNumbering::MAXTriggerLTCFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINTriggerLTCmtccFEDID;  i<=FEDNumbering::MAXTriggerLTCmtccFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINTriggerGCTFEDID;  i<=FEDNumbering::MAXTriggerGCTFEDID; i++)
        {
          selFEDs.push_back(i);
        }

      for (int i=FEDNumbering::MINTriggerLTCTriggerFEDID;  i<=FEDNumbering::MAXTriggerLTCTriggerFEDID; i++)
        {
          selFEDs.push_back(i);
        }

      for (int i=FEDNumbering::MINTriggerLTCHCALFEDID;  i<=FEDNumbering::MAXTriggerLTCHCALFEDID; i++)
        {
          selFEDs.push_back(i);
        }

      for (int i=FEDNumbering::MINTriggerLTCSiStripFEDID;  i<=FEDNumbering::MAXTriggerLTCSiStripFEDID; i++)
        {
          selFEDs.push_back(i);
        }

      for (int i=FEDNumbering::MINTriggerLTCECALFEDID;  i<=FEDNumbering::MAXTriggerLTCECALFEDID; i++)
        {
          selFEDs.push_back(i);
        }

      for (int i=FEDNumbering::MINTriggerLTCTotemCastorFEDID;  i<=FEDNumbering::MAXTriggerLTCTotemCastorFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINTriggerLTCRPCFEDID;  i<=FEDNumbering::MAXTriggerLTCRPCFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      
      for (int i=FEDNumbering::MINTriggerLTCCSCFEDID;  i<=FEDNumbering::MAXTriggerLTCCSCFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINTriggerLTCDTFEDID;  i<=FEDNumbering::MAXTriggerLTCDTFEDID; i++)
        {
          selFEDs.push_back(i);
        }
      for (int i=FEDNumbering::MINTriggerLTCSiPixelFEDID;  i<=FEDNumbering::MAXTriggerLTCSiPixelFEDID; i++)
        {
          selFEDs.push_back(i);
        }

    }
  
  for (int i=FEDNumbering::MINDAQeFEDFEDID;  i<=FEDNumbering::MAXDAQeFEDFEDID; i++)
    {
      selFEDs.push_back(i);
    }
  

  // Copying:
  const FEDRawDataCollection *rdc=rawIn.product();
  
  //   if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
  //       continue ; // skip all raw collections not produced by the current process
  
  for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) 
    {
      bool rightFED=false;
      for (uint32_t k=0; k<selFEDs.size(); k++)
        {
          if (j==selFEDs[k])
           {
             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);

}

Member Data Documentation

Definition at line 25 of file SubdetFEDSelector.h.

Referenced by produce(), and SubdetFEDSelector().

Definition at line 26 of file SubdetFEDSelector.h.

Referenced by produce(), and SubdetFEDSelector().

Definition at line 29 of file SubdetFEDSelector.h.

Referenced by produce(), and SubdetFEDSelector().

Definition at line 28 of file SubdetFEDSelector.h.

Referenced by produce(), and SubdetFEDSelector().

Definition at line 27 of file SubdetFEDSelector.h.

Referenced by produce(), and SubdetFEDSelector().

Definition at line 30 of file SubdetFEDSelector.h.

Referenced by produce(), and SubdetFEDSelector().

Definition at line 32 of file SubdetFEDSelector.h.

Referenced by produce(), and SubdetFEDSelector().