ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HFmon2012/macros/getR.C
(Generate patch)

Comparing UserCode/HFmon2012/macros/getR.C (file contents):
Revision 1.1 by yilmaz, Mon Aug 13 14:57:42 2012 UTC vs.
Revision 1.7 by makbiyik, Wed Aug 15 17:44:46 2012 UTC

# Line 45 | Line 45 | void concentrate(TH2D*& hh){
45   }
46  
47  
48 + double getRwithTime(int run = 178579, int ieta = 30, int iphi = 57, int idepth = 1){
49  
50 <
50 <
51 <
52 <
53 <
54 < double getR(int run = 127707, int ieta = 30, int iphi = 57, int idepth = 1, double rangeMin = 1052){
50 >  double rangeMin = 1052;
51  
52    if(0){
53      run = 187937;
# Line 69 | Line 65 | double getR(int run = 127707, int ieta =
65  
66    double r = 0;
67  
68 <  TFile* inf = new TFile(Form("res%d.root",run));
68 >  TFile* inf = new TFile(Form("../test/res%d.root",run));
69    TNtuple * nt = (TNtuple*)inf->Get("nt");
70  
71    TCut channel(Form("ieta==%d&&iphi==%d&&idepth==%d",ieta,iphi,idepth));
# Line 96 | Line 92 | double getR(int run = 127707, int ieta =
92    h->SetAxisRange(rangeMin,rangeMax);
93    iMin = h->GetMaximumBin();
94    rangeMin = h->GetBinLowEdge(iMin);
95 +
96 +  if(rangeMin > 1070) rangeMin -= 25;
97    rangeMax = rangeMin + 24;
98  
99    TF1* f = new TF1("f","[0]-[1]*TMath::Erf((x-[2])/[3])",rangeMin,rangeMax);
# Line 120 | Line 118 | double getR(int run = 127707, int ieta =
118  
119   }
120  
121 +
122 + double getRwithoutTime(int run = 178579, int ieta = 30, int iphi = 57, int idepth = 1){
123 +
124 +  TH1::SetDefaultSumw2();
125 +  TH2::SetDefaultSumw2();
126 +
127 +  double r = 0;
128 +
129 +  TFile* inf = new TFile(Form("../test/res%d.root",run));
130 +  TNtuple * nt = (TNtuple*)inf->Get("nt");
131 +
132 +  TCut channel(Form("ieta==%d&&iphi==%d&&idepth==%d",ieta,iphi,idepth));
133 +  TCut reasonable("ry > -0.2 && ry < 2");
134 +
135 +  TCut wing3("(s3+s0)<0.03*(s1+s2)");
136 +  TCut wing5("(s3+s0)<0.05*(s1+s2)");
137 +  TCut wing10("(s3+s0)<0.10*(s1+s2)");
138 +
139 +  TCut wing = wing3;
140 +
141 +  TCut cut = channel && wing;
142 +
143 +  TF1* f = new TF1(Form("fg_%d_%d_%d_%d",run,ieta,iphi,idepth),"gaus(0)+[3]",0,2);
144 +
145 +  int Nbin = 50;
146 +  TH1D* h = new TH1D(Form("hg_%d_%d_%d_%d",run,ieta,iphi,idepth),"",Nbin,0,2);
147 +  TH1D* h3 = new TH1D(Form("hg3_%d_%d_%d_%d",run,ieta,iphi,idepth),"",Nbin,0,2);
148 +  TH1D* h5 = new TH1D(Form("hg5_%d_%d_%d_%d",run,ieta,iphi,idepth),"",Nbin,0,2);
149 +  TH1D* h10 = new TH1D(Form("hg10_%d_%d_%d_%d",run,ieta,iphi,idepth),"",Nbin,0,2);
150 +
151 +  nt->SetAlias("ry","s1/s2");
152 +  if(0){
153 +    nt->Draw(Form("ry>>%s",h3->GetName()),cut&&wing3,"");
154 +    nt->Draw(Form("ry>>%s",h5->GetName()),cut&&wing5,"");
155 +    nt->Draw(Form("ry>>%s",h10->GetName()),cut&&wing10,"");
156 +  }
157 +  nt->Draw(Form("ry>>%s",h->GetName()),cut,"");
158 +
159 +  f->SetParameter(0,h->GetMaximum());
160 +  f->SetParameter(1,h->GetMean());
161 +  f->SetParameter(2,h->GetRMS());
162 +
163 +
164 +  h->Fit(f,"R");
165 +
166 +  r = f->GetParameter(1);
167 +
168 +  new TCanvas();  
169 +  return r;
170 +
171 + }
172 +
173 +
174 +
175 +
176 +
177 +
178 + double getR(int run = 130158, int ieta = 30, int iphi = 57, int idepth = 1, bool useTime = 1){
179 +
180 +
181 +  double r2 = getRwithoutTime(run,ieta,iphi,idepth);
182 +  double r1 = getRwithTime(run,ieta,iphi,idepth);
183 +
184 +  TLine* line = new TLine(1000,r2,1175,r2);  
185 +  line->SetLineWidth(5);
186 +  line->SetLineColor(1);
187 +  line->SetLineStyle(2);
188 +
189 +  line->Draw("same");
190 +  if(useTime) return r1;
191 +  else return r2;
192 +
193 + }
194 +
195 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines