/[PAMELA software]/DarthVader/ToFLevel2/src/ToFCore.cpp
ViewVC logotype

Diff of /DarthVader/ToFLevel2/src/ToFCore.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mocchiut, Fri Jun 30 09:22:03 2006 UTC revision 1.4 by mocchiut, Thu Jul 6 09:03:27 2006 UTC
# Line 185  int ToFCore(ULong64_t run, TFile *file, Line 185  int ToFCore(ULong64_t run, TFile *file,
185    // variables needed to load magnetic field maps    // variables needed to load magnetic field maps
186    //    //
187    Int_t ntrkentry = 0;    Int_t ntrkentry = 0;
188      Int_t npmtentry = 0;
189    ULong64_t tttrkpar1 = 0ULL;    ULong64_t tttrkpar1 = 0ULL;
190    Bool_t trkpar1 = true;    Bool_t trkpar1 = true;
191    ULong64_t tttofpar1 = 0ULL;    ULong64_t tttofpar1 = 0ULL;
# Line 536  int ToFCore(ULong64_t run, TFile *file, Line 537  int ToFCore(ULong64_t run, TFile *file,
537        //        //
538        ei = l0reg->event;        ei = l0reg->event;
539        //        //
540          //
541          //
542          tof->Clear();
543          Int_t pmt_id = 0;
544          ToFPMT *t_pmt = new ToFPMT();
545          TClonesArray &tpmt = *tof->PMT;
546          ToFTrkVar *t_tof = new ToFTrkVar();
547          TClonesArray &t = *tof->ToFTrk;
548          //
549        // paranoid check        // paranoid check
550        //        //
551        if ( atime > runinfo->RUNTRAILER_TIME || atime < runinfo->RUNHEADER_TIME  ) {        if ( atime > runinfo->RUNTRAILER_TIME || atime < runinfo->RUNHEADER_TIME  ) {
# Line 567  int ToFCore(ULong64_t run, TFile *file, Line 577  int ToFCore(ULong64_t run, TFile *file,
577        //        //
578        // start processing        // start processing
579        //        //
       tof->Clear();  
       //tof = new ToFLevel2();  
   
580        //        //
581        // Here we will use some procedure to calibrate our data and put some kind of informations in the cinput structure        // Here we will use some procedure to calibrate our data and put some kind of informations in the cinput structure
582    
# Line 586  int ToFCore(ULong64_t run, TFile *file, Line 593  int ToFCore(ULong64_t run, TFile *file,
593        //        //
594        // Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related  variables.        // Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related  variables.
595        //        //
596          npmtentry = 0;
597          //
598          ntrkentry = 0;
599        //        //
600        // Calculate tracks informations from ToF alone        // Calculate tracks informations from ToF alone
601        //        //
602        tofl2com();        tofl2com();
603        //        //
604          memcpy(tof->tof_j_flag,tofoutput_.tof_j_flag,6*sizeof(Int_t));
605          //
606          t_tof->trkseqno = -1;
607          //
608        // and now we must copy from the output structure to the level2 class:        // and now we must copy from the output structure to the level2 class:
609        //        //
610        // common variables not related to the track        t_tof->npmttdc = 0;
611        for (Int_t kk=0; kk<3;kk++){        //
         tof->xtofpos[kk] = tofoutput_.xtofpos[kk];  
         tof->ytofpos[kk] = tofoutput_.ytofpos[kk];  
       }  
   
       for (Int_t kk=0; kk<6;kk++){  
         tof->tof_i_flag[kk]=tofoutput_.tof_i_flag[kk];  
         tof->tof_j_flag[kk]=tofoutput_.tof_j_flag[kk];  
       }  
   
       for (Int_t kk=0; kk<13;kk++){  
         tof->betatof_a[kk] = tofoutput_.betatof_a[kk];    
       }  
         
612        for (Int_t hh=0; hh<12;hh++){        for (Int_t hh=0; hh<12;hh++){
613          for (Int_t kk=0; kk<4;kk++){          for (Int_t kk=0; kk<4;kk++){
614            tof->adctof_c[hh][kk] = tofoutput_.adctof_c[hh][kk];            if ( tofoutput_.tofmask[hh][kk] != 0 ){
615          }              pmt_id = tof->GetPMTid(kk,hh);
616                t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc);
617                t_tof->npmttdc++;
618              };
619            };
620          };
621          for (Int_t kk=0; kk<13;kk++){
622            t_tof->beta[kk] = tofoutput_.betatof_a[kk];    
623        }        }
624          //
625          t_tof->npmtadc = 0;
626        for (Int_t hh=0; hh<12;hh++){        for (Int_t hh=0; hh<12;hh++){
627          for (Int_t kk=0; kk<4;kk++){          for (Int_t kk=0; kk<4;kk++){
628            tof->tdc_c[hh][kk] = tofoutput_.tdc_c[hh][kk];            if ( tofoutput_.adctof_c[hh][kk] < 1000 ){
629          }              t_tof->dedx.AddAt(tofoutput_.adctof_c[hh][kk],t_tof->npmtadc);
630        }              pmt_id = tof->GetPMTid(kk,hh);
631                      t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc);
632                t_tof->npmtadc++;
633              };
634            };
635          };
636        //        //
637        // Calculate track-related variables        memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos));
638          memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos));
639        //        //
640          new(t[ntrkentry]) ToFTrkVar(*t_tof);
641          ntrkentry++;      
642          t_tof->Clear();
643        //        //
       // Calculate variables related to tracks only if we have at least one track (from selftrigger and/or tracker)  
644        //        //
       ntrkentry = 0;  
645        //        //
646        //      if ( trk->GetNTracks() > 0 ){        t_pmt->Clear();
647          //
648          for (Int_t hh=0; hh<12;hh++){
649            for (Int_t kk=0; kk<4;kk++){
650              if ( tofoutput_.tdc_c[hh][kk] < 4095 || tofEvent->adc[kk][hh] < 4095 ){          
651                //
652                t_pmt->pmt_id = tof->GetPMTid(kk,hh);
653                t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk];
654                t_pmt->adc = tofEvent->adc[kk][hh];
655                //
656                new(tpmt[npmtentry]) ToFPMT(*t_pmt);
657                npmtentry++;        
658                t_pmt->Clear();
659              };
660            };
661          };      
662          //
663          // Calculate track-related variables
664          //
665        if ( trk->ntrk() > 0 ){        if ( trk->ntrk() > 0 ){
666          //          //
667          // We have at least one track          // We have at least one track
# Line 636  int ToFCore(ULong64_t run, TFile *file, Line 669  int ToFCore(ULong64_t run, TFile *file,
669          //          //
670          // Run over tracks          // Run over tracks
671          //          //
         // example: how to use tracker data  
672          for(Int_t nt=0; nt < trk->ntrk(); nt++){            for(Int_t nt=0; nt < trk->ntrk(); nt++){  
673            //            //
674            TrkTrack *ptt = trk->GetStoredTrack(nt);            TrkTrack *ptt = trk->GetStoredTrack(nt);
# Line 653  int ToFCore(ULong64_t run, TFile *file, Line 685  int ToFCore(ULong64_t run, TFile *file,
685            //            //
686            // Copy values in the class from the structure (we need to use a temporary class to store variables).            // Copy values in the class from the structure (we need to use a temporary class to store variables).
687            //            //
688            ToFTrkVar *t_tof = new ToFTrkVar();            t_tof->npmttdc = 0;
689              for (Int_t hh=0; hh<12;hh++){
690                for (Int_t kk=0; kk<4;kk++){
691                  if ( tofoutput_.tofmask[hh][kk] != 0 ){
692                    pmt_id = tof->GetPMTid(kk,hh);
693                    t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc);
694                    t_tof->npmttdc++;
695                  };
696                };
697              };
698            for (Int_t kk=0; kk<13;kk++){            for (Int_t kk=0; kk<13;kk++){
699              t_tof->beta_a[kk] = tofoutput_.beta_a[kk];              t_tof->beta[kk] = tofoutput_.beta_a[kk];    
700            }            };
701                        //
702              t_tof->npmtadc = 0;
703            for (Int_t hh=0; hh<12;hh++){            for (Int_t hh=0; hh<12;hh++){
704              for (Int_t kk=0; kk<4;kk++){              for (Int_t kk=0; kk<4;kk++){
705                t_tof->adc_c[hh][kk] = tofoutput_.adc_c[hh][kk];                if ( tofoutput_.adc_c[hh][kk] < 1000 ){
706              }                  t_tof->dedx.AddAt(tofoutput_.adc_c[hh][kk],t_tof->npmtadc);
707            }                  pmt_id = tof->GetPMTid(kk,hh);
708                    t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc);
709                    t_tof->npmtadc++;
710                  };
711                };
712              };
713              //
714              memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos));
715              memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos));
716            //            //
717            // Store the tracker track number in order to be sure to have shyncronized data during analysis            // Store the tracker track number in order to be sure to have shyncronized data during analysis
718            //            //
# Line 670  int ToFCore(ULong64_t run, TFile *file, Line 720  int ToFCore(ULong64_t run, TFile *file,
720            //            //
721            // create a new object for this event with track-related variables            // create a new object for this event with track-related variables
722            //            //
           TClonesArray &t = *tof->ToFTrk;  
723            new(t[ntrkentry]) ToFTrkVar(*t_tof);            new(t[ntrkentry]) ToFTrkVar(*t_tof);
           //  
           delete t_tof;  
           //  
724            ntrkentry++;              ntrkentry++;  
725              t_tof->Clear();
726            //            //
727          }; // loop on all the tracks          }; // loop on all the tracks
728        };        };
# Line 685  int ToFCore(ULong64_t run, TFile *file, Line 732  int ToFCore(ULong64_t run, TFile *file,
732        toft->Fill();        toft->Fill();
733        //            //    
734        //        //
735          //
736          delete t_tof;
737          //
738          //
739          //
740      jumpev:      jumpev:
741        debug = false;        debug = false;
742        //        //

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23