CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions
SiStripRegFEDSelector Class Reference

#include <SiStripRegFEDSelector.h>

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

Public Member Functions

 SiStripRegFEDSelector (const edm::ParameterSet &)
 
 ~SiStripRegFEDSelector ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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 &)
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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_.

10 {
11  seedLabel_=iConfig.getParameter<edm::InputTag>("regSeedLabel");
12  delta_=iConfig.getParameter<double>("delta");
13 
14  rawInLabel_=iConfig.getParameter<edm::InputTag>("rawInputLabel");
15 
16  produces<FEDRawDataCollection>();
17 }
T getParameter(std::string const &) const
SiStripRegFEDSelector::~SiStripRegFEDSelector ( )

Definition at line 20 of file SiStripRegFEDSelector.cc.

21 {
22 
23 }

Member Function Documentation

void SiStripRegFEDSelector::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 146 of file SiStripRegFEDSelector.cc.

146  {
147 }
void SiStripRegFEDSelector::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 150 of file SiStripRegFEDSelector.cc.

150  {
151 }
void SiStripRegFEDSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 26 of file SiStripRegFEDSelector.cc.

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

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

27 {
28  std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);
29 
31  iEvent.getByLabel(seedLabel_,trigSeedTrks);
32 
33  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
34  trigSeedTrks->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
35 
37  iEvent.getByLabel(rawInLabel_,rawIn);
38 
40 
41  std::vector<int> stripFEDVec;
42 
43  //get vector of regions
44  const SiStripRegionCabling::Cabling ccab=strip_cabling->getRegionCabling();
45 
46  //size of region (eta,phi)
47  const std::pair<double,double> regDim=strip_cabling->regionDimensions();
48 
50 
51  bool fedSaved[1000];
52  for (int i=0; i<1000; i++) fedSaved[i]=false;
53 
54  //cycle on seeds
55  for (uint32_t p=0; p<isoPixTrackRefs.size(); p++)
56  {
57  double etaObj_=isoPixTrackRefs[p]->track()->eta();
58  double phiObj_=isoPixTrackRefs[p]->track()->phi();
59 
60  //cycle on regions
61  for (uint32_t i=0; i<ccab.size(); i++)
62  {
64  double dphi=fabs(pos.second-phiObj_);
65  if (dphi>acos(-1)) dphi=2*acos(-1)-dphi;
66  double R=sqrt(pow(pos.first-etaObj_,2)+dphi*dphi);
67  if (R-sqrt(pow(regDim.first/2,2)+pow(regDim.second/2,2))>delta_) continue;
68  //get vector of subdets within region
69  const SiStripRegionCabling::RegionCabling regSubdets= ccab[i];
70  //cycle on subdets
71  for (uint32_t idet=0; idet<SiStripRegionCabling::ALLSUBDETS; idet++)
72  {
73  //get vector of layers within subdet of region
74  const SiStripRegionCabling::WedgeCabling regSubdetLayers=regSubdets[idet];
75  for (uint32_t ilayer=0; ilayer<SiStripRegionCabling::ALLLAYERS; ilayer++)
76  {
77  //get map of vectors of feds withing the layer of subdet of region
78  const SiStripRegionCabling::ElementCabling fedVectorMap=regSubdetLayers[ilayer];
79  SiStripRegionCabling::ElementCabling::const_iterator it=fedVectorMap.begin();
80  for( ; it!=fedVectorMap.end(); it++)
81  {
82  for (uint32_t op=0; op<(it->second).size(); op++)
83  {
84  //get fed id
85  int fediid=(it->second)[op].fedId();
86  if (!fedSaved[fediid])
87  {
88  stripFEDVec.push_back(fediid);
89  }
90  fedSaved[fediid]=true;
91 
92  }
93  }
94 
95  }
96 
97  }
98  }
99  }
100 
101 
103 
104  const FEDRawDataCollection *rdc=rawIn.product();
105 
106  // if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
107  // continue ; // skip all raw collections not produced by the current process
108 
109  for ( int j=0; j< FEDNumbering::MAXFEDID; ++j )
110  {
111  bool rightFED=false;
112  for (uint32_t k=0; k<stripFEDVec.size(); k++)
113  {
114  if (j==stripFEDVec[k])
115  {
116  rightFED=true;
117  }
118  }
119  if (!rightFED) continue;
120  const FEDRawData & fedData = rdc->FEDData(j);
121  size_t size=fedData.size();
122 
123  if ( size > 0 )
124  {
125  // this fed has data -- lets copy it
126  FEDRawData & fedDataProd = producedData->FEDData(j);
127  if ( fedDataProd.size() != 0 ) {
128 // std::cout << " More than one FEDRawDataCollection with data in FED ";
129 // std::cout << j << " Skipping the 2nd\n";
130  continue;
131  }
132  fedDataProd.resize(size);
133  unsigned char *dataProd=fedDataProd.data();
134  const unsigned char *data=fedData.data();
135  for ( unsigned int k=0; k<size; ++k ) {
136  dataProd[k]=data[k];
137  }
138  }
139  }
140 
141  iEvent.put(producedData);
142 
143 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< SiStripRegionCabling > strip_cabling
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:33
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
std::vector< ElementCabling > WedgeCabling
T sqrt(T t)
Definition: SSEVec.h:28
std::pair< double, double > Position
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
int k[5][pyjets_maxn]
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:74
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
std::vector< WedgeCabling > RegionCabling
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::map< uint32_t, std::vector< FedChannelConnection > > ElementCabling
std::vector< RegionCabling > Cabling

Member Data Documentation

double SiStripRegFEDSelector::delta_

Definition at line 31 of file SiStripRegFEDSelector.h.

Referenced by produce(), and SiStripRegFEDSelector().

edm::InputTag SiStripRegFEDSelector::rawInLabel_

Definition at line 33 of file SiStripRegFEDSelector.h.

Referenced by produce(), and SiStripRegFEDSelector().

edm::InputTag SiStripRegFEDSelector::seedLabel_

Definition at line 30 of file SiStripRegFEDSelector.h.

Referenced by produce(), and SiStripRegFEDSelector().

edm::ESHandle<SiStripRegionCabling> SiStripRegFEDSelector::strip_cabling

Definition at line 28 of file SiStripRegFEDSelector.h.

Referenced by produce().