Skip to content

Commit

Permalink
Merge pull request cms-sw#13 from BrieucF/introduce_rpc
Browse files Browse the repository at this point in the history
Introduce RPC: v0
  • Loading branch information
folguera authored May 23, 2019
2 parents c93ba74 + 52f378a commit 9ad5e42
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 2 deletions.
1 change: 1 addition & 0 deletions L1Trigger/DTPhase2Trigger/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<use name="FWCore/ParameterSet"/>
<use name="FWCore/MessageLogger"/>
<use name="Geometry/DTGeometry"/>
<use name="Geometry/RPCGeometry"/>
<use name="L1Trigger/DTUtilities"/>
<use name="L1Trigger/DTBti"/>
<use name="L1Trigger/DTTraco"/>
Expand Down
6 changes: 6 additions & 0 deletions L1Trigger/DTPhase2Trigger/interface/DTTrigPhase2Prod.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
//RPC TP
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
#include <DataFormats/MuonDetId/interface/RPCDetId.h>
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"


#include <fstream>
Expand Down Expand Up @@ -69,6 +70,7 @@ class DTTrigPhase2Prod: public edm::EDProducer{
void endRun(edm::Run const& iRun, const edm::EventSetup& iEventSetup) override;

edm::ESHandle<DTGeometry> dtGeo;
edm::ESHandle<RPCGeometry> rpcGeo;

std::vector<std::pair<int,MuonPath>> primitives;

Expand Down Expand Up @@ -125,6 +127,10 @@ void endRun(edm::Run const& iRun, const edm::EventSetup& iEventSetup) override;
MPFilter* mpathqualityenhancer;
MPFilter* mpathredundantfilter;
MuonPathAssociator* mpathassociator;

// RPC
bool useRPC;
GlobalPoint getRPCGlobalPosition(RPCDetId rpcId, const RPCRecHit& rpcIt) const;

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
do_correlation = cms.untracked.bool(True),
dT0_correlate_TP = cms.untracked.double(25.),
minx_match_2digis = cms.untracked.double(2.1),
p2_df = cms.untracked.int32(2), #1 for phase-1, 2 for slice-test, 3 for phase-2 carlo-federica
p2_df = cms.untracked.int32(2), #0 for phase-1, 1 for slice-test, 2 for phase-2 carlo-federica
filter_cousins = cms.untracked.bool(True),
apply_txt_ttrig_bc0 = cms.untracked.bool(False),
ttrig_filename = cms.untracked.string('/afs/cern.ch/user/c/carrillo/public/info/wire_rawId_ttrig.txt'),
Expand All @@ -23,5 +23,6 @@
debug = cms.untracked.bool(False),
dump = cms.untracked.bool(False),
#RPC
rpcRecHits = cms.untracked.InputTag("rpcRecHits")
rpcRecHits = cms.untracked.InputTag("rpcRecHits"),
useRPC = cms.untracked.bool(False)
)
61 changes: 61 additions & 0 deletions L1Trigger/DTPhase2Trigger/src/DTTrigPhase2Prod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ DTTrigPhase2Prod::DTTrigPhase2Prod(const ParameterSet& pset){
dtDigisToken = consumes< DTDigiCollection >(pset.getParameter<edm::InputTag>("digiTag"));

rpcRecHitsLabel = consumes<RPCRecHitCollection>(pset.getUntrackedParameter < edm::InputTag > ("rpcRecHits"));
useRPC = pset.getUntrackedParameter<bool>("useRPC");


// Choosing grouping scheme:
Expand Down Expand Up @@ -119,6 +120,9 @@ void DTTrigPhase2Prod::beginRun(edm::Run const& iRun, const edm::EventSetup& iEv

if(debug) std::cout<<"getting DT geometry"<<std::endl;
iEventSetup.get<MuonGeometryRecord>().get(dtGeo);//1103

if(debug) std::cout<<"getting RPC geometry"<<std::endl;
iEventSetup.get<MuonGeometryRecord>().get(rpcGeo);

ESHandle< DTConfigManager > dtConfig ;
iEventSetup.get< DTConfigManagerRcd >().get( dtConfig );
Expand Down Expand Up @@ -327,6 +331,54 @@ void DTTrigPhase2Prod::produce(Event & iEvent, const EventSetup& iEventSetup){
}
}

// Store RPC hits
if(useRPC){
for (RPCRecHitCollection::const_iterator rpcIt = rpcHits->begin(); rpcIt != rpcHits->end(); rpcIt++) {
// Retrieve RPC info and translate it to DT convention if needed
int rpc_bx = rpcIt->BunchX(); // FIXME how to get bx w.r.t. orbit start?
int rpc_time = int(rpcIt->time());// FIXME need to follow DT convention
RPCDetId rpcDetId = (RPCDetId)(*rpcIt).rpcId();
if(debug) std::cout << "Getting RPC info from : " << rpcDetId << std::endl;
int rpc_region = rpcDetId.region();
if(rpc_region != 0 ) continue; // Region = 0 Barrel
int rpc_wheel = rpcDetId.ring(); // In barrel, wheel is accessed via ring() method ([-2,+2])
int rpc_dt_sector = rpcDetId.sector()-1; // DT sector:[0,11] while RPC sector:[1,12]
int rpc_station = rpcDetId.station();

if(debug) std::cout << "Getting RPC global point and translating to DT local coordinates" << std::endl;
GlobalPoint rpc_gp = getRPCGlobalPosition(rpcDetId, *rpcIt);
int rpc_global_phi = rpc_gp.phi();
int rpc_localDT_phi = std::numeric_limits<int>::min();
// FIXME Adaptation of L1Trigger/L1TTwinMux/src/RPCtoDTTranslator.cc radialAngle function, should maybe be updated
if (rpcDetId.sector() == 1) rpc_localDT_phi = int(rpc_global_phi * 1024);
else {
if (rpc_global_phi >= 0) rpc_localDT_phi = int((rpc_localDT_phi - rpc_dt_sector * Geom::pi() / 6.) * 1024);
else rpc_localDT_phi = int((rpc_global_phi + (13 - rpcDetId.sector()) * Geom::pi() / 6.) * 1024);
}
int rpc_phiB = std::numeric_limits<int>::min(); // single hit has no phiB and 0 is legal value for DT phiB
int rpc_quality = -1; // to be decided
int rpc_index = 0;
int rpc_BxCnt = 0;
int rpc_flag = 3; // only single hit for now
if(p2_df == 2){
if(debug)std::cout<<"pushing back phase-2 dataformat carlo-federica dataformat"<<std::endl;
outP2Ph.push_back(L1Phase2MuDTPhDigi(rpc_bx,
rpc_wheel,
rpc_dt_sector,
rpc_station,
0, //this would be the layer in the new dataformat
rpc_localDT_phi,
rpc_phiB,
rpc_quality,
rpc_index,
rpc_time,
-1, // signle hit --> no chi2
rpc_flag
));
}
}
}

if(p2_df==2){
std::unique_ptr<L1Phase2MuDTPhContainer> resultP2Ph (new L1Phase2MuDTPhContainer);
resultP2Ph->setContainer(outP2Ph); iEvent.put(std::move(resultP2Ph));
Expand Down Expand Up @@ -385,4 +437,13 @@ int DTTrigPhase2Prod::rango(metaPrimitive mp) {
return 0;
}

GlobalPoint DTTrigPhase2Prod::getRPCGlobalPosition(RPCDetId rpcId, const RPCRecHit& rpcIt) const{

RPCDetId rpcid = RPCDetId(rpcId);
const LocalPoint& rpc_lp = rpcIt.localPosition();
const GlobalPoint& rpc_gp = rpcGeo->idToDet(rpcid)->surface().toGlobal(rpc_lp);

return rpc_gp;

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("L1DTTrigPhase2Prod")

process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cff")
process.load("Geometry.DTGeometry.dtGeometry_cfi")
process.DTGeometryESModule.applyAlignment = False

process.load("L1Trigger.DTPhase2Trigger.dtTriggerPhase2PrimitiveDigis_cfi")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load("Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff")
#process.GlobalTag.globaltag = "90X_dataRun2_Express_v2"
#process.GlobalTag.globaltag = "80X_dataRun2_2016SeptRepro_v7"
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '')

#Calibrate Digis
process.load("Phase2L1Trigger.CalibratedDigis.CalibratedDigis_cfi")
process.CalibratedDigis.dtDigiTag = "simMuonDTDigis"
#process.CalibratedDigis.flat_calib = 325 #turn to 0 to use the DB , 325 for JM and Jorge benchmark

#DTTriggerPhase2
process.load("L1Trigger.DTPhase2Trigger.dtTriggerPhase2PrimitiveDigis_cfi")
#process.dtTriggerPhase2PrimitiveDigis.trigger_with_sl = 3 #4 means SL 1 and 3
#for the moment the part working in phase2 format is the slice test
#process.dtTriggerPhase2PrimitiveDigis.p2_df = 0 //0 is phase1, 1 is slice test, 2 is phase2(carlo-federica)
#process.dtTriggerPhase2PrimitiveDigis.filter_primos = True
#for debugging
process.dtTriggerPhase2PrimitiveDigis.min_phinhits_match_segment = 4
#process.dtTriggerPhase2PrimitiveDigis.debug = True

#Produce RPC clusters from RPCDigi
process.load("RecoLocalMuon.RPCRecHit.rpcRecHits_cfi")
process.rpcRecHits.rpcDigiLabel = cms.InputTag('simMuonRPCDigis')
# Use RPC
process.load('Configuration.Geometry.GeometryExtended2023D38Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2023D38_cff')
process.dtTriggerPhase2PrimitiveDigis.useRPC = True

process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring(
#'file:/eos/user/c/carrillo/digis_segments_Run2016BSingleMuonRAW-RECO.root'
'file:/eos/cms/store/group/dpg_dt/comm_dt/TriggerSimulation/SamplesReco/SingleMu_FlatPt-2to100/Version_10_5_0/SimRECO_1.root'
)
)
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(100)
)

process.out = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('keep *'),
fileName = cms.untracked.string('DTTriggerPhase2Primitives100_withRPC.root')
)

process.p = cms.Path(process.rpcRecHits*process.CalibratedDigis*process.dtTriggerPhase2PrimitiveDigis)
process.this_is_the_end = cms.EndPath(process.out)






0 comments on commit 9ad5e42

Please sign in to comment.