1 |
/** |
/** |
2 |
* FTrkCalibQLookExpert.cpp |
* FTrkCalibQLookExpert.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r06 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the data file to analyze |
* file - the data file to analyze |
8 |
* step - select =1 in order to analyze one event at time |
* step - select =1 in order to analyze one event at time |
18 |
#include <TPaveText.h> |
#include <TPaveText.h> |
19 |
#include <TLatex.h> |
#include <TLatex.h> |
20 |
#include <TCanvas.h> |
#include <TCanvas.h> |
21 |
|
#include <TFile.h> |
22 |
#include <TTree.h> |
#include <TTree.h> |
23 |
#include <TGraph.h> |
#include <TGraph.h> |
24 |
#include <TStyle.h> |
#include <TStyle.h> |
30 |
#include <CalibTrk2Event.h> |
#include <CalibTrk2Event.h> |
31 |
// |
// |
32 |
|
|
33 |
|
typedef struct caltrk_def{ |
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
|
|
if ( to == 0 ){ |
|
|
Int_t t2length = s2.Length(); |
|
|
s1 = ""; |
|
|
to = t2length; |
|
|
}; |
|
|
for (Int_t i = from; i<to; i++){ |
|
|
s1.Append(s2[i],1); |
|
|
}; |
|
|
}; |
|
|
|
|
|
typedef struct caltrk_def{ |
|
34 |
Int_t good0[2]; |
Int_t good0[2]; |
35 |
Int_t daqmode[12]; |
Int_t daqmode[12]; |
36 |
Int_t dspnum[12]; |
Int_t dspnum[12]; |
58 |
{ |
{ |
59 |
// |
// |
60 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
61 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
62 |
Int_t dwpos = filepath.rfind("/"); |
Int_t dwpos1 = file.Last('.'); |
63 |
Int_t dwpos1 = filepath.rfind(".root"); |
TString base,ffile ; |
64 |
TString fpath=(filepath.c_str()); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
65 |
TString base,ffile; |
if(dwpos>0) base=file(0,dwpos); |
|
stringcopy(base,fpath,0,dwpos); |
|
|
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
|
|
if(dwpos>0) base+="/"; |
|
66 |
|
|
67 |
TString out; |
TString out; |
68 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
70 |
}else{ |
}else{ |
71 |
out = outdir; |
out = outdir; |
72 |
} |
} |
73 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
74 |
|
|
75 |
// |
// |
76 |
// inizialise the variables and open the file |
// inizialise the variables and open the file |
77 |
Int_t nevents=0; |
Int_t nevents=0; |
78 |
Int_t minevent = 0; |
Int_t minevent = 0; |
79 |
Int_t maxevent = 0; |
Int_t maxevent = 0; |
80 |
ULong64_t FOBT[2], HOBT=0, TOBT=0; |
ULong64_t FOBT[2]; |
81 |
|
|
82 |
FOBT[0]=0; |
FOBT[0]=0; |
83 |
FOBT[1]=0; |
FOBT[1]=0; |
121 |
pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0; |
pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0; |
122 |
pamela::PscuHeader *ph=0; |
pamela::PscuHeader *ph=0; |
123 |
pamela::CalibTrk1Event *trk1 = 0; |
pamela::CalibTrk1Event *trk1 = 0; |
124 |
pamela::CalibTrk2Event *trk2 = 0; |
pamela::CalibTrk2Event *trk2 = 0; |
125 |
|
pamela::EventCounter *cod=0; |
126 |
|
|
127 |
|
pamela::PacketType *pctp=0; |
128 |
|
|
129 |
hotr = (TTree*)calibFile->Get("CalibHeader"); |
hotr = (TTree*)calibFile->Get("CalibHeader"); |
130 |
hotr->SetBranchAddress("Header", &eh4); |
hotr->SetBranchAddress("Header", &eh4); |
186 |
// |
// |
187 |
//********************************************************************** |
//********************************************************************** |
188 |
|
|
189 |
|
Int_t hcevent=hotr->GetEntries(); |
190 |
|
printf("\n%d\n",hcevent); |
191 |
|
ULong64_t HOBT[hcevent], TOBT[hcevent]; |
192 |
|
for (Int_t i = 0; i < hcevent; i++){ |
193 |
|
totr->GetEntry(i); |
194 |
|
hotr->GetEntry(i); |
195 |
|
ph = eh4->GetPscuHeader(); |
196 |
|
HOBT[i]= ph->GetOrbitalTime(); |
197 |
|
ph = eh3->GetPscuHeader(); |
198 |
|
TOBT[i]= ph->GetOrbitalTime(); |
199 |
|
} |
200 |
|
|
201 |
printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent); |
printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent); |
202 |
for (Int_t i = minevent; i < maxevent; i++){ |
for (Int_t i = minevent; i < maxevent; i++){ |
203 |
|
|
204 |
otr1->GetEntry(i); |
otr1->GetEntry(i); |
205 |
otr2->GetEntry(i); |
otr2->GetEntry(i); |
206 |
totr->GetEntry(i); |
|
|
hotr->GetEntry(i); |
|
|
ph = eh4->GetPscuHeader(); |
|
|
HOBT= ph->GetOrbitalTime(); |
|
|
ph = eh3->GetPscuHeader(); |
|
|
TOBT= ph->GetOrbitalTime(); |
|
|
|
|
207 |
ctrk.good0[0]=trk1->good0; |
ctrk.good0[0]=trk1->good0; |
208 |
ctrk.good0[1]=trk2->good0; |
ctrk.good0[1]=trk2->good0; |
209 |
for (Int_t m = 0; m < 6; m++){ |
for (Int_t m = 0; m < 6; m++){ |
210 |
ph = eh1->GetPscuHeader(); |
ph = eh1->GetPscuHeader(); |
211 |
|
cod = eh1->GetCounter(); |
212 |
FOBT[0]= ph->GetOrbitalTime(); |
FOBT[0]= ph->GetOrbitalTime(); |
213 |
ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; |
ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; |
214 |
ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; |
ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; |
257 |
ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; |
ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; |
258 |
ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; |
ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; |
259 |
ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; |
ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; |
260 |
}; |
} |
261 |
}; |
} |
262 |
|
|
263 |
|
|
264 |
// |
// |
266 |
Int_t risposta=0; |
Int_t risposta=0; |
267 |
stringstream fromfile; |
stringstream fromfile; |
268 |
|
|
269 |
fromfile<<"FTrkCalibQLook_EXPERT File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT<<" --"; |
printf("\n\t%d\n",cod->Get(pctp->CalibHeader)); |
270 |
|
fromfile<<"FTrkCalibQLook_EXPERT File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT[(cod->Get(pctp->CalibHeader))-1]<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT[(cod->Get(pctp->CalibHeader))-1]<<" --"; |
271 |
|
|
272 |
gStyle->SetLabelSize(0.08,"x"); |
gStyle->SetLabelSize(0.08,"x"); |
273 |
gStyle->SetLabelSize(0.08,"y"); |
gStyle->SetLabelSize(0.08,"y"); |