CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/TrackingMonitor/src/TrackAnalyzer.cc

Go to the documentation of this file.
00001 /*
00002  *  See header file for a description of this class.
00003  *
00004  *  $Date: 2011/10/25 09:11:43 $
00005  *  $Revision: 1.18 $
00006  *  \author Suchandra Dutta , Giorgia Mila
00007  */
00008 
00009 #include "DataFormats/TrackReco/interface/Track.h"
00010 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00011 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00012 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
00013 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00014 #include "MagneticField/Engine/interface/MagneticField.h"
00015 
00016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00017 #include "FWCore/Utilities/interface/InputTag.h"
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019 #include "DQM/TrackingMonitor/interface/TrackAnalyzer.h"
00020 #include <string>
00021 #include "TMath.h"
00022 
00023 TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig) 
00024     : conf_( iConfig )
00025     , doTrackerSpecific_( conf_.getParameter<bool>("doTrackerSpecific") )
00026     , doAllPlots_( conf_.getParameter<bool>("doAllPlots") )
00027     , doBSPlots_ ( conf_.getParameter<bool>("doBeamSpotPlots") )
00028     , doGoodTrackPlots_ ( conf_.getParameter<bool>("doGoodTrackPlots") )
00029     , doDCAPlots_ ( conf_.getParameter<bool>("doDCAPlots") )
00030     , doGeneralPropertiesPlots_ ( conf_.getParameter<bool>("doGeneralPropertiesPlots") )
00031     , doMeasurementStatePlots_( conf_.getParameter<bool>("doMeasurementStatePlots") )
00032     , doHitPropertiesPlots_ ( conf_.getParameter<bool>("doHitPropertiesPlots") )
00033     , doRecHitVsPhiVsEtaPerTrack_ ( conf_.getParameter<bool>("doRecHitVsPhiVsEtaPerTrack") )
00034     , doGoodTrackRecHitVsPhiVsEtaPerTrack_ ( conf_.getParameter<bool>("doGoodTrackRecHitVsPhiVsEtaPerTrack") )
00035     , NumberOfRecHitsPerTrack(NULL)
00036     , NumberOfRecHitsFoundPerTrack(NULL)
00037     , NumberOfRecHitsLostPerTrack(NULL)
00038     , NumberOfLayersPerTrack(NULL)
00039     , NumberOfRecHitVsPhiVsEtaPerTrack(NULL)
00040     , GoodTrackNumberOfRecHitVsPhiVsEtaPerTrack(NULL)
00041     , Chi2(NULL)
00042     , Chi2Prob(NULL)
00043     , Chi2oNDF(NULL)
00044     , DistanceOfClosestApproach(NULL)
00045     , DistanceOfClosestApproachToBS(NULL)
00046     , DistanceOfClosestApproachVsTheta(NULL)
00047     , DistanceOfClosestApproachVsPhi(NULL)
00048     , DistanceOfClosestApproachToBSVsPhi(NULL)
00049     , DistanceOfClosestApproachVsEta(NULL)
00050     , xPointOfClosestApproach(NULL)
00051     , xPointOfClosestApproachVsZ0(NULL)
00052     , yPointOfClosestApproach(NULL)
00053     , yPointOfClosestApproachVsZ0(NULL)
00054     , zPointOfClosestApproach(NULL)
00055 
00056     , NumberOfTOBRecHitsPerTrack(NULL)
00057     , NumberOfTOBRecHitsPerTrackVsPhiProfile(NULL)
00058     , NumberOfTOBRecHitsPerTrackVsEtaProfile(NULL)
00059     , NumberOfTOBLayersPerTrack(NULL)
00060     , NumberOfTOBLayersPerTrackVsPhiProfile(NULL)
00061     , NumberOfTOBLayersPerTrackVsEtaProfile(NULL)
00062 
00063     , NumberOfTIBRecHitsPerTrack(NULL)
00064     , NumberOfTIBRecHitsPerTrackVsPhiProfile(NULL)
00065     , NumberOfTIBRecHitsPerTrackVsEtaProfile(NULL)
00066     , NumberOfTIBLayersPerTrack(NULL)
00067     , NumberOfTIBLayersPerTrackVsPhiProfile(NULL)
00068     , NumberOfTIBLayersPerTrackVsEtaProfile(NULL)
00069 
00070     , NumberOfTIDRecHitsPerTrack(NULL)
00071     , NumberOfTIDRecHitsPerTrackVsPhiProfile(NULL)
00072     , NumberOfTIDRecHitsPerTrackVsEtaProfile(NULL)
00073     , NumberOfTIDLayersPerTrack(NULL)
00074     , NumberOfTIDLayersPerTrackVsPhiProfile(NULL)
00075     , NumberOfTIDLayersPerTrackVsEtaProfile(NULL)
00076 
00077     , NumberOfTECRecHitsPerTrack(NULL)
00078     , NumberOfTECRecHitsPerTrackVsPhiProfile(NULL)
00079     , NumberOfTECRecHitsPerTrackVsEtaProfile(NULL)
00080     , NumberOfTECLayersPerTrack(NULL)
00081     , NumberOfTECLayersPerTrackVsPhiProfile(NULL)
00082     , NumberOfTECLayersPerTrackVsEtaProfile(NULL)
00083 
00084     , NumberOfPixBarrelRecHitsPerTrack(NULL)
00085     , NumberOfPixBarrelRecHitsPerTrackVsPhiProfile(NULL)
00086     , NumberOfPixBarrelRecHitsPerTrackVsEtaProfile(NULL)
00087     , NumberOfPixBarrelLayersPerTrack(NULL)
00088     , NumberOfPixBarrelLayersPerTrackVsPhiProfile(NULL)
00089     , NumberOfPixBarrelLayersPerTrackVsEtaProfile(NULL)
00090 
00091     , NumberOfPixEndcapRecHitsPerTrack(NULL)
00092     , NumberOfPixEndcapRecHitsPerTrackVsPhiProfile(NULL)
00093     , NumberOfPixEndcapRecHitsPerTrackVsEtaProfile(NULL)
00094     , NumberOfPixEndcapLayersPerTrack(NULL)
00095     , NumberOfPixEndcapLayersPerTrackVsPhiProfile(NULL)
00096     , NumberOfPixEndcapLayersPerTrackVsEtaProfile(NULL)
00097 
00098     , GoodTrackChi2oNDF(NULL)
00099     , GoodTrackNumberOfRecHitsPerTrack(NULL)
00100 
00101 {
00102 
00103   //  std::cout << "TrackAnalyzer::TrackAnalyzer() - doGoodTrackPlots_ = "  << doGoodTrackPlots_ << std::endl;
00104 
00105 }
00106 
00107 TrackAnalyzer::~TrackAnalyzer() 
00108 { 
00109 }
00110 
00111 void TrackAnalyzer::beginJob(DQMStore * dqmStore_) 
00112 {
00113 
00114     // parameters from the configuration
00115     std::string QualName       = conf_.getParameter<std::string>("Quality");
00116     std::string AlgoName       = conf_.getParameter<std::string>("AlgoName");
00117     std::string MEFolderName   = conf_.getParameter<std::string>("FolderName"); 
00118     std::string MEBSFolderName = conf_.getParameter<std::string>("BSFolderName"); 
00119 
00120     // use the AlgoName and Quality Name 
00121     std::string CatagoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
00122 
00123     // get binning from the configuration
00124     int    TKHitBin     = conf_.getParameter<int>(   "RecHitBin");
00125     double TKHitMin     = conf_.getParameter<double>("RecHitMin");
00126     double TKHitMax     = conf_.getParameter<double>("RecHitMax");
00127 
00128     int    TKLostBin    = conf_.getParameter<int>(   "RecLostBin");
00129     double TKLostMin    = conf_.getParameter<double>("RecLostMin");
00130     double TKLostMax    = conf_.getParameter<double>("RecLostMax");
00131 
00132     int    TKLayBin     = conf_.getParameter<int>(   "RecLayBin");
00133     double TKLayMin     = conf_.getParameter<double>("RecLayMin");
00134     double TKLayMax     = conf_.getParameter<double>("RecLayMax");
00135 
00136     int    Chi2Bin      = conf_.getParameter<int>(   "Chi2Bin");
00137     double Chi2Min      = conf_.getParameter<double>("Chi2Min");
00138     double Chi2Max      = conf_.getParameter<double>("Chi2Max");
00139 
00140     int    Chi2NDFBin   = conf_.getParameter<int>(   "Chi2NDFBin");
00141     double Chi2NDFMin   = conf_.getParameter<double>("Chi2NDFMin");
00142     double Chi2NDFMax   = conf_.getParameter<double>("Chi2NDFMax");
00143 
00144     int    Chi2ProbBin  = conf_.getParameter<int>(   "Chi2ProbBin");
00145     double Chi2ProbMin  = conf_.getParameter<double>("Chi2ProbMin");
00146     double Chi2ProbMax  = conf_.getParameter<double>("Chi2ProbMax");
00147 
00148     int    PhiBin       = conf_.getParameter<int>(   "PhiBin");
00149     double PhiMin       = conf_.getParameter<double>("PhiMin");
00150     double PhiMax       = conf_.getParameter<double>("PhiMax");
00151 
00152     int    EtaBin       = conf_.getParameter<int>(   "EtaBin");
00153     double EtaMin       = conf_.getParameter<double>("EtaMin");
00154     double EtaMax       = conf_.getParameter<double>("EtaMax");
00155 
00156     int    ThetaBin     = conf_.getParameter<int>(   "ThetaBin");
00157     double ThetaMin     = conf_.getParameter<double>("ThetaMin");
00158     double ThetaMax     = conf_.getParameter<double>("ThetaMax");
00159 
00160     int    DxyBin       = conf_.getParameter<int>(   "DxyBin");
00161     double DxyMin       = conf_.getParameter<double>("DxyMin");
00162     double DxyMax       = conf_.getParameter<double>("DxyMax");
00163 
00164     int    VXBin        = conf_.getParameter<int>(   "VXBin");
00165     double VXMin        = conf_.getParameter<double>("VXMin");
00166     double VXMax        = conf_.getParameter<double>("VXMax");
00167 
00168     int    VYBin        = conf_.getParameter<int>(   "VYBin");
00169     double VYMin        = conf_.getParameter<double>("VYMin");
00170     double VYMax        = conf_.getParameter<double>("VYMax");
00171 
00172     int    VZBin        = conf_.getParameter<int>(   "VZBin");
00173     double VZMin        = conf_.getParameter<double>("VZMin");
00174     double VZMax        = conf_.getParameter<double>("VZMax");
00175 
00176     int    X0Bin        = conf_.getParameter<int>(   "X0Bin");
00177     double X0Min        = conf_.getParameter<double>("X0Min");
00178     double X0Max        = conf_.getParameter<double>("X0Max");
00179 
00180     int    Y0Bin        = conf_.getParameter<int>(   "Y0Bin");
00181     double Y0Min        = conf_.getParameter<double>("Y0Min");
00182     double Y0Max        = conf_.getParameter<double>("Y0Max");
00183 
00184     int    Z0Bin        = conf_.getParameter<int>(   "Z0Bin");
00185     double Z0Min        = conf_.getParameter<double>("Z0Min");
00186     double Z0Max        = conf_.getParameter<double>("Z0Max");
00187 
00188     dqmStore_->setCurrentFolder(MEFolderName);
00189 
00190     // book the Hit Property histograms
00191     // ---------------------------------------------------------------------------------//
00192 
00193    
00194     if ( doHitPropertiesPlots_ || doAllPlots_ ){
00195 
00196       dqmStore_->setCurrentFolder(MEFolderName+"/HitProperties");
00197       
00198       histname = "NumberOfRecHitsPerTrack_";
00199       NumberOfRecHitsPerTrack = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TKHitBin, TKHitMin, TKHitMax);
00200       NumberOfRecHitsPerTrack->setAxisTitle("Number of RecHits of each Track");
00201       NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
00202 
00203       histname = "NumberOfRecHitsFoundPerTrack_";
00204       NumberOfRecHitsFoundPerTrack = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TKHitBin, TKHitMin, TKHitMax);
00205       NumberOfRecHitsFoundPerTrack->setAxisTitle("Number of RecHits found for each Track");
00206       NumberOfRecHitsFoundPerTrack->setAxisTitle("Number of Tracks", 2);
00207 
00208       histname = "NumberOfRecHitsLostPerTrack_";
00209       NumberOfRecHitsLostPerTrack = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TKLostBin, TKLostMin, TKLostMax);
00210       NumberOfRecHitsLostPerTrack->setAxisTitle("Number of RecHits lost for each Track");
00211       NumberOfRecHitsLostPerTrack->setAxisTitle("Number of Tracks", 2);
00212 
00213       histname = "NumberOfLayersPerTrack_";
00214       NumberOfLayersPerTrack = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TKLayBin, TKLayMin, TKLayMax);
00215       NumberOfLayersPerTrack->setAxisTitle("Number of Layers of each Track", 1);
00216       NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2);
00217       
00218     }
00219     if ( doRecHitVsPhiVsEtaPerTrack_ ){
00220 
00221       dqmStore_->setCurrentFolder(MEFolderName+"/HitProperties");
00222       
00223       histname = "NumberOfRecHitVsPhiVsEtaPerTrack_";
00224       NumberOfRecHitVsPhiVsEtaPerTrack = dqmStore_->bookProfile2D(histname+CatagoryName, histname+CatagoryName, 
00225                                                                            EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
00226       NumberOfRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1);
00227       NumberOfRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2);
00228     }
00229 
00230 
00231     // book the General Property histograms
00232     // ---------------------------------------------------------------------------------//
00233 
00234     if (doGeneralPropertiesPlots_ || doAllPlots_){
00235 
00236       dqmStore_->setCurrentFolder(MEFolderName+"/GeneralProperties");
00237 
00238       histname = "Chi2_";
00239       Chi2 = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, Chi2Bin, Chi2Min, Chi2Max);
00240       Chi2->setAxisTitle("Track #chi^{2}"  ,1);
00241       Chi2->setAxisTitle("Number of Tracks",2);
00242 
00243       histname = "Chi2Prob_";
00244       Chi2Prob = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax);
00245       Chi2Prob->setAxisTitle("Track #chi^{2} probability",1);
00246       Chi2Prob->setAxisTitle("Number of Tracks"        ,2);
00247       
00248       histname = "Chi2oNDF_";
00249       Chi2oNDF = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
00250       Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf",1);
00251       Chi2oNDF->setAxisTitle("Number of Tracks"  ,2);
00252       
00253       histname = "DistanceOfClosestApproach_";
00254       DistanceOfClosestApproach = dqmStore_->book1D(histname+CatagoryName,histname+CatagoryName,DxyBin,DxyMin,DxyMax);
00255       DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",1);
00256       DistanceOfClosestApproach->setAxisTitle("Number of Tracks",2);
00257       
00258       histname = "DistanceOfClosestApproachVsPhi_";
00259       DistanceOfClosestApproachVsPhi = dqmStore_->bookProfile(histname+CatagoryName,histname+CatagoryName, PhiBin, PhiMin, PhiMax, DxyMin,DxyMax,"");
00260       DistanceOfClosestApproachVsPhi->getTH1()->SetBit(TH1::kCanRebin);
00261       DistanceOfClosestApproachVsPhi->setAxisTitle("Track #phi",1);
00262       DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
00263       
00264       histname = "xPointOfClosestApproach_";
00265       xPointOfClosestApproach = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, VXBin, VXMin, VXMax);
00266       xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)",1);
00267       xPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
00268       
00269       histname = "yPointOfClosestApproach_";
00270       yPointOfClosestApproach = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, VYBin, VYMin, VYMax);
00271       yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)",1);
00272       yPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
00273       
00274       histname = "zPointOfClosestApproach_";
00275       zPointOfClosestApproach = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, VZBin, VZMin, VZMax);
00276       zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)",1);
00277       zPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
00278       
00279       // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition
00280       histname = "algorithm_";
00281       algorithm = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, 32, 0., 32.);
00282       algorithm->setAxisTitle("Tracking algorithm",1);
00283       algorithm->setAxisTitle("Number of Tracks",2);
00284       
00285     }
00286     
00287     // book the Beam Spot related histograms
00288     // ---------------------------------------------------------------------------------//
00289     
00290     if(doBSPlots_ || doAllPlots_)
00291       {
00292         dqmStore_->setCurrentFolder(MEBSFolderName);
00293         
00294         histname = "DistanceOfClosestApproachToBS_";
00295         DistanceOfClosestApproachToBS = dqmStore_->book1D(histname+CatagoryName,histname+CatagoryName,DxyBin,DxyMin,DxyMax);
00296         DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
00297         DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2);
00298         
00299         histname = "DistanceOfClosestApproachToBSVsPhi_";
00300         DistanceOfClosestApproachToBSVsPhi = dqmStore_->bookProfile(histname+CatagoryName,histname+CatagoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
00301         DistanceOfClosestApproachToBSVsPhi->getTH1()->SetBit(TH1::kCanRebin);
00302         DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi",1);
00303         DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
00304         
00305         histname = "xPointOfClosestApproachVsZ0_";
00306         xPointOfClosestApproachVsZ0 = dqmStore_->bookProfile(histname+CatagoryName, histname+CatagoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
00307         xPointOfClosestApproachVsZ0->setAxisTitle("d_{z} (cm)",1);
00308         xPointOfClosestApproachVsZ0->setAxisTitle("x component of Track PCA to beam line (cm)",2);
00309         
00310         histname = "yPointOfClosestApproachVsZ0_";
00311         yPointOfClosestApproachVsZ0 = dqmStore_->bookProfile(histname+CatagoryName, histname+CatagoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
00312         yPointOfClosestApproachVsZ0->setAxisTitle("d_{z} (cm)",1);
00313         yPointOfClosestApproachVsZ0->setAxisTitle("y component of Track PCA to beam line (cm)",2);
00314       }
00315     
00316     // book the Profile plots for DCA related histograms
00317     // ---------------------------------------------------------------------------------//
00318     if(doDCAPlots_ || doAllPlots_)
00319       {
00320         dqmStore_->setCurrentFolder(MEFolderName+"/GeneralProperties");
00321         histname = "DistanceOfClosestApproachVsTheta_";
00322         DistanceOfClosestApproachVsTheta = dqmStore_->bookProfile(histname+CatagoryName,histname+CatagoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin,DxyMax,"");
00323         DistanceOfClosestApproachVsTheta->setAxisTitle("Track #theta",1);
00324         DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
00325 
00326         histname = "DistanceOfClosestApproachVsEta_";
00327         DistanceOfClosestApproachVsEta = dqmStore_->bookProfile(histname+CatagoryName,histname+CatagoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax,"");
00328         DistanceOfClosestApproachVsEta->setAxisTitle("Track #eta",1);
00329         DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
00330     }
00331 
00332     // book tracker specific related histograms
00333     // ---------------------------------------------------------------------------------//
00334     if(doTrackerSpecific_ || doAllPlots_) 
00335       {
00336         doTrackerSpecificInitialization(dqmStore_);
00337       }
00338     
00339     // book state related histograms
00340     // ---------------------------------------------------------------------------------//
00341     if (doMeasurementStatePlots_ || doAllPlots_){
00342 
00343       std::string StateName = conf_.getParameter<std::string>("MeasurementState");
00344       
00345       if (StateName == "All") 
00346         {
00347           bookHistosForState("OuterSurface", dqmStore_);
00348           bookHistosForState("InnerSurface", dqmStore_);
00349           bookHistosForState("ImpactPoint" , dqmStore_);
00350         } 
00351       else if 
00352         (   
00353          StateName != "OuterSurface" && 
00354          StateName != "InnerSurface" && 
00355          StateName != "ImpactPoint" &&
00356          StateName != "default" 
00357          ) 
00358         {
00359           bookHistosForState("default", dqmStore_);
00360         }
00361       else
00362         {
00363           bookHistosForState(StateName, dqmStore_);
00364         }
00365     }
00366     
00367     // book histos for good tracks (HP + Pt>1GeV)
00368     // ---------------------------------------------------------------------------------//
00369 
00370     if ( doGoodTrackPlots_ || doAllPlots_ ) {
00371 
00372       dqmStore_->setCurrentFolder(MEFolderName+"/GeneralProperties");
00373 
00374       histname = "GoodTrackChi2oNDF_";
00375       GoodTrackChi2oNDF = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
00376       GoodTrackChi2oNDF->setAxisTitle("Good Track #chi^{2}/ndf",1);
00377       GoodTrackChi2oNDF->setAxisTitle("Number of Tracks"  ,2);
00378 
00379       dqmStore_->setCurrentFolder(MEFolderName+"/HitProperties");
00380 
00381       histname = "GoodTrackNumberOfRecHitsPerTrack_";
00382       GoodTrackNumberOfRecHitsPerTrack = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TKHitBin, TKHitMin, TKHitMax);
00383       GoodTrackNumberOfRecHitsPerTrack->setAxisTitle("Number of RecHits of each Good Track");
00384       GoodTrackNumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
00385       
00386     }
00387 
00388     if ( doGoodTrackRecHitVsPhiVsEtaPerTrack_ ){
00389 
00390       dqmStore_->setCurrentFolder(MEFolderName+"/HitProperties");
00391       
00392       histname = "GoodTrackNumberOfRecHitVsPhiVsEtaPerTrack_";
00393       GoodTrackNumberOfRecHitVsPhiVsEtaPerTrack = dqmStore_->bookProfile2D(histname+CatagoryName, histname+CatagoryName, 
00394                                                                            EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
00395       GoodTrackNumberOfRecHitVsPhiVsEtaPerTrack->setAxisTitle("Good Track #eta ", 1);
00396       GoodTrackNumberOfRecHitVsPhiVsEtaPerTrack->setAxisTitle("Good Track #phi ", 2);
00397     }
00398    
00399 }
00400 
00401 // -- Analyse
00402 // ---------------------------------------------------------------------------------//
00403 void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track)
00404 {
00405 
00406   if ( doHitPropertiesPlots_ || doAllPlots_ ){
00407     // rec hits
00408     NumberOfRecHitsPerTrack->Fill(track.recHitsSize());
00409     NumberOfRecHitsFoundPerTrack->Fill(track.found());
00410     NumberOfRecHitsLostPerTrack->Fill(track.lost());
00411     
00412     // layters
00413     NumberOfLayersPerTrack->Fill(track.hitPattern().trackerLayersWithMeasurement());
00414   
00415   }
00416   if ( doRecHitVsPhiVsEtaPerTrack_ ){
00417     NumberOfRecHitVsPhiVsEtaPerTrack->Fill(track.eta(),track.phi(),track.recHitsSize());    
00418   }
00419 
00420   if (doGeneralPropertiesPlots_ || doAllPlots_){
00421     // fitting
00422     Chi2->Fill(track.chi2());
00423     Chi2Prob->Fill(TMath::Prob(track.chi2(),(int)track.ndof()));
00424     Chi2oNDF->Fill(track.normalizedChi2());
00425 
00426     // PCA
00427     DistanceOfClosestApproach->Fill(track.dxy());
00428     DistanceOfClosestApproachVsPhi->Fill(track.phi(), track.dxy());
00429     xPointOfClosestApproach->Fill(track.vertex().x());
00430     yPointOfClosestApproach->Fill(track.vertex().y());
00431     zPointOfClosestApproach->Fill(track.vertex().z());
00432 
00433     // algorithm
00434     algorithm->Fill(static_cast<double>(track.algo()));
00435 
00436   }
00437 
00438   if(doBSPlots_ || doAllPlots_)
00439     {
00440       edm::InputTag bsSrc = conf_.getParameter< edm::InputTag >("beamSpot");
00441 
00442       edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
00443         iEvent.getByLabel(bsSrc,recoBeamSpotHandle);
00444         reco::BeamSpot bs = *recoBeamSpotHandle;      
00445 
00446         DistanceOfClosestApproachToBS->Fill(track.dxy(bs.position()));
00447         DistanceOfClosestApproachToBSVsPhi->Fill(track.phi(), track.dxy(bs.position()));
00448         xPointOfClosestApproachVsZ0->Fill(track.dz(),track.vx());
00449         yPointOfClosestApproachVsZ0->Fill(track.dz(),track.vy());
00450     }
00451 
00452     if(doDCAPlots_ || doAllPlots_)
00453       {
00454         DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0());
00455         DistanceOfClosestApproachVsEta->Fill(track.eta(), track.d0());
00456       }  
00457 
00458     //Tracker Specific Histograms
00459     if(doTrackerSpecific_ || doAllPlots_) 
00460       {
00461         doTrackerSpecificFillHists(track);
00462       }
00463 
00464     if (doMeasurementStatePlots_ || doAllPlots_){
00465       std::string StateName = conf_.getParameter<std::string>("MeasurementState");
00466       if (StateName == "All") 
00467         {
00468           fillHistosForState(iSetup, track, std::string("OuterSurface"));
00469           fillHistosForState(iSetup, track, std::string("InnerSurface"));
00470           fillHistosForState(iSetup, track, std::string("ImpactPoint"));
00471         } 
00472       else if 
00473         (   
00474          StateName != "OuterSurface" && 
00475          StateName != "InnerSurface" && 
00476          StateName != "ImpactPoint" &&
00477          StateName != "default" 
00478          ) 
00479         {
00480           fillHistosForState(iSetup, track, std::string("default"));
00481         }
00482       else
00483         {
00484           fillHistosForState(iSetup, track, StateName);
00485         }
00486     }
00487 
00488     // Good Tracks plots
00489 
00490     if ( doGoodTrackPlots_ || doAllPlots_ ) {
00491       if ( track.quality(reco::TrackBase::highPurity) && track.pt() > 1. ) {
00492         GoodTrackChi2oNDF->Fill(track.normalizedChi2());
00493         GoodTrackNumberOfRecHitsPerTrack->Fill(track.recHitsSize());
00494       }
00495     }
00496     if ( doGoodTrackRecHitVsPhiVsEtaPerTrack_  ) {
00497       if ( track.quality(reco::TrackBase::highPurity) && track.pt() > 1. ) {
00498         GoodTrackNumberOfRecHitVsPhiVsEtaPerTrack->Fill(track.eta(),track.phi(),track.recHitsSize());
00499       }
00500     }
00501 
00502 
00503 }
00504 
00505 
00506 // book histograms at differnt measurement points
00507 // ---------------------------------------------------------------------------------//
00508 void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore * dqmStore_) 
00509 {
00510 
00511 
00512     // parameters from the configuration
00513     std::string QualName       = conf_.getParameter<std::string>("Quality");
00514     std::string AlgoName       = conf_.getParameter<std::string>("AlgoName");
00515     std::string MEFolderName   = conf_.getParameter<std::string>("FolderName"); 
00516 
00517     // use the AlgoName and Quality Name 
00518     std::string CatagoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
00519 
00520     // get binning from the configuration
00521     double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
00522     double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
00523 
00524     int    RecHitBin   = conf_.getParameter<int>(   "RecHitBin");
00525     double RecHitMin   = conf_.getParameter<double>("RecHitMin");
00526     double RecHitMax   = conf_.getParameter<double>("RecHitMax");
00527 
00528     int    RecLayBin   = conf_.getParameter<int>(   "RecHitBin");
00529     double RecLayMin   = conf_.getParameter<double>("RecHitMin");
00530     double RecLayMax   = conf_.getParameter<double>("RecHitMax");
00531 
00532 
00533     int    PhiBin     = conf_.getParameter<int>(   "PhiBin");
00534     double PhiMin     = conf_.getParameter<double>("PhiMin");
00535     double PhiMax     = conf_.getParameter<double>("PhiMax");
00536 
00537     int    EtaBin     = conf_.getParameter<int>(   "EtaBin");
00538     double EtaMin     = conf_.getParameter<double>("EtaMin");
00539     double EtaMax     = conf_.getParameter<double>("EtaMax");
00540 
00541     int    ThetaBin   = conf_.getParameter<int>(   "ThetaBin");
00542     double ThetaMin   = conf_.getParameter<double>("ThetaMin");
00543     double ThetaMax   = conf_.getParameter<double>("ThetaMax");
00544 
00545     int    TrackQBin  = conf_.getParameter<int>(   "TrackQBin");
00546     double TrackQMin  = conf_.getParameter<double>("TrackQMin");
00547     double TrackQMax  = conf_.getParameter<double>("TrackQMax");
00548 
00549     int    TrackPtBin = conf_.getParameter<int>(   "TrackPtBin");
00550     double TrackPtMin = conf_.getParameter<double>("TrackPtMin");
00551     double TrackPtMax = conf_.getParameter<double>("TrackPtMax");
00552 
00553     int    TrackPBin  = conf_.getParameter<int>(   "TrackPBin");
00554     double TrackPMin  = conf_.getParameter<double>("TrackPMin");
00555     double TrackPMax  = conf_.getParameter<double>("TrackPMax");
00556 
00557     int    TrackPxBin = conf_.getParameter<int>(   "TrackPxBin");
00558     double TrackPxMin = conf_.getParameter<double>("TrackPxMin");
00559     double TrackPxMax = conf_.getParameter<double>("TrackPxMax");
00560 
00561     int    TrackPyBin = conf_.getParameter<int>(   "TrackPyBin");
00562     double TrackPyMin = conf_.getParameter<double>("TrackPyMin");
00563     double TrackPyMax = conf_.getParameter<double>("TrackPyMax");
00564 
00565     int    TrackPzBin = conf_.getParameter<int>(   "TrackPzBin");
00566     double TrackPzMin = conf_.getParameter<double>("TrackPzMin");
00567     double TrackPzMax = conf_.getParameter<double>("TrackPzMax");
00568 
00569     int    ptErrBin   = conf_.getParameter<int>(   "ptErrBin");
00570     double ptErrMin   = conf_.getParameter<double>("ptErrMin");
00571     double ptErrMax   = conf_.getParameter<double>("ptErrMax");
00572 
00573     int    pxErrBin   = conf_.getParameter<int>(   "pxErrBin");
00574     double pxErrMin   = conf_.getParameter<double>("pxErrMin");
00575     double pxErrMax   = conf_.getParameter<double>("pxErrMax");
00576 
00577     int    pyErrBin   = conf_.getParameter<int>(   "pyErrBin");
00578     double pyErrMin   = conf_.getParameter<double>("pyErrMin");
00579     double pyErrMax   = conf_.getParameter<double>("pyErrMax");
00580 
00581     int    pzErrBin   = conf_.getParameter<int>(   "pzErrBin");
00582     double pzErrMin   = conf_.getParameter<double>("pzErrMin");
00583     double pzErrMax   = conf_.getParameter<double>("pzErrMax");
00584 
00585     int    pErrBin    = conf_.getParameter<int>(   "pErrBin");
00586     double pErrMin    = conf_.getParameter<double>("pErrMin");
00587     double pErrMax    = conf_.getParameter<double>("pErrMax");
00588 
00589     int    phiErrBin  = conf_.getParameter<int>(   "phiErrBin");
00590     double phiErrMin  = conf_.getParameter<double>("phiErrMin");
00591     double phiErrMax  = conf_.getParameter<double>("phiErrMax");
00592 
00593     int    etaErrBin  = conf_.getParameter<int>(   "etaErrBin");
00594     double etaErrMin  = conf_.getParameter<double>("etaErrMin");
00595     double etaErrMax  = conf_.getParameter<double>("etaErrMax");
00596 
00597 
00598     dqmStore_->setCurrentFolder(MEFolderName);
00599 
00600     TkParameterMEs tkmes;
00601 
00602     std::string histTag = (sname == "default") ? CatagoryName : sname + "_" + CatagoryName;
00603 
00604     if(doAllPlots_)
00605     {
00606         // hit properties
00607         dqmStore_->setCurrentFolder(MEFolderName+"/HitProperties");
00608 
00609         // rechits
00610         histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag;
00611         tkmes.NumberOfRecHitsPerTrackVsPhi = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax,"");
00612         tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
00613         tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits of each Track",2);
00614 
00615         histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag;
00616         tkmes.NumberOfRecHitsPerTrackVsTheta = dqmStore_->bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitMin, RecHitMax,"");
00617         tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #theta",1);
00618         tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits of each Track",2);
00619 
00620         histname = "NumberOfRecHitsPerTrackVsEta_" + histTag;
00621         tkmes.NumberOfRecHitsPerTrackVsEta = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax,"");
00622         tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
00623         tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits of each Track",2);
00624 
00625         histname = "NumberOfLayersPerTrackVsPhi_" + histTag;
00626         tkmes.NumberOfLayersPerTrackVsPhi = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayMin, RecLayMax,"");
00627         tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1);
00628         tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers of each Track",2);
00629 
00630         histname = "NumberOfLayersPerTrackVsTheta_" + histTag;
00631         tkmes.NumberOfLayersPerTrackVsTheta = dqmStore_->bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayMin, RecLayMax,"");
00632         tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #theta",1);
00633         tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers of each Track",2);
00634 
00635         histname = "NumberOfLayersPerTrackVsEta_" + histTag;
00636         tkmes.NumberOfLayersPerTrackVsEta = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayMin, RecLayMax,"");
00637         tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1);
00638         tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers of each Track",2);
00639 
00640         // general properties
00641         dqmStore_->setCurrentFolder(MEFolderName+"/GeneralProperties");
00642 
00643         histname = "Chi2oNDFVsTheta_" + histTag;
00644         tkmes.Chi2oNDFVsTheta = dqmStore_->bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,"");
00645         tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1);
00646         tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2);
00647 
00648         histname = "Chi2oNDFVsPhi_" + histTag;
00649         tkmes.Chi2oNDFVsPhi   = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,"");
00650         tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1);
00651         tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2);
00652 
00653         histname = "Chi2oNDFVsEta_" + histTag;
00654         tkmes.Chi2oNDFVsEta   = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,"");
00655         tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1);
00656         tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2);
00657     }
00658 
00659     // general properties
00660     dqmStore_->setCurrentFolder(MEFolderName+"/GeneralProperties");
00661 
00662     histname = "TrackP_" + histTag;
00663 
00664     tkmes.TrackP = dqmStore_->book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax);
00665     tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1);
00666     tkmes.TrackP->setAxisTitle("Number of Tracks",2);
00667 
00668     histname = "TrackPt_" + histTag;
00669     tkmes.TrackPt = dqmStore_->book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax);
00670     tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1);
00671     tkmes.TrackPt->setAxisTitle("Number of Tracks",2);
00672 
00673     histname = "TrackPx_" + histTag;
00674     tkmes.TrackPx = dqmStore_->book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax);
00675     tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1);
00676     tkmes.TrackPx->setAxisTitle("Number of Tracks",2);
00677 
00678     histname = "TrackPy_" + histTag;
00679     tkmes.TrackPy = dqmStore_->book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax);
00680     tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1);
00681     tkmes.TrackPy->setAxisTitle("Number of Tracks",2);
00682 
00683     histname = "TrackPz_" + histTag;
00684     tkmes.TrackPz = dqmStore_->book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax);
00685     tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1);
00686     tkmes.TrackPz->setAxisTitle("Number of Tracks",2);
00687 
00688     histname = "TrackPhi_" + histTag;
00689     tkmes.TrackPhi = dqmStore_->book1D(histname, histname, PhiBin, PhiMin, PhiMax);
00690     tkmes.TrackPhi->setAxisTitle("Track #phi", 1);
00691     tkmes.TrackPhi->setAxisTitle("Number of Tracks",2);
00692 
00693     histname = "TrackEta_" + histTag;
00694     tkmes.TrackEta = dqmStore_->book1D(histname, histname, EtaBin, EtaMin, EtaMax);
00695     tkmes.TrackEta->setAxisTitle("Track #eta", 1);
00696     tkmes.TrackEta->setAxisTitle("Number of Tracks",2);
00697 
00698     histname = "TrackTheta_" + histTag;
00699     tkmes.TrackTheta = dqmStore_->book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax);
00700     tkmes.TrackTheta->setAxisTitle("Track #theta", 1);
00701     tkmes.TrackTheta->setAxisTitle("Number of Tracks",2);
00702 
00703     histname = "TrackQ_" + histTag;
00704     tkmes.TrackQ = dqmStore_->book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax);
00705     tkmes.TrackQ->setAxisTitle("Track Charge", 1);
00706     tkmes.TrackQ->setAxisTitle("Number of Tracks",2);
00707 
00708     histname = "TrackPErrOverP_" + histTag;
00709     tkmes.TrackPErr = dqmStore_->book1D(histname, histname, pErrBin, pErrMin, pErrMax);
00710     tkmes.TrackPErr->setAxisTitle("error(p)/p", 1);
00711     tkmes.TrackPErr->setAxisTitle("Number of Tracks",2);
00712 
00713     histname = "TrackPtErrOverPt_" + histTag;
00714     tkmes.TrackPtErr = dqmStore_->book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax);
00715     tkmes.TrackPtErr->setAxisTitle("error(p_{T})/p_{T}", 1);
00716     tkmes.TrackPtErr->setAxisTitle("Number of Tracks",2);
00717 
00718     histname = "TrackPxErrOverPx_" + histTag;
00719     tkmes.TrackPxErr = dqmStore_->book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax);
00720     tkmes.TrackPxErr->setAxisTitle("error(p_{x})/p_{x}", 1);
00721     tkmes.TrackPxErr->setAxisTitle("Number of Tracks",2);
00722 
00723     histname = "TrackPyErrOverPy_" + histTag;
00724     tkmes.TrackPyErr = dqmStore_->book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax);
00725     tkmes.TrackPyErr->setAxisTitle("error(p_{y})/p_{y}", 1);
00726     tkmes.TrackPyErr->setAxisTitle("Number of Tracks",2);
00727 
00728     histname = "TrackPzErrOverPz_" + histTag;
00729     tkmes.TrackPzErr = dqmStore_->book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax);
00730     tkmes.TrackPzErr->setAxisTitle("error(p_{z})/p_{z}", 1);
00731     tkmes.TrackPzErr->setAxisTitle("Number of Tracks",2);
00732 
00733     histname = "TrackPhiErr_" + histTag;
00734     tkmes.TrackPhiErr = dqmStore_->book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax);
00735     tkmes.TrackPhiErr->setAxisTitle("error(#theta)");
00736     tkmes.TrackPhiErr->setAxisTitle("Number of Tracks",2);
00737 
00738     histname = "TrackEtaErr_" + histTag;
00739     tkmes.TrackEtaErr = dqmStore_->book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax);
00740     tkmes.TrackEtaErr->setAxisTitle("error(#eta)");
00741     tkmes.TrackEtaErr->setAxisTitle("Number of Tracks",2);
00742 
00743     // rec hit profiles
00744 
00745     histname = "NumberOfRecHitsPerTrackVsPhiProfile_" + histTag;
00746     tkmes.NumberOfRecHitsPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax,"");
00747     tkmes.NumberOfRecHitsPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
00748     tkmes.NumberOfRecHitsPerTrackVsPhiProfile->setAxisTitle("Number of RecHits of each Track",2);
00749 
00750     histname = "NumberOfRecHitsPerTrackVsThetaProfile_" + histTag;
00751     tkmes.NumberOfRecHitsPerTrackVsThetaProfile = dqmStore_->bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax,"");
00752     tkmes.NumberOfRecHitsPerTrackVsThetaProfile->setAxisTitle("Track #phi",1);
00753     tkmes.NumberOfRecHitsPerTrackVsThetaProfile->setAxisTitle("Number of RecHits of each Track",2);
00754 
00755     histname = "NumberOfRecHitsPerTrackVsEtaProfile_" + histTag;
00756     tkmes.NumberOfRecHitsPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax,"");
00757     tkmes.NumberOfRecHitsPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
00758     tkmes.NumberOfRecHitsPerTrackVsEtaProfile->setAxisTitle("Number of RecHits of each Track",2);
00759 
00760     histname = "NumberOfLayersPerTrackVsPhiProfile_" + histTag;
00761     tkmes.NumberOfLayersPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax,"");
00762     tkmes.NumberOfLayersPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
00763     tkmes.NumberOfLayersPerTrackVsPhiProfile->setAxisTitle("Number of Layers of each Track",2);
00764 
00765     histname = "NumberOfLayersPerTrackVsThetaProfile_" + histTag;
00766     tkmes.NumberOfLayersPerTrackVsThetaProfile = dqmStore_->bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax,"");
00767     tkmes.NumberOfLayersPerTrackVsThetaProfile->setAxisTitle("Track #phi",1);
00768     tkmes.NumberOfLayersPerTrackVsThetaProfile->setAxisTitle("Number of Layers of each Track",2);
00769 
00770     histname = "NumberOfLayersPerTrackVsEtaProfile_" + histTag;
00771     tkmes.NumberOfLayersPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax,"");
00772     tkmes.NumberOfLayersPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
00773     tkmes.NumberOfLayersPerTrackVsEtaProfile->setAxisTitle("Number of Layers of each Track",2);
00774 
00775     if ( doGoodTrackPlots_ ) {
00776 
00777       histname = "GoodTrackPt_" + histTag;
00778       tkmes.GoodTrackPt = dqmStore_->book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax);
00779       tkmes.GoodTrackPt->setAxisTitle("Good Track p_{T} (GeV/c)", 1);
00780       tkmes.GoodTrackPt->setAxisTitle("Number of Tracks",2);
00781       
00782       histname = "GoodTrackEta_" + histTag;
00783       tkmes.GoodTrackEta = dqmStore_->book1D(histname, histname, EtaBin, EtaMin, EtaMax);
00784       tkmes.GoodTrackEta->setAxisTitle("Good Track #eta", 1);
00785       tkmes.GoodTrackEta->setAxisTitle("Number of Tracks",2);
00786       
00787       histname = "GoodTrackPhi_" + histTag;
00788       tkmes.GoodTrackPhi = dqmStore_->book1D(histname, histname, PhiBin, PhiMin, PhiMax);
00789       tkmes.GoodTrackPhi->setAxisTitle("Good Track #phi", 1);
00790       tkmes.GoodTrackPhi->setAxisTitle("Number of Tracks",2);
00791 
00792     }
00793 
00794     // now put the MEs in the map
00795     TkParameterMEMap.insert( std::make_pair(sname, tkmes) );
00796 }
00797 
00798 
00799 // fill histograms at differnt measurement points
00800 // ---------------------------------------------------------------------------------//
00801 void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname) 
00802 {
00803     //get the kinematic parameters
00804     double p, px, py, pz, pt, theta, phi, eta, q;
00805     double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror;
00806 
00807     bool isHighPurity = track.quality(reco::TrackBase::highPurity);
00808 
00809     if (sname == "default") 
00810     {
00811         p     = track.p();
00812         px    = track.px();
00813         py    = track.py();
00814         pz    = track.pz();
00815         pt    = track.pt();
00816         phi   = track.phi();
00817         theta = track.theta();
00818         eta   = track.eta();
00819         q     = track.charge();
00820 
00821         pterror  = (pt) ? track.ptError()/pt : 0.0;
00822         pxerror  = -1.0;
00823         pyerror  = -1.0;
00824         pzerror  = -1.0;
00825         perror   = -1.0;
00826         phierror = track.phiError();
00827         etaerror = track.etaError();
00828 
00829     } 
00830     else 
00831     {
00832         edm::ESHandle<TransientTrackBuilder> theB;
00833         iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
00834         reco::TransientTrack TransTrack = theB->build(track);
00835 
00836         TrajectoryStateOnSurface TSOS;
00837 
00838         if      (sname == "OuterSurface")  TSOS = TransTrack.outermostMeasurementState();
00839         else if (sname == "InnerSurface")  TSOS = TransTrack.innermostMeasurementState();
00840         else if (sname == "ImpactPoint")   TSOS = TransTrack.impactPointState();
00841 
00842         p     = TSOS.globalMomentum().mag();
00843         px    = TSOS.globalMomentum().x();
00844         py    = TSOS.globalMomentum().y();
00845         pz    = TSOS.globalMomentum().z();
00846         pt    = TSOS.globalMomentum().perp();
00847         phi   = TSOS.globalMomentum().phi();
00848         theta = TSOS.globalMomentum().theta();
00849         eta   = TSOS.globalMomentum().eta();
00850         q     = TSOS.charge();
00851 
00852         //get the error of the kinimatic parameters
00853         AlgebraicSymMatrix66 errors = TSOS.cartesianError().matrix();
00854         double partialPterror = errors(3,3)*pow(TSOS.globalMomentum().x(),2) + errors(4,4)*pow(TSOS.globalMomentum().y(),2);
00855         pterror  = sqrt(partialPterror)/TSOS.globalMomentum().perp();
00856         pxerror  = sqrt(errors(3,3))/TSOS.globalMomentum().x();
00857         pyerror  = sqrt(errors(4,4))/TSOS.globalMomentum().y();
00858         pzerror  = sqrt(errors(5,5))/TSOS.globalMomentum().z();
00859         perror   = sqrt(partialPterror+errors(5,5)*pow(TSOS.globalMomentum().z(),2))/TSOS.globalMomentum().mag();
00860         phierror = sqrt(TSOS.curvilinearError().matrix()(2,2));
00861         etaerror = sqrt(TSOS.curvilinearError().matrix()(1,1))*fabs(sin(TSOS.globalMomentum().theta()));
00862 
00863         
00864 
00865     }
00866 
00867     std::map<std::string, TkParameterMEs>::iterator iPos = TkParameterMEMap.find(sname); 
00868     if (iPos != TkParameterMEMap.end()) 
00869     {
00870         TkParameterMEs tkmes = iPos->second;
00871 
00872         // momentum
00873         tkmes.TrackP->Fill(p);
00874         tkmes.TrackPx->Fill(px);
00875         tkmes.TrackPy->Fill(py);
00876         tkmes.TrackPz->Fill(pz);
00877         tkmes.TrackPt->Fill(pt);
00878 
00879         // angles
00880         tkmes.TrackPhi->Fill(phi);
00881         tkmes.TrackEta->Fill(eta);
00882         tkmes.TrackTheta->Fill(theta);
00883 
00884         tkmes.TrackQ->Fill(q);
00885 
00886         // errors
00887         tkmes.TrackPtErr->Fill(pterror);
00888         tkmes.TrackPxErr->Fill(pxerror);
00889         tkmes.TrackPyErr->Fill(pyerror);
00890         tkmes.TrackPzErr->Fill(pzerror);
00891         tkmes.TrackPErr->Fill(perror);
00892         tkmes.TrackPhiErr->Fill(phierror);
00893         tkmes.TrackEtaErr->Fill(etaerror);
00894 
00895         // rec hits 
00896         tkmes.NumberOfRecHitsPerTrackVsPhiProfile->Fill(phi,    track.hitPattern().numberOfValidHits());
00897         tkmes.NumberOfRecHitsPerTrackVsThetaProfile->Fill(theta,track.hitPattern().numberOfValidHits());
00898         tkmes.NumberOfRecHitsPerTrackVsEtaProfile->Fill(eta,    track.hitPattern().numberOfValidHits());
00899 
00900 
00901         // rec layers 
00902         tkmes.NumberOfLayersPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().stripLayersWithMeasurement());
00903         tkmes.NumberOfLayersPerTrackVsThetaProfile->Fill(theta, track.hitPattern().stripLayersWithMeasurement());
00904         tkmes.NumberOfLayersPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().stripLayersWithMeasurement());
00905 
00906         if(doAllPlots_)
00907         {
00908             // hit related
00909             tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, track.found());
00910             tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta, track.found());
00911             tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, track.found());
00912 
00913             // general properties
00914             tkmes.Chi2oNDFVsTheta->Fill(theta, track.normalizedChi2());
00915             tkmes.Chi2oNDFVsPhi->Fill(phi, track.normalizedChi2());
00916             tkmes.Chi2oNDFVsEta->Fill(eta, track.normalizedChi2());
00917 
00918             // rec hits 
00919             tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi,        track.hitPattern().numberOfValidHits());
00920             tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta,    track.hitPattern().numberOfValidHits());
00921             tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta,        track.hitPattern().numberOfValidHits());
00922             
00923 
00924         }
00925 
00926         if ( doGoodTrackPlots_ ) {
00927           if ( isHighPurity && pt > 1. ) {
00928             tkmes.GoodTrackPt->Fill(pt);
00929             tkmes.GoodTrackEta->Fill(eta);
00930             tkmes.GoodTrackPhi->Fill(phi);
00931           }
00932         }
00933 
00934     }
00935 }
00936 
00937 
00938 void TrackAnalyzer::doTrackerSpecificInitialization(DQMStore * dqmStore_) 
00939 {
00940 
00941     // parameters from the configuration
00942     std::string QualName     = conf_.getParameter<std::string>("Quality");
00943     std::string AlgoName     = conf_.getParameter<std::string>("AlgoName");
00944     std::string MEFolderName = conf_.getParameter<std::string>("FolderName"); 
00945 
00946     // use the AlgoName and Quality Name 
00947     std::string CatagoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
00948 
00949     // get binning from the configuration
00950     int    TOBHitBin = conf_.getParameter<int>(   "TOBHitBin");
00951     double TOBHitMin = conf_.getParameter<double>("TOBHitMin");
00952     double TOBHitMax = conf_.getParameter<double>("TOBHitMax");
00953 
00954     int    TIBHitBin = conf_.getParameter<int>(   "TIBHitBin");
00955     double TIBHitMin = conf_.getParameter<double>("TIBHitMin");
00956     double TIBHitMax = conf_.getParameter<double>("TIBHitMax");
00957 
00958     int    TIDHitBin = conf_.getParameter<int>(   "TIDHitBin");
00959     double TIDHitMin = conf_.getParameter<double>("TIDHitMin");
00960     double TIDHitMax = conf_.getParameter<double>("TIDHitMax");
00961 
00962     int    TECHitBin = conf_.getParameter<int>(   "TECHitBin");
00963     double TECHitMin = conf_.getParameter<double>("TECHitMin");
00964     double TECHitMax = conf_.getParameter<double>("TECHitMax");
00965 
00966     int    PXBHitBin = conf_.getParameter<int>(   "PXBHitBin");
00967     double PXBHitMin = conf_.getParameter<double>("PXBHitMin");
00968     double PXBHitMax = conf_.getParameter<double>("PXBHitMax");
00969 
00970     int    PXFHitBin = conf_.getParameter<int>(   "PXFHitBin");
00971     double PXFHitMin = conf_.getParameter<double>("PXFHitMin");
00972     double PXFHitMax = conf_.getParameter<double>("PXFHitMax");
00973 
00974     int    TOBLayBin = conf_.getParameter<int>(   "TOBLayBin");
00975     double TOBLayMin = conf_.getParameter<double>("TOBLayMin");
00976     double TOBLayMax = conf_.getParameter<double>("TOBLayMax");
00977 
00978     int    TIBLayBin = conf_.getParameter<int>(   "TIBLayBin");
00979     double TIBLayMin = conf_.getParameter<double>("TIBLayMin");
00980     double TIBLayMax = conf_.getParameter<double>("TIBLayMax");
00981 
00982     int    TIDLayBin = conf_.getParameter<int>(   "TIDLayBin");
00983     double TIDLayMin = conf_.getParameter<double>("TIDLayMin");
00984     double TIDLayMax = conf_.getParameter<double>("TIDLayMax");
00985 
00986     int    TECLayBin = conf_.getParameter<int>(   "TECLayBin");
00987     double TECLayMin = conf_.getParameter<double>("TECLayMin");
00988     double TECLayMax = conf_.getParameter<double>("TECLayMax");
00989 
00990     int    PXBLayBin = conf_.getParameter<int>(   "PXBLayBin");
00991     double PXBLayMin = conf_.getParameter<double>("PXBLayMin");
00992     double PXBLayMax = conf_.getParameter<double>("PXBLayMax");
00993 
00994     int    PXFLayBin = conf_.getParameter<int>(   "PXFLayBin");
00995     double PXFLayMin = conf_.getParameter<double>("PXFLayMin");
00996     double PXFLayMax = conf_.getParameter<double>("PXFLayMax");
00997 
00998 
00999     int    PhiBin     = conf_.getParameter<int>(   "PhiBin");
01000     double PhiMin     = conf_.getParameter<double>("PhiMin");
01001     double PhiMax     = conf_.getParameter<double>("PhiMax");
01002 
01003     int    EtaBin     = conf_.getParameter<int>(   "EtaBin");
01004     double EtaMin     = conf_.getParameter<double>("EtaMin");
01005     double EtaMax     = conf_.getParameter<double>("EtaMax");
01006 
01007     // book hit property histograms
01008     // ---------------------------------------------------------------------------------//
01009     dqmStore_->setCurrentFolder(MEFolderName+"/HitProperties");
01010 
01011 
01012     TkParameterMEs tkmes;
01013 
01014     // TOB hits properties
01015 
01016     histname = "NumberOfTOBRecHitsPerTrack_" + CatagoryName;
01017     NumberOfTOBRecHitsPerTrack = dqmStore_->book1D(histname, histname, TOBHitBin, TOBHitMin, TOBHitMax);
01018     NumberOfTOBRecHitsPerTrack->setAxisTitle("Number of TOB RecHits of each Track",1);
01019     NumberOfTOBRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
01020 
01021     histname = "NumberOfTOBRecHitsPerTrackVsPhiProfile_" + CatagoryName;
01022     NumberOfTOBRecHitsPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TOBHitBin, TOBHitMin, TOBHitMax,"");
01023     NumberOfTOBRecHitsPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01024     NumberOfTOBRecHitsPerTrackVsPhiProfile->setAxisTitle("Number of TOB RecHits of each Track",2);
01025 
01026     histname = "NumberOfTOBRecHitsPerTrackVsEtaProfile_" + CatagoryName;
01027     NumberOfTOBRecHitsPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TOBHitBin, TOBHitMin, TOBHitMax,"");
01028     NumberOfTOBRecHitsPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01029     NumberOfTOBRecHitsPerTrackVsEtaProfile->setAxisTitle("Number of TOB RecHits of each Track",2);
01030 
01031     histname = "NumberOfTOBLayersPerTrack_" + CatagoryName;
01032     NumberOfTOBLayersPerTrack = dqmStore_->book1D(histname, histname, TOBLayBin, TOBLayMin, TOBLayMax);
01033     NumberOfTOBLayersPerTrack->setAxisTitle("Number of TOB Layers of each Track",1);
01034     NumberOfTOBLayersPerTrack->setAxisTitle("Number of Tracks", 2);
01035 
01036     histname = "NumberOfTOBLayersPerTrackVsPhiProfile_" + CatagoryName;
01037     NumberOfTOBLayersPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TOBLayBin, TOBLayMin, TOBLayMax,"");
01038     NumberOfTOBLayersPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01039     NumberOfTOBLayersPerTrackVsPhiProfile->setAxisTitle("Number of TOB Layers of each Track",2);
01040 
01041     histname = "NumberOfTOBLayersPerTrackVsEtaProfile_" + CatagoryName;
01042     NumberOfTOBLayersPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TOBLayBin, TOBLayMin, TOBLayMax,"");
01043     NumberOfTOBLayersPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01044     NumberOfTOBLayersPerTrackVsEtaProfile->setAxisTitle("Number of TOB Layers of each Track",2);
01045 
01046 
01047     // TIB hits properties
01048 
01049     histname = "NumberOfTIBRecHitsPerTrack_" + CatagoryName;
01050     NumberOfTIBRecHitsPerTrack = dqmStore_->book1D(histname, histname, TIBHitBin, TIBHitMin, TIBHitMax);
01051     NumberOfTIBRecHitsPerTrack->setAxisTitle("Number of TIB RecHits of each Track",1);
01052     NumberOfTIBRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
01053 
01054     histname = "NumberOfTIBRecHitsPerTrackVsPhiProfile_" + CatagoryName;
01055     NumberOfTIBRecHitsPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TIBHitBin, TIBHitMin, TIBHitMax,"");
01056     NumberOfTIBRecHitsPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01057     NumberOfTIBRecHitsPerTrackVsPhiProfile->setAxisTitle("Number of TIB RecHits of each Track",2);
01058 
01059     histname = "NumberOfTIBRecHitsPerTrackVsEtaProfile_" + CatagoryName;
01060     NumberOfTIBRecHitsPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TIBHitBin, TIBHitMin, TIBHitMax,"");
01061     NumberOfTIBRecHitsPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01062     NumberOfTIBRecHitsPerTrackVsEtaProfile->setAxisTitle("Number of TIB RecHits of each Track",2);
01063 
01064     histname = "NumberOfTIBLayersPerTrack_" + CatagoryName;
01065     NumberOfTIBLayersPerTrack = dqmStore_->book1D(histname, histname, TIBLayBin, TIBLayMin, TIBLayMax);
01066     NumberOfTIBLayersPerTrack->setAxisTitle("Number of TIB Layers of each Track",1);
01067     NumberOfTIBLayersPerTrack->setAxisTitle("Number of Tracks", 2);
01068 
01069     histname = "NumberOfTIBLayersPerTrackVsPhiProfile_" + CatagoryName;
01070     NumberOfTIBLayersPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TIBLayBin, TIBLayMin, TIBLayMax,"");
01071     NumberOfTIBLayersPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01072     NumberOfTIBLayersPerTrackVsPhiProfile->setAxisTitle("Number of TIB Layers of each Track",2);
01073 
01074     histname = "NumberOfTIBLayersPerTrackVsEtaProfile_" + CatagoryName;
01075     NumberOfTIBLayersPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TIBLayBin, TIBLayMin, TIBLayMax,"");
01076     NumberOfTIBLayersPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01077     NumberOfTIBLayersPerTrackVsEtaProfile->setAxisTitle("Number of TIB Layers of each Track",2);
01078 
01079 
01080     // TID hit properties
01081 
01082     histname = "NumberOfTIDRecHitsPerTrack_" + CatagoryName;
01083     NumberOfTIDRecHitsPerTrack = dqmStore_->book1D(histname, histname, TIDHitBin, TIDHitMin, TIDHitMax);
01084     NumberOfTIDRecHitsPerTrack->setAxisTitle("Number of TID RecHits of each Track",1);
01085     NumberOfTIDRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
01086 
01087     histname = "NumberOfTIDRecHitsPerTrackVsPhiProfile_" + CatagoryName;
01088     NumberOfTIDRecHitsPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TIDHitBin, TIDHitMin, TIDHitMax,"");
01089     NumberOfTIDRecHitsPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01090     NumberOfTIDRecHitsPerTrackVsPhiProfile->setAxisTitle("Number of TID RecHits of each Track",2);
01091 
01092     histname = "NumberOfTIDRecHitsPerTrackVsEtaProfile_" + CatagoryName;
01093     NumberOfTIDRecHitsPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TIDHitBin, TIDHitMin, TIDHitMax,"");
01094     NumberOfTIDRecHitsPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01095     NumberOfTIDRecHitsPerTrackVsEtaProfile->setAxisTitle("Number of TID RecHits of each Track",2);
01096 
01097     histname = "NumberOfTIDLayersPerTrack_" + CatagoryName;
01098     NumberOfTIDLayersPerTrack = dqmStore_->book1D(histname, histname, TIDLayBin, TIDLayMin, TIDLayMax);
01099     NumberOfTIDLayersPerTrack->setAxisTitle("Number of TID Layers of each Track",1);
01100     NumberOfTIDLayersPerTrack->setAxisTitle("Number of Tracks", 2);
01101 
01102     histname = "NumberOfTIDLayersPerTrackVsPhiProfile_" + CatagoryName;
01103     NumberOfTIDLayersPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TIDLayBin, TIDLayMin, TIDLayMax,"");
01104     NumberOfTIDLayersPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01105     NumberOfTIDLayersPerTrackVsPhiProfile->setAxisTitle("Number of TID Layers of each Track",2);
01106 
01107     histname = "NumberOfTIDLayersPerTrackVsEtaProfile_" + CatagoryName;
01108     NumberOfTIDLayersPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TIDLayBin, TIDLayMin, TIDLayMax,"");
01109     NumberOfTIDLayersPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01110     NumberOfTIDLayersPerTrackVsEtaProfile->setAxisTitle("Number of TID Layers of each Track",2);
01111 
01112 
01113     // TEC hits properties    
01114 
01115     histname = "NumberOfTECRecHitsPerTrack_"+ CatagoryName;
01116     NumberOfTECRecHitsPerTrack = dqmStore_->book1D(histname, histname, TECHitBin, TECHitMin, TECHitMax);
01117     NumberOfTECRecHitsPerTrack->setAxisTitle("Number of TEC RecHits of each Track",1);
01118     NumberOfTECRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
01119 
01120     histname = "NumberOfTECRecHitsPerTrackVsPhiProfile_" + CatagoryName;
01121     NumberOfTECRecHitsPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TECHitBin, TECHitMin, TECHitMax,"");
01122     NumberOfTECRecHitsPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01123     NumberOfTECRecHitsPerTrackVsPhiProfile->setAxisTitle("Number of TEC RecHits of each Track",2);
01124 
01125     histname = "NumberOfTECRecHitsPerTrackVsEtaProfile_" + CatagoryName;
01126     NumberOfTECRecHitsPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TECHitBin, TECHitMin, TECHitMax,"");
01127     NumberOfTECRecHitsPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01128     NumberOfTECRecHitsPerTrackVsEtaProfile->setAxisTitle("Number of TEC RecHits of each Track",2);
01129 
01130     histname = "NumberOfTECLayersPerTrack_"+ CatagoryName;
01131     NumberOfTECLayersPerTrack = dqmStore_->book1D(histname, histname, TECLayBin, TECLayMin, TECLayMax);
01132     NumberOfTECLayersPerTrack->setAxisTitle("Number of TEC Layers of each Track",1);
01133     NumberOfTECLayersPerTrack->setAxisTitle("Number of Tracks", 2);
01134 
01135     histname = "NumberOfTECLayersPerTrackVsPhiProfile_" + CatagoryName;
01136     NumberOfTECLayersPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, TECLayBin, TECLayMin, TECLayMax,"");
01137     NumberOfTECLayersPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01138     NumberOfTECLayersPerTrackVsPhiProfile->setAxisTitle("Number of TEC Layers of each Track",2);
01139 
01140     histname = "NumberOfTECLayersPerTrackVsEtaProfile_" + CatagoryName;
01141     NumberOfTECLayersPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, TECLayBin, TECLayMin, TECLayMax,"");
01142     NumberOfTECLayersPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01143     NumberOfTECLayersPerTrackVsEtaProfile->setAxisTitle("Number of TEC Layers of each Track",2);
01144 
01145 
01146     // PixBarrel hits properties
01147 
01148     histname = "NumberOfPixBarrelRecHitsPerTrack_" + CatagoryName;
01149     NumberOfPixBarrelRecHitsPerTrack = dqmStore_->book1D(histname, histname, PXBHitBin, PXBHitMin, PXBHitMax);
01150     NumberOfPixBarrelRecHitsPerTrack->setAxisTitle("Number of Pixel Barrel RecHits of each Track",1);
01151     NumberOfPixBarrelRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
01152 
01153     histname = "NumberOfPixBarrelRecHitsPerTrackVsPhiProfile_" + CatagoryName;
01154     NumberOfPixBarrelRecHitsPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, PXBHitBin, PXBHitMin, PXBHitMax,"");
01155     NumberOfPixBarrelRecHitsPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01156     NumberOfPixBarrelRecHitsPerTrackVsPhiProfile->setAxisTitle("Number of Pixel Barrel RecHits of each Track",2);
01157 
01158     histname = "NumberOfPixBarrelRecHitsPerTrackVsEtaProfile_" + CatagoryName;
01159     NumberOfPixBarrelRecHitsPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, PXBHitBin, PXBHitMin, PXBHitMax,"");
01160     NumberOfPixBarrelRecHitsPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01161     NumberOfPixBarrelRecHitsPerTrackVsEtaProfile->setAxisTitle("Number of Pixel Barrel RecHits of each Track",2);
01162 
01163     histname = "NumberOfPixBarrelLayersPerTrack_" + CatagoryName;
01164     NumberOfPixBarrelLayersPerTrack = dqmStore_->book1D(histname, histname, PXBLayBin, PXBLayMin, PXBLayMax);
01165     NumberOfPixBarrelLayersPerTrack->setAxisTitle("Number of Pixel Barrel Layers of each Track",1);
01166     NumberOfPixBarrelLayersPerTrack->setAxisTitle("Number of Tracks", 2);
01167 
01168     histname = "NumberOfPixBarrelLayersPerTrackVsPhiProfile_" + CatagoryName;
01169     NumberOfPixBarrelLayersPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, PXBLayBin, PXBLayMin, PXBLayMax,"");
01170     NumberOfPixBarrelLayersPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01171     NumberOfPixBarrelLayersPerTrackVsPhiProfile->setAxisTitle("Number of Pixel Barrel Layers of each Track",2);
01172 
01173     histname = "NumberOfPixBarrelLayersPerTrackVsEtaProfile_" + CatagoryName;
01174     NumberOfPixBarrelLayersPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, PXBLayBin, PXBLayMin, PXBLayMax,"");
01175     NumberOfPixBarrelLayersPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01176     NumberOfPixBarrelLayersPerTrackVsEtaProfile->setAxisTitle("Number of Pixel Barrel Layers of each Track",2);
01177 
01178 
01179     // PixEndcap hits profiles
01180 
01181     histname = "NumberOfPixEndcapRecHitsPerTrack_" + CatagoryName;
01182     NumberOfPixEndcapRecHitsPerTrack = dqmStore_->book1D(histname, histname, PXFHitBin, PXFHitMin, PXFHitMax);
01183     NumberOfPixEndcapRecHitsPerTrack->setAxisTitle("Number of Pixel Endcap RecHits of each Track",1);
01184     NumberOfPixEndcapRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
01185 
01186     histname = "NumberOfPixEndcapRecHitsPerTrackVsPhiProfile_" + CatagoryName;
01187     NumberOfPixEndcapRecHitsPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, PXBHitBin, PXBHitMin, PXBHitMax,"");
01188     NumberOfPixEndcapRecHitsPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01189     NumberOfPixEndcapRecHitsPerTrackVsPhiProfile->setAxisTitle("Number of Pixel Endcap RecHits of each Track",2);
01190 
01191     histname = "NumberOfPixEndcapRecHitsPerTrackVsEtaProfile_" + CatagoryName;
01192     NumberOfPixEndcapRecHitsPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, PXBHitBin, PXBHitMin, PXBHitMax,"");
01193     NumberOfPixEndcapRecHitsPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01194     NumberOfPixEndcapRecHitsPerTrackVsEtaProfile->setAxisTitle("Number of Pixel Endcap RecHits of each Track",2);
01195 
01196     histname = "NumberOfPixEndcapLayersPerTrack_" + CatagoryName;
01197     NumberOfPixEndcapLayersPerTrack = dqmStore_->book1D(histname, histname, PXFLayBin, PXFLayMin, PXFLayMax);
01198     NumberOfPixEndcapLayersPerTrack->setAxisTitle("Number of Pixel Endcap Layers of each Track",1);
01199     NumberOfPixEndcapLayersPerTrack->setAxisTitle("Number of Tracks", 2);
01200 
01201     histname = "NumberOfPixEndcapLayersPerTrackVsPhiProfile_" + CatagoryName;
01202     NumberOfPixEndcapLayersPerTrackVsPhiProfile = dqmStore_->bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, PXBLayBin, PXBLayMin, PXBLayMax,"");
01203     NumberOfPixEndcapLayersPerTrackVsPhiProfile->setAxisTitle("Track #phi",1);
01204     NumberOfPixEndcapLayersPerTrackVsPhiProfile->setAxisTitle("Number of Pixel Endcap Layers of each Track",2);
01205 
01206     histname = "NumberOfPixEndcapLayersPerTrackVsEtaProfile_" + CatagoryName;
01207     NumberOfPixEndcapLayersPerTrackVsEtaProfile = dqmStore_->bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, PXBLayBin, PXBLayMin, PXBLayMax,"");
01208     NumberOfPixEndcapLayersPerTrackVsEtaProfile->setAxisTitle("Track #eta",1);
01209     NumberOfPixEndcapLayersPerTrackVsEtaProfile->setAxisTitle("Number of Pixel Endcap Layers of each Track",2);
01210 
01211 }
01212 
01213 
01214 void TrackAnalyzer::doTrackerSpecificFillHists(const reco::Track & track) 
01215 {
01216   double phi   = track.phi();
01217   double eta   = track.eta();
01218 
01219   //Fill TIB Layers and RecHits
01220   NumberOfTIBRecHitsPerTrack->Fill(track.hitPattern().numberOfValidStripTIBHits()); 
01221   NumberOfTIBRecHitsPerTrackVsPhiProfile->Fill(phi,    track.hitPattern().numberOfValidStripTIBHits());
01222   NumberOfTIBRecHitsPerTrackVsEtaProfile->Fill(eta,    track.hitPattern().numberOfValidStripTIBHits());
01223 
01224   NumberOfTIBLayersPerTrack->Fill(track.hitPattern().stripTIBLayersWithMeasurement());
01225   NumberOfTIBLayersPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().stripTIBLayersWithMeasurement());
01226   NumberOfTIBLayersPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().stripTIBLayersWithMeasurement());
01227 
01228   //Fill TOB Layers and RecHits
01229   NumberOfTOBRecHitsPerTrack->Fill(track.hitPattern().numberOfValidStripTOBHits());
01230   NumberOfTOBRecHitsPerTrackVsPhiProfile->Fill(phi,    track.hitPattern().numberOfValidStripTOBHits());
01231   NumberOfTOBRecHitsPerTrackVsEtaProfile->Fill(eta,    track.hitPattern().numberOfValidStripTOBHits());
01232 
01233   NumberOfTOBLayersPerTrack->Fill(track.hitPattern().stripTOBLayersWithMeasurement());
01234   NumberOfTOBLayersPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().stripTOBLayersWithMeasurement());
01235   NumberOfTOBLayersPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().stripTOBLayersWithMeasurement());
01236   
01237 
01238   //Fill TID Layers and RecHits
01239   NumberOfTIDRecHitsPerTrack->Fill(track.hitPattern().numberOfValidStripTIDHits());
01240   NumberOfTIDRecHitsPerTrackVsPhiProfile->Fill(phi,    track.hitPattern().numberOfValidStripTIDHits());
01241   NumberOfTIDRecHitsPerTrackVsEtaProfile->Fill(eta,    track.hitPattern().numberOfValidStripTIDHits());
01242 
01243   NumberOfTIDLayersPerTrack->Fill(track.hitPattern().stripTIDLayersWithMeasurement());
01244   NumberOfTIDLayersPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().stripTIDLayersWithMeasurement());
01245   NumberOfTIDLayersPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().stripTIDLayersWithMeasurement());
01246 
01247   
01248   //Fill TEC Layers and RecHits
01249   NumberOfTECRecHitsPerTrack->Fill(track.hitPattern().numberOfValidStripTECHits());
01250   NumberOfTECRecHitsPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().numberOfValidStripTECHits());
01251   NumberOfTECRecHitsPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().numberOfValidStripTECHits());
01252 
01253   NumberOfTECLayersPerTrack->Fill(track.hitPattern().stripTECLayersWithMeasurement());
01254   NumberOfTECLayersPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().stripTECLayersWithMeasurement());
01255   NumberOfTECLayersPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().stripTECLayersWithMeasurement());
01256 
01257   //Fill PixBarrel Layers and RecHits
01258   NumberOfPixBarrelRecHitsPerTrack->Fill(track.hitPattern().numberOfValidPixelBarrelHits());
01259   NumberOfPixBarrelRecHitsPerTrackVsPhiProfile->Fill(phi,    track.hitPattern().numberOfValidPixelBarrelHits());
01260   NumberOfPixBarrelRecHitsPerTrackVsEtaProfile->Fill(eta,    track.hitPattern().numberOfValidPixelBarrelHits());
01261 
01262   NumberOfPixBarrelLayersPerTrack->Fill(track.hitPattern().pixelBarrelLayersWithMeasurement());
01263   NumberOfPixBarrelLayersPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().pixelBarrelLayersWithMeasurement());
01264   NumberOfPixBarrelLayersPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().pixelBarrelLayersWithMeasurement());
01265 
01266   //Fill PixEndcap Layers and RecHits
01267   NumberOfPixEndcapRecHitsPerTrack->Fill(track.hitPattern().numberOfValidPixelEndcapHits());
01268   NumberOfPixEndcapRecHitsPerTrackVsPhiProfile->Fill(phi,    track.hitPattern().numberOfValidPixelEndcapHits());
01269   NumberOfPixEndcapRecHitsPerTrackVsEtaProfile->Fill(eta,    track.hitPattern().numberOfValidPixelEndcapHits());
01270 
01271   NumberOfPixEndcapLayersPerTrack->Fill(track.hitPattern().pixelEndcapLayersWithMeasurement());
01272   NumberOfPixEndcapLayersPerTrackVsPhiProfile->Fill(phi,     track.hitPattern().pixelEndcapLayersWithMeasurement());
01273   NumberOfPixEndcapLayersPerTrackVsEtaProfile->Fill(eta,     track.hitPattern().pixelEndcapLayersWithMeasurement());
01274 
01275 }
01276 //
01277 // -- Set Lumi Flag
01278 //
01279 void TrackAnalyzer::setLumiFlag() {
01280   if (Chi2oNDF) Chi2oNDF->setLumiFlag();
01281   if (NumberOfRecHitsPerTrack) NumberOfRecHitsPerTrack->setLumiFlag();
01282   if (GoodTrackChi2oNDF) GoodTrackChi2oNDF->setLumiFlag();
01283   if (GoodTrackNumberOfRecHitsPerTrack) GoodTrackNumberOfRecHitsPerTrack->setLumiFlag();
01284 }
01285 //
01286 // -- Apply SoftReset 
01287 //
01288 void TrackAnalyzer::doSoftReset(DQMStore * dqmStore_) {
01289   dqmStore_->softReset(Chi2oNDF);
01290   dqmStore_->softReset(NumberOfRecHitsPerTrack);
01291   dqmStore_->softReset(GoodTrackChi2oNDF);
01292   dqmStore_->softReset(GoodTrackNumberOfRecHitsPerTrack);
01293 }
01294 //
01295 // -- Remove SoftReset
01296 //
01297 void TrackAnalyzer::undoSoftReset(DQMStore * dqmStore_) {
01298   dqmStore_->disableSoftReset(Chi2oNDF);
01299   dqmStore_->disableSoftReset(NumberOfRecHitsPerTrack);
01300   dqmStore_->disableSoftReset(GoodTrackChi2oNDF);
01301   dqmStore_->disableSoftReset(GoodTrackNumberOfRecHitsPerTrack);
01302 }
01303 
01304