--- UserCode/wangdy/TimingCSC/interface/CSCTimingAnalyzer.h 2007/08/13 10:06:21 1.2 +++ UserCode/wangdy/TimingCSC/interface/CSCTimingAnalyzer.h 2008/09/30 10:19:18 1.13 @@ -7,22 +7,12 @@ * based on B. Jackson's analyzer by Dayong Wang * */ -// $Id: CSCTimingAnalyzer.h,v 1.2 2007/08/13 10:06:21 wangdy Exp $ +// $Id: CSCTimingAnalyzer.h,v 1.13 2008/09/30 10:19:18 wangdy Exp $ #ifndef TimingCSC_CSCTimingAnalyzer_h #define TimingCSC_CSCTimingAnalyzer_h -//#include - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/Handle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" #include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" @@ -38,13 +28,21 @@ enum /// MAX_STATIONS is set to 5 because the subsectors in ME 1 are handled /// as a separate station MAX_STATIONS = 5, - MAX_SECTORS = 6, + MAX_SECTORS = 12, MAX_CHAMBERS = 9 }; const TString stationLabel[MAX_STATIONS] = {"1a","1b","2","3","4"}; -const TString sectorLabel[MAX_SECTORS] = {"1","2","3","4","5","6"}; +const TString sectorLabel[12] = {"1","2","3","4","5","6", "7","8","9","10","11","12"}; const TString chamberLabel[MAX_CHAMBERS] = {"1","2","3","4","5","6","7","8","9"}; +const TString SecOverLabel[11] = {"1b3-1a1","1b6-1a4","2S3-1","2S3-4","2S9-1","2S9-4", + "3S3-1","3S3-4","3S9-1","3S9-4","4S3-1"}; +const int MINSEC=0; +const int MAXSEC=12; +const int TIMINGSEC=3; // this only works for naive estimation now +const int BX_START=3; // starting of hBX: 3 for MC and 0 for data +const int ABSBX_START=797; // starting of hAbsBX: run#62232:797; run#63200:234; run62384:2500 +const int NUMSEC=MAXSEC-MINSEC; class CSCTriggerMappingFromFile; @@ -61,7 +59,7 @@ public: private: - void initializeHistograms(); + void initializeHistograms(); void fillHistograms(edm::Handle corrlcts, edm::Handle tracks); @@ -73,7 +71,7 @@ private: void deleteRootObjects(); void deleteHistograms(); void deleteCanvases(); - + int myBX(edm::Event& event); bool testBeam; int TBFEDid, TBendcap, TBsector; std::string mapPath; @@ -81,6 +79,8 @@ private: int eventNumber; /* std::string day; */ + edm::InputTag lctProducer, trackProducer; + std::string run; std::string outFile; std::string timeFile; @@ -93,8 +93,16 @@ private: /// for output of const and error TFile* fTimingConst; - TH1I* hBX[MAX_SECTORS][MAX_STATIONS][MAX_CHAMBERS]; + /// for inter sector synchronization + TFile* fInterSector; + + /// for absolute BXN synchronization + TFile* fAbsBXN; + + TH1I* hBX[NUMSEC][MAX_STATIONS][MAX_CHAMBERS]; + TH1I* hAbsBX[NUMSEC][MAX_STATIONS][MAX_CHAMBERS]; TH1I* hNumTracksPerEvent; + TH1I* hBX0; TH1F* hTimingConstDirect; TH1F* hTimingConstA; TH1F* hTimingConstB; @@ -104,59 +112,100 @@ private: /// /// MAX_CHAMBERS-2 because there are that many boundaries between CSCs to /// account for in ME 234. In ME 1 there will be unused plots - TH1I* hBXDifference[MAX_SECTORS][MAX_STATIONS][MAX_CHAMBERS-2]; + TH1I* hBXDifference[NUMSEC][MAX_STATIONS][MAX_CHAMBERS-2]; /// BX difference between station 2 and 3 /// overlapping cscs in ME 2 and 3 - TH1I* hBXDifference23Overlap[MAX_SECTORS][MAX_CHAMBERS]; + TH1I* hBXDifference23Overlap[NUMSEC][MAX_CHAMBERS]; /// crossing cscs in ME 2 and 3 - TH1I* hBXDifference23Cross[MAX_SECTORS][2*MAX_CHAMBERS-4]; + TH1I* hBXDifference23Cross[NUMSEC][2*MAX_CHAMBERS-4]; /// non overlapping cscs in ME 2 and 3 - TH1I* hBXDifference23NonOverlap[MAX_SECTORS][MAX_CHAMBERS-3]; + TH1I* hBXDifference23NonOverlap[NUMSEC][MAX_CHAMBERS-3]; /// require "forward" muons /// BX difference between stations 1A and 2 /// ME 1A ring 1 - TH1I* hBXDifference1AR12[MAX_SECTORS][MAX_CHAMBERS-3]; + TH1I* hBXDifference1AR12[NUMSEC][MAX_CHAMBERS-3]; /// ME 1A ring 2/3 - TH1I* hBXDifference1AR232[MAX_SECTORS][MAX_CHAMBERS-3]; + TH1I* hBXDifference1AR232[NUMSEC][MAX_CHAMBERS-3]; /// BX difference between stations 1B and 2 /// ME 1B ring 1 - TH1I* hBXDifference1BR12[MAX_SECTORS][MAX_CHAMBERS-3]; + TH1I* hBXDifference1BR12[NUMSEC][MAX_CHAMBERS-3]; /// ME 1B ring 2/3 - TH1I* hBXDifference1BR232[MAX_SECTORS][MAX_CHAMBERS-3]; + TH1I* hBXDifference1BR232[NUMSEC][MAX_CHAMBERS-3]; + + /// BX difference within different rings in stations 1A + /// R1-R2 + TH1I* hBXDifference1AInR1R2[NUMSEC][7]; + /// R1-R3 + TH1I* hBXDifference1AInR1R3[NUMSEC][7]; + + /// BX difference within different rings in stations 1B + /// R1-R2 + TH1I* hBXDifference1BInR1R2[NUMSEC][7]; + /// R1-R3 + TH1I* hBXDifference1BInR1R3[NUMSEC][7]; + + /// BX difference within stations 1A abd 1B + TH1I* hBXDifference1AWith1B[NUMSEC][7]; + + + /// BX difference between station 3 and 4 + /// overlapping cscs in ME 3 and 4 + TH1I* hBXDifference34Overlap[NUMSEC][MAX_CHAMBERS]; + /// crossing cscs in ME 3 and 4 + TH1I* hBXDifference34Cross[NUMSEC][4]; + + /// BX differences between different sectors + TH1I* hBXDifferenceSector[NUMSEC][11]; + - /// Canvases to display the histograms once they are filled - TCanvas* cBX[MAX_SECTORS][MAX_STATIONS]; + TCanvas* cBX[NUMSEC][MAX_STATIONS]; TCanvas* cNumTracksPerEvent; TCanvas* cTimingConstA; TCanvas* cTimingConstB; TCanvas* cTimingConstDirect; TCanvas* cTimingComp; - TCanvas* cBXDifference[MAX_SECTORS][MAX_STATIONS]; + TCanvas* cBXDifference[NUMSEC][MAX_STATIONS]; /// Canvases for printing BX Difference between station 2 and 3 /// Overlapping cscs in stations 2 and 3 - TCanvas* cBXDifference23Overlap[MAX_SECTORS]; + TCanvas* cBXDifference23Overlap[NUMSEC]; /// Crossing cscs in stations 2 and 3 - TCanvas* cBXDifference23Cross[MAX_SECTORS]; + TCanvas* cBXDifference23Cross[NUMSEC]; /// Non-overlapping cscs in stations 2 and 3 - TCanvas* cBXDifference23NonOverlap[MAX_SECTORS]; + TCanvas* cBXDifference23NonOverlap[NUMSEC]; /// Canvases for printing BX differences between station 1A and 2 /// ME 1A ring 1 - TCanvas* cBXDifference1AR12[MAX_SECTORS]; + TCanvas* cBXDifference1AR12[NUMSEC]; /// ME 1A ring 2/3 - TCanvas* cBXDifference1AR232[MAX_SECTORS]; + TCanvas* cBXDifference1AR232[NUMSEC]; /// Canvases for printing BX differences between station 1B and 2 /// ME 1B ring 1 - TCanvas* cBXDifference1BR12[MAX_SECTORS]; + TCanvas* cBXDifference1BR12[NUMSEC]; /// ME 1B ring 2/3 - TCanvas* cBXDifference1BR232[MAX_SECTORS]; + TCanvas* cBXDifference1BR232[NUMSEC]; + + /// Canvases for printing BX differences within station 1A + /// R1R2 + TCanvas* cBXDifference1AInR1R2[NUMSEC]; + /// R1R3 + TCanvas* cBXDifference1AInR1R3[NUMSEC]; + + /// Canvases for printing BX differences within station 1B + /// R1R2 + TCanvas* cBXDifference1BInR1R2[NUMSEC]; + /// R1R3 + TCanvas* cBXDifference1BInR1R3[NUMSEC]; + + /// Canvases for printing BX differences of station 1A and 1B + TCanvas* cBXDifference1AWith1B[NUMSEC]; + };