CMS 3D CMS Logo

SiStripRegFEDSelector.cc
Go to the documentation of this file.
1 
7 
9  : tok_seed_(consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<edm::InputTag>("regSeedLabel"))),
10  tok_raw_(consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("rawInputLabel"))),
12  delta_(iConfig.getParameter<double>("delta")) {
13  produces<FEDRawDataCollection>();
14 }
15 
17 
19  auto producedData = std::make_unique<FEDRawDataCollection>();
20 
22  iEvent.getByToken(tok_seed_, trigSeedTrks);
23 
24  std::vector<edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
25  trigSeedTrks->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
26 
28  iEvent.getByToken(tok_raw_, rawIn);
29 
30  const SiStripRegionCabling* strip_cabling = &iSetup.getData(tok_strip_);
31  std::vector<int> stripFEDVec;
32 
33  //get vector of regions
34  const SiStripRegionCabling::Cabling& ccab = strip_cabling->getRegionCabling();
35 
36  //size of region (eta,phi)
37  const std::pair<double, double> regDim = strip_cabling->regionDimensions();
38 
40 
41  bool fedSaved[1000];
42  for (int i = 0; i < 1000; i++)
43  fedSaved[i] = false;
44 
45  //cycle on seeds
46  for (uint32_t p = 0; p < isoPixTrackRefs.size(); p++) {
47  double etaObj_ = isoPixTrackRefs[p]->track()->eta();
48  double phiObj_ = isoPixTrackRefs[p]->track()->phi();
49 
50  //cycle on regions
51  for (uint32_t i = 0; i < ccab.size(); i++) {
52  SiStripRegionCabling::Position pos = strip_cabling->position(i);
53  double dphi = fabs(pos.second - phiObj_);
54  if (dphi > acos(-1))
55  dphi = 2 * acos(-1) - dphi;
56  double R = sqrt(pow(pos.first - etaObj_, 2) + dphi * dphi);
57  if (R - sqrt(pow(regDim.first / 2, 2) + pow(regDim.second / 2, 2)) > delta_)
58  continue;
59  //get vector of subdets within region
60  const SiStripRegionCabling::RegionCabling regSubdets = ccab[i];
61  //cycle on subdets
62  for (uint32_t idet = 0; idet < SiStripRegionCabling::ALLSUBDETS; idet++) {
63  //get vector of layers within subdet of region
64  const SiStripRegionCabling::WedgeCabling regSubdetLayers = regSubdets[idet];
65  for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
66  //get map of vectors of feds withing the layer of subdet of region
67  const SiStripRegionCabling::ElementCabling fedVectorMap = regSubdetLayers[ilayer];
68  SiStripRegionCabling::ElementCabling::const_iterator it = fedVectorMap.begin();
69  for (; it != fedVectorMap.end(); it++) {
70  for (uint32_t op = 0; op < (it->second).size(); op++) {
71  //get fed id
72  int fediid = (it->second)[op].fedId();
73  if (!fedSaved[fediid]) {
74  stripFEDVec.push_back(fediid);
75  }
76  fedSaved[fediid] = true;
77  }
78  }
79  }
80  }
81  }
82  }
83 
85 
86  const FEDRawDataCollection* rdc = rawIn.product();
87 
88  // if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
89  // continue ; // skip all raw collections not produced by the current process
90 
91  for (int j = 0; j < FEDNumbering::MAXFEDID; ++j) {
92  bool rightFED = false;
93  for (uint32_t k = 0; k < stripFEDVec.size(); k++) {
94  if (j == stripFEDVec[k]) {
95  rightFED = true;
96  }
97  }
98  if (!rightFED)
99  continue;
100  const FEDRawData& fedData = rdc->FEDData(j);
101  size_t size = fedData.size();
102 
103  if (size > 0) {
104  // this fed has data -- lets copy it
105  FEDRawData& fedDataProd = producedData->FEDData(j);
106  if (fedDataProd.size() != 0) {
107  edm::LogVerbatim("HcalIsoTrack") << " More than one FEDRawDataCollection with data in FED " << j
108  << " Skipping the 2nd *****";
109  continue;
110  }
111  fedDataProd.resize(size);
112  unsigned char* dataProd = fedDataProd.data();
113  const unsigned char* data = fedData.data();
114  for (unsigned int k = 0; k < size; ++k) {
115  dataProd[k] = data[k];
116  }
117  }
118  }
119 
120  iEvent.put(std::move(producedData));
121 }
122 
124 
SiStripRegionCabling::Position
std::pair< double, double > Position
Definition: SiStripRegionCabling.h:38
SiStripRegionCabling::RegionCabling
std::vector< WedgeCabling > RegionCabling
Definition: SiStripRegionCabling.h:33
SiStripRegionCabling::ALLLAYERS
Definition: SiStripRegionCabling.h:27
mps_fire.i
i
Definition: mps_fire.py:428
SiStripRegFEDSelector::delta_
const double delta_
Definition: SiStripRegFEDSelector.h:37
MessageLogger.h
SiStripRegionCabling::WedgeCabling
std::vector< ElementCabling > WedgeCabling
Definition: SiStripRegionCabling.h:32
SiStripRegionCabling::getRegionCabling
const Cabling & getRegionCabling() const
Definition: SiStripRegionCabling.h:118
edm::Handle::product
T const * product() const
Definition: Handle.h:70
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
SiStripRegionCabling::position
const Position position(const uint32_t) const
Definition: SiStripRegionCabling.h:128
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
SiStripRegionCabling::ALLSUBDETS
Definition: SiStripRegionCabling.h:26
trigger::TriggerTrack
Definition: TriggerTypeDefs.h:87
IsolatedPixelTrackCandidate.h
edm::Handle< trigger::TriggerFilterObjectWithRefs >
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition: TriggerRefsCollections.h:590
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
SiStripRegFEDSelector::tok_strip_
const edm::ESGetToken< SiStripRegionCabling, SiStripRegionCablingRcd > tok_strip_
Definition: SiStripRegFEDSelector.h:36
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SiStripRegFEDSelector::beginJob
void beginJob() override
Definition: SiStripRegFEDSelector.cc:123
dqmdumpme.k
k
Definition: dqmdumpme.py:60
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
SiStripRegFEDSelector::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: SiStripRegFEDSelector.cc:18
SiStripRegFEDSelector::SiStripRegFEDSelector
SiStripRegFEDSelector(const edm::ParameterSet &)
Definition: SiStripRegFEDSelector.cc:8
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripRegFEDSelector::~SiStripRegFEDSelector
~SiStripRegFEDSelector() override
Definition: SiStripRegFEDSelector.cc:16
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
SiStripRegionCablingRcd
Definition: SiStripDependentRecords.h:23
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripRegFEDSelector::tok_raw_
const edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
Definition: SiStripRegFEDSelector.h:35
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiStripRegionCabling::Cabling
std::vector< RegionCabling > Cabling
Definition: SiStripRegionCabling.h:34
FedChannelConnection.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
FEDRawData::resize
void resize(size_t newsize)
Definition: FEDRawData.cc:28
SiStripRegFEDSelector.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
trigger
Definition: HLTPrescaleTableCond.h:8
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
SiStripRegionCabling::ElementCabling
std::vector< Element > ElementCabling
Definition: SiStripRegionCabling.h:31
dttmaxenums::R
Definition: DTTMax.h:29
IsolatedPixelTrackCandidateFwd.h
SiStripRegFEDSelector::endJob
void endJob() override
Definition: SiStripRegFEDSelector.cc:125
SiStripRegionCabling
Definition: SiStripRegionCabling.h:23
SiStripRegFEDSelector::tok_seed_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_seed_
Definition: SiStripRegFEDSelector.h:34
SiStripRegionCabling::regionDimensions
const std::pair< double, double > regionDimensions() const
Definition: SiStripRegionCabling.h:124
FEDNumbering::MAXFEDID
Definition: FEDNumbering.h:26
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443