Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23584 from casarsa/mc-btlSIM-devel
Simulation of the readout and digitization for the MIP timing detector barrel
- Loading branch information
Showing
25 changed files
with
3,890 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
RecoLocalFastTime/FTLCommonAlgos/interface/MTDRecHitAlgoBase.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef RecoLocalFastTime_FTLCommonAlgos_MTDRecHitAlgoBase_HH | ||
#define RecoLocalFastTime_FTLCommonAlgos_MTDRecHitAlgoBase_HH | ||
|
||
/** \class MTDRecHitAlgoBase | ||
* Template algorithm to make rechits from uncalibrated rechits | ||
* | ||
* \author Lindsey Gray | ||
*/ | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/ConsumesCollector.h" | ||
|
||
#include "DataFormats/FTLRecHit/interface/FTLRecHit.h" | ||
#include "DataFormats/FTLRecHit/interface/FTLUncalibratedRecHit.h" | ||
|
||
namespace edm { | ||
class Event; | ||
class EventSetup; | ||
} | ||
|
||
class MTDRecHitAlgoBase { | ||
public: | ||
|
||
/// Constructor | ||
MTDRecHitAlgoBase(const edm::ParameterSet& conf, | ||
edm::ConsumesCollector& sumes): | ||
name_( conf.getParameter<std::string>("algoName") ){ }; | ||
|
||
/// Destructor | ||
virtual ~MTDRecHitAlgoBase() { }; | ||
|
||
/// get event and eventsetup information | ||
virtual void getEvent(const edm::Event&) = 0; | ||
virtual void getEventSetup(const edm::EventSetup&) = 0; | ||
|
||
/// make rechits from dataframes | ||
virtual FTLRecHit makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const = 0; | ||
|
||
const std::string& name() const { return name_; } | ||
|
||
private: | ||
std::string name_; | ||
|
||
}; | ||
|
||
#include "FWCore/PluginManager/interface/PluginFactory.h" | ||
typedef edmplugin::PluginFactory< MTDRecHitAlgoBase* (const edm::ParameterSet&, edm::ConsumesCollector&) > MTDRecHitAlgoFactory; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "RecoLocalFastTime/FTLCommonAlgos/interface/MTDRecHitAlgoBase.h" | ||
|
||
class MTDRecHitAlgo : public MTDRecHitAlgoBase { | ||
public: | ||
/// Constructor | ||
MTDRecHitAlgo( const edm::ParameterSet& conf, | ||
edm::ConsumesCollector& sumes ) : | ||
MTDRecHitAlgoBase( conf, sumes ), | ||
thresholdToKeep_( conf.getParameter<double>("thresholdToKeep") ), | ||
calibration_( conf.getParameter<double>("calibrationConstant") ) { } | ||
|
||
/// Destructor | ||
~MTDRecHitAlgo() override { } | ||
|
||
/// get event and eventsetup information | ||
void getEvent(const edm::Event&) final {} | ||
void getEventSetup(const edm::EventSetup&) final {} | ||
|
||
/// make the rec hit | ||
FTLRecHit makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags ) const final; | ||
|
||
private: | ||
double thresholdToKeep_, calibration_; | ||
}; | ||
|
||
|
||
FTLRecHit | ||
MTDRecHitAlgo::makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const { | ||
|
||
float energy = uRecHit.amplitude() * calibration_; | ||
float time = uRecHit.time(); | ||
float timeError = uRecHit.timeError(); | ||
|
||
FTLRecHit rh( uRecHit.id(), energy, time, timeError ); | ||
|
||
// Now fill flags | ||
// all rechits from the digitizer are "good" at present | ||
if( energy > thresholdToKeep_ ) { | ||
flags = FTLRecHit::kGood; | ||
rh.setFlag(flags); | ||
} else { | ||
flags = FTLRecHit::kKilled; | ||
rh.setFlag(flags); | ||
} | ||
|
||
return rh; | ||
} | ||
|
||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_EDM_PLUGIN( MTDRecHitAlgoFactory, MTDRecHitAlgo, "MTDRecHitAlgo" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "RecoLocalFastTime/FTLCommonAlgos/interface/MTDRecHitAlgoBase.h" | ||
|
||
EDM_REGISTER_PLUGINFACTORY(MTDRecHitAlgoFactory,"MTDRecHitAlgoFactory"); |
96 changes: 96 additions & 0 deletions
96
RecoLocalFastTime/FTLRecProducers/plugins/MTDRecHitProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
|
||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "DataFormats/FTLDigi/interface/FTLDigiCollections.h" | ||
#include "DataFormats/FTLRecHit/interface/FTLRecHitCollections.h" | ||
|
||
#include "RecoLocalFastTime/FTLCommonAlgos/interface/MTDRecHitAlgoBase.h" | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
class MTDRecHitProducer : public edm::stream::EDProducer<> { | ||
|
||
public: | ||
explicit MTDRecHitProducer(const edm::ParameterSet& ps); | ||
~MTDRecHitProducer() override; | ||
void produce(edm::Event& evt, const edm::EventSetup& es) override; | ||
|
||
private: | ||
|
||
const edm::EDGetTokenT<FTLUncalibratedRecHitCollection> ftlbURecHits_; // collection of barrel digis | ||
const edm::EDGetTokenT<FTLUncalibratedRecHitCollection> ftleURecHits_; // collection of endcap digis | ||
|
||
const std::string ftlbInstance_; // instance name of barrel hits | ||
const std::string ftleInstance_; // instance name of endcap hits | ||
|
||
std::unique_ptr<MTDRecHitAlgoBase> barrel_,endcap_; | ||
}; | ||
|
||
MTDRecHitProducer::MTDRecHitProducer(const edm::ParameterSet& ps) : | ||
ftlbURecHits_( consumes<FTLUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("barrelUncalibratedRecHits") ) ), | ||
ftleURecHits_( consumes<FTLUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("endcapUncalibratedRecHits") ) ), | ||
ftlbInstance_( ps.getParameter<std::string>("BarrelHitsName") ), | ||
ftleInstance_( ps.getParameter<std::string>("EndcapHitsName") ) | ||
{ | ||
|
||
produces< FTLRecHitCollection >(ftlbInstance_); | ||
produces< FTLRecHitCollection >(ftleInstance_); | ||
|
||
auto sumes = consumesCollector(); | ||
|
||
const edm::ParameterSet& barrel = ps.getParameterSet("barrel"); | ||
const std::string& barrelAlgo = barrel.getParameter<std::string>("algoName"); | ||
barrel_.reset( MTDRecHitAlgoFactory::get()->create(barrelAlgo, barrel, sumes) ); | ||
|
||
const edm::ParameterSet& endcap = ps.getParameterSet("endcap"); | ||
const std::string& endcapAlgo = endcap.getParameter<std::string>("algoName"); | ||
endcap_.reset( MTDRecHitAlgoFactory::get()->create(endcapAlgo, endcap, sumes) ); | ||
|
||
} | ||
|
||
MTDRecHitProducer::~MTDRecHitProducer() { | ||
} | ||
|
||
void | ||
MTDRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) { | ||
|
||
|
||
// tranparently get things from event setup | ||
barrel_->getEventSetup(es); | ||
endcap_->getEventSetup(es); | ||
|
||
barrel_->getEvent(evt); | ||
endcap_->getEvent(evt); | ||
|
||
// prepare output | ||
auto barrelRechits = std::make_unique<FTLRecHitCollection>(); | ||
auto endcapRechits = std::make_unique<FTLRecHitCollection>(); | ||
|
||
edm::Handle< FTLUncalibratedRecHitCollection > hBarrel; | ||
evt.getByToken( ftlbURecHits_, hBarrel ); | ||
barrelRechits->reserve(hBarrel->size()/2); | ||
for(const auto& uhit : *hBarrel) { | ||
uint32_t flags = FTLRecHit::kGood; | ||
auto rechit = std::move( barrel_->makeRecHit(uhit, flags) ); | ||
if( flags == FTLRecHit::kGood ) barrelRechits->push_back( std::move(rechit) ); | ||
} | ||
|
||
edm::Handle< FTLUncalibratedRecHitCollection > hEndcap; | ||
evt.getByToken( ftleURecHits_, hEndcap ); | ||
endcapRechits->reserve(hEndcap->size()/2); | ||
for(const auto& uhit : *hEndcap) { | ||
uint32_t flags = FTLRecHit::kGood; | ||
auto rechit = std::move( endcap_->makeRecHit(uhit, flags) ); | ||
if( flags == FTLRecHit::kGood ) endcapRechits->push_back( std::move(rechit) ); | ||
} | ||
|
||
// put the collection of recunstructed hits in the event | ||
evt.put(std::move(barrelRechits), ftlbInstance_); | ||
evt.put(std::move(endcapRechits), ftleInstance_); | ||
} | ||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE( MTDRecHitProducer ); |
25 changes: 25 additions & 0 deletions
25
RecoLocalFastTime/FTLRecProducers/python/mtdRecHits_cfi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
_barrelAlgo = cms.PSet( | ||
algoName = cms.string("MTDRecHitAlgo"), | ||
thresholdToKeep = cms.double(1.), # MeV | ||
calibrationConstant = cms.double(0.026041667), # MeV/pC | ||
) | ||
|
||
|
||
_endcapAlgo = cms.PSet( | ||
algoName = cms.string("MTDRecHitAlgo"), | ||
thresholdToKeep = cms.double(0.5), # MIPs | ||
calibrationConstant = cms.double(1.), | ||
) | ||
|
||
|
||
mtdRecHits = cms.EDProducer( | ||
"MTDRecHitProducer", | ||
barrel = _barrelAlgo, | ||
endcap = _endcapAlgo, | ||
barrelUncalibratedRecHits = cms.InputTag('mtdUncalibratedRecHits:FTLBarrel'), | ||
endcapUncalibratedRecHits = cms.InputTag('mtdUncalibratedRecHits:FTLEndcap'), | ||
BarrelHitsName = cms.string('FTLBarrel'), | ||
EndcapHitsName = cms.string('FTLEndcap'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.