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

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

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

revision 1.7 by mocchiut, Fri Jul 21 12:00:22 2006 UTC revision 1.13 by mocchiut, Mon Jan 22 14:09:32 2007 UTC
# Line 32  ToFTrkVar::ToFTrkVar() { Line 32  ToFTrkVar::ToFTrkVar() {
32    npmtadc = 0;    npmtadc = 0;
33    pmttdc = TArrayI(48);    pmttdc = TArrayI(48);
34    pmtadc = TArrayI(48);    pmtadc = TArrayI(48);
35      tdcflag = TArrayI(48); // gf: 30 Nov 2006
36      adcflag = TArrayI(48); // gf: 30 Nov 2006
37    dedx = TArrayF(48);    dedx = TArrayF(48);
38    //    //
39    //    //
# Line 47  void ToFTrkVar::Clear() { Line 49  void ToFTrkVar::Clear() {
49    npmtadc = 0;    npmtadc = 0;
50    pmttdc.Reset();    pmttdc.Reset();
51    pmtadc.Reset();    pmtadc.Reset();
52      tdcflag.Reset(); // gf: 30 Nov 2006
53      adcflag.Reset(); // gf: 30 Nov 2006
54    dedx.Reset();    dedx.Reset();
55    //    //
56    memset(beta,  0, 13*sizeof(Float_t));    memset(beta,  0, 13*sizeof(Float_t));
# Line 63  ToFTrkVar::ToFTrkVar(const ToFTrkVar &t) Line 67  ToFTrkVar::ToFTrkVar(const ToFTrkVar &t)
67    npmtadc = t.npmtadc;    npmtadc = t.npmtadc;
68    (t.pmttdc).Copy(pmttdc);    (t.pmttdc).Copy(pmttdc);
69    (t.pmtadc).Copy(pmtadc);    (t.pmtadc).Copy(pmtadc);
70      (t.tdcflag).Copy(tdcflag); // gf: 30 Nov 2006
71      (t.adcflag).Copy(adcflag); // gf: 30 Nov 2006
72    (t.dedx).Copy(dedx);    (t.dedx).Copy(dedx);
73    //    //
74    memcpy(beta,t.beta,sizeof(beta));    memcpy(beta,t.beta,sizeof(beta));
# Line 73  ToFTrkVar::ToFTrkVar(const ToFTrkVar &t) Line 79  ToFTrkVar::ToFTrkVar(const ToFTrkVar &t)
79    
80  ToFLevel2::ToFLevel2() {      ToFLevel2::ToFLevel2() {    
81    //    //
82    PMT = new TClonesArray("ToFPMT",12);  //  PMT = new TClonesArray("ToFPMT",12); //ELENA
83    ToFTrk = new TClonesArray("ToFTrkVar",2);  //  ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA
84      PMT = 0; //ELENA
85      ToFTrk = 0; //ELENA
86      //
87      this->Clear();
88    //    //
   memset(tof_j_flag, 0, 6*sizeof(Int_t));  
89  };  };
90    
91    void ToFLevel2::Set(){//ELENA
92        if(!PMT)PMT = new TClonesArray("ToFPMT",12); //ELENA
93        if(!ToFTrk)ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA
94    }//ELENA
95    
96  void ToFLevel2::Clear(){  void ToFLevel2::Clear(){
97    //    //
98    ToFTrk->Clear();    if(ToFTrk)ToFTrk->Delete(); //ELENA
99    PMT->Clear();    if(PMT)PMT->Delete(); //ELENA
100    memset(tof_j_flag, 0, 6*sizeof(Int_t));    memset(tof_j_flag, 0, 6*sizeof(Int_t));
101      unpackError = 0;
102    //    //
103  };  };
104    
105    void ToFLevel2::Delete(){ //ELENA
106      //
107      if(ToFTrk){
108          ToFTrk->Delete(); //ELENA
109          delete ToFTrk;  //ELENA
110      }
111      if(PMT){
112          PMT->Delete(); //ELENA
113          delete PMT; //ELENA
114      } //ELENA
115      //
116    }; //ELENA
117    
118  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){
119    //        //    
120    if(itrk >= ntrk()){    if(itrk >= ntrk()){
# Line 95  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t Line 123  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t
123      return(NULL);      return(NULL);
124    }      }  
125    //    //
126      if(!ToFTrk)return 0; //ELENA
127    TClonesArray &t = *(ToFTrk);    TClonesArray &t = *(ToFTrk);
128    ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk];    ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk];
129    return toftrack;    return toftrack;
# Line 108  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit) Line 137  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit)
137      return(NULL);      return(NULL);
138    }      }  
139    //    //
140      if(!PMT)return 0; //ELENA
141    TClonesArray &t = *(PMT);    TClonesArray &t = *(PMT);
142    ToFPMT *tofpmt = (ToFPMT*)t[ihit];    ToFPMT *tofpmt = (ToFPMT*)t[ihit];
143    return tofpmt;    return tofpmt;
# Line 138  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit) Line 168  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit)
168        else return -1;        else return -1;
169    };    };
170  /**  /**
171   * Method to know if a given ToF paddle was hit, that is there is a TDC signal from both PMTs   * Method to know if a given ToF paddle was hit, that is there is a TDC signal
172     * from both PMTs
173   * @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5).   * @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5).
174   * @param paddle_id Paddle ID.   * @param paddle_id Paddle ID.
175   * @return 1 if the paddle was hit.   * @return 1 if the paddle was hit.
# Line 171  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 202  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
202    
203    
204  Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane){  Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane){
205    
206    Float_t dedx = 0.;    Float_t dedx = 0.;
207    Int_t ip = 0;    Int_t ip = 0;
208    Int_t pmt_id = 0;    Int_t pmt_id = 0;
# Line 182  Float_t ToFLevel2::GetdEdx(Int_t notrack Line 214  Float_t ToFLevel2::GetdEdx(Int_t notrack
214    };    };
215    //    //
216    ToFTrkVar *trk = GetToFTrkVar(notrack);    ToFTrkVar *trk = GetToFTrkVar(notrack);
217      if(!trk) return 0; //ELENA
218    //    //
219    for (Int_t i=0; i<trk->npmtadc; i++){    for (Int_t i=0; i<trk->npmtadc; i++){
220      //      //
# Line 189  Float_t ToFLevel2::GetdEdx(Int_t notrack Line 222  Float_t ToFLevel2::GetdEdx(Int_t notrack
222      //      //
223      pl = GetPlaneIndex(pmt_id);      pl = GetPlaneIndex(pmt_id);
224      //      //
225      if ( pl == ip ) dedx += (trk->dedx).At(i);        if ( pl == ip ) dedx += (trk->dedx).At(i);
226      //      //
227    };    };
228    //    //
# Line 211  void ToFLevel2::GetMatrix(Int_t notrack, Line 244  void ToFLevel2::GetMatrix(Int_t notrack,
244    Int_t kk = 0;    Int_t kk = 0;
245    //    //
246    ToFTrkVar *trk = GetToFTrkVar(notrack);    ToFTrkVar *trk = GetToFTrkVar(notrack);
247      if(!trk)return; //ELENA
248    //    //
249    for (Int_t i=0; i<trk->npmtadc; i++){    for (Int_t i=0; i<trk->npmtadc; i++){
250      //      //
# Line 224  void ToFLevel2::GetMatrix(Int_t notrack, Line 258  void ToFLevel2::GetMatrix(Int_t notrack,
258    for (Int_t i=0; i<npmt(); i++){    for (Int_t i=0; i<npmt(); i++){
259      //      //
260      ToFPMT *pmt = GetToFPMT(i);      ToFPMT *pmt = GetToFPMT(i);
261        if(!pmt)break; //ELENA
262      //      //
263      GetPMTIndex(pmt->pmt_id,hh,kk);      GetPMTIndex(pmt->pmt_id,hh,kk);
264      //      //
# Line 332  void ToFLevel2::GetLevel2Struct(cToFLeve Line 367  void ToFLevel2::GetLevel2Struct(cToFLeve
367    for(Int_t i=0;i<6;i++)    for(Int_t i=0;i<6;i++)
368      l2->tof_j_flag[i]=tof_j_flag[i];      l2->tof_j_flag[i]=tof_j_flag[i];
369    
370    l2->ntoftrk = ToFTrk->GetEntries();    if(ToFTrk){ //ELENA
371    for(Int_t j=0;j<l2->ntoftrk;j++){        l2->ntoftrk = ToFTrk->GetEntries();
372      l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno;        for(Int_t j=0;j<l2->ntoftrk;j++){
373      l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc;            l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno;
374      for(Int_t i=0;i<l2->npmttdc[j];i++)            l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc;
375        l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i);            for(Int_t i=0;i<l2->npmttdc[j];i++){
376      for(Int_t i=0;i<13;i++)                l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i);
377        l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i];                l2->tdcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->tdcflag.At(i); // gf: 30 Nov 2006
378              }
379      l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc;            for(Int_t i=0;i<13;i++)
380      for(Int_t i=0;i<l2->npmtadc[j];i++){                l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i];
381        l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i);            
382        l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i);            l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc;
383      }            for(Int_t i=0;i<l2->npmtadc[j];i++){
384      for(Int_t i=0;i<3;i++){                l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i);
385        l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i];                l2->adcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->adcflag.At(i); // gf: 30 Nov 2006
386        l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i];                l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i);
387      }            }
388    }            for(Int_t i=0;i<3;i++){
389                  l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i];
390                  l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i];
391              }
392          }
393      } //ELENA
394            
395    l2->npmt = PMT->GetEntries();    if(PMT){ //ELENA
396     for(Int_t j=0;j<l2->npmt;j++){        l2->npmt = PMT->GetEntries();
397       l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id;        for(Int_t j=0;j<l2->npmt;j++){
398       l2->adc[j] =((ToFPMT*)PMT->At(j))->adc;            l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id;
399       l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw;            l2->adc[j] =((ToFPMT*)PMT->At(j))->adc;
400     }            l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw;
401          }
402      } //ELENA
403  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.23