--- eventviewer/flight/src/FEVdetector.cpp 2006/12/12 10:47:43 1.5 +++ eventviewer/flight/src/FEVdetector.cpp 2007/02/12 08:10:34 1.9 @@ -128,14 +128,14 @@ ph = eh->GetPscuHeader(); lastevno = (int)ph->Counter; } else { - 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! }; otr->GetEntry(minevent); if ( level.file < 2 ){ ph = eh->GetPscuHeader(); firstevno = (int)ph->Counter; } else { - 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! }; } @@ -173,7 +173,7 @@ return((int)ph->Counter); } else { // return(thisentry); // to be changed as soon as we will have pkt_counter in the level2 file! - 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! }; } @@ -326,8 +326,8 @@ trcs = (TString)trc.str().c_str(); } else { headcold = headc; - headc = oinfoL2->pkt_num; // to be changed as soon as we will have obt in the level2 file! - OBT = oinfoL2->OBT; // 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! + OBT = L2->GetOrbitalInfo()->OBT; // to be changed as soon as we will have obt in the level2 file! DOBT = OBT - OOBT; OOBT = OBT; if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0; @@ -336,18 +336,18 @@ // who gave the trigger? // calotrig = 0; - if ( L2->patterntrig[0] ) calotrig = 1; + if ( L2->GetTrigLevel2()->patterntrig[0] ) calotrig = 1; toftrig = 0; - 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; s4pulser = 0; - if ( L2->patterntrig[1] & (1<<0) ) s4pulser = 1; + if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) s4pulser = 1; // // TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns. // S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug": // if ( !calotrig && !toftrig ) s4pulser = 1; // - Int_t trigconf = L2->trigconf; + Int_t trigconf = L2->GetTrigLevel2()->trigconf; stringstream trc; trc.str(""); if ( trigconf & (1<<0) ) trc << "TOF1"; @@ -488,7 +488,7 @@ magfie << pam_calib; magfie << "/trk-param/field_param-0/"; // - L2->LoadField(magfie.str().c_str()); + L2->GetTrkLevel2()->LoadField(magfie.str().c_str()); } else { // // load calorimeter ADC2MIP conversion file @@ -533,7 +533,7 @@ trigger = new pamela::trigger::TriggerEvent(); eh = new pamela::EventHeader(); ph = new pamela::PscuHeader(); - oinfoL2 = new OrbitalInfo(); + // oinfoL2 = new OrbitalInfo(); runinfo = new ItoRunInfo(file); // de = new pamela::calorimeter::CalorimeterEvent(); @@ -548,8 +548,8 @@ otr->SetBranchAddress("Header", &eh); }; if ( level.file == 2 ){ - otr->AddFriend("OrbitalInfo", file); - otr->SetBranchAddress("OrbitalInfo", &oinfoL2); + // otr->AddFriend("OrbitalInfo", file); + // otr->SetBranchAddress("OrbitalInfo", &oinfoL2); runinfo->Read(0ULL); }; // @@ -2024,7 +2024,8 @@ ms11b[i] = 0.; } else { ms11b[i] = 1.; - }; }; + }; + }; for ( Int_t i = 0; i<6; i++ ) { mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]]; mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]]; @@ -2123,7 +2124,7 @@ // var.tofraw = 0; // - repuntil = L2->ToFLevel2::ntrk(); + if ( level.file == 2 ) repuntil = L2->GetToFLevel2()->ntrk(); // printf("repuntil = %i \n",repuntil); //repuntil = L2->GetNTracks(); // @@ -2138,14 +2139,14 @@ // if ( repuntil == 1 || var.tofraw ){ numtr = 0; - ptt = L2->GetToFTrkVar(0); + ptt = L2->GetToFLevel2()->GetToFTrkVar(0); repeat = false; } else { // // if ( numtr >= repuntil-1 ) repeat = false; // - ptt = L2->GetToFTrkVar(numtr); + ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr); }; // xp11[0] = 0.; @@ -2161,7 +2162,7 @@ // Float_t adc[4][12]; Float_t tdc[4][12]; - L2->GetMatrix(numtr,adc,tdc); + L2->GetToFLevel2()->GetMatrix(numtr,adc,tdc); // for ( Int_t i = 0; i<8; i++ ) { @@ -2805,10 +2806,10 @@ // full infos from ac // if ( level.file == 2 ){ - hitmapA = L2->hitmap[0]; - hitmapB = L2->hitmap[1]; - hitstatusA = L2->hitstatus[0]; - hitstatusB = L2->hitstatus[1]; + hitmapA = L2->GetAcLevel2()->hitmap[0]; + hitmapB = L2->GetAcLevel2()->hitmap[1]; + hitstatusA = L2->GetAcLevel2()->hitstatus[0]; + hitstatusB = L2->GetAcLevel2()->hitstatus[1]; }; // // @@ -4065,7 +4066,7 @@ // if ( level.file == 2 ){ for ( Int_t j = 0; j<3; j++ ) { - if ( L2->S4adc != 32. ) ms4[j] = L2->S4calibrated; + if ( L2->GetS4Level2()->S4adc != 32. ) ms4[j] = L2->GetS4Level2()->S4calibrated; }; }; // @@ -4150,9 +4151,9 @@ }; }; if ( level.file == 2 ){ - yUpperTrig = (Int_t)L2->trigPhysics; - yUpperBk = (Int_t)L2->upperBack; - yBottomBk = (Int_t)L2->bottomBack; + yUpperTrig = (Int_t)L2->GetNDLevel2()->trigPhysics; + yUpperBk = (Int_t)L2->GetNDLevel2()->upperBack; + yBottomBk = (Int_t)L2->GetNDLevel2()->bottomBack; }; // var.trup = yUpperTrig; @@ -4459,8 +4460,8 @@ // // singlets X // - for (Int_t sing = 0; sing < L2->nclsx(); sing++){ - TClonesArray &t = *(L2->SingletX); + for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){ + TClonesArray &t = *(L2->GetTrkLevel2()->SingletX); TrkSinglet *singlet = (TrkSinglet*)t[sing]; x = (singlet->coord[0]+singlet->coord[1])/2.; // @@ -4484,8 +4485,8 @@ // // singlets Y // - for (Int_t sing = 0; sing < L2->nclsy(); sing++){ - TClonesArray &t = *(L2->SingletY); + for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){ + TClonesArray &t = *(L2->GetTrkLevel2()->SingletY); TrkSinglet *singlet = (TrkSinglet*)t[sing]; // Int_t planepad = (singlet->plane - 1)* 2; @@ -4530,9 +4531,9 @@ dcol = 2; }; // - if ( L2->GetNTracks() > 0 ){ - for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ - TrkTrack *track = L2->GetTrack(nt); + if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ + for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ + TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); if ( nt == 0 ){ var.rig = 0.; if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; @@ -4628,9 +4629,9 @@ // // first of all plot crosses relatives to tracks // - if ( L2->GetNTracks() > 0 ){ - for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ - TrkTrack *track = L2->GetTrack(nt); + if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ + for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ + TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); for (Int_t plane = 0; plane<6; plane++){ // x = track->xm[plane]; @@ -4676,7 +4677,7 @@ // // try to plot crosses relative to singlets // - if ( L2->nclsx() > 0 && L2->nclsy() > 0 ){ + if ( L2->GetTrkLevel2()->nclsx() > 0 && L2->GetTrkLevel2()->nclsy() > 0 ){ for (Int_t plane = 1; plane<7; plane++){ // // count how many singlet in the x and y view for this plane: @@ -4690,8 +4691,8 @@ TArrayF *array2 = new TArrayF(5000); TArrayF *sigarrax = new TArrayF(5000); TArrayF *sigarray = new TArrayF(5000); - for (Int_t sing = 0; sing < L2->nclsx(); sing++){ - TClonesArray &t = *(L2->SingletX); + for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){ + TClonesArray &t = *(L2->GetTrkLevel2()->SingletX); TrkSinglet *singlet = (TrkSinglet*)t[sing]; if ( singlet->plane == plane ){ arrax->AddAt(((singlet->coord[0]+singlet->coord[1])/2.),totsx); @@ -4720,8 +4721,8 @@ totsx++; }; }; - for (Int_t sing = 0; sing < L2->nclsy(); sing++){ - TClonesArray &t = *(L2->SingletY); + for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){ + TClonesArray &t = *(L2->GetTrkLevel2()->SingletY); TrkSinglet *singlet = (TrkSinglet*)t[sing]; if ( singlet->plane == plane ){ array1->AddAt(singlet->coord[0],totsy); @@ -4946,11 +4947,106 @@ // // // + if ( var.CALO && false ){ + if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){ + Float_t calx[22]; + Float_t caly[22]; + Float_t calzx[22]; + Float_t calzy[22]; + Float_t zpiano[22]; + zpiano[0] = (CTZ+118.)*var.sfy/1000.; + for (Int_t plane = 1; plane < 22; plane++){ + if ( !(plane%2) ){ + zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; + }else { + zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; + }; + }; + for (Int_t plane = 0; plane < 22; plane++){ + calx[plane] = (L2->GetCaloLevel2()->cbar[plane][0]/100.)*var.sfx + var.xxvc;; + caly[plane] = (L2->GetCaloLevel2()->cbar[plane][1]/100.)*var.sfx + var.xyvc; + // calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; + calzx[plane] = zpiano[plane] + var.yxvc; + calzy[plane] = zpiano[plane] + var.yyvc; + // printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]); + }; + // + // Calorimeter track + // + Int_t trcol = 30; + if ( var.bw ){ + trcol = 14; + } else { + trcol = 44; + }; + thefigure->cd(); + TPolyLine *trakx = new TPolyLine(22,calx,calzx); + trakx->SetLineColor(trcol); + if ( L2->GetCaloLevel2()->fitmode[0] == 1 ) trakx->SetLineStyle(3); + if ( L2->GetCaloLevel2()->fitmode[0] == 2 ) trakx->SetLineStyle(4); + trakx->SetLineWidth(2); + trakx->Draw(); + TPolyLine *traky = new TPolyLine(22,caly,calzy); + traky->SetLineColor(trcol); + if ( L2->GetCaloLevel2()->fitmode[1] == 1 ) traky->SetLineStyle(3); + if ( L2->GetCaloLevel2()->fitmode[1] == 2 ) traky->SetLineStyle(4); + traky->SetLineWidth(2); + traky->Draw(); + }; + if ( L2->GetCaloLevel2()->npcfit[2] > 0 ){ + Float_t calx[22]; + Float_t caly[22]; + Float_t calzx[22]; + Float_t calzy[22]; + Float_t zpiano[22]; + zpiano[0] = (CTZ+118.)*var.sfy/1000.; + for (Int_t plane = 1; plane < 22; plane++){ + if ( !(plane%2) ){ + zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; + }else { + zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; + }; + }; + // + // + CaloTrkVar *ctra = L2->GetCaloStoredTrack(-1); + // + for (Int_t plane = 0; plane < 22; plane++){ + calx[plane] = (ctra->tbar[plane][0]/100.)*var.sfx + var.xxvc;; + caly[plane] = (ctra->tbar[plane][1]/100.)*var.sfx + var.xyvc; + // calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; + calzx[plane] = zpiano[plane] + var.yxvc; + calzy[plane] = zpiano[plane] + var.yyvc; + // printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]); + }; + // + // Calorimeter track + // + Int_t trcol = 30; + if ( var.bw ){ + trcol = 16; + } else { + trcol = 46; + }; + thefigure->cd(); + TPolyLine *trakx = new TPolyLine(22,calx,calzx); + trakx->SetLineColor(trcol); + trakx->SetLineStyle(3); + trakx->SetLineWidth(2); + trakx->Draw(); + TPolyLine *traky = new TPolyLine(22,caly,calzy); + traky->SetLineColor(trcol); + traky->SetLineStyle(3); + traky->SetLineWidth(2); + traky->Draw(); + }; + }; + // if ( !var.TRK || level.file != 2 ) return; // - if ( L2->GetNTracks() > 0 ){ - for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ - TrkTrack *track = L2->GetTrack(nt); + if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ + for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ + TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); Int_t npoint = 100; Float_t zin[100]; Double_t xout[100]; @@ -5020,6 +5116,7 @@ }; tzx[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc; tzy[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc; + // printf("tx[e] %f ty [e] %f tzx %f tzy %f \n",tx[e],ty[e],tzx[e],tzy[e]); }; // // From S1 to CALO @@ -5569,12 +5666,12 @@ // stringstream xvev; stringstream yvev; - for (Int_t ii = 0; ii < L2->nstrip; ii++){ + for (Int_t ii = 0; ii < L2->GetCaloLevel2()->nstrip; ii++){ Int_t colo; Int_t l; Int_t m; Int_t n; - Float_t mip = L2->DecodeEstrip(ii,l,m,n); + Float_t mip = L2->GetCaloLevel1()->DecodeEstrip(ii,l,m,n); if ( var.bw ){ colo = -1; } else { @@ -5608,8 +5705,8 @@ }; pd1->Update(); pd2->Update(); - var.qtot=(int)L2->qtot; - var.nstrip=(int)L2->nstrip; + var.qtot=(int)L2->GetCaloLevel2()->qtot; + var.nstrip=(int)L2->GetCaloLevel2()->nstrip; }; }