Skip to content
Open
Show file tree
Hide file tree
Changes from all 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_phase2_rpc_devel_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

phase2_rpc_devel = cms.Modifier()

Original file line number Diff line number Diff line change
Expand Up @@ -3403,6 +3403,53 @@ def condition(self, fragment, stepList, key, hasHarvest):
offset = 0.85,
)

# RPC development WF
class UpgradeWorkflow_rpcDevel(UpgradeWorkflow):
def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs):
super(UpgradeWorkflow_rpcDevel, self).__init__(
steps = [
'DigiTrigger',
'RecoGlobal',
'RecoGlobalFakeHLT',
'HARVESTGlobal',
'HARVESTGlobalFakeHLT',
'ALCAPhase2',
],
PU = [
'DigiTrigger',
'RecoGlobal',
'RecoGlobalFakeHLT',
'HARVESTGlobal',
'HARVESTGlobalFakeHLT',
'ALCAPhase2',
],
**kwargs
)
self.__digi = digi
self.__reco = reco
self.__harvest = harvest

def setup_(self, step, stepName, stepDict, k, properties):
mods = {'--era': stepDict[step][k]['--era'] + ',phase2_rpc_devel'}

if 'Digi' in step:
mods |= self.__digi
elif 'Reco' in step:
mods |= self.__reco
elif 'HARVEST' in step:
mods |= self.__harvest

stepDict[stepName][k] = merge([mods, stepDict[step][k]])

def condition(self, fragment, stepList, key, hasHarvest):
return fragment == "TTbar_14TeV" and 'Run4' in key


upgradeWFs['rpcDevel'] = UpgradeWorkflow_rpcDevel(
suffix = '_rpcDevel',
offset = 0.62,
)

# check for duplicates in offsets or suffixes
offsets = [specialWF.offset for specialType,specialWF in upgradeWFs.items()]
suffixes = [specialWF.suffix for specialType,specialWF in upgradeWFs.items()]
Expand Down
44 changes: 44 additions & 0 deletions DataFormats/RPCDigi/interface/IRPCDigi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef IRPCDigi_IRPCDigi_h
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please follow code rule 4.1: this should be #ifndef DataFormats_RPCDigi_IRPCDigi_h (& similar for all other header files in this PR)

#define IRPCDigi_IRPCDigi_h

/** \class IRPCDigi
*
* Digi for Improved Resisitive Plate Chamber (IRPC)
*
* \author Borislav Pavlov - University of Sofia
*/

#include <cstdint>
#include <iosfwd>

class IRPCDigi {
public:
explicit IRPCDigi(int strip, int bxLR, int bxHR, int sbxLR, int sbxHR, int fineLR, int fineHR);
IRPCDigi();

bool operator==(const IRPCDigi& digi) const;
bool operator<(const IRPCDigi& digi) const;
void print() const;
int strip() const { return strip_; }
int bx() const { return bxLR_; }
int sbx() const { return sbxLR_; }
int bxLR() const { return bxLR_; }
int bxHR() const { return bxHR_; }
int sbxLR() const { return sbxLR_; }
int sbxHR() const { return sbxHR_; }
int fineLR() const { return fineLR_; }
int fineHR() const { return fineHR_; }

private:
uint16_t strip_;
int32_t bxLR_; //BX from low radius FEB
int32_t bxHR_; //BX from high radius FEB
int8_t sbxLR_; //sub-BX from low radius FEB
int8_t sbxHR_; //sub-BX from high radius FEB
int8_t fineLR_; //high resolution time rom low radius FEB
int8_t fineHR_; //high resolution time rom high radius FEB
};

std::ostream& operator<<(std::ostream& o, const IRPCDigi& digi);

#endif
15 changes: 15 additions & 0 deletions DataFormats/RPCDigi/interface/IRPCDigiCollection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef IRPCDigi_IRPCDigiCollection_h
#define IRPCDigi_IRPCDigiCollection_h
/** \class RPCDigiCollection
*
* \author Borislav Pavlov
* \date 14 July 2021
*/

#include <DataFormats/MuonDetId/interface/RPCDetId.h>
#include <DataFormats/RPCDigi/interface/IRPCDigi.h>
#include <DataFormats/MuonData/interface/MuonDigiCollection.h>

typedef MuonDigiCollection<RPCDetId, IRPCDigi> IRPCDigiCollection;

#endif
14 changes: 14 additions & 0 deletions DataFormats/RPCDigi/interface/IRPCDigiTime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "DataFormats/RPCDigi/interface/IRPCDigi.h"

class IRPCDigiTime {
public:
IRPCDigiTime(const IRPCDigi& adigi);
float time();
float coordinateY();
float timeLR();
float timeHR();

private:
IRPCDigi theDigi;
float TDC2Time(int BX, int SBX, int FT);
};
34 changes: 34 additions & 0 deletions DataFormats/RPCDigi/interface/RPCDigiPhase2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef RPCDigi_RPCDigiPhase2_h
#define RPCDigi_RPCDigiPhase2_h

/** \class RPCDigiPhase2
*
* Digi for Resisitive Plate Chamber, after Phase2 upgrade
*
* \author Borislav Pavlov - University of Sofia
*/

#include <cstdint>
#include <iosfwd>

class RPCDigiPhase2 {
public:
explicit RPCDigiPhase2(int strip, int bx, int sbx);
RPCDigiPhase2();

bool operator==(const RPCDigiPhase2& digi) const;
bool operator<(const RPCDigiPhase2& digi) const;
void print() const;
int strip() const { return strip_; }
int bx() const { return bx_; }
int sbx() const { return sbx_; }

private:
uint16_t strip_;
int32_t bx_; // for BX
int8_t sbx_; // for sub-BX
};

std::ostream& operator<<(std::ostream& o, const RPCDigiPhase2& digi);

#endif
15 changes: 15 additions & 0 deletions DataFormats/RPCDigi/interface/RPCDigiPhase2Collection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef RPCDigi_RPCDigiPhase2Collection_h
#define RPCDigi_RPCDigiPhase2Collection_h
/** \class RPCDigiCollection
*
* \author Borislav Pavlov
* \date 14 June 2024
*/

#include <DataFormats/MuonDetId/interface/RPCDetId.h>
#include <DataFormats/RPCDigi/interface/RPCDigiPhase2.h>
#include <DataFormats/MuonData/interface/MuonDigiCollection.h>

typedef MuonDigiCollection<RPCDetId, RPCDigiPhase2> RPCDigiPhase2Collection;

#endif
10 changes: 10 additions & 0 deletions DataFormats/RPCDigi/interface/RPCDigiPhase2Time.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "DataFormats/RPCDigi/interface/RPCDigiPhase2.h"

class RPCDigiPhase2Time {
public:
RPCDigiPhase2Time(const RPCDigiPhase2& adigi);
float time();

private:
RPCDigiPhase2 theDigi;
};
33 changes: 33 additions & 0 deletions DataFormats/RPCDigi/src/IRPCDigi.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/** \file
*
*
* \author Borislav Pavlov - University of Sofia
*
*/

#include "DataFormats/RPCDigi/interface/IRPCDigi.h"
#include <iostream>

IRPCDigi::IRPCDigi(int strip, int bxLR, int bxHR, int sbxLR, int sbxHR, int fineLR, int fineHR)
: strip_(strip), bxLR_(bxLR), bxHR_(bxHR), sbxLR_(sbxLR), sbxHR_(sbxHR), fineLR_(fineLR), fineHR_(fineHR) {}

IRPCDigi::IRPCDigi() : strip_(0), bxLR_(0), sbxLR_(0) {}

// Comparison
bool IRPCDigi::operator==(const IRPCDigi& digi) const {
if (strip_ != digi.strip() || bxLR_ != digi.bx())
return false;
return true;
Comment on lines +18 to +20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

simplify:

return strip_ == digi.strip() && bxLR_ = digi.bx();

}

///Precedence operator
bool IRPCDigi::operator<(const IRPCDigi& digi) const {
if (digi.bx() == this->bx())
return digi.strip() < this->strip();
else
return digi.bx() < this->bx();
}

std::ostream& operator<<(std::ostream& o, const IRPCDigi& digi) { return o << " " << digi.strip() << " " << digi.bx(); }

void IRPCDigi::print() const { std::cout << "Strip " << strip() << " bx " << bx() << std::endl; }
16 changes: 16 additions & 0 deletions DataFormats/RPCDigi/src/IRPCDigiTime.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "DataFormats/RPCDigi/interface/IRPCDigiTime.h"

IRPCDigiTime::IRPCDigiTime(const IRPCDigi& adigi) : theDigi(adigi) {}

float IRPCDigiTime::time() { return (timeLR() + timeHR()) / 2.; }

float IRPCDigiTime::coordinateY() {
const double signal_speed = 0.66 * 299792458e-7; //signal propagation speed [cm/ns]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in principle, physical constants like speed of light should be taken from a central source, but I'm not sure if e.g. CLHEP usage is recommended in DataFormats

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CLHEP dependence is allowed in DataFormats (we even have DataFormats/CLHEP).

return signal_speed * (timeLR() - timeHR()) / 2.;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

return signal_speed * time(); to avoid duplication

}

float IRPCDigiTime::timeLR() { return TDC2Time(theDigi.bxLR(), theDigi.sbxLR(), theDigi.fineLR()); }

float IRPCDigiTime::timeHR() { return TDC2Time(theDigi.bxHR(), theDigi.sbxHR(), theDigi.fineHR()); }

float IRPCDigiTime::TDC2Time(int BX, int SBX, int FT) { return 25. * BX + 2.5 * SBX + 0.2 * FT; }
34 changes: 34 additions & 0 deletions DataFormats/RPCDigi/src/RPCDigiPhase2.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/** \file
*
*
* \author Borislav Pavlov - University of Sofia
*
*/

#include "DataFormats/RPCDigi/interface/RPCDigiPhase2.h"
#include <iostream>

RPCDigiPhase2::RPCDigiPhase2(int strip, int bx, int sbx) : strip_(strip), bx_(bx), sbx_(sbx) {}

RPCDigiPhase2::RPCDigiPhase2() : strip_(0), bx_(0), sbx_(0) {}

// Comparison
bool RPCDigiPhase2::operator==(const RPCDigiPhase2& digi) const {
if (strip_ != digi.strip() || bx_ != digi.bx())
return false;
return true;
Comment on lines +17 to +19
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

simplify as above

}

///Precedence operator
bool RPCDigiPhase2::operator<(const RPCDigiPhase2& digi) const {
if (digi.bx() == this->bx())
return digi.strip() < this->strip();
else
return digi.bx() < this->bx();
}

std::ostream& operator<<(std::ostream& o, const RPCDigiPhase2& digi) {
return o << " " << digi.strip() << " " << digi.bx();
}

void RPCDigiPhase2::print() const { std::cout << "Strip " << strip() << " bx " << bx() << std::endl; }
7 changes: 7 additions & 0 deletions DataFormats/RPCDigi/src/RPCDigiPhase2Time.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "DataFormats/RPCDigi/interface/RPCDigiPhase2Time.h"

RPCDigiPhase2Time::RPCDigiPhase2Time(const RPCDigiPhase2& adigi) : theDigi(adigi) {}

float RPCDigiPhase2Time::time() {
return 25. * theDigi.bx() + 1.5625 * theDigi.sbx(); // 25./16. = 1.5625 ns
}
4 changes: 4 additions & 0 deletions DataFormats/RPCDigi/src/classes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include <DataFormats/RPCDigi/interface/RPCDigi.h>
#include <DataFormats/RPCDigi/interface/RPCDigiCollection.h>
#include <DataFormats/RPCDigi/interface/RPCDigiPhase2.h>
#include <DataFormats/RPCDigi/interface/RPCDigiPhase2Collection.h>
#include <DataFormats/RPCDigi/interface/IRPCDigi.h>
#include <DataFormats/RPCDigi/interface/IRPCDigiCollection.h>
#include "DataFormats/RPCDigi/interface/RPCRawDataCounts.h"
#include "DataFormats/RPCDigi/interface/RPCRawSynchro.h"
#include "DataFormats/RPCDigi/interface/RPCDigiL1Link.h"
Expand Down
18 changes: 18 additions & 0 deletions DataFormats/RPCDigi/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@
<class name="MuonDigiCollection<RPCDetId,RPCDigi>"/>
<class name="edm::Wrapper<MuonDigiCollection<RPCDetId,RPCDigi>>" splitLevel="0"/>

<class name="RPCDigiPhase2" ClassVersion="3">
<version ClassVersion="3" checksum="1584553419"/>
</class>
<class name="std::vector<RPCDigiPhase2>"/>
<class name="std::map<RPCDetId,std::vector<RPCDigiPhase2> >"/>
<class name="std::pair<RPCDetId,std::vector<RPCDigiPhase2> >"/>
<class name="MuonDigiCollection<RPCDetId,RPCDigiPhase2>"/>
<class name="edm::Wrapper<MuonDigiCollection<RPCDetId,RPCDigiPhase2>>" splitLevel="0"/>

<class name="IRPCDigi" ClassVersion="3">
<version ClassVersion="3" checksum="4103044833"/>
</class>
<class name="std::vector<IRPCDigi>"/>
<class name="std::map<RPCDetId,std::vector<IRPCDigi> >"/>
<class name="std::pair<RPCDetId,std::vector<IRPCDigi> >"/>
<class name="MuonDigiCollection<RPCDetId,IRPCDigi>"/>
<class name="edm::Wrapper<MuonDigiCollection<RPCDetId,IRPCDigi>>" splitLevel="0"/>

<class name="edm::Wrapper<std::map <std::pair<int,int>, int> >"/>
<class name="RPCRawDataCounts" ClassVersion="10">
<version ClassVersion="10" checksum="977138550"/>
Expand Down
8 changes: 8 additions & 0 deletions IOMC/RandomEngine/python/IOMC_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
initialSeed = cms.untracked.uint32(1234567),
engineName = FullSimEngine
),
simMuonIRPCDigis = cms.PSet(
initialSeed = cms.untracked.uint32(1234567),
engineName = FullSimEngine
),
simMuonRPCDigisPhase2 = cms.PSet(
initialSeed = cms.untracked.uint32(1234567),
engineName = FullSimEngine
),
#
# HI generation & simulation is a special processing/chain,
# integrated since 330 cycle
Expand Down
3 changes: 3 additions & 0 deletions SimMuon/Configuration/python/SimMuon_EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
phase2_muon.toModify( SimMuonRECO, outputCommands = SimMuonRECO.outputCommands + ['keep *DigiSimLinkedmDetSetVector_simMuonME0Digis_*_*'] )
phase2_muon.toModify( SimMuonPREMIX, outputCommands = SimMuonPREMIX.outputCommands + ['keep *_mix_g4SimHitsMuonME0Hits_*'] )

from Configuration.Eras.Modifier_phase2_rpc_devel_cff import phase2_rpc_devel
phase2_rpc_devel.toModify( SimMuonFEVTDEBUG, outputCommands = SimMuonFEVTDEBUG.outputCommands + ['keep *_simMuonRPCDigisPhase2_*_*',
'keep *_simMuonIRPCDigis_*_*'] )

# FastSim uses different naming convention
from Configuration.Eras.Modifier_fastSim_cff import fastSim
Expand Down
21 changes: 18 additions & 3 deletions SimMuon/Configuration/python/SimMuon_cff.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import FWCore.ParameterSet.Config as cms

# Muon Digitization (CSC, DT, RPC electronics responce)

# CSC digitizer
#
from SimMuon.CSCDigitizer.muonCSCDigis_cfi import *
from CalibMuon.CSCCalibration.CSCChannelMapper_cfi import *
from CalibMuon.CSCCalibration.CSCIndexer_cfi import *

# DT digitizer
#
from SimMuon.DTDigitizer.muondtdigi_cfi import *

# RPC digitizer
#
from SimMuon.RPCDigitizer.muonrpcdigi_cfi import *
#
# If your branch still uses the legacy filename muonrpcdigi_cfi.py,
# change only this import line back to that filename.
from SimMuon.RPCDigitizer.muonRPCDigis_cfi import *

muonDigiTask = cms.Task(simMuonCSCDigis, simMuonDTDigis, simMuonRPCDigis)
muonDigi = cms.Sequence(muonDigiTask)

Expand All @@ -27,6 +33,14 @@
# while GE0 is in development, just turn off ME0 tasks
_phase2_ge0 = _phase2_muonDigiTask.copyAndExclude([muonME0DigiTask])

# phase2_rpc_devel:
# keep legacy simMuonRPCDigis for side-by-side validation
# and add the new Phase-2 RPC + iRPC digis
_phase2_rpc_devel = _phase2_muonDigiTask.copyAndExclude([muonME0DigiTask])
_phase2_rpc_devel.add(simMuonRPCDigisPhase2)
_phase2_rpc_devel.add(simMuonIRPCDigis)


from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017
run2_GEM_2017.toReplaceWith( muonDigiTask, _run3_muonDigiTask )
from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
Expand All @@ -35,4 +49,5 @@
phase2_muon.toReplaceWith( muonDigiTask, _phase2_muonDigiTask )
from Configuration.Eras.Modifier_phase2_GE0_cff import phase2_GE0
phase2_GE0.toReplaceWith( muonDigiTask, _phase2_ge0 )

from Configuration.Eras.Modifier_phase2_rpc_devel_cff import phase2_rpc_devel
phase2_rpc_devel.toReplaceWith(muonDigiTask, _phase2_rpc_devel)
Loading