00001 #ifndef EcalTB07DaqFormatter_H
00002 #define EcalTB07DaqFormatter_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 #include "FWCore/ParameterSet/interface/FileInPath.h"
00026
00027 class FEDRawData;
00028 class DCCDataParser;
00029 class EcalTB07DaqFormatter {
00030
00031 public:
00032
00033 EcalTB07DaqFormatter(std::string tbName, int a[68][5][5], int b[71], int c[201]);
00034 virtual ~EcalTB07DaqFormatter(){LogDebug("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter" << "\n"; };
00035
00036 void interpretRawData( const FEDRawData & data , EBDigiCollection& digicollection , EEDigiCollection& eeDigiCollection,
00037 EcalPnDiodeDigiCollection & pndigicollection,
00038 EcalRawDataCollection& DCCheaderCollection,
00039 EBDetIdCollection & dccsizecollection,
00040 EcalElectronicsIdCollection & ttidcollection , EcalElectronicsIdCollection & blocksizecollection,
00041 EBDetIdCollection & chidcollection , EBDetIdCollection & gaincollection,
00042 EBDetIdCollection & gainswitchcollection , EBDetIdCollection & gainswitchstaycollection,
00043 EcalElectronicsIdCollection & memttidcollection, EcalElectronicsIdCollection & memblocksizecollection,
00044 EcalElectronicsIdCollection & memgaincollection, EcalElectronicsIdCollection & memchidcollection,
00045 EcalTrigPrimDigiCollection &tpcollection);
00046
00047
00048 private:
00049
00050 void DecodeMEM( DCCTBTowerBlock * towerblock, EcalPnDiodeDigiCollection & pndigicollection ,
00051 EcalElectronicsIdCollection & memttidcollection, EcalElectronicsIdCollection & memblocksizecollection,
00052 EcalElectronicsIdCollection & memgaincollection, EcalElectronicsIdCollection & memchidcollection);
00053
00054 std::pair<int,int> cellIndex(int tower_id, int strip, int xtal);
00055 int cryIc(int tower_id, int strip, int xtal);
00056 bool leftTower(int tower) const ;
00057 bool rightTower(int tower) const ;
00058
00059 private:
00060 DCCTBDataParser* theParser_;
00061 int cryIcMap_[68][5][5];
00062 int tbStatusToLocation_[71];
00063 int tbTowerIDToLocation_[201];
00064 std::string tbName_;
00065
00066 int getEE_ix(int tower, int strip, int ch);
00067 int getEE_iy(int tower, int strip, int ch);
00068
00069 enum SMGeom_t {
00070 kModules = 4,
00071 kTriggerTowers = 68,
00072 kTowersInPhi = 4,
00073 kTowersInEta = 17,
00074 kCrystals = 1700,
00075 kPns = 10,
00076 kCrystalsInPhi = 20,
00077 kCrystalsInEta = 85,
00078 kCrystalsPerTower = 25,
00079 kCardsPerTower = 5,
00080 kChannelsPerCard = 5
00081 };
00082
00083 enum SMElectronics_t {
00084 kSamplesPerChannel = 10,
00085 kSamplesPerPn = 50,
00086 kChannelsPerTower = 25,
00087 kStripsPerTower = 5,
00088 kChannelsPerStrip = 5,
00089 kPnPerTowerBlock = 5,
00090 kTriggerTowersAndMem = 70
00091 };
00092
00093
00094 unsigned _numExpectedTowers;
00095 unsigned _ExpectedTowers[71];
00096 unsigned _expTowersIndex;
00097
00098
00099 int memRawSample_[kStripsPerTower][kChannelsPerStrip][ kSamplesPerChannel+1];
00100 int data_MEM[500];
00101 bool pnAllocated;
00102 bool pnIsOkInBlock[kPnPerTowerBlock];
00103
00104 };
00105 #endif