Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:14

0001 #ifndef Alignment_CommonAlignmentProducer_AlignmentProducerAsAnalyzer_h
0002 #define Alignment_CommonAlignmentProducer_AlignmentProducerAsAnalyzer_h
0003 
0004 /**
0005  * @package   Alignment/CommonAlignmentProducer
0006  * @file      AlignmentProducerAsAnalyzer.h
0007  *
0008  * @author    Max Stark (max.stark@cern.ch)
0009  * @date      2015/07/16
0010  *
0011  * @brief     AlignmentProducer useable for Prompt Calibration Loop (PCL)
0012  *
0013  * Code has similar functionality as the standard offline AlignmentProducer (see
0014  * AlignmentProducer.h) Main difference is the base-class exchange from an
0015  * ESProducerLooper to an EDAnalyzer. For further information regarding aligment
0016  * workflow on PCL see:
0017  *
0018  * https://indico.cern.ch/event/394130/session/0/contribution/8/attachments/1127471/1610233/2015-07-16_PixelPCL_Ali.pdf
0019  *
0020  */
0021 
0022 #include "Alignment/CommonAlignmentProducer/interface/AlignmentProducerBase.h"
0023 #include "FWCore/Framework/interface/one/EDProducer.h"
0024 #include "FWCore/Framework/interface/ProcessBlock.h"
0025 #include "FWCore/Framework/interface/Run.h"
0026 #include "DataFormats/Alignment/interface/AlignmentToken.h"
0027 
0028 class AlignmentProducerAsAnalyzer : public AlignmentProducerBase,
0029                                     public edm::one::EDProducer<edm::EndProcessBlockProducer,
0030                                                                 edm::one::WatchLuminosityBlocks,
0031                                                                 edm::one::WatchRuns,
0032                                                                 edm::one::SharedResources,
0033                                                                 edm::Accumulator> {
0034   //========================== PUBLIC METHODS ==================================
0035 public:  //====================================================================
0036   /// Constructor
0037   AlignmentProducerAsAnalyzer(const edm::ParameterSet&);
0038 
0039   /// Destructor
0040   ~AlignmentProducerAsAnalyzer() override = default;
0041 
0042   /*** Code which implements the interface
0043        Called from outside ***/
0044 
0045   void beginJob() override;
0046   void endJob() override;
0047 
0048   void beginRun(const edm::Run&, const edm::EventSetup&) override;
0049   void endRun(const edm::Run&, const edm::EventSetup&) override;
0050 
0051   void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override;
0052   void endLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override;
0053   void endProcessBlockProduce(edm::ProcessBlock& processBlock) override;
0054 
0055   void accumulate(const edm::Event&, const edm::EventSetup&) override;
0056 
0057 private:
0058   edm::EDPutTokenT<AlignmentToken> token_;
0059   bool getTrajTrackAssociationCollection(const edm::Event&, edm::Handle<TrajTrackAssociationCollection>&) override;
0060   bool getBeamSpot(const edm::Event&, edm::Handle<reco::BeamSpot>&) override;
0061   bool getTkFittedLasBeamCollection(const edm::Run&, edm::Handle<TkFittedLasBeamCollection>&) override;
0062   bool getTsosVectorCollection(const edm::Run&, edm::Handle<TsosVectorCollection>&) override;
0063   bool getAliClusterValueMap(const edm::Event&, edm::Handle<AliClusterValueMap>&) override;
0064 
0065   edm::EDGetTokenT<TrajTrackAssociationCollection> tjTkAssociationMapToken_;
0066   edm::EDGetTokenT<reco::BeamSpot> beamSpotToken_;
0067   edm::EDGetTokenT<TkFittedLasBeamCollection> tkLasBeamToken_;
0068   edm::EDGetTokenT<TsosVectorCollection> tsosVectorToken_;
0069   edm::EDGetTokenT<AliClusterValueMap> clusterValueMapToken_;
0070 };
0071 
0072 //------------------------------------------------------------------------------
0073 inline bool AlignmentProducerAsAnalyzer::getTrajTrackAssociationCollection(
0074     const edm::Event& event, edm::Handle<TrajTrackAssociationCollection>& result) {
0075   return event.getByToken(tjTkAssociationMapToken_, result);
0076 }
0077 
0078 //------------------------------------------------------------------------------
0079 inline bool AlignmentProducerAsAnalyzer::getBeamSpot(const edm::Event& event, edm::Handle<reco::BeamSpot>& result) {
0080   return event.getByToken(beamSpotToken_, result);
0081 }
0082 
0083 //------------------------------------------------------------------------------
0084 inline bool AlignmentProducerAsAnalyzer::getTkFittedLasBeamCollection(const edm::Run& run,
0085                                                                       edm::Handle<TkFittedLasBeamCollection>& result) {
0086   return run.getByToken(tkLasBeamToken_, result);
0087 }
0088 
0089 //------------------------------------------------------------------------------
0090 inline bool AlignmentProducerAsAnalyzer::getTsosVectorCollection(const edm::Run& run,
0091                                                                  edm::Handle<TsosVectorCollection>& result) {
0092   return run.getByToken(tsosVectorToken_, result);
0093 }
0094 
0095 //------------------------------------------------------------------------------
0096 inline bool AlignmentProducerAsAnalyzer::getAliClusterValueMap(const edm::Event& event,
0097                                                                edm::Handle<AliClusterValueMap>& result) {
0098   return event.getByToken(clusterValueMapToken_, result);
0099 }
0100 
0101 #endif