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 TCalibOldCrossTalkEvt {
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 CSCOldCrossTalkAnalyzer : public edm::EDAnalyzer {
00051 public:
00052 explicit CSCOldCrossTalkAnalyzer(edm::ParameterSet const& conf);
00053 virtual void analyze(edm::Event const& e, edm::EventSetup const& iSetup);
00054 ~CSCOldCrossTalkAnalyzer();
00055
00056 #define CHAMBERS_oldxt 13
00057 #define LAYERS_oldxt 6
00058 #define STRIPS_oldxt 80
00059 #define TIMEBINS_oldxt 8
00060 #define DDU_oldxt 4
00061 #define TOTALSTRIPS_oldxt 480
00062 #define PULSES_oldxt 20
00063
00064
00065 private:
00066 int eventNumber,evt,strip,misMatch,fff,ret_code,length,Nddu,myevt,first_strip_index,strips_per_layer,chamber_index;
00067 int chamber,layer,reportedChambers,chamber_num,sector,record,NChambers ;
00068 int dmbID[CHAMBERS_oldxt],crateID[CHAMBERS_oldxt],size[CHAMBERS_oldxt];
00069 std::vector<int> adc;
00070 std::string chamber_id;
00071 int thebins[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt][TIMEBINS_oldxt*PULSES_oldxt];
00072 int theadccountsc[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt][TIMEBINS_oldxt*PULSES_oldxt];
00073 int theadccountsl[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt][TIMEBINS_oldxt*PULSES_oldxt];
00074 int theadccountsr[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt][TIMEBINS_oldxt*PULSES_oldxt];
00075 float pedMean,pedMean1,time,max1,max2,min1, aPeak,sumFive,maxRMS,maxPed,adcMAX;
00076 float maxPeakTime, minPeakTime, maxPeakADC, minPeakADC;
00077 float meanPedestal,meanPeak,meanPeakSquare,meanPedestalSquare,theRMS;
00078 float thePeak,thePeakMin, thePeakRMS,theSumFive,thePedestal,theRSquare;
00079 float thetime[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt][TIMEBINS_oldxt*PULSES_oldxt];
00080 float xtalk_intercept_left[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00081 float xtalk_intercept_right[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00082 float xtalk_slope_left[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00083 float xtalk_slope_right[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00084 float xtalk_chi2_left[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00085 float xtalk_chi2_right[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00086 float myPeakTime[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00087 float myMeanPeakTime[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00088 float array_meanPeakTime[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00089 float arrayOfPed[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00090 float arrayOfPedSquare[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00091 float arrayPed[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00092 float arrayPeak[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00093 float arrayPeakMin[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00094 float arrayOfPeak[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00095 float arrayOfPeakSquare[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00096 float arraySumFive[DDU_oldxt][CHAMBERS_oldxt][LAYERS_oldxt][STRIPS_oldxt];
00097 float myTime[TIMEBINS_oldxt];
00098 float myADC[TIMEBINS_oldxt];
00099 int myTbin[TIMEBINS_oldxt];
00100 float newPed[TOTALSTRIPS_oldxt];
00101 float newRMS[TOTALSTRIPS_oldxt];
00102 float newPeakRMS[TOTALSTRIPS_oldxt];
00103 float newPeak[TOTALSTRIPS_oldxt];
00104 float newPeakMin[TOTALSTRIPS_oldxt];
00105 float newSumFive[TOTALSTRIPS_oldxt];
00106 float new_xtalk_intercept_right[TOTALSTRIPS_oldxt];
00107 float new_xtalk_intercept_left[TOTALSTRIPS_oldxt];
00108 float new_xtalk_slope_right[TOTALSTRIPS_oldxt];
00109 float new_xtalk_slope_left[TOTALSTRIPS_oldxt];
00110 float new_rchi2[TOTALSTRIPS_oldxt];
00111 float new_lchi2[TOTALSTRIPS_oldxt];
00112 float newPeakTime[TOTALSTRIPS_oldxt];
00113 float newMeanPeakTime[TOTALSTRIPS_oldxt];
00114 int lines,myIndex;
00115 std::ifstream filein;
00116 std::string PSet,name;
00117 bool debug;
00118 int flagRMS,flagNoise;
00119
00120
00121 TCalibOldCrossTalkEvt calib_evt;
00122 TBranch *calibevt;
00123 TTree *calibtree;
00124 TFile *calibfile;
00125 ofstream* outfile;
00126 TH1F xtime;
00127 TH1F ped_mean_all;
00128 TH1F ped_RMS_all;
00129 TH1F maxADC;
00130 TH2F pulseshape_ch0;
00131 TH2F pulseshape_ch1;
00132 TH2F pulseshape_ch2;
00133 TH2F pulseshape_ch3;
00134 TH2F pulseshape_ch4;
00135 TH2F pulseshape_ch5;
00136 TH2F pulseshape_ch6;
00137 TH2F pulseshape_ch7;
00138 TH2F pulseshape_ch8;
00139 TH2F pulseshape_ch9;
00140 TH2F pulseshape_ch10;
00141 TH2F pulseshape_ch11;
00142 TH2F pulseshape_ch12;
00143
00144 };
00145