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 , EBDetIdCollection & gainswitchstaycollection,
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,
00063 kTriggerTowers = 68,
00064 kTowersInPhi = 4,
00065 kTowersInEta = 17,
00066 kCrystals = 1700,
00067 kPns = 10,
00068 kCrystalsInPhi = 20,
00069 kCrystalsInEta = 85,
00070 kCrystalsPerTower = 25,
00071 kCardsPerTower = 5,
00072 kChannelsPerCard = 5
00073 };
00074
00075 enum SMElectronics_t {
00076 kSamplesPerChannel = 10,
00077 kSamplesPerPn = 50,
00078 kChannelsPerTower = 25,
00079 kStripsPerTower = 5,
00080 kChannelsPerStrip = 5,
00081 kPnPerTowerBlock = 5,
00082 kTriggerTowersAndMem = 70
00083 };
00084
00085
00086 unsigned _numExpectedTowers;
00087 unsigned _ExpectedTowers[71];
00088 unsigned _expTowersIndex;
00089
00090
00091 int memRawSample_[kStripsPerTower][kChannelsPerStrip][ kSamplesPerChannel+1];
00092 int data_MEM[500];
00093 bool pnAllocated;
00094 bool pnIsOkInBlock[kPnPerTowerBlock];
00095
00096 };
00097 #endif