Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EcalTBDaqFormatter_H
0002 #define EcalTBDaqFormatter_H
0003 /** \class EcalTBDaqFormatter
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 
0024 class FEDRawData;
0025 class DCCTBDataParser;
0026 class EcalTBDaqFormatter {
0027 public:
0028   EcalTBDaqFormatter();
0029   virtual ~EcalTBDaqFormatter() {
0030     LogDebug("EcalTBRawToDigi") << "@SUB=EcalTBDaqFormatter"
0031                                 << "\n";
0032   };
0033 
0034   void interpretRawData(const FEDRawData& data,
0035                         EBDigiCollection& digicollection,
0036                         EcalPnDiodeDigiCollection& pndigicollection,
0037                         EcalRawDataCollection& DCCheaderCollection,
0038                         EBDetIdCollection& dccsizecollection,
0039                         EcalElectronicsIdCollection& ttidcollection,
0040                         EcalElectronicsIdCollection& blocksizecollection,
0041                         EBDetIdCollection& chidcollection,
0042                         EBDetIdCollection& gaincollection,
0043                         EBDetIdCollection& gainswitchcollection,
0044                         EcalElectronicsIdCollection& memttidcollection,
0045                         EcalElectronicsIdCollection& memblocksizecollection,
0046                         EcalElectronicsIdCollection& memgaincollection,
0047                         EcalElectronicsIdCollection& memchidcollection,
0048                         EcalTrigPrimDigiCollection& tpcollection);
0049 
0050 private:
0051   void DecodeMEM(DCCTBTowerBlock* towerblock,
0052                  EcalPnDiodeDigiCollection& pndigicollection,
0053                  EcalElectronicsIdCollection& memttidcollection,
0054                  EcalElectronicsIdCollection& memblocksizecollection,
0055                  EcalElectronicsIdCollection& memgaincollection,
0056                  EcalElectronicsIdCollection& memchidcollection);
0057 
0058   std::pair<int, int> cellIndex(int tower_id, int strip, int xtal);
0059   int cryIc(int tower_id, int strip, int xtal);
0060   bool leftTower(int tower) const;
0061   bool rightTower(int tower) const;
0062 
0063 private:
0064   DCCTBDataParser* theParser_;
0065 
0066   enum SMGeom_t {
0067     kModules = 4,            // Number of modules per supermodule
0068     kTriggerTowers = 68,     // Number of trigger towers per supermodule
0069     kTowersInPhi = 4,        // Number of trigger towers in phi
0070     kTowersInEta = 17,       // Number of trigger towers in eta
0071     kCrystals = 1700,        // Number of crystals per supermodule
0072     kPns = 10,               // Number of PN laser monitoring diodes per supermodule
0073     kCrystalsInPhi = 20,     // Number of crystals in phi
0074     kCrystalsInEta = 85,     // Number of crystals in eta
0075     kCrystalsPerTower = 25,  // Number of crystals per trigger tower
0076     kCardsPerTower = 5,      // Number of VFE cards per trigger tower
0077     kChannelsPerCard = 5     // Number of channels per VFE card
0078   };
0079 
0080   enum SMElectronics_t {
0081     kSamplesPerChannel = 10,   // Number of sample per channel, per event
0082     kSamplesPerPn = 50,        // Number of sample per PN, per event
0083     kChannelsPerTower = 25,    // Number of channels per trigger tower
0084     kStripsPerTower = 5,       // Number of VFE cards per trigger tower
0085     kChannelsPerStrip = 5,     // Number channels per VFE card
0086     kPnPerTowerBlock = 5,      // Number Pn diodes pertaining to 1 tower block = 1/2 mem box
0087     kTriggerTowersAndMem = 70  // Number of trigger towers block including mems
0088   };
0089 
0090   // index and container for expected towers (according to DCC status)
0091   unsigned _numExpectedTowers;
0092   unsigned _ExpectedTowers[71];
0093   unsigned _expTowersIndex;
0094 
0095   // used for mem boxes unpacking
0096   int memRawSample_[kStripsPerTower][kChannelsPerStrip][kSamplesPerChannel + 1];  // store raw data for one mem
0097   int data_MEM[500];  // collects unpacked data for both mems
0098   bool pnAllocated;
0099   bool pnIsOkInBlock[kPnPerTowerBlock];
0100 };
0101 #endif