5 Log(2,
"ShowRec.cpp",
"--- void FillGlobalInBTArrayNEW() ---");
19 cout <<
"---!! DOWNSTREAM ORDER ASSUMED !!---"<<endl;
20 cout <<
"---!! IF PROGRAM CRASH HERE, CHECK YOUR INPUT FP,NP;MP;LP !!---"<<endl;
22 cout <<
"---!! TO BE DONE: WHAT IF BRICK IS IN UPSTREAM ORDERING ??? !!---"<<endl;
38 cout <<
"--- FillGlobalInBTArray: DOWNSTREAM ORDER" <<endl;
39 cout <<
"--- npat = " <<
npat << endl;
40 cout <<
"--- firstplate = " << firstplate << endl;
41 cout <<
"--- middleplate = " << middleplate << endl;
42 cout <<
"--- lastplate = " << lastplate << endl;
43 cout <<
" GLOBAL_gAli->GetPattern(firstplate)->Z() = " <<
GLOBAL_gAli->
GetPattern(firstplate)->
Z() << endl;
44 cout <<
" GLOBAL_gAli->GetPattern(middleplate)->Z() = " <<
GLOBAL_gAli->
GetPattern(middleplate)->
Z() << endl;
92 cout <<
"Technical Realisation to be implemented here .... " << endl;
94 TObjArray* arrayIntermediate =
new TObjArray();
111 if (
gEDBDEBUGLEVEL>2) cout <<
"--- Doing filling InBT case cmd_LT>0"<<endl;
114 TFile * fil =
new TFile(
"linked_tracks.root");
115 TTree*
tr= (TTree*)fil->Get(
"tracks");
116 TClonesArray *seg=
new TClonesArray(
"EdbSegP",60);
117 int nentr = int(
tr->GetEntries());
119 tr->SetBranchAddress(
"t.", &
t );
120 tr->SetBranchAddress(
"s", &seg );
121 tr->SetBranchAddress(
"nseg", &nseg );
122 tr->SetBranchAddress(
"n0", &n0 );
123 tr->SetBranchAddress(
"npl", &npl );
127 for (
int i=0; i<nentr; i++ ) {
132 for (
int k=0; k<nseg; k++ ) {
134 if (
cmd_LT==1 && k>0)
continue;
135 if (
cmd_LT==2 && k<nseg-1)
continue;
146 Float_t patZ=segment->
Z();
147 if (patZ<GLOBAL_gAli__firstplate_Z || patZ>GLOBAL_gAli__middleplate_Z)
continue;
149 arrayIntermediate->Add(segment);
155 if (
gEDBDEBUGLEVEL>2) cout <<
"--- Filled " << arrayIntermediate->GetEntries() <<
" Segments into arrayIntermediate."<<endl;
158 cout <<
"cmd_LT==0" << endl;
159 for (Int_t nr=0; nr<
npat; ++nr) {
172 if (patZ<GLOBAL_gAli__firstplate_Z || patZ>GLOBAL_gAli__middleplate_Z) InRange=0;
174 if ( !InRange)
continue;
180 arrayIntermediate->Add(segment);
186 cout <<
"--- Attention: given cmd_LT value does not macht any criterion. " << endl;
187 cout <<
"--- Dont fill the arrayIntermediate with anything." << endl;
190 cout <<
"--- Criterion 0) Source done." << endl;
191 cout <<
"--- Criterion 1) Plate range done." << endl;
192 cout <<
"--- arrayIntermediate->GetEntries() = " << arrayIntermediate->GetEntries() << endl;
201 TObjArray* arrayIntermediate2 =
new TObjArray();
203 Int_t nEnt = arrayIntermediate->GetEntries();
206 for (Int_t n=0; n<nEnt; ++n) {
207 segment=(
EdbSegP*) arrayIntermediate->At(n);
208 numberMC = segment->
MCEvt();
209 if (
cmd_MC == 0 ) arrayIntermediate2->Add(segment);
210 if (
cmd_MC == 1 )
if (numberMC>=0) arrayIntermediate2->Add(segment);
211 if (
cmd_MC == 2 )
if (numberMC <0) arrayIntermediate2->Add(segment);
213 cout <<
"--- Criterion 2) MC flag range done." << endl;
214 cout <<
"--- arrayIntermediate2->GetEntries() = " << arrayIntermediate2->GetEntries() << endl;
223 TObjArray* arrayIntermediate3 =
new TObjArray();
227 arrayIntermediate3 = arrayIntermediate2;
230 nEnt = arrayIntermediate2->GetEntries();
232 for (Int_t n=0; n<nEnt; ++n) {
233 segment=(
EdbSegP*) arrayIntermediate2->At(n);
235 numberPDGId = segment->
Flag();
236 if (numberPDGId ==
cmd_MCFL ) arrayIntermediate3->Add(segment);
239 cout <<
"--- Criterion 3) PDG-value done." << endl;
240 cout <<
"--- Criterion 3) cmd_MCFL = " <<
cmd_MCFL << endl;
241 cout <<
"--- arrayIntermediate3->GetEntries() = " << arrayIntermediate3->GetEntries() << endl;
252 TObjArray* arrayIntermediate4 =
new TObjArray();
254 arrayIntermediate4 = arrayIntermediate3 ;
258 TObjArray* arrayIntermediateBG =
new TObjArray();
259 TObjArray* arrayIntermediateMC =
new TObjArray();
260 TObjArray* arrayIntermediateFHZP =
new TObjArray();
262 nEnt = arrayIntermediate3->GetEntries();
263 for (Int_t n=0; n<nEnt; ++n) {
264 segment=(
EdbSegP*) arrayIntermediate3->At(n);
265 if ( segment->
MCEvt()<0) arrayIntermediateBG->Add(segment);
266 else arrayIntermediateMC->Add(segment);
272 Int_t NarrayIntermediateMC=arrayIntermediateMC->GetEntries();
273 Bool_t OtherSegGreaterPSameMC=kFALSE;
274 Bool_t OtherSegLowerZSameMC=kFALSE;
281 Int_t segMCmin=NarrayIntermediateMC;
284 for (Int_t n=0; n<NarrayIntermediateMC; ++n) {
285 seg=(
EdbSegP*) arrayIntermediateMC->At(n);
286 segMC = seg->
MCEvt();
288 if (segMC>segMCmax) segMCmax = segMC;
289 if (segMC<segMCmin) segMCmin = segMC;
298 if (
cmd_HPLZ == 1) cout <<
"Take highest P() segment per each MCEvt." << endl;
299 if (
cmd_HPLZ == 2) cout <<
"Take lowest Z() segment per each MCEvt." << endl;
303 Float_t segPmax[segMCmax+1];
304 Int_t segn[segMCmax+1];
305 Float_t segZmin[segMCmax+1];
306 Int_t segm[segMCmax+1];
309 for (Int_t nrMC=segMCmin; nrMC<=segMCmax; ++nrMC) {
312 segZmin[nrMC]=9999999999;
317 for (Int_t n=0; n<NarrayIntermediateMC; ++n) {
318 seg=(
EdbSegP*) arrayIntermediateMC->At(n);
319 segMC = seg->
MCEvt();
322 if (segP>segPmax[segMC]) {
323 segPmax[segMC] = segP;
326 if (segZ<segZmin[segMC]) {
327 segZmin[segMC] = segZ;
331 if (TMath::Abs(segZ-segZmin[segMC])<0.1) {
333 seg2=(
EdbSegP*) arrayIntermediateMC->At(segm[segMC]);
335 if ( segP > seg2->
P() ) {
336 segZmin[segMC] = segZ;
342 Int_t SegHPLZNumberInArray=0;
343 for (Int_t nrMC=segMCmin; nrMC<=segMCmax; ++nrMC) {
344 if (segn[nrMC]==-1)
continue;
345 if (
cmd_HPLZ == 1) SegHPLZNumberInArray = segn[nrMC];
346 if (
cmd_HPLZ == 2) SegHPLZNumberInArray = segm[nrMC];
349 seg=(
EdbSegP*) arrayIntermediateMC->At(segn[nrMC]);
352 seg=(
EdbSegP*) arrayIntermediateMC->At(segm[nrMC]);
357 seg=(
EdbSegP*) arrayIntermediateMC->At(SegHPLZNumberInArray);
358 arrayIntermediateFHZP->Add(seg);
361 cout <<
" Added all FHZP segments. Number of entries = " << arrayIntermediateFHZP->GetEntries() << endl;
366 cout <<
"Warning: unsupported cmd_HPLZ value. Do no cut." << endl;
367 arrayIntermediateFHZP = arrayIntermediate3 ;
373 nEnt = arrayIntermediateFHZP->GetEntries();
374 for (Int_t n=0; n<nEnt; ++n) {
375 segment=(
EdbSegP*) arrayIntermediateFHZP->At(n);
376 arrayIntermediate4->Add(segment);
378 nEnt = arrayIntermediateBG->GetEntries();
379 for (Int_t n=0; n<nEnt; ++n) {
380 segment=(
EdbSegP*) arrayIntermediateBG->At(n);
381 arrayIntermediate4->Add(segment);
386 cout <<
"--- Criterion 4) criterion HPLZ " << endl;
387 cout <<
"--- Criterion 4) cmd_HPLZ = " <<
cmd_HPLZ << endl;
388 cout <<
"--- arrayIntermediate4->GetEntries() = " << arrayIntermediate4->GetEntries() << endl;
390 cout <<
"---- " << endl << endl;
391 cout <<
"TODO HERE: CRITERION 5 VTX IP CUT ... " << endl;
392 cout <<
"TODO HERE: CRITERION 5 VTX IP CUT ... " << endl;
393 cout <<
"WARNING As of July 4th 2018, the VTX IP CUT is not yet implemented " << endl;
394 cout <<
"in the new FillGlobalInBTArrayNEW() function. TO BE DONE !!! " << endl;
395 cout <<
"TODO HERE: CRITERION 5 VTX IP CUT ... " << endl;
396 cout <<
"TODO HERE: CRITERION 5 VTX IP CUT ... " << endl;
397 cout <<
"---- " << endl << endl;
417 cout <<
"GLOBAL_InBTArray filling done.................."<<endl;
419 cout <<
"--- GLOBAL_InBTArray->GetEntries() = 0 . RETURN FILL FUNCTION !" << endl;
427 cout <<
"--- GLOBAL_InBTArray->GetEntries() = " <<
GLOBAL_InBTArray->GetEntries() << endl;
428 cout <<
"--- GLOBAL_InBTArray->At(0) = " << endl;
430 cout <<
"--- GLOBAL_InBTArray->At(Last) = " << endl;
436 for (Int_t n=0; n<GLOBAL_InBTArrayN; ++n) {
443 cout <<
"What to do, if GLOBAL_InBTArray has zero entries???" << endl;
444 cout <<
"Only logical would be that the program stops." << endl;
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
Int_t npat
Definition: Xi2HatStartScript.C:33
EdbPVRec * GLOBAL_gAli
Definition: ShowRec.h:73
TObjArray * GLOBAL_ShowerSegArray
Definition: ShowRec.h:76
Int_t cmd_LT
Definition: ShowRec.h:19
Int_t cmd_FP
Definition: ShowRec.h:15
Int_t cmd_MCFL
Definition: ShowRec.h:21
Int_t cmd_MP
Definition: ShowRec.h:17
Int_t cmd_LP
Definition: ShowRec.h:16
Int_t cmd_MC
Definition: ShowRec.h:20
TObjArray * GLOBAL_InBTArray
Definition: ShowRec.h:74
TTree * t
Definition: check_shower.C:4
Int_t Npatterns() const
Definition: EdbPattern.h:380
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
Float_t Z() const
Definition: EdbSegP.h:150
Float_t P() const
Definition: EdbSegP.h:149
void PrintNice() const
Definition: EdbSegP.cxx:418
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
Definition: EdbPattern.h:118
gEDBDEBUGLEVEL
Definition: energy.C:7
Int_t cmd_HPLZ
Definition: ShowRec.h:25
EdbSegP * s2
Definition: tlg2pattern.C:31