Skip to content

Commit

Permalink
Merge pull request #8 from dtp2-tpg-am/AM_106X_FactorizeFilterAndAsso…
Browse files Browse the repository at this point in the history
…ciator

AM 10_6_X factorize filter and associator
  • Loading branch information
folguera authored May 15, 2019
2 parents 0e3c8dd + af564ca commit b7e2008
Show file tree
Hide file tree
Showing 7 changed files with 884 additions and 660 deletions.
25 changes: 5 additions & 20 deletions L1Trigger/DTPhase2Trigger/interface/DTTrigPhase2Prod.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "L1Trigger/DTPhase2Trigger/interface/InitialGrouping.h"
#include "L1Trigger/DTPhase2Trigger/interface/MuonPathAnalyzer.h"
#include "L1Trigger/DTPhase2Trigger/interface/MuonPathAnalyzerPerSL.h"
#include "L1Trigger/DTPhase2Trigger/interface/MuonPathFilter.h"
#include "L1Trigger/DTPhase2Trigger/interface/MuonPathAssociator.h"

#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h"
#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h"
Expand Down Expand Up @@ -66,24 +68,8 @@ class DTTrigPhase2Prod: public edm::EDProducer{

edm::ESHandle<DTGeometry> dtGeo;

//ttrig
std::string ttrig_filename;
std::map<int,float> ttriginfo;

//z
std::string z_filename;
std::map<int,float> zinfo;

//shift
std::string shift_filename;
std::map<int,float> shiftinfo;

int chosen_sl;

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

int arePrimos(metaPrimitive primera, metaPrimitive segunda);
int rango(metaPrimitive primera);
bool outer(metaPrimitive primera);
bool inner(metaPrimitive primera);
void printmP(metaPrimitive mP);
Expand Down Expand Up @@ -116,14 +102,10 @@ class DTTrigPhase2Prod: public edm::EDProducer{
// Debug Flag
bool debug;
bool dump;
double tanPhiTh;
double dT0_correlate_TP;
double min_dT0_match_segment;
double minx_match_2digis;
int min_phinhits_match_segment;
bool do_correlation;
int p2_df;
bool filter_primos;

// txt ttrig flag
bool txt_ttrig_bc0;
Expand All @@ -137,6 +119,9 @@ class DTTrigPhase2Prod: public edm::EDProducer{
Int_t grcode; // Grouping code
MotherGrouping* grouping_obj;
MuonPathAnalyzer* mpathanalyzer;
MuonPathFilter* mpathfilter;
MuonPathAssociator* mpathassociator;

};


Expand Down
83 changes: 83 additions & 0 deletions L1Trigger/DTPhase2Trigger/interface/MuonPathAssociator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#ifndef Phase2L1Trigger_DTTrigger_MuonPathAssociator_cc
#define Phase2L1Trigger_DTTrigger_MuonPathAssociator_cc

#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
#include "DataFormats/MuonDetId/interface/DTLayerId.h"
#include "DataFormats/MuonDetId/interface/DTWireId.h"
#include "DataFormats/DTDigi/interface/DTDigiCollection.h"
//#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
//#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h"
//#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
//#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h"
//
#include "L1Trigger/DTPhase2Trigger/interface/muonpath.h"
#include "L1Trigger/DTPhase2Trigger/interface/analtypedefs.h"
#include "L1Trigger/DTPhase2Trigger/interface/constants.h"

#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/DTGeometry/interface/DTLayer.h"

#include <iostream>
#include <fstream>

// ===============================================================================
// Previous definitions and declarations
// ===============================================================================

// ===============================================================================
// Class declarations
// ===============================================================================

class MuonPathAssociator {
public:
// Constructors and destructor
MuonPathAssociator(const edm::ParameterSet& pset);
virtual ~MuonPathAssociator();

// Main methods
void initialise(const edm::EventSetup& iEventSetup);
void run(edm::Event& iEvent, const edm::EventSetup& iEventSetup, edm::Handle<DTDigiCollection> digis,
std::vector<metaPrimitive> &inMPaths, std::vector<metaPrimitive> &outMPaths);


void finish();

// Other public methods

// Public attributes
edm::ESHandle<DTGeometry> dtGeo;


private:

// Private methods
void correlateMPaths(edm::Handle<DTDigiCollection> digis, std::vector<metaPrimitive> &inMPaths, std::vector<metaPrimitive> &outMPaths);

// void associate(metaPrimitive MP, std::vector<metaPrimitive> &outMP);

bool hasPosRF(int wh,int sec) { return wh>0 || (wh==0 && sec%4>1); }

// Private attributes
double dT0_correlate_TP;
double minx_match_2digis;
Bool_t debug;

//shift
std::string shift_filename;
std::map<int,float> shiftinfo;

};


#endif
85 changes: 85 additions & 0 deletions L1Trigger/DTPhase2Trigger/interface/MuonPathFilter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#ifndef Phase2L1Trigger_DTTrigger_MuonPathFilter_cc
#define Phase2L1Trigger_DTTrigger_MuonPathFilter_cc

#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
#include "DataFormats/MuonDetId/interface/DTLayerId.h"
#include "DataFormats/MuonDetId/interface/DTWireId.h"
#include "DataFormats/DTDigi/interface/DTDigiCollection.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h"

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

#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambContainer.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambDigi.h"

#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h"
#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h"

#include "L1Trigger/DTSectorCollector/interface/DTSectCollPhSegm.h"
#include "L1Trigger/DTSectorCollector/interface/DTSectCollThSegm.h"

#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/DTGeometry/interface/DTLayer.h"

#include <iostream>
#include <fstream>


// ===============================================================================
// Previous definitions and declarations
// ===============================================================================

// ===============================================================================
// Class declarations
// ===============================================================================

class MuonPathFilter {
public:
// Constructors and destructor
MuonPathFilter(const edm::ParameterSet& pset);
virtual ~MuonPathFilter();

// Main methods
void initialise(const edm::EventSetup& iEventSetup);
void run(edm::Event& iEvent, const edm::EventSetup& iEventSetup, std::vector<metaPrimitive> &inMPath, std::vector<metaPrimitive> &outMPath);

void finish();

// Other public methods

// Public attributes
int areCousins(metaPrimitive mp1, metaPrimitive mp2);
int rango(metaPrimitive mp);
void printmP(metaPrimitive mP);

private:
// Private methods
void filterCousins(std::vector<metaPrimitive> &inMPath, std::vector<metaPrimitive> &outMPath);
void filterTanPhi(std::vector<metaPrimitive> &inMPath, std::vector<metaPrimitive> &outMPath);


// Private attributes
Bool_t debug;
bool filter_cousins;
double tanPhiTh;
};


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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
filter_primos = cms.untracked.bool(True),
filter_cousins = cms.untracked.bool(True),
apply_txt_ttrig_bc0 = cms.untracked.bool(False),
ttrig_filename = cms.untracked.string('data/wire_rawId_ttrig.txt'),
z_filename = cms.untracked.string('data/wire_rawId_z.txt'),
Expand Down
Loading

0 comments on commit b7e2008

Please sign in to comment.