83 |
thefigure = &figure; |
thefigure = &figure; |
84 |
checkctrlword(); |
checkctrlword(); |
85 |
var.selex = false; |
var.selex = false; |
86 |
|
var.showall = false; |
87 |
|
|
88 |
|
var.showsi = false; |
89 |
|
var.shownd = false; |
90 |
|
var.shows4 = false; |
91 |
|
var.showorb = false; |
92 |
|
var.showtof = false; |
93 |
|
var.showtrg = false; |
94 |
|
var.showtrk = false; |
95 |
|
var.showcal = false; |
96 |
|
var.showrun = false; |
97 |
|
var.showac = false; |
98 |
} |
} |
99 |
|
|
100 |
void FEVdetector::checkctrlword(){ |
void FEVdetector::checkctrlword(){ |
104 |
var.RUN = 1; |
var.RUN = 1; |
105 |
var.TRK = 0; |
var.TRK = 0; |
106 |
var.ORB = 1; |
var.ORB = 1; |
107 |
var.TRG = 0; |
var.TRG = 1; |
108 |
var.CALO = 0; |
var.CALO = 0; |
109 |
|
var.CALOT = 0; |
110 |
var.S4 = 0; |
var.S4 = 0; |
111 |
var.ND = 0; |
var.ND = 0; |
112 |
var.INFOS = 0; |
var.INFOS = 0; |
146 |
}; |
}; |
147 |
|
|
148 |
void FEVdetector::GetWindow(){ |
void FEVdetector::GetWindow(){ |
|
otr->GetEntry(maxevent); |
|
149 |
// |
// |
150 |
|
if ( level.file == 2 ){ |
151 |
|
// printf("0qui\n"); |
152 |
|
L2->GetEntry(minevent); |
153 |
|
} else { |
154 |
|
otr->GetEntry(minevent); |
155 |
|
} |
156 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
157 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
158 |
lastevno = (int)ph->Counter; |
firstevno = (int)ph->Counter; |
159 |
} else { |
} else { |
160 |
if ( var.ORB ){ |
if ( var.ORB ){ |
161 |
lastevno = L2->GetOrbitalInfo()->pkt_num; |
firstevno = L2->GetOrbitalInfo()->pkt_num; |
162 |
} else { |
} else { |
163 |
lastevno = 0; |
firstevno = 0; |
164 |
}; |
}; |
165 |
}; |
}; |
166 |
otr->GetEntry(minevent); |
// |
167 |
|
if ( level.file == 2 ){ |
168 |
|
// printf("1qui\n"); |
169 |
|
L2->GetEntry(maxevent); |
170 |
|
} else { |
171 |
|
otr->GetEntry(maxevent); |
172 |
|
} |
173 |
|
// |
174 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
175 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
176 |
firstevno = (int)ph->Counter; |
lastevno = (int)ph->Counter; |
177 |
} else { |
} else { |
178 |
if ( var.ORB ){ |
if ( var.ORB ){ |
179 |
firstevno = L2->GetOrbitalInfo()->pkt_num; |
lastevno = L2->GetOrbitalInfo()->pkt_num; |
180 |
} else { |
} else { |
181 |
firstevno = 0; |
lastevno = 0; |
182 |
}; |
}; |
183 |
}; |
}; |
184 |
|
// |
185 |
} |
} |
186 |
|
|
187 |
void FEVdetector::ClearVariables(){ |
void FEVdetector::ClearVariables(){ |
206 |
void FEVdetector::GetEntry(Int_t i){ |
void FEVdetector::GetEntry(Int_t i){ |
207 |
thisentry = i; |
thisentry = i; |
208 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
209 |
|
L2->Clear(); |
210 |
|
// printf("qui\n"); |
211 |
L2->GetEntry(i); |
L2->GetEntry(i); |
212 |
ShowInfo("RunInfo"); |
if ( var.showall ){ |
213 |
ShowInfo("SoftInfo"); |
ShowInfo("RunInfo"); |
214 |
ShowInfo("TrigLevel2"); |
ShowInfo("SoftInfo"); |
215 |
ShowInfo("OrbitalInfo"); |
ShowInfo("OrbitalInfo"); |
216 |
ShowInfo("ToFLevel2"); |
ShowInfo("TrigLevel2"); |
217 |
ShowInfo("TrkLevel2"); |
ShowInfo("ToFLevel2"); |
218 |
ShowInfo("AcLevel2"); |
ShowInfo("TrkLevel2"); |
219 |
ShowInfo("CaloLevel2"); |
ShowInfo("AcLevel2"); |
220 |
ShowInfo("CaloLevel1"); |
ShowInfo("CaloLevel2"); |
221 |
ShowInfo("S4Level2"); |
ShowInfo("CaloLevel1"); |
222 |
ShowInfo("NDLevel2"); |
ShowInfo("S4Level2"); |
223 |
|
ShowInfo("NDLevel2"); |
224 |
|
} else { |
225 |
|
if ( var.showrun ) ShowInfo("RunInfo"); |
226 |
|
if ( var.showsi ) ShowInfo("SoftInfo"); |
227 |
|
if ( var.showorb ) ShowInfo("OrbitalInfo"); |
228 |
|
if ( var.showtrg ) ShowInfo("TrigLevel2"); |
229 |
|
if ( var.showtof ) ShowInfo("ToFLevel2"); |
230 |
|
if ( var.showtrk ) ShowInfo("TrkLevel2"); |
231 |
|
if ( var.showac ) ShowInfo("AcLevel2"); |
232 |
|
if ( var.showcal ) ShowInfo("CaloLevel2"); |
233 |
|
if ( var.showcal ) ShowInfo("CaloLevel1"); |
234 |
|
if ( var.shows4 ) ShowInfo("S4Level2"); |
235 |
|
if ( var.shownd ) ShowInfo("NDLevel2"); |
236 |
|
}; |
237 |
} else { |
} else { |
238 |
otr->GetEntry(i); |
otr->GetEntry(i); |
239 |
|
if ( var.showall ){ |
240 |
|
ShowInfo("Pscu"); |
241 |
|
ShowInfo("Trigger"); |
242 |
|
ShowInfo("Tof"); |
243 |
|
ShowInfo("Tracker"); |
244 |
|
ShowInfo("Anticounter"); |
245 |
|
ShowInfo("Calorimeter"); |
246 |
|
ShowInfo("S4"); |
247 |
|
ShowInfo("Neutron"); |
248 |
|
} else { |
249 |
|
if ( var.showorb ) ShowInfo("Pscu"); |
250 |
|
if ( var.showtrg ) ShowInfo("Trigger"); |
251 |
|
if ( var.showtof ) ShowInfo("Tof"); |
252 |
|
if ( var.showtrk ) ShowInfo("Tracker"); |
253 |
|
if ( var.showac ) ShowInfo("Anticounter"); |
254 |
|
if ( var.showcal ) ShowInfo("Calorimeter"); |
255 |
|
if ( var.shows4 ) ShowInfo("S4"); |
256 |
|
if ( var.shownd ) ShowInfo("Neutron"); |
257 |
|
}; |
258 |
}; |
}; |
259 |
} |
} |
260 |
|
|
384 |
// TObjArray *leaf_array = 0; |
// TObjArray *leaf_array = 0; |
385 |
// |
// |
386 |
if ( !strcmp(detector.Data(),"RunInfo") || !strcmp(detector.Data(),"SoftInfo") ){ |
if ( !strcmp(detector.Data(),"RunInfo") || !strcmp(detector.Data(),"SoftInfo") ){ |
387 |
if ( runtree ) b1 = runtree->FindBranch(detector.Data()); |
if ( L2->GetRunTree() ) b1 = L2->GetRunTree()->FindBranch(detector.Data()); |
388 |
} else { |
} else { |
389 |
b1 = otr->FindBranch(detector.Data()); |
b1 = otr->FindBranch(detector.Data()); |
390 |
}; |
}; |
417 |
Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()]; |
Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()]; |
418 |
Int_t length = min(len,dlen); |
Int_t length = min(len,dlen); |
419 |
// |
// |
420 |
// printf("Branches : type is %i type is %i tb getname %s slen %i slength %i\n",atype,type,tb->GetName(),len,length); |
// printf("Branches : type is %i type is %i tb getname %s slen %i slength %i\n",atype,type,tb->GetName(),len,length); |
421 |
switch (type){ |
switch (type){ |
422 |
case 0: |
case 0: |
423 |
// |
// |
450 |
// |
// |
451 |
// Unsigned integer |
// Unsigned integer |
452 |
// |
// |
453 |
if ( atype == -7 || atype == 13 ){ |
if ( atype == -7 || atype == 13 || atype == -9 || atype == -8 || atype == 12 ){ |
454 |
while ( j < length ){ |
while ( j < length ){ |
455 |
if ( j < length -1 ){ |
if ( j < length -1 ){ |
456 |
sprintf(o,"%s %i ,",o,(UInt_t)tb->GetValue(j,0)); |
sprintf(o,"%s %u ,",o,(UInt_t)tb->GetValue(j,0)); |
457 |
} else { |
} else { |
458 |
sprintf(o,"%s %i",o,(UInt_t)tb->GetValue(j,0)); |
sprintf(o,"%s %u",o,(UInt_t)tb->GetValue(j,0)); |
459 |
}; |
}; |
460 |
j++; |
j++; |
461 |
}; |
}; |
477 |
// Strings |
// Strings |
478 |
// |
// |
479 |
if ( atype == 45 ){ |
if ( atype == 45 ){ |
480 |
// TString *stringa = (TString*)(tb->GetValuePointer()); |
// TObjArray *cl = (TObjArray*)(tb->GetInfo()->GetOffsets())[tb->GetID()];//tb->GetValuePointer(); |
481 |
|
// TString *stringa = (TString*)(*cl)[0]; |
482 |
|
// TBranchElement *utb = (TBranchElement*)tb->GetBranchCount(); |
483 |
|
// TString** stringa = (TString*)(&tb->GetValuePointer()); |
484 |
|
//TStreamerElement *tste = (TStreamerElement*)tb->GetInfo()->GetCurrentElement(); |
485 |
|
|
486 |
|
// char *ladd; |
487 |
|
// ladd = tb->GetValuePointer() |
488 |
|
// TString *stringa = (TString*)((tste->GetOffset())); |
489 |
|
// TString& mstr = *stringa; |
490 |
|
// printf(" la mia stringa %s \n",mstr.Data()); |
491 |
|
// printf(" offset %i \n",(Int_t)utb->GetValue(0,0)); |
492 |
// int pointer = (tb->GetInfo()->GetOffsets())[tb->GetID()]; |
// int pointer = (tb->GetInfo()->GetOffsets())[tb->GetID()]; |
493 |
// TString *stringa = (TString*)(tb->GetInfo()->GetOffsets())[tb->GetID()]; |
// TString *stringa = (TString*)(tb->GetInfo()->GetOffsets())[tb->GetID()]; |
494 |
// TString *stringa = (TString*)tb->GetAddress(); |
// TString *stringa = (TString*)tb->GetAddress(); |
495 |
// printf(" address 0x%X \n",tb->GetAddress()); |
// printf(" address 0x%X \n",tb->GetAddress()); |
496 |
// printf(" pointer 0x%X \n",tb->GetValuePointer()); |
// printf(" pointer 0x%X \n",tb->GetValuePointer()); |
497 |
// printf(" object 0x%X \n",tb->GetObject()); |
// printf(" object 0x%X \n",tb->GetObject()); |
498 |
// printf("stringa %s lung %i\n",stringa->Data(),stringa->Length()); |
// printf("stringa %s lung %i\n",stringa.Data(),stringa.Length()); |
499 |
// TLeaf *striglia = tb->FindLeaf(tb->GetName()); |
// TLeaf *striglia = tb->FindLeaf(tb->GetName()); |
500 |
// if ( striglia ){ |
// if ( striglia ){ |
501 |
// char *pointer = (char *)striglia->GetValuePointer(); |
// char *pointer = (char *)striglia->GetValuePointer(); |
502 |
// TString *pr= (TString*)pointer; |
// TString *pr= (TString*)pointer; |
503 |
// printf("ciao %s \n",pr->Data()); |
// printf("ciao %s \n",pr->Data()); |
504 |
// }; |
// }; |
505 |
sprintf(o,"%s TString ",o); |
sprintf(o,"%s TString - not implemented yet -",o); |
506 |
}; |
}; |
507 |
// |
// |
508 |
// TArray |
// TArray |
602 |
// }; |
// }; |
603 |
// sprintf(o,"%s\n",o); |
// sprintf(o,"%s\n",o); |
604 |
// |
// |
605 |
sprintf(o,"%s TArray ",o); |
sprintf(o,"%s TArray - not implemented yet -",o); |
606 |
// |
// |
607 |
}; |
}; |
608 |
// |
// |
660 |
// |
// |
661 |
// Integer |
// Integer |
662 |
// |
// |
663 |
if ( satype == -17 ){ |
if ( satype == -17 || satype == -9 ){ |
664 |
// |
// |
665 |
setcolor(col,RESET, BLUE, WHITE); |
setcolor(col,RESET, BLUE, WHITE); |
666 |
setcolor(col2,RESET, BLACK, WHITE); |
setcolor(col2,RESET, BLACK, WHITE); |
893 |
trcs = (TString)trc.str().c_str(); |
trcs = (TString)trc.str().c_str(); |
894 |
} else { |
} else { |
895 |
headcold = headc; |
headcold = headc; |
896 |
|
if ( var.RUN ){ |
897 |
|
var.idrun = L2->GetRunInfo()->ID; |
898 |
|
var.idroot = L2->GetRunInfo()->ID_ROOT_L0; |
899 |
|
var.EVF = L2->GetRunInfo()->EV_FROM; |
900 |
|
}; |
901 |
if ( var.ORB ){ |
if ( var.ORB ){ |
902 |
headc = L2->GetOrbitalInfo()->pkt_num; |
headc = L2->GetOrbitalInfo()->pkt_num; |
903 |
OBT = L2->GetOrbitalInfo()->OBT; |
OBT = L2->GetOrbitalInfo()->OBT; |
1051 |
// |
// |
1052 |
} |
} |
1053 |
|
|
1054 |
TChain* FEVdetector::Load(TFile &mainfile){ |
TChain* FEVdetector::Load(TString file){ |
|
// |
|
|
file = &mainfile; |
|
1055 |
// |
// |
1056 |
L2 = new PamLevel2(); |
// file = &mainfile; |
1057 |
// |
// |
1058 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
1059 |
// |
// |
1060 |
printf(" %s \n",ddec.Data()); |
printf(" %s \n",ddec.Data()); |
1061 |
otr = L2->GetPamTree(gSystem->DirName(file->GetName()),file->GetName(),ddec.Data()); |
if ( !L2 ){ |
1062 |
runtree = L2->GetRunTree(gSystem->DirName(file->GetName()),file->GetName()); |
L2 = new PamLevel2("",file.Data(),ddec.Data()); |
1063 |
|
otr = L2->GetPamTree(); |
1064 |
|
printf(" l2 constructor\n"); |
1065 |
|
// printf(" abst %u obt %u qtot %f \n",L2->GetOrbitalInfo()->absTime,L2->GetOrbitalInfo()->OBT,L2->GetCaloLevel2()->qtot); |
1066 |
|
} else { |
1067 |
|
// |
1068 |
|
printf(" l2 already exist \n"); |
1069 |
|
otr = L2->GetPamTree(gSystem->DirName(file.Data()),file.Data(),ddec.Data()); |
1070 |
|
L2->GetRunTree(gSystem->DirName(file.Data()),file.Data()); |
1071 |
|
// |
1072 |
|
}; |
1073 |
|
// |
1074 |
// |
// |
1075 |
if ( !otr ) return(0); |
if ( !otr ) return(0); |
1076 |
// |
// |
1077 |
|
// otr->CanDeleteRefs(true); |
1078 |
|
// if ( runtree ) runtree->CanDeleteRefs(true); |
1079 |
|
// |
1080 |
} else { |
} else { |
1081 |
// |
// |
1082 |
// load calorimeter ADC2MIP conversion file |
// load calorimeter ADC2MIP conversion file |
1117 |
}; |
}; |
1118 |
// |
// |
1119 |
// |
// |
|
trigger = new pamela::trigger::TriggerEvent(); |
|
|
eh = new pamela::EventHeader(); |
|
|
ph = new pamela::PscuHeader(); |
|
|
// runinfo = new ItoRunInfo(file); |
|
|
// |
|
|
de = new pamela::calorimeter::CalorimeterEvent(); |
|
|
trk = new pamela::tracker::TrackerEvent(); |
|
|
ne = new pamela::neutron::NeutronEvent(); |
|
|
ace = new pamela::anticounter::AnticounterEvent(); |
|
|
s4 = new pamela::S4::S4Event(); |
|
|
tof = new pamela::tof::TofEvent(); |
|
|
// |
|
1120 |
// Load level0 file if the case |
// Load level0 file if the case |
1121 |
// |
// |
1122 |
if ( level.file == 0 || level.file == -1 ){ |
if ( level.file == 0 || level.file == -1 ){ |
1123 |
|
// |
1124 |
|
trigger = new pamela::trigger::TriggerEvent(); |
1125 |
|
eh = new pamela::EventHeader(); |
1126 |
|
ph = new pamela::PscuHeader(); |
1127 |
|
de = new pamela::calorimeter::CalorimeterEvent(); |
1128 |
|
trk = new pamela::tracker::TrackerEvent(); |
1129 |
|
ne = new pamela::neutron::NeutronEvent(); |
1130 |
|
ace = new pamela::anticounter::AnticounterEvent(); |
1131 |
|
s4 = new pamela::S4::S4Event(); |
1132 |
|
tof = new pamela::tof::TofEvent(); |
1133 |
|
// |
1134 |
otr = new TChain("Physics"); |
otr = new TChain("Physics"); |
1135 |
otr->Add(file->GetName(),-1); |
otr->Add(file.Data(),-1); |
1136 |
otr->SetBranchAddress("Trigger", &trigger); |
otr->SetBranchAddress("Trigger", &trigger); |
1137 |
otr->SetBranchAddress("Header", &eh); |
otr->SetBranchAddress("Header", &eh); |
1138 |
}; |
}; |
1908 |
void FEVdetector::ShowTOF(){ |
void FEVdetector::ShowTOF(){ |
1909 |
// |
// |
1910 |
// |
// |
|
// |
|
1911 |
if ( !var.TOF ) return; |
if ( !var.TOF ) return; |
1912 |
// |
// |
1913 |
Int_t tt = 0; |
Int_t tt = 0; |
2743 |
// |
// |
2744 |
if ( numtr >= repuntil-1 ) repeat = false; |
if ( numtr >= repuntil-1 ) repeat = false; |
2745 |
// |
// |
2746 |
ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr); |
// printf(" numtr is %i \n",numtr); |
2747 |
|
ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr); |
2748 |
//ptrack = L2->GetTrack(numtr); |
//ptrack = L2->GetTrack(numtr); |
2749 |
//ptt = ptrack->GetToFTrack(); |
//ptt = ptrack->GetToFTrack(); |
2750 |
}; |
}; |
5559 |
|
|
5560 |
void FEVdetector::ShowTrack(){ |
void FEVdetector::ShowTrack(){ |
5561 |
// |
// |
5562 |
|
if ( level.file != 2 ) return; |
5563 |
// |
// |
5564 |
// |
// |
5565 |
if ( var.CALO && false ){ |
// |
5566 |
|
if ( var.CALO && var.CALOT ){ |
5567 |
if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){ |
if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){ |
5568 |
Float_t calx[22]; |
Float_t calx[22]; |
5569 |
Float_t caly[22]; |
Float_t caly[22]; |
5658 |
}; |
}; |
5659 |
}; |
}; |
5660 |
// |
// |
5661 |
if ( !var.TRK || level.file != 2 ) return; |
if ( !var.TRK ) return; |
5662 |
// |
// |
5663 |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
5664 |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
5665 |
|
|
5666 |
// TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
// TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
5667 |
|
// printf("qui \n"); |
5668 |
PamTrack *ptrack = L2->GetTrack(nt); |
PamTrack *ptrack = L2->GetTrack(nt); |
5669 |
TrkTrack *track = ptrack->GetTrkTrack(); |
TrkTrack *track = ptrack->GetTrkTrack(); |
5670 |
|
// printf("qua \n"); |
5671 |
Int_t npoint = 100; |
Int_t npoint = 100; |
5672 |
Float_t zin[100]; |
Float_t zin[100]; |
5673 |
Double_t xout[100]; |
Double_t xout[100]; |
5875 |
Int_t se = 5; |
Int_t se = 5; |
5876 |
if ( !l && m%2 == 0 ) se = 3; |
if ( !l && m%2 == 0 ) se = 3; |
5877 |
if ( !l && m%2 != 0 ) se = 2; |
if ( !l && m%2 != 0 ) se = 2; |
5878 |
if ( l && m%2 == 0 ) se = 1; |
if ( l && m%2 != 0 ) se = 1; |
5879 |
if ( l && m%2 != 0 ) se = 0; |
if ( l && m%2 == 0 ) se = 0; |
5880 |
// |
// |
5881 |
// determine what kind of event we are going to analyze |
// determine what kind of event we are going to analyze |
5882 |
// |
// |
6083 |
Int_t se = 5; |
Int_t se = 5; |
6084 |
if (l == 0 && m%2 == 0) se = 3; |
if (l == 0 && m%2 == 0) se = 3; |
6085 |
if (l == 0 && m%2 != 0) se = 2; |
if (l == 0 && m%2 != 0) se = 2; |
6086 |
if (l == 1 && m%2 == 0) se = 1; |
if (l == 1 && m%2 != 0) se = 1; |
6087 |
if (l == 1 && m%2 != 0) se = 0; |
if (l == 1 && m%2 == 0) se = 0; |
6088 |
// |
// |
6089 |
// determine what kind of event we are going to analyze |
// determine what kind of event we are going to analyze |
6090 |
// |
// |