CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/EventFilter/EcalTBRawToDigi/src/EcalTBDaqFormatter.h

Go to the documentation of this file.
00001 #ifndef EcalTBDaqFormatter_H
00002 #define EcalTBDaqFormatter_H
00003 
00013 #include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
00014 #include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
00015 #include <DataFormats/EcalDetId/interface/EcalDetIdCollections.h>
00016 #include "DCCTowerBlock.h"
00017 
00018 #include <vector> 
00019 #include <map>
00020 #include <iostream>
00021 
00022 #include "FWCore/ServiceRegistry/interface/Service.h"
00023 
00024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00025 
00026 
00027 class FEDRawData;
00028 class DCCTBDataParser;
00029 class EcalTBDaqFormatter   {
00030 
00031  public:
00032 
00033   EcalTBDaqFormatter();
00034   virtual ~EcalTBDaqFormatter(){LogDebug("EcalTBRawToDigi") << "@SUB=EcalTBDaqFormatter" << "\n"; };
00035 
00036   void  interpretRawData( const FEDRawData & data , EBDigiCollection& digicollection , EcalPnDiodeDigiCollection & pndigicollection ,
00037                           EcalRawDataCollection& DCCheaderCollection,
00038                           EBDetIdCollection & dccsizecollection,
00039                           EcalElectronicsIdCollection & ttidcollection , EcalElectronicsIdCollection & blocksizecollection,
00040                           EBDetIdCollection & chidcollection , EBDetIdCollection & gaincollection ,
00041                           EBDetIdCollection & gainswitchcollection , 
00042                           EcalElectronicsIdCollection & memttidcollection,  EcalElectronicsIdCollection &  memblocksizecollection,
00043                           EcalElectronicsIdCollection & memgaincollection,  EcalElectronicsIdCollection & memchidcollection,
00044                           EcalTrigPrimDigiCollection &tpcollection);
00045  
00046 
00047  private:
00048   
00049   void  DecodeMEM( DCCTBTowerBlock *  towerblock, EcalPnDiodeDigiCollection & pndigicollection ,
00050                    EcalElectronicsIdCollection & memttidcollection,  EcalElectronicsIdCollection &  memblocksizecollection,
00051                    EcalElectronicsIdCollection & memgaincollection,  EcalElectronicsIdCollection & memchidcollection);
00052   
00053   std::pair<int,int>  cellIndex(int tower_id, int strip, int xtal); 
00054   int            cryIc(int tower_id, int strip, int xtal); 
00055   bool leftTower(int tower) const ;
00056   bool rightTower(int tower) const ;
00057 
00058  private:
00059   DCCTBDataParser* theParser_;
00060 
00061   enum SMGeom_t {
00062      kModules = 4,           // Number of modules per supermodule
00063      kTriggerTowers = 68,    // Number of trigger towers per supermodule
00064      kTowersInPhi = 4,       // Number of trigger towers in phi
00065      kTowersInEta = 17,      // Number of trigger towers in eta
00066      kCrystals = 1700,       // Number of crystals per supermodule
00067      kPns = 10,                  // Number of PN laser monitoring diodes per supermodule
00068      kCrystalsInPhi = 20,    // Number of crystals in phi
00069      kCrystalsInEta = 85,    // Number of crystals in eta
00070      kCrystalsPerTower = 25, // Number of crystals per trigger tower
00071      kCardsPerTower = 5,     // Number of VFE cards per trigger tower
00072      kChannelsPerCard = 5    // Number of channels per VFE card
00073    };
00074 
00075   enum SMElectronics_t {
00076     kSamplesPerChannel = 10,  // Number of sample per channel, per event
00077     kSamplesPerPn          = 50,  // Number of sample per PN, per event
00078     kChannelsPerTower   = 25,  // Number of channels per trigger tower
00079     kStripsPerTower        = 5,   // Number of VFE cards per trigger tower
00080     kChannelsPerStrip     = 5,   // Number channels per VFE card
00081     kPnPerTowerBlock    = 5,    // Number Pn diodes pertaining to 1 tower block = 1/2 mem box
00082     kTriggerTowersAndMem  = 70    // Number of trigger towers block including mems
00083   };
00084 
00085   // index and container for expected towers (according to DCC status)
00086   unsigned _numExpectedTowers;
00087   unsigned _ExpectedTowers[71];
00088   unsigned _expTowersIndex;
00089 
00090   // used for mem boxes unpacking
00091   int    memRawSample_[kStripsPerTower][kChannelsPerStrip][ kSamplesPerChannel+1];       // store raw data for one mem
00092   int    data_MEM[500];                                                                                                                  // collects unpacked data for both mems 
00093   bool pnAllocated;
00094   bool pnIsOkInBlock[kPnPerTowerBlock];
00095 
00096 };
00097 #endif