Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:29

0001 /****************************************************************************
0002 *
0003 * This is a part of the TOTEM offline software.
0004 * Authors:
0005 *   Jan Kašpar (jan.kaspar@gmail.com)
0006 *   Nicola Minafra
0007 *   Laurent Forthomme
0008 *
0009 ****************************************************************************/
0010 
0011 #ifndef EventFilter_CTPPSRawToDigi_RawToDigiConverter
0012 #define EventFilter_CTPPSRawToDigi_RawToDigiConverter
0013 
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "DataFormats/Common/interface/DetSetVector.h"
0016 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0017 
0018 #include "EventFilter/CTPPSRawToDigi/interface/VFATFrameCollection.h"
0019 
0020 #include "CondFormats/PPSObjects/interface/TotemDAQMapping.h"
0021 #include "CondFormats/PPSObjects/interface/TotemAnalysisMask.h"
0022 
0023 #include "DataFormats/CTPPSDigi/interface/TotemRPDigi.h"
0024 #include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h"
0025 #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h"
0026 #include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h"
0027 #include "DataFormats/TotemReco/interface/TotemT2Digi.h"
0028 
0029 /// \brief Collection of code to convert TOTEM raw data into digi.
0030 class RawToDigiConverter {
0031 public:
0032   RawToDigiConverter(const edm::ParameterSet &conf);
0033 
0034   /// Creates RP digi.
0035   void run(const VFATFrameCollection &coll,
0036            const TotemDAQMapping &mapping,
0037            const TotemAnalysisMask &mask,
0038            edm::DetSetVector<TotemRPDigi> &digi,
0039            edm::DetSetVector<TotemVFATStatus> &status);
0040 
0041   /// Creates Diamond digi.
0042   void run(const VFATFrameCollection &coll,
0043            const TotemDAQMapping &mapping,
0044            const TotemAnalysisMask &mask,
0045            edm::DetSetVector<CTPPSDiamondDigi> &digi,
0046            edm::DetSetVector<TotemVFATStatus> &status);
0047 
0048   /// Creates Totem Timing digi.
0049   void run(const VFATFrameCollection &coll,
0050            const TotemDAQMapping &mapping,
0051            const TotemAnalysisMask &mask,
0052            edm::DetSetVector<TotemTimingDigi> &digi,
0053            edm::DetSetVector<TotemVFATStatus> &status);
0054 
0055   /// Creates Totem T2 digi
0056   void run(const VFATFrameCollection &coll,
0057            const TotemDAQMapping &mapping,
0058            const TotemAnalysisMask &mask,
0059            edmNew::DetSetVector<TotemT2Digi> &digi,
0060            edm::DetSetVector<TotemVFATStatus> &status);
0061 
0062   /// Print error summaries.
0063   void printSummaries() const;
0064 
0065 private:
0066   struct Record {
0067     const TotemVFATInfo *info;
0068     const VFATFrame *frame;
0069     TotemVFATStatus status;
0070   };
0071 
0072   const unsigned char verbosity;
0073 
0074   const bool printErrorSummary;
0075   const bool printUnknownFrameSummary;
0076 
0077   enum TestFlag { tfNoTest, tfWarn, tfErr };
0078 
0079   /// flags for which tests to run
0080   const unsigned int testFootprint;
0081   const unsigned int testCRC;
0082   const unsigned int testID;
0083   const unsigned int testECMostFrequent;
0084   const unsigned int testBCMostFrequent;
0085 
0086   /// the minimal required number of frames to determine the most frequent counter value
0087   const unsigned int EC_min, BC_min;
0088 
0089   /// the minimal required (relative) occupancy of the most frequent counter value to be accepted
0090   const double EC_fraction, BC_fraction;
0091 
0092   //Test file with two 8-bit hwID fields
0093   const bool olderTotemT2FileTest;
0094 
0095   /// error summaries
0096   std::map<TotemFramePosition, std::map<TotemVFATStatus, unsigned int> > errorSummary;
0097   std::map<TotemFramePosition, unsigned int> unknownSummary;
0098 
0099   /// Common processing for all VFAT based sub-systems.
0100   void runCommon(const VFATFrameCollection &input,
0101                  const TotemDAQMapping &mapping,
0102                  std::map<TotemFramePosition, Record> &records);
0103 };
0104 
0105 #endif