Skip to content

Commit

Permalink
Merge pull request #7 from dtp2-tpg-am/AM_bugFixInAnalyze
Browse files Browse the repository at this point in the history
include dump bool to do validation
  • Loading branch information
folguera authored May 14, 2019
2 parents 9909c2a + 55074cc commit 0e3c8dd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions L1Trigger/DTPhase2Trigger/interface/DTTrigPhase2Prod.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class DTTrigPhase2Prod: public edm::EDProducer{

// Debug Flag
bool debug;
bool dump;
double tanPhiTh;
double dT0_correlate_TP;
double min_dT0_match_segment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
min_dT0_match_segment = cms.untracked.double(12.5),
#debugging
debug = cms.untracked.bool(False),
dump = cms.untracked.bool(False),
#RPC
rpcRecHits = cms.untracked.InputTag("rpcRecHits")
)
15 changes: 14 additions & 1 deletion L1Trigger/DTPhase2Trigger/src/DTTrigPhase2Prod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ DTTrigPhase2Prod::DTTrigPhase2Prod(const ParameterSet& pset){
produces<L1Phase2MuDTPhContainer>();

debug = pset.getUntrackedParameter<bool>("debug");
dump = pset.getUntrackedParameter<bool>("dump");
tanPhiTh = pset.getUntrackedParameter<double>("tanPhiTh");
dT0_correlate_TP = pset.getUntrackedParameter<double>("dT0_correlate_TP");
min_dT0_match_segment = pset.getUntrackedParameter<double>("min_dT0_match_segment");
Expand Down Expand Up @@ -226,7 +227,19 @@ void DTTrigPhase2Prod::produce(Event & iEvent, const EventSetup& iEventSetup){

std::vector<metaPrimitive> metaPrimitives;
mpathanalyzer->run(iEvent, iEventSetup, muonpaths, metaPrimitives); // New grouping implementation


if (dump) {
for (unsigned int i=0; i<metaPrimitives.size(); i++){
cout << iEvent.id().event() << " mp " << i << ": "
<< metaPrimitives.at(i).t0 << " "
<< metaPrimitives.at(i).x << " "
<< metaPrimitives.at(i).tanPhi << " "
<< metaPrimitives.at(i).phi << " "
<< metaPrimitives.at(i).phiB << " "
<< metaPrimitives.at(i).quality << " "
<< endl;
}
}
/*
//filtro por groupos de TDC times en las mismas celdas... corrobarar si sucede... esta implementacion no existe en software pero existe en firmware
// loop over vector of muonpahts produced by grouping
Expand Down
31 changes: 18 additions & 13 deletions L1Trigger/DTPhase2Trigger/src/MuonPathAnalyzerPerSL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,28 @@ MP_QUALITY MuonPathAnalyzerPerSL::getMinimumQuality(void) { return minQuality; }
//--- Métodos privados
//------------------------------------------------------------------

void MuonPathAnalyzerPerSL::analyze(MuonPath *mPath,std::vector<metaPrimitive>& metaPrimitives) {
void MuonPathAnalyzerPerSL::analyze(MuonPath *inMPath,std::vector<metaPrimitive>& metaPrimitives) {
if(debug) std::cout<<"DTp2:analyze \t\t\t\t starts"<<std::endl;

// LOCATE MPATH
int selected_Id=0;
if (mPath->getPrimitive(0)->getTDCTime()!=-1) selected_Id= mPath->getPrimitive(0)->getCameraId();
else if(mPath->getPrimitive(1)->getTDCTime()!=-1) selected_Id= mPath->getPrimitive(1)->getCameraId();
else if(mPath->getPrimitive(2)->getTDCTime()!=-1) selected_Id= mPath->getPrimitive(2)->getCameraId();
else if(mPath->getPrimitive(3)->getTDCTime()!=-1) selected_Id= mPath->getPrimitive(3)->getCameraId();
if (inMPath->getPrimitive(0)->getTDCTime()!=-1) selected_Id= inMPath->getPrimitive(0)->getCameraId();
else if(inMPath->getPrimitive(1)->getTDCTime()!=-1) selected_Id= inMPath->getPrimitive(1)->getCameraId();
else if(inMPath->getPrimitive(2)->getTDCTime()!=-1) selected_Id= inMPath->getPrimitive(2)->getCameraId();
else if(inMPath->getPrimitive(3)->getTDCTime()!=-1) selected_Id= inMPath->getPrimitive(3)->getCameraId();

DTLayerId thisLId(selected_Id);
if(debug) std::cout<<"Building up MuonPathSLId from rawId in the Primitive"<<std::endl;
DTSuperLayerId MuonPathSLId(thisLId.wheel(),thisLId.station(),thisLId.sector(),thisLId.superLayer());
if(debug) std::cout<<"The MuonPathSLId is"<<MuonPathSLId<<std::endl;

if(debug) std::cout<<"DTp2:analyze \t\t\t\t In analyze function checking if mPath->isAnalyzable() "<<mPath->isAnalyzable()<<std::endl;
if(debug) std::cout<<"DTp2:analyze \t\t\t\t In analyze function checking if inMPath->isAnalyzable() "<<inMPath->isAnalyzable()<<std::endl;

if (chosen_sl<4 && thisLId.superLayer()!=chosen_sl) return; // avoid running when mpath not in chosen SL (for 1SL fitting)


// Clonamos el objeto analizado.
MuonPath *mPath = new MuonPath(inMPath);

if (mPath->isAnalyzable()) {
if(debug) std::cout<<"DTp2:analyze \t\t\t\t\t yes it is analyzable "<<mPath->isAnalyzable()<<std::endl;
setCellLayout( mPath->getCellHorizontalLayout() );
Expand All @@ -132,9 +135,6 @@ void MuonPathAnalyzerPerSL::analyze(MuonPath *mPath,std::vector<metaPrimitive>&
if(debug) std::cout<<"DTp2:analyze \t\t\t\t\t no it is NOT analyzable "<<mPath->isAnalyzable()<<std::endl;
}

// Clonamos el objeto analizado.
MuonPath *mpAux = new MuonPath(mPath);

int wi[8],tdc[8];
DTPrimitive Prim0(mPath->getPrimitive(0)); wi[0]=Prim0.getChannelId();tdc[0]=Prim0.getTDCTime();
DTPrimitive Prim1(mPath->getPrimitive(1)); wi[1]=Prim1.getChannelId();tdc[1]=Prim1.getTDCTime();
Expand Down Expand Up @@ -174,10 +174,14 @@ void MuonPathAnalyzerPerSL::analyze(MuonPath *mPath,std::vector<metaPrimitive>&
((mPath->getQuality() == LOWQ or mPath->getQuality()==LOWQGHOST) and latQuality[i].quality==LOWQ))){

if(debug) std::cout<<"DTp2:analyze \t\t\t\t\t laterality #- "<<i<<" inside if"<<std::endl;
mpAux->setBxTimeValue(latQuality[i].bxValue);
mPath->setBxTimeValue(latQuality[i].bxValue);
if(debug) std::cout<<"DTp2:analyze \t\t\t\t\t laterality #- "<<i<<" settingLateralCombination"<<std::endl;
mpAux->setLateralComb(lateralities[i]);
mPath->setLateralComb(lateralities[i]);
if(debug) std::cout<<"DTp2:analyze \t\t\t\t\t laterality #- "<<i<<" done settingLateralCombination"<<std::endl;

// Clonamos el objeto analizado.
MuonPath *mpAux = new MuonPath(mPath);

int idxHitNotValid = latQuality[i].invalidateHitIdx;
if (idxHitNotValid >= 0) {
delete mpAux->getPrimitive(idxHitNotValid);
Expand Down Expand Up @@ -266,6 +270,7 @@ void MuonPathAnalyzerPerSL::analyze(MuonPath *mPath,std::vector<metaPrimitive>&
if(debug) std::cout<<"DTp2:analyze \t\t\t\t\t\t\t\t done pushing back metaprimitive no HIGHQ or HIGHQGHOST"<<std::endl;
}
}
delete mpAux;
}
else{
if(debug) std::cout<<"DTp2:analyze \t\t\t\t\t\t\t\t latQuality[i].valid and (((mPath->getQuality()==HIGHQ or mPath->getQuality()==HIGHQGHOST) and latQuality[i].quality==HIGHQ) or ((mPath->getQuality() == LOWQ or mPath->getQuality()==LOWQGHOST) and latQuality[i].quality==LOWQ)) not passed"<<std::endl;
Expand All @@ -285,7 +290,7 @@ void MuonPathAnalyzerPerSL::analyze(MuonPath *mPath,std::vector<metaPrimitive>&
}));
}
}
delete mpAux;
delete mPath;
if(debug) std::cout<<"DTp2:analyze \t\t\t\t finishes"<<std::endl;
}

Expand Down

0 comments on commit 0e3c8dd

Please sign in to comment.