File indexing completed on 2023-10-25 09:48:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "FWCore/Framework/interface/one/EDFilter.h"
0019 #include "FWCore/Framework/interface/EventSetup.h"
0020 #include "FWCore/Framework/interface/Event.h"
0021
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023 #include "FWCore/Utilities/interface/EDGetToken.h"
0024
0025 #include "DataFormats/GeometrySurface/interface/Plane.h"
0026 #include "DataFormats/GeometrySurface/interface/Cylinder.h"
0027 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0028 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0029
0030 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0031
0032 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0033 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0034
0035 #include <TObjArray.h>
0036
0037 #include <vector>
0038
0039 class MagneticField;
0040 class Propagator;
0041
0042 class CosmicGenFilterHelix : public edm::one::EDFilter<edm::one::SharedResources> {
0043 public:
0044 explicit CosmicGenFilterHelix(const edm::ParameterSet &config);
0045 ~CosmicGenFilterHelix() override;
0046
0047 void beginJob() override;
0048 bool filter(edm::Event &event, const edm::EventSetup &eventSetup) override;
0049 void endJob() override;
0050
0051 private:
0052
0053 bool propagateToCutCylinder(const GlobalPoint &vertStart,
0054 const GlobalVector &momStart,
0055 int charge,
0056 const MagneticField *field,
0057 const Propagator *propagator);
0058
0059 bool charge(int id, int &charge) const;
0060
0061 const MagneticField *getMagneticField(const edm::EventSetup &setup) const;
0062 const Propagator *getPropagator(const edm::EventSetup &setup) const;
0063
0064
0065 const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMFToken;
0066 const edm::ESGetToken<Propagator, TrackingComponentsRecord> thePropToken;
0067
0068 edm::EDGetTokenT<edm::HepMCProduct> theSrcToken;
0069 const std::vector<int> theIds;
0070 const std::vector<int> theCharges;
0071 const double theMinP2;
0072 const double theMinPt2;
0073
0074 Cylinder::ConstCylinderPointer theTargetCylinder;
0075 Plane::ConstPlanePointer theTargetPlaneMin;
0076 Plane::ConstPlanePointer theTargetPlaneMax;
0077
0078 unsigned int theNumTotal;
0079 unsigned int theNumPass;
0080
0081
0082 void createHistsStart(const char *dirName, TObjArray &hists);
0083 void createHistsEnd(const char *dirName, TObjArray &hists);
0084 void monitorStart(const GlobalPoint &vert, const GlobalVector &mom, int charge, TObjArray &hists);
0085 void monitorEnd(const GlobalPoint &endVert,
0086 const GlobalVector &endMom,
0087 const GlobalPoint &vert,
0088 const GlobalVector &mom,
0089 double path,
0090 TObjArray &hists);
0091 bool equidistLogBins(double *bins, int nBins, double first, double last) const;
0092 const bool theDoMonitor;
0093 TObjArray theHistsBefore;
0094 TObjArray theHistsAfter;
0095 };