Skip to content

Commit

Permalink
Merge pull request cms-sw#81 from dtp2-tpg-am/AM_11_2_1_newAnalyzer_t…
Browse files Browse the repository at this point in the history
…hetaTP

Am 11 2 1 new analyzer theta tp
  • Loading branch information
jaimeleonh authored Mar 18, 2021
2 parents 4680628 + a5a37c8 commit de16155
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ class MuonPathAnalyticAnalyzer : public MuonPathAnalyzer {
bool debug_;
double chi2Th_;
double tanPhiTh_;
double tanPhiThw2max_;
double tanPhiThw2min_;
double tanPhiThw1max_;
double tanPhiThw1min_;
double tanPhiThw0_;
int cellLayout_[cmsdt::NUM_LAYERS];
bool cmssw_for_global_;
std::string geometry_tag_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
geometry_tag = cms.untracked.string(""),
trigger_with_sl = cms.untracked.int32(4),
tanPhiTh = cms.untracked.double(1.),
tanPhiThw2max = cms.untracked.double(1.3),
tanPhiThw2min = cms.untracked.double(0.5),
tanPhiThw1max = cms.untracked.double(0.9),
tanPhiThw1min = cms.untracked.double(0.2),
tanPhiThw0 = cms.untracked.double(0.5),
chi2Th = cms.untracked.double(0.01), #in cm^2
chi2corTh = cms.untracked.double(0.1), #in cm^2
do_correlation = cms.bool(True),
Expand Down
36 changes: 34 additions & 2 deletions L1Trigger/DTTriggerPhase2/src/MuonPathAnalyticAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ MuonPathAnalyticAnalyzer::MuonPathAnalyticAnalyzer(const ParameterSet &pset, edm
debug_(pset.getUntrackedParameter<bool>("debug")),
chi2Th_(pset.getUntrackedParameter<double>("chi2Th")),
tanPhiTh_(pset.getUntrackedParameter<double>("tanPhiTh")),
tanPhiThw2max_(pset.getUntrackedParameter<double>("tanPhiThw2max")),
tanPhiThw2min_(pset.getUntrackedParameter<double>("tanPhiThw2min")),
tanPhiThw1max_(pset.getUntrackedParameter<double>("tanPhiThw1max")),
tanPhiThw1min_(pset.getUntrackedParameter<double>("tanPhiThw1min")),
tanPhiThw0_(pset.getUntrackedParameter<double>("tanPhiThw0")),
cmssw_for_global_(pset.getUntrackedParameter<bool>("cmssw_for_global")),
geometry_tag_(pset.getUntrackedParameter<std::string>("geometry_tag")){
if (debug_)
Expand Down Expand Up @@ -271,13 +276,15 @@ void MuonPathAnalyticAnalyzer::segment_fitter(DTSuperLayerId MuonPathSLId, int w
// Obtain coordinate values in floating point
double pos_f, slope_f, chi2_f;
DTWireId wireId(MuonPathSLId, 2, 1);

pos_f = double(pos) + int(10 * shiftinfo_[wireId.rawId()] * INCREASED_RES_POS_POW); // position in mm * precision in JM RF
pos_f /= (10. * INCREASED_RES_POS_POW); // position in cm w.r.t center of the chamber
slope_f = - (double(slope) / INCREASED_RES_SLOPE_POW);
chi2_f = double(chi2_mm2_p) / (16. * 64. * 100.);

// Impose the thresholds
if (std::abs(slope_f) > tanPhiTh_) return;
if (MuonPathSLId.superLayer() != 2)
if (std::abs(slope_f) > tanPhiTh_) return;
if (chi2_f > (chi2Th_)) return;

// Compute phi and phib
Expand Down Expand Up @@ -332,7 +339,32 @@ void MuonPathAnalyticAnalyzer::segment_fitter(DTSuperLayerId MuonPathSLId, int w
}

if (MuonPathSLId.superLayer() == 2){

// Impose the thresholds
if(std::abs(MuonPathSLId.wheel())==2){
if (slope_f > tanPhiThw2max_ or slope_f < tanPhiThw2min_) return;
}

if(std::abs(MuonPathSLId.wheel())==1){
if (slope_f > tanPhiThw1max_ or slope_f < tanPhiThw1min_) return;
}

if(MuonPathSLId.wheel()==0){
if (std::abs(slope_f) > tanPhiThw0_) return;
}


DTLayerId SL2_layer2Id(MuonPathSLId,2);
double z_shift=shiftthetainfo_[SL2_layer2Id.rawId()];
double jm_y = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? z_shift-pos_f : z_shift+pos_f;
if(cmssw_for_global_){
LocalPoint wire1_in_layer(dtGeo_->layer(SL2_layer2Id)->specificTopology().wirePosition(1),0,-0.65);
GlobalPoint wire1_in_global=dtGeo_->layer(SL2_layer2Id)->toGlobal(wire1_in_layer);
LocalPoint wire1_in_sl=dtGeo_->superLayer(MuonPathSLId)->toLocal(wire1_in_global);
double x_shift=wire1_in_sl.x();
jm_y=(dtGeo_->superLayer(MuonPathSLId)->toGlobal(LocalPoint(double(pos)/(10*pow(2,INCREASED_RES_POS))+x_shift ,0.,0))).z();
}
phi=jm_y;
phiB=slope_f;
}

metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,48 @@
process.load("L1Trigger.DTTriggerPhase2.dtTriggerPhase2PrimitiveDigis_cfi")
process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring('file:/tmp/carrillo/digis_segments_Run2016BSingleMuonRAW-RECO.root'))

#process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1))
#test tunning
#process.dtTriggerPhase2PrimitiveDigis.tanPhiTh = cms.untracked.double(1.4) #temporary for eta
process.dtTriggerPhase2PrimitiveDigis.global_coords_filename = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/run2_global_coord_perp_x_phi0.txt')#for run2 data
process.dtTriggerPhase2PrimitiveDigis.cmssw_for_global = cms.untracked.bool(True) #forcing cmssw coordinates transformation

#process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10))
#process.dtTriggerPhase2PrimitiveDigis.dump = False
#process.dtTriggerPhase2PrimitiveDigis.debug = False
#process.dtTriggerPhase2PrimitiveDigis.chi2Th = cms.untracked.double(0.16)

#scenario
#data scenario 1
process.dtTriggerPhase2PrimitiveDigis.scenario = 1
process.CalibratedDigis.scenario = 1

process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring("detailedInfo"),
detailedInfo = cms.untracked.PSet(threshold = cms.untracked.string("INFO"),
categories = cms.untracked.vstring("DTTrigPhase2Prod"),
extension = cms.untracked.string(".txt")),
debugModules = cms.untracked.vstring("dtTriggerPhase2PrimitiveDigis"),


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

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


####################################################################




#process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000))
#process.dtTriggerPhase2PrimitiveDigis.dump = False
#process.dtTriggerPhase2PrimitiveDigis.debug = False
#process.dtTriggerPhase2PrimitiveDigis.chi2Th = cms.untracked.double(0.16)

#process.load("FWCore.MessageLogger.MessageLogger_cfi")
#process.MessageLogger = cms.Service("MessageLogger",
# destinations = cms.untracked.vstring("detailedInfo"),
# detailedInfo = cms.untracked.PSet(threshold = cms.untracked.string("INFO"),
# categories = cms.untracked.vstring("DTTrigPhase2Prod"),
# extension = cms.untracked.string(".txt")),
# debugModules = cms.untracked.vstring("dtTriggerPhase2PrimitiveDigis"),
#)
####################### SliceTest specials ##############################

#Chi2 -> Changing a lot lately
process.dtTriggerPhase2PrimitiveDigis.chi2Th = cms.untracked.double(0.16)
#process.dtTriggerPhase2PrimitiveDigis.chi2Th = cms.untracked.double(0.16)

#LSB -> Position 0.025 cm instead of 0.004 cm
#process.dtTriggerPhase2PrimitiveDigis.use_LSB = True
Expand All @@ -60,19 +79,3 @@
#process.dtTriggerPhase2PrimitiveDigis.allow_confirmation = True

#TanPsi stuff
process.dtTriggerPhase2PrimitiveDigis.tanPhiTh = cms.untracked.double(1.4) #temporary for eta


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

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






0 comments on commit de16155

Please sign in to comment.