86 |
var.SHOWDEC = 0; |
var.SHOWDEC = 0; |
87 |
var.TOF = 0; |
var.TOF = 0; |
88 |
var.AC = 0; |
var.AC = 0; |
89 |
|
var.RUN = 1; |
90 |
var.TRK = 0; |
var.TRK = 0; |
91 |
var.CALO = 0; |
var.CALO = 0; |
92 |
var.S4 = 0; |
var.S4 = 0; |
123 |
}; |
}; |
124 |
} |
} |
125 |
|
|
126 |
|
void FEVdetector::SetDDEC(TString de){ |
127 |
|
ddec=de; |
128 |
|
}; |
129 |
|
|
130 |
void FEVdetector::GetWindow(){ |
void FEVdetector::GetWindow(){ |
131 |
otr->GetEntry(maxevent); |
otr->GetEntry(maxevent); |
132 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
166 |
void FEVdetector::GetEntry(Int_t i){ |
void FEVdetector::GetEntry(Int_t i){ |
167 |
thisentry = i; |
thisentry = i; |
168 |
otr->GetEntry(i); |
otr->GetEntry(i); |
169 |
|
// PrintData(otr,-1LL,44); |
170 |
} |
} |
171 |
|
|
172 |
void FEVdetector::SetEntry(Int_t i){ |
void FEVdetector::SetEntry(Int_t i){ |
287 |
}; |
}; |
288 |
} |
} |
289 |
|
|
290 |
|
void FEVdetector::PrintLeaves(TTree *otr, Int_t i, TBranchElement *tb, Int_t lenmax){ |
291 |
|
// -- Prints values of leaves. |
292 |
|
|
293 |
|
// tb->ValidateAddress(); |
294 |
|
printf("son qua \n"); |
295 |
|
|
296 |
|
// if (otr->GetMakeClass()) { |
297 |
|
if (!tb->GetAddress()) { |
298 |
|
printf("esco \n"); |
299 |
|
return; |
300 |
|
} |
301 |
|
if (tb->GetType() == 3 || tb->GetType() == 4) { |
302 |
|
// TClonesArray or STL container top-level branch. |
303 |
|
printf("3 o 4 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
304 |
|
return; |
305 |
|
} else if (tb->GetType() == 31 || tb->GetType() == 41) { |
306 |
|
printf(" 31 o 41 \n"); |
307 |
|
// TClonesArray or STL container sub-branch. |
308 |
|
Int_t n = TMath::Min(10, tb->GetNdata()); |
309 |
|
Int_t atype = tb->GetStreamerType() + 20; |
310 |
|
if (tb->GetStreamerType() == 1) { |
311 |
|
// TVirtualStreamerInfo::kOffsetL + TVirtualStreamerInfo::kChar is |
312 |
|
// printed as a string and could print weird characters. |
313 |
|
// So we print an unsigned char instead (not perfect, but better). |
314 |
|
atype = 20 + 11 ; |
315 |
|
} |
316 |
|
if (atype > 54) { |
317 |
|
// FIXME: More logic required here (like in ReadLeaves) |
318 |
|
printf(">54 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
319 |
|
return; |
320 |
|
} |
321 |
|
if (tb->GetStreamerType() > 20) { |
322 |
|
atype -= 20; |
323 |
|
TObjArray *prova= otr->GetListOfLeaves(); |
324 |
|
// TObjArray* leaf2 = (TObjArray*) prova->UncheckedAt(i); |
325 |
|
//TLeaf* leaf = (TLeaf*)(otr->GetLeaf(tb->GetName())); |
326 |
|
// TLeafElement* leaf = (TLeafElement*)((TLeaf*)(otr->GetListOfLeaves()->UncheckedAt(i))->GetBranch()->UncheckedAt(0)); |
327 |
|
TLeafElement* leaf = (TLeafElement*)(prova->UncheckedAt(0)); |
328 |
|
n = n * leaf->GetLenStatic(); |
329 |
|
} |
330 |
|
if (tb->GetInfo()) { |
331 |
|
// n = 16; |
332 |
|
tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); |
333 |
|
//tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); |
334 |
|
} |
335 |
|
return; |
336 |
|
} else if (tb->GetType() <= 2) { |
337 |
|
printf(" <=2 \n"); |
338 |
|
// Branch in split mode. |
339 |
|
// FIXME: This should probably be < 60 instead. |
340 |
|
if ((tb->GetStreamerType() > 40) && (tb->GetStreamerType() < 55)) { |
341 |
|
Int_t atype = tb->GetStreamerType() - 20; |
342 |
|
TBranchElement* counterElement = (TBranchElement*) tb->GetBranchCount(); |
343 |
|
Int_t n = (Int_t) counterElement->GetValue(0, 0); |
344 |
|
if (tb->GetInfo()) { |
345 |
|
tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); |
346 |
|
} |
347 |
|
} else { |
348 |
|
// if (tb->GetInfo()) { |
349 |
|
// tb->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), tb->GetID(), -1, lenmax); |
350 |
|
// } |
351 |
|
// } |
352 |
|
return; |
353 |
|
} |
354 |
|
} else if (tb->GetType() == 3) { |
355 |
|
printf("3 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
356 |
|
} else if (tb->GetType() == 31) { |
357 |
|
printf("31 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
358 |
|
// TClonesArray* clones = (TClonesArray*) tb->GetObject(); |
359 |
|
// if (tb->GetInfo()) { |
360 |
|
// tb->GetInfo()->PrintValueClones(tb->GetName(), clones, tb->GetID(), tb->GetOffset(), lenmax); |
361 |
|
// } |
362 |
|
} else if (tb->GetType() == 41) { |
363 |
|
printf("41 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
364 |
|
// TVirtualCollectionProxy::TPushPop helper(((TBranchElement*) this)->GetCollectionProxy(), fObject); |
365 |
|
// if (GetInfo()) { |
366 |
|
// GetInfo()->PrintValueSTL(GetName(), ((TBranchElement*) this)->GetCollectionProxy(), fID, fOffset, lenmax); |
367 |
|
// } |
368 |
|
} else { |
369 |
|
printf("else %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
370 |
|
// if (GetInfo()) { |
371 |
|
// GetInfo()->PrintValue(GetName(), fObject, fID, -1, lenmax); |
372 |
|
// } |
373 |
|
} |
374 |
|
|
375 |
|
// }; |
376 |
|
printf("esco qui\n"); |
377 |
|
}; |
378 |
|
|
379 |
|
void FEVdetector::PrintData(TTree *tree, Long64_t entry=-1LL,Int_t lenmax=44){ |
380 |
|
// -- Print values of all active leaves for entry. |
381 |
|
// |
382 |
|
// if entry==-1, print current entry (default) |
383 |
|
// if a leaf is an array, a maximum of lenmax elements is printed. |
384 |
|
// |
385 |
|
if (entry != -1) { |
386 |
|
tree->GetEntry(entry); |
387 |
|
} |
388 |
|
// printf("======> EVENT:%lld\n", thisentry); |
389 |
|
printf("======> EVENT:%i\n", thisentry); |
390 |
|
TObjArray* leaves = tree->GetListOfLeaves(); // |
391 |
|
Int_t nleaves = leaves->GetEntriesFast(); |
392 |
|
Int_t ltype; |
393 |
|
for (Int_t i = 0; i < nleaves; i++) { |
394 |
|
TLeaf* leaf = (TLeaf*) leaves->UncheckedAt(i); |
395 |
|
TBranch* branch = leaf->GetBranch(); |
396 |
|
// if (branch->TestBit(kDoNotProcess)) { |
397 |
|
// continue; |
398 |
|
// } |
399 |
|
Int_t len = leaf->GetLen(); |
400 |
|
if (len <= 0) { |
401 |
|
continue; |
402 |
|
} |
403 |
|
len = TMath::Min(len, lenmax); |
404 |
|
if (leaf->IsA() == TLeafElement::Class()) { |
405 |
|
// Double_t value = leaf->GetValue(lenmax); |
406 |
|
//printf(" ioqui %f \n",value); |
407 |
|
// ((TBranchElement*)leaf->GetBranch())->PrintValue(i); |
408 |
|
this->PrintLeaves(otr,i,((TBranchElement*)leaf->GetBranch()), lenmax); |
409 |
|
//leaf->PrintValue(lenmax); |
410 |
|
continue; |
411 |
|
} |
412 |
|
if (branch->GetListOfBranches()->GetEntriesFast() > 0) { |
413 |
|
continue; |
414 |
|
} |
415 |
|
ltype = 10; |
416 |
|
if (leaf->IsA() == TLeafF::Class()) { |
417 |
|
ltype = 5; |
418 |
|
} |
419 |
|
if (leaf->IsA() == TLeafD::Class()) { |
420 |
|
ltype = 5; |
421 |
|
} |
422 |
|
if (leaf->IsA() == TLeafC::Class()) { |
423 |
|
len = 1; |
424 |
|
ltype = 5; |
425 |
|
}; |
426 |
|
printf(" %-15s = ", leaf->GetName()); |
427 |
|
for (Int_t l = 0; l < len; l++) { |
428 |
|
Double_t value = leaf->GetValue(l); |
429 |
|
printf(" ioqui %f \n",value); |
430 |
|
// leaf->PrintValue(l); |
431 |
|
if (l == (len - 1)) { |
432 |
|
printf("\n"); |
433 |
|
continue; |
434 |
|
} |
435 |
|
printf(", "); |
436 |
|
if ((l % ltype) == 0) { |
437 |
|
printf("\n "); |
438 |
|
} |
439 |
|
} |
440 |
|
} |
441 |
|
}; |
442 |
|
|
443 |
void FEVdetector::GetGeneralInfo(){ |
void FEVdetector::GetGeneralInfo(){ |
444 |
// |
// |
445 |
// Get Orbital Time information and header event number |
// Get Orbital Time information and header event number |
628 |
// |
// |
629 |
} |
} |
630 |
|
|
631 |
void FEVdetector::Load(TTree &mainotr, TFile &mainfile){ |
Int_t FEVdetector::Load(TTree &mainotr, TFile &mainfile){ |
632 |
file = &mainfile; |
file = &mainfile; |
633 |
otr = &mainotr; |
otr = &mainotr; |
634 |
L2 = new PamLevel2(); |
L2 = new PamLevel2(); |
635 |
// |
// |
636 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
637 |
// otr = L2->LoadPamTrees(file); |
// otr = L2->LoadPamTrees(file); |
638 |
otr = L2->GetPamTree(file,"+ALL +CAL1 -TRKh -TRK1"); |
// printf(" %s \n",ddec.Data()); |
639 |
|
otr = L2->GetPamTree(file,ddec.Data()); |
640 |
|
// |
641 |
|
if ( !otr ) return(0); |
642 |
// ******************** |
// ******************** |
643 |
// load magnetic field |
// load magnetic field |
644 |
// ******************** |
// ******************** |
690 |
// |
// |
691 |
}; |
}; |
692 |
// |
// |
|
|
|
693 |
// |
// |
694 |
trigger = new pamela::trigger::TriggerEvent(); |
trigger = new pamela::trigger::TriggerEvent(); |
695 |
eh = new pamela::EventHeader(); |
eh = new pamela::EventHeader(); |
708 |
otr->SetBranchAddress("Trigger", &trigger); |
otr->SetBranchAddress("Trigger", &trigger); |
709 |
otr->SetBranchAddress("Header", &eh); |
otr->SetBranchAddress("Header", &eh); |
710 |
}; |
}; |
711 |
if ( level.file == 2 ){ |
if ( level.file == 2 && var.RUN){ |
712 |
// otr->AddFriend("OrbitalInfo", file); |
// otr->AddFriend("OrbitalInfo", file); |
713 |
// otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
// otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
714 |
runinfo->Read(0ULL); |
runinfo->Read(0ULL); |
784 |
printf("Show the Time of Flight detector, LEVEL2 data \n"); |
printf("Show the Time of Flight detector, LEVEL2 data \n"); |
785 |
}; |
}; |
786 |
}; |
}; |
787 |
|
// |
788 |
|
return(1); |
789 |
// |
// |
790 |
} |
} |
791 |
|
|
2187 |
ms11b[i] = 0.; |
ms11b[i] = 0.; |
2188 |
} else { |
} else { |
2189 |
ms11b[i] = 1.; |
ms11b[i] = 1.; |
2190 |
}; }; |
}; |
2191 |
|
}; |
2192 |
for ( Int_t i = 0; i<6; i++ ) { |
for ( Int_t i = 0; i<6; i++ ) { |
2193 |
mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]]; |
mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]]; |
2194 |
mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]]; |
mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]]; |
2287 |
// |
// |
2288 |
var.tofraw = 0; |
var.tofraw = 0; |
2289 |
// |
// |
2290 |
repuntil = L2->GetToFLevel2()->ntrk(); |
if ( level.file == 2 ) repuntil = L2->GetToFLevel2()->ntrk(); |
2291 |
// printf("repuntil = %i \n",repuntil); |
// printf("repuntil = %i \n",repuntil); |
2292 |
//repuntil = L2->GetNTracks(); |
//repuntil = L2->GetNTracks(); |
2293 |
// |
// |
4696 |
// |
// |
4697 |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
4698 |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
4699 |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
PamTrack *ptrack= L2->GetTrack(nt); |
4700 |
|
TrkTrack *track = ptrack->GetTrkTrack(); |
4701 |
if ( nt == 0 ){ |
if ( nt == 0 ){ |
4702 |
var.rig = 0.; |
var.rig = 0.; |
4703 |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
5210 |
// |
// |
5211 |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
5212 |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
5213 |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
|
5214 |
|
// TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
5215 |
|
PamTrack *ptrack = L2->GetTrack(nt); |
5216 |
|
TrkTrack *track = ptrack->GetTrkTrack(); |
5217 |
Int_t npoint = 100; |
Int_t npoint = 100; |
5218 |
Float_t zin[100]; |
Float_t zin[100]; |
5219 |
Double_t xout[100]; |
Double_t xout[100]; |