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::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef unsigned int Word32
 
typedef long long Word64
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

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

Definition at line 48 of file EcalDigiToRaw.h.

Member Typedef Documentation

typedef unsigned int EcalDigiToRaw::Word32

Definition at line 58 of file EcalDigiToRaw.h.

typedef long long EcalDigiToRaw::Word64

Definition at line 57 of file EcalDigiToRaw.h.

Constructor & Destructor Documentation

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

Definition at line 49 of file EcalDigiToRaw.cc.

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

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

Definition at line 84 of file EcalDigiToRaw.cc.

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

Member Function Documentation

void EcalDigiToRaw::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 290 of file EcalDigiToRaw.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 300 of file EcalDigiToRaw.cc.

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

Definition at line 63 of file EcalDigiToRaw.h.

References bx_.

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

Definition at line 60 of file EcalDigiToRaw.h.

References counter_.

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

Definition at line 61 of file EcalDigiToRaw.h.

References debug_.

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

Definition at line 66 of file EcalDigiToRaw.h.

References doBarrel_.

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

Definition at line 67 of file EcalDigiToRaw.h.

References doEndCap_.

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

Definition at line 68 of file EcalDigiToRaw.h.

References doSR_.

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

Definition at line 70 of file EcalDigiToRaw.h.

References doTCC_.

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

Definition at line 69 of file EcalDigiToRaw.h.

References doTower_.

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

Definition at line 72 of file EcalDigiToRaw.h.

References listDCCId_.

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

Definition at line 64 of file EcalDigiToRaw.h.

References lv1_.

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

Definition at line 62 of file EcalDigiToRaw.h.

References orbit_number_.

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

Definition at line 65 of file EcalDigiToRaw.h.

References runnumber_.

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

Implements edm::EDProducer.

Definition at line 104 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(), edm::EventSetup::get(), edm::Event::getByLabel(), EcalSrFlag::id(), edm::EventBase::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().

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

Member Data Documentation

int EcalDigiToRaw::bx_
private

Definition at line 86 of file EcalDigiToRaw.h.

Referenced by GetBX().

const int EcalDigiToRaw::BXMAX = 2808
static

Definition at line 74 of file EcalDigiToRaw.h.

int EcalDigiToRaw::counter_
private

Definition at line 82 of file EcalDigiToRaw.h.

Referenced by GetCounter().

bool EcalDigiToRaw::debug_
private

Definition at line 84 of file EcalDigiToRaw.h.

Referenced by GetDebug().

bool EcalDigiToRaw::doBarrel_
private

Definition at line 97 of file EcalDigiToRaw.h.

Referenced by GetDoBarrel().

bool EcalDigiToRaw::doEndCap_
private

Definition at line 98 of file EcalDigiToRaw.h.

Referenced by GetDoEndCap().

bool EcalDigiToRaw::doSR_
private

Definition at line 90 of file EcalDigiToRaw.h.

Referenced by GetDoSR().

bool EcalDigiToRaw::doTCC_
private

Definition at line 89 of file EcalDigiToRaw.h.

Referenced by GetDoTCC().

bool EcalDigiToRaw::doTower_
private

Definition at line 91 of file EcalDigiToRaw.h.

Referenced by GetDoTower().

BlockFormatter* EcalDigiToRaw::Headerblockformatter_
private

Definition at line 108 of file EcalDigiToRaw.h.

std::string EcalDigiToRaw::instanceNameEB_
private

Definition at line 103 of file EcalDigiToRaw.h.

std::string EcalDigiToRaw::instanceNameEE_
private

Definition at line 104 of file EcalDigiToRaw.h.

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

Definition at line 94 of file EcalDigiToRaw.h.

edm::InputTag EcalDigiToRaw::labelEESR_
private

Definition at line 95 of file EcalDigiToRaw.h.

edm::InputTag EcalDigiToRaw::labelTT_
private

Definition at line 93 of file EcalDigiToRaw.h.

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

Definition at line 100 of file EcalDigiToRaw.h.

Referenced by GetListDCCId().

int EcalDigiToRaw::lv1_
private

Definition at line 87 of file EcalDigiToRaw.h.

Referenced by GetLV1().

int EcalDigiToRaw::orbit_number_
private

Definition at line 83 of file EcalDigiToRaw.h.

Referenced by GetOrbit().

int EcalDigiToRaw::runnumber_
private

Definition at line 85 of file EcalDigiToRaw.h.

Referenced by GetRunNumber().

SRBlockFormatter* EcalDigiToRaw::SRblockformatter_
private

Definition at line 109 of file EcalDigiToRaw.h.

TCCBlockFormatter* EcalDigiToRaw::TCCblockformatter_
private

Definition at line 107 of file EcalDigiToRaw.h.

TowerBlockFormatter* EcalDigiToRaw::Towerblockformatter_
private

Definition at line 106 of file EcalDigiToRaw.h.