1

#define DC_Calib_Check_HMS_cxx

2


3

#include "DC_Calib_Check_HMS.h"

4

#include <TStyle.h>

5

#include <TCanvas.h>

6

#include <TLine.h>

7

#include <TMath.h>

8

#include <TPaveText.h>

9

#include <TGaxis.h>

10


11

void DC_Calib_Check_HMS::Begin(TTree * /*tree*/)

12

{

13

printf("\n\n");

14

TString option = GetOption();

15

}

16


17

void DC_Calib_Check_HMS::SlaveBegin(TTree * /*tree*/)

18

{

19

printf("\n\n");

20

TString option = GetOption();

21


22

h2_1u1_DriftDistance = new TH2F("1u1_DriftDistance", "Drift Distance by wire number for 1u1 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

23

h2_1u2_DriftDistance = new TH2F("1u2_DriftDistance", "Drift Distance by wire number for 1u2 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

24

h2_1x1_DriftDistance = new TH2F("1x1_DriftDistance", "Drift Distance by wire number for 1x1 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

25

h2_1x2_DriftDistance = new TH2F("1x2_DriftDistance", "Drift Distance by wire number for 1x2 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

26

h2_1v1_DriftDistance = new TH2F("1v1_DriftDistance", "Drift Distance by wire number for 1v1 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

27

h2_1v2_DriftDistance = new TH2F("1v2_DriftDistance", "Drift Distance by wire number for 1v2 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

28


29

h2_2u1_DriftDistance = new TH2F("2u1_DriftDistance", "Drift Distance by wire number for 2u1 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

30

h2_2u2_DriftDistance = new TH2F("2u2_DriftDistance", "Drift Distance by wire number for 2u2 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

31

h2_2x1_DriftDistance = new TH2F("2x1_DriftDistance", "Drift Distance by wire number for 2x1 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

32

h2_2x2_DriftDistance = new TH2F("2x2_DriftDistance", "Drift Distance by wire number for 2x2 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

33

h2_2v1_DriftDistance = new TH2F("2v1_DriftDistance", "Drift Distance by wire number for 2v1 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

34

h2_2v2_DriftDistance = new TH2F("2v2_DriftDistance", "Drift Distance by wire number for 2v2 Plane; Wire Number; Drift Distance", 120, 0, 120, 100, 0, 1);

35


36

GetOutputList()>Add(h2_1u1_DriftDistance);

37

GetOutputList()>Add(h2_1u2_DriftDistance);

38

GetOutputList()>Add(h2_1x1_DriftDistance);

39

GetOutputList()>Add(h2_1x2_DriftDistance);

40

GetOutputList()>Add(h2_1v1_DriftDistance);

41

GetOutputList()>Add(h2_1v2_DriftDistance);

42


43

GetOutputList()>Add(h2_2u1_DriftDistance);

44

GetOutputList()>Add(h2_2u2_DriftDistance);

45

GetOutputList()>Add(h2_2x1_DriftDistance);

46

GetOutputList()>Add(h2_2x2_DriftDistance);

47

GetOutputList()>Add(h2_2v1_DriftDistance);

48

GetOutputList()>Add(h2_2v2_DriftDistance);

49


50

}

51


52

Bool_t DC_Calib_Check_HMS::Process(Long64_t entry)

53

{

54

fReader.SetEntry(entry);

55


56

if (H_cer_npeSum[0] < 1.0) return kTRUE;

57

if (T_hms_hEL_CLEAN_tdcTime[0] < 0) return kTRUE;

58


59

for (Int_t i = 0; i < H_dc_1u1_time.GetSize(); i++){

60

if (H_dc_1u1_time[i] > 0){

61

h2_1u1_DriftDistance>Fill(H_dc_1u1_wirenum[i], H_dc_1u1_dist[i]);

62

}

63

}

64


65

for (Int_t i = 0; i < H_dc_1u2_time.GetSize(); i++){

66

if (H_dc_1u2_time[i] > 0){

67

h2_1u2_DriftDistance>Fill(H_dc_1u2_wirenum[i], H_dc_1u2_dist[i]);

68

}

69

}

70


71

for (Int_t i = 0; i < H_dc_1x1_time.GetSize(); i++){

72

if (H_dc_1x1_time[i] > 0){

73

h2_1x1_DriftDistance>Fill(H_dc_1x1_wirenum[i], H_dc_1x1_dist[i]);

74

}

75

}

76


77

for (Int_t i = 0; i < H_dc_1x2_time.GetSize(); i++){

78

if (H_dc_1x2_time[i] > 0){

79

h2_1x2_DriftDistance>Fill(H_dc_1x2_wirenum[i], H_dc_1x2_dist[i]);

80

}

81

}

82


83

for (Int_t i = 0; i < H_dc_1v1_time.GetSize(); i++){

84

if (H_dc_1v1_time[i] > 0){

85

h2_1v1_DriftDistance>Fill(H_dc_1v1_wirenum[i], H_dc_1v1_dist[i]);

86

}

87

}

88


89

for (Int_t i = 0; i < H_dc_1v2_time.GetSize(); i++){

90

if (H_dc_1v2_time[i] > 0){

91

h2_1v2_DriftDistance>Fill(H_dc_1v2_wirenum[i], H_dc_1v2_dist[i]);

92

}

93

}

94


95

for (Int_t i = 0; i < H_dc_2u1_time.GetSize(); i++){

96

if (H_dc_2u1_time[i] > 0){

97

h2_2u1_DriftDistance>Fill(H_dc_2u1_wirenum[i], H_dc_2u1_dist[i]);

98

}

99

}

100


101

for (Int_t i = 0; i < H_dc_2u2_time.GetSize(); i++){

102

if (H_dc_2u2_time[i] > 0){

103

h2_2u2_DriftDistance>Fill(H_dc_2u2_wirenum[i], H_dc_2u2_dist[i]);

104

}

105

}

106


107

for (Int_t i = 0; i < H_dc_2x1_time.GetSize(); i++){

108

if (H_dc_2x1_time[i] > 0){

109

h2_2x1_DriftDistance>Fill(H_dc_2x1_wirenum[i], H_dc_2x1_dist[i]);

110

}

111

}

112


113

for (Int_t i = 0; i < H_dc_2x2_time.GetSize(); i++){

114

if (H_dc_2x2_time[i] > 0){

115

h2_2x2_DriftDistance>Fill(H_dc_2x2_wirenum[i], H_dc_2x2_dist[i]);

116

}

117

}

118


119

for (Int_t i = 0; i < H_dc_2v1_time.GetSize(); i++){

120

if (H_dc_2v1_time[i] > 0){

121

h2_2v1_DriftDistance>Fill(H_dc_2v1_wirenum[i], H_dc_2v1_dist[i]);

122

}

123

}

124


125

for (Int_t i = 0; i < H_dc_2v2_time.GetSize(); i++){

126

if (H_dc_2v2_time[i] > 0){

127

h2_2v2_DriftDistance>Fill(H_dc_2v2_wirenum[i], H_dc_2v2_dist[i]);

128

}

129

}

130


131

return kTRUE;

132

}

133


134

void DC_Calib_Check_HMS::SlaveTerminate()

135

{

136

}

137


138

void DC_Calib_Check_HMS::Terminate()

139

{

140

TString option = GetOption();

141


142

TString foutname = Form("HMS_DC_Calib_Check_Run%i", option.Atoi());

143

TString outputpdf = foutname + ".pdf";

144

TCanvas *cDC1 = new TCanvas("DC1","Drift Chamber 1 Planes",100,0,1000,900);

145

cDC1>Divide(2,3);

146

cDC1>cd(1); h2_1u1_DriftDistance>Draw("COLZ");

147

cDC1>cd(2); h2_1u2_DriftDistance>Draw("COLZ");

148

cDC1>cd(3); h2_1x1_DriftDistance>Draw("COLZ");

149

cDC1>cd(4); h2_1x2_DriftDistance>Draw("COLZ");

150

cDC1>cd(5); h2_1v1_DriftDistance>Draw("COLZ");

151

cDC1>cd(6); h2_1v2_DriftDistance>Draw("COLZ");

152

cDC1>Print(outputpdf + '(');

153

TCanvas *cDC2 = new TCanvas("DC2","Drift Chamber 2 Planes",100,0,1000,900);

154

cDC2>Divide(2,3);

155

cDC2>cd(1); h2_2u1_DriftDistance>Draw("COLZ");

156

cDC2>cd(2); h2_2u2_DriftDistance>Draw("COLZ");

157

cDC2>cd(3); h2_2x1_DriftDistance>Draw("COLZ");

158

cDC2>cd(4); h2_2x2_DriftDistance>Draw("COLZ");

159

cDC2>cd(5); h2_2v1_DriftDistance>Draw("COLZ");

160

cDC2>cd(6); h2_2v2_DriftDistance>Draw("COLZ");

161

cDC2>Print(outputpdf + ')');

162


163

TFile *Histogram_file = new TFile(Form("HMS_DCCalib_Check_Run%i.root",option.Atoi()),"RECREATE");

164


165

h2_1u1_DriftDistance>Write();

166

h2_1u2_DriftDistance>Write();

167

h2_1x1_DriftDistance>Write();

168

h2_1x2_DriftDistance>Write();

169

h2_1v1_DriftDistance>Write();

170

h2_1v2_DriftDistance>Write();

171


172

h2_2u1_DriftDistance>Write();

173

h2_2u2_DriftDistance>Write();

174

h2_2x1_DriftDistance>Write();

175

h2_2x2_DriftDistance>Write();

176

h2_2v1_DriftDistance>Write();

177

h2_2v2_DriftDistance>Write();

178


179

Histogram_file>Close();

180

}
