Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-10 22:24:54

0001 #ifndef STANALYZER_H
0002 #define STANALYZER_H
0003 
0004 /** \class STAnalyzer
0005  *
0006  * Description:
0007  *  
0008  *  detailed description
0009  *
0010  * \author : Stefano Lacaprara - INFN Padova <stefano.lacaprara@pd.infn.it>
0011  *
0012  * Modification:
0013  *
0014  */
0015 
0016 /* Base Class Headers */
0017 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0018 #include "FWCore/Framework/interface/ESHandle.h"
0019 namespace edm {
0020   class ParameterSet;
0021   class Event;
0022   class EventSetup;
0023 }  // namespace edm
0024 
0025 /* Collaborating Class Declarations */
0026 #include "DataFormats/Common/interface/Handle.h"
0027 class TFile;
0028 class TH1F;
0029 class TH2F;
0030 class DTLayerId;
0031 class DTLayer;
0032 class DTSuperLayerId;
0033 class DTSuperLayer;
0034 class DTChamberId;
0035 class DTChamber;
0036 class Propagator;
0037 class GeomDet;
0038 class DTGeometry;
0039 class TrajectoryStateOnSurface;
0040 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0041 #include "DataFormats/DTRecHit/interface/DTRecSegment2DCollection.h"
0042 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
0043 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0044 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0045 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
0046 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0047 #include "MagneticField/Engine/interface/MagneticField.h"
0048 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0049 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0050 
0051 /* C++ Headers */
0052 #include <iosfwd>
0053 #include <bitset>
0054 
0055 /* ====================================================================== */
0056 
0057 /* Class STAnalyzer Interface */
0058 
0059 class STAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0060 public:
0061   /* Constructor */
0062   STAnalyzer(const edm::ParameterSet& pset);
0063 
0064   /* Destructor */
0065   ~STAnalyzer() override;
0066 
0067   /* Operations */
0068   void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override;
0069 
0070   void beginJob() override;
0071   void beginRun(const edm::Run& run, const edm::EventSetup& setup) override;
0072   void endRun(const edm::Run& run, const edm::EventSetup& setup) override {}
0073 
0074 private:
0075   void analyzeSATrack(const edm::Event& event, const edm::EventSetup& eventSetup);
0076 
0077   template <typename T, typename C>
0078   void missingHit(const edm::ESHandle<DTGeometry>& dtGeom,
0079                   const edm::Handle<C>& segs,
0080                   const T* ch,
0081                   const TrajectoryStateOnSurface& startTsos,
0082                   bool found = false);
0083 
0084   void fillMinDist(const DTRecSegment4DCollection::range segs,
0085                    const DTChamber* ch,
0086                    const TrajectoryStateOnSurface& extraptsos,
0087                    bool found = false);
0088 
0089   void fillMinDist(const DTRecSegment2DCollection::range segs,
0090                    const DTSuperLayer* ch,
0091                    const TrajectoryStateOnSurface& extraptsos,
0092                    bool found = false);
0093 
0094   void fillMinDist(const DTRecHitCollection::range segs,
0095                    const DTLayer* ch,
0096                    const TrajectoryStateOnSurface& extraptsos,
0097                    bool found = false);
0098 
0099   TH1F* histo(const std::string& name) const;
0100   TH2F* histo2d(const std::string& name) const;
0101 
0102   void createTH1F(const std::string& name,
0103                   const std::string& title,
0104                   const std::string& suffix,
0105                   int nbin,
0106                   const double& binMin,
0107                   const double& binMax) const;
0108 
0109   void createTH2F(const std::string& name,
0110                   const std::string& title,
0111                   const std::string& suffix,
0112                   int nBinX,
0113                   const double& binXMin,
0114                   const double& binXMax,
0115                   int nBinY,
0116                   const double& binYMin,
0117                   const double& binYMax) const;
0118 
0119   std::string toString(const DTLayerId& id) const;
0120   std::string toString(const DTSuperLayerId& id) const;
0121   std::string toString(const DTChamberId& id) const;
0122   template <class T>
0123   std::string hName(const std::string& s, const T& id) const;
0124 
0125 private:
0126   bool debug;
0127   int _ev;
0128   std::string theRootFileName;
0129   TFile* theFile;
0130   //static std::string theAlgoName;
0131   std::string theDTLocalTriggerLabel;
0132   std::string theRecHits4DLabel;
0133   std::string theRecHits2DLabel;
0134   std::string theRecHits1DLabel;
0135   std::string theSTAMuonLabel;
0136   std::string thePropagatorName;
0137 
0138   mutable Propagator* thePropagator;
0139 
0140   bool doSA;
0141 
0142   std::map<DTChamberId, int> hitsPerChamber;
0143   std::map<DTSuperLayerId, int> hitsPerSL;
0144   std::map<DTLayerId, int> hitsPerLayer;
0145 
0146   edm::ESGetToken<DTGeometry, MuonGeometryRecord> theDtGeomTokenBR;
0147   edm::ESGetToken<DTGeometry, MuonGeometryRecord> theDtGeomToken;
0148   edm::ESGetToken<Propagator, TrackingComponentsRecord> thePropagatorToken;
0149   edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMGFieldToken;
0150   edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> theTrackingGeometryToken;
0151 
0152   bool firstPass = true;
0153 
0154 protected:
0155 };
0156 #endif  // STANALYZER_H