CMS 3D CMS Logo

SimHitTrackerAnalyzer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    SimHitTrackerAnalyzer
00004 // Class:      SimHitTrackerAnalyzer
00005 // 
00013 //
00014 // Original Author:  Tommaso Boccali
00015 //         Created:  Tue Jul 26 08:47:57 CEST 2005
00016 // $Id: SimHitTrackerAnalyzer.cc,v 1.1 2006/11/13 15:58:00 fambrogl Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 
00024 // user include files
00025 #include "AnalysisExamples/SimTrackerAnalysis/interface/SimHitTrackerAnalyzer.h"
00026 
00027 #include "FWCore/Framework/interface/Event.h"
00028 #include "FWCore/Framework/interface/EventSetup.h"
00029 #include "FWCore/Framework/interface/ESHandle.h"
00030 #include "FWCore/Framework/interface/MakerMacros.h"
00031 
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
00034 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00035 
00036 #include "DataFormats/DetId/interface/DetId.h"
00037 
00038 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00039 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00040 
00041 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00042 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00043 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00044 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00045 
00046 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00047 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00048 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00049 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00050 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00051 
00052 #include "TFile.h"
00053 #include "TH1.h"
00054 
00055 
00056 
00057 SimHitTrackerAnalyzer::SimHitTrackerAnalyzer( const edm::ParameterSet& iConfig ):
00058   fOutputFileName(iConfig.getUntrackedParameter("HistOutFile",std::string("TestHiggsMass.root"))),
00059   entryX_exitXTK(0),entryY_exitYTK(0),entryZ_exitZTK(0),energyLossTK(0),
00060   entryX_exitXPXB(0),entryY_exitYPXB(0),entryZ_exitZPXB(0),energyLossPXB(0),
00061   entryX_exitXPXF(0),entryY_exitYPXF(0),entryZ_exitZPXF(0),energyLossPXF(0),
00062   entryX_exitXTIB(0),entryY_exitYTIB(0),entryZ_exitZTIB(0),energyLossTIB(0),
00063   entryX_exitXTID(0),entryY_exitYTID(0),entryZ_exitZTID(0),energyLossTID(0),
00064   entryX_exitXTOB(0),entryY_exitYTOB(0),entryZ_exitZTOB(0),energyLossTOB(0),
00065   entryX_exitXTEC(0),entryY_exitYTEC(0),entryZ_exitZTEC(0),energyLossTEC(0),
00066   entryX_exitXPXB1(0),entryY_exitYPXB1(0),entryZ_exitZPXB1(0),energyLossPXB1(0),entryX_exitXPXB2(0), entryY_exitYPXB2(0),
00067   entryZ_exitZPXB2(0),energyLossPXB2(0),entryX_exitXPXB3(0),entryY_exitYPXB3(0),entryZ_exitZPXB3(0),energyLossPXB3(0),
00068   entryX_exitXPXF1(0),entryY_exitYPXF1(0),entryZ_exitZPXF1(0),energyLossPXF1(0),entryX_exitXPXF2(0),entryY_exitYPXF2(0),
00069   entryZ_exitZPXF2(0),energyLossPXF2(0),entryX_exitXTIB1(0),entryY_exitYTIB1(0),entryZ_exitZTIB1(0),energyLossTIB1(0),
00070   entryX_exitXTIB2(0),entryY_exitYTIB2(0),entryZ_exitZTIB2(0),energyLossTIB2(0),entryX_exitXTIB3(0),entryY_exitYTIB3(0),
00071   entryZ_exitZTIB3(0),energyLossTIB3(0),entryX_exitXTIB4(0),entryY_exitYTIB4(0),entryZ_exitZTIB4(0),energyLossTIB4(0),
00072   entryX_exitXTID1(0),entryY_exitYTID1(0),entryZ_exitZTID1(0),energyLossTID1(0),entryX_exitXTID2(0),entryY_exitYTID2(0),
00073   entryZ_exitZTID2(0),energyLossTID2(0),entryX_exitXTID3(0),entryY_exitYTID3(0),entryZ_exitZTID3(0),energyLossTID3(0),
00074   entryX_exitXTOB1(0),entryY_exitYTOB1(0),entryZ_exitZTOB1(0),energyLossTOB1(0),entryX_exitXTOB2(0),entryY_exitYTOB2(0),
00075   entryZ_exitZTOB2(0),energyLossTOB2(0),entryX_exitXTOB3(0),entryY_exitYTOB3(0),entryZ_exitZTOB3(0),energyLossTOB3(0),
00076   entryX_exitXTOB4(0),entryY_exitYTOB4(0),entryZ_exitZTOB4(0),energyLossTOB4(0),entryX_exitXTOB5(0),entryY_exitYTOB5(0),
00077   entryZ_exitZTOB5(0),energyLossTOB5(0),entryX_exitXTOB6(0),entryY_exitYTOB6(0),entryZ_exitZTOB6(0),energyLossTOB6(0),
00078   entryX_exitXTEC1(0),entryY_exitYTEC1(0),entryZ_exitZTEC1(0),energyLossTEC1(0),entryX_exitXTEC2(0),entryY_exitYTEC2(0),
00079   entryZ_exitZTEC2(0),energyLossTEC2(0),entryX_exitXTEC3(0),entryY_exitYTEC3(0),entryZ_exitZTEC3(0),energyLossTEC3(0),
00080   entryX_exitXTEC4(0),entryY_exitYTEC4(0),entryZ_exitZTEC4(0),energyLossTEC4(0),entryX_exitXTEC5(0),entryY_exitYTEC5(0),
00081   entryZ_exitZTEC5(0),energyLossTEC5(0),entryX_exitXTEC6(0),entryY_exitYTEC6(0),entryZ_exitZTEC6(0),energyLossTEC6(0),
00082   entryX_exitXTEC7(0),entryY_exitYTEC7(0),entryZ_exitZTEC7(0),energyLossTEC7(0),entryX_exitXTEC8(0),entryY_exitYTEC8(0),
00083   entryZ_exitZTEC8(0),energyLossTEC8(0),entryX_exitXTEC9(0),entryY_exitYTEC9(0),entryZ_exitZTEC9(0),energyLossTEC9(0),
00084   numbHitsForDet(0),histoPlot(0)
00085 {
00086    //now do what ever initialization is needed
00087 }
00088 
00089 void SimHitTrackerAnalyzer::beginJob(const edm::EventSetup&){
00090 
00091   histoPlot = new TFile(fOutputFileName.c_str(),"RECREATE");
00092 
00093   entryX_exitXTK  = new TH1D(  "HistEntryExitXTK"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00094   entryY_exitYTK  = new TH1D(  "HistEntryExitYTK"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00095   entryZ_exitZTK  = new TH1D(  "HistEntryExitZTK"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00096   energyLossTK    = new TH1D(  "HistEnergyLossTK"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00097 
00098 
00099   //PXB histo              
00100   entryX_exitXPXB  = new TH1D(  "HistEntryExitXPXB"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00101   entryY_exitYPXB  = new TH1D(  "HistEntryExitYPXB"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00102   entryZ_exitZPXB  = new TH1D(  "HistEntryExitZPXB"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00103   energyLossPXB    = new TH1D(  "HistEnergyLossPXB"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00104 
00105   entryX_exitXPXB1  = new TH1D(  "HistEntryExitXPXB1"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00106   entryY_exitYPXB1  = new TH1D(  "HistEntryExitYPXB1"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00107   entryZ_exitZPXB1  = new TH1D(  "HistEntryExitZPXB1"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00108   energyLossPXB1    = new TH1D(  "HistEnergyLossPXB1"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00109   entryX_exitXPXB2  = new TH1D(  "HistEntryExitXPXB2"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00110   entryY_exitYPXB2  = new TH1D(  "HistEntryExitYPXB2"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00111   entryZ_exitZPXB2  = new TH1D(  "HistEntryExitZPXB2"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00112   energyLossPXB2    = new TH1D(  "HistEnergyLossPXB2"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00113   entryX_exitXPXB3  = new TH1D(  "HistEntryExitXPXB3"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00114   entryY_exitYPXB3  = new TH1D(  "HistEntryExitYPXB3"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00115   entryZ_exitZPXB3  = new TH1D(  "HistEntryExitZPXB3"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00116   energyLossPXB3    = new TH1D(  "HistEnergyLossPXB3"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00117                            
00118   //PXF histo              
00119   entryX_exitXPXF  = new TH1D(  "HistEntryExitXPXF"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00120   entryY_exitYPXF  = new TH1D(  "HistEntryExitYPXF"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00121   entryZ_exitZPXF  = new TH1D(  "HistEntryExitZPXF"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00122   energyLossPXF    = new TH1D(  "HistEnergyLossPXF"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00123 
00124   entryX_exitXPXF1  = new TH1D(  "HistEntryExitXPXF1"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00125   entryY_exitYPXF1  = new TH1D(  "HistEntryExitYPXF1"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00126   entryZ_exitZPXF1  = new TH1D(  "HistEntryExitZPXF1"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00127   energyLossPXF1    = new TH1D(  "HistEnergyLossPXF1"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00128   entryX_exitXPXF2  = new TH1D(  "HistEntryExitXPXF2"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00129   entryY_exitYPXF2  = new TH1D(  "HistEntryExitYPXF2"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00130   entryZ_exitZPXF2  = new TH1D(  "HistEntryExitZPXF2"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00131   energyLossPXF2    = new TH1D(  "HistEnergyLossPXF2"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00132                            
00133   //TIB histo              
00134   entryX_exitXTIB  = new TH1D(  "HistEntryExitXTIB"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00135   entryY_exitYTIB  = new TH1D(  "HistEntryExitYTIB"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00136   entryZ_exitZTIB  = new TH1D(  "HistEntryExitZTIB"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00137   energyLossTIB    = new TH1D(  "HistEnergyLossTIB"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00138 
00139   entryX_exitXTIB1  = new TH1D(  "HistEntryExitXTIB1"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00140   entryY_exitYTIB1  = new TH1D(  "HistEntryExitYTIB1"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00141   entryZ_exitZTIB1  = new TH1D(  "HistEntryExitZTIB1"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00142   energyLossTIB1    = new TH1D(  "HistEnergyLossTIB1"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00143   entryX_exitXTIB2  = new TH1D(  "HistEntryExitXTIB2"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00144   entryY_exitYTIB2  = new TH1D(  "HistEntryExitYTIB2"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00145   entryZ_exitZTIB2  = new TH1D(  "HistEntryExitZTIB2"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00146   energyLossTIB2    = new TH1D(  "HistEnergyLossTIB2"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00147   entryX_exitXTIB3  = new TH1D(  "HistEntryExitXTIB3"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00148   entryY_exitYTIB3  = new TH1D(  "HistEntryExitYTIB3"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00149   entryZ_exitZTIB3  = new TH1D(  "HistEntryExitZTIB3"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00150   energyLossTIB3    = new TH1D(  "HistEnergyLossTIB3"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00151   entryX_exitXTIB4  = new TH1D(  "HistEntryExitXTIB4"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00152   entryY_exitYTIB4  = new TH1D(  "HistEntryExitYTIB4"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00153   entryZ_exitZTIB4  = new TH1D(  "HistEntryExitZTIB4"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00154   energyLossTIB4    = new TH1D(  "HistEnergyLossTIB4"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00155                            
00156   //TID histo              
00157   entryX_exitXTID  = new TH1D(  "HistEntryExitXTID"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00158   entryY_exitYTID  = new TH1D(  "HistEntryExitYTID"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00159   entryZ_exitZTID  = new TH1D(  "HistEntryExitZTID"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00160   energyLossTID    = new TH1D(  "HistEnergyLossTID"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00161 
00162   entryX_exitXTID1  = new TH1D(  "HistEntryExitXTID1"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00163   entryY_exitYTID1  = new TH1D(  "HistEntryExitYTID1"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00164   entryZ_exitZTID1  = new TH1D(  "HistEntryExitZTID1"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00165   energyLossTID1    = new TH1D(  "HistEnergyLossTID1"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00166   entryX_exitXTID2  = new TH1D(  "HistEntryExitXTID2"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00167   entryY_exitYTID2  = new TH1D(  "HistEntryExitYTID2"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00168   entryZ_exitZTID2  = new TH1D(  "HistEntryExitZTID2"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00169   energyLossTID2    = new TH1D(  "HistEnergyLossTID2"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00170   entryX_exitXTID3  = new TH1D(  "HistEntryExitXTID3"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00171   entryY_exitYTID3  = new TH1D(  "HistEntryExitYTID3"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00172   entryZ_exitZTID3  = new TH1D(  "HistEntryExitZTID3"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00173   energyLossTID3    = new TH1D(  "HistEnergyLossTID3"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00174                            
00175   //TOB histo              
00176   entryX_exitXTOB  = new TH1D(  "HistEntryExitXTOB"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00177   entryY_exitYTOB  = new TH1D(  "HistEntryExitYTOB"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00178   entryZ_exitZTOB  = new TH1D(  "HistEntryExitZTOB"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00179   energyLossTOB    = new TH1D(  "HistEnergyLossTOB"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00180 
00181   entryX_exitXTOB1  = new TH1D(  "HistEntryExitXTOB1"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00182   entryY_exitYTOB1  = new TH1D(  "HistEntryExitYTOB1"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00183   entryZ_exitZTOB1  = new TH1D(  "HistEntryExitZTOB1"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00184   energyLossTOB1    = new TH1D(  "HistEnergyLossTOB1"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00185   entryX_exitXTOB2  = new TH1D(  "HistEntryExitXTOB2"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00186   entryY_exitYTOB2  = new TH1D(  "HistEntryExitYTOB2"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00187   entryZ_exitZTOB2  = new TH1D(  "HistEntryExitZTOB2"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00188   energyLossTOB2    = new TH1D(  "HistEnergyLossTOB2"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00189   entryX_exitXTOB3  = new TH1D(  "HistEntryExitXTOB3"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00190   entryY_exitYTOB3  = new TH1D(  "HistEntryExitYTOB3"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00191   entryZ_exitZTOB3  = new TH1D(  "HistEntryExitZTOB3"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00192   energyLossTOB3    = new TH1D(  "HistEnergyLossTOB3"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00193   entryX_exitXTOB4  = new TH1D(  "HistEntryExitXTOB4"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00194   entryY_exitYTOB4  = new TH1D(  "HistEntryExitYTOB4"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00195   entryZ_exitZTOB4  = new TH1D(  "HistEntryExitZTOB4"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00196   energyLossTOB4    = new TH1D(  "HistEnergyLossTOB4"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00197   entryX_exitXTOB5  = new TH1D(  "HistEntryExitXTOB5"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00198   entryY_exitYTOB5  = new TH1D(  "HistEntryExitYTOB5"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00199   entryZ_exitZTOB5  = new TH1D(  "HistEntryExitZTOB5"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00200   energyLossTOB5    = new TH1D(  "HistEnergyLossTOB5"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00201   entryX_exitXTOB6  = new TH1D(  "HistEntryExitXTOB6"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00202   entryY_exitYTOB6  = new TH1D(  "HistEntryExitYTOB6"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00203   entryZ_exitZTOB6  = new TH1D(  "HistEntryExitZTOB6"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00204   energyLossTOB6    = new TH1D(  "HistEnergyLossTOB6"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00205                            
00206   //TEC histo              
00207   entryX_exitXTEC  = new TH1D(  "HistEntryExitXTEC"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00208   entryY_exitYTEC  = new TH1D(  "HistEntryExitYTEC"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00209   entryZ_exitZTEC  = new TH1D(  "HistEntryExitZTEC"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00210   energyLossTEC    = new TH1D(  "HistEnergyLossTEC"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00211 
00212   entryX_exitXTEC1  = new TH1D(  "HistEntryExitXTEC1"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00213   entryY_exitYTEC1  = new TH1D(  "HistEntryExitYTEC1"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00214   entryZ_exitZTEC1  = new TH1D(  "HistEntryExitZTEC1"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00215   energyLossTEC1    = new TH1D(  "HistEnergyLossTEC1"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00216   entryX_exitXTEC2  = new TH1D(  "HistEntryExitXTEC2"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00217   entryY_exitYTEC2  = new TH1D(  "HistEntryExitYTEC2"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00218   entryZ_exitZTEC2  = new TH1D(  "HistEntryExitZTEC2"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00219   energyLossTEC2    = new TH1D(  "HistEnergyLossTEC2"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00220   entryX_exitXTEC3  = new TH1D(  "HistEntryExitXTEC3"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00221   entryY_exitYTEC3  = new TH1D(  "HistEntryExitYTEC3"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00222   entryZ_exitZTEC3  = new TH1D(  "HistEntryExitZTEC3"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00223   energyLossTEC3    = new TH1D(  "HistEnergyLossTEC3"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00224   entryX_exitXTEC4  = new TH1D(  "HistEntryExitXTEC4"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00225   entryY_exitYTEC4  = new TH1D(  "HistEntryExitYTEC4"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00226   entryZ_exitZTEC4  = new TH1D(  "HistEntryExitZTEC4"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00227   energyLossTEC4    = new TH1D(  "HistEnergyLossTEC4"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00228   entryX_exitXTEC5  = new TH1D(  "HistEntryExitXTEC5"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00229   entryY_exitYTEC5  = new TH1D(  "HistEntryExitYTEC5"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00230   entryZ_exitZTEC5  = new TH1D(  "HistEntryExitZTEC5"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00231   energyLossTEC5    = new TH1D(  "HistEnergyLossTEC5"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00232   entryX_exitXTEC6  = new TH1D(  "HistEntryExitXTEC6"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00233   entryY_exitYTEC6  = new TH1D(  "HistEntryExitYTEC6"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00234   entryZ_exitZTEC6  = new TH1D(  "HistEntryExitZTEC6"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00235   energyLossTEC6    = new TH1D(  "HistEnergyLossTEC6"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00236   entryX_exitXTEC7  = new TH1D(  "HistEntryExitXTEC7"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00237   entryY_exitYTEC7  = new TH1D(  "HistEntryExitYTEC7"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00238   entryZ_exitZTEC7  = new TH1D(  "HistEntryExitZTEC7"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00239   energyLossTEC7    = new TH1D(  "HistEnergyLossTEC7"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00240   entryX_exitXTEC8  = new TH1D(  "HistEntryExitXTEC8"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00241   entryY_exitYTEC8  = new TH1D(  "HistEntryExitYTEC8"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00242   entryZ_exitZTEC8  = new TH1D(  "HistEntryExitZTEC8"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00243   energyLossTEC8    = new TH1D(  "HistEnergyLossTEC8"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00244   entryX_exitXTEC9  = new TH1D(  "HistEntryExitXTEC9"  , "EntryX - ExitX" , 100,  -0.03, 0.03 ) ;
00245   entryY_exitYTEC9  = new TH1D(  "HistEntryExitYTEC9"  , "EntryY - ExitY" , 100,  -0.03, 0.03 ) ;
00246   entryZ_exitZTEC9  = new TH1D(  "HistEntryExitZTEC9"  , "EntryZ - ExitZ" , 100,  -0.03, 0.03 ) ;
00247   energyLossTEC9    = new TH1D(  "HistEnergyLossTEC9"  , "EnergyLoss" , 100,  0., 0.001 ) ;
00248 
00249   numbHitsForDet    = new TH1D(  "NumbHitsInDet"  , "Hits per Det" , 20,  0., 20. ) ;  
00250 
00251   return;
00252 
00253 }
00254 
00255 //
00256 // member functions
00257 //
00258 
00259 // ------------ method called to produce the data  ------------
00260 void SimHitTrackerAnalyzer::analyze( const edm::Event& iEvent, const edm::EventSetup& iSetup ){
00261 
00262    using namespace edm;
00263 
00264    std::vector<PSimHit> theTrackerHits;
00265    // take the Geometry
00266    edm::ESHandle<TrackerGeometry> pDD;
00267    iSetup.get<TrackerDigiGeometryRecord>().get( pDD );     
00268 
00269    //   Handle<HepMCProduct> MCEvt;
00270    Handle<PSimHitContainer> PixelBarrelHitsLowTof;
00271    Handle<PSimHitContainer> PixelBarrelHitsHighTof;
00272    Handle<PSimHitContainer> PixelEndcapHitsLowTof;
00273    Handle<PSimHitContainer> PixelEndcapHitsHighTof;
00274    Handle<PSimHitContainer> TIBHitsLowTof;
00275    Handle<PSimHitContainer> TIBHitsHighTof;
00276    Handle<PSimHitContainer> TIDHitsLowTof;
00277    Handle<PSimHitContainer> TIDHitsHighTof;
00278    Handle<PSimHitContainer> TOBHitsLowTof;
00279    Handle<PSimHitContainer> TOBHitsHighTof;
00280    Handle<PSimHitContainer> TECHitsLowTof;
00281    Handle<PSimHitContainer> TECHitsHighTof;
00282 
00283    iEvent.getByLabel("g4SimHits","TrackerHitsPixelBarrelLowTof", PixelBarrelHitsLowTof);
00284    iEvent.getByLabel("g4SimHits","TrackerHitsPixelBarrelHighTof", PixelBarrelHitsHighTof);
00285    iEvent.getByLabel("g4SimHits","TrackerHitsPixelEndcapLowTof", PixelEndcapHitsLowTof);
00286    iEvent.getByLabel("g4SimHits","TrackerHitsPixelEndcapHighTof", PixelEndcapHitsHighTof);
00287    iEvent.getByLabel("g4SimHits","TrackerHitsTIBLowTof", TIBHitsLowTof);
00288    iEvent.getByLabel("g4SimHits","TrackerHitsTIBHighTof", TIBHitsHighTof);
00289    iEvent.getByLabel("g4SimHits","TrackerHitsTIDLowTof", TIDHitsLowTof);
00290    iEvent.getByLabel("g4SimHits","TrackerHitsTIDHighTof", TIDHitsHighTof);
00291    iEvent.getByLabel("g4SimHits","TrackerHitsTOBLowTof", TOBHitsLowTof);
00292    iEvent.getByLabel("g4SimHits","TrackerHitsTOBHighTof", TOBHitsHighTof);
00293    iEvent.getByLabel("g4SimHits","TrackerHitsTECLowTof", TECHitsLowTof);
00294    iEvent.getByLabel("g4SimHits","TrackerHitsTECHighTof", TECHitsHighTof);
00295 
00296    theTrackerHits.insert(theTrackerHits.end(), PixelBarrelHitsLowTof->begin(), PixelBarrelHitsLowTof->end()); 
00297    theTrackerHits.insert(theTrackerHits.end(), PixelBarrelHitsHighTof->begin(), PixelBarrelHitsHighTof->end());
00298    theTrackerHits.insert(theTrackerHits.end(), PixelEndcapHitsLowTof->begin(), PixelEndcapHitsLowTof->end()); 
00299    theTrackerHits.insert(theTrackerHits.end(), PixelEndcapHitsHighTof->begin(), PixelEndcapHitsHighTof->end());
00300    theTrackerHits.insert(theTrackerHits.end(), TIBHitsLowTof->begin(), TIBHitsLowTof->end()); 
00301    theTrackerHits.insert(theTrackerHits.end(), TIBHitsHighTof->begin(), TIBHitsHighTof->end());
00302    theTrackerHits.insert(theTrackerHits.end(), TIDHitsLowTof->begin(), TIDHitsLowTof->end()); 
00303    theTrackerHits.insert(theTrackerHits.end(), TIDHitsHighTof->begin(), TIDHitsHighTof->end());
00304    theTrackerHits.insert(theTrackerHits.end(), TOBHitsLowTof->begin(), TOBHitsLowTof->end()); 
00305    theTrackerHits.insert(theTrackerHits.end(), TOBHitsHighTof->begin(), TOBHitsHighTof->end());
00306    theTrackerHits.insert(theTrackerHits.end(), TECHitsLowTof->begin(), TECHitsLowTof->end()); 
00307    theTrackerHits.insert(theTrackerHits.end(), TECHitsHighTof->begin(), TECHitsHighTof->end());
00308 
00309    std::map<unsigned int, unsigned int,std::less<unsigned int> > SimHitMap;
00310 
00311    for (std::vector<PSimHit>::iterator isim = theTrackerHits.begin();
00312         isim != theTrackerHits.end(); ++isim){
00313      DetId tkId(isim->detUnitId());
00314 
00315      SimHitMap[(*isim).detUnitId()]++;
00316 
00317      float entryX = (isim->entryPoint()).x();
00318      float entryY = (isim->entryPoint()).y();
00319      float entryZ = (isim->entryPoint()).z();
00320      
00321      float exitX = (isim->exitPoint()).x();
00322      float exitY = (isim->exitPoint()).y();
00323      float exitZ = (isim->exitPoint()).z();
00324      
00325      float eloss = isim->energyLoss();
00326      
00327      entryX_exitXTK->Fill(entryX-exitX);
00328      entryY_exitYTK->Fill(entryY-exitY);
00329      entryZ_exitZTK->Fill(entryZ-exitZ);
00330      energyLossTK->Fill(eloss);
00331 
00332      if(tkId.subdetId()==1){
00333        PXBDetId pxbId(tkId);
00334        entryX_exitXPXB->Fill(entryX-exitX);
00335        entryY_exitYPXB->Fill(entryY-exitY);
00336        entryZ_exitZPXB->Fill(entryZ-exitZ);
00337        energyLossPXB->Fill(eloss);
00338        if(pxbId.layer()==1){
00339          entryX_exitXPXB1->Fill(entryX-exitX);
00340          entryY_exitYPXB1->Fill(entryY-exitY);
00341          entryZ_exitZPXB1->Fill(entryZ-exitZ);
00342          energyLossPXB1->Fill(eloss);
00343        }else if(pxbId.layer()==2){
00344          entryX_exitXPXB2->Fill(entryX-exitX);
00345          entryY_exitYPXB2->Fill(entryY-exitY);
00346          entryZ_exitZPXB2->Fill(entryZ-exitZ);
00347          energyLossPXB2->Fill(eloss);
00348        }else if(pxbId.layer()==3){
00349          entryX_exitXPXB3->Fill(entryX-exitX);
00350          entryY_exitYPXB3->Fill(entryY-exitY);
00351          entryZ_exitZPXB3->Fill(entryZ-exitZ);
00352          energyLossPXB3->Fill(eloss);
00353        }
00354      }else if(tkId.subdetId()==2){
00355        PXFDetId pxfId(tkId);
00356        entryX_exitXPXF->Fill(entryX-exitX);
00357        entryY_exitYPXF->Fill(entryY-exitY);
00358        entryZ_exitZPXF->Fill(entryZ-exitZ);
00359        energyLossPXF->Fill(eloss);
00360        if(pxfId.disk()==1){
00361          entryX_exitXPXF1->Fill(entryX-exitX);
00362          entryY_exitYPXF1->Fill(entryY-exitY);
00363          entryZ_exitZPXF1->Fill(entryZ-exitZ);
00364          energyLossPXF1->Fill(eloss);
00365        }else if(pxfId.disk()==2){
00366          entryX_exitXPXF2->Fill(entryX-exitX);
00367          entryY_exitYPXF2->Fill(entryY-exitY);
00368          entryZ_exitZPXF2->Fill(entryZ-exitZ);
00369          energyLossPXF2->Fill(eloss);
00370        }
00371      }else if(tkId.subdetId()==3){
00372        TIBDetId tibId(tkId);
00373        entryX_exitXTIB->Fill(entryX-exitX);
00374        entryY_exitYTIB->Fill(entryY-exitY);
00375        entryZ_exitZTIB->Fill(entryZ-exitZ);
00376        energyLossTIB->Fill(eloss);
00377        if(tibId.layer()==1){
00378          entryX_exitXTIB1->Fill(entryX-exitX);
00379          entryY_exitYTIB1->Fill(entryY-exitY);
00380          entryZ_exitZTIB1->Fill(entryZ-exitZ);
00381          energyLossTIB1->Fill(eloss);
00382        }else if(tibId.layer()==2){
00383          entryX_exitXTIB2->Fill(entryX-exitX);
00384          entryY_exitYTIB2->Fill(entryY-exitY);
00385          entryZ_exitZTIB2->Fill(entryZ-exitZ);
00386          energyLossTIB2->Fill(eloss);
00387        }else if(tibId.layer()==3){
00388          entryX_exitXTIB3->Fill(entryX-exitX);
00389          entryY_exitYTIB3->Fill(entryY-exitY);
00390          entryZ_exitZTIB3->Fill(entryZ-exitZ);
00391          energyLossTIB3->Fill(eloss);
00392        }else if(tibId.layer()==4){
00393          entryX_exitXTIB4->Fill(entryX-exitX);
00394          entryY_exitYTIB4->Fill(entryY-exitY);
00395          entryZ_exitZTIB4->Fill(entryZ-exitZ);
00396          energyLossTIB3->Fill(eloss);
00397        }
00398      }else if(tkId.subdetId()==4){
00399        TIDDetId tidId(tkId);
00400        entryX_exitXTID->Fill(entryX-exitX);
00401        entryY_exitYTID->Fill(entryY-exitY);
00402        entryZ_exitZTID->Fill(entryZ-exitZ);
00403        energyLossTID->Fill(eloss);
00404        if(tidId.wheel()==1){
00405          entryX_exitXTID1->Fill(entryX-exitX);
00406          entryY_exitYTID1->Fill(entryY-exitY);
00407          entryZ_exitZTID1->Fill(entryZ-exitZ);
00408          energyLossTID1->Fill(eloss);
00409        }else if(tidId.wheel()==2){
00410          entryX_exitXTID2->Fill(entryX-exitX);
00411          entryY_exitYTID2->Fill(entryY-exitY);
00412          entryZ_exitZTID2->Fill(entryZ-exitZ);
00413          energyLossTID2->Fill(eloss);
00414        }else if(tidId.wheel()==3){
00415          entryX_exitXTID3->Fill(entryX-exitX);
00416          entryY_exitYTID3->Fill(entryY-exitY);
00417          entryZ_exitZTID3->Fill(entryZ-exitZ);
00418          energyLossTID3->Fill(eloss);
00419        }
00420      }else if(tkId.subdetId()==5){
00421        TOBDetId tobId(tkId);
00422        entryX_exitXTOB->Fill(entryX-exitX);
00423        entryY_exitYTOB->Fill(entryY-exitY);
00424        entryZ_exitZTOB->Fill(entryZ-exitZ);
00425        energyLossTOB->Fill(eloss);
00426        if(tobId.layer()==1){
00427          entryX_exitXTOB1->Fill(entryX-exitX);
00428          entryY_exitYTOB1->Fill(entryY-exitY);
00429          entryZ_exitZTOB1->Fill(entryZ-exitZ);
00430          energyLossTOB1->Fill(eloss);
00431        }else if(tobId.layer()==2){
00432          entryX_exitXTOB2->Fill(entryX-exitX);
00433          entryY_exitYTOB2->Fill(entryY-exitY);
00434          entryZ_exitZTOB2->Fill(entryZ-exitZ);
00435          energyLossTOB2->Fill(eloss);
00436        }else if(tobId.layer()==3){
00437          entryX_exitXTOB3->Fill(entryX-exitX);
00438          entryY_exitYTOB3->Fill(entryY-exitY);
00439          entryZ_exitZTOB3->Fill(entryZ-exitZ);
00440          energyLossTOB3->Fill(eloss);
00441        }else if(tobId.layer()==4){
00442          entryX_exitXTOB4->Fill(entryX-exitX);
00443          entryY_exitYTOB4->Fill(entryY-exitY);
00444          entryZ_exitZTOB4->Fill(entryZ-exitZ);
00445          energyLossTOB4->Fill(eloss);
00446        }else if(tobId.layer()==5){
00447          entryX_exitXTOB5->Fill(entryX-exitX);
00448          entryY_exitYTOB5->Fill(entryY-exitY);
00449          entryZ_exitZTOB5->Fill(entryZ-exitZ);
00450          energyLossTOB5->Fill(eloss);
00451        }else if(tobId.layer()==6){
00452          entryX_exitXTOB6->Fill(entryX-exitX);
00453          entryY_exitYTOB6->Fill(entryY-exitY);
00454          entryZ_exitZTOB6->Fill(entryZ-exitZ);
00455          energyLossTOB6->Fill(eloss);
00456        }
00457      }else if(tkId.subdetId()==6){
00458        TECDetId tecId(tkId);
00459        entryX_exitXTEC->Fill(entryX-exitX);
00460        entryY_exitYTEC->Fill(entryY-exitY);
00461        entryZ_exitZTEC->Fill(entryZ-exitZ);
00462        energyLossTEC->Fill(eloss);
00463        if(tecId.wheel()==1){
00464          entryX_exitXTEC1->Fill(entryX-exitX);
00465          entryY_exitYTEC1->Fill(entryY-exitY);
00466          entryZ_exitZTEC1->Fill(entryZ-exitZ);
00467          energyLossTEC1->Fill(eloss);
00468        }else if(tecId.wheel()==2){
00469          entryX_exitXTEC2->Fill(entryX-exitX);
00470          entryY_exitYTEC2->Fill(entryY-exitY);
00471          entryZ_exitZTEC2->Fill(entryZ-exitZ);
00472          energyLossTEC2->Fill(eloss);
00473        }else if(tecId.wheel()==3){
00474          entryX_exitXTEC3->Fill(entryX-exitX);
00475          entryY_exitYTEC3->Fill(entryY-exitY);
00476          entryZ_exitZTEC3->Fill(entryZ-exitZ);
00477          energyLossTEC3->Fill(eloss);
00478        }else if(tecId.wheel()==4){
00479          entryX_exitXTEC4->Fill(entryX-exitX);
00480          entryY_exitYTEC4->Fill(entryY-exitY);
00481          entryZ_exitZTEC4->Fill(entryZ-exitZ);
00482          energyLossTEC4->Fill(eloss);
00483        }else if(tecId.wheel()==5){
00484          entryX_exitXTEC5->Fill(entryX-exitX);
00485          entryY_exitYTEC5->Fill(entryY-exitY);
00486          entryZ_exitZTEC5->Fill(entryZ-exitZ);
00487          energyLossTEC5->Fill(eloss);
00488        }else if(tecId.wheel()==6){
00489          entryX_exitXTEC6->Fill(entryX-exitX);
00490          entryY_exitYTEC6->Fill(entryY-exitY);
00491          entryZ_exitZTEC6->Fill(entryZ-exitZ);
00492          energyLossTEC6->Fill(eloss);
00493        }else if(tecId.wheel()==7){
00494          entryX_exitXTEC7->Fill(entryX-exitX);
00495          entryY_exitYTEC7->Fill(entryY-exitY);
00496          entryZ_exitZTEC7->Fill(entryZ-exitZ);
00497          energyLossTEC7->Fill(eloss);
00498        }else if(tecId.wheel()==8){
00499          entryX_exitXTEC8->Fill(entryX-exitX);
00500          entryY_exitYTEC8->Fill(entryY-exitY);
00501          entryZ_exitZTEC8->Fill(entryZ-exitZ);
00502          energyLossTEC8->Fill(eloss);
00503        }else if(tecId.wheel()==9){
00504          entryX_exitXTEC9->Fill(entryX-exitX);
00505          entryY_exitYTEC9->Fill(entryY-exitY);
00506          entryZ_exitZTEC9->Fill(entryZ-exitZ);
00507          energyLossTEC9->Fill(eloss);
00508        }
00509      }
00510 
00511    }
00512 
00513    for(std::vector<GeomDetUnit*>::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
00514      unsigned int moduleId = (*it)->geographicalId().rawId();  
00515      if (SimHitMap.find(moduleId) != SimHitMap.end()){
00516        numbHitsForDet->Fill((SimHitMap.find(moduleId))->second); 
00517      }
00518    }    
00519 
00520    return;
00521 
00522 }
00523 
00524 
00525 void SimHitTrackerAnalyzer::endJob(){
00526 
00527   histoPlot->Write() ;
00528   histoPlot->Close() ;
00529   
00530   return ;
00531 }

Generated on Tue Jun 9 17:25:10 2009 for CMSSW by  doxygen 1.5.4