CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ECALRegFEDSelector.cc
Go to the documentation of this file.
1 
7 
9 {
10  seedLabel_=iConfig.getParameter<edm::InputTag>("regSeedLabel");
11  delta_=iConfig.getParameter<double>("delta");
12 
13  rawInLabel_=iConfig.getParameter<edm::InputTag>("rawInputLabel");
14 
16 
17  produces<FEDRawDataCollection>();
18  produces<EcalListOfFEDS>();
19 
20  for (int p=0; p<1200; p++)
21  {
22  fedSaved[p]=false;
23  }
24 }
25 
26 
28 {
29 }
30 
31 
33 {
34  for (int p=0; p<1200; p++)
35  {
36  fedSaved[p]=false;
37  }
38 
39  std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);
40 
41  std::auto_ptr<EcalListOfFEDS> fedList(new EcalListOfFEDS);
42 
44  iEvent.getByLabel(seedLabel_,trigSeedTrks);
45 
46  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
47  trigSeedTrks->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
48 
50  iEvent.getByLabel(rawInLabel_,rawIn);
51 
52  // std::vector<int> EC_FED_IDs;
53 
54  for (uint32_t p=0; p<isoPixTrackRefs.size(); p++)
55  {
56  double etaObj_=isoPixTrackRefs[p]->track()->eta();
57  double phiObj_=isoPixTrackRefs[p]->track()->phi();
58 
59  EcalEtaPhiRegion ecEtaPhi(etaObj_-delta_,etaObj_+delta_,phiObj_-delta_,phiObj_+delta_);
60 
61  const std::vector<int> EC_FED_IDs=ec_mapping->GetListofFEDs(ecEtaPhi);
62 
63  const FEDRawDataCollection *rdc=rawIn.product();
64 
65  for ( int j=0; j< FEDNumbering::MAXFEDID; j++ )
66  {
67  bool rightFED=false;
68  for (uint32_t k=0; k<EC_FED_IDs.size(); k++)
69  {
70  if (j==EcalRegionCabling::fedIndex(EC_FED_IDs[k]))
71  {
72  if (!fedSaved[j])
73  {
74  fedList->AddFED(j);
75  rightFED=true;
76  fedSaved[j]=true;
77  }
78  }
79  }
81  {
82  fedSaved[j]=true;
83  rightFED=true;
84  }
85  if (!rightFED) continue;
86  const FEDRawData & fedData = rdc->FEDData(j);
87  size_t size=fedData.size();
88 
89  if ( size > 0 )
90  {
91  // this fed has data -- lets copy it
92  FEDRawData & fedDataProd = producedData->FEDData(j);
93  if ( fedDataProd.size() != 0 )
94  {
95 // std::cout << " More than one FEDRawDataCollection with data in FED ";
96 // std::cout << j << " Skipping the 2nd\n";
97  continue;
98  }
99  fedDataProd.resize(size);
100  unsigned char *dataProd=fedDataProd.data();
101  const unsigned char *data=fedData.data();
102  for ( unsigned int k=0; k<size; ++k )
103  {
104  dataProd[k]=data[k];
105  }
106  }
107 
108  }
109  }
110 
111  iEvent.put(producedData);
112  iEvent.put(fedList);
113 
114 }
115 
116 
118 }
119 
120 
122 }
T getParameter(std::string const &) const
ECALRegFEDSelector(const edm::ParameterSet &)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
const EcalElectronicsMapping * ec_mapping
static int fedIndex(const uint32_t index)
int iEvent
Definition: GenABIO.cc:243
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::InputTag rawInLabel_
void resize(size_t newsize)
Definition: FEDRawData.cc:33
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
std::vector< int > GetListofFEDs(const EcalEtaPhiRegion region) const
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
int k[5][pyjets_maxn]
virtual void produce(edm::Event &, const edm::EventSetup &)
T const * product() const
Definition: Handle.h:74
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
edm::InputTag seedLabel_
tuple size
Write out results.