| 4 |
// |
// |
| 5 |
// NB: Check length physics packet [packet type (0x10 = physics data)] |
// NB: Check length physics packet [packet type (0x10 = physics data)] |
| 6 |
// |
// |
|
#include <sstream> |
|
|
#include <fstream> |
|
|
#include <stdlib.h> |
|
|
#include <stdio.h> |
|
|
#include <string.h> |
|
|
#include <ctype.h> |
|
|
#include <time.h> |
|
|
#include "Riostream.h" |
|
|
#include "TFile.h" |
|
|
#include "TDirectory.h" |
|
|
#include "TTree.h" |
|
|
#include "TLeafI.h" |
|
|
#include "TH1.h" |
|
|
#include "TH2.h" |
|
|
#include "TF1.h" |
|
|
#include "TMath.h" |
|
|
#include "TRandom.h" |
|
|
#include "TSQLServer.h" |
|
|
#include "TSystem.h" |
|
|
#include "CalibTrk1Event.h" |
|
|
#include "CalibTrk2Event.h" |
|
|
// |
|
| 7 |
#include "Digitizer.h" |
#include "Digitizer.h" |
| 8 |
#include "CRC.h" |
|
|
// |
|
|
#include <PamelaRun.h> |
|
|
#include <physics/calorimeter/CalorimeterEvent.h> |
|
|
#include <CalibCalPedEvent.h> |
|
|
#include "GLTables.h" |
|
|
// |
|
| 9 |
extern "C"{ |
extern "C"{ |
| 10 |
short crc(short, short); |
short crc(short, short); |
| 11 |
}; |
}; |
| 12 |
// |
// |
| 13 |
|
|
| 14 |
Digitizer::Digitizer(TTree* tree, char* &file_raw){ |
Digitizer::Digitizer(TTree* tree, char* &file_raw,int nspe1=200,int ntof1=200,int ncat1=50,int ncas1=50,int ncar1=100,int ncal1=1000,int nnd1=200,int nstr1=1000){ |
| 15 |
|
nspe=new int[1]; |
| 16 |
|
ntof=new int[1]; |
| 17 |
|
ncat=new int[1]; |
| 18 |
|
ncas=new int[1]; |
| 19 |
|
ncar=new int[1]; |
| 20 |
|
ncal=new int[1]; |
| 21 |
|
nnd=new int[1]; |
| 22 |
|
nstr=new int[1]; |
| 23 |
|
|
| 24 |
|
*nspe=nspe1; |
| 25 |
|
*ntof=ntof1; |
| 26 |
|
*ncat=ncat1; |
| 27 |
|
*ncas=ncas1; |
| 28 |
|
*ncar=ncar1; |
| 29 |
|
*ncal=ncal1; |
| 30 |
|
*nnd=nnd1; |
| 31 |
|
*nstr=nstr1; |
| 32 |
|
|
| 33 |
fhBookTree = tree; |
fhBookTree = tree; |
| 34 |
fFilename = file_raw; |
fFilename = file_raw; |
| 35 |
fCounter = 0; |
fCounter = 0; |
| 70 |
|
|
| 71 |
std:: cout << "preparing tree" << endl; |
std:: cout << "preparing tree" << endl; |
| 72 |
|
|
| 73 |
|
Ipltof=(UChar_t*)malloc(*ntof *sizeof(UChar_t)); |
| 74 |
|
Ipaddle=(UChar_t*)malloc(*ntof *sizeof(UChar_t)); |
| 75 |
|
Ipartof=(UShort_t*)malloc(*ntof *sizeof(UShort_t)); |
| 76 |
|
// Ipartof=(UChar_t*)malloc(*ntof *sizeof(UChar_t));//DPMJET |
| 77 |
|
Xintof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 78 |
|
Yintof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 79 |
|
Zintof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 80 |
|
Xouttof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 81 |
|
Youttof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 82 |
|
Zouttof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 83 |
|
Ereltof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 84 |
|
Timetof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 85 |
|
Pathtof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 86 |
|
P0tof=(Float_t*)malloc(*ntof *sizeof(Float_t)); |
| 87 |
|
Iparcat=(UChar_t*)malloc(*ncat *sizeof(UChar_t)); |
| 88 |
|
Icat=(UChar_t*)malloc(*ncat *sizeof(UChar_t)); |
| 89 |
|
Xincat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 90 |
|
Yincat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 91 |
|
Zincat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 92 |
|
Xoutcat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 93 |
|
Youtcat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 94 |
|
Zoutcat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 95 |
|
Erelcat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 96 |
|
Timecat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 97 |
|
Pathcat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 98 |
|
P0cat=(Float_t*)malloc(*ncat *sizeof(Float_t)); |
| 99 |
|
Iparcas=(UChar_t*)malloc(*ncas *sizeof(UChar_t)); |
| 100 |
|
Icas=(UChar_t*)malloc(*ncas *sizeof(UChar_t)); |
| 101 |
|
Xincas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 102 |
|
Yincas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 103 |
|
Zincas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 104 |
|
Xoutcas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 105 |
|
Youtcas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 106 |
|
Zoutcas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 107 |
|
Erelcas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 108 |
|
Timecas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 109 |
|
Pathcas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 110 |
|
P0cas=(Float_t*)malloc(*ncas *sizeof(Float_t)); |
| 111 |
|
// Iparspe=(UShort_t*)malloc(*nspe *sizeof(UShort_t)); |
| 112 |
|
// Iparspe=(UChar_t*)malloc(*nspe *sizeof(UChar_t)); |
| 113 |
|
Itrpb=(UChar_t*)malloc(*nspe *sizeof(UChar_t)); |
| 114 |
|
Itrsl=(UChar_t*)malloc(*nspe *sizeof(UChar_t)); |
| 115 |
|
Itspa=(UChar_t*)malloc(*nspe *sizeof(UChar_t)); |
| 116 |
|
Xinspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 117 |
|
Yinspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 118 |
|
Zinspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 119 |
|
Xoutspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 120 |
|
Youtspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 121 |
|
Zoutspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 122 |
|
Xavspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 123 |
|
Yavspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 124 |
|
Zavspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 125 |
|
Erelspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 126 |
|
Pathspe=(Float_t*)malloc(*nspe *sizeof(Float_t)); |
| 127 |
|
P0spe=(Float_t*)malloc(*nspe *sizeof(Float_t));; |
| 128 |
|
Nxmult=(UChar_t*)malloc(*nspe *sizeof(UChar_t)); |
| 129 |
|
Nymult=(UChar_t*)malloc(*nspe *sizeof(UChar_t)); |
| 130 |
|
Istripx=(UShort_t*)malloc(*nstr *sizeof(UShort_t)); |
| 131 |
|
Qstripx=(Float_t*)malloc(*nstr *sizeof(Float_t)); |
| 132 |
|
Xstripx=(Float_t*)malloc(*nstr *sizeof(Float_t)); |
| 133 |
|
Npstripx=(UChar_t*)malloc(*nstr *sizeof(UChar_t)); |
| 134 |
|
Ntstripx=(UChar_t*)malloc(*nstr *sizeof(UChar_t)); |
| 135 |
|
Npstripy=(UChar_t*)malloc(*nstr *sizeof(UChar_t)); |
| 136 |
|
Ntstripy=(UChar_t*)malloc(*nstr *sizeof(UChar_t)); |
| 137 |
|
Istripy=(UShort_t*)malloc(*nstr *sizeof(UShort_t)); |
| 138 |
|
Qstripy=(Float_t*)malloc(*nstr *sizeof(Float_t)); |
| 139 |
|
Ystripy=(Float_t*)malloc(*nstr *sizeof(Float_t)); |
| 140 |
|
Icapl=(UChar_t*)malloc(*ncal *sizeof(UChar_t)); |
| 141 |
|
Icasi=(UChar_t*)malloc(*ncal *sizeof(UChar_t)); |
| 142 |
|
Icast=(UChar_t*)malloc(*ncal *sizeof(UChar_t)); |
| 143 |
|
Xincal=(Float_t*)malloc(*ncal *sizeof(Float_t)); |
| 144 |
|
Yincal=(Float_t*)malloc(*ncal *sizeof(Float_t)); |
| 145 |
|
Zincal=(Float_t*)malloc(*ncal *sizeof(Float_t)); |
| 146 |
|
Erelcal=(Float_t*)malloc(*ncal *sizeof(Float_t)); |
| 147 |
|
Itubend=(UChar_t*)malloc(*nnd *sizeof(UChar_t)); |
| 148 |
|
Iparnd=(UChar_t*)malloc(*nnd *sizeof(UChar_t)); |
| 149 |
|
Xinnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 150 |
|
Yinnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 151 |
|
Zinnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 152 |
|
Xoutnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 153 |
|
Youtnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 154 |
|
Zoutnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 155 |
|
Erelnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 156 |
|
Timend=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 157 |
|
Pathnd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 158 |
|
P0nd=(Float_t*)malloc(*nnd *sizeof(Float_t)); |
| 159 |
|
Iparcard=(UChar_t*)malloc(*ncar *sizeof(UChar_t)); |
| 160 |
|
Icard=(UChar_t*)malloc(*ncar *sizeof(UChar_t)); |
| 161 |
|
Xincard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 162 |
|
Yincard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 163 |
|
Zincard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 164 |
|
Xoutcard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 165 |
|
Youtcard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 166 |
|
Zoutcard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 167 |
|
Erelcard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 168 |
|
Timecard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 169 |
|
Pathcard=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 170 |
|
P0card=(Float_t*)malloc(*ncar *sizeof(Float_t)); |
| 171 |
|
|
| 172 |
|
|
| 173 |
|
|
| 174 |
// prepare tree//modified by E.Vannuccini 03/08 |
// prepare tree//modified by E.Vannuccini 03/08 |
| 175 |
if(fhBookTree->GetBranch("Irun"))fhBookTree->SetBranchAddress("Irun",&Irun); |
if(fhBookTree->GetBranch("Irun"))fhBookTree->SetBranchAddress("Irun",&Irun); |
| 176 |
if(fhBookTree->GetBranch("Ievnt"))fhBookTree->SetBranchAddress("Ievnt",&Ievnt); |
if(fhBookTree->GetBranch("Ievnt"))fhBookTree->SetBranchAddress("Ievnt",&Ievnt); |
| 182 |
if(fhBookTree->GetBranch("Phi"))fhBookTree->SetBranchAddress("Phi",&Phi); |
if(fhBookTree->GetBranch("Phi"))fhBookTree->SetBranchAddress("Phi",&Phi); |
| 183 |
if(fhBookTree->GetBranch("P0"))fhBookTree->SetBranchAddress("P0",&P0); |
if(fhBookTree->GetBranch("P0"))fhBookTree->SetBranchAddress("P0",&P0); |
| 184 |
if(fhBookTree->GetBranch("Nthtof"))fhBookTree->SetBranchAddress("Nthtof",&Nthtof); |
if(fhBookTree->GetBranch("Nthtof"))fhBookTree->SetBranchAddress("Nthtof",&Nthtof); |
| 185 |
if(fhBookTree->GetBranch("Ipltof"))fhBookTree->SetBranchAddress("Ipltof",Ipltof); |
if(fhBookTree->GetBranch("Ipltof"))fhBookTree->SetBranchAddress("Ipltof",Ipltof);/////////////////////////// |
| 186 |
if(fhBookTree->GetBranch("Ipaddle"))fhBookTree->SetBranchAddress("Ipaddle",Ipaddle); |
if(fhBookTree->GetBranch("Ipaddle"))fhBookTree->SetBranchAddress("Ipaddle",Ipaddle); |
| 187 |
if(fhBookTree->GetBranch("Ipartof"))fhBookTree->SetBranchAddress("Ipartof",Ipartof); |
if(fhBookTree->GetBranch("Ipartof"))fhBookTree->SetBranchAddress("Ipartof",Ipartof); |
| 188 |
if(fhBookTree->GetBranch("Xintof"))fhBookTree->SetBranchAddress("Xintof",Xintof); |
if(fhBookTree->GetBranch("Xintof"))fhBookTree->SetBranchAddress("Xintof",Xintof); |
| 210 |
if(fhBookTree->GetBranch("P0cat"))fhBookTree->SetBranchAddress("P0cat",P0cat); |
if(fhBookTree->GetBranch("P0cat"))fhBookTree->SetBranchAddress("P0cat",P0cat); |
| 211 |
if(fhBookTree->GetBranch("Nthcas"))fhBookTree->SetBranchAddress("Nthcas",&Nthcas); |
if(fhBookTree->GetBranch("Nthcas"))fhBookTree->SetBranchAddress("Nthcas",&Nthcas); |
| 212 |
if(fhBookTree->GetBranch("Iparcas"))fhBookTree->SetBranchAddress("Iparcas",Iparcas); |
if(fhBookTree->GetBranch("Iparcas"))fhBookTree->SetBranchAddress("Iparcas",Iparcas); |
| 213 |
if(fhBookTree->GetBranch("Icas"))fhBookTree->SetBranchAddress("Icas",Icas); |
if(fhBookTree->GetBranch("Icas"))fhBookTree->SetBranchAddress("Icas",Icas);/////////////////////////////// |
| 214 |
if(fhBookTree->GetBranch("Xincas"))fhBookTree->SetBranchAddress("Xincas",Xincas); |
if(fhBookTree->GetBranch("Xincas"))fhBookTree->SetBranchAddress("Xincas",Xincas); |
| 215 |
if(fhBookTree->GetBranch("Yincas"))fhBookTree->SetBranchAddress("Yincas",Yincas); |
if(fhBookTree->GetBranch("Yincas"))fhBookTree->SetBranchAddress("Yincas",Yincas); |
| 216 |
if(fhBookTree->GetBranch("Zincas"))fhBookTree->SetBranchAddress("Zincas",Zincas); |
if(fhBookTree->GetBranch("Zincas"))fhBookTree->SetBranchAddress("Zincas",Zincas); |
| 222 |
if(fhBookTree->GetBranch("Pathcas"))fhBookTree->SetBranchAddress("Pathcas",Pathcas); |
if(fhBookTree->GetBranch("Pathcas"))fhBookTree->SetBranchAddress("Pathcas",Pathcas); |
| 223 |
if(fhBookTree->GetBranch("P0cas"))fhBookTree->SetBranchAddress("P0cas",P0cas); |
if(fhBookTree->GetBranch("P0cas"))fhBookTree->SetBranchAddress("P0cas",P0cas); |
| 224 |
if(fhBookTree->GetBranch("Nthspe"))fhBookTree->SetBranchAddress("Nthspe",&Nthspe); |
if(fhBookTree->GetBranch("Nthspe"))fhBookTree->SetBranchAddress("Nthspe",&Nthspe); |
| 225 |
if(fhBookTree->GetBranch("Iparspe"))fhBookTree->SetBranchAddress("Iparspe",Iparspe); |
// if(fhBookTree->GetBranch("Iparspe"))fhBookTree->SetBranchAddress("Iparspe",Iparspe); |
| 226 |
if(fhBookTree->GetBranch("Itrpb"))fhBookTree->SetBranchAddress("Itrpb",Itrpb); |
if(fhBookTree->GetBranch("Itrpb"))fhBookTree->SetBranchAddress("Itrpb",Itrpb); |
| 227 |
if(fhBookTree->GetBranch("Itrsl"))fhBookTree->SetBranchAddress("Itrsl",Itrsl); |
if(fhBookTree->GetBranch("Itrsl"))fhBookTree->SetBranchAddress("Itrsl",Itrsl); |
| 228 |
if(fhBookTree->GetBranch("Itspa"))fhBookTree->SetBranchAddress("Itspa",Itspa); |
if(fhBookTree->GetBranch("Itspa"))fhBookTree->SetBranchAddress("Itspa",Itspa); |
| 250 |
if(fhBookTree->GetBranch("Npstripy"))fhBookTree->SetBranchAddress("Npstripy",Npstripy); |
if(fhBookTree->GetBranch("Npstripy"))fhBookTree->SetBranchAddress("Npstripy",Npstripy); |
| 251 |
if(fhBookTree->GetBranch("Ntstripy"))fhBookTree->SetBranchAddress("Ntstripy",Ntstripy); |
if(fhBookTree->GetBranch("Ntstripy"))fhBookTree->SetBranchAddress("Ntstripy",Ntstripy); |
| 252 |
if(fhBookTree->GetBranch("Istripy"))fhBookTree->SetBranchAddress("Istripy",Istripy); |
if(fhBookTree->GetBranch("Istripy"))fhBookTree->SetBranchAddress("Istripy",Istripy); |
| 253 |
if(fhBookTree->GetBranch("Qstripy"))fhBookTree->SetBranchAddress("Qstripy",Qstripy); |
if(fhBookTree->GetBranch("Qstripy"))fhBookTree->SetBranchAddress("Qstripy",Qstripy);/////////////////////// |
| 254 |
if(fhBookTree->GetBranch("Ystripy"))fhBookTree->SetBranchAddress("Ystripy",Ystripy); |
if(fhBookTree->GetBranch("Ystripy"))fhBookTree->SetBranchAddress("Ystripy",Ystripy); |
| 255 |
if(fhBookTree->GetBranch("Nthcali"))fhBookTree->SetBranchAddress("Nthcali",&Nthcali); |
if(fhBookTree->GetBranch("Nthcali"))fhBookTree->SetBranchAddress("Nthcali",&Nthcali); |
| 256 |
if(fhBookTree->GetBranch("Icaplane"))fhBookTree->SetBranchAddress("Icaplane",Icaplane); |
if(fhBookTree->GetBranch("Icaplane"))fhBookTree->SetBranchAddress("Icaplane",Icaplane); |
| 268 |
if(fhBookTree->GetBranch("Nthnd"))fhBookTree->SetBranchAddress("Nthnd",&Nthnd); |
if(fhBookTree->GetBranch("Nthnd"))fhBookTree->SetBranchAddress("Nthnd",&Nthnd); |
| 269 |
if(fhBookTree->GetBranch("Itubend"))fhBookTree->SetBranchAddress("Itubend",Itubend); |
if(fhBookTree->GetBranch("Itubend"))fhBookTree->SetBranchAddress("Itubend",Itubend); |
| 270 |
if(fhBookTree->GetBranch("Iparnd"))fhBookTree->SetBranchAddress("Iparnd",Iparnd); |
if(fhBookTree->GetBranch("Iparnd"))fhBookTree->SetBranchAddress("Iparnd",Iparnd); |
| 271 |
if(fhBookTree->GetBranch("Xinnd"))fhBookTree->SetBranchAddress("Xinnd",Xinnd); |
if(fhBookTree->GetBranch("Xinnd"))fhBookTree->SetBranchAddress("Xinnd",Xinnd);///////////////////////// |
| 272 |
if(fhBookTree->GetBranch("Yinnd"))fhBookTree->SetBranchAddress("Yinnd",Yinnd); |
if(fhBookTree->GetBranch("Yinnd"))fhBookTree->SetBranchAddress("Yinnd",Yinnd); |
| 273 |
if(fhBookTree->GetBranch("Zinnd"))fhBookTree->SetBranchAddress("Zinnd",Zinnd); |
if(fhBookTree->GetBranch("Zinnd"))fhBookTree->SetBranchAddress("Zinnd",Zinnd); |
| 274 |
if(fhBookTree->GetBranch("Xoutnd"))fhBookTree->SetBranchAddress("Xoutnd",Xoutnd); |
if(fhBookTree->GetBranch("Xoutnd"))fhBookTree->SetBranchAddress("Xoutnd",Xoutnd); |
| 278 |
if(fhBookTree->GetBranch("Timend"))fhBookTree->SetBranchAddress("Timend",Timend); |
if(fhBookTree->GetBranch("Timend"))fhBookTree->SetBranchAddress("Timend",Timend); |
| 279 |
if(fhBookTree->GetBranch("Pathnd"))fhBookTree->SetBranchAddress("Pathnd",Pathnd); |
if(fhBookTree->GetBranch("Pathnd"))fhBookTree->SetBranchAddress("Pathnd",Pathnd); |
| 280 |
if(fhBookTree->GetBranch("P0nd"))fhBookTree->SetBranchAddress("P0nd",P0nd); |
if(fhBookTree->GetBranch("P0nd"))fhBookTree->SetBranchAddress("P0nd",P0nd); |
| 281 |
if(fhBookTree->GetBranch("Nthcard"))fhBookTree->SetBranchAddress("Nthcard",&Nthcard); |
if(fhBookTree->GetBranch("Nthcard"))fhBookTree->SetBranchAddress("Nthcard",&Nthcard);///////////////////// |
| 282 |
if(fhBookTree->GetBranch("Iparcard"))fhBookTree->SetBranchAddress("Iparcard",Iparcard); |
if(fhBookTree->GetBranch("Iparcard"))fhBookTree->SetBranchAddress("Iparcard",Iparcard); |
| 283 |
if(fhBookTree->GetBranch("Icard"))fhBookTree->SetBranchAddress("Icard",Icard); |
if(fhBookTree->GetBranch("Icard"))fhBookTree->SetBranchAddress("Icard",Icard); |
| 284 |
if(fhBookTree->GetBranch("Xincard"))fhBookTree->SetBranchAddress("Xincard",Xincard); |
if(fhBookTree->GetBranch("Xincard"))fhBookTree->SetBranchAddress("Xincard",Xincard); |
| 285 |
if(fhBookTree->GetBranch("Yincard"))fhBookTree->SetBranchAddress("Yincard",Yincard); |
if(fhBookTree->GetBranch("Yincard"))fhBookTree->SetBranchAddress("Yincard",Yincard); |
| 286 |
if(fhBookTree->GetBranch("Zincard"))fhBookTree->SetBranchAddress("Zincard",Zincard); |
if(fhBookTree->GetBranch("Zincard"))fhBookTree->SetBranchAddress("Zincard",Zincard); |
| 287 |
if(fhBookTree->GetBranch("Xoutcard"))fhBookTree->SetBranchAddress("Xoutcard",Xoutcard); |
if(fhBookTree->GetBranch("Xoutcard"))fhBookTree->SetBranchAddress("Xoutcard",Xoutcard); |
| 288 |
if(fhBookTree->GetBranch("Youtcard"))fhBookTree->SetBranchAddress("Youtcard",Youtcard); |
if(fhBookTree->GetBranch("Youtcard"))fhBookTree->SetBranchAddress("Youtcard",Youtcard);///////////////// |
| 289 |
if(fhBookTree->GetBranch("Zoutcard"))fhBookTree->SetBranchAddress("Zoutcard",Zoutcard); |
if(fhBookTree->GetBranch("Zoutcard"))fhBookTree->SetBranchAddress("Zoutcard",Zoutcard); |
| 290 |
if(fhBookTree->GetBranch("Erelcard"))fhBookTree->SetBranchAddress("Erelcard",Erelcard); |
if(fhBookTree->GetBranch("Erelcard"))fhBookTree->SetBranchAddress("Erelcard",Erelcard); |
| 291 |
if(fhBookTree->GetBranch("Timecard"))fhBookTree->SetBranchAddress("Timecard",Timecard); |
if(fhBookTree->GetBranch("Timecard"))fhBookTree->SetBranchAddress("Timecard",Timecard); |
| 292 |
if(fhBookTree->GetBranch("Pathcard"))fhBookTree->SetBranchAddress("Pathcard",Pathcard); |
if(fhBookTree->GetBranch("Pathcard"))fhBookTree->SetBranchAddress("Pathcard",Pathcard); |
| 293 |
if(fhBookTree->GetBranch("P0card"))fhBookTree->SetBranchAddress("P0card",P0card); |
// if(fhBookTree->GetBranch("P0card"))fhBookTree->SetBranchAddress("P0card",P0card); |
| 294 |
// fhBookTree->SetBranchStatus("*",0); //modified by E.Vannuccini 03/08 |
// fhBookTree->SetBranchStatus("*",0); //modified by E.Vannuccini 03/08 |
| 295 |
} |
} |
| 296 |
|
|
| 325 |
AddPadding(); |
AddPadding(); |
| 326 |
WriteTrackCalib(); |
WriteTrackCalib(); |
| 327 |
|
|
| 328 |
DigitizeRunHeader(); |
////////////////////////// DigitizeRunHeader(); |
| 329 |
WriteRunHeader(); |
///////////////////////// WriteRunHeader(); |
| 330 |
|
|
| 331 |
LoadMipCor(); // some initialization of parameters -not used now- |
LoadMipCor(); // some initialization of parameters -not used now- |
| 332 |
// end loading, digitizing and writing tracker calibration |
// end loading, digitizing and writing tracker calibration |
| 333 |
// TOF ------ read calibration file (get A1, A2, lambda1, lambda2) |
// TOF ------ read calibration file (get A1, A2, lambda1, lambda2) |
| 334 |
const int np=48; |
const int np=48; |
| 335 |
Float_t *atte1,*atte2,*lambda1,*lambda2; |
float *atte1,*atte2,*lambda1,*lambda2; |
| 336 |
atte1=(float *)malloc(np *sizeof(float)); |
atte1=(float *)malloc(np *sizeof(float)); |
| 337 |
atte2=(float *)malloc(np *sizeof(float)); |
atte2=(float *)malloc(np *sizeof(float)); |
| 338 |
lambda1=(float *)malloc(np *sizeof(float)); |
lambda1=(float *)malloc(np *sizeof(float)); |
| 339 |
lambda2=(float *)malloc(np *sizeof(float)); |
lambda2=(float *)malloc(np *sizeof(float)); |
| 340 |
LoadTOFCalib(np,atte1,atte2,lambda1,lambda2); |
LoadTOFCalib(np,atte1,atte2,lambda1,lambda2); |
| 341 |
|
attenAC = new TF1("fAttAC",".825+.64*atan(9.8/x)",0.,45.); |
| 342 |
//end tof calib |
//end tof calib |
| 343 |
// |
// |
| 344 |
// loops over the events |
// loops over the events |
| 347 |
Int_t nentries = fhBookTree->GetEntriesFast(); |
Int_t nentries = fhBookTree->GetEntriesFast(); |
| 348 |
Long64_t nbytes = 0; |
Long64_t nbytes = 0; |
| 349 |
for (Int_t i=0; i<nentries;i++) { |
for (Int_t i=0; i<nentries;i++) { |
| 350 |
// |
nbytes += fhBookTree->GetEntry(i); |
| 351 |
nbytes += fhBookTree->GetEntry(i); |
// read detectors sequentially: |
| 352 |
// read detectors sequentially: |
// http://www.ts.infn.it/fileadmin/documents/physics/experiments/wizard/cpu/gen_arch/RM_Acquisition.pdf |
| 353 |
// http://www.ts.infn.it/fileadmin/documents/physics/experiments/wizard/cpu/gen_arch/RM_Acquisition.pdf |
// on pamelatov: /cvs/yoda/techmodel/physics/NeutronDetectorReader.cpp |
| 354 |
// on pamelatov: /cvs/yoda/techmodel/physics/NeutronDetectorReader.cpp |
DigitizeTOF(np,atte1,atte2,lambda1,lambda2); |
| 355 |
//DigitizeTRIGGER(); |
DigitizeAC(); |
| 356 |
DigitizeTOF(np,atte1,atte2,lambda1,lambda2); |
DigitizeCALO(); |
| 357 |
DigitizeAC(); |
DigitizeTrack(); |
| 358 |
DigitizeCALO(); |
DigitizeS4(); |
| 359 |
DigitizeTrack(); |
DigitizeND(); |
| 360 |
DigitizeS4(); |
// |
| 361 |
DigitizeND(); |
// Add padding to 64 bits |
| 362 |
// |
// |
| 363 |
// Add padding to 64 bits |
AddPadding(); |
| 364 |
// |
// |
| 365 |
AddPadding(); |
// Create CPU header, we need packet type (0x10 = physics data) and packet length. |
| 366 |
// |
// |
| 367 |
// Create CPU header, we need packet type (0x10 = physics data) and packet length. |
UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer+fS4buffer)+fPadding+fTOFbuffer+fTRIGGERbuffer; |
| 368 |
// |
//UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer)+fPadding+fTOFbuffer+fTRIGGERbuffer; |
| 369 |
UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer+fS4buffer)+fPadding+fTOFbuffer+fTRIGGERbuffer; |
DigitizePSCU(length,0x10,fDataPSCU); |
| 370 |
//UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer)+fPadding+fTOFbuffer+fTRIGGERbuffer; |
if ((i%1000)==0)cout << "writing event " << i << endl; |
| 371 |
DigitizePSCU(length,0x10,fDataPSCU); |
WriteData(); |
| 372 |
if ( !i%100 ) std::cout << "writing event " << i << endl; |
} |
| 373 |
WriteData(); |
//////////////////////////////// DigitizeRunTrailer(); |
| 374 |
}; |
//////////////////////////////// WriteRunTrailer(); |
| 375 |
|
|
|
DigitizeRunTrailer(); |
|
|
WriteRunTrailer(); |
|
|
|
|
| 376 |
fOutputfile.close(); |
fOutputfile.close(); |
| 377 |
std::cout << "files closed" << endl << flush; |
cout << "files closed" << endl; |
|
|
|
| 378 |
}; |
}; |
| 379 |
|
|
| 380 |
|
|
|
//void Digitizer::DigitizeTRIGGER() { |
|
|
//fDataTrigger: 152 bytes |
|
|
// corrected 30/11/'07 SO (was 153) |
|
|
//for (Int_t j=0; j < 152; j++) |
|
|
// fDataTrigger[j]=0x00; |
|
|
//}; |
|
|
|
|
|
|
|
|
|
|
| 381 |
void Digitizer::ReadData(){ |
void Digitizer::ReadData(){ |
| 382 |
|
|
| 383 |
UShort_t InData[64]; |
UShort_t InData[64]; |