CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions

SiStripRegFEDSelector Class Reference

#include <SiStripRegFEDSelector.h>

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

List of all members.

Public Member Functions

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

Public Attributes

double delta_
edm::InputTag rawInLabel_
edm::InputTag seedLabel_
edm::ESHandle
< SiStripRegionCabling
strip_cabling

Private Member Functions

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

Detailed Description

Definition at line 23 of file SiStripRegFEDSelector.h.


Constructor & Destructor Documentation

SiStripRegFEDSelector::SiStripRegFEDSelector ( const edm::ParameterSet iConfig)

Definition at line 9 of file SiStripRegFEDSelector.cc.

References delta_, edm::ParameterSet::getParameter(), rawInLabel_, and seedLabel_.

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

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

Definition at line 20 of file SiStripRegFEDSelector.cc.

{
 
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 146 of file SiStripRegFEDSelector.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 150 of file SiStripRegFEDSelector.cc.

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

Implements edm::EDProducer.

Definition at line 26 of file SiStripRegFEDSelector.cc.

References SiStripRegionCabling::ALLLAYERS, SiStripRegionCabling::ALLSUBDETS, FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, delta_, FEDRawDataCollection::FEDData(), edm::EventSetup::get(), edm::Event::getByLabel(), i, j, gen::k, FEDNumbering::MAXFEDID, AlCaHLTBitMon_ParallelJobs::p, pos, funct::pow(), edm::Handle< T >::product(), edm::Event::put(), dttmaxenums::R, rawInLabel_, FEDRawData::resize(), seedLabel_, findQualityFiles::size, FEDRawData::size(), mathSSE::sqrt(), strip_cabling, and trigger::TriggerTrack.

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

  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);
  
  iSetup.get<SiStripRegionCablingRcd>().get(strip_cabling);
  
  std::vector<int> stripFEDVec; 
  
  //get vector of regions
  const SiStripRegionCabling::Cabling ccab=strip_cabling->getRegionCabling();
  
  //size of region (eta,phi)
  const std::pair<double,double> regDim=strip_cabling->regionDimensions();
  
  const SiStripRegionCabling::ElementCabling elcabling;
  
  bool fedSaved[1000];
  for (int i=0; i<1000; i++) fedSaved[i]=false;
  
  //cycle on seeds
  for (uint32_t p=0; p<isoPixTrackRefs.size(); p++)
    {
      double etaObj_=isoPixTrackRefs[p]->track()->eta();
      double phiObj_=isoPixTrackRefs[p]->track()->phi();
      
      //cycle on regions
      for (uint32_t i=0; i<ccab.size(); i++)
        {
          SiStripRegionCabling::Position pos=strip_cabling->position(i);
          double dphi=fabs(pos.second-phiObj_);
          if (dphi>acos(-1)) dphi=2*acos(-1)-dphi;
          double R=sqrt(pow(pos.first-etaObj_,2)+dphi*dphi);
          if (R-sqrt(pow(regDim.first/2,2)+pow(regDim.second/2,2))>delta_) continue;
          //get vector of subdets within region
          const SiStripRegionCabling::RegionCabling regSubdets= ccab[i];
          //cycle on subdets
          for (uint32_t idet=0; idet<SiStripRegionCabling::ALLSUBDETS; idet++)
            {
              //get vector of layers within subdet of region
              const SiStripRegionCabling::WedgeCabling regSubdetLayers=regSubdets[idet];        
              for (uint32_t ilayer=0; ilayer<SiStripRegionCabling::ALLLAYERS; ilayer++)
                {
                  //get map of vectors of feds withing the layer of subdet of region
                  const SiStripRegionCabling::ElementCabling fedVectorMap=regSubdetLayers[ilayer];
                  SiStripRegionCabling::ElementCabling::const_iterator it=fedVectorMap.begin();
                  for( ; it!=fedVectorMap.end(); it++)
                    {
                      for (uint32_t op=0; op<(it->second).size(); op++)
                        {
                          //get fed id 
                          int fediid=(it->second)[op].fedId(); 
                          if (!fedSaved[fediid]) 
                            {
                              stripFEDVec.push_back(fediid);
                            }
                          fedSaved[fediid]=true;
                          
                        }
                    }   
                  
                }
              
            }
        }
    }
  
  
  
  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<stripFEDVec.size(); k++) 
        {
          if (j==stripFEDVec[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 31 of file SiStripRegFEDSelector.h.

Referenced by produce(), and SiStripRegFEDSelector().

Definition at line 33 of file SiStripRegFEDSelector.h.

Referenced by produce(), and SiStripRegFEDSelector().

Definition at line 30 of file SiStripRegFEDSelector.h.

Referenced by produce(), and SiStripRegFEDSelector().

Definition at line 28 of file SiStripRegFEDSelector.h.

Referenced by produce().