CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:   EcalCosmicsHists 
00004 // Class:     EcalCosmicsHists 
00005 // 
00013 //
00014 // Original Author:  Seth COOPER
00015 //         Created:  Th Nov 22 5:46:22 CEST 2007
00016 // $Id: EcalCosmicsHists.h,v 1.4 2010/01/04 15:07:39 ferriff Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include <vector>
00024 #include <map>
00025 #include <set>
00026 
00027 // user include files
00028 #include "FWCore/Framework/interface/Frameworkfwd.h"
00029 #include "FWCore/Framework/interface/EDAnalyzer.h"
00030 #include "FWCore/Framework/interface/Event.h"
00031 #include "FWCore/Framework/interface/MakerMacros.h"
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033 #include "FWCore/Framework/interface/ESHandle.h"
00034 
00035 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00036 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
00037 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00038 #include "DataFormats/DetId/interface/DetId.h"
00039 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00040 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
00041 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
00042 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00043 #include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h"
00044 
00045 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
00046 
00047 #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h"
00048 
00049 #include "TFile.h"
00050 #include "TH1F.h"
00051 #include "TH2F.h"
00052 #include "TH3F.h"
00053 #include "TGraph.h"
00054 #include "TNtuple.h"
00055 
00056 
00057 // *** for TrackAssociation
00058 #include "DataFormats/TrackReco/interface/Track.h"
00059 #include "DataFormats/Common/interface/Handle.h"
00060 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
00061 #include "TrackingTools/TrackAssociator/interface/TrackAssociatorParameters.h"
00062 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00063 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00064 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00065 // ***
00066 
00067 //
00068 // class declaration
00069 //
00070 
00071 class EcalCosmicsHists : public edm::EDAnalyzer {
00072    public:
00073       explicit EcalCosmicsHists(const edm::ParameterSet&);
00074       ~EcalCosmicsHists();
00075 
00076 
00077    private:
00078       virtual void beginRun(edm::Run const &, edm::EventSetup const &) ;
00079       virtual void analyze(edm::Event const &, edm::EventSetup const &);
00080       virtual void endJob() ;
00081       std::string intToString(int num);
00082       void initHists(int);
00083       std::vector<bool> determineTriggers(const edm::Event&, const edm::EventSetup& eventSetup);
00084 
00085   // ----------member data ---------------------------
00086   
00087   edm::InputTag ecalRawDataColl_;
00088   edm::InputTag ecalRecHitCollectionEB_;
00089   edm::InputTag ecalRecHitCollectionEE_;
00090   edm::InputTag barrelClusterCollection_;
00091   edm::InputTag endcapClusterCollection_;
00092   edm::InputTag l1GTReadoutRecTag_;
00093   edm::InputTag l1GMTReadoutRecTag_;
00094   
00095   int runNum_;
00096   double histRangeMax_, histRangeMin_;
00097   double minTimingAmpEB_;
00098   double minTimingAmpEE_;
00099   double minRecHitAmpEB_;
00100   double minRecHitAmpEE_;
00101   double minHighEnergy_;
00102   
00103   double *ttEtaBins;
00104   double *modEtaBins;
00105   std::string fileName_;
00106   bool runInFileName_;
00107 
00108   double startTime_, runTimeLength_;
00109   int numTimingBins_; 
00110   
00111   std::map<int,TH1F*> FEDsAndHists_;
00112   std::map<int,TH1F*> FEDsAndE2Hists_;
00113   std::map<int,TH1F*> FEDsAndenergyHists_;
00114   std::map<int,TH1F*> FEDsAndTimingHists_;
00115   std::map<int,TH1F*> FEDsAndFrequencyHists_;
00116   std::map<int,TH1F*> FEDsAndiPhiProfileHists_;
00117   std::map<int,TH1F*> FEDsAndNumXtalsInClusterHists_;
00118   std::map<int,TH1F*> FEDsAndiEtaProfileHists_;
00119   std::map<int,TH2F*> FEDsAndTimingVsFreqHists_;
00120   std::map<int,TH2F*> FEDsAndTimingVsAmpHists_;
00121   std::map<int,TH2F*> FEDsAndE2vsE1Hists_;
00122   std::map<int,TH2F*> FEDsAndenergyvsE1Hists_;
00123   std::map<int,TH2F*> FEDsAndOccupancyHists_;  
00124   std::map<int,TH2F*> FEDsAndTimingVsPhiHists_;  
00125   std::map<int,TH2F*> FEDsAndTimingVsEtaHists_;  
00126   std::map<int,TH2F*> FEDsAndTimingVsModuleHists_;  
00127   std::map<int,TH2F*> FEDsAndDCCRuntypeVsBxHists_;
00128 
00129   TH1F* allFedsHist_;
00130   TH1F* allFedsE2Hist_;
00131   TH1F* allFedsenergyHist_;
00132   TH1F* allFedsenergyHighHist_;
00133   TH1F* allFedsenergyOnlyHighHist_;
00134   TH1F* allFedsTimingHist_;
00135   TH1F* allFedsFrequencyHist_;
00136   TH1F* allFedsiPhiProfileHist_;
00137   TH1F* allFedsiEtaProfileHist_;
00138   TH1F* allFedsNumXtalsInClusterHist_;
00139   TH1F* NumXtalsInClusterHist_;
00140   TH1F* numberofCosmicsHist_;
00141   TH1F* numberofCosmicsWTrackHist_;
00142   TH1F* numberofGoodEvtFreq_;
00143 
00144   TH1F* numberofCosmicsHistEB_;
00145 
00146   //TH1F* numberofSCCosmicsHist_;//SC Num cosmics
00147   TH1F* numberofBCinSC_;//SC Num cosmics
00148   TH2F* numberofBCinSCphi_;//SC
00149 
00150   TH2F* TrueBCOccupancy_;
00151   TH2F* TrueBCOccupancyCoarse_;
00152 
00153   TH2F* numxtalsVsEnergy_;
00154   TH2F* numxtalsVsHighEnergy_;
00155 
00156   TH2F* allFedsE2vsE1Hist_;
00157   TH2F* allFedsenergyvsE1Hist_;
00158   TH2F* allOccupancy_; //New file to do eta-phi occupancy
00159   TH2F* TrueOccupancy_; //New file to do eta-phi occupancy
00160   TH2F* allOccupancyCoarse_; //New file to do eta-phi occupancy
00161   TH2F* TrueOccupancyCoarse_; //New file to do eta-phi occupancy
00162 
00163   // single xtal clusters
00164   TH2F* allOccupancySingleXtal_;
00165   TH1F* energySingleXtalHist_;
00166 
00167   TH2F* allFedsTimingVsFreqHist_;
00168   TH2F* allFedsTimingVsAmpHist_;
00169   TH2F* allFedsTimingPhiHist_;
00170   TH2F* allFedsTimingEtaHist_;
00171   TH2F* allFedsTimingPhiEbpHist_;
00172   TH2F* allFedsTimingPhiEbmHist_;
00173   TH3F* allFedsTimingPhiEtaHist_;
00174   TH3F* allFedsTimingTTHist_;
00175   TH2F* allFedsTimingLMHist_;
00176 
00177   TH1F* allFedsTimingEbpHist_;
00178   TH1F* allFedsTimingEbmHist_;
00179   TH1F* allFedsTimingEbpTopHist_;
00180   TH1F* allFedsTimingEbmTopHist_;
00181   TH1F* allFedsTimingEbpBottomHist_;
00182   TH1F* allFedsTimingEbmBottomHist_;
00183 
00184   TH2F* allOccupancyECAL_; 
00185   TH2F* allOccupancyCoarseECAL_; 
00186   TH2F* allOccupancyExclusiveECAL_; 
00187   TH2F* allOccupancyCoarseExclusiveECAL_; 
00188   TH1F* allFedsTimingHistECAL_;
00189   TH3F* allFedsTimingPhiEtaHistECAL_;
00190   TH3F* allFedsTimingTTHistECAL_;
00191   TH2F* allFedsTimingLMHistECAL_;
00192 
00193   TH2F* allOccupancyDT_; 
00194   TH2F* allOccupancyCoarseDT_; 
00195   TH2F* allOccupancyExclusiveDT_; 
00196   TH2F* allOccupancyCoarseExclusiveDT_; 
00197   TH1F* allFedsTimingHistDT_;
00198   TH3F* allFedsTimingPhiEtaHistDT_;
00199   TH3F* allFedsTimingTTHistDT_;
00200   TH2F* allFedsTimingLMHistDT_;
00201 
00202   TH2F* allOccupancyRPC_; 
00203   TH2F* allOccupancyCoarseRPC_; 
00204   TH2F* allOccupancyExclusiveRPC_; 
00205   TH2F* allOccupancyCoarseExclusiveRPC_; 
00206   TH1F* allFedsTimingHistRPC_;
00207   TH3F* allFedsTimingPhiEtaHistRPC_;
00208   TH3F* allFedsTimingTTHistRPC_;
00209   TH2F* allFedsTimingLMHistRPC_;
00210 
00211   TH2F* allOccupancyCSC_; 
00212   TH2F* allOccupancyCoarseCSC_; 
00213   TH2F* allOccupancyExclusiveCSC_; 
00214   TH2F* allOccupancyCoarseExclusiveCSC_; 
00215   TH1F* allFedsTimingHistCSC_;
00216   TH3F* allFedsTimingPhiEtaHistCSC_;
00217   TH3F* allFedsTimingTTHistCSC_;
00218   TH2F* allFedsTimingLMHistCSC_;
00219 
00220   TH2F* allOccupancyHCAL_; 
00221   TH2F* allOccupancyCoarseHCAL_; 
00222   TH2F* allOccupancyExclusiveHCAL_; 
00223   TH2F* allOccupancyCoarseExclusiveHCAL_; 
00224   TH1F* allFedsTimingHistHCAL_;
00225   TH3F* allFedsTimingPhiEtaHistHCAL_;
00226   TH3F* allFedsTimingTTHistHCAL_;
00227   TH2F* allFedsTimingLMHistHCAL_;
00228 
00229   TH1F* allFedsTimingHistEcalMuon_;
00230   
00231   TH1F* triggerHist_;
00232   TH1F* triggerExclusiveHist_;
00233 
00234   TH2F* allOccupancyHighEnergy_; 
00235   TH2F* allOccupancyHighEnergyCoarse_; 
00236   TH3F* allFedsOccupancyHighEnergyHist_;
00237 
00238   TH1F* runNumberHist_;
00239   TH1F* deltaRHist_;
00240   TH1F* deltaEtaHist_;
00241   TH1F* deltaPhiHist_;
00242   TH1F* ratioAssocTracksHist_;
00243   TH1F* ratioAssocClustersHist_;
00244   TH2F* deltaEtaDeltaPhiHist_;
00245   TH2F* seedTrackPhiHist_;
00246   TH2F* seedTrackEtaHist_;
00247 
00248   // DCC Event type (runtype) vs. bx
00249   TH2F* dccEventVsBxHist_;
00250   TH1F* dccBXErrorByFEDHist_;
00251   TH1F* dccOrbitErrorByFEDHist_;
00252   TH1F* dccRuntypeErrorByFEDHist_;
00253   TH1F* dccRuntypeHist_;
00254   TH2F* dccErrorVsBxHist_;
00255   
00256   // track association
00257   TH2F* trackAssoc_muonsEcal_;
00258   TrackDetectorAssociator trackAssociator_;
00259   TrackAssociatorParameters trackParameters_;
00260   TH1F* numberofCrossedEcalIdsHist_;
00261 
00262   // top & bottom
00263   TH1F* numberofCosmicsTopBottomHist_;
00264   int cosmicCounterTopBottom_;
00265 
00266   // hcal energy
00267   TH1F * hcalEnergy_HBHE_;
00268   TH1F * hcalEnergy_HF_;
00269   TH1F * hcalEnergy_HO_;
00270   TH2F * hcalHEHBecalEB_;
00271 
00272   // high energy analysis (inherited from serena)
00273   TH1F* HighEnergy_NumXtal;
00274   TH2F* HighEnergy_NumXtalFedId;
00275   TH2F* HighEnergy_NumXtaliphi;
00276   TH3F* HighEnergy_energy3D;
00277   TH2F* HighEnergy_energyNumXtal;
00278 
00279   TH1F* HighEnergy_numClusHighEn;
00280   TH1F* HighEnergy_ratioClusters;
00281 
00282   TH1F* HighEnergy_bestSeed;
00283   TH2F* HighEnergy_bestSeedOccupancy;
00284 
00285   TH2F* HighEnergy_2GeV_occuCoarse;
00286   TH3F* HighEnergy_2GeV_occu3D;
00287   TH2F* HighEnergy_100GeV_occuCoarse;
00288   TH3F* HighEnergy_100GeV_occu3D;
00289 
00290   TH1F* HighEnergy_numRecoTrackBarrel;
00291   TH1F* HighEnergy_TracksAngle;
00292   TH1F* HighEnergy_TracksAngleTopBottom;
00293   TH3F* HighEnergy_0tracks_occu3D;
00294   TH3F* HighEnergy_1tracks_occu3D;
00295   TH3F* HighEnergy_2tracks_occu3D;
00296 
00297   TH3F* HighEnergy_0tracks_occu3DXtal;
00298   TH3F* HighEnergy_1tracks_occu3DXtal;
00299   TH3F* HighEnergy_2tracks_occu3DXtal;
00300   
00301   //for timestamp information
00302   TH1F* allFedsFreqTimeHist_;
00303   TH2F* allFedsFreqTimeVsPhiHist_;
00304   TH2F* allFedsFreqTimeVsPhiTTHist_;
00305   TH2F* allFedsFreqTimeVsEtaHist_;
00306   TH2F* allFedsFreqTimeVsEtaTTHist_;
00307   
00308   // Plots for EE
00309   TH2F* EEP_AllOccupancyCoarse_;
00310   TH2F* EEP_AllOccupancy_;
00311   TH1F* EEP_FedsenergyHist_;
00312   TH1F* EEP_FedsenergyHighHist_;
00313   TH1F* EEP_FedsenergyOnlyHighHist_;
00314   TH1F* EEP_FedsE2Hist_;
00315   TH2F* EEP_FedsE2vsE1Hist_;
00316   TH2F* EEP_FedsenergyvsE1Hist_;
00317   TH1F* EEP_FedsSeedEnergyHist_;
00318 
00319   TH1F* EEP_FedsNumXtalsInClusterHist_;
00320   TH1F* EEP_NumXtalsInClusterHist_;
00321   TH2F* EEP_numxtalsVsEnergy_;
00322   TH2F* EEP_numxtalsVsHighEnergy_;
00323   TH1F* EEP_numberofBCinSC_;
00324 
00325   TH1F* EEP_numberofCosmicsHist_;
00326 
00327   TH2F* EEP_OccupancySingleXtal_;
00328   TH1F* EEP_energySingleXtalHist_;
00329 
00330   TH1F* EEP_FedsTimingHist_;        
00331   TH2F* EEP_FedsTimingVsAmpHist_;
00332   TH3F* EEP_FedsTimingTTHist_;
00333 
00334   TH2F* EEP_OccupancyECAL_; 
00335   TH2F* EEP_OccupancyCoarseECAL_; 
00336   TH2F* EEP_OccupancyExclusiveECAL_; 
00337   TH2F* EEP_OccupancyCoarseExclusiveECAL_; 
00338   TH1F* EEP_FedsTimingHistECAL_;
00339   TH3F* EEP_FedsTimingTTHistECAL_;
00340 
00341   TH2F* EEP_OccupancyDT_; 
00342   TH2F* EEP_OccupancyCoarseDT_; 
00343   TH2F* EEP_OccupancyExclusiveDT_; 
00344   TH2F* EEP_OccupancyCoarseExclusiveDT_; 
00345   TH1F* EEP_FedsTimingHistDT_;
00346   TH3F* EEP_FedsTimingTTHistDT_;
00347 
00348   TH2F* EEP_OccupancyRPC_; 
00349   TH2F* EEP_OccupancyCoarseRPC_; 
00350   TH2F* EEP_OccupancyExclusiveRPC_; 
00351   TH2F* EEP_OccupancyCoarseExclusiveRPC_; 
00352   TH1F* EEP_FedsTimingHistRPC_;
00353   TH3F* EEP_FedsTimingTTHistRPC_;
00354 
00355   TH2F* EEP_OccupancyCSC_; 
00356   TH2F* EEP_OccupancyCoarseCSC_; 
00357   TH2F* EEP_OccupancyExclusiveCSC_; 
00358   TH2F* EEP_OccupancyCoarseExclusiveCSC_; 
00359   TH1F* EEP_FedsTimingHistCSC_;
00360   TH3F* EEP_FedsTimingTTHistCSC_;
00361 
00362   TH2F* EEP_OccupancyHCAL_; 
00363   TH2F* EEP_OccupancyCoarseHCAL_; 
00364   TH2F* EEP_OccupancyExclusiveHCAL_; 
00365   TH2F* EEP_OccupancyCoarseExclusiveHCAL_; 
00366   TH1F* EEP_FedsTimingHistHCAL_;
00367   TH3F* EEP_FedsTimingTTHistHCAL_;
00368 
00369   TH1F* EEP_triggerHist_;
00370   TH1F* EEP_triggerExclusiveHist_;
00371 
00372   TH2F* EEP_OccupancyHighEnergy_; 
00373   TH2F* EEP_OccupancyHighEnergyCoarse_; 
00374 
00375   // EE-
00376   TH2F* EEM_AllOccupancyCoarse_;
00377   TH2F* EEM_AllOccupancy_;
00378   TH1F* EEM_FedsenergyHist_;
00379   TH1F* EEM_FedsenergyHighHist_;
00380   TH1F* EEM_FedsenergyOnlyHighHist_;
00381   TH1F* EEM_FedsE2Hist_;
00382   TH2F* EEM_FedsE2vsE1Hist_;
00383   TH2F* EEM_FedsenergyvsE1Hist_;
00384   TH1F* EEM_FedsSeedEnergyHist_;
00385 
00386   TH1F* EEM_FedsNumXtalsInClusterHist_;
00387   TH1F* EEM_NumXtalsInClusterHist_;
00388   TH2F* EEM_numxtalsVsEnergy_;
00389   TH2F* EEM_numxtalsVsHighEnergy_;
00390   TH1F* EEM_numberofBCinSC_;
00391 
00392   TH1F* EEM_numberofCosmicsHist_;
00393 
00394   TH2F* EEM_OccupancySingleXtal_;
00395   TH1F* EEM_energySingleXtalHist_;
00396 
00397   TH1F* EEM_FedsTimingHist_;        
00398   TH2F* EEM_FedsTimingVsAmpHist_;
00399   TH3F* EEM_FedsTimingTTHist_;
00400 
00401   TH2F* EEM_OccupancyECAL_; 
00402   TH2F* EEM_OccupancyCoarseECAL_; 
00403   TH2F* EEM_OccupancyExclusiveECAL_; 
00404   TH2F* EEM_OccupancyCoarseExclusiveECAL_; 
00405   TH1F* EEM_FedsTimingHistECAL_;
00406   TH3F* EEM_FedsTimingTTHistECAL_;
00407 
00408   TH2F* EEM_OccupancyDT_; 
00409   TH2F* EEM_OccupancyCoarseDT_; 
00410   TH2F* EEM_OccupancyExclusiveDT_; 
00411   TH2F* EEM_OccupancyCoarseExclusiveDT_; 
00412   TH1F* EEM_FedsTimingHistDT_;
00413   TH3F* EEM_FedsTimingTTHistDT_;
00414 
00415   TH2F* EEM_OccupancyRPC_; 
00416   TH2F* EEM_OccupancyCoarseRPC_; 
00417   TH2F* EEM_OccupancyExclusiveRPC_; 
00418   TH2F* EEM_OccupancyCoarseExclusiveRPC_; 
00419   TH1F* EEM_FedsTimingHistRPC_;
00420   TH3F* EEM_FedsTimingTTHistRPC_;
00421 
00422   TH2F* EEM_OccupancyCSC_; 
00423   TH2F* EEM_OccupancyCoarseCSC_; 
00424   TH2F* EEM_OccupancyExclusiveCSC_; 
00425   TH2F* EEM_OccupancyCoarseExclusiveCSC_; 
00426   TH1F* EEM_FedsTimingHistCSC_;
00427   TH3F* EEM_FedsTimingTTHistCSC_;
00428 
00429   TH2F* EEM_OccupancyHCAL_; 
00430   TH2F* EEM_OccupancyCoarseHCAL_; 
00431   TH2F* EEM_OccupancyExclusiveHCAL_; 
00432   TH2F* EEM_OccupancyCoarseExclusiveHCAL_; 
00433   TH1F* EEM_FedsTimingHistHCAL_;
00434   TH3F* EEM_FedsTimingTTHistHCAL_;
00435   
00436   TH1F* EEM_triggerHist_;
00437   TH1F* EEM_triggerExclusiveHist_;
00438 
00439   TH2F* EEM_OccupancyHighEnergy_; 
00440   TH2F* EEM_OccupancyHighEnergyCoarse_; 
00441 
00442   EcalFedMap* fedMap_;
00443 
00444   TFile* file;
00445   
00446   int naiveEvtNum_; 
00447   int cosmicCounter_;
00448   int cosmicCounterEB_;
00449   int cosmicCounterEEP_;
00450   int cosmicCounterEEM_;
00451 
00452   std::vector<int> l1Accepts_;
00453   std::vector<std::string> l1Names_;
00454 
00455   const EcalElectronicsMapping* ecalElectronicsMap_;
00456 
00457 };