| 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";  | 
| 475 | 
   L2 = new PamLevel2();  | 
   L2 = new PamLevel2();  | 
| 476 | 
   // | 
   // | 
| 477 | 
   if ( level.file == 2 ){ | 
   if ( level.file == 2 ){ | 
| 478 | 
     otr = L2->LoadPamTrees(file);  | 
     //    otr = L2->LoadPamTrees(file);  | 
| 479 | 
  | 
     otr = L2->GetPamTree(file,"+ALL +CAL1 -TRKh -TRK1");  | 
| 480 | 
     // ******************** | 
     // ******************** | 
| 481 | 
     // load magnetic field | 
     // load magnetic field | 
| 482 | 
     // ******************** | 
     // ******************** | 
| 484 | 
     // | 
     // | 
| 485 | 
     stringstream magfie; | 
     stringstream magfie; | 
| 486 | 
     magfie.str(""); | 
     magfie.str(""); | 
| 487 | 
  | 
     //    magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/"; | 
| 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 | 
   // | 
   // | 
| 817 | 
   // | 
   // | 
| 818 | 
   // SHOW PALETTE | 
   // SHOW PALETTE | 
| 819 | 
   // | 
   // | 
| 820 | 
  | 
   thefigure->cd(); | 
| 821 | 
   if ( var.PALETTE ) ShowPalette(); | 
   if ( var.PALETTE ) ShowPalette(); | 
| 822 | 
   // | 
   // | 
| 823 | 
   // SHOW VERBOSE INFOS | 
   // SHOW VERBOSE INFOS | 
| 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++ ) {    | 
| 2171 | 
         if ( adc[ch11b[i]][hb11b[i]] < 1000. ){ | 
         if ( adc[ch11b[i]][hb11b[i]] < 1000. ){ | 
| 2172 | 
           ms11b[i] = adc[ch11b[i]][hb11b[i]]; | 
           ms11b[i] = adc[ch11b[i]][hb11b[i]]; | 
| 2173 | 
         }; | 
         }; | 
| 2174 | 
         xp11[i] = 0.; | 
         //      xp11[i] = 0.; | 
| 2175 | 
       }; | 
       }; | 
| 2176 | 
  | 
  | 
| 2177 | 
       Int_t nmtof = 0; | 
       Int_t nmtof = 0; | 
| 2211 | 
         if ( adc[ch12b[i]][hb12b[i]] < 1000. ) ms12b[i] = adc[ch12b[i]][hb12b[i]]; | 
         if ( adc[ch12b[i]][hb12b[i]] < 1000. ) ms12b[i] = adc[ch12b[i]][hb12b[i]]; | 
| 2212 | 
         xp12[i] = 0.; | 
         xp12[i] = 0.; | 
| 2213 | 
       };     | 
       };     | 
| 2214 | 
  | 
       // | 
| 2215 | 
       xp12[0] = ptt->xtofpos[0]; | 
       xp12[0] = ptt->xtofpos[0]; | 
| 2216 | 
       // | 
       // | 
| 2217 | 
       ii = 2; | 
       ii = 2; | 
| 2219 | 
         ii--; | 
         ii--; | 
| 2220 | 
         if ( adc[ch21a[i]][hb21a[i]] < 1000. ) ms21a[ii] = adc[ch21a[i]][hb21a[i]]; | 
         if ( adc[ch21a[i]][hb21a[i]] < 1000. ) ms21a[ii] = adc[ch21a[i]][hb21a[i]]; | 
| 2221 | 
         if ( adc[ch21b[i]][hb21b[i]] < 1000. ) ms21b[ii] = adc[ch21b[i]][hb21b[i]]; | 
         if ( adc[ch21b[i]][hb21b[i]] < 1000. ) ms21b[ii] = adc[ch21b[i]][hb21b[i]]; | 
| 2222 | 
         xp12[i] = 0.; | 
         xp21[i] = 0.; | 
| 2223 | 
       }; | 
       }; | 
| 2224 | 
       xp21[0] = ptt->xtofpos[1]; | 
       xp21[0] = ptt->xtofpos[1]; | 
| 2225 | 
       // | 
       // | 
| 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); | 
| 4946 | 
   // | 
   // | 
| 4947 | 
   // | 
   // | 
| 4948 | 
   // | 
   // | 
| 4949 | 
  | 
   if ( var.CALO && false ){ | 
| 4950 | 
  | 
     if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){ | 
| 4951 | 
  | 
       Float_t calx[22]; | 
| 4952 | 
  | 
       Float_t caly[22]; | 
| 4953 | 
  | 
       Float_t calzx[22]; | 
| 4954 | 
  | 
       Float_t calzy[22]; | 
| 4955 | 
  | 
       Float_t zpiano[22]; | 
| 4956 | 
  | 
       zpiano[0] = (CTZ+118.)*var.sfy/1000.; | 
| 4957 | 
  | 
       for (Int_t plane = 1; plane < 22; plane++){        | 
| 4958 | 
  | 
         if ( !(plane%2) ){ | 
| 4959 | 
  | 
           zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; | 
| 4960 | 
  | 
         }else { | 
| 4961 | 
  | 
           zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; | 
| 4962 | 
  | 
         }; | 
| 4963 | 
  | 
       }; | 
| 4964 | 
  | 
       for (Int_t plane = 0; plane < 22; plane++){        | 
| 4965 | 
  | 
         calx[plane] = (L2->GetCaloLevel2()->cbar[plane][0]/100.)*var.sfx + var.xxvc;; | 
| 4966 | 
  | 
         caly[plane] = (L2->GetCaloLevel2()->cbar[plane][1]/100.)*var.sfx + var.xyvc; | 
| 4967 | 
  | 
         //      calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; | 
| 4968 | 
  | 
         calzx[plane] = zpiano[plane] + var.yxvc; | 
| 4969 | 
  | 
         calzy[plane] = zpiano[plane] + var.yyvc; | 
| 4970 | 
  | 
         //      printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]);  | 
| 4971 | 
  | 
       }; | 
| 4972 | 
  | 
       // | 
| 4973 | 
  | 
       // Calorimeter track | 
| 4974 | 
  | 
       // | 
| 4975 | 
  | 
       Int_t trcol = 30; | 
| 4976 | 
  | 
       if ( var.bw ){ | 
| 4977 | 
  | 
         trcol = 14; | 
| 4978 | 
  | 
       } else { | 
| 4979 | 
  | 
         trcol = 44; | 
| 4980 | 
  | 
       }; | 
| 4981 | 
  | 
       thefigure->cd(); | 
| 4982 | 
  | 
       TPolyLine *trakx = new TPolyLine(22,calx,calzx); | 
| 4983 | 
  | 
       trakx->SetLineColor(trcol); | 
| 4984 | 
  | 
       if ( L2->GetCaloLevel2()->fitmode[0] == 1 ) trakx->SetLineStyle(3); | 
| 4985 | 
  | 
       if ( L2->GetCaloLevel2()->fitmode[0] == 2 ) trakx->SetLineStyle(4); | 
| 4986 | 
  | 
       trakx->SetLineWidth(2); | 
| 4987 | 
  | 
       trakx->Draw(); | 
| 4988 | 
  | 
       TPolyLine *traky = new TPolyLine(22,caly,calzy); | 
| 4989 | 
  | 
       traky->SetLineColor(trcol); | 
| 4990 | 
  | 
       if ( L2->GetCaloLevel2()->fitmode[1] == 1 ) traky->SetLineStyle(3); | 
| 4991 | 
  | 
       if ( L2->GetCaloLevel2()->fitmode[1] == 2 ) traky->SetLineStyle(4); | 
| 4992 | 
  | 
       traky->SetLineWidth(2); | 
| 4993 | 
  | 
       traky->Draw();       | 
| 4994 | 
  | 
     }; | 
| 4995 | 
  | 
     if ( L2->GetCaloLevel2()->npcfit[2] > 0 ){ | 
| 4996 | 
  | 
       Float_t calx[22]; | 
| 4997 | 
  | 
       Float_t caly[22]; | 
| 4998 | 
  | 
       Float_t calzx[22]; | 
| 4999 | 
  | 
       Float_t calzy[22]; | 
| 5000 | 
  | 
       Float_t zpiano[22]; | 
| 5001 | 
  | 
       zpiano[0] = (CTZ+118.)*var.sfy/1000.; | 
| 5002 | 
  | 
       for (Int_t plane = 1; plane < 22; plane++){        | 
| 5003 | 
  | 
         if ( !(plane%2) ){ | 
| 5004 | 
  | 
           zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.; | 
| 5005 | 
  | 
         }else { | 
| 5006 | 
  | 
           zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.; | 
| 5007 | 
  | 
         }; | 
| 5008 | 
  | 
       }; | 
| 5009 | 
  | 
       // | 
| 5010 | 
  | 
       // | 
| 5011 | 
  | 
       CaloTrkVar *ctra = L2->GetCaloStoredTrack(-1); | 
| 5012 | 
  | 
       // | 
| 5013 | 
  | 
       for (Int_t plane = 0; plane < 22; plane++){        | 
| 5014 | 
  | 
         calx[plane] = (ctra->tbar[plane][0]/100.)*var.sfx + var.xxvc;; | 
| 5015 | 
  | 
         caly[plane] = (ctra->tbar[plane][1]/100.)*var.sfx + var.xyvc; | 
| 5016 | 
  | 
         //      calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc; | 
| 5017 | 
  | 
         calzx[plane] = zpiano[plane] + var.yxvc; | 
| 5018 | 
  | 
         calzy[plane] = zpiano[plane] + var.yyvc; | 
| 5019 | 
  | 
         //      printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]);  | 
| 5020 | 
  | 
       }; | 
| 5021 | 
  | 
       // | 
| 5022 | 
  | 
       // Calorimeter track | 
| 5023 | 
  | 
       // | 
| 5024 | 
  | 
       Int_t trcol = 30; | 
| 5025 | 
  | 
       if ( var.bw ){ | 
| 5026 | 
  | 
         trcol = 16; | 
| 5027 | 
  | 
       } else { | 
| 5028 | 
  | 
         trcol = 46; | 
| 5029 | 
  | 
       }; | 
| 5030 | 
  | 
       thefigure->cd(); | 
| 5031 | 
  | 
       TPolyLine *trakx = new TPolyLine(22,calx,calzx); | 
| 5032 | 
  | 
       trakx->SetLineColor(trcol); | 
| 5033 | 
  | 
       trakx->SetLineStyle(3); | 
| 5034 | 
  | 
       trakx->SetLineWidth(2); | 
| 5035 | 
  | 
       trakx->Draw(); | 
| 5036 | 
  | 
       TPolyLine *traky = new TPolyLine(22,caly,calzy); | 
| 5037 | 
  | 
       traky->SetLineColor(trcol); | 
| 5038 | 
  | 
       traky->SetLineStyle(3); | 
| 5039 | 
  | 
       traky->SetLineWidth(2); | 
| 5040 | 
  | 
       traky->Draw();       | 
| 5041 | 
  | 
     }; | 
| 5042 | 
  | 
   }; | 
| 5043 | 
  | 
   // | 
| 5044 | 
   if ( !var.TRK || level.file != 2 ) return; | 
   if ( !var.TRK || level.file != 2 ) return; | 
| 5045 | 
   // | 
   // | 
| 5046 | 
   if ( L2->GetNTracks() > 0 ){ | 
   if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ | 
| 5047 | 
     for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){ | 
     for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ | 
| 5048 | 
       TrkTrack *track = L2->GetTrack(nt);  | 
       TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt);  | 
| 5049 | 
       Int_t npoint = 100; | 
       Int_t npoint = 100; | 
| 5050 | 
       Float_t zin[100]; | 
       Float_t zin[100]; | 
| 5051 | 
       Double_t xout[100]; | 
       Double_t xout[100]; | 
| 5115 | 
           }; | 
           }; | 
| 5116 | 
           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;                  | 
| 5117 | 
           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; | 
| 5118 | 
  | 
           //      printf("tx[e] %f ty [e] %f tzx %f tzy %f \n",tx[e],ty[e],tzx[e],tzy[e]); | 
| 5119 | 
         }; | 
         }; | 
| 5120 | 
         // | 
         // | 
| 5121 | 
         // From S1 to CALO | 
         // From S1 to CALO | 
| 5665 | 
     // | 
     // | 
| 5666 | 
     stringstream xvev; | 
     stringstream xvev; | 
| 5667 | 
     stringstream yvev;     | 
     stringstream yvev;     | 
| 5668 | 
     for (Int_t ii = 0; ii < L2->nstrip; ii++){ | 
     for (Int_t ii = 0; ii < L2->GetCaloLevel2()->nstrip; ii++){ | 
| 5669 | 
       Int_t colo; | 
       Int_t colo; | 
| 5670 | 
       Int_t l; | 
       Int_t l; | 
| 5671 | 
       Int_t m; | 
       Int_t m; | 
| 5672 | 
       Int_t n; | 
       Int_t n; | 
| 5673 | 
       Float_t mip = L2->DecodeEstrip(ii,l,m,n); | 
       Float_t mip = L2->GetCaloLevel1()->DecodeEstrip(ii,l,m,n); | 
| 5674 | 
       if ( var.bw ){ | 
       if ( var.bw ){ | 
| 5675 | 
         colo = -1; | 
         colo = -1; | 
| 5676 | 
       } else { | 
       } else { | 
| 5704 | 
     }; | 
     }; | 
| 5705 | 
     pd1->Update(); | 
     pd1->Update(); | 
| 5706 | 
     pd2->Update(); | 
     pd2->Update(); | 
| 5707 | 
     var.qtot=(int)L2->qtot; | 
     var.qtot=(int)L2->GetCaloLevel2()->qtot; | 
| 5708 | 
     var.nstrip=(int)L2->nstrip; | 
     var.nstrip=(int)L2->GetCaloLevel2()->nstrip; | 
| 5709 | 
   }; | 
   }; | 
| 5710 | 
 } | 
 } | 
| 5711 | 
  | 
  |