File indexing completed on 2023-10-25 10:00:53
0001 #ifndef PCCNTupler_h
0002 #define PCCNTupler_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <map>
0019
0020 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "FWCore/ServiceRegistry/interface/Service.h"
0023 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0024 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
0025 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0026 #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
0027 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0028 #include "DataFormats/VertexReco/interface/Vertex.h"
0029
0030 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0031
0032 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0033 #include "FWCore/Utilities/interface/EDGetToken.h"
0034
0035 #include "TObject.h"
0036 #include "TH1F.h"
0037
0038 class TObject;
0039 class TTree;
0040 class TH1D;
0041 class TFile;
0042 class RectangularPixelTopology;
0043 class DetId;
0044
0045 class PCCNTupler : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::one::WatchLuminosityBlocks> {
0046 public:
0047 PCCNTupler(const edm::ParameterSet&);
0048 virtual ~PCCNTupler();
0049 virtual void beginJob() override;
0050 virtual void endJob() override;
0051 virtual void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0052 void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
0053 void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
0054
0055 protected:
0056 void Reset();
0057 void SaveAndReset();
0058 void ComputeMeanAndMeanError();
0059
0060 private:
0061 edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > pixelToken;
0062 edm::EDGetTokenT<reco::VertexCollection> recoVtxToken;
0063 edm::EDGetTokenT<std::vector<PileupSummaryInfo> > pileUpToken;
0064 edm::EDGetTokenT<reco::CaloJetCollection> hltjetsToken_;
0065 float *jhcalpt, *jhcalphi, *jhcaleta, *jhcale, *jhcalemf, *jhcaln90, *jhcaln90hits;
0066 int nhjetcal;
0067
0068 edm::InputTag fPrimaryVertexCollectionLabel;
0069 edm::InputTag fPixelClusterLabel;
0070 edm::InputTag fPileUpInfoLabel;
0071
0072 static const int MAX_VERTICES = 300;
0073
0074
0075 std::string saveType = "LumiSect";
0076 std::string sampleType = "MC";
0077 bool saveAndReset;
0078 bool sameEvent;
0079 bool sameLumiNib;
0080 bool sameLumiSect;
0081 bool firstEvent;
0082
0083
0084 TTree* tree;
0085 int run;
0086 int LS = -99;
0087 int LN = -99;
0088 int event = -99;
0089 int bunchCrossing = -99;
0090 int orbit = -99;
0091
0092 std::pair<int, int> bxModKey;
0093
0094 int eventCounter = 0;
0095 int totalEvents;
0096
0097 bool includeVertexInformation;
0098 bool includePixels;
0099 bool includeJets;
0100 bool splitByBX;
0101 bool pixelPhase2Geometry;
0102
0103 int nPU;
0104 int nVtx;
0105 int vtx_nTrk[MAX_VERTICES];
0106 int vtx_ndof[MAX_VERTICES];
0107 float vtx_x[MAX_VERTICES];
0108 float vtx_y[MAX_VERTICES];
0109 float vtx_z[MAX_VERTICES];
0110 float vtx_xError[MAX_VERTICES];
0111 float vtx_yError[MAX_VERTICES];
0112 float vtx_zError[MAX_VERTICES];
0113 float vtx_chi2[MAX_VERTICES];
0114 float vtx_normchi2[MAX_VERTICES];
0115 bool vtx_isValid[MAX_VERTICES];
0116 bool vtx_isFake[MAX_VERTICES];
0117 bool vtx_isGood[MAX_VERTICES];
0118
0119 std::map<int, int> nGoodVtx;
0120 std::map<int, int> nValidVtx;
0121 std::map<std::pair<int, int>, int> nPixelClusters;
0122 std::map<std::pair<int, int>, int> nClusters;
0123 std::map<int, int> layers;
0124
0125 std::map<std::pair<int, int>, float> meanPixelClusters;
0126 std::map<std::pair<int, int>, float> meanPixelClustersError;
0127
0128 TH1F* pileup;
0129
0130 UInt_t timeStamp_begin;
0131 UInt_t timeStamp_local;
0132 UInt_t timeStamp_end;
0133 std::map<int, int> BXNo;
0134 };
0135
0136 #endif