CMS 3D CMS Logo

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