/[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.9 by mocchiut, Thu Nov 30 15:44:55 2006 UTC revision 1.10 by pam-fi, Thu Jan 11 09:34:27 2007 UTC
# Line 79  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();    this->Clear();
88    //    //
# Line 88  ToFLevel2::ToFLevel2() {     Line 90  ToFLevel2::ToFLevel2() {    
90    
91  void ToFLevel2::Clear(){  void ToFLevel2::Clear(){
92    //    //
93    ToFTrk->Clear();    if(ToFTrk)ToFTrk->Delete(); //ELENA
94    PMT->Clear();    if(PMT)PMT->Delete(); //ELENA
95    memset(tof_j_flag, 0, 6*sizeof(Int_t));    memset(tof_j_flag, 0, 6*sizeof(Int_t));
96    unpackError = 0;    unpackError = 0;
97    //    //
98  };  };
99    
100    void ToFLevel2::Delete(){ //ELENA
101      //
102      if(ToFTrk){
103          ToFTrk->Delete(); //ELENA
104          delete ToFTrk;  //ELENA
105      }
106      if(PMT){
107          PMT->Delete(); //ELENA
108          delete PMT; //ELENA
109      } //ELENA
110      //
111    }; //ELENA
112    
113  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){
114    //        //    
115    if(itrk >= ntrk()){    if(itrk >= ntrk()){
# Line 103  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t Line 118  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t
118      return(NULL);      return(NULL);
119    }      }  
120    //    //
121      if(!ToFTrk)return 0; //ELENA
122    TClonesArray &t = *(ToFTrk);    TClonesArray &t = *(ToFTrk);
123    ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk];    ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk];
124    return toftrack;    return toftrack;
# Line 116  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit) Line 132  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit)
132      return(NULL);      return(NULL);
133    }      }  
134    //    //
135      if(!PMT)return 0; //ELENA
136    TClonesArray &t = *(PMT);    TClonesArray &t = *(PMT);
137    ToFPMT *tofpmt = (ToFPMT*)t[ihit];    ToFPMT *tofpmt = (ToFPMT*)t[ihit];
138    return tofpmt;    return tofpmt;
# Line 146  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit) Line 163  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit)
163        else return -1;        else return -1;
164    };    };
165  /**  /**
166   * 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
167     * from both PMTs
168   * @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).
169   * @param paddle_id Paddle ID.   * @param paddle_id Paddle ID.
170   * @return 1 if the paddle was hit.   * @return 1 if the paddle was hit.
# Line 179  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 197  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
197    
198    
199  Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane){  Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane){
200    
201    Float_t dedx = 0.;    Float_t dedx = 0.;
202    Int_t ip = 0;    Int_t ip = 0;
203    Int_t pmt_id = 0;    Int_t pmt_id = 0;
# Line 190  Float_t ToFLevel2::GetdEdx(Int_t notrack Line 209  Float_t ToFLevel2::GetdEdx(Int_t notrack
209    };    };
210    //    //
211    ToFTrkVar *trk = GetToFTrkVar(notrack);    ToFTrkVar *trk = GetToFTrkVar(notrack);
212      if(!trk) return 0; //ELENA
213    //    //
214    for (Int_t i=0; i<trk->npmtadc; i++){    for (Int_t i=0; i<trk->npmtadc; i++){
215      //      //
# Line 197  Float_t ToFLevel2::GetdEdx(Int_t notrack Line 217  Float_t ToFLevel2::GetdEdx(Int_t notrack
217      //      //
218      pl = GetPlaneIndex(pmt_id);      pl = GetPlaneIndex(pmt_id);
219      //      //
220      if ( pl == ip ) dedx += (trk->dedx).At(i);        if ( pl == ip ){
221    //      // --- patch ---
222    //      bool ISNULL=false;
223    //      for(Int_t im=0; im< this->npmt(); im++){            
224    //          if(this->GetToFPMT(im)->pmt_id == pmt_id && this->GetToFPMT(im)->adc == 4095){
225    //              cout << " ToFLevel2::GetdEdx(Int_t,Int_t) --> **warning** ADC(PMT="<<pmt_id<<") = 4095"<<endl;
226    //              ISNULL=true;
227    //          }
228    //      }
229    //      // --- patch ---
230    //      dedx += (trk->dedx).At(i)*(Int_t)(!ISNULL);
231            dedx += (trk->dedx).At(i);
232        }
233      //      //
234    };    };
235    //    //
# Line 219  void ToFLevel2::GetMatrix(Int_t notrack, Line 251  void ToFLevel2::GetMatrix(Int_t notrack,
251    Int_t kk = 0;    Int_t kk = 0;
252    //    //
253    ToFTrkVar *trk = GetToFTrkVar(notrack);    ToFTrkVar *trk = GetToFTrkVar(notrack);
254      if(!trk)return; //ELENA
255    //    //
256    for (Int_t i=0; i<trk->npmtadc; i++){    for (Int_t i=0; i<trk->npmtadc; i++){
257      //      //
# Line 232  void ToFLevel2::GetMatrix(Int_t notrack, Line 265  void ToFLevel2::GetMatrix(Int_t notrack,
265    for (Int_t i=0; i<npmt(); i++){    for (Int_t i=0; i<npmt(); i++){
266      //      //
267      ToFPMT *pmt = GetToFPMT(i);      ToFPMT *pmt = GetToFPMT(i);
268        if(!pmt)break; //ELENA
269      //      //
270      GetPMTIndex(pmt->pmt_id,hh,kk);      GetPMTIndex(pmt->pmt_id,hh,kk);
271      //      //
# Line 340  void ToFLevel2::GetLevel2Struct(cToFLeve Line 374  void ToFLevel2::GetLevel2Struct(cToFLeve
374    for(Int_t i=0;i<6;i++)    for(Int_t i=0;i<6;i++)
375      l2->tof_j_flag[i]=tof_j_flag[i];      l2->tof_j_flag[i]=tof_j_flag[i];
376    
377    l2->ntoftrk = ToFTrk->GetEntries();    if(ToFTrk){ //ELENA
378    for(Int_t j=0;j<l2->ntoftrk;j++){        l2->ntoftrk = ToFTrk->GetEntries();
379      l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno;        for(Int_t j=0;j<l2->ntoftrk;j++){
380      l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc;            l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno;
381      for(Int_t i=0;i<l2->npmttdc[j];i++){            l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc;
382        l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i);            for(Int_t i=0;i<l2->npmttdc[j];i++){
383        l2->tdcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->tdcflag.At(i); // gf: 30 Nov 2006                l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i);
384      }                l2->tdcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->tdcflag.At(i); // gf: 30 Nov 2006
385      for(Int_t i=0;i<13;i++)            }
386        l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i];            for(Int_t i=0;i<13;i++)
387                      l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i];
388      l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc;            
389      for(Int_t i=0;i<l2->npmtadc[j];i++){            l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc;
390        l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i);            for(Int_t i=0;i<l2->npmtadc[j];i++){
391        l2->adcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->adcflag.At(i); // gf: 30 Nov 2006                l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i);
392        l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i);                l2->adcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->adcflag.At(i); // gf: 30 Nov 2006
393      }                l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i);
394      for(Int_t i=0;i<3;i++){            }
395        l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i];            for(Int_t i=0;i<3;i++){
396        l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i];                l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i];
397      }                l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i];
398    }            }
399          }
400      } //ELENA
401            
402    l2->npmt = PMT->GetEntries();    if(PMT){ //ELENA
403     for(Int_t j=0;j<l2->npmt;j++){        l2->npmt = PMT->GetEntries();
404       l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id;        for(Int_t j=0;j<l2->npmt;j++){
405       l2->adc[j] =((ToFPMT*)PMT->At(j))->adc;            l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id;
406       l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw;            l2->adc[j] =((ToFPMT*)PMT->At(j))->adc;
407     }            l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw;
408          }
409      } //ELENA
410  }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.23