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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Thu Nov 30 17:05:09 2006 UTC (18 years ago) by pam-fi
Branch: MAIN
CVS Tags: v2r01, v3r00
Changes since 1.4: +1 -1 lines
*** empty log message ***

1 mocchiut 1.1 /**
2     * \file TrkStruct.h
3     * \author Elena Vannuccini
4     * \date
5     */
6     #include <TrkStruct.h>
7    
8    
9     using namespace pamela;
10     using namespace std;
11    
12     float aint(float f){
13     int ret = (int)f;
14     float ret1 = 0;
15     ret1=(float)ret;
16     return ret1;
17     }
18    
19     float anint(float f){
20     int ret = (int)(f+0.5);
21     float ret1 = 0;
22     ret1=(float)ret;
23 pam-fi 1.4 return ret1;
24 mocchiut 1.1 }
25     /**
26     * Method to fill the tracker calibration-parameter struct from on-line calibrations
27     */
28 pam-fi 1.2 void cTrkCalib::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
29 mocchiut 1.1
30 pam-fi 1.4 TTree *tr1 = (TTree*)f0->Get("CalibTrk1");
31     TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
32 mocchiut 1.1
33 pam-fi 1.4 CalibTrk1Event *calibdata1 = 0;
34     CalibTrk2Event *calibdata2 = 0;
35     tr1->SetBranchAddress("CalibTrk1",&calibdata1);
36     tr2->SetBranchAddress("CalibTrk2",&calibdata2);
37     tr1->GetEntry(ev_reg1);
38     tr2->GetEntry(ev_reg2);
39     Int_t dspn1(0),dspn2(0);
40    
41     for(Int_t i=0;i<6;i++){
42     dspn1=calibdata1->DSPnumber[i]-1;
43     dspn2=calibdata2->DSPnumber[i]-1;
44 mocchiut 1.1 /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */
45 pam-fi 1.4 for(Int_t ii=0;ii<3072;ii++){
46     Int_t j=(ii/128);
47     Int_t jj=ii-j*128;
48     pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];
49     pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];
50     pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);
51     pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);
52     sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];
53     sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];
54     sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);
55     sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);
56     // cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
57     // cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
58     // cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
59     // cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
60    
61     //
62     // invert the bad
63     //
64     if(calibdata1->DSPbad_par[i][ii]==0)
65     bad[jj][j][dspn1]=1;
66     else if(calibdata1->DSPbad_par[i][ii]==1)
67     bad[jj][j][dspn1]=0;
68     if(calibdata2->DSPbad_par[i][ii]==0)
69     bad[jj][j][dspn2]=1;
70     else if(calibdata2->DSPbad_par[i][ii]==1)
71     bad[jj][j][dspn2]=0;
72 mocchiut 1.1 };
73 pam-fi 1.4 };
74 mocchiut 1.1
75 pam-fi 1.4 tr1->Delete();
76     tr2->Delete();
77 mocchiut 1.1 };
78 pam-fi 1.2
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 pam-fi 1.4 // 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 pam-fi 1.2
111     //
112 pam-fi 1.4 // invert the bad
113 pam-fi 1.2 //
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 pam-fi 1.3 * Method to fill the tracker calibration-parameter struct from default calibration
163 pam-fi 1.2 */
164     void cTrkCalib::FillTCalibFrom(TString path){
165    
166     path_.FillWith(path);
167     fillpedsigfromdefault_();
168     if(path_.error) throw -216;
169    
170     };
171    
172 pam-fi 1.4 /**
173     * Method to fill the tracker VA1-mask struct from calibration
174     */
175     void cTrkMask::Set(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
176    
177     TrkCalib *calib = new TrkCalib();
178    
179     for(Int_t i=0; i<2; i++){
180     TTree *tr=0;
181     if(i==0){
182     //-------------------------
183     //read calibration packet 1
184     //-------------------------
185     tr = (TTree*)f0->Get("CalibTrk1");
186     tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo());
187     tr->GetEntry(ev_reg1);
188     }
189     if(i==1){
190     //-------------------------
191     //read calibration packet 2
192     //-------------------------
193     tr = (TTree*)f0->Get("CalibTrk2");
194     tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo());
195     tr->GetEntry(ev_reg2);
196     }
197     for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){
198     for(Int_t ivk=0; ivk<NVK; ivk++){
199     Int_t view = calib->GetView(ipkt);
200     Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1);
201     Float_t sigmin = 0.;
202     if(view%2)sigmin = 6.5;
203     else sigmin = 2.5;
204     Int_t mask = 1;
205     if( sigm<sigmin )mask = 0;
206    
207     mask_vk_run[ivk][view-1] = mask;
208    
209 pam-fi 1.5 // if(mask==0)cout<< " VIEW "<<view<<" VK "<<ivk+1<<" -- <SIG> "<<sigm<<" ---> MASKED!"<<endl;
210 pam-fi 1.4 }
211     }
212     if(tr)tr->Delete();
213     }
214    
215     if(calib)calib->Delete();
216    
217     };

  ViewVC Help
Powered by ViewVC 1.1.23