CMS 3D CMS Logo

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

#include <EventFilter/EcalDigiToRaw/src/EcalDigiToRaw.cc>

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

Public Types

typedef unsigned int Word32
 
typedef long long Word64
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

void beginJob ()
 
 EcalDigiToRaw (const edm::ParameterSet &pset)
 
void endJob ()
 
int * GetBX ()
 
int * GetCounter ()
 
bool GetDebug ()
 
bool GetDoBarrel ()
 
bool GetDoEndCap ()
 
bool GetDoSR ()
 
bool GetDoTCC ()
 
bool GetDoTower ()
 
std::vector< int32_t > * GetListDCCId ()
 
int * GetLV1 ()
 
int * GetOrbit ()
 
int * GetRunNumber ()
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~EcalDigiToRaw ()
 
- 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 ()
 

Static Public Attributes

static const int BXMAX = 2808
 

Private Attributes

int bx_
 
int counter_
 
bool debug_
 
bool doBarrel_
 
bool doEndCap_
 
bool doSR_
 
bool doTCC_
 
bool doTower_
 
BlockFormatterHeaderblockformatter_
 
std::string instanceNameEB_
 
std::string instanceNameEE_
 
std::string label_
 
edm::InputTag labelEBSR_
 
edm::InputTag labelEESR_
 
edm::InputTag labelTT_
 
std::vector< int32_t > listDCCId_
 
int lv1_
 
int orbit_number_
 
int runnumber_
 
SRBlockFormatterSRblockformatter_
 
TCCBlockFormatterTCCblockformatter_
 
TowerBlockFormatterTowerblockformatter_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 49 of file EcalDigiToRaw.h.

Member Typedef Documentation

typedef unsigned int EcalDigiToRaw::Word32

Definition at line 59 of file EcalDigiToRaw.h.

typedef long long EcalDigiToRaw::Word64

Definition at line 58 of file EcalDigiToRaw.h.

Constructor & Destructor Documentation

EcalDigiToRaw::EcalDigiToRaw ( const edm::ParameterSet pset)

Definition at line 50 of file EcalDigiToRaw.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

51 {
52 
53  doTCC_ = iConfig.getUntrackedParameter<bool>("WriteTCCBlock");
54  doSR_ = iConfig.getUntrackedParameter<bool>("WriteSRFlags");
55  doTower_ = iConfig.getUntrackedParameter<bool>("WriteTowerBlock");
56 
57  doBarrel_ = iConfig.getUntrackedParameter<bool>("DoBarrel");
58  doEndCap_ = iConfig.getUntrackedParameter<bool>("DoEndCap");
59 
60  listDCCId_ = iConfig.getUntrackedParameter< std::vector<int32_t> >("listDCCId");
61  label_= iConfig.getParameter<string>("Label");
62  instanceNameEB_ = iConfig.getParameter<string>("InstanceEB");
63  instanceNameEE_ = iConfig.getParameter<string>("InstanceEE");
64 
65  labelTT_ = iConfig.getParameter<edm::InputTag>("labelTT");
66 
67  labelEBSR_ = iConfig.getParameter<edm::InputTag>("labelEBSRFlags");
68  labelEESR_ = iConfig.getParameter<edm::InputTag>("labelEESRFlags");
69 
70  counter_ = 0;
71  debug_ = iConfig.getUntrackedParameter<bool>("debug");
72 
73 
78 
79  produces<FEDRawDataCollection>();
80 
81 
82 }
BlockFormatter * Headerblockformatter_
TCCBlockFormatter * TCCblockformatter_
edm::InputTag labelTT_
Definition: EcalDigiToRaw.h:94
TowerBlockFormatter * Towerblockformatter_
SRBlockFormatter * SRblockformatter_
edm::InputTag labelEESR_
Definition: EcalDigiToRaw.h:96
std::string instanceNameEE_
std::string label_
std::vector< int32_t > listDCCId_
edm::InputTag labelEBSR_
Definition: EcalDigiToRaw.h:95
std::string instanceNameEB_
EcalDigiToRaw::~EcalDigiToRaw ( )
virtual

Definition at line 85 of file EcalDigiToRaw.cc.

86 {
87 
88  // do anything here that needs to be done at desctruction time
89  // (e.g. close files, deallocate resources etc.)
90 
91  delete Towerblockformatter_;
92  delete TCCblockformatter_;
93  delete SRblockformatter_;
94  delete Headerblockformatter_;
95 
96 }
BlockFormatter * Headerblockformatter_
TCCBlockFormatter * TCCblockformatter_
TowerBlockFormatter * Towerblockformatter_
SRBlockFormatter * SRblockformatter_

Member Function Documentation

void EcalDigiToRaw::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 291 of file EcalDigiToRaw.cc.

292 {
293  Headerblockformatter_ -> SetParam(this);
294  Towerblockformatter_ -> SetParam(this);
295  TCCblockformatter_ -> SetParam(this);
296  SRblockformatter_ -> SetParam(this);
297 }
BlockFormatter * Headerblockformatter_
TCCBlockFormatter * TCCblockformatter_
TowerBlockFormatter * Towerblockformatter_
SRBlockFormatter * SRblockformatter_
void EcalDigiToRaw::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 301 of file EcalDigiToRaw.cc.

301  {
302 }
int* EcalDigiToRaw::GetBX ( )
inline

Definition at line 64 of file EcalDigiToRaw.h.

References bx_.

64 {return &bx_ ;}
int* EcalDigiToRaw::GetCounter ( )
inline

Definition at line 61 of file EcalDigiToRaw.h.

References counter_.

61 {return &counter_ ;}
bool EcalDigiToRaw::GetDebug ( )
inline

Definition at line 62 of file EcalDigiToRaw.h.

References debug_.

62 {return debug_ ;}
bool EcalDigiToRaw::GetDoBarrel ( )
inline

Definition at line 67 of file EcalDigiToRaw.h.

References doBarrel_.

67 {return doBarrel_ ;}
bool EcalDigiToRaw::GetDoEndCap ( )
inline

Definition at line 68 of file EcalDigiToRaw.h.

References doEndCap_.

68 {return doEndCap_ ;}
bool EcalDigiToRaw::GetDoSR ( )
inline

Definition at line 69 of file EcalDigiToRaw.h.

References doSR_.

69 {return doSR_ ;}
bool EcalDigiToRaw::GetDoTCC ( )
inline

Definition at line 71 of file EcalDigiToRaw.h.

References doTCC_.

71 {return doTCC_ ;}
bool EcalDigiToRaw::GetDoTower ( )
inline

Definition at line 70 of file EcalDigiToRaw.h.

References doTower_.

70 {return doTower_ ;}
std::vector<int32_t>* EcalDigiToRaw::GetListDCCId ( )
inline

Definition at line 73 of file EcalDigiToRaw.h.

References listDCCId_.

73 {return &listDCCId_ ;}
std::vector< int32_t > listDCCId_
int* EcalDigiToRaw::GetLV1 ( )
inline

Definition at line 65 of file EcalDigiToRaw.h.

References lv1_.

65 {return &lv1_ ;}
int* EcalDigiToRaw::GetOrbit ( )
inline

Definition at line 63 of file EcalDigiToRaw.h.

References orbit_number_.

63 {return &orbit_number_ ;}
int* EcalDigiToRaw::GetRunNumber ( )
inline

Definition at line 66 of file EcalDigiToRaw.h.

References runnumber_.

66 {return &runnumber_ ;}
void EcalDigiToRaw::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 105 of file EcalDigiToRaw.cc.

References begin, edm::EventBase::bunchCrossing(), gather_cfg::cout, EcalElectronicsId::dccId(), cond::rpcobgas::detid, DigiToRaw_cff::DigiToRaw, EcalBarrel, EcalEndcap, end, edm::EventID::event(), L1Comparator_cfi::FEDid, edm::EventSetup::get(), edm::Event::getByLabel(), EcalSrFlag::id(), edm::EventBase::id(), errorMatrix2Lands_multiChannel::id, FEDNumbering::MINECALFEDID, edm::EventBase::orbitNumber(), edm::print(), edm::ESHandle< class >::product(), edm::Event::put(), lumiPlot::rawdata, edm::EventID::run(), EcalTrigTowerDetId::subDet(), and EcalSrFlag::value().

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

106 {
107 
108  if (debug_) cout << "Enter in EcalDigiToRaw::produce ... " << endl;
109 
111  iSetup.get< EcalMappingRcd >().get(ecalmapping);
112  const EcalElectronicsMapping* TheMapping = ecalmapping.product();
113 
114  Towerblockformatter_ -> StartEvent();
115  SRblockformatter_ -> StartEvent();
116 
117  runnumber_ = iEvent.id().run();
118 
119  // bx_ = (counter_ % BXMAX);
120  // orbit_number_ = counter_ / BXMAX;
121  // counter_ ++;
122 
123  counter_ = iEvent.id().event();
124  bx_ = iEvent.bunchCrossing();
125  orbit_number_ = iEvent.orbitNumber();
126 
127  lv1_ = counter_ % (0x1<<24);
128 
129  auto_ptr<FEDRawDataCollection> productRawData(new FEDRawDataCollection);
130 
131 
132  Headerblockformatter_ -> DigiToRaw(productRawData.get());
133 
134 
135 // --------- Now the Trigger Block part
136 
138 
139  Handle<EBSrFlagCollection> ebSrFlags;
140  Handle<EESrFlagCollection> eeSrFlags;
141 
142 
143  if (doTCC_) {
144 
145  if (debug_) cout << "Creation of the TCC block " << endl;
146  // iEvent.getByType(ecalTrigPrim);
147  iEvent.getByLabel(labelTT_, ecalTrigPrim);
148 
149  // loop on TP's and add one by one to the block
150  for (EcalTrigPrimDigiCollection::const_iterator it = ecalTrigPrim -> begin();
151  it != ecalTrigPrim -> end(); it++) {
152 
153  const EcalTriggerPrimitiveDigi& trigprim = *it;
154  const EcalTrigTowerDetId& detid = it -> id();
155 
156  if ( (detid.subDet() == EcalBarrel) && (! doBarrel_) ) continue;
157  if ( (detid.subDet() == EcalEndcap) && (! doEndCap_) ) continue;
158 
159  int iDCC = TheMapping -> DCCid(detid);
160  int FEDid = FEDNumbering::MINECALFEDID + iDCC;
161 
162  FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
163 
164  // adding the primitive to the block
165  TCCblockformatter_ -> DigiToRaw(trigprim, rawdata, TheMapping);
166 
167  } // end loop on ecalTrigPrim
168 
169  } // endif doTCC
170 
171 
172  if (doSR_) {
173  if (debug_) cout << " Process the SR flags " << endl;
174 
175  if (doBarrel_) {
176 
177  // iEvent.getByType(ebSrFlags);
178  iEvent.getByLabel(labelEBSR_, ebSrFlags);
179 
180  for (EBSrFlagCollection::const_iterator it = ebSrFlags -> begin();
181  it != ebSrFlags -> end(); it++) {
182  const EcalSrFlag& srflag = *it;
183  int flag = srflag.value();
184 
185  EcalTrigTowerDetId id = srflag.id();
186  int Dccid = TheMapping -> DCCid(id);
187  int DCC_Channel = TheMapping -> iTT(id);
188  int FEDid = FEDNumbering::MINECALFEDID + Dccid;
189  // if (Dccid == 10) cout << "Dcc " << Dccid << " DCC_Channel " << DCC_Channel << " flag " << flag << endl;
190  if (debug_) cout << "will process SRblockformatter_ for FEDid " << dec << FEDid << endl;
191  FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
192  if (debug_) Headerblockformatter_ -> print(rawdata);
193  SRblockformatter_ -> DigiToRaw(Dccid,DCC_Channel,flag, rawdata);
194 
195  }
196  } // end DoBarrel
197 
198 
199  if (doEndCap_) {
200  // iEvent.getByType(eeSrFlags);
201  iEvent.getByLabel(labelEESR_, eeSrFlags);
202 
203  for (EESrFlagCollection::const_iterator it = eeSrFlags -> begin();
204  it != eeSrFlags -> end(); it++) {
205  const EcalSrFlag& srflag = *it;
206  int flag = srflag.value();
207  EcalScDetId id = srflag.id();
208  pair<int, int> ind = TheMapping -> getDCCandSC(id);
209  int Dccid = ind.first;
210  int DCC_Channel = ind.second;
211 
212  int FEDid = FEDNumbering::MINECALFEDID + Dccid;
213  FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
214  SRblockformatter_ -> DigiToRaw(Dccid,DCC_Channel,flag, rawdata);
215  }
216  } // end doEndCap
217 
218  } // endif doSR
219 
220 
221 // --------- Now the Tower Block part
222 
223  Handle<EBDigiCollection> ebDigis;
224  Handle<EEDigiCollection> eeDigis;
225 
226  if (doTower_) {
227 
228  if (doBarrel_) {
229  if (debug_) cout << "Creation of the TowerBlock ... Barrel case " << endl;
230  iEvent.getByLabel(label_,instanceNameEB_,ebDigis);
231  for (EBDigiCollection::const_iterator it=ebDigis -> begin();
232  it != ebDigis->end(); it++) {
233  const EBDataFrame& dataframe = *it;
234  const EBDetId& ebdetid = it -> id();
235  int DCCid = TheMapping -> DCCid(ebdetid);
236  int FEDid = FEDNumbering::MINECALFEDID + DCCid ;
237  FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
238  Towerblockformatter_ -> DigiToRaw(dataframe, rawdata, TheMapping);
239  }
240 
241  }
242 
243  if (doEndCap_) {
244  if (debug_) cout << "Creation of the TowerBlock ... EndCap case " << endl;
245  iEvent.getByLabel(label_,instanceNameEE_,eeDigis);
246  for (EEDigiCollection::const_iterator it=eeDigis -> begin();
247  it != eeDigis->end(); it++) {
248  const EEDataFrame& dataframe = *it;
249  const EEDetId& eedetid = it -> id();
250  EcalElectronicsId elid = TheMapping -> getElectronicsId(eedetid);
251  int DCCid = elid.dccId() ;
252  int FEDid = FEDNumbering::MINECALFEDID + DCCid;
253  FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
254  Towerblockformatter_ -> DigiToRaw(dataframe, rawdata, TheMapping);
255  }
256  }
257 
258  } // endif doTower_
259 
260 
261 
262 // -------- Clean up things ...
263 
264  map<int, map<int,int> >* FEDorder = Towerblockformatter_ -> GetFEDorder();
265 
266  Headerblockformatter_ -> CleanUp(productRawData.get(), FEDorder);
267 
268 
269 /*
270  cout << "For FED 633 " << endl;
271  FEDRawData& rawdata = productRawData -> FEDData(633);
272  Headerblockformatter_ -> print(rawdata);
273 */
274 
275  // Headerblockformatter_ -> PrintSizes(productRawData.get());
276 
277 
278 
279  Towerblockformatter_ -> EndEvent(productRawData.get());
280 
281  iEvent.put(productRawData);
282 
283 
284  return;
285 
286 }
BlockFormatter * Headerblockformatter_
long int flag
Definition: mlp_lapack.h:47
int value() const
Definition: EcalSrFlag.h:45
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:8
TCCBlockFormatter * TCCblockformatter_
std::vector< T >::const_iterator const_iterator
virtual const DetId & id() const =0
edm::InputTag labelTT_
Definition: EcalDigiToRaw.h:94
int iEvent
Definition: GenABIO.cc:243
TowerBlockFormatter * Towerblockformatter_
#define end
Definition: vmac.h:38
SRBlockFormatter * SRblockformatter_
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
edm::InputTag labelEESR_
Definition: EcalDigiToRaw.h:96
T const * product() const
Definition: ESHandle.h:62
std::string instanceNameEE_
std::string label_
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
#define begin
Definition: vmac.h:31
tuple cout
Definition: gather_cfg.py:121
dictionary rawdata
Definition: lumiPlot.py:393
edm::InputTag labelEBSR_
Definition: EcalDigiToRaw.h:95
std::string instanceNameEB_

Member Data Documentation

int EcalDigiToRaw::bx_
private

Definition at line 87 of file EcalDigiToRaw.h.

Referenced by GetBX().

const int EcalDigiToRaw::BXMAX = 2808
static

Definition at line 75 of file EcalDigiToRaw.h.

int EcalDigiToRaw::counter_
private

Definition at line 83 of file EcalDigiToRaw.h.

Referenced by GetCounter().

bool EcalDigiToRaw::debug_
private

Definition at line 85 of file EcalDigiToRaw.h.

Referenced by GetDebug().

bool EcalDigiToRaw::doBarrel_
private

Definition at line 98 of file EcalDigiToRaw.h.

Referenced by GetDoBarrel().

bool EcalDigiToRaw::doEndCap_
private

Definition at line 99 of file EcalDigiToRaw.h.

Referenced by GetDoEndCap().

bool EcalDigiToRaw::doSR_
private

Definition at line 91 of file EcalDigiToRaw.h.

Referenced by GetDoSR().

bool EcalDigiToRaw::doTCC_
private

Definition at line 90 of file EcalDigiToRaw.h.

Referenced by GetDoTCC().

bool EcalDigiToRaw::doTower_
private

Definition at line 92 of file EcalDigiToRaw.h.

Referenced by GetDoTower().

BlockFormatter* EcalDigiToRaw::Headerblockformatter_
private

Definition at line 109 of file EcalDigiToRaw.h.

std::string EcalDigiToRaw::instanceNameEB_
private

Definition at line 104 of file EcalDigiToRaw.h.

std::string EcalDigiToRaw::instanceNameEE_
private

Definition at line 105 of file EcalDigiToRaw.h.

std::string EcalDigiToRaw::label_
private
edm::InputTag EcalDigiToRaw::labelEBSR_
private

Definition at line 95 of file EcalDigiToRaw.h.

edm::InputTag EcalDigiToRaw::labelEESR_
private

Definition at line 96 of file EcalDigiToRaw.h.

edm::InputTag EcalDigiToRaw::labelTT_
private

Definition at line 94 of file EcalDigiToRaw.h.

std::vector<int32_t> EcalDigiToRaw::listDCCId_
private

Definition at line 101 of file EcalDigiToRaw.h.

Referenced by GetListDCCId().

int EcalDigiToRaw::lv1_
private

Definition at line 88 of file EcalDigiToRaw.h.

Referenced by GetLV1().

int EcalDigiToRaw::orbit_number_
private

Definition at line 84 of file EcalDigiToRaw.h.

Referenced by GetOrbit().

int EcalDigiToRaw::runnumber_
private

Definition at line 86 of file EcalDigiToRaw.h.

Referenced by GetRunNumber().

SRBlockFormatter* EcalDigiToRaw::SRblockformatter_
private

Definition at line 110 of file EcalDigiToRaw.h.

TCCBlockFormatter* EcalDigiToRaw::TCCblockformatter_
private

Definition at line 108 of file EcalDigiToRaw.h.

TowerBlockFormatter* EcalDigiToRaw::Towerblockformatter_
private

Definition at line 107 of file EcalDigiToRaw.h.