25 #include "TRootEmbeddedCanvas.h"
31 #include "TApplication.h"
53 if (plane != NULL )plane->
print();
65 Int_t nClBloc[2][100];
67 for(Int_t ndet = 0; ndet<2; ndet++){
69 for(Int_t i = 0; i<100; i++)
71 for(Int_t i = 0; i<
fSizeX; i++){
72 for(Int_t j = 0; j<
fSizeZ; j++){
79 Int_t nBloc = 0, nClBlocs = 0;
80 for(Int_t j=0;j<
fSizeZ;j++){
81 for(Int_t i=0;i<
fSizeX;i++){
85 nClBloc[ndet][nBloc] = nCl;
88 Info(
"process",
"nClBloc[%d][%d] = %d",ndet,nBloc,nClBloc[ndet][nBloc]);
91 if(nClBlocs >= nClTot)
break;
93 if(nClBlocs >= nClTot)
break;
97 for(Int_t j=0;j<
fSizeZ;j++){
98 for(Int_t i=0;i<
fSizeX;i++){
106 Int_t nPoints = clArray->GetEntries();
107 for(Int_t i = 0; i<nPoints; i++){
112 Double_t xSigma = cluster->
GetSig();
113 Double_t zSigma = cluster->
GetMean();
114 Double_t x = cluster->
GetX();
115 Double_t z = cluster->
GetZ();
116 Double_t q = cluster->
GetQ();
117 cluster->
SetSig(xSigma/q - x*x);
118 cluster->
SetMean(zSigma/q - z*z);
121 clArray->RemoveAt(i);
139 if(nCl < 0)
return 0;
141 Info(
"GroupClusters",
"%d %d %d %d",nBloc,i,j,nCl);
164 if(nCl < 0)
return 0;
168 Info(
"CollateClusters",
"%d %d %d %d",cluster->
GetPlane(),i,j,nCl);
169 Double_t x = cluster->
GetX();
170 Double_t z = cluster->
GetZ();
171 Double_t qTot = cluster->
GetQ();
172 Double_t xMean = x*qTot;
173 Double_t zMean = z*qTot;
174 Double_t qMax = cluster->
GetQmax();
175 Double_t xSigma = cluster->
GetSig();
176 Double_t zSigma = cluster->
GetMean();
178 Int_t imin = ifirst%
NADC;
179 Int_t jmin = ifirst/
NADC;
181 Int_t imax = width%
NADC;
182 Int_t jmax = width/
NADC;
185 for(Int_t i1 = -1; i1<2; i1++){
186 for(Int_t j1 = -1; j1<2; j1++){
187 if(i1 == j1 || i1 == -j1)
continue;
190 if(!cluster1)
continue;
191 Double_t x1 = cluster1->
GetX();
192 Double_t z1 = cluster1->
GetZ();
193 if(TMath::Abs(x1-x)>
fRebinX)
continue;
194 if(TMath::Abs(z1-z)>
fRebinZ)
continue;
196 Double_t q1 = cluster1->
GetQ();
198 Int_t imin1 = ifirst1%
NADC;
199 Int_t jmin1 = ifirst1/
NADC;
200 Int_t width1 = cluster1->
GetWidth();
201 Int_t imax1 = width1%
NADC;
202 Int_t jmax1 = width1/
NADC;
203 if(imin1<imin) imin = imin1;
204 if(jmin1<jmin) jmin = jmin1;
205 if(imax1>imax) imax = imax1;
206 if(jmax1>jmax) jmax = jmax1;
210 if(q1>qMax) qMax = q1;
211 xSigma += q1*cluster1->
GetSig();
212 zSigma += q1*cluster1->
GetMean();
213 clArray->Remove(cluster1);
217 cluster->
SetX(xMean/qTot);
218 cluster->
SetZ(zMean/qTot);
234 if ( m == NULL )
return 0;
237 Info(
"MakeClusters",
"%d",ndet);
245 Double_t xMean = 0, zMean = 0;
246 Double_t xSigma = 0, zSigma = 0;
247 Double_t qTot = 0, qMax = 0;
248 for(Int_t j2 = 0; j2<
fRebinX; j2++){
249 if(j + j2>=NCHAN)
break;
250 for(Int_t i2 = 0; i2<
fRebinZ; i2++){
251 if(i+i2>=NADC)
break;
252 Double_t q = m->
GetData(j+j2,i+i2);
253 if(q <= -1000)
continue;
257 zSigma += q*(i+i2)*(i+i2);
258 xSigma += q*(j+j2)*(j+j2);
262 if(qTot<=500)
continue;
267 xSigma -= xMean*xMean;
268 zSigma -= zMean*zMean;
271 HarpoRecoClusters *cl =
new HarpoRecoClusters(
BLOCCLUSTER,qTot,qMax,zSigma,i,xSigma,
fRebinZ,fRebinX,-1,ndet,0);
273 Info(
"MakeClusters",
"%d %g %g",ndet,xMean,zMean);
279 if(imax>=NADC) imax = NADC-1;
281 if(jmax>=NADC) jmax = NCHAN-1;
305 Long64_t rebinX = 10;
307 Info(
"Constructor",
"Use default RebinX %d",
fRebinX);
311 Long64_t rebinZ = 10;
313 Info(
"Constructor",
"Use default RebinZ %d",
fRebinZ);
317 Long64_t nMinBloc = 4;
319 Info(
"Constructor",
"Use default RebinZ %d",
fNminBlocs);
330 cout <<
"fSizeX = " <<
fSizeX << endl;
331 cout <<
"fSizeZ = " <<
fSizeZ << endl;
336 for(Int_t i = 0; i<
fSizeX; i++)
339 for(Int_t i = 0; i<
fSizeX; i++)
366 TCanvas* c = ecTab->GetCanvas();
367 c->GetPad(1)->Delete();
368 c->GetPad(2)->Delete();
372 for(Int_t plane = 0; plane<2;plane++){
373 TVirtualPad* cP = c->GetPad(plane+1);
375 TVirtualPad* cMaps = cP->GetPad(1);
379 TH2F* h =
new TH2F(
"h",
"",512,0,512,288,0,288);
380 for(Int_t i=1;i<
NADC;i++){
381 for(Int_t j=0;j<
NCHAN;j++){
383 h->SetBinContent(i+1,j+1,q);
394 TGraph* gAll =
new TGraph();
396 for(Int_t i = 0; i<10; i++) g[i] =
new TGraph();
398 Int_t nPoints = clArray->GetEntries();
400 for(Int_t i = 0; i<nPoints; i++){
402 if(cluster->
GetPlane()!=plane)
continue;
403 gAll->SetPoint(i,cluster->
GetZ(),cluster->
GetX());
405 Info(
"DisplayAnalysis",
"%d %g %g",plane,cluster->
GetZ(),cluster->
GetX());
407 if(iTr<0 || iTr>=10)
continue;
408 g[iTr]->SetPoint(g[iTr]->GetN(),cluster->
GetZ(),cluster->
GetX());
410 gAll->SetMarkerStyle(7);
412 for(Int_t i = 0; i<10; i++){
413 g[i]->SetMarkerStyle(6);
414 g[i]->SetMarkerColor(i+2);
429 UInt_t ysize = 9*ysize2;
430 TGTransientFrame*
main =
new TGTransientFrame(gClient->GetRoot(), fMain, xsize, ysize);
431 main->Connect(
"CloseWindow()",
"HarpoRecoMonitorGui", main,
"CloseWindow()");
432 main->DontCallClose();
435 main->SetCleanup(kDeepCleanup);
437 TGVerticalFrame* f213 =
new TGVerticalFrame(main,xsize,ysize,kVerticalFrame);
438 TGLabel* fLabel =
new TGLabel(f213,
"Clustering 2D blocs");
440 TGHorizontalFrame* rebinXFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
441 TGLabel* rebinXLabel =
new TGLabel(rebinXFrame,
"X size");
445 TGHorizontalFrame* rebinZFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
446 TGLabel* rebinZLabel =
new TGLabel(rebinZFrame,
"Z size");
450 TGHorizontalFrame* nMinBlocsFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
451 TGLabel* nMinBlocsLabel =
new TGLabel(nMinBlocsFrame,
"WmaxCl");
458 TGTextButton* setConf =
new TGTextButton(f213,
"Save Config",
id);
459 setConf->Associate(fMain);
461 TGLayoutHints* fLayout1 =
new TGLayoutHints(kLHintsLeft ,5,5,5,5);
462 TGLayoutHints* fLayout2 =
new TGLayoutHints(kLHintsRight ,5,5,5,5);
463 TGLayoutHints* fLayout3 =
new TGLayoutHints(kLHintsTop | kLHintsExpandX ,5,5,5,5);
464 TGLayoutHints* fLayout4 =
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5);
466 main->AddFrame(f213,fLayout4);
467 f213->AddFrame(fLabel,fLayout3);
469 f213->AddFrame(rebinXFrame,fLayout3);
470 rebinXFrame->AddFrame(rebinXLabel,fLayout1);
473 f213->AddFrame(rebinZFrame,fLayout3);
474 rebinZFrame->AddFrame(rebinZLabel,fLayout1);
477 f213->AddFrame(nMinBlocsFrame,fLayout3);
478 nMinBlocsFrame->AddFrame(nMinBlocsLabel,fLayout1);
481 f213->AddFrame(setConf,fLayout3);
484 main->MapSubwindows();
494 Info(
"SetConfig",
"Renewing configuration");
506 for(Int_t i = 0; i<
fSizeX; i++)
514 for(Int_t i = 0; i<
fSizeX; i++)
517 for(Int_t i = 0; i<
fSizeX; i++)
Int_t GroupClusters(Int_t nBloc, Int_t i, Int_t j, TClonesArray *clArray)
Redefine empty default.
HarpoRecoEvent * GetRecoEvent()
void SetIdClusterTrack(Int_t val)
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
int main(int argc, char **argv)
Dummy analysis to run as test and example. Give basic histograms of the data.
void DisplayAnalysis(TRootEmbeddedCanvas *ecTab, TGListBox *infobox)
void AddClusters(HarpoRecoClusters *val)
void RemoveAllClusterTrack()
Cluster object, containing position, charge and quality information.
TFile * OpenHistFile(const char *ananame)
Int_t MakeClusters(Int_t ndet)
void Save(char *mode=NULL)
void ConfigFrame(TGMainFrame *fMain, Int_t id)
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
TGNumberEntry * fChooseRebinX
TVirtualPad * MakeNiceHisto(TH1 *hist, TVirtualPad *c1, const char *opt, Bool_t copy)
Int_t GetIdClusterTrack()
void ResetClustersArray()
void SetSig(Double_t val)
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
TGNumberEntry * fChooseNminBlocs
void print()
Overloaded method which do all job.
HarpoEventHeader * GetHeader()
HarpoRecoClusters * CollateClusters(Int_t iCl, Int_t i, Int_t j, TClonesArray *clArray)
const ULong_t gkNDetectors
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
void SetIfirst(Int_t val)
TGNumberEntry * fChooseRebinZ
void SetMean(Double_t val)
TClonesArray * GetClustersArray()