Skip to content

Commit

Permalink
Merge pull request cms-sw#58 from BrieucF/refactor_rpcTranslated
Browse files Browse the repository at this point in the history
RPC only segment and more
  • Loading branch information
camilocarrillo authored Sep 20, 2019
2 parents 64d9d0a + 7d95a21 commit 7187bc6
Show file tree
Hide file tree
Showing 6 changed files with 266 additions and 88 deletions.
5 changes: 3 additions & 2 deletions L1Trigger/DTPhase2Trigger/doc/qualities.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ DT quality code

RPC Flag (tells how RPC was used) #FIXME being implemented, not everything availabel yet
---------------------------------
0: RPC not used
0: segment that could not be mathced to any RPC cluster (or 'useRPC' option is set to false)
1: RPC used to overwrite TP timing info (both t0 and BX)
2: RPC only segment
3: RPC single hit
3: RPC single hit not associated to any DT segment
4: RPC used to confirm the presence of the TP, but not used to recompute any of its quantities
5: RPC single hit associated with a DT segment (only kept if 'storeAllRPCHits' is set to True, which not the default)
60 changes: 54 additions & 6 deletions L1Trigger/DTPhase2Trigger/interface/RPCIntegrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,76 @@
#include <DataFormats/MuonDetId/interface/RPCDetId.h>
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"

//DT geometry
#include <Geometry/Records/interface/MuonGeometryRecord.h>
#include <Geometry/DTGeometry/interface/DTGeometry.h>
#include "Geometry/DTGeometry/interface/DTLayer.h"
#include "DataFormats/MuonDetId/interface/DTWireId.h"
#include "DQM/DTMonitorModule/interface/DTTrigGeomUtils.h"

#include "L1Trigger/DTPhase2Trigger/interface/analtypedefs.h"
//#include "L1Trigger/DTPhase2Trigger/interface/constants.h"

struct rpc_metaprimitive {
RPCDetId rpc_id;
const RPCRecHit* rpc_cluster;
GlobalPoint global_position;
int rpcFlag;
int rpc_bx;
double rpc_t0;
rpc_metaprimitive(RPCDetId rpc_id_construct, const RPCRecHit* rpc_cluster_construct, GlobalPoint global_position_construct, int rpcFlag_construct, int rpc_bx_construct, double rpc_t0_construct) : rpc_id(rpc_id_construct), rpc_cluster(rpc_cluster_construct), global_position(global_position_construct), rpcFlag(rpcFlag_construct), rpc_bx(rpc_bx_construct), rpc_t0(rpc_t0_construct) { }
};

// change to this one if DT bx centered at zero again
//struct rpc_metaprimitive {
// RPCDetId rpc_id;
// const RPCRecHit* rpc_cluster;
// GlobalPoint global_position;
// int rpcFlag;
// rpc_metaprimitive(RPCDetId rpc_id_construct, const RPCRecHit* rpc_cluster_construct, GlobalPoint global_position_construct, int rpcFlag_construct) : rpc_id(rpc_id_construct), rpc_cluster(rpc_cluster_construct), global_position(global_position_construct), rpcFlag(rpcFlag_construct) { }
//};

class RPCIntegrator {
public:
RPCIntegrator(const edm::ParameterSet& pset);
~RPCIntegrator();

void initialise(const edm::EventSetup& iEventSetup);
void initialise(const edm::EventSetup& iEventSetup, double shift_back_fromDT);
void finish();

void prepareMetaPrimitives(edm::Handle<RPCRecHitCollection> rpcRecHits);
void matchWithDTAndUseRPCTime(std::vector<metaPrimitive> & dt_metaprimitives);
void makeRPCOnlySegments();
void storeRPCSingleHits();
void removeRPCHitsUsed();

rpc_metaprimitive* matchDTwithRPC(metaPrimitive* dt_metaprimitive);
L1Phase2MuDTPhDigi createL1Phase2MuDTPhDigi(RPCDetId rpcDetId, int rpc_bx, double rpc_time, double rpc_global_phi, double phiB, int rpc_flag);

double getPhiBending(rpc_metaprimitive* rpc_hit_1, rpc_metaprimitive* rpc_hit_2);
int getPhiInDTTPFormat(double rpc_global_phi, int rpcSector);
GlobalPoint getRPCGlobalPosition(RPCDetId rpcId, const RPCRecHit& rpcIt) const;
void translateRPC(edm::Handle<RPCRecHitCollection> rpcRecHits);
L1Phase2MuDTPhDigi* matchDTwithRPC(metaPrimitive* dt_metaprimitive);
void confirmDT(std::vector<metaPrimitive> & dt_metaprimitives, double shift_back);
double getPhi_DT_MP_conv(double rpc_global_phi, int rpcSector);
bool hasPosRF_rpc(int wh, int sec);

std::vector<L1Phase2MuDTPhDigi> rpcRecHits_translated;
std::vector<rpc_metaprimitive> rpc_metaprimitives;

private:
//RPCRecHitCollection m_rpcRecHits;
Bool_t m_debug;
int m_max_quality_to_overwrite_t0;
int m_bx_window;
double m_phi_window;
bool m_storeAllRPCHits;
edm::ESHandle<RPCGeometry> m_rpcGeo;
int m_dt_phi_granularity = 81920;
edm::ESHandle<DTGeometry> m_dtGeo;
double m_dt_phi_granularity = 65536. / 0.8; // 65536 different values per 0.8 radian
double m_dt_phiB_granularity = 2048. / 1.4; // 2048. different values per 1.4 radian
// Constant geometry values
//R[stat][layer] - radius of rpc station/layer from center of CMS
double R[2][2] = {{410.0, 444.8}, {492.7, 527.3}};
double distance_between_two_rpc_layers = 35; // in cm
double shift_back;
//float m_radius_rb1_layer1 = 410.0, m_radius_rb1_layer2 = 444.8, m_radius_rb2_layer1 = 492.7, m_radius_rb2_layer2 = 527.3;
};
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
#RPC
rpcRecHits = cms.untracked.InputTag("rpcRecHits"),
useRPC = cms.untracked.bool(False),
max_quality_to_overwrite_t0 = cms.untracked.int32(9) # will use RPC to set 't0' for TP with quality < max_quality_to_overwrite_t0
bx_window = cms.untracked.int32(1), # will look for RPC cluster within a bunch crossing window of 'dt.BX +- bx_window'
phi_window = cms.untracked.double(50.), # will look for RPC cluster within a phi window of +- phi_window in arbitrary coordinates (plot the value we cut on in RPCIntergator to fine tune it)
max_quality_to_overwrite_t0 = cms.untracked.int32(9), # will use RPC to set 't0' for TP with quality < 'max_quality_to_overwrite_t0'
storeAllRPCHits = cms.untracked.bool(False)
)

dtTriggerPhase2PrimitiveDigis.HoughGrouping = HoughGrouping
Expand Down
10 changes: 7 additions & 3 deletions L1Trigger/DTPhase2Trigger/src/DTTrigPhase2Prod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,12 @@ void DTTrigPhase2Prod::produce(Event & iEvent, const EventSetup& iEventSetup){
// RPC integration
if(useRPC) {
if (debug) std::cout << "Start integrating RPC" << std::endl;
rpc_integrator->initialise(iEventSetup);
rpc_integrator->translateRPC(rpcRecHits);
rpc_integrator->confirmDT(correlatedMetaPrimitives, shift_back);
rpc_integrator->initialise(iEventSetup, shift_back);
rpc_integrator->prepareMetaPrimitives(rpcRecHits);
rpc_integrator->matchWithDTAndUseRPCTime(correlatedMetaPrimitives);
rpc_integrator->makeRPCOnlySegments();
rpc_integrator->storeRPCSingleHits();
rpc_integrator->removeRPCHitsUsed();
}

/// STORING RESULTs
Expand Down Expand Up @@ -431,6 +434,7 @@ void DTTrigPhase2Prod::endRun(edm::Run const& iRun, const edm::EventSetup& iEven
mpathqualityenhancer->finish();
mpathredundantfilter->finish();
mpathassociator->finish();
rpc_integrator->finish();
};


Expand Down
Loading

0 comments on commit 7187bc6

Please sign in to comment.