00001
00009 #include <iostream>
00010 #include <time.h>
00011 #include <sys/stat.h>
00012 #include <unistd.h>
00013 #include <fstream>
00014
00015 #include "TFile.h"
00016 #include "TTree.h"
00017 #include "TH1F.h"
00018 #include "TH2F.h"
00019 #include "TCanvas.h"
00020
00021 class TCalibCrossTalkEvt {
00022 public:
00023 Float_t xtalk_slope_left;
00024 Float_t xtalk_slope_right;
00025 Float_t xtalk_int_left;
00026 Float_t xtalk_int_right;
00027 Float_t xtalk_chi2_left;
00028 Float_t xtalk_chi2_right;
00029 Float_t peakTime;
00030 Int_t strip;
00031 Int_t layer;
00032 Int_t cham;
00033 Int_t ddu;
00034 Float_t pedMean;
00035 Float_t pedRMS;
00036 Float_t peakRMS;
00037 Float_t maxADC;
00038 Float_t sum;
00039 Int_t id;
00040 Int_t flagRMS;
00041 Int_t flagNoise;
00042 Float_t MaxPed[13];
00043 Float_t MaxRMS[13];
00044 Float_t MaxPeakTime[13];
00045 Float_t MinPeakTime[13];
00046 Float_t MaxPeakADC[13];
00047 Float_t MinPeakADC[13];
00048 };
00049
00050 class CSCCrossTalkAnalyzer : public edm::EDAnalyzer {
00051 public:
00052 explicit CSCCrossTalkAnalyzer(edm::ParameterSet const& conf);
00053 virtual void analyze(edm::Event const& e, edm::EventSetup const& iSetup);
00054 ~CSCCrossTalkAnalyzer();
00055
00056 #define CHAMBERS_xt 13
00057 #define LAYERS_xt 6
00058 #define STRIPS_xt 80
00059 #define TIMEBINS_xt 8
00060 #define DDU_xt 9
00061 #define TOTALSTRIPS_xt 480
00062 #define PULSES_xt 10
00063 #define REP_xt 25
00064
00065
00066 private:
00067 int eventNumber,evt,strip,misMatch,fff,ret_code,length,Nddu,myevt,first_strip_index,strips_per_layer,chamber_index;
00068 int chamber,layer,reportedChambers,chamber_num,sector,record,NChambers ;
00069 int dmbID[CHAMBERS_xt],crateID[CHAMBERS_xt],size[CHAMBERS_xt];
00070 std::vector<int> adc;
00071 std::string chamber_id;
00072 int thebins[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt][TIMEBINS_xt*PULSES_xt];
00073 int theadccountsc[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt][TIMEBINS_xt*PULSES_xt];
00074 int theadccountsl[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt][TIMEBINS_xt*PULSES_xt];
00075 int theadccountsr[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt][TIMEBINS_xt*PULSES_xt];
00076 float pedMean,pedMean1,time,max1,max2,min1, aPeak,sumFive,maxRMS,maxPed,adcMAX;
00077 float maxPeakTime, minPeakTime, maxPeakADC, minPeakADC;
00078 float meanPedestal,meanPeak,meanPeakSquare,meanPedestalSquare,theRMS;
00079 float thePeak,thePeakMin, thePeakRMS,theSumFive,thePedestal,theRSquare;
00080 float thetime[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt][TIMEBINS_xt*PULSES_xt];
00081 float xtalk_intercept_left[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00082 float xtalk_intercept_right[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00083 float xtalk_slope_left[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00084 float xtalk_slope_right[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00085 float xtalk_chi2_left[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00086 float xtalk_chi2_right[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00087 float myPeakTime[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00088 float myMeanPeakTime[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00089 float array_meanPeakTime[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00090 float arrayOfPed[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00091 float arrayOfPedSquare[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00092 float arrayPed[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00093 float arrayPeak[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00094 float arrayPeakMin[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00095 float arrayOfPeak[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00096 float arrayOfPeakSquare[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00097 float arraySumFive[DDU_xt][CHAMBERS_xt][LAYERS_xt][STRIPS_xt];
00098 float myTime[TIMEBINS_xt];
00099 float myADC[TIMEBINS_xt];
00100 int myTbin[TIMEBINS_xt];
00101 float newPed[TOTALSTRIPS_xt];
00102 float newRMS[TOTALSTRIPS_xt];
00103 float newPeakRMS[TOTALSTRIPS_xt];
00104 float newPeak[TOTALSTRIPS_xt];
00105 float newPeakMin[TOTALSTRIPS_xt];
00106 float newSumFive[TOTALSTRIPS_xt];
00107 float new_xtalk_intercept_right[TOTALSTRIPS_xt];
00108 float new_xtalk_intercept_left[TOTALSTRIPS_xt];
00109 float new_xtalk_slope_right[TOTALSTRIPS_xt];
00110 float new_xtalk_slope_left[TOTALSTRIPS_xt];
00111 float new_rchi2[TOTALSTRIPS_xt];
00112 float new_lchi2[TOTALSTRIPS_xt];
00113 float newPeakTime[TOTALSTRIPS_xt];
00114 float newMeanPeakTime[TOTALSTRIPS_xt];
00115 int lines,myIndex;
00116 std::ifstream filein;
00117 std::string PSet,name;
00118 std::string chamber_type;
00119 bool debug;
00120 int flagRMS,flagNoise,myNcham,myCounter;
00121
00122
00123 TCalibCrossTalkEvt calib_evt;
00124 TBranch *calibevt;
00125 TTree *calibtree;
00126 TFile *calibfile;
00127 ofstream* outfile;
00128 TH1F xtime;
00129 TH1F ped_mean_all;
00130 TH1F ped_RMS_all;
00131 TH1F maxADC;
00132 TH2F pulseshape_ch0;
00133 TH2F pulseshape_ch1;
00134 TH2F pulseshape_ch2;
00135 TH2F pulseshape_ch3;
00136 TH2F pulseshape_ch4;
00137 TH2F pulseshape_ch5;
00138 TH2F pulseshape_ch6;
00139 TH2F pulseshape_ch7;
00140 TH2F pulseshape_ch8;
00141 TH2F pulseshape_ch9;
00142 TH2F pulseshape_ch10;
00143 TH2F pulseshape_ch11;
00144 TH2F pulseshape_ch12;
00145
00146 };
00147