Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:57

0001 #ifndef EcalTB07DaqFormatter_H
0002 #define EcalTB07DaqFormatter_H
0003 /** \class EcalTB07DaqFormatter
0004  *
0005  *  \author N. Marinelli  IASA-Athens
0006  *  \author G. Della Ricca
0007  *  \author G. Franzoni
0008  *  \author A. Ghezzi
0009  *
0010  */
0011 #include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
0012 #include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
0013 #include <DataFormats/EcalDetId/interface/EcalDetIdCollections.h>
0014 #include "DCCTowerBlock.h"
0015 
0016 #include <vector>
0017 #include <map>
0018 #include <iostream>
0019 
0020 #include "FWCore/ServiceRegistry/interface/Service.h"
0021 
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "FWCore/ParameterSet/interface/FileInPath.h"
0024 
0025 class FEDRawData;
0026 class DCCDataParser;
0027 class EcalTB07DaqFormatter {
0028 public:
0029   EcalTB07DaqFormatter(std::string tbName, int a[68][5][5], int b[71], int c[201]);
0030   virtual ~EcalTB07DaqFormatter() {
0031     LogDebug("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter"
0032                                   << "\n";
0033   };
0034 
0035   void interpretRawData(const FEDRawData& data,
0036                         EBDigiCollection& digicollection,
0037                         EEDigiCollection& eeDigiCollection,
0038                         EcalPnDiodeDigiCollection& pndigicollection,
0039                         EcalRawDataCollection& DCCheaderCollection,
0040                         EBDetIdCollection& dccsizecollection,
0041                         EcalElectronicsIdCollection& ttidcollection,
0042                         EcalElectronicsIdCollection& blocksizecollection,
0043                         EBDetIdCollection& chidcollection,
0044                         EBDetIdCollection& gaincollection,
0045                         EBDetIdCollection& gainswitchcollection,
0046                         EcalElectronicsIdCollection& memttidcollection,
0047                         EcalElectronicsIdCollection& memblocksizecollection,
0048                         EcalElectronicsIdCollection& memgaincollection,
0049                         EcalElectronicsIdCollection& memchidcollection,
0050                         EcalTrigPrimDigiCollection& tpcollection);
0051 
0052 private:
0053   void DecodeMEM(DCCTBTowerBlock* towerblock,
0054                  EcalPnDiodeDigiCollection& pndigicollection,
0055                  EcalElectronicsIdCollection& memttidcollection,
0056                  EcalElectronicsIdCollection& memblocksizecollection,
0057                  EcalElectronicsIdCollection& memgaincollection,
0058                  EcalElectronicsIdCollection& memchidcollection);
0059 
0060   std::pair<int, int> cellIndex(int tower_id, int strip, int xtal);
0061   int cryIc(int tower_id, int strip, int xtal);
0062   bool leftTower(int tower) const;
0063   bool rightTower(int tower) const;
0064 
0065 private:
0066   DCCTBDataParser* theParser_;
0067   int cryIcMap_[68][5][5];
0068   int tbStatusToLocation_[71];
0069   int tbTowerIDToLocation_[201];
0070   std::string tbName_;
0071 
0072   int getEE_ix(int tower, int strip, int ch);
0073   int getEE_iy(int tower, int strip, int ch);
0074 
0075   enum SMGeom_t {
0076     kModules = 4,            // Number of modules per supermodule
0077     kTriggerTowers = 68,     // Number of trigger towers per supermodule
0078     kTowersInPhi = 4,        // Number of trigger towers in phi
0079     kTowersInEta = 17,       // Number of trigger towers in eta
0080     kCrystals = 1700,        // Number of crystals per supermodule
0081     kPns = 10,               // Number of PN laser monitoring diodes per supermodule
0082     kCrystalsInPhi = 20,     // Number of crystals in phi
0083     kCrystalsInEta = 85,     // Number of crystals in eta
0084     kCrystalsPerTower = 25,  // Number of crystals per trigger tower
0085     kCardsPerTower = 5,      // Number of VFE cards per trigger tower
0086     kChannelsPerCard = 5     // Number of channels per VFE card
0087   };
0088 
0089   enum SMElectronics_t {
0090     kSamplesPerChannel = 10,   // Number of sample per channel, per event
0091     kSamplesPerPn = 50,        // Number of sample per PN, per event
0092     kChannelsPerTower = 25,    // Number of channels per trigger tower
0093     kStripsPerTower = 5,       // Number of VFE cards per trigger tower
0094     kChannelsPerStrip = 5,     // Number channels per VFE card
0095     kPnPerTowerBlock = 5,      // Number Pn diodes pertaining to 1 tower block = 1/2 mem box
0096     kTriggerTowersAndMem = 70  // Number of trigger towers block including mems
0097   };
0098 
0099   // index and container for expected towers (according to DCC status)
0100   unsigned _numExpectedTowers;
0101   unsigned _ExpectedTowers[71];
0102   unsigned _expTowersIndex;
0103 
0104   // used for mem boxes unpacking
0105   int memRawSample_[kStripsPerTower][kChannelsPerStrip][kSamplesPerChannel + 1];  // store raw data for one mem
0106   int data_MEM[500];  // collects unpacked data for both mems
0107   bool pnAllocated;
0108   bool pnIsOkInBlock[kPnPerTowerBlock];
0109 };
0110 #endif