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.ORB = 0; |
92 |
|
var.TRG = 0; |
93 |
var.CALO = 0; |
var.CALO = 0; |
94 |
var.S4 = 0; |
var.S4 = 0; |
95 |
var.ND = 0; |
var.ND = 0; |
125 |
}; |
}; |
126 |
} |
} |
127 |
|
|
128 |
|
void FEVdetector::SetDDEC(TString de){ |
129 |
|
ddec=de; |
130 |
|
}; |
131 |
|
|
132 |
void FEVdetector::GetWindow(){ |
void FEVdetector::GetWindow(){ |
133 |
otr->GetEntry(maxevent); |
otr->GetEntry(maxevent); |
134 |
|
// |
135 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
136 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
137 |
lastevno = (int)ph->Counter; |
lastevno = (int)ph->Counter; |
138 |
} else { |
} else { |
139 |
lastevno = oinfoL2->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
if ( var.ORB ){ |
140 |
|
lastevno = L2->GetOrbitalInfo()->pkt_num; |
141 |
|
} else { |
142 |
|
lastevno = 0; |
143 |
|
}; |
144 |
}; |
}; |
145 |
otr->GetEntry(minevent); |
otr->GetEntry(minevent); |
146 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
147 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
148 |
firstevno = (int)ph->Counter; |
firstevno = (int)ph->Counter; |
149 |
} else { |
} else { |
150 |
firstevno = oinfoL2->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
if ( var.ORB ){ |
151 |
|
firstevno = L2->GetOrbitalInfo()->pkt_num; |
152 |
|
} else { |
153 |
|
firstevno = 0; |
154 |
|
}; |
155 |
}; |
}; |
156 |
} |
} |
157 |
|
|
177 |
void FEVdetector::GetEntry(Int_t i){ |
void FEVdetector::GetEntry(Int_t i){ |
178 |
thisentry = i; |
thisentry = i; |
179 |
otr->GetEntry(i); |
otr->GetEntry(i); |
180 |
|
// PrintData(otr,-1LL,44); |
181 |
} |
} |
182 |
|
|
183 |
void FEVdetector::SetEntry(Int_t i){ |
void FEVdetector::SetEntry(Int_t i){ |
190 |
return((int)ph->Counter); |
return((int)ph->Counter); |
191 |
} else { |
} else { |
192 |
// return(thisentry); // to be changed as soon as we will have pkt_counter in the level2 file! |
// return(thisentry); // to be changed as soon as we will have pkt_counter in the level2 file! |
193 |
return((int)oinfoL2->pkt_num); // to be changed as soon as we will have pkt_counter in the level2 file! |
return((int)L2->GetOrbitalInfo()->pkt_num); // to be changed as soon as we will have pkt_counter in the level2 file! |
194 |
}; |
}; |
195 |
} |
} |
196 |
|
|
298 |
}; |
}; |
299 |
} |
} |
300 |
|
|
301 |
|
void FEVdetector::PrintLeaves(TTree *otr, Int_t i, TBranchElement *tb, Int_t lenmax){ |
302 |
|
// -- Prints values of leaves. |
303 |
|
|
304 |
|
// tb->ValidateAddress(); |
305 |
|
printf("son qua \n"); |
306 |
|
|
307 |
|
// if (otr->GetMakeClass()) { |
308 |
|
if (!tb->GetAddress()) { |
309 |
|
printf("esco \n"); |
310 |
|
return; |
311 |
|
} |
312 |
|
if (tb->GetType() == 3 || tb->GetType() == 4) { |
313 |
|
// TClonesArray or STL container top-level branch. |
314 |
|
printf("3 o 4 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
315 |
|
return; |
316 |
|
} else if (tb->GetType() == 31 || tb->GetType() == 41) { |
317 |
|
printf(" 31 o 41 \n"); |
318 |
|
// TClonesArray or STL container sub-branch. |
319 |
|
Int_t n = TMath::Min(10, tb->GetNdata()); |
320 |
|
Int_t atype = tb->GetStreamerType() + 20; |
321 |
|
if (tb->GetStreamerType() == 1) { |
322 |
|
// TVirtualStreamerInfo::kOffsetL + TVirtualStreamerInfo::kChar is |
323 |
|
// printed as a string and could print weird characters. |
324 |
|
// So we print an unsigned char instead (not perfect, but better). |
325 |
|
atype = 20 + 11 ; |
326 |
|
} |
327 |
|
if (atype > 54) { |
328 |
|
// FIXME: More logic required here (like in ReadLeaves) |
329 |
|
printf(">54 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
330 |
|
return; |
331 |
|
} |
332 |
|
if (tb->GetStreamerType() > 20) { |
333 |
|
atype -= 20; |
334 |
|
TObjArray *prova= otr->GetListOfLeaves(); |
335 |
|
// TObjArray* leaf2 = (TObjArray*) prova->UncheckedAt(i); |
336 |
|
//TLeaf* leaf = (TLeaf*)(otr->GetLeaf(tb->GetName())); |
337 |
|
// TLeafElement* leaf = (TLeafElement*)((TLeaf*)(otr->GetListOfLeaves()->UncheckedAt(i))->GetBranch()->UncheckedAt(0)); |
338 |
|
TLeafElement* leaf = (TLeafElement*)(prova->UncheckedAt(0)); |
339 |
|
n = n * leaf->GetLenStatic(); |
340 |
|
} |
341 |
|
if (tb->GetInfo()) { |
342 |
|
// n = 16; |
343 |
|
tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); |
344 |
|
//tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); |
345 |
|
} |
346 |
|
return; |
347 |
|
} else if (tb->GetType() <= 2) { |
348 |
|
printf(" <=2 \n"); |
349 |
|
// Branch in split mode. |
350 |
|
// FIXME: This should probably be < 60 instead. |
351 |
|
if ((tb->GetStreamerType() > 40) && (tb->GetStreamerType() < 55)) { |
352 |
|
Int_t atype = tb->GetStreamerType() - 20; |
353 |
|
TBranchElement* counterElement = (TBranchElement*) tb->GetBranchCount(); |
354 |
|
Int_t n = (Int_t) counterElement->GetValue(0, 0); |
355 |
|
if (tb->GetInfo()) { |
356 |
|
tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); |
357 |
|
} |
358 |
|
} else { |
359 |
|
// if (tb->GetInfo()) { |
360 |
|
// tb->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), tb->GetID(), -1, lenmax); |
361 |
|
// } |
362 |
|
// } |
363 |
|
return; |
364 |
|
} |
365 |
|
} else if (tb->GetType() == 3) { |
366 |
|
printf("3 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
367 |
|
} else if (tb->GetType() == 31) { |
368 |
|
printf("31 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
369 |
|
// TClonesArray* clones = (TClonesArray*) tb->GetObject(); |
370 |
|
// if (tb->GetInfo()) { |
371 |
|
// tb->GetInfo()->PrintValueClones(tb->GetName(), clones, tb->GetID(), tb->GetOffset(), lenmax); |
372 |
|
// } |
373 |
|
} else if (tb->GetType() == 41) { |
374 |
|
printf("41 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
375 |
|
// TVirtualCollectionProxy::TPushPop helper(((TBranchElement*) this)->GetCollectionProxy(), fObject); |
376 |
|
// if (GetInfo()) { |
377 |
|
// GetInfo()->PrintValueSTL(GetName(), ((TBranchElement*) this)->GetCollectionProxy(), fID, fOffset, lenmax); |
378 |
|
// } |
379 |
|
} else { |
380 |
|
printf("else %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
381 |
|
// if (GetInfo()) { |
382 |
|
// GetInfo()->PrintValue(GetName(), fObject, fID, -1, lenmax); |
383 |
|
// } |
384 |
|
} |
385 |
|
|
386 |
|
// }; |
387 |
|
printf("esco qui\n"); |
388 |
|
}; |
389 |
|
|
390 |
|
void FEVdetector::PrintData(TTree *tree, Long64_t entry=-1LL,Int_t lenmax=44){ |
391 |
|
// -- Print values of all active leaves for entry. |
392 |
|
// |
393 |
|
// if entry==-1, print current entry (default) |
394 |
|
// if a leaf is an array, a maximum of lenmax elements is printed. |
395 |
|
// |
396 |
|
if (entry != -1) { |
397 |
|
tree->GetEntry(entry); |
398 |
|
} |
399 |
|
// printf("======> EVENT:%lld\n", thisentry); |
400 |
|
printf("======> EVENT:%i\n", thisentry); |
401 |
|
TObjArray* leaves = tree->GetListOfLeaves(); // |
402 |
|
Int_t nleaves = leaves->GetEntriesFast(); |
403 |
|
Int_t ltype; |
404 |
|
for (Int_t i = 0; i < nleaves; i++) { |
405 |
|
TLeaf* leaf = (TLeaf*) leaves->UncheckedAt(i); |
406 |
|
TBranch* branch = leaf->GetBranch(); |
407 |
|
// if (branch->TestBit(kDoNotProcess)) { |
408 |
|
// continue; |
409 |
|
// } |
410 |
|
Int_t len = leaf->GetLen(); |
411 |
|
if (len <= 0) { |
412 |
|
continue; |
413 |
|
} |
414 |
|
len = TMath::Min(len, lenmax); |
415 |
|
if (leaf->IsA() == TLeafElement::Class()) { |
416 |
|
// Double_t value = leaf->GetValue(lenmax); |
417 |
|
//printf(" ioqui %f \n",value); |
418 |
|
// ((TBranchElement*)leaf->GetBranch())->PrintValue(i); |
419 |
|
this->PrintLeaves(otr,i,((TBranchElement*)leaf->GetBranch()), lenmax); |
420 |
|
//leaf->PrintValue(lenmax); |
421 |
|
continue; |
422 |
|
} |
423 |
|
if (branch->GetListOfBranches()->GetEntriesFast() > 0) { |
424 |
|
continue; |
425 |
|
} |
426 |
|
ltype = 10; |
427 |
|
if (leaf->IsA() == TLeafF::Class()) { |
428 |
|
ltype = 5; |
429 |
|
} |
430 |
|
if (leaf->IsA() == TLeafD::Class()) { |
431 |
|
ltype = 5; |
432 |
|
} |
433 |
|
if (leaf->IsA() == TLeafC::Class()) { |
434 |
|
len = 1; |
435 |
|
ltype = 5; |
436 |
|
}; |
437 |
|
printf(" %-15s = ", leaf->GetName()); |
438 |
|
for (Int_t l = 0; l < len; l++) { |
439 |
|
Double_t value = leaf->GetValue(l); |
440 |
|
printf(" ioqui %f \n",value); |
441 |
|
// leaf->PrintValue(l); |
442 |
|
if (l == (len - 1)) { |
443 |
|
printf("\n"); |
444 |
|
continue; |
445 |
|
} |
446 |
|
printf(", "); |
447 |
|
if ((l % ltype) == 0) { |
448 |
|
printf("\n "); |
449 |
|
} |
450 |
|
} |
451 |
|
} |
452 |
|
}; |
453 |
|
|
454 |
void FEVdetector::GetGeneralInfo(){ |
void FEVdetector::GetGeneralInfo(){ |
455 |
// |
// |
456 |
// Get Orbital Time information and header event number |
// Get Orbital Time information and header event number |
496 |
trcs = (TString)trc.str().c_str(); |
trcs = (TString)trc.str().c_str(); |
497 |
} else { |
} else { |
498 |
headcold = headc; |
headcold = headc; |
499 |
headc = oinfoL2->pkt_num; // to be changed as soon as we will have obt in the level2 file! |
if ( var.ORB ){ |
500 |
OBT = oinfoL2->OBT; // to be changed as soon as we will have obt in the level2 file! |
headc = L2->GetOrbitalInfo()->pkt_num; |
501 |
DOBT = OBT - OOBT; |
OBT = L2->GetOrbitalInfo()->OBT; |
502 |
OOBT = OBT; |
DOBT = OBT - OOBT; |
503 |
if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0; |
OOBT = OBT; |
504 |
var.etime = OBT; |
if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0; |
505 |
|
var.etime = OBT; |
506 |
|
} else { |
507 |
|
var.etime = 0; |
508 |
|
}; |
509 |
// |
// |
510 |
// who gave the trigger? |
// who gave the trigger? |
511 |
// |
// |
512 |
calotrig = 0; |
Int_t trigconf = 0; |
513 |
if ( L2->patterntrig[0] ) calotrig = 1; |
if ( var.TRG ){ |
514 |
toftrig = 0; |
calotrig = 0; |
515 |
if ( L2->patterntrig[2] || L2->patterntrig[3] || L2->patterntrig[4] || L2->patterntrig[5] ) toftrig = 1; |
if ( L2->GetTrigLevel2()->patterntrig[0] ) calotrig = 1; |
516 |
s4pulser = 0; |
toftrig = 0; |
517 |
if ( L2->patterntrig[1] & (1<<0) ) s4pulser = 1; |
if ( L2->GetTrigLevel2()->patterntrig[2] || L2->GetTrigLevel2()->patterntrig[3] || L2->GetTrigLevel2()->patterntrig[4] || L2->GetTrigLevel2()->patterntrig[5] ) toftrig = 1; |
518 |
// |
s4pulser = 0; |
519 |
// TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns. |
if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) s4pulser = 1; |
520 |
// S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug": |
// |
521 |
// |
// TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns. |
522 |
if ( !calotrig && !toftrig ) s4pulser = 1; |
// S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug": |
523 |
// |
// |
524 |
Int_t trigconf = L2->trigconf; |
if ( !calotrig && !toftrig ) s4pulser = 1; |
525 |
|
// |
526 |
|
trigconf = L2->GetTrigLevel2()->trigconf; |
527 |
|
} else { |
528 |
|
trigconf = 0; |
529 |
|
} |
530 |
stringstream trc; |
stringstream trc; |
531 |
trc.str(""); |
trc.str(""); |
532 |
if ( trigconf & (1<<0) ) trc << "TOF1"; |
if ( trigconf & (1<<0) ) trc << "TOF1"; |
635 |
// |
// |
636 |
if ( level.file == -1 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,-1,(Variables &)var);"); |
if ( level.file == -1 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,-1,(Variables &)var);"); |
637 |
// |
// |
638 |
if ( level.file == 2 ) isOK = gApplication->ProcessLine("filter((PamLevel2 *)L2,2);"); |
// if ( level.file == 2 ) isOK = gApplication->ProcessLine("filter((PamLevel2 *)L2,2);"); |
639 |
|
if ( level.file == 2 ) isOK = gApplication->ProcessLine("filter();"); |
640 |
// |
// |
641 |
// progress bar in text window |
// progress bar in text window |
642 |
// |
// |
649 |
// |
// |
650 |
} |
} |
651 |
|
|
652 |
void FEVdetector::Load(TTree &mainotr, TFile &mainfile){ |
Int_t FEVdetector::Load(TTree &mainotr, TFile &mainfile){ |
653 |
|
//Int_t FEVdetector::Load(TChain &mainotr, TFile &mainfile){ |
654 |
file = &mainfile; |
file = &mainfile; |
655 |
otr = &mainotr; |
otr = &mainotr; |
656 |
L2 = new PamLevel2(); |
L2 = new PamLevel2(); |
657 |
// |
// |
658 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
659 |
// otr = L2->LoadPamTrees(file); |
// otr = L2->LoadPamTrees(file); |
660 |
otr = L2->GetPamTree(file); |
printf(" %s \n",ddec.Data()); |
661 |
|
// otr->Refresh(); |
662 |
|
// otr->Clear(); |
663 |
|
// otr = new TTree(); |
664 |
|
otr = L2->GetPamTree(file,ddec.Data()); |
665 |
|
// |
666 |
|
if ( !otr ) return(0); |
667 |
// ******************** |
// ******************** |
668 |
// load magnetic field |
// load magnetic field |
669 |
// ******************** |
// ******************** |
670 |
const char *pam_calib = pathtocalibration(); |
// const char *pam_calib = pathtocalibration(); |
671 |
// |
// |
672 |
stringstream magfie; |
// stringstream magfie; |
673 |
magfie.str(""); |
// magfie.str(""); |
674 |
// magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/"; |
// magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/"; |
675 |
magfie << pam_calib; |
// magfie << pam_calib; |
676 |
magfie << "/trk-param/field_param-0/"; |
//magfie << "/trk-param/field_param-0/"; |
677 |
// |
// |
678 |
L2->LoadField(magfie.str().c_str()); |
//L2->GetTrkLevel2()->LoadField(magfie.str().c_str()); |
679 |
} else { |
} else { |
680 |
// |
// |
681 |
// load calorimeter ADC2MIP conversion file |
// load calorimeter ADC2MIP conversion file |
715 |
// |
// |
716 |
}; |
}; |
717 |
// |
// |
|
|
|
718 |
// |
// |
719 |
trigger = new pamela::trigger::TriggerEvent(); |
trigger = new pamela::trigger::TriggerEvent(); |
720 |
eh = new pamela::EventHeader(); |
eh = new pamela::EventHeader(); |
721 |
ph = new pamela::PscuHeader(); |
ph = new pamela::PscuHeader(); |
722 |
oinfoL2 = new OrbitalInfo(); |
// oinfoL2 = new OrbitalInfo(); |
723 |
runinfo = new ItoRunInfo(file); |
runinfo = new ItoRunInfo(file); |
724 |
// |
// |
725 |
de = new pamela::calorimeter::CalorimeterEvent(); |
de = new pamela::calorimeter::CalorimeterEvent(); |
733 |
otr->SetBranchAddress("Trigger", &trigger); |
otr->SetBranchAddress("Trigger", &trigger); |
734 |
otr->SetBranchAddress("Header", &eh); |
otr->SetBranchAddress("Header", &eh); |
735 |
}; |
}; |
736 |
if ( level.file == 2 ){ |
if ( level.file == 2 && var.RUN){ |
737 |
otr->AddFriend("OrbitalInfo", file); |
// otr->AddFriend("OrbitalInfo", file); |
738 |
otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
// otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
739 |
runinfo->Read(0ULL); |
runinfo->Read(0ULL); |
740 |
}; |
}; |
741 |
// |
// |
809 |
printf("Show the Time of Flight detector, LEVEL2 data \n"); |
printf("Show the Time of Flight detector, LEVEL2 data \n"); |
810 |
}; |
}; |
811 |
}; |
}; |
812 |
|
// |
813 |
|
// printf("qua\n"); |
814 |
|
return(1); |
815 |
// |
// |
816 |
} |
} |
817 |
|
|
2213 |
ms11b[i] = 0.; |
ms11b[i] = 0.; |
2214 |
} else { |
} else { |
2215 |
ms11b[i] = 1.; |
ms11b[i] = 1.; |
2216 |
}; }; |
}; |
2217 |
|
}; |
2218 |
for ( Int_t i = 0; i<6; i++ ) { |
for ( Int_t i = 0; i<6; i++ ) { |
2219 |
mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]]; |
mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]]; |
2220 |
mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]]; |
mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]]; |
2313 |
// |
// |
2314 |
var.tofraw = 0; |
var.tofraw = 0; |
2315 |
// |
// |
2316 |
repuntil = L2->ToFLevel2::ntrk(); |
if ( level.file == 2 ) repuntil = L2->GetToFLevel2()->ntrk(); |
2317 |
// printf("repuntil = %i \n",repuntil); |
// printf("repuntil = %i \n",repuntil); |
2318 |
//repuntil = L2->GetNTracks(); |
//repuntil = L2->GetNTracks(); |
2319 |
// |
// |
2328 |
// |
// |
2329 |
if ( repuntil == 1 || var.tofraw ){ |
if ( repuntil == 1 || var.tofraw ){ |
2330 |
numtr = 0; |
numtr = 0; |
2331 |
ptt = L2->GetToFTrkVar(0); |
ptt = L2->GetToFLevel2()->GetToFTrkVar(0); |
2332 |
repeat = false; |
repeat = false; |
2333 |
} else { |
} else { |
2334 |
// |
// |
2335 |
// |
// |
2336 |
if ( numtr >= repuntil-1 ) repeat = false; |
if ( numtr >= repuntil-1 ) repeat = false; |
2337 |
// |
// |
2338 |
ptt = L2->GetToFTrkVar(numtr); |
ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr); |
2339 |
}; |
}; |
2340 |
// |
// |
2341 |
xp11[0] = 0.; |
xp11[0] = 0.; |
2351 |
// |
// |
2352 |
Float_t adc[4][12]; |
Float_t adc[4][12]; |
2353 |
Float_t tdc[4][12]; |
Float_t tdc[4][12]; |
2354 |
L2->GetMatrix(numtr,adc,tdc); |
L2->GetToFLevel2()->GetMatrix(numtr,adc,tdc); |
2355 |
|
|
2356 |
// |
// |
2357 |
for ( Int_t i = 0; i<8; i++ ) { |
for ( Int_t i = 0; i<8; i++ ) { |
2995 |
// full infos from ac |
// full infos from ac |
2996 |
// |
// |
2997 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
2998 |
hitmapA = L2->hitmap[0]; |
hitmapA = L2->GetAcLevel2()->hitmap[0]; |
2999 |
hitmapB = L2->hitmap[1]; |
hitmapB = L2->GetAcLevel2()->hitmap[1]; |
3000 |
hitstatusA = L2->hitstatus[0]; |
hitstatusA = L2->GetAcLevel2()->hitstatus[0]; |
3001 |
hitstatusB = L2->hitstatus[1]; |
hitstatusB = L2->GetAcLevel2()->hitstatus[1]; |
3002 |
}; |
}; |
3003 |
// |
// |
3004 |
// |
// |
3872 |
pcasp4b->Draw("f"); |
pcasp4b->Draw("f"); |
3873 |
pcasp4b->Draw(); |
pcasp4b->Draw(); |
3874 |
}; |
}; |
3875 |
Float_t alfa = 1.2020334; |
// Float_t alfax = 1.2020334; |
3876 |
|
Float_t alfax = 1.22157778; |
3877 |
|
Float_t alfay = 1.27393111; |
3878 |
Float_t lcrd = 0.1815/2.; |
Float_t lcrd = 0.1815/2.; |
3879 |
Float_t wcrd = 0.008; |
Float_t wcrd = 0.008; |
3880 |
if ( true ){ |
if ( true ){ |
4085 |
// |
// |
4086 |
// Float_t cardcx = 0.143168*var.sfx; |
// Float_t cardcx = 0.143168*var.sfx; |
4087 |
//Float_t cardcy = 0.1475*var.sfy; |
//Float_t cardcy = 0.1475*var.sfy; |
4088 |
Float_t cardcx = 0.153168*var.sfx; |
// |
4089 |
Float_t cardcy = 0.1575*var.sfy; |
// Float_t cardcx = 0.153168*var.sfx; |
4090 |
Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)}; |
// |
4091 |
Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)}; |
Float_t cardcx = (0.19123*(1.-lcrd*cos(alfax)))*var.sfx; |
4092 |
Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)}; |
// Float_t cardcy = 0.1575*var.sfy; |
4093 |
Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)}; |
Float_t cardcy = (0.179212*(1.-lcrd*sin(alfax)))*var.sfy; |
4094 |
|
Float_t acrdx[4] = {-lcrd*cos(alfax), lcrd*cos(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)}; |
4095 |
|
Float_t acrdy[4] = {-lcrd*sin(alfax), lcrd*sin(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)}; |
4096 |
|
Float_t bcrdx[4] = { lcrd*cos(alfax), lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), lcrd*cos(alfax)}; |
4097 |
|
Float_t bcrdy[4] = { lcrd*sin(alfax), lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), lcrd*sin(alfax)}; |
4098 |
|
|
4099 |
// |
// |
4100 |
// CARD3 X/ Y |
// CARD3 X/ Y |
4154 |
}; |
}; |
4155 |
|
|
4156 |
if ( true ){ |
if ( true ){ |
4157 |
Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)}; |
Float_t acrdx[4] = {-lcrd*cos(alfay), lcrd*cos(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)}; |
4158 |
Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)}; |
Float_t acrdy[4] = {-lcrd*sin(alfay), lcrd*sin(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)}; |
4159 |
Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)}; |
Float_t bcrdx[4] = { lcrd*cos(alfay), lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), lcrd*cos(alfay)}; |
4160 |
Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)}; |
Float_t bcrdy[4] = { lcrd*sin(alfay), lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), lcrd*sin(alfay)}; |
4161 |
// |
// |
4162 |
// CARD - Y-view |
// CARD - Y-view |
4163 |
// |
// |
4164 |
Float_t cardcx = 0.12*var.sfx; |
// Float_t cardcx = 0.12*var.sfx; |
4165 |
Float_t cardcy = 0.1475*var.sfy; |
Float_t cardcx = (0.16014*(1.-lcrd*cos(alfay)))*var.sfx; |
4166 |
|
// Float_t cardcy = 0.178818*var.sfy; |
4167 |
|
Float_t cardcy = (0.178818*(1.-lcrd*sin(alfay)))*var.sfy; |
4168 |
|
// Float_t cardcy = 0.1475*var.sfy; |
4169 |
// |
// |
4170 |
// CARD4 X Y/ |
// CARD4 X Y/ |
4171 |
// |
// |
4264 |
// |
// |
4265 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
4266 |
for ( Int_t j = 0; j<3; j++ ) { |
for ( Int_t j = 0; j<3; j++ ) { |
4267 |
if ( L2->S4adc != 32. ) ms4[j] = L2->S4calibrated; |
if ( L2->GetS4Level2()->S4adc != 32. ) ms4[j] = L2->GetS4Level2()->S4calibrated; |
4268 |
}; |
}; |
4269 |
}; |
}; |
4270 |
// |
// |
4349 |
}; |
}; |
4350 |
}; |
}; |
4351 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
4352 |
yUpperTrig = (Int_t)L2->trigPhysics; |
yUpperTrig = (Int_t)L2->GetNDLevel2()->trigPhysics; |
4353 |
yUpperBk = (Int_t)L2->upperBack; |
yUpperBk = (Int_t)L2->GetNDLevel2()->upperBack; |
4354 |
yBottomBk = (Int_t)L2->bottomBack; |
yBottomBk = (Int_t)L2->GetNDLevel2()->bottomBack; |
4355 |
}; |
}; |
4356 |
// |
// |
4357 |
var.trup = yUpperTrig; |
var.trup = yUpperTrig; |
4658 |
// |
// |
4659 |
// singlets X |
// singlets X |
4660 |
// |
// |
4661 |
for (Int_t sing = 0; sing < L2->nclsx(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){ |
4662 |
TClonesArray &t = *(L2->SingletX); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletX); |
4663 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4664 |
x = (singlet->coord[0]+singlet->coord[1])/2.; |
x = (singlet->coord[0]+singlet->coord[1])/2.; |
4665 |
// |
// |
4683 |
// |
// |
4684 |
// singlets Y |
// singlets Y |
4685 |
// |
// |
4686 |
for (Int_t sing = 0; sing < L2->nclsy(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){ |
4687 |
TClonesArray &t = *(L2->SingletY); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletY); |
4688 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4689 |
// |
// |
4690 |
Int_t planepad = (singlet->plane - 1)* 2; |
Int_t planepad = (singlet->plane - 1)* 2; |
4729 |
dcol = 2; |
dcol = 2; |
4730 |
}; |
}; |
4731 |
// |
// |
4732 |
if ( L2->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
4733 |
for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
4734 |
TrkTrack *track = L2->GetTrack(nt); |
PamTrack *ptrack= L2->GetTrack(nt); |
4735 |
|
TrkTrack *track = ptrack->GetTrkTrack(); |
4736 |
if ( nt == 0 ){ |
if ( nt == 0 ){ |
4737 |
var.rig = 0.; |
var.rig = 0.; |
4738 |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
4828 |
// |
// |
4829 |
// first of all plot crosses relatives to tracks |
// first of all plot crosses relatives to tracks |
4830 |
// |
// |
4831 |
if ( L2->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
4832 |
for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
4833 |
TrkTrack *track = L2->GetTrack(nt); |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
4834 |
for (Int_t plane = 0; plane<6; plane++){ |
for (Int_t plane = 0; plane<6; plane++){ |
4835 |
// |
// |
4836 |
x = track->xm[plane]; |
x = track->xm[plane]; |
4876 |
// |
// |
4877 |
// try to plot crosses relative to singlets |
// try to plot crosses relative to singlets |
4878 |
// |
// |
4879 |
if ( L2->nclsx() > 0 && L2->nclsy() > 0 ){ |
if ( L2->GetTrkLevel2()->nclsx() > 0 && L2->GetTrkLevel2()->nclsy() > 0 ){ |
4880 |
for (Int_t plane = 1; plane<7; plane++){ |
for (Int_t plane = 1; plane<7; plane++){ |
4881 |
// |
// |
4882 |
// count how many singlet in the x and y view for this plane: |
// count how many singlet in the x and y view for this plane: |
4890 |
TArrayF *array2 = new TArrayF(5000); |
TArrayF *array2 = new TArrayF(5000); |
4891 |
TArrayF *sigarrax = new TArrayF(5000); |
TArrayF *sigarrax = new TArrayF(5000); |
4892 |
TArrayF *sigarray = new TArrayF(5000); |
TArrayF *sigarray = new TArrayF(5000); |
4893 |
for (Int_t sing = 0; sing < L2->nclsx(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){ |
4894 |
TClonesArray &t = *(L2->SingletX); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletX); |
4895 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4896 |
if ( singlet->plane == plane ){ |
if ( singlet->plane == plane ){ |
4897 |
arrax->AddAt(((singlet->coord[0]+singlet->coord[1])/2.),totsx); |
arrax->AddAt(((singlet->coord[0]+singlet->coord[1])/2.),totsx); |
4920 |
totsx++; |
totsx++; |
4921 |
}; |
}; |
4922 |
}; |
}; |
4923 |
for (Int_t sing = 0; sing < L2->nclsy(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){ |
4924 |
TClonesArray &t = *(L2->SingletY); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletY); |
4925 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4926 |
if ( singlet->plane == plane ){ |
if ( singlet->plane == plane ){ |
4927 |
array1->AddAt(singlet->coord[0],totsy); |
array1->AddAt(singlet->coord[0],totsy); |
5146 |
// |
// |
5147 |
// |
// |
5148 |
// |
// |
5149 |
|
if ( var.CALO && false ){ |
5150 |
|
if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){ |
5151 |
|
Float_t calx[22]; |
5152 |
|
Float_t caly[22]; |
5153 |
|
Float_t calzx[22]; |
5154 |
|
Float_t calzy[22]; |
5155 |
|
Float_t zpiano[22]; |
5156 |
|
zpiano[0] = (CTZ+118.)*var.sfy/1000.; |
5157 |
|
for (Int_t plane = 1; plane < 22; plane++){ |
5158 |
|
if ( !(plane%2) ){ |
5159 |
|
zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; |
5160 |
|
}else { |
5161 |
|
zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; |
5162 |
|
}; |
5163 |
|
}; |
5164 |
|
for (Int_t plane = 0; plane < 22; plane++){ |
5165 |
|
calx[plane] = (L2->GetCaloLevel2()->cbar[plane][0]/100.)*var.sfx + var.xxvc;; |
5166 |
|
caly[plane] = (L2->GetCaloLevel2()->cbar[plane][1]/100.)*var.sfx + var.xyvc; |
5167 |
|
// calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; |
5168 |
|
calzx[plane] = zpiano[plane] + var.yxvc; |
5169 |
|
calzy[plane] = zpiano[plane] + var.yyvc; |
5170 |
|
// printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]); |
5171 |
|
}; |
5172 |
|
// |
5173 |
|
// Calorimeter track |
5174 |
|
// |
5175 |
|
Int_t trcol = 30; |
5176 |
|
if ( var.bw ){ |
5177 |
|
trcol = 14; |
5178 |
|
} else { |
5179 |
|
trcol = 44; |
5180 |
|
}; |
5181 |
|
thefigure->cd(); |
5182 |
|
TPolyLine *trakx = new TPolyLine(22,calx,calzx); |
5183 |
|
trakx->SetLineColor(trcol); |
5184 |
|
if ( L2->GetCaloLevel2()->fitmode[0] == 1 ) trakx->SetLineStyle(3); |
5185 |
|
if ( L2->GetCaloLevel2()->fitmode[0] == 2 ) trakx->SetLineStyle(4); |
5186 |
|
trakx->SetLineWidth(2); |
5187 |
|
trakx->Draw(); |
5188 |
|
TPolyLine *traky = new TPolyLine(22,caly,calzy); |
5189 |
|
traky->SetLineColor(trcol); |
5190 |
|
if ( L2->GetCaloLevel2()->fitmode[1] == 1 ) traky->SetLineStyle(3); |
5191 |
|
if ( L2->GetCaloLevel2()->fitmode[1] == 2 ) traky->SetLineStyle(4); |
5192 |
|
traky->SetLineWidth(2); |
5193 |
|
traky->Draw(); |
5194 |
|
}; |
5195 |
|
if ( L2->GetCaloLevel2()->npcfit[2] > 0 ){ |
5196 |
|
Float_t calx[22]; |
5197 |
|
Float_t caly[22]; |
5198 |
|
Float_t calzx[22]; |
5199 |
|
Float_t calzy[22]; |
5200 |
|
Float_t zpiano[22]; |
5201 |
|
zpiano[0] = (CTZ+118.)*var.sfy/1000.; |
5202 |
|
for (Int_t plane = 1; plane < 22; plane++){ |
5203 |
|
if ( !(plane%2) ){ |
5204 |
|
zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; |
5205 |
|
}else { |
5206 |
|
zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; |
5207 |
|
}; |
5208 |
|
}; |
5209 |
|
// |
5210 |
|
// |
5211 |
|
CaloTrkVar *ctra = L2->GetCaloStoredTrack(-1); |
5212 |
|
// |
5213 |
|
for (Int_t plane = 0; plane < 22; plane++){ |
5214 |
|
calx[plane] = (ctra->tbar[plane][0]/100.)*var.sfx + var.xxvc;; |
5215 |
|
caly[plane] = (ctra->tbar[plane][1]/100.)*var.sfx + var.xyvc; |
5216 |
|
// calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; |
5217 |
|
calzx[plane] = zpiano[plane] + var.yxvc; |
5218 |
|
calzy[plane] = zpiano[plane] + var.yyvc; |
5219 |
|
// printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]); |
5220 |
|
}; |
5221 |
|
// |
5222 |
|
// Calorimeter track |
5223 |
|
// |
5224 |
|
Int_t trcol = 30; |
5225 |
|
if ( var.bw ){ |
5226 |
|
trcol = 16; |
5227 |
|
} else { |
5228 |
|
trcol = 46; |
5229 |
|
}; |
5230 |
|
thefigure->cd(); |
5231 |
|
TPolyLine *trakx = new TPolyLine(22,calx,calzx); |
5232 |
|
trakx->SetLineColor(trcol); |
5233 |
|
trakx->SetLineStyle(3); |
5234 |
|
trakx->SetLineWidth(2); |
5235 |
|
trakx->Draw(); |
5236 |
|
TPolyLine *traky = new TPolyLine(22,caly,calzy); |
5237 |
|
traky->SetLineColor(trcol); |
5238 |
|
traky->SetLineStyle(3); |
5239 |
|
traky->SetLineWidth(2); |
5240 |
|
traky->Draw(); |
5241 |
|
}; |
5242 |
|
}; |
5243 |
|
// |
5244 |
if ( !var.TRK || level.file != 2 ) return; |
if ( !var.TRK || level.file != 2 ) return; |
5245 |
// |
// |
5246 |
if ( L2->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
5247 |
for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
5248 |
TrkTrack *track = L2->GetTrack(nt); |
|
5249 |
|
// TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
5250 |
|
PamTrack *ptrack = L2->GetTrack(nt); |
5251 |
|
TrkTrack *track = ptrack->GetTrkTrack(); |
5252 |
Int_t npoint = 100; |
Int_t npoint = 100; |
5253 |
Float_t zin[100]; |
Float_t zin[100]; |
5254 |
Double_t xout[100]; |
Double_t xout[100]; |
5318 |
}; |
}; |
5319 |
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; |
5320 |
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; |
5321 |
|
// printf("tx[e] %f ty [e] %f tzx %f tzy %f \n",tx[e],ty[e],tzx[e],tzy[e]); |
5322 |
}; |
}; |
5323 |
// |
// |
5324 |
// From S1 to CALO |
// From S1 to CALO |
5868 |
// |
// |
5869 |
stringstream xvev; |
stringstream xvev; |
5870 |
stringstream yvev; |
stringstream yvev; |
5871 |
for (Int_t ii = 0; ii < L2->nstrip; ii++){ |
for (Int_t ii = 0; ii < L2->GetCaloLevel2()->nstrip; ii++){ |
5872 |
Int_t colo; |
Int_t colo; |
5873 |
Int_t l; |
Int_t l; |
5874 |
Int_t m; |
Int_t m; |
5875 |
Int_t n; |
Int_t n; |
5876 |
Float_t mip = L2->DecodeEstrip(ii,l,m,n); |
Float_t mip = L2->GetCaloLevel1()->DecodeEstrip(ii,l,m,n); |
5877 |
if ( var.bw ){ |
if ( var.bw ){ |
5878 |
colo = -1; |
colo = -1; |
5879 |
} else { |
} else { |
5907 |
}; |
}; |
5908 |
pd1->Update(); |
pd1->Update(); |
5909 |
pd2->Update(); |
pd2->Update(); |
5910 |
var.qtot=(int)L2->qtot; |
var.qtot=(int)L2->GetCaloLevel2()->qtot; |
5911 |
var.nstrip=(int)L2->nstrip; |
var.nstrip=(int)L2->GetCaloLevel2()->nstrip; |
5912 |
}; |
}; |
5913 |
} |
} |
5914 |
|
|