|
||||
File indexing completed on 2024-04-06 12:30:41
0001 #ifndef TrackingAnalysis_TrackingTruthAccumulator_h 0002 #define TrackingAnalysis_TrackingTruthAccumulator_h 0003 0004 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" 0005 #include "Geometry/Records/interface/TrackerTopologyRcd.h" 0006 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" 0007 #include "FWCore/Framework/interface/ProducesCollector.h" 0008 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h" 0009 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h" 0010 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" 0011 #include "SimTracker/Common/interface/TrackingParticleSelector.h" 0012 #include <memory> // required for std::unique_ptr 0013 0014 // Forward declarations 0015 class PileUpEventPrincipal; 0016 class PSimHit; 0017 0018 /** @brief Replacement for TrackingTruthProducer in the new pileup mixing setup. 0019 * 0020 * The configuration parameters are: 0021 * 0022 * <table> 0023 * <tr> 0024 * <th>Parameter name </th><th> Type </th><th> 0025 * Description </th> 0026 * </tr> 0027 * <tr><td> volumeRadius </td><td> double </td><td> 0028 * The volume radius in cm used if ignoreTracksOutsideVolume is true. </td></tr> 0029 * <tr><td> volumeZ </td><td> double </td><td> 0030 * The volume z in cm used if ignoreTracksOutsideVolume is true. </td></tr> 0031 * <tr><td> ignoreTracksOutsideVolume </td><td> bool </td><td> 0032 * If true, sim tracks that have a production vertex outside the volume 0033 * specified by volumeRadius and volumeZ won't be turned into TrackingParticles. 0034 * Doesn't make much difference to be honest, over a huge range of volume sizes 0035 * so there must be a cut earlier in the simulation. </td></tr> <tr><td> 0036 * maximumPreviousBunchCrossing </td><td> unsigned int </td><td> Bunch 0037 * crossings before this number (inclusive; use positive integer) won't be 0038 * included. Setting to zero means only in-time. </td></tr> <tr><td> 0039 * maximumSubsequentBunchCrossing </td><td> unsigned int </td><td> Bunch 0040 * crossings after this won't create any TrackingParticles. </td></tr> <tr><td> 0041 * createUnmergedCollection </td><td> bool </td><td> Whether 0042 * to create the TrackingParticle collection without bremsstrahlung merged. 0043 * </td></tr> <tr><td> createMergedBremsstrahlung </td><td> bool </td><td> 0044 * Whether to create the TrackingParticle collection with bremsstrahlung merged. 0045 * At least one of createUnmergedCollection or createMergedBremsstrahlung should 0046 * be true otherwise nothing will be produced. </td></tr> <tr><td> 0047 * createInitialVertexCollection </td><td> bool </td><td> Whether 0048 * to create a collection of just the initial vertices. You can usually get this 0049 * information 0050 * from one of the other collections (merged or unmerged bremsstrahlung), but 0051 * for 0052 * this collection no selection is applied. Hence you will always have all of 0053 * the initial vertices regardless of how tightly you select TrackingParticles 0054 * with the "select" parameter. Note that <b>the collection will have no links 0055 * to the products of these vertices<b>. If you want to know what came off 0056 * these vertices you will have to look in one of the other collections. The 0057 * name of the collection will be "InitialVertices".</td></tr> <tr><td> 0058 * alwaysAddAncestors </td><td> bool </td><td> If a sim 0059 * track passes selection and is turned into a TrackingParticle, all of it's 0060 * parents 0061 * will also be created even if they fail the selection. This was the default 0062 * behaviour 0063 * for the old TrackingParticleProducer. </td></tr> <tr><td> removeDeadModules 0064 * </td><td> bool </td><td> Hasn't been implemented yet (as of 0065 * 22/May/2013). </td></tr> <tr><td> simTrackCollection </td><td> 0066 * edm::InputTag </td><td> The input SimTrack collection </td></tr> <tr><td> 0067 * simVertexCollection </td><td> edm::InputTag </td><td> The 0068 * input SimVerted collection </td></tr> <tr><td> simHitCollections </td><td> 0069 * edm::ParameterSet </td><td> A ParameterSet of vectors of InputTags that are 0070 * the input PSimHits </td></tr> <tr><td> genParticleCollection </td><td> 0071 * edm::InputTag </td><td> The input reco::GenParticle collection. Note that 0072 * there's a difference between reco::GenParticle and HepMC::GenParticle; the 0073 * old TrackingTruthProducer used to use HepMC::GenParticle. </td></tr> <tr><td> 0074 * allowDifferentSimHitProcesses </td><td> bool </td><td> Should 0075 * be false for FullSim and true for FastSim. There's more documentation in the 0076 * code if you're really interested. </td></tr> <tr><td> select </td><td> 0077 * edm::ParameterSet </td><td> A ParameterSet used to configure a 0078 * TrackingParticleSelector. If the TrackingParticle doesn't pass this selector 0079 * then it's not added to the output. </td></tr> 0080 * </table> 0081 * 0082 * @author Mark Grimes (mark.grimes@bristol.ac.uk) 0083 * @date 11/Oct/2012 0084 */ 0085 class TrackingTruthAccumulator : public DigiAccumulatorMixMod { 0086 public: 0087 explicit TrackingTruthAccumulator(const edm::ParameterSet &config, 0088 edm::ProducesCollector, 0089 edm::ConsumesCollector &iC); 0090 0091 private: 0092 void initializeEvent(const edm::Event &event, const edm::EventSetup &setup) override; 0093 void accumulate(const edm::Event &event, const edm::EventSetup &setup) override; 0094 void accumulate(const PileUpEventPrincipal &event, const edm::EventSetup &setup, edm::StreamID const &) override; 0095 void finalizeEvent(edm::Event &event, const edm::EventSetup &setup) override; 0096 0097 /** @brief Both forms of accumulate() delegate to this templated method. */ 0098 template <class T> 0099 void accumulateEvent(const T &event, 0100 const edm::EventSetup &setup, 0101 const edm::Handle<edm::HepMCProduct> &hepMCproduct); 0102 0103 /** @brief Fills the supplied vector with pointers to the SimHits, checking 0104 * for bad modules if required */ 0105 template <class T> 0106 void fillSimHits(std::vector<const PSimHit *> &returnValue, const T &event, const edm::EventSetup &setup); 0107 0108 const std::string messageCategory_; ///< The message category used to send 0109 ///< messages to MessageLogger 0110 0111 const double volumeRadius_; 0112 const double volumeZ_; 0113 /// maximum distance for HepMC::GenVertex to be added to SimVertex 0114 const double vertexDistanceCut_; 0115 const bool ignoreTracksOutsideVolume_; 0116 0117 /** The maximum bunch crossing BEFORE the signal crossing to create 0118 * TrackinParticles for. Use positive values. If set to zero no previous 0119 * bunches are added and only in-time, signal and after bunches (defined by 0120 * maximumSubsequentBunchCrossing_) are used.*/ 0121 const unsigned int maximumPreviousBunchCrossing_; 0122 /** The maximum bunch crossing AFTER the signal crossing to create 0123 * TrackinParticles for. E.g. if set to zero only 0124 * uses the signal and in time pileup (and previous bunches defined by the 0125 * maximumPreviousBunchCrossing_ parameter). */ 0126 const unsigned int maximumSubsequentBunchCrossing_; 0127 /// If bremsstrahlung merging, whether to also add the unmerged collection to 0128 /// the event or not. 0129 const bool createUnmergedCollection_; 0130 const bool createMergedCollection_; 0131 /// Whether or not to create a separate collection for just the initial 0132 /// interaction vertices 0133 const bool createInitialVertexCollection_; 0134 /// Whether or not to add the full parentage of any TrackingParticle that is 0135 /// inserted in the collection. 0136 const bool addAncestors_; 0137 0138 /// As of 11/Feb/2013 this option hasn't been implemented yet. 0139 const bool removeDeadModules_; 0140 const edm::InputTag simTrackLabel_; 0141 const edm::InputTag simVertexLabel_; 0142 std::vector<edm::InputTag> collectionTags_; 0143 edm::InputTag genParticleLabel_; 0144 /// Needed to add HepMC::GenVertex to SimVertex 0145 edm::InputTag hepMCproductLabel_; 0146 const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_; 0147 0148 bool selectorFlag_; 0149 TrackingParticleSelector selector_; 0150 /// Uses the same config as selector_, but can be used to drop out early since 0151 /// selector_ requires the TrackingParticle to be created first. 0152 bool chargedOnly_; 0153 /// Uses the same config as selector_, but can be used to drop out early since 0154 /// selector_ requires the TrackingParticle to be created first. 0155 bool signalOnly_; 0156 0157 /** @brief When counting hits, allows hits in different detectors to have a 0158 * different process type. 0159 * 0160 * Fast sim PSimHits seem to have a peculiarity where the process type (as 0161 * reported by PSimHit::processType()) is different for the tracker than the 0162 * muons. When counting how many hits there are, the code usually only counts 0163 * the number of hits that have the same process type as the first hit. 0164 * Setting this to true will also count hits that have the same process type 0165 * as the first hit in the second detector.<br/> 0166 */ 0167 bool allowDifferentProcessTypeForDifferentDetectors_; 0168 0169 public: 0170 // These always go hand in hand, and I need to pass them around in the 0171 // internal functions, so I might as well package them up in a struct. 0172 struct OutputCollections { 0173 std::unique_ptr<TrackingParticleCollection> pTrackingParticles; 0174 std::unique_ptr<TrackingVertexCollection> pTrackingVertices; 0175 TrackingParticleRefProd refTrackingParticles; 0176 TrackingVertexRefProd refTrackingVertexes; 0177 }; 0178 0179 private: 0180 OutputCollections unmergedOutput_; 0181 OutputCollections mergedOutput_; 0182 std::unique_ptr<TrackingVertexCollection> pInitialVertices_; 0183 }; 0184 0185 #endif // end of "#ifndef TrackingAnalysis_TrackingTruthAccumulator_h"
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |