StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtStraightPlotter.cxx
1 #include "StFgtStraightPlotter.h"
3 #include "StFgtGeneralBase.h"
4 #include "StRoot/StEvent/StFgtCollection.h"
5 #include "StRoot/StEvent/StFgtHitCollection.h"
6 #include "StRoot/StEvent/StFgtHit.h"
7 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
8 #include "StRoot/StEvent/StEvent.h"
9 #include "StRoot/StEvent/StEventInfo.h"
10 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
11 #include "TMath.h"
12 
13 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
14 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
15 #include "StMuDSTMaker/COMMON/StMuDst.h"
16 #include "StMuDSTMaker/COMMON/StMuEvent.h"
17 #include "StarClassLibrary/StThreeVectorF.hh"
18 #include <cstdlib>
19 
20 #include <TH2D.h>
21 #include <TROOT.h>
22 #include <TStyle.h>
23 #include <TCanvas.h>
24 #include <utility>
25 #include <TArc.h>
26 #include <TLine.h>
27 #include <set>
28 
29 //#define PRINT_1D
30 //max num clusters any disk is allowed to have
31 
32 #include "StFgtCosmicAlignment.h"
33 
34 #define MAX_DIST_STRIP_R 0.7
35 #define MAX_DIST_STRIP_PHI 0.03
36 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
37 //#define LEN_CONDITION
38 #define PULSE_CONDITION
39 #define DO_PRINT
40 
41 
42 #include "StRoot/StEvent/StEvent.h"
43 #include "StRoot/StEvent/StFgtCollection.h"
44 //disk for which I want to calculate efficieny
45 
46 
47 #define MAX_CHARGE_RATIO
48 #define MIN_CHARGE_RATIO
49 
50 //#define DISK_EFF 2
51 #define QUAD_EFF 1
52 #define MY_PI 3.14159265359
53 
54 
55 
56 #define MAX_DIST2_EFF 1.0
57 #define MAX_DIST2 1.0
58 
59 #define MIN_NUM_POINTS 2
60 #define DISK_DIM 40
61 
62 #define NUM_EFF_BIN 30
63 
64 Bool_t StFgtStraightPlotter::arePointsMatched(vector<generalCluster>::iterator c1, vector<generalCluster>::iterator c2)
65 {
66  Float_t tUncert1;
67  Float_t tCharge1;
68 
69  Float_t tUncert2;
70  Float_t tCharge2;
71 
72  if(c1->clusterCharge<20 || c2->clusterCharge<20)
73  return false;
74  if(c1->clusterCharge<c2->clusterCharge)
75  {
76  tCharge1=c2->clusterCharge;
77  tUncert1=c2->clusterChargeUncert;
78  tCharge2=c1->clusterCharge;
79  tUncert2=c1->clusterChargeUncert;
80  }
81  else
82  {
83  tCharge1=c1->clusterCharge;
84  tUncert1=c1->clusterChargeUncert;
85  tCharge2=c2->clusterCharge;
86  tUncert2=c2->clusterChargeUncert;
87  }
88 
89 
90  if(((tCharge1/tCharge2) <chargeMatchCut) ||((tCharge1-tUncert1)/(tCharge2+tUncert2))<chargeMatchCut)
91  return true;
92  else
93  return false;
94 }
95 
96 
97 Bool_t StFgtStraightPlotter::validPulse(generalStrip& strip)
98 {
99  for(int i=0;i<4;i++)
100  {
101  Float_t adc1=strip.adc[i];
102  Float_t adc2=strip.adc[i+1];
103  Float_t adc3=strip.adc[i+2];
104  Float_t cut=5*strip.pedErr;
105  if(adc1>cut && adc2 >cut && adc3 > cut)
106  {
107  if(adc1 <adc2 && adc2 < adc3)
108  return true;
109  }
110  }
111  return false;
112 }
113 
114 Bool_t StFgtStraightPlotter::fitTheStrip(generalStrip* pStrip, generalStrip* pStripOtherLayer,float* amp, float* t0, float* chi2Ndf, int iD, int iq, int apvBin, Char_t layer)
115 {
116  if(fitCounter>2000)
117  return true;
118  fitCounter++;
119  char buffer[100];
120  sprintf(buffer,"d%d_quad%d",iD,iq);
121  pulsePictureFile->cd();
122  // cout <<"trying to cd to " << buffer <<endl;
123  pulsePictureFile->cd(buffer);
124  // cout <<"done " <<endl;
125  if(layer=='R')
126  sprintf(buffer,"apv%d_R",apvBin);
127  else
128  sprintf(buffer,"apv%d_P",apvBin);
129  // cout <<"changing to " << buffer <<endl;
130  // cout <<" and now to " << buffer <<endl;
131  gDirectory->cd(buffer);
132  // cout << "done cd 2 " << endl;
133  Int_t minAdcCount=100000;
134  Int_t maxAdcCount=0;
135  for(Int_t tb=0;tb<7;tb++)
136  {
137  mHistPtr->SetBinContent(tb+1,0);
138  mHistPtr->SetBinError(tb+1,10000);
139  mHistPtr->SetBinContent(tb+1, pStrip->adc[tb]);
140  if(pStrip->adc[tb]<minAdcCount)
141  minAdcCount=pStrip->adc[tb]-pStrip->pedErr;
142  if(pStrip->adc[tb]>maxAdcCount)
143  maxAdcCount=pStrip->adc[tb]+pStrip->pedErr;
144  mHistPtr->SetBinError(tb+1,pStrip->pedErr);
145  }
146 
147  // mHistPtr->Fit(mPulseShapePtr);
148  (*amp)=mPulseShapePtr->GetParameter(0);
149  (*t0)=mPulseShapePtr->GetParameter(4);
150  (*chi2Ndf)=mPulseShapePtr->GetChisquare()/mPulseShapePtr->GetNDF();
151  sprintf(buffer,"pulse histo_D%d_Q%d_APV%d_ev%d",iD,iq,apvBin,evtNr);
152  // cout <<"histo name: "<< buffer <<endl;
153  TH1F* tmpPulseHisto=(TH1F*)mHistPtr->Clone(buffer);
154  tmpPulseHisto->Write();
155 
156  if(pStripOtherLayer!=0)
157  {
158  mCanvas->cd();
159 
160  sprintf(buffer,"tmpCnvsD%d_Q%d_APV%d_ev%d",iD,iq,apvBin,evtNr);
161  TCanvas* tmpCnv=(TCanvas*)mCanvas->Clone(buffer);
162 
163  tmpCnv->SetTitle(buffer);
164  tmpCnv->SetName(buffer);
165 
166  tmpCnv->cd();
167 
168  for(Int_t tb=0;tb<7;tb++)
169  {
170  mHistPtr2->SetBinContent(tb+1,0);
171  mHistPtr2->SetBinError(tb+1,10000);
172  mHistPtr2->SetBinContent(tb+1, pStripOtherLayer->adc[tb]);
173  mHistPtr2->SetBinError(tb+1,pStripOtherLayer->pedErr);
174  if(pStripOtherLayer->adc[tb]<minAdcCount)
175  minAdcCount=pStripOtherLayer->adc[tb]-pStripOtherLayer->pedErr;
176  if(pStripOtherLayer->adc[tb]>maxAdcCount)
177  maxAdcCount=pStripOtherLayer->adc[tb]+pStripOtherLayer->pedErr;
178  }
179 
180  tmpPulseHisto->GetYaxis()->SetRangeUser(minAdcCount-10,maxAdcCount+10);
181  mHistPtr2->GetYaxis()->SetRangeUser(minAdcCount-10,maxAdcCount+10);
182  tmpPulseHisto->Draw();
183  mHistPtr2->Draw("SAME");
184  tmpCnv->Write();
185  }
186 
187  pulsePictureFile->cd();
188 
189  myRootFile->cd();
190 
191  return true;
192 }
193 
194 
195 template<class T> void StFgtStraightPlotter::createPlots(T*** pH, int numH, const char* nameBase, int numBin, int first, int last)
196 {
197 
198  char buffer[200];
199  char bufferNB[200];
200  sprintf(bufferNB,"%s_%s",nameBase,mFileName);
201  (*pH)=new T*[numH];
202 
203  if (numH==22)
204  {
205  for(int iD=0;iD<numH;iD++)
206  {
207  sprintf(buffer, "%s_APV%d", bufferNB, iD);
208  (*pH)[iD]=new T(buffer,buffer,numBin, first, last);
209  }
210  }
211 
212  if ((numH == kFgtNumDiscs*4)&&(numH!=22))
213  //if ((numH == kFgtNumDiscs*4))
214  {
215  for(int iD=0;iD<kFgtNumDiscs;iD++)
216  {
217  for(int iQ=0;iQ<4;iQ++)
218  {
219  sprintf(buffer,"%s_disc%d_quad%d",bufferNB,iD+1,iQ);
220  (*pH)[iD*4+iQ]=new T(buffer,buffer,numBin,first,last);
221  }
222  }
223  }
224  else
225  {
226  for(int iD=0;iD<kFgtNumDiscs;iD++)
227  {
228 
229  if (numH==kFgtNumDiscs)
230  {
231  sprintf(buffer, "%s_disc%d", bufferNB, iD+1);
232  (*pH)[iD]=new T(buffer, buffer,numBin, first, last);
233  }
234  else
235  {
236  for(int binAPVi=0;binAPVi<40;binAPVi++)
237  {
238  int iQ = -1;
239  if((binAPVi>= 0) && (binAPVi<= 9)) iQ=0;
240  if((binAPVi>=10) && (binAPVi<=19)) iQ=1;
241  if((binAPVi>=20) && (binAPVi<=29)) iQ=2;
242  if((binAPVi>=30) && (binAPVi<=39)) iQ=3;
243  sprintf(buffer,"%s_disc%d_quad%d_apvBIN%d",bufferNB,iD+1,iQ,binAPVi);
244  (*pH)[iD*40+binAPVi]=new T(buffer,buffer,numBin,first,last);
245  }
246  }
247  }
248  }
249 }
250 
251 
252 template void StFgtStraightPlotter::createPlots(TH1I*** pH, int numH,const char* nameBase, int numBin, int first, int last);
253 template void StFgtStraightPlotter::createPlots(TH1F*** pH, int numH, const char* nameBase, int numBin, int first, int last);
254 template void StFgtStraightPlotter::createPlots(TH1D*** pH, int numH, const char* nameBase, int numBin, int first, int last);
255 
256 void StFgtStraightPlotter::doNormalize(TH2D** hEff, TH2D** hNonEff)
257 {
258  for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
259  {
260  TH2D* tmpAllCounts=(TH2D*)hEff[iD]->Clone("tmp");
261  hEff[iD]->Add(hNonEff[iD]);//all counts
262  for(int nx=1;nx<hEff[iD]->GetNbinsX()+1;nx++)
263  {
264  for(int ny=1;ny<hEff[iD]->GetNbinsY()+1;ny++)
265  {
266  Double_t denom=hEff[iD]->GetBinContent(nx,ny);
267  if(denom>0 && (tmpAllCounts->GetBinContent(nx,ny)/denom)<=1.0)
268  {
269  hEff[iD]->SetBinContent(nx,ny,tmpAllCounts->GetBinContent(nx,ny)/denom);
270  }
271  else
272  {
273  hEff[iD]->SetBinContent(nx,ny,0.0);
274  }
275  }
276  }
277  delete tmpAllCounts;
278  }
279 }
280 
281 
282 
283 void StFgtStraightPlotter::saveSigs(Double_t* sigR, Double_t* sigP, Double_t r, Double_t phi, Int_t maxR, Int_t maxPhi, Int_t discId, Int_t quad)
284 {
285  Char_t buffer[200];
286  int uniqueId=rand() % 1000;
287  sprintf(buffer,"Sig_Disc%d_quad%d_Phi_Evt_%d_R_%f_Phi_%f_%d_%s",discId,quad,evtNr,r,phi,uniqueId,mFileName);
288 
289  TH2D* histoP=new TH2D(buffer,buffer,7,0,6,maxPhi,0,maxPhi-1);
290  for(int i=0;i<maxPhi;i++)
291  {
292  for(int j=0;j<7;j++)
293  {
294  histoP->SetBinContent(j+1,i+1,sigP[i*7+j]);
295  // cout <<"P: setting bin : i: " << i << " j: " << j << " index: "<< i*7+j << " sig: " << sigP[i*7+j]<<endl;
296  }
297  }
298  v_hClusP.push_back(histoP);
299  sprintf(buffer,"Sig_Disc%d_quad%d_R_Evt_%d_R_%f_Phi_%f_%d_%s",discId,quad,evtNr,r,phi,uniqueId,mFileName);
300  // cout <<"creating histoR: "<< buffer<<endl;
301  TH2D* histoR=new TH2D(buffer,buffer,7,0,6,maxR,0,maxR-1);
302  for(int i=0;i<maxR;i++)
303  {
304  for(int j=0;j<7;j++)
305  {
306  histoR->SetBinContent(j+1,i+1,sigR[i*7+j]);
307  // cout <<"R: setting bin : i: " << i << " j: " << j << " index: "<< i*7+j << " sig: " << sigR[i*7+j]<<endl;
308  }
309  }
310  v_hClusR.push_back(histoR);
311 }
312 
313 pair<double,double> StFgtStraightPlotter::getDca( vector<AVTrack>::iterator it)
314 {
315 
316  float oldDist=100000;
317  float zStep=1.0;
318  float optZ=-200;
319  float dist=0;
320  for(float z=-100;z<100;z=z+zStep)
321  {
322  float x=it->mx*z+it->ax;
323  float y=it->my*z+it->ay;
324  dist=x*x+y*y;
325  if(dist>oldDist)
326  {
328  dist=oldDist;
329  optZ=z-zStep;//last z was better
330  break;
331  }
332  else
333  oldDist=dist;
334  }
335  return pair<double,double>(optZ,sqrt(dist));
336 }
337 
338 
339 Double_t StFgtStraightPlotter::findClosestStrip(Char_t layer, double ord, Int_t iD, Int_t iQ)
340 {
341  if(iD<0 || iD >5)
342  {
343  return -99999;
344  }
345  vector<generalCluster> &hitVec=*(pClusters[iD]);
346  Double_t dist=99999;
347  for(vector<generalCluster>::iterator it=hitVec.begin();it!=hitVec.end();it++)
348  {
349  if(useChargeMatch && !it->hasMatch)
350  continue;
351  if(it->layer!=layer)
352  continue;
353  Double_t mDist=9999;
354  if(it->layer!='R')
355  {
356  mDist=fabs(it->posPhi-ord);
357  }
358  else
359  mDist=fabs(it->posR-ord);
360 
361  if(mDist<dist)
362  dist=mDist;
363  }
364  return dist;
365 }
366 
367 
370 void StFgtStraightPlotter::fillStripHistos(Float_t r, Float_t phi, Int_t iD, Int_t iq)
371 {
372 
373  // cout <<"filling strip histos " <<endl;
374  bool partOfClusterP=false;
375  bool partOfClusterR=false;
376  Double_t clusterChargeR=-9999;
377  Double_t clusterChargeP=-9999;
378 
379  Double_t mClusterSizeP=-9999;
380  Double_t mClusterSizeR=-9999;
381 
382  Double_t maxRCharge=-9999;
383  Double_t maxPhiCharge=-9999;
384  Double_t maxRChargeUncert=-9999;
385  Double_t maxPhiChargeUncert=-9999;
386  Int_t maxRInd=-1;
387  Int_t maxPInd=-1;
388  Int_t maxRTb=-1;
389  Int_t maxPTb=-1;
390  Int_t maxRAdc=-1;
391  Int_t maxPAdc=-1;
392  Double_t maxSigAdcR=-1;
393  Double_t maxSigAdcP=-1;
394  Int_t numFSigP=0;
395  Int_t numFSigR=0;
396  Int_t firstFSigTbP=0;
397  Int_t firstFSigTbR=0;
398 
399  Float_t secondToLastRatioP=0;
400  Float_t secondToLastRatioR=0;
401 
402  Float_t firstTbSigR=-1;
403  Float_t firstTbSigP=-1;
404 
405 
406  Double_t ordinate, lowerSpan, upperSpan;//, prvOrdinate;
407  Short_t disc, quadrant,strip;
408  Char_t layer;
409  //These variables will store the APV number at which the relevant stuff happens for the overall quad.
410  Int_t APVmaxRCharge=-9999;
411  Int_t APVmaxPhiCharge=-9999;
412  //Int_t APVmaxRChargeUncert=-9999;
413  //Int_t APVmaxPhiChargeUncert=-9999;
414  Int_t APVmaxRInd=-1;
415  Int_t APVmaxPInd=-1;
416  Int_t APVmaxRTb=-1;
417  Int_t APVmaxPTb=-1;
418  Int_t APVmaxRAdc=-1;
419  Int_t APVmaxPAdc=-1;
420  Int_t APVmaxSigAdcR=-1;
421  Int_t APVmaxSigAdcP=-1;
422  Int_t APVnumFSigP=0;
423  Int_t APVnumFSigR=0;
424  Int_t APVfirstFSigTbP=0;
425  Int_t APVfirstFSigTbR=0;
426 
427  Int_t APVsecondToLastRatioP=0;
428  Int_t APVsecondToLastRatioR=0;
429 
430  Int_t APVfirstTbSigR=-1;
431  Int_t APVfirstTbSigP=-1;
432 
433 
434 
435  for(unsigned int i=0;i< pStrips[iD*4+iq].size();i++)
436  {
437  Int_t geoId=pStrips[iD*4+iq][i].geoId;
438  generalStrip& pStrip=pStrips[iD*4+iq][i];
439 
440  Int_t rdo, arm, apv, chan;
441  mDb->getElecCoordFromGeoId(geoId, rdo,arm,apv,chan);
442  //using binAPV for simplicity
443  Int_t binAPV = (iq*10)+(apv%12);
444 
445  StFgtGeom::getPhysicalCoordinate(geoId,disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
446  StFgtGeom::decodeGeoId(geoId,disc, quadrant, layer, strip);
447  //char buffer[100];
448  // if(layer=='P' && disc==iD && iq==quadrant)
449  // cout <<"looking for " << phi << " have: " << ordinate <<" diff: " << fabs(ordinate-phi) <<endl;
450  if(disc==iD && iq==quadrant && ((layer =='R' && fabs(ordinate-r)<0.7) || (layer=='P' && fabs(ordinate-phi)<0.03) || (layer=='P' && fabs(ordinate-phi+2*MY_PI)<0.03 ) || (layer=='P' && fabs(ordinate-phi-2*MY_PI)<0.03)|| (layer=='P' && fabs(ordinate-phi+MY_PI)<0.03 ) || (layer=='P' && fabs(ordinate-phi-MY_PI)<0.03)))
451  {
452  if(layer=='P')
453  {
454  if(pStrip.charge>maxPhiCharge)
455  {
456  if((pStrip.seedType>=kFgtSeedType1 && pStrip.seedType<=kFgtSeedTypeMax)|| pStrip.seedType==kFgtClusterPart || pStrip.seedType==kFgtClusterEndUp ||pStrip.seedType==kFgtClusterEndDown)
457  {
458  partOfClusterP=true;
459  pair<Double_t, Double_t> cluSize=findCluChargeSize(iD,'P',ordinate);
460  clusterChargeP=cluSize.first;
461  mClusterSizeP=cluSize.second;
462  }
463  else
464  {
465  partOfClusterP=false;
466  clusterChargeP=-9999;
467  }
468  maxPhiCharge=pStrip.charge;
469  maxPhiChargeUncert=pStrip.chargeUncert;
470  maxPInd=i;
471  maxPAdc=-9999;
472  maxSigAdcP=-9999;
473  numFSigP=0;
474  firstFSigTbP=-1;
475  firstTbSigP=-1;
476  APVmaxPhiCharge=-1;
477  APVmaxPInd=-1;
478  APVmaxPAdc=-1;
479  APVmaxSigAdcP=-1;
480  APVnumFSigP=-1;
481  APVfirstFSigTbP=-1;
482  APVfirstTbSigP=-1;
483 
484  if(pStrip.adc[6]>0)
485  {
486  secondToLastRatioP=pStrip.adc[5]/(float)pStrip.adc[6];
487  APVsecondToLastRatioP=binAPV;
488  }
489  if(pStrip.pedErr>0)
490  {
491  firstTbSigP=pStrip.adc[0]/(float)pStrip.pedErr;
492  APVfirstTbSigP=binAPV;
493  }
494  for(int iAdc=0;iAdc<7;iAdc++)
495  {
496  if(pStrip.adc[iAdc]>5*pStrip.pedErr)
497  {
498  numFSigP++;
499  APVnumFSigP=binAPV;
500  if(firstFSigTbP<0)
501  {
502  firstFSigTbP=iAdc;
503  APVfirstFSigTbP=binAPV;
504  }
505  }
506  if(pStrip.adc[iAdc]>maxPAdc)
507  {
508  maxPAdc=pStrip.adc[iAdc];
509  APVmaxPAdc=binAPV;
510  maxPTb=iAdc;
511  APVmaxPTb=binAPV;
512  if(pStrip.pedErr>0)
513  {
514  maxSigAdcP=(Double_t)maxPAdc/pStrip.pedErr;
515  APVmaxSigAdcP=binAPV;
516  }
517  }
518  }
519  }
520  }
521  else
522  {
523  if(pStrip.charge>maxRCharge)
524  {
525  if((pStrip.seedType>=kFgtSeedType1 && pStrip.seedType<=kFgtSeedTypeMax)|| pStrip.seedType==kFgtClusterPart || pStrip.seedType==kFgtClusterEndUp ||pStrip.seedType==kFgtClusterEndDown)
526  {
527  partOfClusterR=true;
528  pair<Double_t, Double_t> cluSize=findCluChargeSize(iD,'R',ordinate);
529  clusterChargeR=cluSize.first;
530  mClusterSizeR=cluSize.second;
531  }
532  else
533  {
534  clusterChargeR=-9999;
535  partOfClusterR=false;
536  }
537 
538  maxRCharge=pStrip.charge;
539  maxRInd=i;
540  maxRChargeUncert=pStrip.chargeUncert;
541  maxRAdc=-9999;
542  maxSigAdcR=-9999;
543  numFSigR=0;
544  firstFSigTbR=-1;
545  firstTbSigR=-1;
546  APVmaxRCharge=-1;
547  APVmaxRInd=-1;
548  APVmaxRAdc=-1;
549  APVmaxSigAdcR=-1;
550  APVnumFSigR=-1;
551  APVfirstFSigTbR=-1;
552  APVfirstTbSigR=-1;
553 
554  if(pStrip.adc[6]>0)
555  {
556  secondToLastRatioR=pStrip.adc[5]/(float)pStrip.adc[6];
557  APVsecondToLastRatioR=binAPV;
558  }
559  if(pStrip.pedErr>0)
560  {
561  firstTbSigR=pStrip.adc[0]/(float)pStrip.pedErr;
562  APVfirstTbSigR=binAPV;
563  }
564  for(int iAdc=0;iAdc<7;iAdc++)
565  {
566  // cout <<"adc: "<< pStrip.adc[iAdc] <<endl;
567  if(pStrip.adc[iAdc]>5*pStrip.pedErr)
568  {
569  numFSigR++;
570  APVnumFSigR=binAPV;
571  if(firstFSigTbR<0)
572  {
573  firstFSigTbR=iAdc;
574  APVfirstFSigTbR=binAPV;
575  }
576  }
577  if(pStrip.adc[iAdc]>maxRAdc)
578  {
579  maxRAdc=pStrip.adc[iAdc];
580  APVmaxRAdc=binAPV;
581  maxRTb=iAdc;
582  APVmaxRTb=binAPV;
583  if(pStrip.pedErr>0)
584  {
585  maxSigAdcR=(Double_t)maxRAdc/pStrip.pedErr;
586  APVmaxSigAdcR=binAPV;
587  }
588  }
589  }
590  // cout <<"numfSigma: " << numFSigR <<endl;
591  }
592  }
593  }
594  }
595 
596  Float_t InnerRad=19;
597  //fill histos
598  if(maxPhiCharge>200)
599  {
600  firstTbSigCloseClusterP[iD*4+iq]->Fill(firstTbSigP);
601  maxAdcCloseClusterP[iD*4+iq]->Fill(maxPAdc);
602 
603  maxTbCloseClusterP[iD*4+iq]->Fill(maxPTb);
604  numFSigCloseClusterP[iD*4+iq]->Fill(numFSigP);
605  numFirstHighCloseClusterP[iD*4+iq]->Fill(firstFSigTbP);
606  // maxAdcCloseClusterP[iD*4+iq]->Fill(maxPAdc);
607  maxSigCloseClusterP[iD*4+iq]->Fill(maxSigAdcP);
608  // cout <<"firstFSigtbP: " << firstFSigTbP <<endl;
609  // cout <<"filling ratio with : " << secondToLastRatioP <<endl;
610  secondToLastRatioCloseClusterP[iD*4+iq]->Fill(secondToLastRatioP);
612 
613 
614 
615  if(r>InnerRad&& APVfirstTbSigP>-1 && APVmaxPAdc>-1 && APVmaxPTb>-1 && APVnumFSigP>-1 && APVfirstFSigTbP>-1 && APVmaxSigAdcP>-1 && APVsecondToLastRatioP>-1)
616  {
617  APVfirstTbSigCloseClusterP[iD*40+APVfirstTbSigP]->Fill(firstTbSigP);
618  APVmaxAdcCloseClusterP[iD*40+APVmaxPAdc]->Fill(maxPAdc);
619  APVmaxTbCloseClusterP[iD*40+APVmaxPTb]->Fill(maxPTb);
620  APVnumFSigCloseClusterP[iD*40+APVnumFSigP]->Fill(numFSigP);
621  APVnumFirstHighCloseClusterP[iD*40+APVfirstFSigTbP]->Fill(firstFSigTbP);
622  APVmaxSigCloseClusterP[iD*40+APVmaxSigAdcP]->Fill(maxSigAdcP);
623  APVsecondToLastRatioCloseClusterP[iD*40+APVsecondToLastRatioP]->Fill(secondToLastRatioP);
624  }
625 
626  if(iD==2 && iq==1 && (float)pStrips[iD*4+iq][maxPInd].pedErr>0)
627  {
628  pulseCounterP++;
629  for(int iB=0;iB<7;iB++)
630  {
631  exPulseMaxAdcNormP->SetBinContent(iB+1,exPulseMaxAdcNormP->GetBinContent(iB+1)+pStrips[iD*4+iq][maxPInd].adc[iB]/(float)maxPAdc);
632  exPulseSigP->SetBinContent(iB+1,exPulseSigP->GetBinContent(iB+1)+pStrips[iD*4+iq][maxPInd].adc[iB]/(float)pStrips[iD*4+iq][maxPInd].pedErr);
633  }
634  }
635  }
636 
637  if(maxRCharge>200)
638  {
639  firstTbSigCloseClusterR[iD*4+iq]->Fill(firstTbSigR);
640  maxTbCloseClusterR[iD*4+iq]->Fill(maxRTb);
641  maxAdcCloseClusterR[iD*4+iq]->Fill(maxRAdc);
642  numFSigCloseClusterR[iD*4+iq]->Fill(numFSigR);
643  numFirstHighCloseClusterR[iD*4+iq]->Fill(firstFSigTbR);
644  // cout <<"firstFSigtbR: " << firstFSigTbR <<endl;
645  maxSigCloseClusterR[iD*4+iq]->Fill(maxSigAdcR);
646  // cout <<"filling ratio R with : " << secondToLastRatioR <<endl;
647  secondToLastRatioCloseClusterR[iD*4+iq]->Fill(secondToLastRatioR);
648 
649  if(r> InnerRad && APVfirstTbSigR>-1 && APVmaxRAdc>-1 && APVmaxRTb>-1 && APVnumFSigR>-1 && APVfirstFSigTbR>-1 && APVmaxSigAdcR>-1 && APVsecondToLastRatioR>-1)
650  {
651  APVfirstTbSigCloseClusterR[iD*40+APVfirstTbSigR]->Fill(firstTbSigR);
652  APVmaxTbCloseClusterR[iD*40+APVmaxRTb]->Fill(maxRTb);
653  APVmaxAdcCloseClusterR[iD*40+APVmaxRAdc]->Fill(maxRAdc);
654  APVnumFSigCloseClusterR[iD*40+APVnumFSigR]->Fill(numFSigR);
655  APVnumFirstHighCloseClusterR[iD*40+APVfirstFSigTbR]->Fill(firstFSigTbR);
656  APVmaxSigCloseClusterR[iD*40+APVmaxSigAdcR]->Fill(maxSigAdcR);
657  APVsecondToLastRatioCloseClusterR[iD*40+APVsecondToLastRatioR]->Fill(secondToLastRatioR);
658  }
659 
660  if(iD==2 && iq==1 && (float)pStrips[iD*4+iq][maxRInd].pedErr>0)
661  {
662  pulseCounterR++;
663  for(int iB=0;iB<7;iB++)
664  {
665  exPulseMaxAdcNormR->SetBinContent(iB+1,exPulseMaxAdcNormR->GetBinContent(iB+1)+pStrips[iD*4+iq][maxRInd].adc[iB]/(float)maxRAdc);
666  exPulseSigR->SetBinContent(iB+1,exPulseSigR->GetBinContent(iB+1)+pStrips[iD*4+iq][maxRInd].adc[iB]/(float)pStrips[iD*4+iq][maxRInd].pedErr);
667  }
668  }
669  }
670 
671 
672  if(maxRCharge> 200 && maxPhiCharge>200 && iD==m_effDisk)// && (float)pStrips[iD*4+iq][maxRInd].charge)
673  {
674  StFgtGeom::getPhysicalCoordinate((float)pStrips[iD*4+iq][maxRInd].geoId,disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
675  // if(ordinate>20)
676  {
677  chargeCorrMaxStrip->Fill(maxRCharge,maxPhiCharge);
678  chargeCorrMaxAdc->Fill(maxRAdc,maxPAdc);
679 
680 
681  }
682  }
683  // if(iD==2 && iq==1 && (float)pStrips[iD*4+iq][maxRInd].pedErr>0)
684 
685 
686 
687  if(partOfClusterR&& partOfClusterP && iD==m_effDisk)
688  {
689  chargeCorrInEffDisk->Fill(clusterChargeR,clusterChargeP);
690  StFgtGeom::getPhysicalCoordinate((float)pStrips[iD*4+iq][maxRInd].geoId,disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
691  // if(ordinate>20)
692 
693  }
694  if(partOfClusterR&& partOfClusterP)
695  {
696  chargeCorr[iD*4+iq]->Fill(clusterChargeR,clusterChargeP);
697  // cout <<"disk: " << iD << " quad: " << iq <<endl;
698  // cout <<"looking at cluster (part of track?) at r: " << r <<" phi: " << phi <<" size r: " << mClusterSizeR <<" phi: " << mClusterSizeP;
699  // cout << "extr charge r: " <<clusterChargeR <<" charge phi: " << clusterChargeP <<endl;
700 
701  //basically only here we fill with the estimated cluster, for the other disks we fill with the cluster on the track
702  // if(r>20)
703  {
704  clusterSizeR[iD*4+iq]->Fill(mClusterSizeR);
705  clusterSizeP[iD*4+iq]->Fill(mClusterSizeP);
706  }
707  }
708 
709  if(partOfClusterP)
710  {
711 
712  // cout <<" part of p cluster " << endl;
713  float intPCharge=(float)pStrips[iD*4+iq][maxPInd].charge+(float)pStrips[iD*4+iq][maxPInd-1].charge+(float)pStrips[iD*4+iq][maxPInd+1].charge;
714  float chi2Ndf;
715  float amp;
716  float t0;
718  if(partOfClusterR)
719  fitTheStrip(&(pStrips[iD*4+iq][maxPInd]),&(pStrips[iD*4+iq][maxRInd]),&amp,&t0,&chi2Ndf,iD,iq,APVmaxPAdc,'P');
720  else
721  fitTheStrip(&(pStrips[iD*4+iq][maxPInd]),0,&amp,&t0,&chi2Ndf,iD,iq,APVmaxPAdc,'P');
722 
723  APVfitChi2P[iD*40+APVmaxPAdc]->Fill(chi2Ndf);
724 
725  firstTbSigTrackClusterP[iD*4+iq]->Fill(firstTbSigP);
726  maxAdcTrackClusterP[iD*4+iq]->Fill(maxPAdc);
727  maxSigTrackClusterP[iD*4+iq]->Fill(maxSigAdcP);
728  maxTbTrackClusterP[iD*4+iq]->Fill(maxPTb);
729  numFSigTrackClusterP[iD*4+iq]->Fill(numFSigP);
730  numFirstHighTrackClusterP[iD*4+iq]->Fill(firstFSigTbP);
731  secondToLastRatioTrackClusterP[iD*4+iq]->Fill(secondToLastRatioP);
732 
733  if(iD==2 && iq==1 && (float)pStrips[iD*4+iq][maxPInd].pedErr>0)
734  {
735  pulseCounterTP++;
736  for(int iB=0;iB<7;iB++)
737  {
738  exPulseMaxAdcNormTrackP->SetBinContent(iB+1,exPulseMaxAdcNormTrackP->GetBinContent(iB+1)+pStrips[iD*4+iq][maxPInd].adc[iB]/(float)maxPAdc);
739 
740  exPulseSigTrackP->SetBinContent(iB+1,exPulseSigTrackP->GetBinContent(iB+1)+pStrips[iD*4+iq][maxPInd].adc[iB]/(float)pStrips[iD*4+iq][maxPInd].pedErr);
741 
742  }
743  }
744 
745  }
746  if(partOfClusterR)
747  {
748 
749  // cout <<" part of R cluster " << endl;
750  float intRCharge=(float)pStrips[iD*4+iq][maxRInd].charge+(float)pStrips[iD*4+iq][maxRInd-1].charge+(float)pStrips[iD*4+iq][maxRInd+1].charge;
751  float chi2Ndf;
752  float amp;
753  float t0;
755  if(partOfClusterP)
756  fitTheStrip(&(pStrips[iD*4+iq][maxRInd]),&pStrips[iD*4+iq][maxPInd],&amp,&t0,&chi2Ndf, iD, iq, APVmaxRAdc,'R');
757  else
758  fitTheStrip(&(pStrips[iD*4+iq][maxRInd]),0,&amp,&t0,&chi2Ndf, iD, iq, APVmaxRAdc,'R');
759  APVfitChi2R[iD*40+APVmaxRAdc]->Fill(chi2Ndf);
760 
761 
762  firstTbSigTrackClusterR[iD*4+iq]->Fill(firstTbSigR);
763  maxTbTrackClusterR[iD*4+iq]->Fill(maxRTb);
764  maxAdcTrackClusterR[iD*4+iq]->Fill(maxRAdc);
765  maxSigTrackClusterR[iD*4+iq]->Fill(maxSigAdcR);
766  numFSigTrackClusterR[iD*4+iq]->Fill(numFSigR);
767  numFirstHighTrackClusterR[iD*4+iq]->Fill(firstFSigTbR);
768  secondToLastRatioTrackClusterR[iD*4+iq]->Fill(secondToLastRatioR);
769 
770  if(iD==2 && iq==1 && (float)pStrips[iD*4+iq][maxRInd].pedErr>0)
771  {
772  pulseCounterTR++;
773  for(int iB=0;iB<7;iB++)
774  {
775  exPulseMaxAdcNormTrackR->SetBinContent(iB+1,exPulseMaxAdcNormTrackR->GetBinContent(iB+1)+pStrips[iD*4+iq][maxRInd].adc[iB]/(float)maxRAdc);
776  exPulseSigTrackR->SetBinContent(iB+1,exPulseSigTrackR->GetBinContent(iB+1)+pStrips[iD*4+iq][maxRInd].adc[iB]/(float)pStrips[iD*4+iq][maxRInd].pedErr);
777  }
778  }
779  }
780 
781 }
782 //is this a good hit in the loose term. We can implement different criteria, so either pulse or some charge sum
783 //Bool_t StFgtStraightPlotter::isGoodHit(
784 
785 
786 //is there something where we expect it? Again, here phi is relative to the quadrant!!
787 Bool_t StFgtStraightPlotter::isSomewhatEff(Float_t r, Float_t phi, Int_t iD, Int_t iq)
788 {
789  Double_t maxRCharge=-9999;
790  Double_t maxPhiCharge=-9999;
791  Double_t maxRChargeUncert=-9999;
792  Double_t maxPhiChargeUncert=-9999;
793  Int_t maxRInd=-1;
794  Int_t maxPInd=-1;
795  Bool_t validPhiPulse=false;
796  Bool_t validRPulse=false;
797  for(unsigned int i=0;i< pStrips[iD*4+iq].size();i++)
798  {
799  Int_t geoId=pStrips[iD*4+iq][i].geoId;
800  generalStrip& pStrip=pStrips[iD*4+iq][i];
801  Short_t disc, quadrant,strip;
802  Char_t layer;
803  Double_t ordinate, lowerSpan, upperSpan;//, prvOrdinate;
804  StFgtGeom::getPhysicalCoordinate(geoId,disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
805  StFgtGeom::decodeGeoId(geoId,disc, quadrant, layer, strip);
806  // if(layer=='P' && disc==iD && iq==quadrant)
807  // cout <<"looking for " << phi << " have: " << ordinate <<" diff: " << fabs(ordinate-phi) <<endl;
808  if(disc==iD && iq==quadrant && ((layer =='R' && fabs(ordinate-r)<0.7) || (layer=='P' && fabs(ordinate-phi)<0.04) || (layer=='P' && fabs(ordinate-phi+2*MY_PI)<0.04 ) || (layer=='P' && fabs(ordinate-phi-2*MY_PI)<0.04)|| (layer=='P' && fabs(ordinate-phi+MY_PI)<0.04 ) || (layer=='P' && fabs(ordinate-phi-MY_PI)<0.04)))
809  {
810  if(layer=='P')
811  {
812  if(validPulse(pStrip))
813  validPhiPulse=true;
814 
815  if(pStrip.charge>maxPhiCharge)
816  {
817  maxPhiCharge=pStrip.charge;
818  maxPhiChargeUncert=pStrip.chargeUncert;
819  maxPInd=i;
820  }
821  }
822  else
823  {
824  if(validPulse(pStrip))
825  validRPulse=true;
826 
827  if(pStrip.charge>maxRCharge)
828  {
829  maxRCharge=pStrip.charge;
830  maxRInd=i;
831  maxRChargeUncert=pStrip.chargeUncert;
832  }
833  }
834  }
835  }
836 #ifdef PULSE_CONDITION
837  if(validPhiPulse && validRPulse)
838  return true;
839 #endif
840 
841 
842  if(maxRInd>=0 && maxPInd>=0)
843  {
844 #ifdef LEN_CONDITION
845  if(maxRCharge>1000 && maxPhiCharge>1000)
846  return true;
847 #endif
848 
850  if(maxRInd>0)
851  maxRCharge+=pStrips[iD*4+iq][maxRInd-1].charge;
852  if(maxRInd< (int)(pStrips[iD*4+iq].size()-1))
853  maxRCharge+=pStrips[iD*4+iq][maxRInd+1].charge;
854  if(maxPInd>0)
855  maxPhiCharge+=pStrips[iD*4+iq][maxPInd-1].charge;
856  if(maxPInd< (int)(pStrips[iD*4+iq].size()-1))
857  maxPhiCharge+=pStrips[iD*4+iq][maxPInd+1].charge;
859 
860  // cout <<"charge: "<< maxRCharge<< " 3* uncert " << 3*maxRChargeUncert <<" maxPhiCharge " << maxPhiCharge<<" 3*phi "<< 3*maxPhiChargeUncert <<endl;
861  if(maxRCharge>3*maxRChargeUncert && maxPhiCharge>3*maxPhiChargeUncert)
862  {
863  //if we don't care about charge ratio
864  // return true;
865  if(maxRCharge>maxPhiCharge)
866  {
867  if(maxRCharge/maxPhiCharge<4)
868  return true;
869  else
870  return false;
871  }
872  else
873  {
874  if(maxPhiCharge/maxPhiCharge<4)
875  return true;
876  else
877  return false;
878  }
879  }
880 
881  }
882  return false;
883 }
884 
885 //if required only return clusters with matches...
886 pair<Double_t,Double_t> StFgtStraightPlotter::findCluChargeSize(Int_t iD,Char_t layer, Double_t ordinate)
887 {
888  if(iD<0 || iD >5)
889  {
890  return pair<Double_t,Double_t>(-99999,-99999);
891  }
892  vector<generalCluster> &hitVec=*(pClusters[iD]);
893  Double_t charge=-99999;
894  Double_t cluSize=-9999;
895  Double_t minDist=99999;
896  for(vector<generalCluster>::iterator it=hitVec.begin();it!=hitVec.end();it++)
897  {
898  if(it->layer!=layer)
899  continue;
900  Float_t ord=-9999;
901  if(layer=='R')
902  {
903  ord=it->posR;
904  }
905  else
906  {
907  ord=it->posPhi;
908  if(fabs(ordinate-(ord+MY_PI))<fabs(ord-ordinate))
909  ord=ord+MY_PI;
910  if(fabs(ordinate-(ord-MY_PI))<fabs(ord-ordinate))
911  ord=ord-MY_PI;
912  }
913 
914  if((fabs(ordinate-ord)<minDist) && (!useChargeMatch || it->hasMatch))
915  {
916  charge=it->clusterCharge;
917  cluSize=it->clusterSize;
918  minDist=fabs(ordinate-ord);
919  }
920  }
921  return pair<Double_t,Double_t>(charge,cluSize);
922 }
923 
924 Double_t StFgtStraightPlotter::findClosestPoint(float mx, float bx, float my, float by, double xE, double yE, Int_t iD)
925 {
926  // cout <<"expecting point at " << xE <<", " <<yE <<endl;
927  if(iD<0 || iD >5)
928  {
929  return 99999;
930  }
931  vector<generalCluster> &hitVec=*(pClusters[iD]);
932  Double_t dist2=99999;
933  for(vector<generalCluster>::iterator it=hitVec.begin();it!=hitVec.end();it++)
934  {
935  for(vector<generalCluster>::iterator it2=hitVec.begin();it2!=hitVec.end();it2++)
936  {
937  //
938  if(useChargeMatch && !arePointsMatched(it,it2))
939  continue;
940 
941  if(it->layer==it2->layer)
942  continue;
943  Float_t r=it->posR;
944  Float_t phi=it2->posPhi;
945  if(it->layer!='R')
946  {
947  phi=it->posPhi;
948  r=it2->posR;
949  }
950 
951  Float_t x=r*cos(phi);
952  Float_t y=r*sin(phi);
953  // cout <<"we have " << x <<", " << y <<endl;
954  Double_t mDist=(x-xE)*(x-xE)+(y-yE)*(y-yE);
955  if(mDist<dist2)
956  {
957  dist2=mDist;
958  //recalculate distance with proper alignment
959  float tmpX, tmpY,tmpZ,tmpP,tmpR;
960  if(isCosmic)
961  {
962  getAlign(iD,phi,r,tmpX,tmpY,tmpZ,tmpP,tmpR);
963 
964 
965  Double_t xExpUpdate=mx*tmpZ+bx;
966  Double_t yExpUpdate=my*tmpZ+by;
967  // cout<<"tmpx: " << tmpX <<" old: " << x <<" xE old: " << xE << " updated: " << xExpUpdate;
968  // cout<<"tmpy: " << tmpY <<" old: " << y <<" yE old: " << yE << " updated: " << yExpUpdate<<endl;
969  mDist=(tmpX-xExpUpdate)*(tmpX-xExpUpdate)+(tmpY-yExpUpdate)*(tmpY-yExpUpdate);
970  }
971  dist2=mDist;
973  // Double_t yExp=my*StFgtGeom::getDiscZ(i)+by;
974 
975 
976  // (*outTxtFile) <<"point found, x: " << x <<" y: " << y << " dist: " << dist2 <<endl;
977  }
978  }
979  }
980  // (*outTxtFile) <<"returning : " << dist2<<endl;
981  return dist2;
982 }
983 
984 
986 Short_t StFgtStraightPlotter::getQuadFromCoo(Double_t x, Double_t y)
987 {
988  cout <<"do not use this function!!!" <<endl;
989  if(x>0 && y>0)
990  return 0;
991  if(x>0 && y<0)
992  return 1;
993  if(x<0 && y<0)
994  return 2;
995  if(x<0 && y>0)
996  return 3;
997 
998  return -9999;
999 }
1000 
1001 
1002 Bool_t StFgtStraightPlotter::printArea1D(Int_t iD,Int_t iq, Int_t centerGeoId)
1003 {
1004 
1005  for(unsigned int i=0;i<pStrips[iD*4+iq].size();i++)
1006  {
1007  Int_t geoId=pStrips[iD*4+iq][i].geoId;
1008  generalStrip& pStrip=pStrips[iD*4+iq][i];
1009  Short_t disc, quadrant,strip;
1010  Char_t layer;
1011  Double_t ordinate, lowerSpan, upperSpan;//, prvOrdinate;
1012  StFgtGeom::getPhysicalCoordinate(geoId,disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
1013  StFgtGeom::decodeGeoId(geoId,disc, quadrant, layer, strip);
1014  char buffer[100];
1015  switch(pStrip.seedType)
1016  {
1017  case kFgtSeedTypeNo:
1018  sprintf(buffer,"No Seed");
1019  break;
1020  case kFgtSeedType1:
1021  sprintf(buffer,"Seed1");
1022  break;
1023  case kFgtSeedType2:
1024  sprintf(buffer,"Seed2");
1025  break;
1026  case kFgtSeedType3:
1027  sprintf(buffer,"Seed3");
1028  break;
1029  case kFgtSeedType4:
1030  sprintf(buffer,"Seed4");
1031  break;
1032  case kFgtSeedType5:
1033  sprintf(buffer,"Seed5");
1034  break;
1035  case kFgtClusterPart:
1036  sprintf(buffer,"PartOfCluster");
1037  break;
1038  case kFgtClusterEndUp:
1039  sprintf(buffer,"EoC");
1040  break;
1041  case kFgtClusterEndDown:
1042  sprintf(buffer,"BoC");
1043  break;
1044  case kFgtDeadStrip:
1045  sprintf(buffer,"DeadStrip");
1046  break;
1047  case kFgtClusterTooBig:
1048  sprintf(buffer,"cluster too big");
1049  break;
1050  case kFgtClusterSeedInSeaOfNoise:
1051  sprintf(buffer,"seed in noise");
1052  break;
1053  default:
1054  sprintf(buffer,"somethingWrong: %d", pStrip.seedType);
1055  }
1056 
1057  // if(layer=='P' && disc==iD && iq==quadrant)
1058  // cout <<"looking for " << phi << " have: " << ordinate <<" diff: " << fabs(ordinate-phi) <<endl;
1059  if(abs(geoId-centerGeoId)<8)
1060  {
1061  // cout <<" found!!!" << endl;
1062  (*outTxtFile) <<StFgtGeom::encodeGeoName(iD,iq,layer,strip)<<"geo: " << geoId<< " ord: " << ordinate <<" layer: " <<layer<<" ped: " << pStrip.ped <<" pedErr: " << pStrip.pedErr <<" seedType: " <<buffer<<" ";
1063  for(int iT=0;iT<7;iT++)
1064  {
1065  if(pStrip.adc[iT]<pStrip.pedErr)
1066  (*outTxtFile) << setw(4) << " . "<< " ";
1067  else
1068  (*outTxtFile) << setw(4) <<pStrip.adc[iT] <<" ";
1069  }
1070  (*outTxtFile) <<endl;
1071  }
1072  }
1073  return kStOk;
1074 
1075 }
1076 
1077 //print the strips around the place where we expect hit
1078 Bool_t StFgtStraightPlotter::printArea(Float_t r, Float_t phi, Int_t iD, Int_t iq)
1079 {
1080  //just print the first 1000 clusters
1081 
1082  // cout <<" looking for r: " << r <<" phi: " << phi<< " to print " <<endl;
1083  if(printCounter>1000)
1084  return true;
1085  printCounter++;
1086  //first r:
1087  Double_t signalsP[900];
1088  Double_t signalsR[900];
1089 
1090  Int_t counterR=0;
1091  Int_t counterP=0;
1092  // cout <<" looking for strips.., we have: " << pStrips[iD*4+iq].size() << " in iD: " << iD << " iq: " << iq <<endl;
1093  for(unsigned int i=0;i<pStrips[iD*4+iq].size();i++)
1094  {
1095  Int_t geoId=pStrips[iD*4+iq][i].geoId;
1096  generalStrip& pStrip=pStrips[iD*4+iq][i];
1097  Short_t disc, quadrant,strip;
1098  Char_t layer;
1099  Double_t ordinate, lowerSpan, upperSpan;//, prvOrdinate;
1100  StFgtGeom::getPhysicalCoordinate(geoId,disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
1101  StFgtGeom::decodeGeoId(geoId,disc, quadrant, layer, strip);
1102  char buffer[100];
1103  switch(pStrip.seedType)
1104  {
1105  case kFgtSeedTypeNo:
1106  sprintf(buffer,"No Seed");
1107  break;
1108  case kFgtSeedType1:
1109  sprintf(buffer,"Seed1");
1110  break;
1111  case kFgtSeedType2:
1112  sprintf(buffer,"Seed2");
1113  break;
1114  case kFgtSeedType3:
1115  sprintf(buffer,"Seed3");
1116  break;
1117  case kFgtSeedType4:
1118  sprintf(buffer,"Seed4");
1119  break;
1120  case kFgtSeedType5:
1121  sprintf(buffer,"Seed5");
1122  break;
1123  case kFgtClusterPart:
1124  sprintf(buffer,"PartOfCluster");
1125  break;
1126  case kFgtClusterEndUp:
1127  sprintf(buffer,"EoC");
1128  break;
1129  case kFgtClusterEndDown:
1130  sprintf(buffer,"BoC");
1131  break;
1132  case kFgtDeadStrip:
1133  sprintf(buffer,"DeadStrip");
1134  break;
1135  case kFgtClusterTooBig:
1136  sprintf(buffer,"cluster too big");
1137  break;
1138  case kFgtClusterSeedInSeaOfNoise:
1139  sprintf(buffer,"seed in noise");
1140  break;
1141  default:
1142  sprintf(buffer,"somethingWrong: %d", pStrip.seedType);
1143  }
1144 
1145  // if(layer=='P' && disc==iD && iq==quadrant)
1146  // cout <<"looking for " << phi << " have: " << ordinate <<" diff: " << fabs(ordinate-phi) <<endl;
1147  // if(layer=='R' && disc==iD && iq==quadrant)
1148  // cout <<"looking for r=" << r << " have: " << ordinate <<" diff: " << fabs(ordinate-r) <<endl;
1149  if(disc==iD && iq==quadrant && ((layer =='R' && fabs(ordinate-r)<1.0) || (layer=='P' && fabs(ordinate-phi)<0.04) || (layer=='P' && fabs(ordinate-phi+2*MY_PI)<0.04 ) || (layer=='P' && fabs(ordinate-phi-2*MY_PI)<0.04)|| (layer=='P' && fabs(ordinate-phi+MY_PI)<0.04 ) || (layer=='P' && fabs(ordinate-phi-MY_PI)<0.04)))
1150  {
1151  // cout <<" found!!!" << endl;
1152  (*outTxtFile) <<"Id: " << geoId<<" "<<StFgtGeom::encodeGeoName(iD,iq,layer,strip)<<" ord: " << ordinate <<" layer: " <<layer<<" ped: " << pStrip.ped <<" pedErr: " << pStrip.pedErr <<" seedType: " <<buffer<<" ";
1153  for(int iT=0;iT<7;iT++)
1154  {
1155  if(pStrip.adc[iT]<pStrip.pedErr)
1156  (*outTxtFile) << setw(4) << " . "<< " ";
1157  else
1158  (*outTxtFile) << setw(4) <<pStrip.adc[iT] <<" ";
1159 
1160 
1161  if(layer=='P'&& counterP<40)
1162  {
1163  signalsP[counterP*7+iT]=pStrip.adc[iT];
1164  // cout <<"first p: setting bin : i: " << counterP << " j: " << iT << " index: "<< counterP*7+iT << " sig: " << signalsP[counterP*7+iT]<<endl;
1165  if(iT==6)
1166  counterP++;
1167  }
1168  if(layer=='R'&& counterR<40)
1169  {
1170  signalsR[counterR*7+iT]=pStrip.adc[iT];
1171  // cout <<"first R: setting bin : i: " << counterR << " j: " << iT << " index: "<< counterR*7+iT << " sig: " << signalsR[counterP*7+iT]<<endl;
1172  if(iT==6)
1173  counterR++;
1174  }
1175  }
1176  (*outTxtFile) <<endl;
1177  }
1178  }
1179 
1180  saveSigs(signalsR,signalsP,r,phi,counterR,counterP, iD, iq);
1181  return kStOk;
1182 }
1183 
1184 
1185 
1186 //print the strips around the place where we expect hit
1187 pair<Double_t,Double_t> StFgtStraightPlotter::getChargeRatio(Float_t r, Float_t phi, Int_t iD, Int_t iq)
1188 {
1189  //first r:
1190  Double_t maxRCharge=-9999;
1191  Double_t maxPhiCharge=-9999;
1192  Int_t maxRInd=-1;
1193  Int_t maxPInd=-1;
1194  for(unsigned int i=0;i< pStrips[iD*4+iq].size();i++)
1195  {
1196  Int_t geoId=pStrips[iD*4+iq][i].geoId;
1197  generalStrip& pStrip=pStrips[iD*4+iq][i];
1198  Short_t disc, quadrant,strip;
1199  Char_t layer;
1200  Double_t ordinate, lowerSpan, upperSpan;//, prvOrdinate;
1201  StFgtGeom::getPhysicalCoordinate(geoId,disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
1202  StFgtGeom::decodeGeoId(geoId,disc, quadrant, layer, strip);
1203  // if(layer=='P' && disc==iD && iq==quadrant)
1204  // cout <<"looking for " << phi << " have: " << ordinate <<" diff: " << fabs(ordinate-phi) <<endl;
1205  if(disc==iD && iq==quadrant && ((layer =='R' && fabs(ordinate-r)<0.7) || (layer=='P' && fabs(ordinate-phi)<0.03) || (layer=='P' && fabs(ordinate-phi+2*MY_PI)<0.03 ) || (layer=='P' && fabs(ordinate-phi-2*MY_PI)<0.03)|| (layer=='P' && fabs(ordinate-phi+MY_PI)<0.03 ) || (layer=='P' && fabs(ordinate-phi-MY_PI)<0.03)))
1206  {
1207  if(layer=='P')
1208  {
1209  if(pStrip.charge>maxPhiCharge)
1210  {
1211  maxPhiCharge=pStrip.charge;
1212  maxPInd=i;
1213  }
1214  }
1215  else
1216  {
1217  if(pStrip.charge>maxRCharge)
1218  {
1219  maxRCharge=pStrip.charge;
1220  maxRInd=i;
1221  }
1222  }
1223  }
1224  }
1225  if(maxRInd>=0 && maxPInd>=0)
1226  {
1227  if(maxRCharge>1000 && maxPhiCharge>1000)
1228  {
1230  if(maxRInd>0)
1231  maxRCharge+=pStrips[iD*4+iq][maxRInd-1].charge;
1232  if(maxRInd< (int)(pStrips[iD*4+iq].size()-1))
1233  maxRCharge+=pStrips[iD*4+iq][maxRInd+1].charge;
1234  if(maxPInd>0)
1235  maxPhiCharge+=pStrips[iD*4+iq][maxPInd-1].charge;
1236  if(maxPInd< (int)(pStrips[iD*4+iq].size()-1))
1237  maxPhiCharge+=pStrips[iD*4+iq][maxPInd+1].charge;
1238 
1239  return pair<Double_t,Double_t>(maxRCharge,maxPhiCharge);
1240  }
1241 
1242  }
1243  return pair<Double_t,Double_t>(-9999,-9999);
1244 }
1245 
1246 
1247 Double_t StFgtStraightPlotter::getRPhiRatio(vector<generalCluster>::iterator hitIterBegin, vector<generalCluster>::iterator hitIterEnd)
1248 {
1249  Short_t quad;
1250  Char_t layer;
1251  Int_t numR=0;
1252  Int_t numPhi=0;
1253  vector<generalCluster>::iterator hitIter=hitIterBegin;
1254  for(;hitIter!=hitIterEnd;hitIter++)
1255  {
1256  quad=hitIter->quad;
1257  layer=hitIter->layer;
1258 
1259  if(layer=='R')
1260  numR++;
1261  else
1262  numPhi++;
1263  }
1264 
1265  if(numR+numPhi>0)
1266  return (numR-numPhi)/((Double_t)(numR+numPhi));
1267  else
1268  return -1;
1269 };
1270 
1275 {
1276  evtNr++;
1277  Int_t numTracksInCurrEv=0;
1278  StFgtGeneralBase *fgtGenMkr = static_cast<StFgtGeneralBase * >( GetMaker("fgtGenBase"));
1279  pClusters=fgtGenMkr->getClusters();
1280  pStrips=fgtGenMkr->getStrips();
1281  Int_t tmpCluCount[6*4*2];
1282  memset(tmpCluCount,0,6*4*2*sizeof(Int_t));
1283  for(int iD=0;iD<6;iD++)
1284  {
1285  vector<generalCluster> &hitVec=*(pClusters[iD]);
1286  for( vector<generalCluster>::iterator hitIter=hitVec.begin();hitIter != hitVec.end();hitIter++)
1287  {
1288 
1289  Int_t iq=hitIter->quad;
1290  if(hitIter->layer=='R')
1291  {
1292  tmpCluCount[iD*4+iq]++;
1293  h_clusterChargeR[iD]->Fill(hitIter->clusterCharge);
1294  }
1295  else
1296  {
1297  tmpCluCount[6*4+iD*4+iq]++;
1298  h_clusterChargePhi[iD]->Fill(hitIter->clusterCharge);
1299  }
1300 
1301  }
1302  }
1303  for(int iD=0;iD<6;iD++)
1304  {
1305  for(int iq=0;iq<4;iq++)
1306  {
1307  numClustersR[iD*4+iq]->Fill(tmpCluCount[iD*4+iq]);
1308  numClustersPhi[iD*4+iq]->Fill(tmpCluCount[6*4+iD*4+iq]);
1309  }
1310  }
1311 
1312  // cout <<"ave make " <<endl;
1313  Int_t ierr = kStOk;
1314  (*outTxtFile) <<"----------------------------- Event Nr: " << evtNr<<" -----------------" <<endl;
1315 
1316  StFgtStraightTrackMaker *fgtSTracker = static_cast<StFgtStraightTrackMaker * >( GetMaker(mTrackerName));
1317 
1318  vector<AVTrack>& tracks=fgtSTracker->getTracks();
1319  // cout <<"plotter: we have " << tracks.size() << "tracks " <<endl;
1320  // intNumTracks+=tracks.size();
1321  for(vector<AVTrack>::iterator it=tracks.begin();it!=tracks.end();it++)
1322  {
1323  // cout <<"plotter chi2: "<< it->chi2 <<" vertex: " << it->trkZ <<endl;
1324  if(it->chi2>maxDistChi || fabs(it->trkZ)> vertexCut || it->dca> dcaCut )
1325  {
1326  continue;
1327  }
1328  //only add tracks that pass our cut criteria....
1329  intNumTracks++;
1330  numTracksInCurrEv++;
1331  numPointsPerTrack->Fill(it->points->size());
1332  for(int i=0;i<it->points->size();i++)
1333  {
1334  Int_t iD=(*(it->points))[i].dID;
1335  Int_t iq=(*(it->points))[i].quadID;
1336  if(iD<6 && iD>=0 && iq<4 && iq>=0)
1337  {
1338  // cout <<"disk : " << iD << " iq: " << iq <<endl;
1339  Float_t rCharge=(*(it->points))[i].rCharge;
1340  Float_t phiCharge=(*(it->points))[i].phiCharge;
1341  Float_t rPos=(*(it->points))[i].r;
1342  Float_t phiPos=(*(it->points))[i].phi;
1343  //r clusters are at constant r, so we plot against phi and vice versa
1344  if(phiPos<0)
1345  phiPos+=2*TMath::Pi();
1346  chargeTrackClusterRvsP[iD*4+iq]->Fill(phiPos,(*(it->points))[i].rCharge);
1347  chargeTrackClusterPvsR[iD*4+iq]->Fill(rPos,(*(it->points))[i].phiCharge);
1348  chargeTrackClusterR[iD*4+iq]->Fill((*(it->points))[i].rCharge);
1349  chargeTrackClusterP[iD*4+iq]->Fill((*(it->points))[i].phiCharge);
1350  numTrackClusterR[iD*4+iq]->Fill(rPos);
1351  numTrackClusterP[iD*4+iq]->Fill(phiPos);
1352  if(fabs((rCharge-phiCharge)/(rCharge+phiCharge))<0.1)
1353  {
1354  //num track is not needed beause we don't do it position depedent
1355  numTrackSymCutClusterR[iD*4+iq]->Fill(rPos);
1356  numTrackSymCutClusterP[iD*4+iq]->Fill(phiPos);
1357  //---
1358  chargeTrackSymCutClusterR[iD*4+iq]->Fill((*(it->points))[i].rCharge);
1359  chargeTrackSymCutClusterP[iD*4+iq]->Fill((*(it->points))[i].phiCharge);
1360  }
1361  radioPlotsTrackHits[iD]->Fill((*(it->points))[i].x,(*(it->points))[i].y);
1362  radioPlotsClusChargeR[iD]->Fill((*(it->points))[i].x,(*(it->points))[i].y,(*(it->points))[i].rCharge);
1363  radioPlotsClusChargeP[iD]->Fill((*(it->points))[i].x,(*(it->points))[i].y,(*(it->points))[i].phiCharge);
1364  radioPlotsClusSizeR[iD]->Fill((*(it->points))[i].x,(*(it->points))[i].y,(*(it->points))[i].rSize);
1365  radioPlotsClusSizeP[iD]->Fill((*(it->points))[i].x,(*(it->points))[i].y,(*(it->points))[i].phiSize);
1366  chargeCorrTracks[iD*4+iq]->Fill((*(it->points))[i].rCharge,(*(it->points))[i].phiCharge);
1367 
1368 
1369  trkPhiProj[iD]->Fill((*(it->points))[i].phi);
1370 
1371  if((*(it->points))[i].r>19)
1372  {
1373  chargeCorrTracksRCut[iD*4+iq]->Fill((*(it->points))[i].rCharge,(*(it->points))[i].phiCharge);
1374  }
1375 
1376  // cout <<" r charge: " << (*(it->points))[i].rCharge << " phi : " << (*(it->points))[i].phiCharge <<endl;
1377  // cout << "point on track: R hit: " << (*(it->points))[i].fgtHitR->getPositionR()<< " geoId: " << (*(it->points))[i].fgtHitR->getCentralStripGeoId() <<" size: " <<(*(it->points))[i].fgtHitR->getNstrip()<< endl;
1378  // cout << "point on track: Phi hit: " << (*(it->points))[i].fgtHitPhi->getPositionPhi()<< " geoId: " << (*(it->points))[i].fgtHitPhi->getCentralStripGeoId()<<" size: " << (*(it->points))[i].fgtHitPhi->getNstrip() <<endl;
1379 
1380  }
1381  }
1382 
1383  Double_t mx=it->mx;
1384  Double_t my=it->my;
1385  Double_t bx=it->ax;
1386  Double_t by=it->ay;
1387 
1388  // cout <<"looking at track with mx: " << it->mx <<" ax: " << it->ax <<" my: " << it->my <<" ay: " << it->ay <<endl;
1389  for(int i=0;i<6;i++)
1390  {
1391  // cout <<"checking on disk " << i <<endl;
1392  Double_t xExp=mx*StFgtGeneralBase::getLocDiscZ(i)+bx;
1393  Double_t yExp=my*StFgtGeneralBase::getLocDiscZ(i)+by;
1394  // cout <<"expecting x: " << xExp << ", " << yExp<<endl;
1395  Int_t quad=-1;
1396  //x=r*cos(phi)
1397  //y=r*sin(phi)
1398  Double_t r=sqrt(xExp*xExp+yExp*yExp);
1399  //if both, x and y, are negative we get the wrong angle
1400  Double_t phi=atan(yExp/xExp);
1401  if(xExp <0 && yExp <0)
1402  phi-=TMath::Pi();
1403  // cout <<"phi: "<<phi << " from x: " << xExp <<" y: " << yExp<<endl;
1404  if(phi<-MY_PI)
1405  phi+=2*MY_PI;
1406  if(phi>MY_PI)
1407  phi-=2*MY_PI;
1408  // if(phi<-MY_PI)
1409  // phi+=2*MY_PI;
1410 
1411  // quad=getQuadFromCoo(xExp,yExp);
1412  quad=StFgtGeom::getQuad(phi);
1413  // cout <<"got quad : " << quad << " for phi: " << phi <<endl;
1414  //convert to phi in quad.., so we have to subtract that axis...
1415 
1416  phi-=StFgtGeom::phiQuadXaxis(quad);
1417 
1418  if(phi>TMath::Pi())
1419  phi-=(2*TMath::Pi());
1420  if(phi<((-1)*TMath::Pi()))
1421  phi+=(2*TMath::Pi());
1422 
1423  if(phi<0)
1424  phi+=MY_PI;
1425 
1426  fillStripHistos(r,phi,i,quad);
1427  if(isSomewhatEff(r,phi,i,quad))
1428  {
1429  // cout <<" somewhat eff: " << xExp <<" y: " << yExp <<" disk: " << i <<endl;
1430  radioPlotsEffLoose[i]->Fill(xExp,yExp);
1431  }
1432  else
1433  {
1434  // cout <<"not somewhat eff: " << xExp <<" y: " << yExp <<endl;
1435  radioPlotsNonEffLoose[i]->Fill(xExp,yExp);
1436  }
1437 
1438  if(i==m_effDisk && quad==QUAD_EFF)
1439  {
1440  //do the r/phi thing
1441  if(findClosestStrip('R',r,i,quad)<MAX_DIST_STRIP_R)
1442  radioPlotsEffR[i]->Fill(xExp,yExp);
1443  else
1444  radioPlotsNonEffR[i]->Fill(xExp,yExp);
1445  //correct phi again, so it is absolute in space, like the quads
1446  if(findClosestStrip('P',phi+StFgtGeom::phiQuadXaxis(quad),i,quad)<MAX_DIST_STRIP_PHI)
1447  {
1448  // cout <<" found phi " <<endl;
1449  radioPlotsEffPhi[i]->Fill(xExp,yExp);
1450  }
1451  else
1452  {
1453  // cout << " not found, dist is:" <<findClosestStrip('P',phi,i,quad) <<endl;
1454  radioPlotsNonEffPhi[i]->Fill(xExp,yExp);
1455  }
1456  }
1457 
1458  Double_t closestPoint=findClosestPoint(mx,bx,my,by,xExp,yExp,i);
1459  // cout <<" closest point is " << closestPoint <<" away " <<endl;
1460 
1461 
1462  // (*outTxtFile) <<"closest point t " << xExp <<" , " << yExp << " is : " << closestPoint << " away " << endl;
1463 
1464  if(findClosestPoint(mx,bx,my,by,xExp,yExp,i)<MAX_DIST2_EFF)
1465  {
1466  // cout <<"found point on eff disk, x: " << xExp <<" y: " << yExp <<", dist: " << closestPoint <<endl;
1467  radioPlotsEff[i]->Fill(xExp,yExp);
1468  if(i==m_effDisk)
1469  // if(i==1)
1470  {
1471  hResidua->Fill(sqrt(closestPoint));
1472  hResiduaX->Fill(xExp,sqrt(closestPoint));
1473  hResiduaY->Fill(yExp,sqrt(closestPoint));
1474  hResiduaR->Fill(r,sqrt(closestPoint));
1475  hResiduaP->Fill(phi,sqrt(closestPoint));
1476  }
1477 
1478  (*outTxtFile) <<"***** found hit in disk " <<i << " quad: " << quad << " at " << xExp<<", " << yExp<<" r: " << r <<" phi: " <<phi << endl;
1479 
1480 #ifdef DO_PRINT
1481  // if(i==m_effDisk)
1482  printArea(r,phi,i,quad);
1483 #endif
1484  // chargeCorrInEffDisk->Fill(rPhiRatio.first,rPhiRatio.second);
1485  }
1486  else
1487  {
1488  // cout <<"non eff disk, x: " << xExp <<" y: " << yExp <<endl;
1489  radioPlotsNonEff[i]->Fill(xExp,yExp);
1490  // if(i==m_effDisk)
1491  (*outTxtFile) <<"expected (but haven't found) point on disk " << i <<", x: " << xExp <<" y: " << yExp << " r: " << r <<" phi: " << phi << " quad:: " << quad << endl;
1493 #ifdef DO_PRINT
1494  // if(i==m_effDisk)
1495  printArea(r,phi,i,quad);
1496 #endif
1497  }
1498  pair<Double_t,Double_t> rPhiRatio=getChargeRatio(r,phi,i,quad);
1499 
1500  if(rPhiRatio.first>0 && rPhiRatio.second>0)
1501  {
1502  double asym=fabs((Double_t)1-rPhiRatio.first/rPhiRatio.second);
1503  double ratio=rPhiRatio.first/rPhiRatio.second;
1504 
1505  // cout <<" filling with : r charge: " << rPhiRatio.first <<" , " << rPhiRatio.second <<" ratio: " << ratio <<" asym: " << asym<<endl;
1506  if(asym<2 && ratio <2)
1507  {
1508  hChargeAsym->Fill(asym);
1509  hChargeRatio->Fill(ratio);
1510  chargeRatioInEffDisk->Fill(xExp,yExp,ratio);
1511  chargeAsymInEffDisk->Fill(xExp,yExp,asym);
1512  }
1513  }
1514  }
1515  }
1516  int counter=0;
1517  for(vector<AVTrack>::iterator it=tracks.begin();it!=tracks.end();it++)
1518  {
1519  // cout <<" looking at track " << counter <<endl;
1520  counter++;
1521  // cout <<"This track has parameters: ";
1522  // cout <<" mx: " << it->mx <<" my: " << it->my <<" bx: " << it->ax << " by: " << it->ay << " chi2: " << it->chi2 <<endl;
1523  Double_t vertZ = ( -( it->mx*it->ax + it->my*it->ay )/(it->mx*it->mx+it->my*it->my));
1524 
1525  pair<double,double> dca=getDca(it);
1526  // cout <<"dca: " << dca.second <<" z vertex: " << vertZ <<" or " << dca.first <<endl;
1527  if(it->chi2<maxDistChi && fabs(vertZ)< vertexCut )
1528  {
1529  hIpZ->Fill(dca.first);
1530  hIp->Fill(dca.first,dca.second);
1531  hTrkZ->Fill(vertZ);
1532  hMx->Fill(it->mx);
1533  hMy->Fill(it->my);
1534  hBx->Fill(it->ax);
1535  hBy->Fill(it->ay);
1536  hChi2->Fill(it->chi2);
1537  if(it->vtxRank>0)
1538  {
1539  tpcFgtZVertexCorr->Fill(dca.first,it->ipZEv);
1540  tpcFgtZVertexCorr2->Fill(vertZ,it->ipZEv);
1541  tpcFgtZVtxDiff->Fill(dca.first-it->ipZEv);
1542  tpcFgtZVtxDiff->Fill(vertZ-it->ipZEv);
1543 
1544 
1545  }
1546  tpcFgtZVertexCorr3->Fill(vertZ,dca.first);
1547 
1548  hIpDca->Fill(dca.second);
1549  }
1550  }
1551  numTracks->Fill(numTracksInCurrEv);
1552  return ierr;
1553 
1554 };
1555 
1556 StFgtStraightPlotter::StFgtStraightPlotter( const Char_t* name, const Char_t* trackerName): StMaker( name ),intNumTracks(0),useChargeMatch(false),runningEvtNr(0),hitCounter(0),hitCounterR(0),printCounter(0),fitCounter(0)
1557 {
1558 
1559  sprintf(mTrackerName,"%s",trackerName);
1560 
1561  StFgtDbMaker *fgtDbMkr = static_cast< StFgtDbMaker* >( GetMakerInheritsFrom( "StFgtDbMaker" ) );
1562  if( !fgtDbMkr ){
1563  LOG_FATAL << "StFgtDb not provided and error finding StFgtDbMaker" << endm;
1564  }
1565  mDb = fgtDbMkr->getDbTables();
1566  if( !mDb ){
1567  LOG_FATAL << "StFgtDb not provided and error retrieving pointer from StFgtDbMaker '"
1568  << fgtDbMkr->GetName() << endm;
1569  }
1570  //count from 0--> third disk
1571  m_effDisk=2;
1572  sprintf(mFileBase,"%s",".");
1573  pulseCondition=true;
1574  lenCondition=false;
1575  maxDistStrip_R=0.7;
1576  maxDistStrip_Phi=0.03;
1577  maxDist2Eff=1.0;
1578  doPrint=false;
1579  StFgtGeneralBase *fgtGenMkr = static_cast<StFgtGeneralBase * >( GetMaker("fgtGenBase"));
1580  isCosmic=fgtGenMkr->isCosmic();
1581 
1582  if(!isCosmic)
1583  vertexCut=50;
1584  else
1585  vertexCut=100000000;
1586 
1587  dcaCut=3;
1588  //no cut
1589  // dcaCut=100;
1590 
1591  maxDistChi=1.0;
1592  // cout <<"AVE constructor!!" <<endl;
1593 
1594 
1595 
1596 };
1597 
1598 StFgtStraightPlotter::~StFgtStraightPlotter()
1599 {
1600 
1601  //delete histogram arrays
1602 };
1603 void StFgtStraightPlotter::SetFileBase(const Char_t* filebase, const Char_t* filename )
1604 {
1605  cout <<"setting file base to " << filebase <<endl;
1606  sprintf(mFileBase,"%s",filebase);
1607  sprintf(mFileName,"%s",filename);
1608 }
1609 
1611 
1612 
1613  outTxtFile->close();
1614  gStyle->SetPalette(1);
1615  Int_t ierr = kStOk;
1616  // cout <<"we found " << intNumTracks << " tracks " <<endl;
1618  StFgtStraightTrackMaker *fgtSTracker = static_cast<StFgtStraightTrackMaker * >( GetMaker("fgtStraightTracker"));
1619  vector<AVTrack>& tracks=fgtSTracker->getTracks();
1620 
1623  char buffer[300];
1624  sprintf(buffer,"radioPlots_%s",mFileName);
1625  TCanvas* cRadio=new TCanvas(buffer,buffer,1000,1500);
1626  sprintf(buffer,"radioPlotsLoose_%s",mFileName);
1627  TCanvas* cRadioLoose=new TCanvas(buffer,buffer,1000,1500);
1628  sprintf(buffer,"radioPlotsR_%s",mFileName);
1629  TCanvas* cRadioR=new TCanvas(buffer,buffer,1000,1500);
1630  sprintf(buffer,"radioPlotsPhi_%s",mFileName);
1631  TCanvas* cRadioPhi=new TCanvas(buffer,buffer,1000,1500);
1632  sprintf(buffer,"radioPlotsHits_%s",mFileName);
1633  TCanvas* cRadioHits=new TCanvas(buffer,buffer,1000,1500);
1634  sprintf(buffer,"radioPlotsNonHits_%s",mFileName);
1635  TCanvas* cRadioNonHits=new TCanvas(buffer,buffer,1000,1500);
1636  // cout <<"divide "<<endl;
1637  cRadio->Divide(2,3); //6 discs
1638  cRadioR->Divide(2,3); //6 discs
1639  cRadioPhi->Divide(2,3); //6 discs
1640  cRadioLoose->Divide(2,3); //6 discs
1641  cRadioHits->Divide(2,3); //6 discs
1642  cRadioNonHits->Divide(2,3); //6 discs
1643  sprintf(buffer,"rPhiRatios_%s",mFileName);
1644  TCanvas* cRPRatio=new TCanvas(buffer,buffer,1000,1500);
1645  cRPRatio->Divide(2,3); //6 discs
1646  sprintf(buffer,"crEff_%s",mFileName);
1647  TCanvas* cREff=new TCanvas(buffer,buffer,1000,1500);
1648 
1649  cREff->Divide(2,3); //6 discs
1650  // cout <<"drawing hits " <<endl;
1651  for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
1652  {
1653  // cRadio->cd(iD+1)->SetLogz();
1654  cRadioHits->cd(iD+1);
1655  radioPlotsEff[iD]->Draw("colz");
1656  cRadioNonHits->cd(iD+1);
1657  radioPlotsNonEff[iD]->Draw("colz");
1658  }
1659 
1660  sprintf(buffer,"%s/clusterPics%s.root",mFileBase,mFileName);
1661  cout <<"setting cluster pic file to : " << buffer <<endl;
1662  TFile *fClu = new TFile(buffer,"recreate");
1663  cout <<" 1 " << endl;
1664  fClu->cd();
1665  cout <<" 2 " << endl;
1666  for(unsigned int i=0;i<v_hClusP.size();i++)
1667  {
1668  // (v_hClusP[i])->Write();
1669  }
1670  cout <<" 3 " << endl;
1671  for(unsigned int i=0;i<v_hClusR.size();i++)
1672  {
1673  // (v_hClusR[i])->Write();
1674  }
1675  cout <<" 4 " << endl;
1676  fClu->Write();
1677  cout <<" 5 " << endl;
1678  fClu->Close();
1679  cout <<"about to open signal shapes file... "<<endl;
1680  sprintf(buffer,"%s/signalShapes%s.root",mFileBase,mFileName);
1681  cout <<"setting signal shapes file to : " << buffer <<endl;
1682  TFile *f1 = new TFile(buffer,"recreate");
1683  f1->cd();
1684  cout <<"writing hip..."<<endl;
1685  TCanvas ctmp;
1686  hIp->Draw();
1687  hIp->Write();
1688  f1->Write();
1689  for(int iD=0;iD<6;iD++)
1690  {
1691  radioPlotsTrackHits[iD]->Write();
1692  radioPlotsClusSizeR[iD]->Write();
1693  radioPlotsClusSizeP[iD]->Write();
1694  radioPlotsClusChargeR[iD]->Write();
1695  radioPlotsClusChargeP[iD]->Write();
1696  trkPhiProj[iD]->Write();
1697  }
1698 
1699  // ctmp.SaveAs("tmp.png");
1700 
1701  //normalize
1702  for(int iB=1;iB<8;iB++)
1703  {
1704  exPulseMaxAdcNormP->SetBinContent(iB,exPulseMaxAdcNormP->GetBinContent(iB)/(float)pulseCounterP);
1705  exPulseSigP->SetBinContent(iB,exPulseSigP->GetBinContent(iB)/(float)pulseCounterP);
1706 
1707  exPulseMaxAdcNormR->SetBinContent(iB,exPulseMaxAdcNormR->GetBinContent(iB)/(float)pulseCounterR);
1708  exPulseSigR->SetBinContent(iB,exPulseSigR->GetBinContent(iB)/(float)pulseCounterR);
1709 
1710  exPulseMaxAdcNormTrackP->SetBinContent(iB,exPulseMaxAdcNormTrackP->GetBinContent(iB)/(float)pulseCounterTP);
1711  exPulseSigTrackP->SetBinContent(iB,exPulseSigTrackP->GetBinContent(iB)/(float)pulseCounterTP);
1712 
1713  exPulseMaxAdcNormTrackR->SetBinContent(iB,exPulseMaxAdcNormTrackR->GetBinContent(iB)/(float)pulseCounterTR);
1714  exPulseSigTrackR->SetBinContent(iB,exPulseSigTrackR->GetBinContent(iB)/(float)pulseCounterTR);
1715  }
1716 
1717  chargeCorrSum3->Write();
1718  chargeCorrMaxStrip->Write();
1719  chargeCorrMaxAdc->Write();
1720 
1721  exPulseMaxAdcNormP->Write();
1722  exPulseSigP->Write();
1723 
1724  exPulseMaxAdcNormR->Write();
1725  exPulseSigR->Write();
1726 
1727  exPulseMaxAdcNormTrackP->Write();
1728  exPulseSigTrackP->Write();
1729  exPulseMaxAdcNormTrackR->Write();
1730  exPulseSigTrackR->Write();
1731  numTracks->Write();
1732  numPointsPerTrack->Write();
1733 
1734  for(int xx=0; xx<22; xx++){
1735 
1736  disk1QuadA[xx]->Write();
1737  }
1738 
1739 
1740  for(int iD=0;iD<kFgtNumDiscs;iD++)
1741  {
1742 
1743  //Added for writing geoId, R, phi cluster histrograms
1744 
1745  clusterGeoId[iD]->Write();
1746  clustersR[iD]->Write();
1747  clustersP[iD]->Write();
1748 
1749 
1750  for(int iq=0;iq<4;iq++)
1751  {
1752  numClustersR[iD*4+iq]->Write();
1753  numClustersPhi[iD*4+iq]->Write();
1754  numTrackHits[iD*4+iq]->Write();
1755 
1756 
1757  maxTbCloseClusterP[iD*4+iq]->Write();
1758  maxTbCloseClusterR[iD*4+iq]->Write();
1759  maxAdcCloseClusterP[iD*4+iq]->Write();
1760  maxSigTrackClusterP[iD*4+iq]->Write();
1761  numFSigCloseClusterP[iD*4+iq]->Write();
1762  numFirstHighCloseClusterP[iD*4+iq]->Write();
1763  maxAdcCloseClusterP[iD*4+iq]->Write();
1764  maxSigCloseClusterP[iD*4+iq]->Write();
1765  secondToLastRatioCloseClusterP[iD*4+iq]->Write();
1766  maxAdcCloseClusterR[iD*4+iq]->Write();
1767  maxSigCloseClusterR[iD*4+iq]->Write();
1768  numFSigCloseClusterR[iD*4+iq]->Write();
1769  numFirstHighCloseClusterR[iD*4+iq]->Write();
1770  maxAdcCloseClusterR[iD*4+iq]->Write();
1771  maxSigCloseClusterR[iD*4+iq]->Write();
1772  secondToLastRatioCloseClusterR[iD*4+iq]->Write();
1773  firstTbSigCloseClusterR[iD*4+iq]->Write();
1774  firstTbSigCloseClusterP[iD*4+iq]->Write();
1775 
1776  chargeTrackClusterR[iD*4+iq]->Write();
1777  chargeTrackClusterP[iD*4+iq]->Write();
1778  chargeTrackClusterRvsP[iD*4+iq]->Write();
1779  chargeTrackClusterPvsR[iD*4+iq]->Write();
1780  numTrackClusterR[iD*4+iq]->Write();
1781  numTrackClusterP[iD*4+iq]->Write();
1782  numTrackSymCutClusterR[iD*4+iq]->Write();
1783  numTrackSymCutClusterP[iD*4+iq]->Write();
1784  chargeCorrTracks[iD*4+iq]->Write();
1785  chargeCorrTracksRCut[iD*4+iq]->Write();
1786  chargeTrackSymCutClusterR[iD*4+iq]->Write();
1787  chargeTrackSymCutClusterP[iD*4+iq]->Write();
1788  maxTbTrackClusterP[iD*4+iq]->Write();
1789  maxTbTrackClusterR[iD*4+iq]->Write();
1790  maxAdcTrackClusterP[iD*4+iq]->Write();
1791  maxSigTrackClusterP[iD*4+iq]->Write();
1792  numFSigTrackClusterP[iD*4+iq]->Write();
1793  numFirstHighTrackClusterP[iD*4+iq]->Write();
1794  maxAdcTrackClusterP[iD*4+iq]->Write();
1795  maxSigTrackClusterP[iD*4+iq]->Write();
1796  secondToLastRatioTrackClusterP[iD*4+iq]->Write();
1797  maxAdcTrackClusterR[iD*4+iq]->Write();
1798  maxSigTrackClusterR[iD*4+iq]->Write();
1799  numFSigTrackClusterR[iD*4+iq]->Write();
1800  numFirstHighTrackClusterR[iD*4+iq]->Write();
1801  maxAdcTrackClusterR[iD*4+iq]->Write();
1802  maxSigTrackClusterR[iD*4+iq]->Write();
1803  secondToLastRatioTrackClusterR[iD*4+iq]->Write();
1804  firstTbSigTrackClusterR[iD*4+iq]->Write();
1805  firstTbSigTrackClusterP[iD*4+iq]->Write();
1806 
1807  }
1808  }
1809 
1810  for(int iD=0;iD<6;iD++)
1811  {
1812  for(int binAPVi=0;binAPVi<40;binAPVi++)
1813  {
1814  APVfitChi2P[iD*40+binAPVi]->Write();
1815  APVfitChi2R[iD*40+binAPVi]->Write();
1816  APVfitAmpP[iD*40+binAPVi]->Write();
1817  APVfitAmpR[iD*40+binAPVi]->Write();
1818  APVfitT0P[iD*40+binAPVi]->Write();
1819  APVfitT0R[iD*40+binAPVi]->Write();
1820 
1821  APVfirstTbSigCloseClusterP[iD*40+binAPVi]->Write();
1822  APVmaxAdcCloseClusterP[iD*40+binAPVi]->Write();
1823  APVmaxTbCloseClusterP[iD*40+binAPVi]->Write();
1824  APVnumFSigCloseClusterP[iD*40+binAPVi]->Write();
1825  APVnumFirstHighCloseClusterP[iD*40+binAPVi]->Write();
1826  APVmaxSigCloseClusterP[iD*40+binAPVi]->Write();
1827  APVsecondToLastRatioCloseClusterP[iD*40+binAPVi]->Write();
1828  APVfirstTbSigCloseClusterR[iD*40+binAPVi]->Write();
1829  APVmaxAdcCloseClusterR[iD*40+binAPVi]->Write();
1830  APVmaxTbCloseClusterR[iD*40+binAPVi]->Write();
1831  APVnumFSigCloseClusterR[iD*40+binAPVi]->Write();
1832  APVnumFirstHighCloseClusterR[iD*40+binAPVi]->Write();
1833  APVmaxSigCloseClusterR[iD*40+binAPVi]->Write();
1834  APVsecondToLastRatioCloseClusterR[iD*40+binAPVi]->Write();
1835  }
1836  }
1837 
1838 
1839  cout <<"writen and closed " << endl;
1840 
1841 
1844 
1845 
1846  sprintf(buffer,"clusterSizeR_%s",mFileName);
1847  TCanvas* cClusterSizeR=new TCanvas(buffer,buffer,1000,1500);
1848 
1849  cClusterSizeR->Divide(2,3);
1850  sprintf(buffer,"clusterSizePhi_%s",mFileName);
1851  TCanvas* cClusterSizePhi=new TCanvas(buffer,buffer,1000,1500);
1852  cClusterSizePhi->Divide(2,3);
1853  sprintf(buffer,"chargeCorr_%s",mFileName);
1854  TCanvas* cChargeCorr=new TCanvas(buffer,buffer,1000,1500);
1855  cChargeCorr->Divide(3,4);
1856  sprintf(buffer,"clusterChargePhi_%s",mFileName);
1857  TCanvas* cClusterChargePhi=new TCanvas(buffer,buffer,1000,1500);
1858  cClusterChargePhi->Divide(2,3);
1859  sprintf(buffer,"clusterChargeR_%s",mFileName);
1860  TCanvas* cClusterChargeR=new TCanvas(buffer,buffer,1000,1500);
1861  cClusterChargeR->Divide(2,3);
1862 
1863  // TCanvas cIPProj;
1864  // hIp->Draw("colz");
1865 
1867  hBx->Draw();
1868  hBx->Write();
1870  hBy->Draw();
1871  hBy->Write();
1873  hMx->Draw();
1874  hMx->Write();
1876  hMy->Draw();
1877  hMy->Write();
1879 
1880 
1881  hIpZ->Draw();
1882  hIpZ->Write();
1884 
1885 
1886  hIpDca->Draw();
1887  hIpDca->Write();
1889 
1890  hTrkZ->Draw();
1891  hTrkZ->Write();
1893 
1894  hResidua->Draw();
1895  hResidua->Write();
1896  hResiduaX->Draw();
1897  hResiduaX->Write();
1898 
1899  hResiduaY->Draw();
1900  hResiduaY->Write();
1901  hResiduaR->Draw();
1902  hResiduaR->Write();
1903  hResiduaP->Draw();
1904  hResiduaP->Write();
1906 
1907  hChi2->Draw();
1908  hChi2->Write();
1910 
1911  tpcFgtZVertexCorr->Draw("colz");
1912  tpcFgtZVertexCorr->Write();
1914 
1915  tpcFgtZVertexCorr2->Draw("colz");
1916  tpcFgtZVertexCorr2->Write();
1917 
1918  tpcFgtZVtxDiff->Write();
1919  tpcFgtZVtxDiff2->Write();
1921  tpcFgtZVertexCorr3->Draw("colz");
1922  tpcFgtZVertexCorr3->Write();
1924 
1925 
1926  for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
1927  {
1928  cClusterSizeR->cd(iD+1);
1929  h_clusterSizeR[iD]->Draw();
1930  cClusterSizePhi->cd(iD+1);
1931  h_clusterSizePhi[iD]->Draw();
1932  for(int iq=0;iq<4;iq++)
1933  {
1934  cChargeCorr->cd(iD*4+iq+1);
1935  chargeCorr[iD*4+iq]->Draw("colz");
1936  chargeCorr[iD*4+iq]->Write();
1937  clusterSizeR[iD*4+iq]->Write();
1938  clusterSizeP[iD*4+iq]->Write();
1939  }
1940  cClusterChargeR->cd(iD+1);
1941  h_clusterChargeR[iD]->Draw();
1942  cClusterChargePhi->cd(iD+1);
1943  h_clusterChargePhi[iD]->Draw();
1944  h_clusterChargeR[iD]->Write();
1945  h_clusterChargePhi[iD]->Write();
1946 
1947  }
1948  f1->Write();
1949 
1955 
1956  cout <<"saving .." <<endl;
1957  doNormalize(radioPlotsEffR, radioPlotsNonEffR);
1958  doNormalize(radioPlotsEffPhi, radioPlotsNonEffPhi);
1959 
1960 
1961  for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
1962  {
1963  sprintf(buffer,"allCountsLooseDisk_%d",iD+1);
1964  TH2D* tmpAllCountsLoose=(TH2D*)radioPlotsEffLoose[iD]->Clone(buffer);
1965  tmpAllCountsLoose->Write();
1966  sprintf(buffer,"allClusterCountsDisk_%d",iD+1);
1967  TH2D* tmpAllClusterCounts=(TH2D*)radioPlotsEff[iD]->Clone(buffer);
1968  tmpAllClusterCounts->Write();
1969  }
1970 
1971  doNormalize(radioPlotsEffLoose, radioPlotsNonEffLoose);
1972 
1973 
1974  for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
1975  {
1976  cRadio->cd(iD+1);
1977  sprintf(buffer,"allCountsDisk_%d",iD+1);
1978  TH2D* tmpAllCounts=(TH2D*)radioPlotsEff[iD]->Clone(buffer);
1979  tmpAllCounts->Write();
1980  radioPlotsEff[iD]->Add(radioPlotsNonEff[iD]);//all counts
1981  // radioPlotsEff[iD]->Add(radioPlotsNonEff[iD],-1); //subtract non eff
1982 
1984  for(int nx=1;nx<radioPlotsEff[iD]->GetNbinsX()+1;nx++)
1985  {
1986  for(int ny=1;ny<radioPlotsEff[iD]->GetNbinsY()+1;ny++)
1987  {
1988  Double_t denom=radioPlotsEff[iD]->GetBinContent(nx,ny);
1989  if(denom>0 && (tmpAllCounts->GetBinContent(nx,ny)/denom)<=1.0)
1990  {
1991  // cout <<" efficiency bin nx: " << nx << " ny: " << ny << ", num counts " << tmpAllCounts->GetBinContent(nx,ny) << " / " << denom << " : " << tmpAllCounts->GetBinContent(nx,ny)/denom <<endl;
1992  radioPlotsEff[iD]->SetBinContent(nx,ny,tmpAllCounts->GetBinContent(nx,ny)/denom);
1993  if(iD==m_effDisk)
1994  {
1995  // cout <<"chargeRatio is: " << chargeRatioInEffDisk->GetBinContent(nx,ny)<<endl;
1996  chargeRatioInEffDisk->SetBinContent(nx,ny,chargeRatioInEffDisk->GetBinContent(nx,ny)/denom);
1997  chargeAsymInEffDisk->SetBinContent(nx,ny,chargeAsymInEffDisk->GetBinContent(nx,ny)/denom);
1998  }
1999  }
2000  else
2001  {
2002  // cout <<" efficiency bin nx: " << nx << " ny: " << ny << ", num counts " << tmpAllCounts->GetBinContent(nx,ny) << " / " << denom << " : 0.0" <<endl;
2003  radioPlotsEff[iD]->SetBinContent(nx,ny,0.0);
2004  }
2005  }
2006  }
2007  // radioPlotsEff[iD]->Divide(tmpAllCounts);
2008  radioPlotsEff[iD]->SetMaximum(1.0);
2009  radioPlotsEff[iD]->Draw("colz");
2010 
2011  radioPlotsEffR[iD]->SetMaximum(1.0);
2012  radioPlotsEffPhi[iD]->SetMaximum(1.0);
2013  radioPlotsEffLoose[iD]->SetMaximum(1.0);
2014  cRadioR->cd(iD+1);
2015  radioPlotsEffR[iD]->Draw("colz");
2016  radioPlotsEffR[iD]->Write();
2017  cRadioPhi->cd(iD+1);
2018  radioPlotsEffPhi[iD]->Draw("colz");
2019  radioPlotsEffPhi[iD]->Write();
2020  cRadioLoose->cd(iD+1);
2021  radioPlotsEffLoose[iD]->Draw("colz");
2022  radioPlotsEffLoose[iD]->Write();
2023  radioPlotsNonEffLoose[iD]->Write();
2024  radioPlotsNonEff[iD]->Write();
2025  cRPRatio->cd(iD+1);
2026  rPhiRatioPlots[iD]->Draw();
2027  cREff->cd(iD+1);
2028  f1->Write();
2029 
2030  TH1D* tmpR=(TH1D*)rEff[iD]->Clone("tmpR");
2031  rEff[iD]->Add(rNonEff[iD]);
2032  for(int nx=0;nx<rEff[iD]->GetNbinsX();nx++)
2033  {
2034  Double_t denom=rEff[iD]->GetBinContent(nx);
2035  if(denom>0)
2036  rEff[iD]->SetBinContent(nx,tmpR->GetBinContent(nx)/denom);
2037  else
2038  rEff[iD]->SetBinContent(nx,0.0);
2039  }
2040  rEff[iD]->Draw();
2041  }
2042 
2045 
2049 
2050  cRadio->cd(0);
2051  chargeRatioInEffDisk->Draw("colz");
2053  chargeAsymInEffDisk->Draw("colz");
2055  chargeCorrInEffDisk->Draw("colz");
2056  chargeCorrInEffDisk->Write();
2058  hChargeAsym->Draw();
2060  hChargeRatio->Draw();
2062 
2063 
2066 
2069  f1->Write();
2071  f1->Close();
2072  myRootFile->Write();
2073  myRootFile->Close();
2074 
2075  pulsePictureFile->Write();
2076  cout <<"returning after finish" <<endl;
2077  return ierr;
2078 };
2079 
2080 
2081 
2082 // construct histograms
2083 
2084 
2085 Int_t StFgtStraightPlotter::Init(){
2086  cout <<"init file name is " << mFileName<<endl;
2087  outTxtFile=new ofstream;
2088  outTxtFile->open("clusExpectations.txt");
2089  cluNotFoundTxt=new ofstream;
2090  cluNotFoundTxt->open("clusNotFound.txt");
2091 
2092  Char_t buffer[500];
2093  sprintf(buffer,"tmpCnvs%s",mFileName);
2094  mCanvas=new TCanvas(buffer,buffer);
2095  cout <<"made canvas with name " << buffer <<" pointer: " << mCanvas <<endl;
2096  sprintf(buffer,"%s/clusterEff%s.root",mFileBase,mFileName);
2097 
2098  myRootFile=new TFile(buffer,"RECREATE");
2099  sprintf(buffer,"%s/pulsePic%s.root",mFileBase,mFileName);
2100 
2101  pulsePictureFile=new TFile(buffer,"RECREATE");
2102  cout <<"making dirs.." <<endl;
2103  for(int i=0;i<6;i++){
2104  for(int iq=0;iq<4;iq++){
2105  sprintf(buffer,"d%d_quad%d",i,iq);
2106  pulsePictureFile->mkdir(buffer);
2107  pulsePictureFile->cd(buffer);
2108  for(int iA=0;iA<24;iA++)
2109  {
2110  sprintf(buffer,"apv%d_R",iA);
2111  gDirectory->mkdir(buffer);
2112  sprintf(buffer,"apv%d_P",iA);
2113  gDirectory->mkdir(buffer);
2114  }
2115  pulsePictureFile->cd();
2116 
2117  }}
2118  cout <<"done " << endl;
2119  myRootFile->cd();
2120  // outTxtFile=new ofstream;
2121  // outTxtFile->open("clusters.txt");
2122  sprintf(buffer,"pulseShape_%s",mFileName);
2123  int numTb=7;
2124  mPulseShapePtr=new TF1(buffer,"[0]*(x>[4])*(x-[4])**[1]*exp(-[2]*(x-[4]))+[3]",0,numTb);
2125  mPulseShapePtr->SetParName( 0, "C" );
2126  mPulseShapePtr->SetParName( 1, "a" );
2127  mPulseShapePtr->SetParName( 2, "b" );
2128  mPulseShapePtr->SetParName( 3, "ped" );
2129  mPulseShapePtr->SetParName( 4, "t0" );
2130 
2131  sprintf(buffer,"tempFitHist_%s",mFileName);
2132  mHistPtr=new TH1F(buffer,buffer,numTb,0,numTb);
2133  sprintf(buffer,"tempFitHist2_%s",mFileName);
2134  mHistPtr2=new TH1F(buffer,buffer,numTb,0,numTb);
2135  mHistPtr2->SetLineColor(kBlue);
2136  mHistPtr2->SetFillColor(kBlue);
2137  mHistPtr2->SetMarkerColor(kBlue);
2138  cout <<"producing my canvas... "<<endl;
2139 
2140 
2141 
2142 
2143 
2144 
2145  Int_t ierr = kStOk;
2146  sprintf(buffer,"chargeRatioInEffDisk_%s",mFileName);
2147  chargeRatioInEffDisk=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2148  chargeRatioInEffDisk->SetMaximum(2.0);
2149  sprintf(buffer,"chargeAsymInEffDisk_%s",mFileName);
2150  chargeAsymInEffDisk=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2151  chargeAsymInEffDisk->SetMaximum(1.0);
2152  sprintf(buffer,"chargeCorrInEffDisk_%s",mFileName);
2153  chargeCorrInEffDisk=new TH2D(buffer,buffer,500,0,50000,500,0,50000);
2154  sprintf(buffer,"chargeAsym_%s",mFileName);
2155  hChargeAsym=new TH1D(buffer,buffer,100,0,50);
2156  sprintf(buffer,"chargeRatio_%s",mFileName);
2157  hChargeRatio=new TH1D(buffer,buffer,100,0,50);
2158 
2159  sprintf(buffer,"chargeCorrSum3_%s",mFileName);
2160  chargeCorrSum3=new TH2D(buffer,buffer,500,0,50000,500,0,50000);
2161  sprintf(buffer,"chargeCorrMaxStrip_%s",mFileName);
2162  chargeCorrMaxStrip=new TH2D(buffer,buffer,500,0,20000,500,0,20000);
2163  sprintf(buffer,"chargeCorrMaxAdc_%s",mFileName);
2164  chargeCorrMaxAdc=new TH2D(buffer,buffer,500,0,5000,500,0,5000);
2165  chargeCorrTracks=new TH2D*[kFgtNumDiscs*4];
2166  chargeCorrTracksRCut=new TH2D*[kFgtNumDiscs*4];
2167 
2168  trkPhiProj=new TH1D*[kFgtNumDiscs];
2169 
2170  radioPlotsTrackHits=new TH2D*[kFgtNumDiscs];
2171  radioPlotsClusChargeR=new TH2D*[kFgtNumDiscs];
2172  radioPlotsClusSizeR=new TH2D*[kFgtNumDiscs];
2173  radioPlotsClusChargeP=new TH2D*[kFgtNumDiscs];
2174  radioPlotsClusSizeP=new TH2D*[kFgtNumDiscs];
2175 
2176  radioPlotsEff=new TH2D*[kFgtNumDiscs];
2177  radioPlotsNonEff=new TH2D*[kFgtNumDiscs];
2178  radioPlotsEffR=new TH2D*[kFgtNumDiscs];
2179  radioPlotsNonEffR=new TH2D*[kFgtNumDiscs];
2180  radioPlotsEffPhi=new TH2D*[kFgtNumDiscs];
2181  radioPlotsEffLoose=new TH2D*[kFgtNumDiscs];
2182  radioPlotsNonEffPhi=new TH2D*[kFgtNumDiscs];
2183  radioPlotsNonEffLoose=new TH2D*[kFgtNumDiscs];
2184  rPhiRatioPlots=new TH1D*[kFgtNumDiscs];
2185 
2186  sprintf(buffer,"pulseMaxAdcNormP_%s",mFileName);
2187  exPulseMaxAdcNormP=new TH1F(buffer,buffer,7,0,6);
2188  sprintf(buffer,"pulseSigNormP_%s",mFileName);
2189  exPulseSigP=new TH1F(buffer,buffer,7,0,6);
2190  sprintf(buffer,"pulseMaxAdcNormR_%s",mFileName);
2191  exPulseMaxAdcNormR=new TH1F(buffer,buffer,7,0,6);
2192  sprintf(buffer,"pulseSigNormR_%s",mFileName);
2193  exPulseSigR=new TH1F(buffer,buffer,7,0,6);
2194 
2195  sprintf(buffer,"pulseMaxAdcNormTrackP_%s",mFileName);
2196  exPulseMaxAdcNormTrackP=new TH1F(buffer,buffer,7,0,6);
2197  sprintf(buffer,"pulseSigNormTrackP_%s",mFileName);
2198  exPulseSigTrackP=new TH1F(buffer,buffer,7,0,6);
2199 
2200  sprintf(buffer,"pulseMaxAdcNormTrackR_%s",mFileName);
2201  exPulseMaxAdcNormTrackR=new TH1F(buffer,buffer,7,0,6);
2202  sprintf(buffer,"pulseSigNormTrackR_%s",mFileName);
2203  exPulseSigTrackR=new TH1F(buffer,buffer,7,0,6);
2204 
2205 
2206  pulseCounterP=0;
2207  pulseCounterR=0;
2208 
2209  pulseCounterTP=0;
2210  pulseCounterTR=0;
2211 
2212 
2213 
2214 
2215  createPlots(&numClustersR,kFgtNumDiscs*4,"numClustersR",101,0,100);
2216  createPlots(&numClustersPhi,kFgtNumDiscs*4,"numClustersPhi",101,0,100);
2217  createPlots(&numTrackHits,kFgtNumDiscs*4,"numTrackHits",101,0,100);
2218  sprintf(buffer,"numTracksPerEvent_%s",mFileName);
2219  numTracks=new TH1I(buffer,buffer,10,0,9);
2220  sprintf(buffer,"numPointsPerTrack_%s",mFileName);
2221  numPointsPerTrack=new TH1I(buffer,buffer,7,0,6);
2222 
2223  createPlots(&firstTbSigCloseClusterR,kFgtNumDiscs*4,"firstTbSigCloseClusterR",100,0,20);
2224  createPlots(&firstTbSigCloseClusterP,kFgtNumDiscs*4,"firstTbSigCloseClusterP",100,0,20);
2225  createPlots(&firstTbSigTrackClusterR,kFgtNumDiscs*4,"firstTbSigTrackClusterR",100,0,20);
2226  createPlots(&firstTbSigTrackClusterP,kFgtNumDiscs*4,"firstTbSigTrackClusterP",100,0,20);
2227 
2228  createPlots(&chargeTrackSymCutClusterR,kFgtNumDiscs*4,"chargeTrackSymCutClusterR",100,0,10000);
2229  createPlots(&chargeTrackSymCutClusterP,kFgtNumDiscs*4,"chargeTrackSymCutClusterP",100,0,10000);
2230 
2231  createPlots(&numTrackSymCutClusterR,kFgtNumDiscs*4,"numTrackSymCutClusterR",100,0,10000);
2232  createPlots(&numTrackSymCutClusterP,kFgtNumDiscs*4,"numTrackSymCutClusterP",100,0,10000);
2233 
2234  createPlots(&numTrackClusterR,kFgtNumDiscs*4,"numTrackClusterR",100,10,40);
2235  createPlots(&numTrackClusterP,kFgtNumDiscs*4,"numTrackClusterP",100,0,7);
2236 
2237  createPlots(&chargeTrackClusterR,kFgtNumDiscs*4,"chargeTrackClusterR",100,0,10000);
2238  createPlots(&chargeTrackClusterP,kFgtNumDiscs*4,"chargeTrackClusterP",100,0,10000);
2239 
2240  createPlots(&chargeTrackClusterRvsP,kFgtNumDiscs*4,"chargeTrackClusterRvsP",100,0,7);
2241  createPlots(&chargeTrackClusterPvsR,kFgtNumDiscs*4,"chargeTrackClusterPvsR",100,10,40);
2242 
2243  createPlots(&maxAdcTrackClusterR,kFgtNumDiscs*4,"maxAdcTrackClusterR",100,0,5000);
2244  createPlots(&maxAdcCloseClusterR,kFgtNumDiscs*4,"maxAdcCloseClusterR",100,0,5000);
2245  createPlots(&maxSigTrackClusterR,kFgtNumDiscs*4,"maxSigTrackClusterR",100,1,200);
2246  createPlots(&maxSigCloseClusterR,kFgtNumDiscs*4,"maxSigCloseClusterR",100,1,200);
2247  createPlots(&numFSigTrackClusterR,kFgtNumDiscs*4,"numFSigTrackClusterR",9,1,8);
2248  createPlots(&maxTbCloseClusterR,kFgtNumDiscs*4,"maxTbCloseClusterR",8,0,7);
2249 
2250  createPlots(&maxTbCloseClusterP,kFgtNumDiscs*4,"maxTbCloseClusterP",8,0,7);
2251 
2252  createPlots(&maxTbTrackClusterR,kFgtNumDiscs*4,"maxTbTrackClusterR",8,0,7);
2253 
2254  createPlots(&maxTbTrackClusterP,kFgtNumDiscs*4,"maxTbTrackClusterP",9,0,8);
2255  createPlots(&numFSigCloseClusterR,kFgtNumDiscs*4,"numFSigCloseClusterR",9,0,8);
2256 
2257  createPlots(&numFirstHighTrackClusterR,kFgtNumDiscs*4,"numFirstHighTrackClusterR",8,0,7);
2258  createPlots(&numFirstHighCloseClusterR,kFgtNumDiscs*4,"numFirstHighCloseClusterR",8,0,7);
2259 
2260  createPlots(&maxAdcTrackClusterP,kFgtNumDiscs*4,"maxAdcTrackClusterP",100,0,5000);
2261  createPlots(&maxAdcCloseClusterP,kFgtNumDiscs*4,"maxAdcCloseClusterP",100,0,5000);
2262  createPlots(&maxSigTrackClusterP,kFgtNumDiscs*4,"maxSigTrackClusterP",100,1,200);
2263  createPlots(&maxSigCloseClusterP,kFgtNumDiscs*4,"maxSigCloseClusterP",100,1,200);
2264  createPlots(&numFSigTrackClusterP,kFgtNumDiscs*4,"numFSigTrackClusterP",9,0,8);
2265  createPlots(&numFSigCloseClusterP,kFgtNumDiscs*4,"numFSigCloseClusterP",9,0,8);
2266  createPlots(&numFirstHighTrackClusterP,kFgtNumDiscs*4,"numFirstHighTrackClusterP",8,0,7);
2267  createPlots(&numFirstHighCloseClusterP,kFgtNumDiscs*4,"numFirstHighCloseClusterP",8,0,7);
2268  createPlots(&secondToLastRatioCloseClusterP,kFgtNumDiscs*4,"secondToLastRatioClosClusterP",100,0,5);
2269 
2270  createPlots(&secondToLastRatioCloseClusterR,kFgtNumDiscs*4,"secondToLastRatioClosClusterR",100,0,5);
2271 
2272  createPlots(&secondToLastRatioTrackClusterP,kFgtNumDiscs*4,"secondToLastRatioTrackClusterP",100,0,5);
2273 
2274  createPlots(&secondToLastRatioTrackClusterR,kFgtNumDiscs*4,"secondToLastRatioTrackClusterR",100,0,5);
2275 
2276 
2277 
2278  createPlots(&APVfitChi2P,kFgtNumDiscs*40,"APVfitChi2P",100,0,30);
2279  createPlots(&APVfitChi2R,kFgtNumDiscs*40,"APVfitChi2R",100,0,30);
2280  createPlots(&APVfitAmpP,kFgtNumDiscs*40,"APVfitAmpP",100,0,30);
2281  createPlots(&APVfitAmpR,kFgtNumDiscs*40,"APVfitAmpR",100,0,30);
2282  createPlots(&APVfitT0P,kFgtNumDiscs*40,"APVfitT0P",100,0,30);
2283  createPlots(&APVfitT0R,kFgtNumDiscs*40,"APVfitT0R",100,0,30);
2284 
2285  createPlots(&APVfirstTbSigCloseClusterP,kFgtNumDiscs*40,"APVfirstTbSigCloseClusterP",100,0,20);
2286  createPlots(&APVfirstTbSigCloseClusterR,kFgtNumDiscs*40,"APVfirstTbSigCloseClusterR",100,0,20);
2287  createPlots(&APVmaxAdcCloseClusterP,kFgtNumDiscs*40,"APVmaxAdcCloseClusterP",100,0,5000);
2288  createPlots(&APVmaxAdcCloseClusterR,kFgtNumDiscs*40,"APVmaxAdcCloseClusterR",100,0,5000);
2289  createPlots(&APVmaxTbCloseClusterP,kFgtNumDiscs*40,"APVmaxTbCloseClusterP",8,0,7);
2290  createPlots(&APVmaxTbCloseClusterR,kFgtNumDiscs*40,"APVmaxTbCloseClusterR",8,0,7);
2291  createPlots(&APVnumFSigCloseClusterP,kFgtNumDiscs*40,"APVnumFSigCloseClusterP",9,0,8);
2292  createPlots(&APVnumFSigCloseClusterR,kFgtNumDiscs*40,"APVnumFSigCloseClusterR",9,0,8);
2293  createPlots(&APVnumFirstHighCloseClusterP,kFgtNumDiscs*40,"APVnumFirstHighCloseClusterP",8,0,7);
2294  createPlots(&APVnumFirstHighCloseClusterR,kFgtNumDiscs*40,"APVnumFirstHighCloseClusterR",8,0,7);
2295  createPlots(&APVmaxSigCloseClusterP,kFgtNumDiscs*40,"APVmaxSigCloseClusterP",100,1,200);
2296  createPlots(&APVmaxSigCloseClusterR,kFgtNumDiscs*40,"APVmaxSigCloseClusterR",100,1,200);
2297  createPlots(&APVsecondToLastRatioCloseClusterP,kFgtNumDiscs*40,"APVsecondToLastRatioCloseClusterP",100,0,5);
2298  createPlots(&APVsecondToLastRatioCloseClusterR,kFgtNumDiscs*40,"APVsecondToLastRatioCloseClusterR",100,0,5);
2299 
2300 
2301  //Joes plots
2302  createPlots(&clusterGeoId, kFgtNumDiscs,"clusterGeoId",32000,0,32000);
2303  createPlots(&clustersR, kFgtNumDiscs,"clustersR", 500, 0, 50);
2304  createPlots(&clustersP, kFgtNumDiscs,"clustersP", 100, -3.14159, 3.14159);
2305  //createPlots(&disk1QuadA, 22,"disk1QuadA",128,0,128);
2306  for (Int_t iii=0;iii< 22;iii++)
2307  {
2308  char buffer[100];
2309  sprintf(buffer, "%s_APV%d", "disk1QuadA_%s",iii,mFileName);
2310  disk1QuadA[iii]=new TH1I(buffer,buffer,128,0,128);
2311  }
2312 
2313  rEff=new TH1D*[kFgtNumDiscs];
2314  rNonEff=new TH1D*[kFgtNumDiscs];
2315  // cout <<"ave2" << endl;
2316 
2317  clusterSizeP=new TH1D*[kFgtNumDiscs*4];
2318  clusterSizeR=new TH1D*[kFgtNumDiscs*4];
2319  chargeCorr=new TH2D*[kFgtNumDiscs*4];
2320 
2321  h_clusterSizeR=new TH1D*[kFgtNumDiscs];
2322  h_clusterSizePhi=new TH1D*[kFgtNumDiscs];
2323 
2324  h_clusterChargeR=new TH1D*[kFgtNumDiscs];
2325  h_clusterChargePhi=new TH1D*[kFgtNumDiscs];
2326 
2327  sprintf(buffer,"ProjToIP_%s",mFileName);
2328  hIp=new TH2D(buffer,buffer,50,-100,100,50,0,10);
2329  sprintf(buffer,"hBx_%s",mFileName);
2330  hBx=new TH1D(buffer,buffer,50,-100,100);
2331  sprintf(buffer,"hBy_%s",mFileName);
2332  hBy=new TH1D(buffer,buffer,50,-100,100);
2333  sprintf(buffer,"hMx_%s",mFileName);
2334  hMx=new TH1D(buffer,buffer,50,-100,100);
2335  sprintf(buffer,"hMy_%s",mFileName);
2336  hMy=new TH1D(buffer,buffer,50,-0.1,0.1);
2337  sprintf(buffer,"IP_Z_%s",mFileName);
2338  hIpZ=new TH1D(buffer,buffer,50,-100,100);
2339 
2340  sprintf(buffer,"ipDCA_%s",mFileName);
2341  hIpDca=new TH1D(buffer,buffer,50,-100,100);
2342  sprintf(buffer,"z_Vtx_From_trk_fit_%s",mFileName);
2343  hTrkZ=new TH1D(buffer,buffer,50,-100,100);
2344  sprintf(buffer,"residua_%s",mFileName);
2345  hResidua=new TH1D(buffer,buffer,100,0,2);
2346  sprintf(buffer,"residuaX_%s",mFileName);
2347  hResiduaX=new TH2D(buffer,buffer,100,-10,10,200,0,1.0);
2348  sprintf(buffer,"residuaY_%s",mFileName);
2349  hResiduaY=new TH2D(buffer,buffer,100,-40,-20,200,0,1.0);
2350  sprintf(buffer,"residuaR_%s",mFileName);
2351  hResiduaR=new TH2D(buffer,buffer,100,12,32,200,0,1.0);
2352  sprintf(buffer,"residuaP_%s",mFileName);
2353  hResiduaP=new TH2D(buffer,buffer,100,0,0.8,200,0,1.0);
2354 
2355  sprintf(buffer,"chi2_%s",mFileName);
2356  hChi2=new TH1D(buffer,buffer,50,0,2);
2357  sprintf(buffer,"tpc_fgt_corr_%s",mFileName);
2358  tpcFgtZVertexCorr=new TH2D(buffer,buffer,100,-120,120,100,-120,120);
2359  sprintf(buffer,"tpc_fgt_corr2_%s",mFileName);
2360  tpcFgtZVertexCorr2=new TH2D(buffer,buffer,100,-120,120,100,-120,120);
2361  sprintf(buffer,"tpc_fgt_corr3_%s",mFileName);
2362  tpcFgtZVertexCorr3=new TH2D(buffer,buffer,50,-50,50,50,-50,50);
2363 
2364  sprintf(buffer,"tpc_fgt_diff%s",mFileName);
2365  tpcFgtZVtxDiff=new TH1D(buffer,buffer,1000,-50,50);
2366  sprintf(buffer,"tpc_fgt_diff2%s",mFileName);
2367  tpcFgtZVtxDiff2=new TH1D(buffer, buffer,1000,-50,50);
2368 
2369  for(int iD=0;iD<kFgtNumDiscs;iD++)
2370  {
2371 
2372  for(int iq=0;iq<4;iq++)
2373  {
2374  sprintf(buffer,"chargeCorrTracks_disk_%d_quad_%d_%s",iD,iq,mFileName);
2375  chargeCorrTracks[iD*4+iq]=new TH2D(buffer,buffer,200,0,10000,200,0,10000);
2376  sprintf(buffer,"chargeCorrTracksRCut_disk_%d_quad_%d_%s",iD,iq,mFileName);
2377  chargeCorrTracksRCut[iD*4+iq]=new TH2D(buffer,buffer,200,0,10000,200,0,10000);
2378  }
2379 
2380  sprintf(buffer,"radioTrackHits_%d_%s",iD,mFileName);
2381  radioPlotsTrackHits[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2382 
2383  sprintf(buffer,"trkPhiProj_%d_%s",iD,mFileName);
2384  trkPhiProj[iD]=new TH1D(buffer,buffer,100,-3.5,3.5);
2385 
2386  sprintf(buffer,"radioClusterChargeR_%d_%s",iD,mFileName);
2387  radioPlotsClusChargeR[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2388 
2389  sprintf(buffer,"radioClusterSizeR_%d_%s",iD,mFileName);
2390  radioPlotsClusSizeR[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2391 
2392  sprintf(buffer,"radioClusterChargeP_%d_%s",iD,mFileName);
2393  radioPlotsClusChargeP[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2394 
2395  sprintf(buffer,"radioClusterSizeP_%d_%s",iD,mFileName);
2396  radioPlotsClusSizeP[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2397 
2398  sprintf(buffer,"radioDiskEff_%d_%s",iD,mFileName);
2399  radioPlotsEff[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2400 
2401  sprintf(buffer,"radioDiskEffR_%d_%s",iD,mFileName);
2402  radioPlotsEffR[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2403 
2404  sprintf(buffer,"radioDiskEffPhi_%d_%s",iD,mFileName);
2405  radioPlotsEffPhi[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2406 
2407  sprintf(buffer,"radioDiskEffLoose_%d_%s",iD,mFileName);
2408  radioPlotsEffLoose[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2409  // cout <<"1" <<endl;
2410  sprintf(buffer,"rEff_%d_%s",iD,mFileName);
2411  rEff[iD]=new TH1D(buffer,buffer,100,0,DISK_DIM);
2412  sprintf(buffer,"rNonEff_%d_%s",iD,mFileName);
2413  rNonEff[iD]=new TH1D(buffer,buffer,100,0,DISK_DIM);
2414  sprintf(buffer,"clusterSizeR_Disk_%d_%s",iD,mFileName);
2415  h_clusterSizeR[iD]=new TH1D(buffer,buffer,20,0,20);
2416  h_clusterSizeR[iD]->SetFillColor(kYellow);
2417  sprintf(buffer,"clusterSizePhi_Disk_%d_%s",iD,mFileName);
2418  h_clusterSizePhi[iD]=new TH1D(buffer,buffer,20,0,20);
2419  h_clusterSizePhi[iD]->SetFillColor(kYellow);
2420  sprintf(buffer,"clusterChargeR_Disk_%d_%s",iD,mFileName);
2421  h_clusterChargeR[iD]=new TH1D(buffer,buffer,100,0,5000);
2422  h_clusterChargeR[iD]->SetFillColor(kYellow);
2423 
2424  sprintf(buffer,"clusterChargePhi_Disk_%d_%s",iD,mFileName);
2425  h_clusterChargePhi[iD]=new TH1D(buffer,buffer,100,0,5000);
2426  h_clusterChargePhi[iD]->SetFillColor(kYellow);
2427  // cout <<"2" <<endl;
2428  for(int nx=0;nx<radioPlotsEff[iD]->GetNbinsX();nx++)
2429  {
2430  for(int ny=0;ny<radioPlotsEff[iD]->GetNbinsY();ny++)
2431  {
2432  // radioPlotsEff[iD]->SetBinContent(nx,ny,0.1);//so that there is no divide by zero
2433  }
2434  }
2435  // cout <<"3" <<endl;
2436  for(int iq=0;iq<4;iq++)
2437  {
2438  sprintf(buffer,"r_phi_ChargeCorrelationInDisk_%d_quad_%d_%s",iD+1,iq,mFileName);
2439  chargeCorr[iD*4+iq]=new TH2D(buffer,buffer,200,0,70000,200,0,70000);
2440  sprintf(buffer,"clusterSizeRInDisk_%d_quad_%d_%s",iD+1,iq,mFileName);
2441  clusterSizeR[iD*4+iq]=new TH1D(buffer,buffer,100,0,100);
2442  sprintf(buffer,"clusterSizePInDisk_%d_quad_%d_%d",iD+1,iq,mFileName);
2443  clusterSizeP[iD*4+iq]=new TH1D(buffer,buffer,100,0,100);
2444  }
2445  sprintf(buffer,"radioDiskNonEff_%d_%s",iD,mFileName);
2446  radioPlotsNonEff[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2447  // cout <<" created non eff histo " << endl;
2448  sprintf(buffer,"radioDiskNonEffR_%d_%s",iD,mFileName);
2449  radioPlotsNonEffR[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2450  sprintf(buffer,"radioDiskNonEffPhi_%d_%s",iD,mFileName);
2451  radioPlotsNonEffPhi[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2452  sprintf(buffer,"radioDiskNonEffLoose_%d_%s",iD,mFileName);
2453  radioPlotsNonEffLoose[iD]=new TH2D(buffer,buffer,NUM_EFF_BIN,-DISK_DIM,DISK_DIM,NUM_EFF_BIN,-DISK_DIM,DISK_DIM);
2454  for(int nx=0;nx<rEff[iD]->GetNbinsX();nx++)
2455  {
2456  // rEff[iD]->SetBinContent(nx,0.1);
2457  }
2458  sprintf(buffer,"rPhiRatio_%d_%s",iD,mFileName);
2459  rPhiRatioPlots[iD]=new TH1D(buffer,buffer,100,-2,10);
2460  }
2461 
2462  return ierr;
2463 };
2464 ClassImp(StFgtStraightPlotter);
virtual TObject * Clone(const char *newname="") const
the custom implementation fo the TObject::Clone
Definition: TDataSet.cxx:308
pair< double, double > getDca(vector< AVTrack >::iterator it)
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237
void fillStripHistos(Float_t r, Float_t phi, Int_t iD, Int_t iq)
Double_t findClosestPoint(float mx, float bx, float my, float by, double xE, double yE, Int_t iD)
Short_t getQuadFromCoo(Double_t x, Double_t y)
this is too naive..., assumes non-rotated quads
Definition: Stypes.h:41