| 1 |
mocchiut |
1.1 |
/** |
| 2 |
|
|
* \file TrkStruct.h |
| 3 |
|
|
* \author Elena Vannuccini |
| 4 |
|
|
* \date |
| 5 |
|
|
*/ |
| 6 |
|
|
#include <TrkStruct.h> |
| 7 |
|
|
|
| 8 |
|
|
#include <TTree.h> |
| 9 |
|
|
#include <CalibTrk1Event.h> |
| 10 |
|
|
#include <CalibTrk2Event.h> |
| 11 |
|
|
#include <fstream> |
| 12 |
|
|
#include <iostream> |
| 13 |
|
|
|
| 14 |
|
|
using namespace pamela; |
| 15 |
|
|
using namespace std; |
| 16 |
|
|
|
| 17 |
|
|
float aint(float f){ |
| 18 |
|
|
int ret = (int)f; |
| 19 |
|
|
float ret1 = 0; |
| 20 |
|
|
ret1=(float)ret; |
| 21 |
|
|
return ret1; |
| 22 |
|
|
} |
| 23 |
|
|
|
| 24 |
|
|
float anint(float f){ |
| 25 |
|
|
int ret = (int)(f+0.5); |
| 26 |
|
|
float ret1 = 0; |
| 27 |
|
|
ret1=(float)ret; |
| 28 |
|
|
return ret1; |
| 29 |
|
|
} |
| 30 |
|
|
/** |
| 31 |
|
|
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
| 32 |
|
|
*/ |
| 33 |
|
|
void cTrkCalib::FillFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
| 34 |
|
|
|
| 35 |
|
|
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
| 36 |
|
|
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
| 37 |
|
|
|
| 38 |
|
|
CalibTrk1Event *calibdata1 = 0; |
| 39 |
|
|
CalibTrk2Event *calibdata2 = 0; |
| 40 |
|
|
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
| 41 |
|
|
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
| 42 |
|
|
tr1->GetEntry(ev_reg1); |
| 43 |
|
|
tr2->GetEntry(ev_reg2); |
| 44 |
|
|
Int_t dspn1(0),dspn2(0); |
| 45 |
|
|
|
| 46 |
|
|
for(Int_t i=0;i<6;i++){ |
| 47 |
|
|
dspn1=calibdata1->DSPnumber[i]-1; |
| 48 |
|
|
dspn2=calibdata2->DSPnumber[i]-1; |
| 49 |
|
|
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
| 50 |
|
|
for(Int_t ii=0;ii<3072;ii++){ |
| 51 |
|
|
Int_t j=(ii/128); |
| 52 |
|
|
Int_t jj=ii-j*128; |
| 53 |
|
|
pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
| 54 |
|
|
pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
| 55 |
|
|
pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
| 56 |
|
|
pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
| 57 |
|
|
sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
| 58 |
|
|
sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
| 59 |
|
|
sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
| 60 |
|
|
sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
| 61 |
|
|
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
| 62 |
|
|
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
| 63 |
|
|
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
| 64 |
|
|
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
| 65 |
|
|
|
| 66 |
|
|
// |
| 67 |
|
|
// invert the bad |
| 68 |
|
|
// |
| 69 |
|
|
if(calibdata1->DSPbad_par[i][ii]==0) |
| 70 |
|
|
bad[jj][j][dspn1]=1; |
| 71 |
|
|
else if(calibdata1->DSPbad_par[i][ii]==1) |
| 72 |
|
|
bad[jj][j][dspn1]=0; |
| 73 |
|
|
if(calibdata2->DSPbad_par[i][ii]==0) |
| 74 |
|
|
bad[jj][j][dspn2]=1; |
| 75 |
|
|
else if(calibdata2->DSPbad_par[i][ii]==1) |
| 76 |
|
|
bad[jj][j][dspn2]=0; |
| 77 |
|
|
}; |
| 78 |
|
|
}; |
| 79 |
|
|
|
| 80 |
|
|
tr1->Delete(); |
| 81 |
|
|
tr2->Delete(); |
| 82 |
|
|
}; |