CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Validation/MuonHits/src/MuonSimHitsValidAnalyzer.h

Go to the documentation of this file.
00001 #ifndef MuonSimHitsValidAnalyzer_h
00002 #define MuonSimHitsValidAnalyzer_h
00003 
00005 #include "FWCore/Framework/interface/EDAnalyzer.h"
00006 #include "FWCore/Framework/interface/Frameworkfwd.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/EventSetup.h"
00009 #include "DataFormats/Common/interface/Handle.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 #include "DataFormats/Provenance/interface/Provenance.h"
00012 #include "FWCore/Framework/interface/MakerMacros.h"
00013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 #include "FWCore/ServiceRegistry/interface/Service.h"
00016 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00017 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00018 #include "DataFormats/DetId/interface/DetId.h"
00019 
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021 #include "DQMServices/Core/interface/MonitorElement.h"
00022 
00024 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00025 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00026 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00027 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
00028 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
00029 
00031 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00032 
00034 //#include "SimDataFormats/ValidationFormats/interface/PValidationFormats.h"
00035 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00036 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00037 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00038 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00039 
00041 #include <CLHEP/Vector/LorentzVector.h>
00042 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00043 
00044 #include <iostream>
00045 
00046 #include <stdlib.h>
00047 #include <string>
00048 #include <memory>
00049 #include <vector>
00050 
00051 #include "TString.h"
00052 
00053 class TH1F;
00054 class TFile;
00055 
00056 namespace edm {
00057   class ParameterSet; class Event; class EventSetup;}
00058 
00059 class MuonSimHitsValidAnalyzer : public edm::EDAnalyzer
00060 {
00061   
00062  public:
00063 
00064   typedef std::vector<float> FloatVector;
00065   typedef std::vector<int>   IntegerVector;
00066   typedef std::vector<long int>   LongIntegerVector;
00067   typedef std::vector<unsigned int>   UnsigIntegerVector;
00068 
00069   explicit MuonSimHitsValidAnalyzer(const edm::ParameterSet&);
00070   virtual ~MuonSimHitsValidAnalyzer();
00071 
00072   virtual void beginJob();
00073   virtual void endJob();  
00074   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00075   
00076  private:
00077 
00078   void fillCSC(const edm::Event&, const edm::EventSetup&);
00079   void fillDT(const edm::Event&, const edm::EventSetup&);
00080   void fillRPC(const edm::Event&, const edm::EventSetup&);
00081 
00082   void bookHistos_DT();
00083   void bookHistos_CSC();
00084   void bookHistos_RPC();
00085   void saveHistos_DT();
00086   void saveHistos_CSC();
00087   void saveHistos_RPC();
00088 
00089  private:
00090 
00092   std::string fName;
00093   int verbosity;
00094   std::string label;
00095   bool getAllProvenances;
00096   bool printProvenanceInfo;
00097 
00098   std::string DToutputFile_;
00099   std::string CSCoutputFile_;
00100   std::string RPCoutputFile_;
00101 
00102   TFile *theDTFile;
00103   TFile *theCSCFile;
00104   TFile *theRPCFile;
00105 
00106 
00108   int nRawGenPart;
00109  
00110   unsigned int iden;
00111   Int_t wheel, station, sector, superlayer, layer, wire;
00112   Int_t region, ring, subsector, roll; 
00113   Int_t path, pathchamber;
00114   Int_t touch1, touch4, nummu_DT, nummu_RPC, nummu_CSC;
00115   Int_t touche1, touche4;
00116   Float_t pow6;
00117   Float_t mom1, mom4, mome1, mome4;
00118   Float_t costeta, radius,sinteta;
00119   Float_t globposx, globposy, globposz;
00120   Float_t globposphi, globposeta;
00121 
00123 
00124   edm::InputTag CSCHitsSrc_;
00125   edm::InputTag DTHitsSrc_;
00126   edm::InputTag RPCHitsSrc_;                                                
00127   
00128   // DaqMonitor element
00129   DQMStore* dbeDT_;
00130   DQMStore* dbeCSC_; 
00131   DQMStore* dbeRPC_;
00132 
00133 
00134   // Monitor elements
00135   // DT
00136   MonitorElement* meAllDTHits;
00137   MonitorElement* meMuDTHits;
00138   MonitorElement* meToF;
00139   MonitorElement* meEnergyLoss;
00140   MonitorElement* meMomentumMB1;
00141   MonitorElement* meMomentumMB4;
00142   MonitorElement* meLossMomIron;
00143   MonitorElement* meLocalXvsZ;
00144   MonitorElement* meLocalXvsY;
00145   MonitorElement* meGlobalXvsZ;
00146   MonitorElement* meGlobalXvsY;
00147   MonitorElement* meGlobalXvsZWm2;
00148   MonitorElement* meGlobalXvsZWm1;
00149   MonitorElement* meGlobalXvsZW0;
00150   MonitorElement* meGlobalXvsZWp1;
00151   MonitorElement* meGlobalXvsZWp2;
00152   MonitorElement* meGlobalXvsYWm2;
00153   MonitorElement* meGlobalXvsYWm1;
00154   MonitorElement* meGlobalXvsYW0;
00155   MonitorElement* meGlobalXvsYWp1;
00156   MonitorElement* meGlobalXvsYWp2;
00157   MonitorElement* meWheelOccup;
00158   MonitorElement* meStationOccup;
00159   MonitorElement* meSectorOccup;
00160   MonitorElement* meSuperLOccup;
00161   MonitorElement* meLayerOccup;
00162   MonitorElement* meWireOccup;
00163   MonitorElement* mePathMuon;
00164   MonitorElement* meChamberOccup;
00165   MonitorElement* meHitRadius;
00166   MonitorElement* meCosTheta;
00167   MonitorElement* meGlobalEta;
00168   MonitorElement* meGlobalPhi;
00169 
00170   //CSC
00171   MonitorElement* meAllCSCHits;
00172   MonitorElement* meMuCSCHits;
00173   MonitorElement* meEnergyLoss_111;
00174   MonitorElement* meToF_311;  
00175   MonitorElement* meEnergyLoss_112;
00176   MonitorElement* meToF_312;
00177   MonitorElement* meEnergyLoss_113;
00178   MonitorElement* meToF_313;
00179   MonitorElement* meEnergyLoss_114;
00180   MonitorElement* meToF_314;
00181   MonitorElement* meEnergyLoss_121;
00182   MonitorElement* meToF_321;
00183   MonitorElement* meEnergyLoss_122;
00184   MonitorElement* meToF_322;
00185   MonitorElement* meEnergyLoss_131;
00186   MonitorElement* meToF_331;
00187   MonitorElement* meEnergyLoss_132;
00188   MonitorElement* meToF_332;
00189   MonitorElement* meEnergyLoss_141;
00190   MonitorElement* meToF_341;
00191   MonitorElement* meEnergyLoss_211;
00192   MonitorElement* meToF_411;
00193   MonitorElement* meEnergyLoss_212;
00194   MonitorElement* meToF_412;
00195   MonitorElement* meEnergyLoss_213;
00196   MonitorElement* meToF_413;
00197   MonitorElement* meEnergyLoss_214;
00198   MonitorElement* meToF_414;
00199   MonitorElement* meEnergyLoss_221;
00200   MonitorElement* meToF_421;
00201   MonitorElement* meEnergyLoss_222;
00202   MonitorElement* meToF_422;
00203   MonitorElement* meEnergyLoss_231;
00204   MonitorElement* meToF_431;
00205   MonitorElement* meEnergyLoss_232;
00206   MonitorElement* meToF_432;
00207   MonitorElement* meEnergyLoss_241;
00208   MonitorElement* meToF_441;
00209 
00210   //RPC
00211   MonitorElement* meAllRPCHits;
00212   MonitorElement* meMuRPCHits;
00213   MonitorElement* meRegionOccup;
00214   MonitorElement* meRingOccBar;
00215   MonitorElement* meRingOccEndc;
00216   MonitorElement* meStatOccBar;
00217   MonitorElement* meStatOccEndc;
00218   MonitorElement* meSectorOccBar;
00219   MonitorElement* meSectorOccEndc;
00220   MonitorElement* meLayerOccBar;
00221   MonitorElement* meLayerOccEndc;
00222   MonitorElement* meSubSectOccBar;
00223   MonitorElement* meSubSectOccEndc;
00224   MonitorElement* meRollOccBar;
00225   MonitorElement* meRollOccEndc;
00226   MonitorElement* meElossBar;
00227   MonitorElement* meElossEndc;
00228   MonitorElement* mepathRPC;
00229   MonitorElement* meMomRB1;
00230   MonitorElement* meMomRB4;
00231   MonitorElement* meLossMomBar;
00232   MonitorElement* meMomRE1;
00233   MonitorElement* meMomRE4;
00234   MonitorElement* meLossMomEndc; 
00235   MonitorElement* meLocalXvsYBar;
00236   MonitorElement* meGlobalXvsZBar;
00237   MonitorElement* meGlobalXvsYBar;
00238   MonitorElement* meLocalXvsYEndc;
00239   MonitorElement* meGlobalXvsZEndc;
00240   MonitorElement* meGlobalXvsYEndc;
00241   MonitorElement* meHitRadiusBar;
00242   MonitorElement* meCosThetaBar;
00243   MonitorElement* meHitRadiusEndc;
00244   MonitorElement* meCosThetaEndc;
00245 
00246 
00248   unsigned int count;
00249 
00250 }; 
00251 
00253  
00254 static const int dMuon            = 2;
00255 
00256 static const int sdMuonDT         = 1;
00257 static const int sdMuonCSC        = 2;
00258 static const int sdMuonRPC        = 3;
00259 
00260 #endif