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]; |
5111 |
// |
// |
5112 |
// |
// |
5113 |
// |
// |
5114 |
|
if ( var.CALO && false ){ |
5115 |
|
if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){ |
5116 |
|
Float_t calx[22]; |
5117 |
|
Float_t caly[22]; |
5118 |
|
Float_t calzx[22]; |
5119 |
|
Float_t calzy[22]; |
5120 |
|
Float_t zpiano[22]; |
5121 |
|
zpiano[0] = (CTZ+118.)*var.sfy/1000.; |
5122 |
|
for (Int_t plane = 1; plane < 22; plane++){ |
5123 |
|
if ( !(plane%2) ){ |
5124 |
|
zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; |
5125 |
|
}else { |
5126 |
|
zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; |
5127 |
|
}; |
5128 |
|
}; |
5129 |
|
for (Int_t plane = 0; plane < 22; plane++){ |
5130 |
|
calx[plane] = (L2->GetCaloLevel2()->cbar[plane][0]/100.)*var.sfx + var.xxvc;; |
5131 |
|
caly[plane] = (L2->GetCaloLevel2()->cbar[plane][1]/100.)*var.sfx + var.xyvc; |
5132 |
|
// calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; |
5133 |
|
calzx[plane] = zpiano[plane] + var.yxvc; |
5134 |
|
calzy[plane] = zpiano[plane] + var.yyvc; |
5135 |
|
// printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]); |
5136 |
|
}; |
5137 |
|
// |
5138 |
|
// Calorimeter track |
5139 |
|
// |
5140 |
|
Int_t trcol = 30; |
5141 |
|
if ( var.bw ){ |
5142 |
|
trcol = 14; |
5143 |
|
} else { |
5144 |
|
trcol = 44; |
5145 |
|
}; |
5146 |
|
thefigure->cd(); |
5147 |
|
TPolyLine *trakx = new TPolyLine(22,calx,calzx); |
5148 |
|
trakx->SetLineColor(trcol); |
5149 |
|
if ( L2->GetCaloLevel2()->fitmode[0] == 1 ) trakx->SetLineStyle(3); |
5150 |
|
if ( L2->GetCaloLevel2()->fitmode[0] == 2 ) trakx->SetLineStyle(4); |
5151 |
|
trakx->SetLineWidth(2); |
5152 |
|
trakx->Draw(); |
5153 |
|
TPolyLine *traky = new TPolyLine(22,caly,calzy); |
5154 |
|
traky->SetLineColor(trcol); |
5155 |
|
if ( L2->GetCaloLevel2()->fitmode[1] == 1 ) traky->SetLineStyle(3); |
5156 |
|
if ( L2->GetCaloLevel2()->fitmode[1] == 2 ) traky->SetLineStyle(4); |
5157 |
|
traky->SetLineWidth(2); |
5158 |
|
traky->Draw(); |
5159 |
|
}; |
5160 |
|
if ( L2->GetCaloLevel2()->npcfit[2] > 0 ){ |
5161 |
|
Float_t calx[22]; |
5162 |
|
Float_t caly[22]; |
5163 |
|
Float_t calzx[22]; |
5164 |
|
Float_t calzy[22]; |
5165 |
|
Float_t zpiano[22]; |
5166 |
|
zpiano[0] = (CTZ+118.)*var.sfy/1000.; |
5167 |
|
for (Int_t plane = 1; plane < 22; plane++){ |
5168 |
|
if ( !(plane%2) ){ |
5169 |
|
zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; |
5170 |
|
}else { |
5171 |
|
zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; |
5172 |
|
}; |
5173 |
|
}; |
5174 |
|
// |
5175 |
|
// |
5176 |
|
CaloTrkVar *ctra = L2->GetCaloStoredTrack(-1); |
5177 |
|
// |
5178 |
|
for (Int_t plane = 0; plane < 22; plane++){ |
5179 |
|
calx[plane] = (ctra->tbar[plane][0]/100.)*var.sfx + var.xxvc;; |
5180 |
|
caly[plane] = (ctra->tbar[plane][1]/100.)*var.sfx + var.xyvc; |
5181 |
|
// calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; |
5182 |
|
calzx[plane] = zpiano[plane] + var.yxvc; |
5183 |
|
calzy[plane] = zpiano[plane] + var.yyvc; |
5184 |
|
// printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]); |
5185 |
|
}; |
5186 |
|
// |
5187 |
|
// Calorimeter track |
5188 |
|
// |
5189 |
|
Int_t trcol = 30; |
5190 |
|
if ( var.bw ){ |
5191 |
|
trcol = 16; |
5192 |
|
} else { |
5193 |
|
trcol = 46; |
5194 |
|
}; |
5195 |
|
thefigure->cd(); |
5196 |
|
TPolyLine *trakx = new TPolyLine(22,calx,calzx); |
5197 |
|
trakx->SetLineColor(trcol); |
5198 |
|
trakx->SetLineStyle(3); |
5199 |
|
trakx->SetLineWidth(2); |
5200 |
|
trakx->Draw(); |
5201 |
|
TPolyLine *traky = new TPolyLine(22,caly,calzy); |
5202 |
|
traky->SetLineColor(trcol); |
5203 |
|
traky->SetLineStyle(3); |
5204 |
|
traky->SetLineWidth(2); |
5205 |
|
traky->Draw(); |
5206 |
|
}; |
5207 |
|
}; |
5208 |
|
// |
5209 |
if ( !var.TRK || level.file != 2 ) return; |
if ( !var.TRK || level.file != 2 ) return; |
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]; |
5283 |
}; |
}; |
5284 |
tzx[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc; |
tzx[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc; |
5285 |
tzy[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc; |
tzy[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc; |
5286 |
|
// printf("tx[e] %f ty [e] %f tzx %f tzy %f \n",tx[e],ty[e],tzx[e],tzy[e]); |
5287 |
}; |
}; |
5288 |
// |
// |
5289 |
// From S1 to CALO |
// From S1 to CALO |