CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/EventFilter/EcalTBRawToDigi/src/EcalTB07DaqFormatter.h

Go to the documentation of this file.
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 ,
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,           // Number of modules per supermodule
00071      kTriggerTowers = 68,    // Number of trigger towers per supermodule
00072      kTowersInPhi = 4,       // Number of trigger towers in phi
00073      kTowersInEta = 17,      // Number of trigger towers in eta
00074      kCrystals = 1700,       // Number of crystals per supermodule
00075      kPns = 10,                  // Number of PN laser monitoring diodes per supermodule
00076      kCrystalsInPhi = 20,    // Number of crystals in phi
00077      kCrystalsInEta = 85,    // Number of crystals in eta
00078      kCrystalsPerTower = 25, // Number of crystals per trigger tower
00079      kCardsPerTower = 5,     // Number of VFE cards per trigger tower
00080      kChannelsPerCard = 5    // Number of channels per VFE card
00081    };
00082 
00083   enum SMElectronics_t {
00084     kSamplesPerChannel = 10,  // Number of sample per channel, per event
00085     kSamplesPerPn          = 50,  // Number of sample per PN, per event
00086     kChannelsPerTower   = 25,  // Number of channels per trigger tower
00087     kStripsPerTower        = 5,   // Number of VFE cards per trigger tower
00088     kChannelsPerStrip     = 5,   // Number channels per VFE card
00089     kPnPerTowerBlock    = 5,    // Number Pn diodes pertaining to 1 tower block = 1/2 mem box
00090     kTriggerTowersAndMem  = 70    // Number of trigger towers block including mems
00091   };
00092 
00093   // index and container for expected towers (according to DCC status)
00094   unsigned _numExpectedTowers;
00095   unsigned _ExpectedTowers[71];
00096   unsigned _expTowersIndex;
00097 
00098   // used for mem boxes unpacking
00099   int    memRawSample_[kStripsPerTower][kChannelsPerStrip][ kSamplesPerChannel+1];       // store raw data for one mem
00100   int    data_MEM[500];                                                                                                                  // collects unpacked data for both mems 
00101   bool pnAllocated;
00102   bool pnIsOkInBlock[kPnPerTowerBlock];
00103 
00104 };
00105 #endif