--- eventviewer/flight/src/FEVdetector.cpp 2007/03/20 12:49:55 1.16 +++ eventviewer/flight/src/FEVdetector.cpp 2007/11/08 11:05:34 1.21 @@ -83,6 +83,18 @@ thefigure = &figure; checkctrlword(); var.selex = false; + var.showall = false; + + var.showsi = false; + var.shownd = false; + var.shows4 = false; + var.showorb = false; + var.showtof = false; + var.showtrg = false; + var.showtrk = false; + var.showcal = false; + var.showrun = false; + var.showac = false; } void FEVdetector::checkctrlword(){ @@ -92,7 +104,7 @@ var.RUN = 1; var.TRK = 0; var.ORB = 1; - var.TRG = 0; + var.TRG = 1; var.CALO = 0; var.CALOT = 0; var.S4 = 0; @@ -134,41 +146,42 @@ }; void FEVdetector::GetWindow(){ - printf(" ah \n"); // if ( level.file == 2 ){ - L2->GetEntry(maxevent); + // printf("0qui\n"); + L2->GetEntry(minevent); } else { - otr->GetEntry(maxevent); + otr->GetEntry(minevent); } - // if ( level.file < 2 ){ ph = eh->GetPscuHeader(); - lastevno = (int)ph->Counter; + firstevno = (int)ph->Counter; } else { if ( var.ORB ){ - lastevno = L2->GetOrbitalInfo()->pkt_num; + firstevno = L2->GetOrbitalInfo()->pkt_num; } else { - lastevno = 0; + firstevno = 0; }; }; - printf(" mmh minev %u \n",minevent); + // if ( level.file == 2 ){ - L2->GetEntry(minevent); + // printf("1qui\n"); + L2->GetEntry(maxevent); } else { - otr->GetEntry(minevent); + otr->GetEntry(maxevent); } + // if ( level.file < 2 ){ ph = eh->GetPscuHeader(); - firstevno = (int)ph->Counter; + lastevno = (int)ph->Counter; } else { if ( var.ORB ){ - firstevno = L2->GetOrbitalInfo()->pkt_num; + lastevno = L2->GetOrbitalInfo()->pkt_num; } else { - firstevno = 0; + lastevno = 0; }; }; - printf(" aaah \n"); + // } void FEVdetector::ClearVariables(){ @@ -193,30 +206,55 @@ void FEVdetector::GetEntry(Int_t i){ thisentry = i; if ( level.file == 2 ){ - printf("qui \n"); + L2->Clear(); + // printf("qui\n"); L2->GetEntry(i); - printf("qua \n"); - ShowInfo("RunInfo"); - ShowInfo("SoftInfo"); - ShowInfo("OrbitalInfo"); - ShowInfo("TrigLevel2"); - ShowInfo("ToFLevel2"); - ShowInfo("TrkLevel2"); - ShowInfo("AcLevel2"); - ShowInfo("CaloLevel2"); - ShowInfo("CaloLevel1"); - ShowInfo("S4Level2"); - ShowInfo("NDLevel2"); + if ( var.showall ){ + ShowInfo("RunInfo"); + ShowInfo("SoftInfo"); + ShowInfo("OrbitalInfo"); + ShowInfo("TrigLevel2"); + ShowInfo("ToFLevel2"); + ShowInfo("TrkLevel2"); + ShowInfo("AcLevel2"); + ShowInfo("CaloLevel2"); + ShowInfo("CaloLevel1"); + ShowInfo("S4Level2"); + ShowInfo("NDLevel2"); + } else { + if ( var.showrun ) ShowInfo("RunInfo"); + if ( var.showsi ) ShowInfo("SoftInfo"); + if ( var.showorb ) ShowInfo("OrbitalInfo"); + if ( var.showtrg ) ShowInfo("TrigLevel2"); + if ( var.showtof ) ShowInfo("ToFLevel2"); + if ( var.showtrk ) ShowInfo("TrkLevel2"); + if ( var.showac ) ShowInfo("AcLevel2"); + if ( var.showcal ) ShowInfo("CaloLevel2"); + if ( var.showcal ) ShowInfo("CaloLevel1"); + if ( var.shows4 ) ShowInfo("S4Level2"); + if ( var.shownd ) ShowInfo("NDLevel2"); + }; } else { otr->GetEntry(i); - ShowInfo("Pscu"); - ShowInfo("Trigger"); - ShowInfo("Tof"); - ShowInfo("Tracker"); - ShowInfo("Anticounter"); - ShowInfo("Calorimeter"); - ShowInfo("Neutron"); - ShowInfo("S4"); + if ( var.showall ){ + ShowInfo("Pscu"); + ShowInfo("Trigger"); + ShowInfo("Tof"); + ShowInfo("Tracker"); + ShowInfo("Anticounter"); + ShowInfo("Calorimeter"); + ShowInfo("S4"); + ShowInfo("Neutron"); + } else { + if ( var.showorb ) ShowInfo("Pscu"); + if ( var.showtrg ) ShowInfo("Trigger"); + if ( var.showtof ) ShowInfo("Tof"); + if ( var.showtrk ) ShowInfo("Tracker"); + if ( var.showac ) ShowInfo("Anticounter"); + if ( var.showcal ) ShowInfo("Calorimeter"); + if ( var.shows4 ) ShowInfo("S4"); + if ( var.shownd ) ShowInfo("Neutron"); + }; }; } @@ -346,7 +384,7 @@ // TObjArray *leaf_array = 0; // if ( !strcmp(detector.Data(),"RunInfo") || !strcmp(detector.Data(),"SoftInfo") ){ - if ( runtree ) b1 = runtree->FindBranch(detector.Data()); + if ( L2->GetRunTree() ) b1 = L2->GetRunTree()->FindBranch(detector.Data()); } else { b1 = otr->FindBranch(detector.Data()); }; @@ -855,6 +893,11 @@ trcs = (TString)trc.str().c_str(); } else { headcold = headc; + if ( var.RUN ){ + var.idrun = L2->GetRunInfo()->ID; + var.idroot = L2->GetRunInfo()->ID_ROOT_L0; + var.EVF = L2->GetRunInfo()->EV_FROM; + }; if ( var.ORB ){ headc = L2->GetOrbitalInfo()->pkt_num; OBT = L2->GetOrbitalInfo()->OBT; @@ -1008,68 +1051,31 @@ // } -TChain* FEVdetector::Load(TFile &mainfile){ - // - gObjectTable->Print(); +TChain* FEVdetector::Load(TString file){ // - file = &mainfile; - // - // if ( otr ) otr->Reset(); - // if ( runtree ) runtree->Reset(); - if ( runtree ){ - printf(" runtree residuo \n"); - if ( runtree->GetFile() ){ - printf("chiudi file \n"); - // runtree->GetFile()->Close("R"); - }; - }; - // - if ( runtree ){ - printf(" clear runtree \n"); - runtree->Clear(); - printf(" delete runtree \n"); - delete runtree; - }; - // if ( runtree ) runtree->Print(); - if ( otr ){ - printf(" otr residuo \n"); - // if ( otr->GetFile() ) otr->GetFile()->Close("R"); - // otr->ResetBranchAddresses(); - }; - if ( otr ){ - printf("proviamo ad ammazzarlo di brutto\n"); - // otr->Clear(); - printf("proviamo ad ammazzarlo di brutto\n"); - otr->Delete(); - printf("proviamo ad ammazzarlo di brutto\n"); - //delete otr; - printf("speriamo sia rimasto secco\n"); - }; -// if ( otr ){ -// otr->DropBaskets(); -// otr->Delete("all"); -// }; -// if ( runtree ){ -// runtree->DropBaskets(); -// runtree->Delete("all"); -// }; - if ( runtree ) printf("2 runtree residuo \n"); -// if ( runtree ) runtree->Print(); - if ( otr ) printf("2 otr residuo \n"); -// if ( otr ) otr->Print(); - // - L2 = new PamLevel2(); + // file = &mainfile; // if ( level.file == 2 ){ // printf(" %s \n",ddec.Data()); - otr = L2->GetPamTree(gSystem->DirName(file->GetName()),file->GetName(),ddec.Data()); - runtree = L2->GetRunTree(gSystem->DirName(file->GetName()),file->GetName()); + if ( !L2 ){ + L2 = new PamLevel2("",file.Data(),ddec.Data()); + otr = L2->GetPamTree(); + printf(" l2 constructor\n"); + // printf(" abst %u obt %u qtot %f \n",L2->GetOrbitalInfo()->absTime,L2->GetOrbitalInfo()->OBT,L2->GetCaloLevel2()->qtot); + } else { + // + printf(" l2 already exist \n"); + otr = L2->GetPamTree(gSystem->DirName(file.Data()),file.Data(),ddec.Data()); + L2->GetRunTree(gSystem->DirName(file.Data()),file.Data()); + // + }; + // // if ( !otr ) return(0); // - otr->CanDeleteRefs(true); - if ( runtree ) runtree->CanDeleteRefs(true); + // otr->CanDeleteRefs(true); + // if ( runtree ) runtree->CanDeleteRefs(true); // } else { // @@ -1126,7 +1132,7 @@ tof = new pamela::tof::TofEvent(); // otr = new TChain("Physics"); - otr->Add(file->GetName(),-1); + otr->Add(file.Data(),-1); otr->SetBranchAddress("Trigger", &trigger); otr->SetBranchAddress("Header", &eh); }; @@ -5553,6 +5559,8 @@ void FEVdetector::ShowTrack(){ // + if ( level.file != 2 ) return; + // // // if ( var.CALO && var.CALOT ){ @@ -5650,14 +5658,16 @@ }; }; // - if ( !var.TRK || level.file != 2 ) return; + if ( !var.TRK ) return; // if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ // TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); + // printf("qui \n"); PamTrack *ptrack = L2->GetTrack(nt); TrkTrack *track = ptrack->GetTrkTrack(); + // printf("qua \n"); Int_t npoint = 100; Float_t zin[100]; Double_t xout[100]; @@ -5865,8 +5875,8 @@ Int_t se = 5; if ( !l && m%2 == 0 ) se = 3; if ( !l && m%2 != 0 ) se = 2; - if ( l && m%2 == 0 ) se = 1; - if ( l && m%2 != 0 ) se = 0; + if ( l && m%2 != 0 ) se = 1; + if ( l && m%2 == 0 ) se = 0; // // determine what kind of event we are going to analyze // @@ -6073,8 +6083,8 @@ Int_t se = 5; if (l == 0 && m%2 == 0) se = 3; if (l == 0 && m%2 != 0) se = 2; - if (l == 1 && m%2 == 0) se = 1; - if (l == 1 && m%2 != 0) se = 0; + if (l == 1 && m%2 != 0) se = 1; + if (l == 1 && m%2 == 0) se = 0; // // determine what kind of event we are going to analyze //