Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPS full sim specific files only (second part of the splited PR 24420) #24545

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Configuration/Eras/python/Modifier_pps_2016_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

pps_2016 = cms.Modifier()

4 changes: 4 additions & 0 deletions Configuration/Eras/python/Modifier_pps_2017_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

pps_2017 = cms.Modifier()

4 changes: 4 additions & 0 deletions Configuration/Eras/python/Modifier_pps_2018_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

pps_2018 = cms.Modifier()

10 changes: 10 additions & 0 deletions Configuration/Geometry/python/GeometryExtended2016_CTPPS_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import FWCore.ParameterSet.Config as cms

#
# Geometry master configuration
#
# Ideal geometry, needed for simulation
from Geometry.CMSCommonData.cmsExtendedGeometry2016aXML_CTPPS_cfi import *
from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import *
from Geometry.HcalCommonData.hcalParameters_cfi import *
from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import *
11 changes: 11 additions & 0 deletions Configuration/Geometry/python/GeometryExtended2017_CTPPS_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import FWCore.ParameterSet.Config as cms

#
# Geometry master configuration
#
# Ideal geometry, needed for simulation
from Geometry.CMSCommonData.cmsExtendedGeometry2017XML_CTPPS_cfi import *
from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import *
from Geometry.HcalCommonData.hcalParameters_cfi import *
from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import *

11 changes: 11 additions & 0 deletions Configuration/Geometry/python/GeometryExtended2018_CTPPS_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import FWCore.ParameterSet.Config as cms

#
# Geometry master configuration
#
# Ideal geometry, needed for simulation
from Geometry.CMSCommonData.cmsExtendedGeometry2018XML_CTPPS_cfi import *
from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import *
from Geometry.HcalCommonData.hcalParameters_cfi import *
from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import *

11 changes: 9 additions & 2 deletions Configuration/StandardSequences/python/DigiToRaw_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@
from EventFilter.CastorRawToDigi.CastorDigiToRaw_cfi import *
from EventFilter.RawDataCollector.rawDataCollector_cfi import *
from L1Trigger.Configuration.L1TDigiToRaw_cff import *
from EventFilter.CTPPSRawToDigi.ctppsDigiToRaw_cff import *

from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lines about premix_stage1 in this file were removed in #24184. It looks like they were kept here incorrectly in the rebase.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok


#DigiToRaw = cms.Sequence(L1TDigiToRaw*siPixelRawData*SiStripDigiToRaw*ecalPacker*esDigiToRaw*hcalRawData*cscpacker*dtpacker*rpcpacker*rawDataCollector)
DigiToRaw = cms.Sequence(L1TDigiToRaw*siPixelRawData*SiStripDigiToRaw*ecalPacker*esDigiToRaw*hcalRawData*cscpacker*dtpacker*rpcpacker*castorRawData*rawDataCollector)
DigiToRaw = cms.Sequence(L1TDigiToRaw*siPixelRawData*SiStripDigiToRaw*ecalPacker*esDigiToRaw*hcalRawData*cscpacker*dtpacker*rpcpacker*ppsRawData*castorRawData*rawDataCollector)
# no L1 DigiToRaw in first PreMixing step
premix_stage1.toReplaceWith(DigiToRaw, DigiToRaw.copyAndExclude([L1TDigiToRaw]))

ecalPacker.Label = 'simEcalDigis'
ecalPacker.InstanceEB = 'ebDigis'
ecalPacker.InstanceEE = 'eeDigis'
ecalPacker.labelEBSRFlags = "simEcalDigis:ebSrFlags"
ecalPacker.labelEESRFlags = "simEcalDigis:eeSrFlags"
premix_stage1.toModify(hcalRawDatauHTR, premix = True)

from Configuration.Eras.Modifier_run3_common_cff import run3_common
run3_common.toReplaceWith(DigiToRaw, DigiToRaw.copyAndExclude([castorRawData]))
Expand All @@ -52,4 +58,5 @@
phase2_muon.toReplaceWith(DigiToRaw, DigiToRaw.copyAndExclude([rpcpacker]))

from Configuration.Eras.Modifier_fastSim_cff import fastSim
fastSim.toReplaceWith(DigiToRaw, DigiToRaw.copyAndExclude([siPixelRawData,SiStripDigiToRaw,castorRawData]))
fastSim.toReplaceWith(DigiToRaw, DigiToRaw.copyAndExclude([siPixelRawData,SiStripDigiToRaw,castorRawData,ppsRawData]))

10 changes: 8 additions & 2 deletions Configuration/StandardSequences/python/Digi_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#
from SimMuon.Configuration.SimMuon_cff import *
#
# PPS Digis
# returns sequence "ppsDigi"
#
from SimPPS.Configuration.SimPPS_cff import *
#
#
# TrackingParticle Producer is now part of the mixing module, so
# it is no longer run here.
#
Expand All @@ -30,7 +36,7 @@
from GeneratorInterface.Core.generatorSmeared_cfi import *
from SimGeneral.PileupInformation.genPUProtons_cfi import *

doAllDigi = cms.Sequence(generatorSmeared*calDigi+muonDigi)
doAllDigi = cms.Sequence(generatorSmeared*calDigi+muonDigi+ppsDigi)
pdigi = cms.Sequence(generatorSmeared*fixGenInfo*cms.SequencePlaceholder("randomEngineStateProducer")*cms.SequencePlaceholder("mix")*doAllDigi*addPileupInfo*genPUProtons)
pdigi_valid = cms.Sequence(pdigi)
pdigi_nogen=cms.Sequence(generatorSmeared*cms.SequencePlaceholder("randomEngineStateProducer")*cms.SequencePlaceholder("mix")*doAllDigi*addPileupInfo*genPUProtons)
Expand All @@ -48,7 +54,6 @@ def _fastSimDigis(process):
# use an alias to make the mixed track collection available under the usual label
from FastSimulation.Configuration.DigiAliases_cff import loadDigiAliases
loadDigiAliases(process)
# no need for the aliases for premixing stage1
modifyDigi_fastSimDigis = (fastSim & ~premix_stage1).makeProcessModifier(_fastSimDigis)

#phase 2 common mods
Expand All @@ -62,3 +67,4 @@ def _modifyEnableHcalHardcode( theProcess ):
modifyEnableHcalHardcode_ = hcalHardcodeConditions.makeProcessModifier( _modifyEnableHcalHardcode )



3 changes: 2 additions & 1 deletion Configuration/StandardSequences/python/Eras.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def __init__(self):
'trackingLowPU', 'trackingPhase1', 'ctpps_2016', 'trackingPhase2PU140','highBetaStar_2018',
'tracker_apv_vfp30_2016', 'pf_badHcalMitigation', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X',
'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016',
'hcalHardcodeConditions', 'hcalSkipPacker']
'hcalHardcodeConditions', 'hcalSkipPacker',
'pps_2016', 'pps_2017', 'pps_2018']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will there be top-level Eras that include these modifiers?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan is to include them in Run2_2016, Run2_2017 and Run2_2018 respectively

internalUseModChains = ['run2_2017_noTrackingModifier']


Expand Down
8 changes: 8 additions & 0 deletions EventFilter/CTPPSRawToDigi/interface/CTPPSElectronicIndex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef EventFilter_CTPPSRawToDigi_CTPPSElectronicIndex_H
#define EventFilter_CTPPSRawToDigi_CTPPSElectronicIndex_H

namespace ctppspixelobjects {
struct CTPPSElectronicIndex { int link; int roc; int dcol; int pxid; };
}

#endif
16 changes: 13 additions & 3 deletions EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@

#include "EventFilter/CTPPSRawToDigi/interface/RPixErrorChecker.h"

#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelIndices.h"
#include "EventFilter/CTPPSRawToDigi/interface/CTPPSElectronicIndex.h"
#include "FWCore/Utilities/interface/typedefs.h"

#include <cstdint>
#include <vector>
#include <map>
Expand All @@ -61,6 +65,8 @@ class CTPPSPixelDataFormatter {
typedef uint32_t Word32;
typedef uint64_t Word64;

typedef std::map<cms_uint32_t,DetDigis> Digis;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be an unordered_map?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check


CTPPSPixelDataFormatter(std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo> const &mapping);

void setErrorStatus(bool theErrorStatus);
Expand All @@ -69,26 +75,30 @@ class CTPPSPixelDataFormatter {

void interpretRawData( bool& errorsInEvent, int fedId, const FEDRawData & data, Collection & digis, Errors & errors);

int nDigis() const { return m_DigiCounter; }

void formatRawData( unsigned int lvl1_ID, RawData & fedRawData, const Digis & digis, std::map< std::map<const uint32_t,std::map<short unsigned int, short unsigned int>>, std::map<short unsigned int,short unsigned int>> iDdet2fed);

private:


mutable int m_WordCounter;

bool m_IncludeErrors;
RPixErrorChecker m_ErrorCheck;

int m_ADC_shift, m_PXID_shift, m_DCOL_shift, m_ROC_shift, m_LINK_shift;
Word32 m_LINK_mask, m_ROC_mask, m_DCOL_mask, m_PXID_mask, m_ADC_mask;



int checkError(const Word32& data) const;

std::string print(const Word64& word) const;

const std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo> &m_Mapping;

mutable int m_DigiCounter;
int m_allDetDigis;
int m_hasDetDigis;
CTPPSPixelIndices theIndices;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe m_Indices, to use the same convention for the names of the class members

};

#endif
62 changes: 62 additions & 0 deletions EventFilter/CTPPSRawToDigi/interface/CTPPSTotemDataFormatter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/****************************************************************************
*
* This is a part of the TOTEM offline software.
* Authors:
*
****************************************************************************/

#ifndef EventFilter_CTPPSRawToDigi_CTPPSTotemDataFormatter_h
#define EventFilter_CTPPSRawToDigi_CTPPSTotemDataFormatter_h

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/DetSetVector.h"

#include "CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h"

#include "DataFormats/CTPPSDigi/interface/TotemRPDigi.h"
#include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h"
#include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h"

#include "FWCore/Utilities/interface/typedefs.h"
#include "DataFormats/FEDRawData/interface/FEDRawData.h"
#include "DataFormats/FEDRawData/interface/FEDHeader.h"
#include "DataFormats/FEDRawData/interface/FEDTrailer.h"
#include <cstdint>
#include <vector>
#include <map>
#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h"
#include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h"
#include "FWCore/Framework/interface/EventSetup.h"
/// \brief Collection of code to convert TOTEM raw data into digi.

class FEDRawData;
class CTPPSTotemDigiToRaw;

class CTPPSTotemDataFormatter {

private:
typedef uint16_t Word16;
typedef uint32_t Word32;
typedef uint64_t Word64;

mutable int theWordCounter;
mutable int theDigiCounter;

public:

typedef std::map<int, FEDRawData> RawData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider making these maps into unordered_maps

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

typedef std::vector<TotemRPDigi> DetDigis;
typedef std::map<cms_uint32_t,DetDigis> Digis;

CTPPSTotemDataFormatter(std::map<TotemFramePosition, TotemVFATInfo> const &mapping);

int nWords() const { return theWordCounter; }
int nDigis() const { return theDigiCounter; }

void formatRawData(unsigned int lvl1_ID, RawData & fedRawData, const Digis & digis, std::map<std::map<const uint32_t, unsigned int>, std::map<short unsigned int, std::map<short unsigned int, short unsigned int>>> iDdet2fed ) ;

std::string print(const Word64 & word) const;
};

#endif
6 changes: 3 additions & 3 deletions EventFilter/CTPPSRawToDigi/interface/VFATFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ class VFATFrame
/// If binary is true, binary format is used.
void Print(bool binary = false) const;

/// internaly used to check CRC
static word calculateCRC(word crc_in, word dato);

protected:
/** Raw data frame as sent by electronics.
* The container is organized as follows (reversed Figure 8 at page 23 of VFAT2 manual):
Expand Down Expand Up @@ -186,9 +189,6 @@ class VFATFrame
/// Number of clusters.
/// Only available in cluster mode and if the number of clusters exceeds a limit (10).
uint8_t numberOfClusters;

/// internaly used to check CRC
static word calculateCRC(word crc_in, word dato);
};

#endif
Loading