Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTPPS: diamond miniAOD #18254

Merged
merged 9 commits into from Apr 13, 2017
Expand Up @@ -23,13 +23,14 @@
_reco.globalreco.remove(_reco.offlineBeamSpot) # temporary removing this by hand, cause the usual removal (see end of this file) doesn't seem work

###########################################
# no castor, zdc, Totem RP in FastSim
# no castor, zdc, Totem/CTPPS RP in FastSim
###########################################
_reco.localreco.remove(_reco.castorreco)
_reco.globalreco.remove(_reco.CastorFullReco)
_reco.hcalLocalRecoSequence.remove(_reco.zdcreco)
_reco.localreco.remove(_reco.totemRPLocalReconstruction)
_reco.localreco.remove(_reco.ctppsDiamondLocalReconstruction)
_reco.localreco.remove(_reco.ctppsLocalTrackLiteProducer)

##########################################
# Calo rechits
Expand Down
4 changes: 3 additions & 1 deletion RecoCTPPS/Configuration/python/recoCTPPS_cff.py
Expand Up @@ -2,8 +2,10 @@

from RecoCTPPS.TotemRPLocal.totemRPLocalReconstruction_cff import *
from RecoCTPPS.TotemRPLocal.ctppsDiamondLocalReconstruction_cff import *
from RecoCTPPS.TotemRPLocal.ctppsLocalTrackLiteProducer_cfi import ctppsLocalTrackLiteProducer

recoCTPPS = cms.Sequence(
totemRPLocalReconstruction *
ctppsDiamondLocalReconstruction
ctppsDiamondLocalReconstruction *
ctppsLocalTrackLiteProducer
)
80 changes: 46 additions & 34 deletions RecoCTPPS/TotemRPLocal/plugins/CTPPSLocalTrackLiteProducer.cc
Expand Up @@ -3,6 +3,7 @@
* This is a part of TOTEM offline software.
* Authors:
* Jan Kašpar (jan.kaspar@gmail.com)
* Laurent Forthomme
*
****************************************************************************/

Expand All @@ -14,6 +15,8 @@

#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h"
#include "DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h"

#include "DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h"

//----------------------------------------------------------------------------------------------------
Expand All @@ -24,69 +27,78 @@
class CTPPSLocalTrackLiteProducer : public edm::stream::EDProducer<>
{
public:
explicit CTPPSLocalTrackLiteProducer(const edm::ParameterSet& conf);

explicit CTPPSLocalTrackLiteProducer( const edm::ParameterSet& );
virtual ~CTPPSLocalTrackLiteProducer() {}
virtual void produce(edm::Event& e, const edm::EventSetup& c) override;

virtual void produce( edm::Event&, const edm::EventSetup& ) override;

private:
edm::EDGetTokenT<edm::DetSetVector<TotemRPLocalTrack>> siStripTrackToken;
edm::EDGetTokenT< edm::DetSetVector<TotemRPLocalTrack> > siStripTrackToken_;
edm::EDGetTokenT< edm::DetSetVector<CTPPSDiamondLocalTrack> > diamondTrackToken_;

/// if true, this module will do nothing
/// needed for consistency with CTPPS-less workflows
bool doNothing;
bool doNothing_;
};

//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------

using namespace std;
using namespace edm;

//----------------------------------------------------------------------------------------------------

CTPPSLocalTrackLiteProducer::CTPPSLocalTrackLiteProducer(edm::ParameterSet const& conf) :
doNothing(conf.getParameter<bool>("doNothing"))
CTPPSLocalTrackLiteProducer::CTPPSLocalTrackLiteProducer( const edm::ParameterSet& iConfig ) :
doNothing_( iConfig.getParameter<bool>( "doNothing" ) )
{
if (doNothing)
return;
if ( doNothing_ ) return;

siStripTrackToken = consumes<DetSetVector<TotemRPLocalTrack>>(conf.getParameter<edm::InputTag>("tagSiStripTrack"));
siStripTrackToken_ = consumes< edm::DetSetVector<TotemRPLocalTrack> > ( iConfig.getParameter<edm::InputTag>("tagSiStripTrack") );
diamondTrackToken_ = consumes< edm::DetSetVector<CTPPSDiamondLocalTrack> >( iConfig.getParameter<edm::InputTag>("tagDiamondTrack") );

produces<vector<CTPPSLocalTrackLite>>();
produces< std::vector<CTPPSLocalTrackLite> >();
}

//----------------------------------------------------------------------------------------------------

void CTPPSLocalTrackLiteProducer::produce(edm::Event& e, const edm::EventSetup& es)
void
CTPPSLocalTrackLiteProducer::produce( edm::Event& iEvent, const edm::EventSetup& )
{
if (doNothing)
if ( doNothing_ )
return;

// get input from Si strips
edm::Handle< DetSetVector<TotemRPLocalTrack> > inputSiStripTracks;
e.getByToken(siStripTrackToken, inputSiStripTracks);

// prepare output
vector<CTPPSLocalTrackLite> output;
std::unique_ptr< std::vector<CTPPSLocalTrackLite> > pOut( new std::vector<CTPPSLocalTrackLite>() );

//----- TOTEM strips

// get input from Si strips
edm::Handle< edm::DetSetVector<TotemRPLocalTrack> > inputSiStripTracks;
iEvent.getByToken( siStripTrackToken_, inputSiStripTracks );

// process tracks from Si strips
for (const auto rpv : *inputSiStripTracks)
{
for ( const auto& rpv : *inputSiStripTracks ) {
const uint32_t rpId = rpv.detId();
for ( const auto& trk : rpv ) {
if ( !trk.isValid() ) continue;
pOut->emplace_back( rpId, trk.getX0(), trk.getX0Sigma(), trk.getY0(), trk.getY0Sigma() );
}
}

//----- diamond detectors

// get input from diamond detectors
edm::Handle< edm::DetSetVector<CTPPSDiamondLocalTrack> > inputDiamondTracks;
iEvent.getByToken( diamondTrackToken_, inputDiamondTracks );

for (const auto t : rpv)
{
if (t.isValid())
output.push_back(CTPPSLocalTrackLite(rpId, t.getX0(), t.getX0Sigma(), t.getY0(), t.getY0Sigma()));
// process tracks from diamond detectors
for ( const auto& rpv : *inputDiamondTracks ) {
const unsigned int rpId = rpv.detId();
for ( const auto& trk : rpv ) {
if ( !trk.isValid() ) continue;
pOut->emplace_back( rpId, trk.getX0(), trk.getX0Sigma(), trk.getY0(), trk.getY0Sigma(), trk.getT() );
}
}

// save output to event
e.put(make_unique<vector<CTPPSLocalTrackLite>>(output));
iEvent.put( std::move( pOut ) );
}

//----------------------------------------------------------------------------------------------------

DEFINE_FWK_MODULE(CTPPSLocalTrackLiteProducer);
DEFINE_FWK_MODULE( CTPPSLocalTrackLiteProducer );
@@ -1,10 +1,11 @@
import FWCore.ParameterSet.Config as cms

ctppsLocalTrackLiteProducer = cms.EDProducer("CTPPSLocalTrackLiteProducer",
tagSiStripTrack = cms.InputTag("totemRPLocalTrackFitter"),
tagSiStripTrack = cms.InputTag("totemRPLocalTrackFitter"),
tagDiamondTrack = cms.InputTag("ctppsDiamondLocalTracks"),

# disable the module by default
doNothing = cms.bool(True)
# disable the module by default
doNothing = cms.bool(True)
)

# enable the module for CTPPS era(s)
Expand Down
Expand Up @@ -15,14 +15,9 @@
# local track fitting
from RecoCTPPS.TotemRPLocal.totemRPLocalTrackFitter_cfi import *

# lite local-track collection from all RPs
from RecoCTPPS.TotemRPLocal.ctppsLocalTrackLiteProducer_cfi import *

totemRPLocalReconstruction = cms.Sequence(
totemRPClusterProducer *
totemRPRecHitProducer *
totemRPUVPatternFinder *
totemRPLocalTrackFitter *

ctppsLocalTrackLiteProducer
totemRPLocalTrackFitter
)
52 changes: 52 additions & 0 deletions RecoCTPPS/TotemRPLocal/test/ctpps_reco_cfg.py
@@ -0,0 +1,52 @@
import FWCore.ParameterSet.Config as cms
process = cms.Process("CTPPS")

process.load('Configuration.StandardSequences.EndOfProcess_cff')

process.source = cms.Source('PoolSource',
fileNames = cms.untracked.vstring(
#'/store/data/Run2016H/ZeroBias/RAW/v1/000/281/010/00000/20B9B8C4-6F7E-E611-8B60-02163E013864.root' # no diamond data
'/store/data/Run2016H/ZeroBias/RAW/v1/000/284/036/00000/D2EE671D-D39E-E611-B272-FA163EA63BCC.root'
),
)

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1000)
)

process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff")

process.load('Geometry.VeryForwardGeometry.geometryRP_cfi')

process.load('RecoCTPPS.TotemRPLocal.totemRPLocalReconstruction_cff')
process.load('RecoCTPPS.TotemRPLocal.ctppsDiamondLocalReconstruction_cff')

process.load('RecoCTPPS.TotemRPLocal.ctppsLocalTrackLiteProducer_cfi')
process.ctppsLocalTrackLiteProducer.doNothing = cms.bool(False)

process.output = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string("file:miniAOD.root"),
outputCommands = cms.untracked.vstring(
'drop *',
'keep *_totemRP*_*_*',
'keep *_ctpps*_*_*',
),
)

process.endjob_step = cms.EndPath(process.endOfProcess)
process.output_step = cms.EndPath(process.output)

# execution configuration
process.ctpps_reco_step = cms.Path(
process.totemRPRawToDigi *
process.totemRPLocalReconstruction *
process.ctppsDiamondRawToDigi *
process.ctppsDiamondLocalReconstruction
)
process.ctpps_miniaod_step = cms.Path(process.ctppsLocalTrackLiteProducer)
process.schedule = cms.Schedule(process.ctpps_reco_step, process.ctpps_miniaod_step, process.endjob_step, process.output_step)

from FWCore.ParameterSet.Utilities import convertToUnscheduled
process = convertToUnscheduled(process)
from FWCore.ParameterSet.Utilities import cleanUnscheduled
process = cleanUnscheduled(process)