Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .gitignore
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this file needs to be re-inserted.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is only needed for my branch and I don't think it should be part of the framework right?

This file was deleted.

5 changes: 5 additions & 0 deletions Configuration/ProcessModifiers/python/kf_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import FWCore.ParameterSet.Config as cms

# This modifier is for injecting KF-based iterations in TICL.

kf = cms.Modifier()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest changing the name of the Modifier to make it more explicit, something along the lines of:

Suggested change
kf = cms.Modifier()
hgcal_ticl_kf = cms.Modifier()

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember when you open the PR to include a line with a recipe to test the Modifier for the reviewers.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sounds good. But separate from the code right? So it's gonna be in the comment section along the lines of "Test modifier on xxxxx.x" right?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly

Empty file.
27 changes: 27 additions & 0 deletions DataFormats/HGCTrackingRecHit/interface/HGCTrackingRecHit.h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question will come on "Do you really need a new hit or you can re-use some that is already in DafaFormats/TrackingRecHit?". Be prepared to reply to this.

Moreover, there will be the question of why it needs another folder and it cannot just be under 'DataFormats/HGCRecHit/'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the reason why we can't use the TrackingRecHit directly is that it contains several pure virtual functions meaning that it can only be used as part of a derived class. I think the same goes for the rest of the objects found in DataFormats/TrackingRecHit. What I could try is to use maybe TrackerRecHit objects in https://github.com/cms-sw/cmssw/tree/master/DataFormats/TrackerRecHit2D for example. That I didn't try.

As for the folder: Sure I think I can move it to the HGCRecHit folder

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But come to think of it. The HGCRecHit is based on a different type of RecHit so maybe it does make sense to separate the two?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree with you.
Let's keep it as it is and if they ask in the review to move it, I would say either we move it in 'DataFormats/TrackingRecHit' or in 'DataFormats/TrackerRecHit2D'. Maybe better the first one because I looked into the classes of the 2D and I don't think there is one that we can simple use for our scope.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef RecoHGCal_HGCTracking_HGCTrackingRecHit_h
#define RecoHGCal_HGCTracking_HGCTrackingRecHit_h

/// Wrapper for TrackingRecHits for PatternRecognitionByKF

#include <cassert>
#include "DataFormats/TrackingRecHit/interface/RecHit2DLocalPos.h"

class HGCTrackingRecHit : public RecHit2DLocalPos {
public:
HGCTrackingRecHit() {}
HGCTrackingRecHit(DetId id, const LocalPoint &pos, const LocalError &err, const float energy):
RecHit2DLocalPos(id),
pos_(pos), err_(err), energy_(energy) {}

virtual HGCTrackingRecHit * clone() const override { return new HGCTrackingRecHit(*this); }
virtual LocalPoint localPosition() const override { return pos_; }
virtual LocalError localPositionError() const override { return err_; }
float energy() const { return energy_; }

protected:
LocalPoint pos_;
LocalError err_;
float energy_;
};

#endif
Empty file.
Empty file.
43 changes: 43 additions & 0 deletions DataFormats/HGCalReco/interface/KFHit.h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decide:

  • what to keep in the rechit object
  • in case you want to keep it for debugging purposes make another branch and clean up this one

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Author: Mark Matthewman - [email protected]
// Date: 04/2023

// Note!!!!
// KFHit is a temporary class provided for easier handling of the PatternRecognitionByKF.
// Once the result format for the Algo has been decided, then the KFHit is obsolete and needs to be deleated.

#ifndef DataFormats_HGCalReco_KFHit_h
#define DataFormats_HGCalReco_KFHit_h

#include <array>
#include <vector>
#include "DataFormats/Provenance/interface/ProductID.h"
#include "DataFormats/Math/interface/Vector3D.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
#include <Eigen/Core>

struct KFHit
{
explicit KFHit(TrajectoryStateOnSurface tsos, uint32_t id):
center(tsos.globalPosition()),
localError(tsos.localError().matrix()),
cartesianError(tsos.cartesianError().matrix()),
curvilinearError(tsos.curvilinearError().matrix()),
xx(tsos.localError().positionError().xx()),
xy(tsos.localError().positionError().xy()),
yy(tsos.localError().positionError().yy()),
charge(tsos.charge()),
detid(id)
{}
KFHit(){}

GlobalPoint center;
AlgebraicSymMatrix55 localError;
AlgebraicSymMatrix66 cartesianError;
AlgebraicSymMatrix55 curvilinearError;
float xx;
float xy;
float yy;
int charge;
uint32_t detid;
};
#endif
1 change: 1 addition & 0 deletions DataFormats/HGCalReco/src/classes.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <vector>
#include <array>
#include "DataFormats/HGCalReco/interface/Trackster.h"
#include "DataFormats/HGCalReco/interface/KFHit.h"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up if needed.

#include "DataFormats/HGCalReco/interface/TICLLayerTile.h"
#include "DataFormats/HGCalReco/interface/TICLSeedingRegion.h"
#include "DataFormats/HGCalReco/interface/TICLCandidate.h"
Expand Down
6 changes: 6 additions & 0 deletions DataFormats/HGCalReco/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@
<class name="std::vector<TICLCandidate>" />
<class name="edm::Wrapper<TICLCandidate>" />
<class name="edm::Wrapper<std::vector<TICLCandidate> >" />
<class name="KFHit"/>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up if needed.

<class name="std::vector<KFHit>"/>
<class name="edm::Wrapper<std::vector<KFHit>>"/>
</lcgdict>



35 changes: 35 additions & 0 deletions Geometry/CommonTopologies/interface/HGCDiskGeomDet.h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in this case, the question will come on "Do you really need this class or you can re-use some that is already in there?". Be prepared to reply to this.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef RecoHGCal_HGCTracking_HGCDiskGeomDet_h
#define RecoHGCal_HGCTracking_HGCDiskGeomDet_h

// (mmatthew) Wrapper class for GeomDet corresponding to one layer of HGCal. Used by PatternRecognitionByKF.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// (mmatthew) Wrapper class for GeomDet corresponding to one layer of HGCal. Used by PatternRecognitionByKF.
// Wrapper class for GeomDet corresponding to one layer of HGCal. Used by PatternRecognitionByKF.


#include "Geometry/CommonDetUnit/interface/GeomDet.h"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important, but more correct:

Suggested change
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "Geometry/CommonTopologies/interface/GeomDet.h"

#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h"
Comment on lines +7 to +8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to include these two?

#include "FWCore/Utilities/interface/Exception.h"

class HGCDiskGeomDet : public GeomDet {
public:
HGCDiskGeomDet(int subdet, int zside, int layer, float z, float rmin, float rmax, float radlen, float xi) ;

int subdet() const { return subdet_; }
int zside() const { return zside_; }
int layer() const { return layer_; }
float rmin() const { return rmin_; }
float rmax() const { return rmax_; }
bool isSilicon() const {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can add as a comment the file where this enum is taken.

if(subdet_ == 8 || subdet_ == 9){
return true;
}
else if (subdet_ == 10){
return false;
}
else throw cms::Exception("LogicError", "Subdetector not defined");
}

protected:
const int subdet_, zside_, layer_;
const float rmin_, rmax_;
};

#endif
13 changes: 13 additions & 0 deletions Geometry/CommonTopologies/src/HGCGeomDet.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "Geometry/CommonTopologies/interface/HGCDiskGeomDet.h"
#include "DataFormats/GeometrySurface/interface/MediumProperties.h"
#include "DataFormats/GeometrySurface/interface/BoundDisk.h"

HGCDiskGeomDet::HGCDiskGeomDet(int subdet, int zside, int layer, float z, float rmin, float rmax, float radlen, float xi) :
GeomDet( Disk::build(Disk::PositionType(0,0,z), Disk::RotationType(), SimpleDiskBounds(rmin, rmax, -20, 20)).get() ),
subdet_(subdet), zside_(zside), layer_(layer), rmin_(rmin), rmax_(rmax)
{
if(subdet == 8 || subdet == 9) setDetId(DetId::Detector(subdet));
if (radlen > 0) {
(const_cast<Plane &>(surface())).setMediumProperties(MediumProperties(radlen,xi));
}
}
8 changes: 6 additions & 2 deletions RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
'keep *_ticlTrackstersHFNoseTrk_*_*',
'keep *_ticlTrackstersHFNoseMIP_*_*',
'keep *_ticlTrackstersHFNoseHAD_*_*',
'keep *_ticlTrackstersHFNoseMerge_*_*',] +
['keep *_pfTICL_*_*']
'keep *_ticlTrackstersHFNoseMerge_*_*'] +
['keep *_pfTICL_*_*'] +
['keep *_ticlRecHitTile_*_*']
)
)
TICL_RECO.outputCommands.extend(TICL_AOD.outputCommands)
Expand All @@ -33,7 +34,10 @@
)
TICL_FEVT.outputCommands.extend(TICL_RECO.outputCommands)

print("RecoHGCalEventContents!!!!!!!!!!!!")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up (and the one after)


def customiseHGCalOnlyEventContent(process):
print("customiseHGCalOnlyEventContent!!!!!!!!!!!!")
def cleanOutputAndSet(outputModule, ticl_outputCommads):
outputModule.outputCommands = ['drop *_*_*_*']
outputModule.outputCommands.extend(ticl_outputCommads)
Expand Down
2 changes: 2 additions & 0 deletions RecoHGCal/TICL/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<flags CXXFLAGS="-g -D=EDM_ML_DEBUG"/>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up (maybe keep in debug branch)

<use name="DataFormats/Candidate"/>
<use name="DataFormats/HGCalReco"/>
<use name="DataFormats/VertexReco"/>
<use name="FWCore/PluginManager"/>
<use name="PhysicsTools/TensorFlow"/>
<use name="TrackingTools/TrajectoryState"/>
<export>
<lib name="1"/>
</export>
11 changes: 10 additions & 1 deletion RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vector>
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "DataFormats/HGCalReco/interface/Trackster.h"
#include "DataFormats/HGCalReco/interface/KFHit.h"
#include "DataFormats/HGCalReco/interface/TICLLayerTile.h"
#include "DataFormats/HGCalReco/interface/TICLSeedingRegion.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand All @@ -16,6 +17,7 @@
#include "RecoHGCal/TICL/interface/commons.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "PhysicsTools/TensorFlow/interface/TensorFlow.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"

namespace edm {
class Event;
Expand Down Expand Up @@ -50,10 +52,17 @@ namespace ticl {
const tensorflow::Session* tS)
: ev(eV), es(eS), layerClusters(lC), mask(mS), layerClustersTime(lT), tiles(tL), regions(rG), tfSession(tS) {}
};

// (mmatthew): makeTrajectories used only by PatternRecognitionByKF.
// TODO: combine with makeTracksters as pure virtual function
virtual void makeTrajectories(const Inputs& input,
std::vector<KFHit>& kfhits,
std::vector<KFHit>& prophits,
float& abs_fail){};

virtual void makeTracksters(const Inputs& input,
std::vector<Trackster>& result,
std::unordered_map<int, std::vector<int>>& seedToTracksterAssociation) = 0;
std::unordered_map<int, std::vector<int>>& seedToTracksterAssociation){};

protected:
int algo_verbosity_;
Expand Down
3 changes: 3 additions & 0 deletions RecoHGCal/TICL/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<use name="DataFormats/ParticleFlowCandidate"/>
<use name="DataFormats/ParticleFlowReco"/>
<use name="DataFormats/TrackReco"/>
<use name="DataFormats/Provenance"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
Expand All @@ -27,9 +28,11 @@
<use name="SimDataFormats/Associations"/>
<use name="SimDataFormats/CaloAnalysis"/>
<use name="TrackingTools/GeomPropagators"/>
<use name="TrackingTools/KalmanUpdators"/>
<use name="TrackingTools/Records"/>
<use name="TrackingTools/TrajectoryState"/>
<use name="fastjet"/>
<use name="TrackingTools/PatternTools"/>
<library file="*.cc" name="RecoHGCalTICLPlugins">
<flags EDM_PLUGIN="1"/>
</library>
4 changes: 3 additions & 1 deletion RecoHGCal/TICL/plugins/PatternRecognitionPluginFactory.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "RecoHGCal/TICL/plugins/PatternRecognitionPluginFactory.h"
#include "PatternRecognitionbyCA.h"
#include "PatternRecognitionbyCLUE3D.h"
#include "PatternRecognitionbyKF.h"
#include "PatternRecognitionbyFastJet.h"
#include "FWCore/ParameterSet/interface/ValidatedPluginFactoryMacros.h"
#include "FWCore/ParameterSet/interface/ValidatedPluginMacros.h"
Expand All @@ -9,5 +10,6 @@ EDM_REGISTER_VALIDATED_PLUGINFACTORY(PatternRecognitionFactory, "PatternRecognit
EDM_REGISTER_VALIDATED_PLUGINFACTORY(PatternRecognitionHFNoseFactory, "PatternRecognitionHFNoseFactory");
DEFINE_EDM_VALIDATED_PLUGIN(PatternRecognitionFactory, ticl::PatternRecognitionbyCA<TICLLayerTiles>, "CA");
DEFINE_EDM_VALIDATED_PLUGIN(PatternRecognitionFactory, ticl::PatternRecognitionbyCLUE3D<TICLLayerTiles>, "CLUE3D");
DEFINE_EDM_VALIDATED_PLUGIN(PatternRecognitionFactory, ticl::PatternRecognitionbyKF<TICLLayerTiles>, "KF");
DEFINE_EDM_VALIDATED_PLUGIN(PatternRecognitionFactory, ticl::PatternRecognitionbyFastJet<TICLLayerTiles>, "FastJet");
DEFINE_EDM_VALIDATED_PLUGIN(PatternRecognitionHFNoseFactory, ticl::PatternRecognitionbyCA<TICLLayerTilesHFNose>, "CA");
DEFINE_EDM_VALIDATED_PLUGIN(PatternRecognitionHFNoseFactory, ticl::PatternRecognitionbyCA<TICLLayerTilesHFNose>, "CA");
2 changes: 2 additions & 0 deletions RecoHGCal/TICL/plugins/PatternRecognitionPluginFactory.h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back

Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ typedef edmplugin::PluginFactory<ticl::PatternRecognitionAlgoBaseT<TICLLayerTile
edm::ConsumesCollector)>
PatternRecognitionHFNoseFactory;



#endif
1 change: 1 addition & 0 deletions RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.cc
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back

Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ void PatternRecognitionbyCLUE3D<TILES>::makeTracksters(
std::vector<Trackster> &result,
std::unordered_map<int, std::vector<int>> &seedToTracksterAssociation) {
// Protect from events with no seeding regions

if (input.regions.empty())
return;

Expand Down
2 changes: 1 addition & 1 deletion RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back

Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ namespace ticl {
};

} // namespace ticl
#endif
#endif
Loading