/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkStruct.cpp
ViewVC logotype

Diff of /DarthVader/TrackerLevel2/src/TrkStruct.cpp

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

revision 1.1 by mocchiut, Fri May 19 13:15:54 2006 UTC revision 1.2 by pam-fi, Tue May 30 16:30:37 2006 UTC
# Line 5  Line 5 
5   */   */
6  #include <TrkStruct.h>  #include <TrkStruct.h>
7    
 #include <TTree.h>  
 #include <CalibTrk1Event.h>  
 #include <CalibTrk2Event.h>  
 #include <fstream>  
 #include <iostream>  
8    
9  using namespace pamela;  using namespace pamela;
10  using namespace std;  using namespace std;
# Line 30  float anint(float f){ Line 25  float anint(float f){
25  /**  /**
26   * Method to fill the tracker calibration-parameter struct from on-line calibrations   * Method to fill the tracker calibration-parameter struct from on-line calibrations
27   */   */
28  void cTrkCalib::FillFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){  void cTrkCalib::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
29    
30          TTree *tr1 = (TTree*)f0->Get("CalibTrk1");            TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
31          TTree *tr2 = (TTree*)f0->Get("CalibTrk2");          TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
# Line 80  void cTrkCalib::FillFrom(TFile* f0, Int_ Line 75  void cTrkCalib::FillFrom(TFile* f0, Int_
75          tr1->Delete();          tr1->Delete();
76          tr2->Delete();          tr2->Delete();
77  };  };
78    
79    /**
80     * Method to fill the tracker calibration-parameter struct from on-line calibrations
81     */
82    void cTrkCalib::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
83    
84        TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
85        TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
86    
87        CalibTrk1Event *calibdata1 = 0;
88        CalibTrk2Event *calibdata2 = 0;
89        tr1->SetBranchAddress("CalibTrk1",&calibdata1);
90        tr2->SetBranchAddress("CalibTrk2",&calibdata2);
91        tr1->GetEntry(ev_reg1);
92        tr2->GetEntry(ev_reg2);
93        Int_t dspn1(0),dspn2(0);
94            
95        for(Int_t i=0;i<6;i++){
96            dspn1=calibdata1->DSPnumber[i]-1;
97            dspn2=calibdata2->DSPnumber[i]-1;
98            /*     cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl; */
99            for(Int_t ii=0;ii<3072;ii++){
100                Int_t j=(ii/128);
101                Int_t jj=ii-j*128;
102                pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];
103                pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];
104                sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];
105                sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];
106            //            cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
107            //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
108            //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
109            //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
110            
111                //
112                            // invert the bad
113                //
114                if(calibdata1->DSPbad_par[i][ii]==0)
115                    bad[jj][j][dspn1]=1;
116                else if(calibdata1->DSPbad_par[i][ii]==1)
117                    bad[jj][j][dspn1]=0;
118                if(calibdata2->DSPbad_par[i][ii]==0)
119                    bad[jj][j][dspn2]=1;
120                else if(calibdata2->DSPbad_par[i][ii]==1)
121                    bad[jj][j][dspn2]=0;
122            };
123        };
124            
125        tr1->Delete();
126        tr2->Delete();
127    };
128    /**
129     * Method to fill the tracker calibration-parameter struct from on-line calibrations
130     */
131    void cTrkCalib::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
132    
133        TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
134        TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
135    
136        CalibTrk1Event *calibdata1 = 0;
137        CalibTrk2Event *calibdata2 = 0;
138        tr1->SetBranchAddress("CalibTrk1",&calibdata1);
139        tr2->SetBranchAddress("CalibTrk2",&calibdata2);
140        tr1->GetEntry(ev_reg1);
141        tr2->GetEntry(ev_reg2);
142        Int_t dspn1(0),dspn2(0);
143            
144        for(Int_t i=0;i<6;i++){
145            dspn1=calibdata1->DSPnumber[i]-1;
146            dspn2=calibdata2->DSPnumber[i]-1;
147            /*     cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl; */
148            for(Int_t ii=0;ii<3072;ii++){
149                Int_t j=(ii/128);
150                Int_t jj=ii-j*128;
151                pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);
152                pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);
153                sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);
154                sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);
155            };
156        };
157            
158        tr1->Delete();
159        tr2->Delete();
160    };
161    /**
162     * Method to fill the tracker calibration-parameter struct from on-line calibrations
163     */
164    void cTrkCalib::FillTCalibFrom(TString path){
165        
166        path_.FillWith(path);
167        fillpedsigfromdefault_();
168        if(path_.error) throw -216;
169    
170    };
171    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.23