CMS 3D CMS Logo

EcalDigiToRaw Class Reference

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

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

Inheritance diagram for EcalDigiToRaw:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef unsigned int Word32
typedef long long Word64

Public Member Functions

void beginJob (const edm::EventSetup &c)
 EcalDigiToRaw (const edm::ParameterSet &pset)
void endJob ()
intGetBX ()
intGetCounter ()
bool GetDebug ()
bool GetDoBarrel ()
bool GetDoEndCap ()
bool GetDoSR ()
bool GetDoTCC ()
bool GetDoTower ()
std::vector< int32_t > * GetListDCCId ()
intGetLV1 ()
intGetOrbit ()
intGetRunNumber ()
void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~EcalDigiToRaw ()

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_


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 counter_, debug_, doBarrel_, doEndCap_, doSR_, doTCC_, doTower_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), Headerblockformatter_, instanceNameEB_, instanceNameEE_, label_, labelEBSR_, labelEESR_, labelTT_, listDCCId_, SRblockformatter_, TCCblockformatter_, and Towerblockformatter_.

00051 {
00052 
00053    doTCC_    = iConfig.getUntrackedParameter<bool>("WriteTCCBlock");
00054    doSR_     = iConfig.getUntrackedParameter<bool>("WriteSRFlags");
00055    doTower_  = iConfig.getUntrackedParameter<bool>("WriteTowerBlock");
00056 
00057    doBarrel_ = iConfig.getUntrackedParameter<bool>("DoBarrel");
00058    doEndCap_ = iConfig.getUntrackedParameter<bool>("DoEndCap");
00059 
00060    listDCCId_ = iConfig.getUntrackedParameter< std::vector<int32_t> >("listDCCId");
00061    
00062    label_= iConfig.getParameter<string>("Label");
00063    instanceNameEB_ = iConfig.getParameter<string>("InstanceEB");
00064    instanceNameEE_ = iConfig.getParameter<string>("InstanceEE");
00065 
00066    labelTT_ = iConfig.getParameter<edm::InputTag>("labelTT");
00067 
00068    labelEBSR_ = iConfig.getParameter<edm::InputTag>("labelEBSRFlags");
00069    labelEESR_ = iConfig.getParameter<edm::InputTag>("labelEESRFlags");
00070 
00071    counter_ = 0;
00072    debug_ = iConfig.getUntrackedParameter<bool>("debug");
00073 
00074 
00075    Towerblockformatter_ = new TowerBlockFormatter;
00076    TCCblockformatter_   = new TCCBlockFormatter();
00077    SRblockformatter_    = new SRBlockFormatter();
00078    Headerblockformatter_= new BlockFormatter;
00079 
00080    produces<FEDRawDataCollection>();
00081 
00082 
00083 }

EcalDigiToRaw::~EcalDigiToRaw (  )  [virtual]

Definition at line 86 of file EcalDigiToRaw.cc.

References Headerblockformatter_, SRblockformatter_, TCCblockformatter_, and Towerblockformatter_.

00087 {
00088  
00089    // do anything here that needs to be done at desctruction time
00090    // (e.g. close files, deallocate resources etc.)
00091 
00092  delete Towerblockformatter_;
00093  delete TCCblockformatter_;
00094  delete SRblockformatter_;
00095  delete Headerblockformatter_;
00096 
00097 }


Member Function Documentation

void EcalDigiToRaw::beginJob ( const edm::EventSetup c  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 287 of file EcalDigiToRaw.cc.

References Headerblockformatter_, SRblockformatter_, TCCblockformatter_, and Towerblockformatter_.

00288 {
00289         Headerblockformatter_ -> SetParam(this);
00290         Towerblockformatter_  -> SetParam(this);
00291         TCCblockformatter_  -> SetParam(this);
00292         SRblockformatter_   -> SetParam(this);
00293 }

void EcalDigiToRaw::endJob ( void   )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 297 of file EcalDigiToRaw.cc.

00297                       {
00298 }

int* EcalDigiToRaw::GetBX (  )  [inline]

Definition at line 64 of file EcalDigiToRaw.h.

References bx_.

00064 {return &bx_ ;}

int* EcalDigiToRaw::GetCounter (  )  [inline]

Definition at line 61 of file EcalDigiToRaw.h.

References counter_.

00061 {return &counter_ ;}

bool EcalDigiToRaw::GetDebug (  )  [inline]

Definition at line 62 of file EcalDigiToRaw.h.

References debug_.

00062 {return debug_ ;}

bool EcalDigiToRaw::GetDoBarrel (  )  [inline]

Definition at line 67 of file EcalDigiToRaw.h.

References doBarrel_.

00067 {return doBarrel_ ;}

bool EcalDigiToRaw::GetDoEndCap (  )  [inline]

Definition at line 68 of file EcalDigiToRaw.h.

References doEndCap_.

00068 {return doEndCap_ ;}

bool EcalDigiToRaw::GetDoSR (  )  [inline]

Definition at line 69 of file EcalDigiToRaw.h.

References doSR_.

00069 {return doSR_ ;}

bool EcalDigiToRaw::GetDoTCC (  )  [inline]

Definition at line 71 of file EcalDigiToRaw.h.

References doTCC_.

00071 {return doTCC_ ;}

bool EcalDigiToRaw::GetDoTower (  )  [inline]

Definition at line 70 of file EcalDigiToRaw.h.

References doTower_.

00070 {return doTower_ ;}

std::vector<int32_t>* EcalDigiToRaw::GetListDCCId (  )  [inline]

Definition at line 73 of file EcalDigiToRaw.h.

References listDCCId_.

00073 {return &listDCCId_ ;}

int* EcalDigiToRaw::GetLV1 (  )  [inline]

Definition at line 65 of file EcalDigiToRaw.h.

References lv1_.

00065 {return &lv1_ ;}

int* EcalDigiToRaw::GetOrbit (  )  [inline]

Definition at line 63 of file EcalDigiToRaw.h.

References orbit_number_.

00063 {return &orbit_number_ ;}

int* EcalDigiToRaw::GetRunNumber (  )  [inline]

Definition at line 66 of file EcalDigiToRaw.h.

References runnumber_.

00066 {return &runnumber_ ;}

void EcalDigiToRaw::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 106 of file EcalDigiToRaw.cc.

References begin, bx_, BXMAX, counter_, GenMuonPlsPt100GeV_cfg::cout, EcalElectronicsId::dccId(), debug_, DigiToRaw_cff::DigiToRaw, doBarrel_, doEndCap_, doSR_, doTCC_, doTower_, EcalBarrel, EcalEndcap, end, lat::endl(), L1Comparator_cfi::FEDid, edm::EventSetup::get(), edm::Event::getByLabel(), FEDNumbering::getEcalFEDIds(), Headerblockformatter_, EcalSrFlag::id(), id, edm::Event::id(), instanceNameEB_, instanceNameEE_, it, label_, labelEBSR_, labelEESR_, labelTT_, lv1_, orbit_number_, print(), edm::ESHandle< T >::product(), edm::Event::put(), edm::EventID::run(), runnumber_, SRblockformatter_, EcalTrigTowerDetId::subDet(), TCCblockformatter_, Towerblockformatter_, and EcalSrFlag::value().

00107 {
00108 
00109    if (debug_) cout << "Enter in EcalDigiToRaw::produce ... " << endl;
00110 
00111    ESHandle< EcalElectronicsMapping > ecalmapping;
00112    iSetup.get< EcalMappingRcd >().get(ecalmapping);
00113    const EcalElectronicsMapping* TheMapping = ecalmapping.product();
00114 
00115    Towerblockformatter_ -> StartEvent();
00116    SRblockformatter_ -> StartEvent();
00117 
00118   runnumber_ = iEvent.id().run();
00119 
00120   bx_ = (counter_ % BXMAX);
00121   orbit_number_ = counter_ / BXMAX;
00122   counter_ ++;
00123   lv1_ = counter_ % (0x1<<24);
00124 
00125   auto_ptr<FEDRawDataCollection> productRawData(new FEDRawDataCollection);
00126 
00127 
00128   pair<int,int> EcalFEDIds=FEDNumbering::getEcalFEDIds();
00129 
00130   Headerblockformatter_ -> DigiToRaw(productRawData.get());
00131 
00132 
00133 // ---------   Now the Trigger Block part
00134 
00135   Handle<EcalTrigPrimDigiCollection> ecalTrigPrim;
00136   
00137   Handle<EBSrFlagCollection> ebSrFlags;
00138   Handle<EESrFlagCollection> eeSrFlags;
00139 
00140 
00141   if (doTCC_) {
00142 
00143      if (debug_) cout << "Creation of the TCC block  " << endl;
00144      // iEvent.getByType(ecalTrigPrim);
00145         iEvent.getByLabel(labelTT_, ecalTrigPrim);
00146 
00147      for (EcalTrigPrimDigiCollection::const_iterator it = ecalTrigPrim -> begin();
00148                            it != ecalTrigPrim -> end(); it++) {
00149 
00150            const EcalTriggerPrimitiveDigi& trigprim = *it;
00151            const EcalTrigTowerDetId& detid = it -> id();
00152 
00153            if ( (detid.subDet() == EcalBarrel) && (! doBarrel_) ) continue;
00154            if ( (detid.subDet() == EcalEndcap) && (! doEndCap_) ) continue;
00155 
00156            int iDCC = TheMapping -> DCCid(detid);
00157            int FEDid = EcalFEDIds.first + iDCC;
00158 
00159            FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
00160 
00161            TCCblockformatter_ -> DigiToRaw(trigprim, rawdata, TheMapping);
00162 
00163      }   // end loop on ecalTrigPrim
00164 
00165    }  // endif doTCC
00166 
00167 
00168    if (doSR_) { 
00169         if (debug_) cout << " Process the SR flags " << endl;
00170 
00171         if (doBarrel_) {
00172 
00173         // iEvent.getByType(ebSrFlags);
00174            iEvent.getByLabel(labelEBSR_, ebSrFlags);
00175                                                                                                                                                 
00176            for (EBSrFlagCollection::const_iterator it = ebSrFlags -> begin();
00177                         it != ebSrFlags -> end(); it++) {
00178                 const EcalSrFlag& srflag = *it;
00179                 int flag = srflag.value();
00180 
00181                 EcalTrigTowerDetId id = srflag.id();
00182                 int Dccid = TheMapping -> DCCid(id);
00183                 int DCC_Channel = TheMapping -> iTT(id);
00184                 int FEDid = EcalFEDIds.first + Dccid;
00185                 // if (Dccid == 10) cout << "Dcc " << Dccid << " DCC_Channel " << DCC_Channel << " flag " << flag << endl;
00186                 if (debug_) cout << "will process SRblockformatter_ for FEDid " << dec << FEDid << endl;
00187                 FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
00188                 if (debug_) Headerblockformatter_ -> print(rawdata);
00189                 SRblockformatter_ -> DigiToRaw(Dccid,DCC_Channel,flag, rawdata);
00190 
00191            }
00192         }  // end DoBarrel
00193 
00194 
00195         if (doEndCap_) {
00196         // iEvent.getByType(eeSrFlags);
00197         iEvent.getByLabel(labelEESR_, eeSrFlags);
00198 
00199            for (EESrFlagCollection::const_iterator it = eeSrFlags -> begin();
00200                         it != eeSrFlags -> end(); it++) {
00201                 const EcalSrFlag& srflag = *it;
00202                 int flag = srflag.value();
00203                 EcalScDetId id = srflag.id();
00204                 pair<int, int> ind = TheMapping -> getDCCandSC(id);
00205                 int Dccid = ind.first;
00206                 int DCC_Channel = ind.second;
00207 
00208                 int FEDid = EcalFEDIds.first + Dccid;
00209                 FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
00210                 SRblockformatter_ -> DigiToRaw(Dccid,DCC_Channel,flag, rawdata);
00211            }
00212         }  // end doEndCap
00213 
00214    }   // endif doSR
00215 
00216 
00217 // ---------  Now the Tower Block part
00218 
00219   Handle<EBDigiCollection> ebDigis;
00220   Handle<EEDigiCollection> eeDigis;
00221 
00222   if (doTower_) {
00223 
00224         if (doBarrel_) {
00225         if (debug_) cout << "Creation of the TowerBlock ... Barrel case " << endl;
00226         iEvent.getByLabel(label_,instanceNameEB_,ebDigis);
00227         for (EBDigiCollection::const_iterator it=ebDigis -> begin();
00228                                 it != ebDigis->end(); it++) {
00229                 const EBDataFrame& dataframe = *it;
00230                 const EBDetId& ebdetid = it -> id();
00231                 int DCCid = TheMapping -> DCCid(ebdetid);
00232                 int FEDid = EcalFEDIds.first + DCCid ;
00233                 FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
00234                 Towerblockformatter_ -> DigiToRaw(dataframe, rawdata, TheMapping);
00235         }
00236 
00237         }
00238 
00239         if (doEndCap_) {
00240         if (debug_) cout << "Creation of the TowerBlock ... EndCap case " << endl;
00241         iEvent.getByLabel(label_,instanceNameEE_,eeDigis);
00242         for (EEDigiCollection::const_iterator it=eeDigis -> begin();
00243                                 it != eeDigis->end(); it++) {
00244                 const EEDataFrame& dataframe = *it;
00245                 const EEDetId& eedetid = it -> id();
00246                 EcalElectronicsId elid = TheMapping -> getElectronicsId(eedetid);
00247                 int DCCid = elid.dccId() ;   
00248                 int FEDid = EcalFEDIds.first + DCCid;
00249                 FEDRawData& rawdata = productRawData.get() -> FEDData(FEDid);
00250                 Towerblockformatter_ -> DigiToRaw(dataframe, rawdata, TheMapping);
00251         }
00252         }
00253 
00254   }  // endif doTower_
00255 
00256 
00257 
00258 // -------- Clean up things ...
00259 
00260   map<int, map<int,int> >* FEDorder = Towerblockformatter_ -> GetFEDorder();
00261 
00262   Headerblockformatter_ -> CleanUp(productRawData.get(), FEDorder);
00263 
00264 
00265 /*
00266    cout << "For FED 633 " << endl;
00267          FEDRawData& rawdata = productRawData -> FEDData(633);
00268          Headerblockformatter_ -> print(rawdata);
00269 */
00270 
00271  // Headerblockformatter_ -> PrintSizes(productRawData.get());
00272 
00273 
00274 
00275  Towerblockformatter_ -> EndEvent(productRawData.get());
00276 
00277  iEvent.put(productRawData);
00278 
00279 
00280  return;
00281 
00282 }


Member Data Documentation

int EcalDigiToRaw::bx_ [private]

Definition at line 87 of file EcalDigiToRaw.h.

Referenced by GetBX(), and produce().

const int EcalDigiToRaw::BXMAX = 2808 [static]

Definition at line 75 of file EcalDigiToRaw.h.

Referenced by produce().

int EcalDigiToRaw::counter_ [private]

Definition at line 83 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), GetCounter(), and produce().

bool EcalDigiToRaw::debug_ [private]

Definition at line 85 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), GetDebug(), and produce().

bool EcalDigiToRaw::doBarrel_ [private]

Definition at line 98 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), GetDoBarrel(), and produce().

bool EcalDigiToRaw::doEndCap_ [private]

Definition at line 99 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), GetDoEndCap(), and produce().

bool EcalDigiToRaw::doSR_ [private]

Definition at line 91 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), GetDoSR(), and produce().

bool EcalDigiToRaw::doTCC_ [private]

Definition at line 90 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), GetDoTCC(), and produce().

bool EcalDigiToRaw::doTower_ [private]

Definition at line 92 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), GetDoTower(), and produce().

BlockFormatter* EcalDigiToRaw::Headerblockformatter_ [private]

Definition at line 109 of file EcalDigiToRaw.h.

Referenced by beginJob(), EcalDigiToRaw(), produce(), and ~EcalDigiToRaw().

std::string EcalDigiToRaw::instanceNameEB_ [private]

Definition at line 104 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), and produce().

std::string EcalDigiToRaw::instanceNameEE_ [private]

Definition at line 105 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), and produce().

std::string EcalDigiToRaw::label_ [private]

Definition at line 103 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), and produce().

edm::InputTag EcalDigiToRaw::labelEBSR_ [private]

Definition at line 95 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), and produce().

edm::InputTag EcalDigiToRaw::labelEESR_ [private]

Definition at line 96 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), and produce().

edm::InputTag EcalDigiToRaw::labelTT_ [private]

Definition at line 94 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), and produce().

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

Definition at line 101 of file EcalDigiToRaw.h.

Referenced by EcalDigiToRaw(), and GetListDCCId().

int EcalDigiToRaw::lv1_ [private]

Definition at line 88 of file EcalDigiToRaw.h.

Referenced by GetLV1(), and produce().

int EcalDigiToRaw::orbit_number_ [private]

Definition at line 84 of file EcalDigiToRaw.h.

Referenced by GetOrbit(), and produce().

int EcalDigiToRaw::runnumber_ [private]

Definition at line 86 of file EcalDigiToRaw.h.

Referenced by GetRunNumber(), and produce().

SRBlockFormatter* EcalDigiToRaw::SRblockformatter_ [private]

Definition at line 110 of file EcalDigiToRaw.h.

Referenced by beginJob(), EcalDigiToRaw(), produce(), and ~EcalDigiToRaw().

TCCBlockFormatter* EcalDigiToRaw::TCCblockformatter_ [private]

Definition at line 108 of file EcalDigiToRaw.h.

Referenced by beginJob(), EcalDigiToRaw(), produce(), and ~EcalDigiToRaw().

TowerBlockFormatter* EcalDigiToRaw::Towerblockformatter_ [private]

Definition at line 107 of file EcalDigiToRaw.h.

Referenced by beginJob(), EcalDigiToRaw(), produce(), and ~EcalDigiToRaw().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:29 2009 for CMSSW by  doxygen 1.5.4