CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DPGAnalysis/Skims/interface/CSCSkim.h

Go to the documentation of this file.
00001 #ifndef DPGAnalysisSkims_CSCSkim_H
00002 #define DPGAnalysisSkims_CSCSkim_H
00003 
00011 // system include files
00012 #include <memory>
00013 #include <iostream>
00014 #include <vector>
00015 #include <map>
00016 #include <string>
00017 #include <iomanip>
00018 #include <fstream>
00019 
00020 // user include files
00021 #include "FWCore/Framework/interface/MakerMacros.h"
00022 #include "FWCore/Framework/interface/Frameworkfwd.h"
00023 #include "FWCore/Framework/interface/EDAnalyzer.h"
00024 #include "FWCore/Framework/interface/EDFilter.h"
00025 #include "FWCore/Framework/interface/Event.h"
00026 #include "DataFormats/Common/interface/Handle.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00028 #include "FWCore/Framework/interface/EventSetup.h"
00029 #include "FWCore/Framework/interface/ESHandle.h"
00030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00031 
00032 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00033 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h"
00034 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
00035 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
00036 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
00037 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h>
00038 #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
00039 #include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h>
00040 
00041 #include "DataFormats/DTRecHit/interface/DTRecSegment4D.h"
00042 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
00043 
00044 #include "DataFormats/MuonReco/interface/Muon.h"
00045 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00046 #include "DataFormats/TrackReco/interface/Track.h"
00047 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00048 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00049 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
00050 
00051 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00052 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00053 #include "Geometry/CSCGeometry/interface/CSCChamber.h"
00054 #include "Geometry/CSCGeometry/interface/CSCLayer.h"
00055 #include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h"
00056 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00057 
00058 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00059 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00060 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00061 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00062 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
00063 
00064 // #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00065 
00066 #include "TVector3.h"
00067 #include "TH1F.h"
00068 #include "TH2F.h"
00069 #include "TFile.h"
00070 #include "TString.h"
00071 #include "TTree.h"
00072 
00073 
00074 class CSCSkim : public edm::EDFilter {
00075  public:
00076   // Constructor
00077   explicit CSCSkim(const edm::ParameterSet& pset);
00078    
00079   // Destructor
00080   ~CSCSkim();
00081      
00082   // Analysis routines
00083   virtual void beginJob() ;
00084   virtual bool filter(edm::Event& event, const edm::EventSetup& eventSetup);
00085   virtual void endJob() ;
00086        
00087 protected:
00088        
00089 private: 
00090 
00091   // main skimming routine
00092   bool doCSCSkimming(edm::Handle<CSCRecHit2DCollection> cscRecHits, 
00093                      edm::Handle<CSCSegmentCollection> cscSegments);
00094 
00095   // extra skimming routine for alignment studies
00096   bool doOverlapSkimming(edm::Handle<CSCSegmentCollection> cscSegments);
00097 
00098   // skimming routine for messy events
00099   bool doMessyEventSkimming(edm::Handle<CSCRecHit2DCollection> cscRecHits, 
00100                             edm::Handle<CSCSegmentCollection> cscSegments);
00101 
00102   // select events with DIGIs in a certain chamber
00103   bool doCertainChamberSelection(edm::Handle<CSCWireDigiCollection> wires,
00104                                  edm::Handle<CSCStripDigiCollection> strips);
00105 
00106   // select events which might probe the DT-CSC overlap region
00107   bool doDTOverlap(edm::Handle<CSCSegmentCollection> cscSegments);
00108 
00109   // select muons which go through inner part of stations 1,2,3,4
00110   bool doHaloLike(edm::Handle<CSCSegmentCollection> cscSegments);
00111 
00112   // select events with long stand-alone (cosmic) muons
00113   bool doLongSATrack(edm::Handle<reco::TrackCollection> saTracks);
00114 
00115   // select events suitable for magnetic field studies - they have a track in the tracker
00116   bool doBFieldStudySelection(edm::Handle<reco::TrackCollection> saTracks, edm::Handle<reco::TrackCollection> Tracks, edm::Handle<reco::MuonCollection> gMuons);
00117 
00118   // some useful functions
00119   int    chamberSerial(int kE, int kS, int kR, int kCh);
00120 
00121   // counters
00122   int nEventsAnalyzed;
00123   int nEventsSelected;
00124   int nEventsChambersBothSides;
00125   int nEventsOverlappingChambers;
00126   int nEventsMessy;
00127   int nEventsCertainChamber;
00128   int nEventsDTOverlap;
00129   int nEventsHaloLike;
00130   int nEventsLongSATrack;
00131   int nEventsForBFieldStudies;
00132 
00133   // run and event number
00134   int iRun;
00135   int iEvent;
00136 
00137   // The root file for the histograms.
00138   TFile *theHistogramFile;
00139 
00140   // file names
00141   std::string outputFileName;
00142   std::string histogramFileName;
00143 
00144   // tag names
00145   edm::InputTag cscRecHitTag;
00146   edm::InputTag cscSegmentTag;
00147   edm::InputTag SAMuonTag;
00148   edm::InputTag GLBMuonTag;
00149   edm::InputTag trackTag;
00150 
00151   // parameters for the selection
00152   bool isSimulation;
00153   int typeOfSkim;
00154   int nLayersWithHitsMinimum;
00155   int minimumHitChambers;
00156   int minimumSegments;
00157   bool demandChambersBothSides;
00158   bool makeHistograms;
00159   bool makeHistogramsForMessyEvents;
00160   int whichEndcap;
00161   int whichStation;
00162   int whichRing;
00163   int whichChamber;
00164   // parameters for B-field study skim
00165   float pMin;
00166   float zLengthMin;
00167   int nCSCHitsMin;
00168   float zInnerMax;
00169   int nTrHitsMin;
00170   float zLengthTrMin;
00171   float rExtMax;
00172   float redChiSqMax;
00173   int nValidHitsMin;
00174 
00175 
00176   // histograms for skimming module
00177   TH1F *hxnRecHits;
00178   TH1F *hxnSegments;
00179   TH1F *hxnHitChambers;
00180   TH1F *hxnRecHitsSel;
00181   TH1F *mevnRecHits0;
00182   TH1F *mevnChambers0;
00183   TH1F *mevnSegments0;
00184   TH1F *mevnRecHits1;
00185   TH1F *mevnChambers1;
00186   TH1F *mevnSegments1;
00187 
00188   TH1F *xxP, *xxnValidHits, *xxnCSCHits, *xxredChiSq, *xxnTrackerHits;
00189 
00190 };
00191 #endif