Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-25 01:53:26

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   unsigned char verbosity;
0073 
0074   unsigned int printErrorSummary;
0075   unsigned int printUnknownFrameSummary;
0076 
0077   enum TestFlag { tfNoTest, tfWarn, tfErr };
0078 
0079   /// flags for which tests to run
0080   unsigned int testFootprint;
0081   unsigned int testCRC;
0082   unsigned int testID;
0083   unsigned int testECRaw;
0084   unsigned int testECDAQ;
0085   unsigned int testECMostFrequent;
0086   unsigned int testBCMostFrequent;
0087 
0088   /// the minimal required number of frames to determine the most frequent counter value
0089   unsigned int EC_min, BC_min;
0090 
0091   /// the minimal required (relative) occupancy of the most frequent counter value to be accepted
0092   double EC_fraction, BC_fraction;
0093 
0094   /// error summaries
0095   std::map<TotemFramePosition, std::map<TotemVFATStatus, unsigned int> > errorSummary;
0096   std::map<TotemFramePosition, unsigned int> unknownSummary;
0097 
0098   /// Common processing for all VFAT based sub-systems.
0099   void runCommon(const VFATFrameCollection &input,
0100                  const TotemDAQMapping &mapping,
0101                  std::map<TotemFramePosition, Record> &records);
0102 };
0103 
0104 #endif