FEDRA emulsion software from the OPERA Collaboration
ShowRec_Alg_CL.cpp File Reference
This graph shows which files directly or indirectly include this file:

Functions

Int_t Reco_CL_AssignZValueToGroup (Double_t z, Double_t z0, Int_t NGroupedPLATES, Int_t PLATESPerGroup)
 
void Reco_CL_BuildGlobalHistogramsOnHeap ()
 
void ReconstructShowers_CL ()
 

Function Documentation

◆ Reco_CL_AssignZValueToGroup()

Int_t Reco_CL_AssignZValueToGroup ( Double_t  z,
Double_t  z0,
Int_t  NGroupedPLATES,
Int_t  PLATESPerGroup 
)
516 {
517  // z: Position of BT to be checked,
518  // z0: ZStart if for example FIRSTPLATE z=3900 (PLATE 4) instead of 0
519  Int_t actplate=(Int_t)(z-z0)/1300+1;
520  Int_t actgroup=(actplate-1)/PLATESPerGroup;
521  // cout << "z z0 actplate "<< z << " " << z0 << " " <<actplate << endl;
522  // cout << "actplate actgroup "<< actplate << " " << actgroup << endl;
523  //This Assignment seems ok.
524  return actgroup;
525 }
brick z0
Definition: RecDispMC.C:106

◆ Reco_CL_BuildGlobalHistogramsOnHeap()

void Reco_CL_BuildGlobalHistogramsOnHeap ( )
528 {
529  TString HistoNameTitle="XXX";
530  for (Int_t h=0; h<50; h++) {
531  // cout << "Creating Hist2DimOnlyBG_Groupe_ " << h << endl;
532  HistoNameTitle=TString(Form("Hist2DimOnlyBG_Groupe_%d",h));
533  Hist2DimOnlyBGOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
534  // cout << "Creating Hist2DimOnlySimOneEvent_Groupe_ " << h << endl;
535  HistoNameTitle=TString(Form("Hist2DimOnlySimOneEvent_Groupe_%d",h));
536  Hist2DimOnlySimOneEventOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
537  // cout << "Creating Hist2DimBGAndSimOneEvent_Groupe_ " << h << endl;
538  HistoNameTitle=TString(Form("Hist2DimBGAndSimOneEvent_Groupe_%d",h));
539  Hist2DimBGAndSimOneEventOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
540  }
541  return;
542 }
TH2F * Hist2DimOnlyBGOneGroupedPlate[50]
Definition: ShowRec.h:350
TH2F * Hist2DimOnlySimOneEventOneGroupedPlate[50]
Definition: ShowRec.h:351
TH2F * Hist2DimBGAndSimOneEventOneGroupedPlate[50]
Definition: ShowRec.h:352

◆ ReconstructShowers_CL()

void ReconstructShowers_CL ( )

=== DEBUG===

===END DEBUG===

===DEBUG===

====== DEBUG===

===END DEBUG===

if (sa->X()<LeftX || sa->X()>RightX || sa->Y()<LeftY || sa->Y()>RightY) continue; /// DEBUG

–val_tan; // Project the last on beack to its owns


==== Now loop over the Grouped plates and search for spectrum peaks in each groupedPlate...

Set the bin arrays for the Spectrum...


Fit each grouped Plate with Spectrum...


.------------—

Fill interimSpectrum For Drawing... without the THRESHOLD_SMOOTHED_DEST Cut to find Maximum

Fill interimSpectrum For Drawing...only when Entry is > THRESHOLD_SMOOTHED_DEST * Maximum THRESHOLD_SMOOTHED_DEST is in % Units of Maxium...

end of loop over the Grouped plates

3 {
4  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_CL() ---");
5 
6  //-----------------------------------------------------------------
7  // Main function for reconstruction of "CLuster" Algorithm
8  //-----------------------------------------------------------------
9  //
10  // For each InitiatorBT this is
11  // divided in several small parts:
12  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
13  // 3) Loop over (whole) local_gAli, check BT for Cuts
14  // 4) Calculate pur/eff/NBT numbers
15  // 5) Fill Trees
16  //-----------------------------------
17 
18  //-----------------------------------
19  // 0) Predefinitions
20  //-----------------------------------
21 
22  // Set ClusterBoxSize of X,Y in microns: (f.e. 50x50)
23  Float_t BOXSIZE=50;
24  Float_t ClusterBoxSizeX=BOXSIZE;
25  Float_t ClusterBoxSizeY=ClusterBoxSizeX;
26  Float_t ClusterBoxSize[]= {ClusterBoxSizeX,ClusterBoxSizeY};
27 
28  // Set GLOBAL Boundaries of the BrickSize, depends on your MC Simulation and on your scanned BG size
29  // Later we will set the frame size, which can be f.e. 1mmX1mm, 3mmX3mm ...
30  // This does not need to be changed...
31  Float_t LeftX=-11000;
32  Float_t RightX=21000;
33  Float_t LeftY=-11000;
34  Float_t RightY=16000;
35 
36  cout << " ......."<<endl;
37  // Set SquareSize of The gAliSub -> Coorseponds to the totral scan Area:
38  Float_t VIEWSIZE=1000;
39  Float_t gAliSub_Length_X=VIEWSIZE;
40  Float_t gAliSub_Length_Y=VIEWSIZE; //1mm
41 
42  // Calculate how many NbinsX,Y are needed:
43  Int_t NbinsX=Int_t((RightX-LeftX)/ClusterBoxSizeX);
44  Int_t NbinsY=Int_t((RightY-LeftY)/ClusterBoxSizeY);
45 
46 
47  cout << " ......."<<endl;
48 
49  Int_t NPLATES=GLOBAL_gAli->Npatterns();
50  Int_t NbinsZ=NPLATES;
51 
52  // Calculate how many NbinsX,Y are needed:
53  Int_t NbinsX_gAliSub=Int_t((gAliSub_Length_X)/ClusterBoxSizeX);
54  Int_t NbinsY_gAliSub=Int_t((gAliSub_Length_Y)/ClusterBoxSizeY);
55 
56  // Arrays for the Spectrum source and dests...
57  // Float_t ** source = new float *[NbinsX];
58  Double_t ** source = new double *[NbinsX];
59  for (Int_t cnti=0; cnti<NbinsX; cnti++) {
60  // source[cnti]=new float[NbinsY];
61  source[cnti]=new double[NbinsY];
62  }
63  // Float_t ** dest = new float *[NbinsX];
64  Double_t ** dest = new double *[NbinsX];
65  for (Int_t cnti=0; cnti<NbinsX; cnti++) {
66  // dest[cnti]=new float[NbinsY];
67  dest[cnti]=new double[NbinsY];
68  }
69 
70  // Arrays for the Spectrum source and dests...
71  // Unused ??? Not to be found in any other part of the code ...
72  // Comment out!
73  /*
74  Float_t ** source_gAliSub = new float *[NbinsX_gAliSub];
75  for (Int_t cnti=0; cnti<NbinsX_gAliSub; cnti++) {
76  source_gAliSub[cnti]=new float[NbinsY_gAliSub];
77  }
78  Float_t ** dest_gAliSub = new float *[NbinsX_gAliSub];
79  for (Int_t cnti=0; cnti<NbinsX_gAliSub; cnti++) {
80  dest_gAliSub[cnti]=new float[NbinsY_gAliSub];
81  }
82  */
83 
84  // Fill Extrapolated BT with direction into next plate?
85  Bool_t FillTANData=kTRUE;
86  cout << " ......."<<endl;
87 
88  // Plates to be grouped Together:
89  Int_t PLATESPERGROUP=1;
90  Int_t FIRSTPLATE=0;
91  Int_t LASTPLATE=0;
92  Int_t MAXPLATE=GLOBAL_gAli->Npatterns()-1;
93  Int_t NGroupedPLATES=ceil( (Double_t)NPLATES/(Double_t)PLATESPERGROUP);
94 
95  // Spectrum Position Peaks
96  Float_t* fPositionX;
97  Float_t* fPositionY;
98  Int_t fNPeaks;
99 
100  // Start Position...
101  Float_t StartPosX,StartPosY,StartPosTX,StartPosTY;
102 
103  // Calculate the z-positions for the grouped plates:
104  Float_t ZPosGroupedPlates[50];
106  cout << "gAli->GetPattern(firstplate)->GetSegment(0)->Z; "<<GLOBAL_gAli->GetPattern(0)->Z()<<endl;
107  cout << "gAli->GetPattern(lastplate)->GetSegment(0)->Z; "<<GLOBAL_gAli->GetPattern(GLOBAL_gAli->Npatterns()-1)->Z()<<endl;
109 
110  for (Int_t i=0; i<NGroupedPLATES; i++) {
111  ZPosGroupedPlates[i]=GLOBAL_gAli->GetPattern(0)->Z()+PLATESPERGROUP*1300*i;
113  cout << "i PLATESPERGROUP NGroupedPLATES ZPosGroupedPlates[i] " << i << " " << PLATESPERGROUP << " " << NGroupedPLATES << " " << ZPosGroupedPlates[i] << " " << endl;
114  }
115 
117  if (gEDBDEBUGLEVEL==2) {
118  cout << "NbinsX = " << NbinsX << endl;
119  cout << "NbinsY = " << NbinsY << endl;
120  cout << "NbinsZ = " << NbinsZ << endl;
121  cout << "NbinsX_gAliSub = " << NbinsX_gAliSub << endl;
122  cout << "NbinsY_gAliSub = " << NbinsY_gAliSub << endl;
123  cout << "FIRSTPLATE= "<<FIRSTPLATE<<endl;
124  cout << "LASTPLATE= "<<LASTPLATE<<endl;
125  cout << "MAXPLATE= "<<MAXPLATE<<endl;
126  cout << "NPLATES= "<<NPLATES<<endl;
127  cout << "NGroupedPLATES= "<<NGroupedPLATES<<endl;
128  cout << "PLATESPERGROUP= "<<PLATESPERGROUP<<endl;
129  }
131 
132  //=========================================
133  // Create the 2Dim Histograms:
135  // Create the 2Dim Histograms:
136  Hist2DimOnlyBGAllPlates= new TH2F();
139  // Create the 3Dim Histograms:
140  Hist3DimOnlyBG = new TH3F();
141  Hist3DimRecoEvent_gAli = new TH3F();
142  //=========================================
143  // Allocate TSectrum2 pointer on the heap, and try to speed up program....
144  spectrum2dim= new TSpectrum2();
145  spectrum2dim->Print();
146  //=========================================
147 
148 
149  // Define Helper Variables:
150  EdbPVRec* local_gAli;
151  EdbSegP* InBT;
152  EdbSegP* seg;
153  Float_t local_gAli_pat_interim_halfsize=0;
154 
157  cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
158 
159  TClonesArray *as;
160  EdbSegP *sa;
161  EdbPattern *as_pattern;
162  EdbPattern *as_pattern_sub;
163 
164 
165  //-----------------------------------------------------------------
166  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
167  // We use the descending loop to begin with BT with lowest z first.
168  // for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
169  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=GLOBAL_InBTArrayEntries-1; --i) {
170 
171  //-----------------------------------
172  // CounterOutPut
173  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
174  if (gEDBDEBUGLEVEL==1) {
175  int modulo=GLOBAL_InBTArrayEntries/20;
176  if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
177  }
178  //-----------------------------------
179 
180  //-----------------------------------
181  // Get InitiatorBT from GLOBAL_InBTArray
182  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
183  //--------
184  GLOBAL_InBT_E=InBT->P();
185  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
186  GLOBAL_InBT_Flag=InBT->Flag();
187  GLOBAL_InBT_MC=InBT->MCEvt();
188  //--------
189  Int_t local_NBT=0;
190  Int_t local_NBTMC=0;
191  Int_t local_NBTallMC=0;
192  Int_t local_NBTeMC=0;
193  float_t local_pure=-1;
194  float_t local_purall=-1;
195  Int_t npat_int=0;
196  Int_t npat_total=0;
197  Int_t npatN=0;
198  Int_t npat_Neff=0;
199  Int_t NBT_Neff=0;
200  Int_t NBTMC_Neff=0;
201  Int_t NBTMCe_Neff=0;
202  //--------
203 
204  if (gEDBDEBUGLEVEL>2) {
205  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
206  InBT->PrintNice();
207  }
208  //-----------------------------------
209 
210  //-----------------------------------
211  // 1) Make local_gAli with cut parameters:
212  //-----------------------------------
213  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
214  // Add InBT to GLOBAL_ShowerSegArray
215  GLOBAL_ShowerSegArray -> Add(InBT);
216  //-----------------------------------
217 
218  //-----------------------------------
219  // 1a) Set Some Variables
220  //-----------------------------------
221  StartPosX=InBT->X();
222  StartPosY=InBT->Y();
223  StartPosTX=InBT->TX();
224  StartPosTY=InBT->TY();
225  //-----------------------------------
226 
227  //-----------------------------------
228  // 1b) Now SetBins for the 2D, 3D Histograms for THIS (specific) Event
229  //-----------------------------------
230 
231  cout << "Reset now some other histos"<<endl;
232  for (Int_t h=0; h<50; h++) {
233  Hist2DimOnlyBGOneGroupedPlate[h]->Reset();
236  }
237 
238  cout << "Reset now some other SetNameTitle "<<endl;
239  Hist2DimOnlyBGAllPlates->SetNameTitle("Hist2DimOnlyBGAllPlates","Hist2DimOnlyBGAllPlates");
240  Hist2DimOnlySimOneEventAllPlates->SetNameTitle("Hist2DimOnlySimOneEventAllPlates","Hist2DimOnlySimOneEventAllPlates");
241  Hist2DimBGAndSimOneEventAllPlates->SetNameTitle("Hist2DimBGAndSimOneEventAllPlates","Hist2DimBGAndSimOneEventAllPlates");
242  Hist2DimOnlyBGAllPlates->SetBins( NbinsX_gAliSub, StartPosX-gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY-gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0);
243  Hist2DimOnlySimOneEventAllPlates->SetBins( NbinsX_gAliSub, StartPosX-gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY-gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0);
244  Hist2DimBGAndSimOneEventAllPlates->SetBins( NbinsX_gAliSub, StartPosX-gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY-gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0);
245 
246  cout << "Reset now some other SetNameTitle "<<endl;
247  Hist3DimOnlyBG->SetNameTitle("Hist3DimOnlyBG","Hist3DimOnlyBG");
248  Hist3DimOnlyBG->SetBins( NbinsX_gAliSub, StartPosX -gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY -gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0, NGroupedPLATES, (FIRSTPLATE-1)*1300, NbinsZ*1300);
249  Hist3DimRecoEvent_gAli->SetNameTitle("Hist3DimRecoEvent_gAli","Hist3DimRecoEvent_gAli");
250  Hist3DimRecoEvent_gAli->SetBins( NbinsX, LeftX, RightX, NbinsY, LeftY, RightY, NGroupedPLATES, (FIRSTPLATE-1)*1300, (LASTPLATE)*1300);
251 
252  cout << "Reset now some other SetNameTitle "<<endl;
253  Hist2DimOnlyBGAllPlates->Reset();
256  Hist3DimOnlyBG->Reset();
257  Hist3DimRecoEvent_gAli->Reset();
258 
259  //-----------------------------------
260  // 1c) Define the Histograms Bounds and Bins,
261  // 1c) Since Bounds are depending on h ...
262  //-----------------------------------
263  Float_t InBT_X=InBT->X();
264  Float_t InBT_TX=InBT->TX();
265  Float_t InBT_X_Extrapolated;
266  Float_t InBT_Y=InBT->Y();
267  Float_t InBT_TY=InBT->TY();
268  Float_t InBT_Y_Extrapolated;
269  Float_t InBT_Z=InBT->Z();
270  for (Int_t h=0; h<NGroupedPLATES; h++) {
271  //cout << "--------------------"<<endl;
272  Float_t zdiff=ZPosGroupedPlates[h]-InBT_Z;
273  InBT_X_Extrapolated=InBT_X+InBT_TX*zdiff;
274  InBT_Y_Extrapolated=InBT_Y+InBT_TY*zdiff;
275  cout << "h InBT_X InBT_TX InBT_Z ZPosGroupedPlates[h] zdiff InBT_X_Extrapolated " << h << " " << InBT_X << " " << InBT_TX << " " << InBT_Z << " " << ZPosGroupedPlates[h] << " " << zdiff << " " <<InBT_X_Extrapolated << endl;
276  cout << "h InBT_Y InBT_TY InBT_Z ZPosGroupedPlates[h] zdiff InBT_Y_Extrapolated " << h << " " << InBT_Y << " " << InBT_TY << " " << InBT_Z << " " << ZPosGroupedPlates[h] << " " << zdiff << " " <<InBT_Y_Extrapolated << endl;
277  Hist2DimOnlyBGOneGroupedPlate[h]->SetBins(NbinsX_gAliSub, InBT_X_Extrapolated-gAliSub_Length_X/2.0,InBT_X_Extrapolated+gAliSub_Length_X/2.0, NbinsY_gAliSub,InBT_Y_Extrapolated-gAliSub_Length_Y/2.0,InBT_Y_Extrapolated+gAliSub_Length_Y/2.0);
278  Hist2DimOnlySimOneEventOneGroupedPlate[h]->SetBins(NbinsX_gAliSub, InBT_X_Extrapolated-gAliSub_Length_X/2.0,InBT_X_Extrapolated+gAliSub_Length_X/2.0, NbinsY_gAliSub,InBT_Y_Extrapolated-gAliSub_Length_Y/2.0,InBT_Y_Extrapolated+gAliSub_Length_Y/2.0);
279  Hist2DimBGAndSimOneEventOneGroupedPlate[h]->SetBins(NbinsX_gAliSub, InBT_X_Extrapolated-gAliSub_Length_X/2.0,InBT_X_Extrapolated+gAliSub_Length_X/2.0, NbinsY_gAliSub,InBT_Y_Extrapolated-gAliSub_Length_Y/2.0,InBT_Y_Extrapolated+gAliSub_Length_Y/2.0);
280  }
281  //=========================================
282 
283 
284 
285  //-----------------------------------
286  // 1c) Loop over (whole) local_gAli, Fill the Histograms (from firstplate up to lastplate)
287  //-----------------------------------
288  Int_t val, val_tan;
289  Int_t local_gAli_npat=local_gAli->Npatterns();
290  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
291 
292  // Loop over all plates of local_gAli, since this is already
293  // extracted with the right numbers of plates...
294  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
295  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
296 
297  as = (TClonesArray*)local_gAli->GetPattern(patterloop_cnt)->GetSegments();
298  as_pattern= (EdbPattern*)local_gAli->GetPattern(patterloop_cnt);
299 
300  cout << "===DEBUG patterloop_cnt= " << patterloop_cnt << " Z pos (k) " << local_gAli->GetPattern(patterloop_cnt)->Z() << endl; // get Z pos of the plate k
301  cout << "===DEBUG (patterloop_cnt) EdbSegments in the Pattern (total): " << as->GetEntries() << endl;
302 
303  for (Int_t h=0; h<as->GetEntries(); h++) {
304  sa = (EdbSegP*)( as->At(h) );
306  val=Reco_CL_AssignZValueToGroup(sa->Z(), ZPosGroupedPlates[0], NGroupedPLATES, PLATESPERGROUP);
307  cout << "entry, val "<<h << " " << val<<endl;
308  Hist2DimBGAndSimOneEventOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
309  if (sa->MCEvt()<0) Hist2DimOnlyBGOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
310  if (FillTANData) {
311  val_tan=Reco_CL_AssignZValueToGroup(sa->Z()+1300, ZPosGroupedPlates[0], NGroupedPLATES, PLATESPERGROUP);
312  cout << "(TAN) entry, val_tan "<<h << " " << val_tan<<endl;
313  if (val_tan>=NGroupedPLATES) {
315  ++val_tan; // Project the last on beack to its owns
316  cout << "(TAN) val_tan changed to "<<h << " " << val_tan<<endl;
317  }
318  Hist2DimBGAndSimOneEventOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
319  if (sa->MCEvt()<0) Hist2DimOnlyBGOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
320  }
321  if (sa->MCEvt()<0) continue;
322  if (sa->MCEvt()!=GLOBAL_InBT_MC) continue;
323  cout << "=== ==DEBUG Filling i with MCEvt "<< i <<"("<< GLOBAL_InBT_MC <<") X,Y,Z: "<<sa->X()<<" "<<sa->Y()<<" "<<sa->Z()<<" "<<sa->MCEvt()<< " to val= " <<val <<endl;
324  Hist2DimOnlySimOneEventOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
325  if (FillTANData) {
326  Hist2DimOnlySimOneEventOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
327  }
328  }
329 
330  } //of Loop over all plates of local_gAli,
331 
332 
333  cout<<endl<<endl;
334  cout <<"Loop over the Grouped plates and search for spectrum peaks in each groupedPlate."<<endl;
337  for (Int_t h=0; h<NGroupedPLATES; h++) {
338 
340  for (Int_t cnti = 0; cnti < NbinsX_gAliSub; cnti++) {
341  for (Int_t cntj = 0; cntj < NbinsY_gAliSub; cntj++) {
342  source[cnti][cntj] = 0; // Reset source before filling it new...
343  dest[cnti][cntj] = 0; // Reset dest before filling it new...
344  source[cnti][cntj] = Hist2DimBGAndSimOneEventOneGroupedPlate[h]->GetBinContent(cnti + 1,cntj + 1);
345  }
346  }
349  Int_t nfound=0;
350  cout << " Do now peak search..."<<endl;
351  nfound = spectrum2dim->SearchHighRes(source, dest, NbinsX_gAliSub, NbinsY_gAliSub, 2, 20, kTRUE, 10, kFALSE, 5);// TO BE OPTIMIZED...
352  cout << " Peak search finished. Go on."<<endl;
355  spectrum_interim->Reset();
357  Int_t interimsbin=0;
358  TAxis *xax;
359  TAxis *yax;
360  TAxis *zax;
361  Double_t xax_bin_value;
362  Double_t yax_bin_value;
363  Double_t zax_bin_value;
364  Double_t value;
365 
367  for (Int_t ii = 0; ii < NbinsX_gAliSub; ii++) {
368  for (Int_t jj = 0; jj < NbinsY_gAliSub; jj++) {
369  value=dest[ii][jj];
370  spectrum_interim->SetBinContent(ii + 1,jj + 1, value);
371  }
372  }
373  Float_t THRESHOLD_SMOOTHED_DEST=0.5;
374  cout << "THRESHOLD_SMOOTHED_DEST spectrum_interim->GetMaximum() : " << THRESHOLD_SMOOTHED_DEST << " " << spectrum_interim->GetMaximum()<< endl;
375  cout << "----------_"<<endl;
376 
377  Double_t spec_int_maximum=spectrum_interim->GetMaximum();
378 
381  for (Int_t ii = 0; ii < NbinsX_gAliSub; ii++) {
382  for (Int_t jj = 0; jj < NbinsY_gAliSub; jj++) {
383  // cout << " h ii jj THRESHOLD_SMOOTHED_DEST dest[ii][jj] "<< h << " " << ii << " " << jj << " " << THRESHOLD_SMOOTHED_DEST << " " << dest[ii][jj] << endl;
384  if (dest[ii][jj]<THRESHOLD_SMOOTHED_DEST*spec_int_maximum) continue;
385  value=dest[ii][jj];
386  spectrum_interim->SetBinContent(ii + 1,jj + 1, value);
387  xax_bin_value=spectrum_interim->GetXaxis()->GetBinCenter(ii + 1);
388  yax_bin_value=spectrum_interim->GetYaxis()->GetBinCenter(jj + 1);
389  zax_bin_value=ZPosGroupedPlates[h];
390  // cout <<" xax_bin ii jj (xyz) value "<< xax_bin_value << " " << ii << " " << jj<< " " <<xax_bin_value << " " << yax_bin_value<< " " << zax_bin_value<<" " << value << endl;
391  Hist3DimRecoEvent_gAli->Fill(xax_bin_value,yax_bin_value,zax_bin_value, value);
392  }
393  }
394  cout << "THRESHOLD_SMOOTHED_DEST spectrum_interim->GetMaximum() : " << THRESHOLD_SMOOTHED_DEST << " " << spectrum_interim->GetMaximum()<< endl;
395  cout << "----------_"<<endl;
396 
397  //AllGroupsSimPlusBGittedSpectrum->cd(h+1);
398  //spectrum_interim->DrawCopy("colz");
399  }
402 
403 
404 
405 
406 
407  return;
408 
409  //-----------------------------------
410  // 2) Loop over (whole) local_gAli, check BT for Cuts
411  //-----------------------------------
412  // Int_t local_gAli_npat=local_gAli->Npatterns();
413  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
414 
415  // Loop over all plates of local_gAli, since this is already
416  // extracted with the right numbers of plates...
417  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
418  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
419 
420  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
421  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
422  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
423 
424  // Now apply cut conditions: CT ConeTube Alg --------------------
425  if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
426  if (!FindPrecedingBTs(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
427  // end of cut conditions: CT ConeTube Alg --------------------
428 
429  // If we arrive here, Basetrack seg has passed criteria
430  // and is then added to the shower array:
431  // Check if its not the InBT which is already added:
432  if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
433  ; // do nothing;
434  }
435  else {
436  GLOBAL_ShowerSegArray -> Add(seg);
437  }
438  }
439  // Calc BT density around shower:
440  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
441  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
442 
443  // Calc TrackNumbers for plate for efficency numbers:
444  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
445  }
446  // end of loop over all plates of local_gAli
448 
449  //-----------------------------------
450  // 4) Calculate pur/eff/NBT numbers,
451  // not needed when only reconstruction
452  // done:
453  //-----------------------------------
454  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
455  Int_t NBT=0;
456  Int_t NBTMC=0;
457  Int_t NBTallMC=0;
458  Int_t NBTeMC=0;
459  Double_t eff, purall, pure;
460  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
461 
462  // Fill only for MC Event:
463  if (GLOBAL_InBT_MC>0) {
468  }
470  }
471 
472 
473  //-----------------------------------
474  // 5) Fill Tree:
475  //-----------------------------------
476  TREE_ShowRecEff->Fill();
477  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
478 
479 
480  //-----------------------------------
481  // 6a) Transfer ShowerArray to treebranchTreeEntry:
482  //-----------------------------------
483  if (cmd_OUTPUTLEVEL>0) {
485  }
486 
487 
488  //------------------------------------
489  // Reset and delete important things:
490  // also to avoid memory problems ...
491  //-----------------------------------
492  GLOBAL_ShowerSegArray->Clear();
493  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
494  delete local_gAli;
495  local_gAli=0;
497  //------------------------------------
498  }
499  // end of loop over GLOBAL_InBTArrayEntries
500  //-----------------------------------------------------------------
501 
502  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
503  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
504  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
505 
506 
507  return;
508 }
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
void Reco_CL_BuildGlobalHistogramsOnHeap()
Definition: ShowRec_Alg_CL.cpp:527
Int_t Reco_CL_AssignZValueToGroup(Double_t z, Double_t z0, Int_t NGroupedPLATES, Int_t PLATESPerGroup)
Definition: ShowRec_Alg_CL.cpp:515
void CalcTrackDensity(EdbPattern *pat_interim, Float_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
Definition: ShowRec.cpp:8749
void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree(TTree *treebranchtree, TObjArray *segarray)
Definition: ShowRec.cpp:7940
EdbPVRec * TransformEdbPVRec(EdbPVRec *gAli, EdbSegP *InitiatorBT)
DEBUG OPENMP TEST!!!!!!!
Definition: ShowRec.cpp:6299
Bool_t GetConeOrTubeDistanceToInBT(EdbSegP *sa, EdbSegP *InBT, Double_t CylinderRadius, Double_t ConeAngle)
Definition: ShowRec.cpp:6990
void CalcEffPurOfShower2(TObjArray *arr, Int_t &NBT, Int_t &NBTMC, Int_t &NBTallMC, Int_t &NBTeMC, Double_t &purall, Double_t &pure, Int_t NBT_Neff, Int_t NBTMC_Neff, Int_t NBTMCe_Neff)
Definition: ShowRec.cpp:7631
void PrintShowerObjectArray(TObjArray *segarray)
Definition: ShowRec.cpp:6967
Bool_t FindPrecedingBTs(EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
Definition: ShowRec.cpp:6764
void CalcEfficencyNumbers(EdbPattern *pat_interim, Int_t MCCheck, Int_t &NBT_Neff, Int_t &NBTMC_Neff, Int_t &NBTMCe_Neff)
Definition: ShowRec.cpp:8771
TH2F * spectrum_interim
Definition: ShowRec.h:358
Int_t GLOBAL_INBTSHOWERNR
Definition: ShowRec.h:80
Double_t GLOBAL_trckdens
Definition: ShowRec.h:39
EdbPVRec * GLOBAL_gAli
Definition: ShowRec.h:73
TH3F * Hist3DimRecoEvent_gAli
Definition: ShowRec.h:354
Int_t cmd_OUTPUTLEVEL
Definition: ShowRec.h:33
TH3F * Hist3DimOnlyBG
Definition: ShowRec.h:353
TH2F * Hist2DimBGAndSimOneEventAllPlates
Definition: ShowRec.h:349
Int_t GLOBAL_EvtBT_FlagArray[99999]
Definition: ShowRec.h:51
TObjArray * GLOBAL_ShowerSegArray
Definition: ShowRec.h:76
Int_t GLOBAL_InBT_MC
Definition: ShowRec.h:43
TH2F * Hist2DimOnlyBGAllPlates
Definition: ShowRec.h:347
Double_t GLOBAL_EvtBT_EArray[99999]
Definition: ShowRec.h:52
TH2F * Hist2DimOnlySimOneEventAllPlates
Definition: ShowRec.h:348
Int_t GLOBAL_EvtBT_MCArray[99999]
Definition: ShowRec.h:51
TTree * TREE_ShowRecEff
Definition: ShowRec.h:62
Float_t shower_trackdensb
Definition: ShowRec.h:395
Int_t GLOBAL_InBT_Flag
Definition: ShowRec.h:43
Double_t GLOBAL_EvtBT_E
Definition: ShowRec.h:50
Double_t GLOBAL_InBT_TanTheta
Definition: ShowRec.h:44
Double_t GLOBAL_InBT_E
Definition: ShowRec.h:44
Double_t CUT_PARAMETER[10]
Definition: ShowRec.h:78
Int_t GLOBAL_EvtBT_MC
Definition: ShowRec.h:49
Int_t GLOBAL_InBTArrayEntries
Definition: ShowRec.h:75
TSpectrum2 * spectrum2dim
Definition: ShowRec.h:357
Double_t GLOBAL_EvtBT_TanThetaArray[99999]
Definition: ShowRec.h:52
Double_t GLOBAL_EvtBT_TanTheta
Definition: ShowRec.h:50
TTree * TREE_ShowShower
Definition: ShowRec.h:68
Int_t GLOBAL_EvtBT_Flag
Definition: ShowRec.h:49
TObjArray * GLOBAL_InBTArray
Definition: ShowRec.h:74
Definition: EdbPVRec.h:148
Definition: EdbPattern.h:280
Int_t Npatterns() const
Definition: EdbPattern.h:380
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
Definition: EdbSegP.h:18
Float_t TX() const
Definition: EdbSegP.h:172
Float_t X() const
Definition: EdbSegP.h:170
Float_t Z() const
Definition: EdbSegP.h:150
Float_t P() const
Definition: EdbSegP.h:149
Float_t Y() const
Definition: EdbSegP.h:171
void PrintNice() const
Definition: EdbSegP.cxx:418
Float_t TY() const
Definition: EdbSegP.h:173
Int_t MCEvt() const
Definition: EdbSegP.h:142
Int_t Flag() const
Definition: EdbSegP.h:146
Float_t Z() const
Definition: EdbPattern.h:87
Int_t GetN() const
Definition: EdbPattern.h:65
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66
TClonesArray * GetSegments() const
Definition: EdbPattern.h:69
gEDBDEBUGLEVEL
Definition: energy.C:7
int MAXPLATE
Definition: shower_btr.C:19