128 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
129 |
lastevno = (int)ph->Counter; |
lastevno = (int)ph->Counter; |
130 |
} else { |
} else { |
131 |
lastevno = oinfoL2->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
lastevno = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
132 |
}; |
}; |
133 |
otr->GetEntry(minevent); |
otr->GetEntry(minevent); |
134 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
135 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
136 |
firstevno = (int)ph->Counter; |
firstevno = (int)ph->Counter; |
137 |
} else { |
} else { |
138 |
firstevno = oinfoL2->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
firstevno = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
139 |
}; |
}; |
140 |
} |
} |
141 |
|
|
173 |
return((int)ph->Counter); |
return((int)ph->Counter); |
174 |
} else { |
} else { |
175 |
// 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! |
176 |
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! |
177 |
}; |
}; |
178 |
} |
} |
179 |
|
|
326 |
trcs = (TString)trc.str().c_str(); |
trcs = (TString)trc.str().c_str(); |
327 |
} else { |
} else { |
328 |
headcold = headc; |
headcold = headc; |
329 |
headc = oinfoL2->pkt_num; // to be changed as soon as we will have obt in the level2 file! |
headc = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have obt in the level2 file! |
330 |
OBT = oinfoL2->OBT; // to be changed as soon as we will have obt in the level2 file! |
OBT = L2->GetOrbitalInfo()->OBT; // to be changed as soon as we will have obt in the level2 file! |
331 |
DOBT = OBT - OOBT; |
DOBT = OBT - OOBT; |
332 |
OOBT = OBT; |
OOBT = OBT; |
333 |
if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0; |
if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0; |
336 |
// who gave the trigger? |
// who gave the trigger? |
337 |
// |
// |
338 |
calotrig = 0; |
calotrig = 0; |
339 |
if ( L2->patterntrig[0] ) calotrig = 1; |
if ( L2->GetTrigLevel2()->patterntrig[0] ) calotrig = 1; |
340 |
toftrig = 0; |
toftrig = 0; |
341 |
if ( L2->patterntrig[2] || L2->patterntrig[3] || L2->patterntrig[4] || L2->patterntrig[5] ) toftrig = 1; |
if ( L2->GetTrigLevel2()->patterntrig[2] || L2->GetTrigLevel2()->patterntrig[3] || L2->GetTrigLevel2()->patterntrig[4] || L2->GetTrigLevel2()->patterntrig[5] ) toftrig = 1; |
342 |
s4pulser = 0; |
s4pulser = 0; |
343 |
if ( L2->patterntrig[1] & (1<<0) ) s4pulser = 1; |
if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) s4pulser = 1; |
344 |
// |
// |
345 |
// TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns. |
// TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns. |
346 |
// S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug": |
// S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug": |
347 |
// |
// |
348 |
if ( !calotrig && !toftrig ) s4pulser = 1; |
if ( !calotrig && !toftrig ) s4pulser = 1; |
349 |
// |
// |
350 |
Int_t trigconf = L2->trigconf; |
Int_t trigconf = L2->GetTrigLevel2()->trigconf; |
351 |
stringstream trc; |
stringstream trc; |
352 |
trc.str(""); |
trc.str(""); |
353 |
if ( trigconf & (1<<0) ) trc << "TOF1"; |
if ( trigconf & (1<<0) ) trc << "TOF1"; |
488 |
magfie << pam_calib; |
magfie << pam_calib; |
489 |
magfie << "/trk-param/field_param-0/"; |
magfie << "/trk-param/field_param-0/"; |
490 |
// |
// |
491 |
L2->LoadField(magfie.str().c_str()); |
L2->GetTrkLevel2()->LoadField(magfie.str().c_str()); |
492 |
} else { |
} else { |
493 |
// |
// |
494 |
// load calorimeter ADC2MIP conversion file |
// load calorimeter ADC2MIP conversion file |
533 |
trigger = new pamela::trigger::TriggerEvent(); |
trigger = new pamela::trigger::TriggerEvent(); |
534 |
eh = new pamela::EventHeader(); |
eh = new pamela::EventHeader(); |
535 |
ph = new pamela::PscuHeader(); |
ph = new pamela::PscuHeader(); |
536 |
oinfoL2 = new OrbitalInfo(); |
// oinfoL2 = new OrbitalInfo(); |
537 |
runinfo = new ItoRunInfo(file); |
runinfo = new ItoRunInfo(file); |
538 |
// |
// |
539 |
de = new pamela::calorimeter::CalorimeterEvent(); |
de = new pamela::calorimeter::CalorimeterEvent(); |
548 |
otr->SetBranchAddress("Header", &eh); |
otr->SetBranchAddress("Header", &eh); |
549 |
}; |
}; |
550 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
551 |
otr->AddFriend("OrbitalInfo", file); |
// otr->AddFriend("OrbitalInfo", file); |
552 |
otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
// otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
553 |
runinfo->Read(0ULL); |
runinfo->Read(0ULL); |
554 |
}; |
}; |
555 |
// |
// |
2123 |
// |
// |
2124 |
var.tofraw = 0; |
var.tofraw = 0; |
2125 |
// |
// |
2126 |
repuntil = L2->ToFLevel2::ntrk(); |
repuntil = L2->GetToFLevel2()->ntrk(); |
2127 |
// printf("repuntil = %i \n",repuntil); |
// printf("repuntil = %i \n",repuntil); |
2128 |
//repuntil = L2->GetNTracks(); |
//repuntil = L2->GetNTracks(); |
2129 |
// |
// |
2138 |
// |
// |
2139 |
if ( repuntil == 1 || var.tofraw ){ |
if ( repuntil == 1 || var.tofraw ){ |
2140 |
numtr = 0; |
numtr = 0; |
2141 |
ptt = L2->GetToFTrkVar(0); |
ptt = L2->GetToFLevel2()->GetToFTrkVar(0); |
2142 |
repeat = false; |
repeat = false; |
2143 |
} else { |
} else { |
2144 |
// |
// |
2145 |
// |
// |
2146 |
if ( numtr >= repuntil-1 ) repeat = false; |
if ( numtr >= repuntil-1 ) repeat = false; |
2147 |
// |
// |
2148 |
ptt = L2->GetToFTrkVar(numtr); |
ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr); |
2149 |
}; |
}; |
2150 |
// |
// |
2151 |
xp11[0] = 0.; |
xp11[0] = 0.; |
2161 |
// |
// |
2162 |
Float_t adc[4][12]; |
Float_t adc[4][12]; |
2163 |
Float_t tdc[4][12]; |
Float_t tdc[4][12]; |
2164 |
L2->GetMatrix(numtr,adc,tdc); |
L2->GetToFLevel2()->GetMatrix(numtr,adc,tdc); |
2165 |
|
|
2166 |
// |
// |
2167 |
for ( Int_t i = 0; i<8; i++ ) { |
for ( Int_t i = 0; i<8; i++ ) { |
2805 |
// full infos from ac |
// full infos from ac |
2806 |
// |
// |
2807 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
2808 |
hitmapA = L2->hitmap[0]; |
hitmapA = L2->GetAcLevel2()->hitmap[0]; |
2809 |
hitmapB = L2->hitmap[1]; |
hitmapB = L2->GetAcLevel2()->hitmap[1]; |
2810 |
hitstatusA = L2->hitstatus[0]; |
hitstatusA = L2->GetAcLevel2()->hitstatus[0]; |
2811 |
hitstatusB = L2->hitstatus[1]; |
hitstatusB = L2->GetAcLevel2()->hitstatus[1]; |
2812 |
}; |
}; |
2813 |
// |
// |
2814 |
// |
// |
4065 |
// |
// |
4066 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
4067 |
for ( Int_t j = 0; j<3; j++ ) { |
for ( Int_t j = 0; j<3; j++ ) { |
4068 |
if ( L2->S4adc != 32. ) ms4[j] = L2->S4calibrated; |
if ( L2->GetS4Level2()->S4adc != 32. ) ms4[j] = L2->GetS4Level2()->S4calibrated; |
4069 |
}; |
}; |
4070 |
}; |
}; |
4071 |
// |
// |
4150 |
}; |
}; |
4151 |
}; |
}; |
4152 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
4153 |
yUpperTrig = (Int_t)L2->trigPhysics; |
yUpperTrig = (Int_t)L2->GetNDLevel2()->trigPhysics; |
4154 |
yUpperBk = (Int_t)L2->upperBack; |
yUpperBk = (Int_t)L2->GetNDLevel2()->upperBack; |
4155 |
yBottomBk = (Int_t)L2->bottomBack; |
yBottomBk = (Int_t)L2->GetNDLevel2()->bottomBack; |
4156 |
}; |
}; |
4157 |
// |
// |
4158 |
var.trup = yUpperTrig; |
var.trup = yUpperTrig; |
4459 |
// |
// |
4460 |
// singlets X |
// singlets X |
4461 |
// |
// |
4462 |
for (Int_t sing = 0; sing < L2->nclsx(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){ |
4463 |
TClonesArray &t = *(L2->SingletX); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletX); |
4464 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4465 |
x = (singlet->coord[0]+singlet->coord[1])/2.; |
x = (singlet->coord[0]+singlet->coord[1])/2.; |
4466 |
// |
// |
4484 |
// |
// |
4485 |
// singlets Y |
// singlets Y |
4486 |
// |
// |
4487 |
for (Int_t sing = 0; sing < L2->nclsy(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){ |
4488 |
TClonesArray &t = *(L2->SingletY); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletY); |
4489 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4490 |
// |
// |
4491 |
Int_t planepad = (singlet->plane - 1)* 2; |
Int_t planepad = (singlet->plane - 1)* 2; |
4530 |
dcol = 2; |
dcol = 2; |
4531 |
}; |
}; |
4532 |
// |
// |
4533 |
if ( L2->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
4534 |
for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
4535 |
TrkTrack *track = L2->GetTrack(nt); |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
4536 |
if ( nt == 0 ){ |
if ( nt == 0 ){ |
4537 |
var.rig = 0.; |
var.rig = 0.; |
4538 |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
4628 |
// |
// |
4629 |
// first of all plot crosses relatives to tracks |
// first of all plot crosses relatives to tracks |
4630 |
// |
// |
4631 |
if ( L2->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
4632 |
for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
4633 |
TrkTrack *track = L2->GetTrack(nt); |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
4634 |
for (Int_t plane = 0; plane<6; plane++){ |
for (Int_t plane = 0; plane<6; plane++){ |
4635 |
// |
// |
4636 |
x = track->xm[plane]; |
x = track->xm[plane]; |
4676 |
// |
// |
4677 |
// try to plot crosses relative to singlets |
// try to plot crosses relative to singlets |
4678 |
// |
// |
4679 |
if ( L2->nclsx() > 0 && L2->nclsy() > 0 ){ |
if ( L2->GetTrkLevel2()->nclsx() > 0 && L2->GetTrkLevel2()->nclsy() > 0 ){ |
4680 |
for (Int_t plane = 1; plane<7; plane++){ |
for (Int_t plane = 1; plane<7; plane++){ |
4681 |
// |
// |
4682 |
// 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: |
4690 |
TArrayF *array2 = new TArrayF(5000); |
TArrayF *array2 = new TArrayF(5000); |
4691 |
TArrayF *sigarrax = new TArrayF(5000); |
TArrayF *sigarrax = new TArrayF(5000); |
4692 |
TArrayF *sigarray = new TArrayF(5000); |
TArrayF *sigarray = new TArrayF(5000); |
4693 |
for (Int_t sing = 0; sing < L2->nclsx(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){ |
4694 |
TClonesArray &t = *(L2->SingletX); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletX); |
4695 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4696 |
if ( singlet->plane == plane ){ |
if ( singlet->plane == plane ){ |
4697 |
arrax->AddAt(((singlet->coord[0]+singlet->coord[1])/2.),totsx); |
arrax->AddAt(((singlet->coord[0]+singlet->coord[1])/2.),totsx); |
4720 |
totsx++; |
totsx++; |
4721 |
}; |
}; |
4722 |
}; |
}; |
4723 |
for (Int_t sing = 0; sing < L2->nclsy(); sing++){ |
for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){ |
4724 |
TClonesArray &t = *(L2->SingletY); |
TClonesArray &t = *(L2->GetTrkLevel2()->SingletY); |
4725 |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
TrkSinglet *singlet = (TrkSinglet*)t[sing]; |
4726 |
if ( singlet->plane == plane ){ |
if ( singlet->plane == plane ){ |
4727 |
array1->AddAt(singlet->coord[0],totsy); |
array1->AddAt(singlet->coord[0],totsy); |
4948 |
// |
// |
4949 |
if ( !var.TRK || level.file != 2 ) return; |
if ( !var.TRK || level.file != 2 ) return; |
4950 |
// |
// |
4951 |
if ( L2->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
4952 |
for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
4953 |
TrkTrack *track = L2->GetTrack(nt); |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
4954 |
Int_t npoint = 100; |
Int_t npoint = 100; |
4955 |
Float_t zin[100]; |
Float_t zin[100]; |
4956 |
Double_t xout[100]; |
Double_t xout[100]; |
5569 |
// |
// |
5570 |
stringstream xvev; |
stringstream xvev; |
5571 |
stringstream yvev; |
stringstream yvev; |
5572 |
for (Int_t ii = 0; ii < L2->nstrip; ii++){ |
for (Int_t ii = 0; ii < L2->GetCaloLevel2()->nstrip; ii++){ |
5573 |
Int_t colo; |
Int_t colo; |
5574 |
Int_t l; |
Int_t l; |
5575 |
Int_t m; |
Int_t m; |
5576 |
Int_t n; |
Int_t n; |
5577 |
Float_t mip = L2->DecodeEstrip(ii,l,m,n); |
Float_t mip = L2->GetCaloLevel1()->DecodeEstrip(ii,l,m,n); |
5578 |
if ( var.bw ){ |
if ( var.bw ){ |
5579 |
colo = -1; |
colo = -1; |
5580 |
} else { |
} else { |
5608 |
}; |
}; |
5609 |
pd1->Update(); |
pd1->Update(); |
5610 |
pd2->Update(); |
pd2->Update(); |
5611 |
var.qtot=(int)L2->qtot; |
var.qtot=(int)L2->GetCaloLevel2()->qtot; |
5612 |
var.nstrip=(int)L2->nstrip; |
var.nstrip=(int)L2->GetCaloLevel2()->nstrip; |
5613 |
}; |
}; |
5614 |
} |
} |
5615 |
|
|