/[PAMELA software]/PamelaDigitizer/Digitizer.cxx
ViewVC logotype

Diff of /PamelaDigitizer/Digitizer.cxx

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

revision 1.7 by pamelats, Wed May 21 09:50:43 2008 UTC revision 1.14 by pizzolot, Fri Oct 16 09:15:50 2009 UTC
# Line 4  Line 4 
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,
15                         int nspe1=200,int ntof1=200,int ncat1=50,
16                         int ncas1=50,int ncar1=100,int ncal1=1000,
17                         int nnd1=200,int nstr1=1000, int comprcalomod=0){
18      
19      nspe=new int[1];
20      ntof=new int[1];
21      ncat=new int[1];
22      ncas=new int[1];
23      ncar=new int[1];
24      ncal=new int[1];
25      nnd=new int[1];
26      nstr=new int[1];
27    
28      *nspe=nspe1;
29      *ntof=ntof1;
30      *ncat=ncat1;
31      *ncas=ncas1;
32      *ncar=ncar1;
33      *ncal=ncal1;
34      *nnd=nnd1;
35      *nstr=nstr1;
36    
37    fhBookTree = tree;    fhBookTree = tree;
38    fFilename =  file_raw;    fFilename =  file_raw;
39    fCounter = 0;    fCounter = 0;
40    fCounterPhys = 0; // SO 5/12/'07    fCounterPhys = 0; // SO 5/12/'07
41    fOBT = 0;    fOBT = 0;
42      fModCalo = comprcalomod ;
43    
44    //    //
45    // DB  connections    // DB  connections
# Line 80  Digitizer::Digitizer(TTree* tree, char* Line 75  Digitizer::Digitizer(TTree* tree, char*
75        
76    std:: cout << "preparing tree" << endl;    std:: cout << "preparing tree" << endl;
77    
78      Ipltof=(UChar_t*)malloc(*ntof *sizeof(UChar_t));
79      Ipaddle=(UChar_t*)malloc(*ntof *sizeof(UChar_t));
80      Ipartof=(UShort_t*)malloc(*ntof *sizeof(UShort_t));
81      //  Ipartof=(UChar_t*)malloc(*ntof *sizeof(UChar_t));//DPMJET
82      Xintof=(Float_t*)malloc(*ntof *sizeof(Float_t));
83      Yintof=(Float_t*)malloc(*ntof *sizeof(Float_t));
84      Zintof=(Float_t*)malloc(*ntof *sizeof(Float_t));
85      Xouttof=(Float_t*)malloc(*ntof *sizeof(Float_t));
86      Youttof=(Float_t*)malloc(*ntof *sizeof(Float_t));
87      Zouttof=(Float_t*)malloc(*ntof *sizeof(Float_t));
88      Ereltof=(Float_t*)malloc(*ntof *sizeof(Float_t));
89      Timetof=(Float_t*)malloc(*ntof *sizeof(Float_t));
90      Pathtof=(Float_t*)malloc(*ntof *sizeof(Float_t));
91      P0tof=(Float_t*)malloc(*ntof *sizeof(Float_t));
92      Iparcat=(UChar_t*)malloc(*ncat *sizeof(UChar_t));
93      Icat=(UChar_t*)malloc(*ncat *sizeof(UChar_t));
94      Xincat=(Float_t*)malloc(*ncat *sizeof(Float_t));
95      Yincat=(Float_t*)malloc(*ncat *sizeof(Float_t));
96      Zincat=(Float_t*)malloc(*ncat *sizeof(Float_t));
97      Xoutcat=(Float_t*)malloc(*ncat *sizeof(Float_t));
98      Youtcat=(Float_t*)malloc(*ncat *sizeof(Float_t));
99      Zoutcat=(Float_t*)malloc(*ncat *sizeof(Float_t));
100      Erelcat=(Float_t*)malloc(*ncat *sizeof(Float_t));
101      Timecat=(Float_t*)malloc(*ncat *sizeof(Float_t));
102      Pathcat=(Float_t*)malloc(*ncat *sizeof(Float_t));
103      P0cat=(Float_t*)malloc(*ncat *sizeof(Float_t));
104      Iparcas=(UChar_t*)malloc(*ncas *sizeof(UChar_t));
105      Icas=(UChar_t*)malloc(*ncas *sizeof(UChar_t));
106      Xincas=(Float_t*)malloc(*ncas *sizeof(Float_t));
107      Yincas=(Float_t*)malloc(*ncas *sizeof(Float_t));
108      Zincas=(Float_t*)malloc(*ncas *sizeof(Float_t));
109      Xoutcas=(Float_t*)malloc(*ncas *sizeof(Float_t));
110      Youtcas=(Float_t*)malloc(*ncas *sizeof(Float_t));
111      Zoutcas=(Float_t*)malloc(*ncas *sizeof(Float_t));
112      Erelcas=(Float_t*)malloc(*ncas *sizeof(Float_t));
113      Timecas=(Float_t*)malloc(*ncas *sizeof(Float_t));
114      Pathcas=(Float_t*)malloc(*ncas *sizeof(Float_t));
115      P0cas=(Float_t*)malloc(*ncas *sizeof(Float_t));
116      //  Iparspe=(UShort_t*)malloc(*nspe *sizeof(UShort_t));
117      //  Iparspe=(UChar_t*)malloc(*nspe *sizeof(UChar_t));
118      Itrpb=(UChar_t*)malloc(*nspe *sizeof(UChar_t));
119      Itrsl=(UChar_t*)malloc(*nspe *sizeof(UChar_t));
120      Itspa=(UChar_t*)malloc(*nspe *sizeof(UChar_t));
121      Xinspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
122      Yinspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
123      Zinspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
124      Xoutspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
125      Youtspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
126      Zoutspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
127      Xavspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
128      Yavspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
129      Zavspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
130      Erelspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
131      Pathspe=(Float_t*)malloc(*nspe *sizeof(Float_t));
132      P0spe=(Float_t*)malloc(*nspe *sizeof(Float_t));;
133      Nxmult=(UChar_t*)malloc(*nspe *sizeof(UChar_t));
134      Nymult=(UChar_t*)malloc(*nspe *sizeof(UChar_t));
135      Istripx=(UShort_t*)malloc(*nstr *sizeof(UShort_t));
136      Qstripx=(Float_t*)malloc(*nstr *sizeof(Float_t));
137      Xstripx=(Float_t*)malloc(*nstr *sizeof(Float_t));
138      Npstripx=(UChar_t*)malloc(*nstr *sizeof(UChar_t));
139      Ntstripx=(UChar_t*)malloc(*nstr *sizeof(UChar_t));
140      Npstripy=(UChar_t*)malloc(*nstr *sizeof(UChar_t));
141      Ntstripy=(UChar_t*)malloc(*nstr *sizeof(UChar_t));
142      Istripy=(UShort_t*)malloc(*nstr *sizeof(UShort_t));
143      Qstripy=(Float_t*)malloc(*nstr *sizeof(Float_t));
144      Ystripy=(Float_t*)malloc(*nstr *sizeof(Float_t));
145      Icapl=(UChar_t*)malloc(*ncal *sizeof(UChar_t));
146      Icasi=(UChar_t*)malloc(*ncal *sizeof(UChar_t));
147      Icast=(UChar_t*)malloc(*ncal *sizeof(UChar_t));
148      Xincal=(Float_t*)malloc(*ncal *sizeof(Float_t));
149      Yincal=(Float_t*)malloc(*ncal *sizeof(Float_t));
150      Zincal=(Float_t*)malloc(*ncal *sizeof(Float_t));
151      Erelcal=(Float_t*)malloc(*ncal *sizeof(Float_t));
152      Itubend=(UChar_t*)malloc(*nnd *sizeof(UChar_t));
153      Iparnd=(UChar_t*)malloc(*nnd *sizeof(UChar_t));
154      Xinnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
155      Yinnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
156      Zinnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
157      Xoutnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
158      Youtnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
159      Zoutnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
160      Erelnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
161      Timend=(Float_t*)malloc(*nnd *sizeof(Float_t));
162      Pathnd=(Float_t*)malloc(*nnd *sizeof(Float_t));
163      P0nd=(Float_t*)malloc(*nnd *sizeof(Float_t));
164      Iparcard=(UChar_t*)malloc(*ncar *sizeof(UChar_t));
165      Icard=(UChar_t*)malloc(*ncar *sizeof(UChar_t));
166      Xincard=(Float_t*)malloc(*ncar *sizeof(Float_t));
167      Yincard=(Float_t*)malloc(*ncar *sizeof(Float_t));
168      Zincard=(Float_t*)malloc(*ncar *sizeof(Float_t));
169      Xoutcard=(Float_t*)malloc(*ncar *sizeof(Float_t));
170      Youtcard=(Float_t*)malloc(*ncar *sizeof(Float_t));
171      Zoutcard=(Float_t*)malloc(*ncar *sizeof(Float_t));
172      Erelcard=(Float_t*)malloc(*ncar *sizeof(Float_t));
173      Timecard=(Float_t*)malloc(*ncar *sizeof(Float_t));
174      Pathcard=(Float_t*)malloc(*ncar *sizeof(Float_t));
175      P0card=(Float_t*)malloc(*ncar *sizeof(Float_t));
176    
177    
178    
179    // prepare tree//modified by E.Vannuccini 03/08    // prepare tree//modified by E.Vannuccini 03/08
180    if(fhBookTree->GetBranch("Irun"))fhBookTree->SetBranchAddress("Irun",&Irun);    if(fhBookTree->GetBranch("Irun"))fhBookTree->SetBranchAddress("Irun",&Irun);
181    if(fhBookTree->GetBranch("Ievnt"))fhBookTree->SetBranchAddress("Ievnt",&Ievnt);    if(fhBookTree->GetBranch("Ievnt"))fhBookTree->SetBranchAddress("Ievnt",&Ievnt);
# Line 91  Digitizer::Digitizer(TTree* tree, char* Line 187  Digitizer::Digitizer(TTree* tree, char*
187    if(fhBookTree->GetBranch("Phi"))fhBookTree->SetBranchAddress("Phi",&Phi);    if(fhBookTree->GetBranch("Phi"))fhBookTree->SetBranchAddress("Phi",&Phi);
188    if(fhBookTree->GetBranch("P0"))fhBookTree->SetBranchAddress("P0",&P0);    if(fhBookTree->GetBranch("P0"))fhBookTree->SetBranchAddress("P0",&P0);
189    if(fhBookTree->GetBranch("Nthtof"))fhBookTree->SetBranchAddress("Nthtof",&Nthtof);    if(fhBookTree->GetBranch("Nthtof"))fhBookTree->SetBranchAddress("Nthtof",&Nthtof);
190    if(fhBookTree->GetBranch("Ipltof"))fhBookTree->SetBranchAddress("Ipltof",Ipltof);    if(fhBookTree->GetBranch("Ipltof"))fhBookTree->SetBranchAddress("Ipltof",Ipltof);///////////////////////////
191    if(fhBookTree->GetBranch("Ipaddle"))fhBookTree->SetBranchAddress("Ipaddle",Ipaddle);    if(fhBookTree->GetBranch("Ipaddle"))fhBookTree->SetBranchAddress("Ipaddle",Ipaddle);
192    if(fhBookTree->GetBranch("Ipartof"))fhBookTree->SetBranchAddress("Ipartof",Ipartof);    if(fhBookTree->GetBranch("Ipartof"))fhBookTree->SetBranchAddress("Ipartof",Ipartof);
193    if(fhBookTree->GetBranch("Xintof"))fhBookTree->SetBranchAddress("Xintof",Xintof);    if(fhBookTree->GetBranch("Xintof"))fhBookTree->SetBranchAddress("Xintof",Xintof);
# Line 119  Digitizer::Digitizer(TTree* tree, char* Line 215  Digitizer::Digitizer(TTree* tree, char*
215    if(fhBookTree->GetBranch("P0cat"))fhBookTree->SetBranchAddress("P0cat",P0cat);    if(fhBookTree->GetBranch("P0cat"))fhBookTree->SetBranchAddress("P0cat",P0cat);
216    if(fhBookTree->GetBranch("Nthcas"))fhBookTree->SetBranchAddress("Nthcas",&Nthcas);    if(fhBookTree->GetBranch("Nthcas"))fhBookTree->SetBranchAddress("Nthcas",&Nthcas);
217    if(fhBookTree->GetBranch("Iparcas"))fhBookTree->SetBranchAddress("Iparcas",Iparcas);    if(fhBookTree->GetBranch("Iparcas"))fhBookTree->SetBranchAddress("Iparcas",Iparcas);
218    if(fhBookTree->GetBranch("Icas"))fhBookTree->SetBranchAddress("Icas",Icas);    if(fhBookTree->GetBranch("Icas"))fhBookTree->SetBranchAddress("Icas",Icas);///////////////////////////////
219    if(fhBookTree->GetBranch("Xincas"))fhBookTree->SetBranchAddress("Xincas",Xincas);    if(fhBookTree->GetBranch("Xincas"))fhBookTree->SetBranchAddress("Xincas",Xincas);
220    if(fhBookTree->GetBranch("Yincas"))fhBookTree->SetBranchAddress("Yincas",Yincas);    if(fhBookTree->GetBranch("Yincas"))fhBookTree->SetBranchAddress("Yincas",Yincas);
221    if(fhBookTree->GetBranch("Zincas"))fhBookTree->SetBranchAddress("Zincas",Zincas);    if(fhBookTree->GetBranch("Zincas"))fhBookTree->SetBranchAddress("Zincas",Zincas);
# Line 131  Digitizer::Digitizer(TTree* tree, char* Line 227  Digitizer::Digitizer(TTree* tree, char*
227    if(fhBookTree->GetBranch("Pathcas"))fhBookTree->SetBranchAddress("Pathcas",Pathcas);    if(fhBookTree->GetBranch("Pathcas"))fhBookTree->SetBranchAddress("Pathcas",Pathcas);
228    if(fhBookTree->GetBranch("P0cas"))fhBookTree->SetBranchAddress("P0cas",P0cas);    if(fhBookTree->GetBranch("P0cas"))fhBookTree->SetBranchAddress("P0cas",P0cas);
229    if(fhBookTree->GetBranch("Nthspe"))fhBookTree->SetBranchAddress("Nthspe",&Nthspe);    if(fhBookTree->GetBranch("Nthspe"))fhBookTree->SetBranchAddress("Nthspe",&Nthspe);
230    if(fhBookTree->GetBranch("Iparspe"))fhBookTree->SetBranchAddress("Iparspe",Iparspe);    //  if(fhBookTree->GetBranch("Iparspe"))fhBookTree->SetBranchAddress("Iparspe",Iparspe);
231    if(fhBookTree->GetBranch("Itrpb"))fhBookTree->SetBranchAddress("Itrpb",Itrpb);    if(fhBookTree->GetBranch("Itrpb"))fhBookTree->SetBranchAddress("Itrpb",Itrpb);
232    if(fhBookTree->GetBranch("Itrsl"))fhBookTree->SetBranchAddress("Itrsl",Itrsl);    if(fhBookTree->GetBranch("Itrsl"))fhBookTree->SetBranchAddress("Itrsl",Itrsl);
233    if(fhBookTree->GetBranch("Itspa"))fhBookTree->SetBranchAddress("Itspa",Itspa);    if(fhBookTree->GetBranch("Itspa"))fhBookTree->SetBranchAddress("Itspa",Itspa);
# Line 159  Digitizer::Digitizer(TTree* tree, char* Line 255  Digitizer::Digitizer(TTree* tree, char*
255    if(fhBookTree->GetBranch("Npstripy"))fhBookTree->SetBranchAddress("Npstripy",Npstripy);    if(fhBookTree->GetBranch("Npstripy"))fhBookTree->SetBranchAddress("Npstripy",Npstripy);
256    if(fhBookTree->GetBranch("Ntstripy"))fhBookTree->SetBranchAddress("Ntstripy",Ntstripy);    if(fhBookTree->GetBranch("Ntstripy"))fhBookTree->SetBranchAddress("Ntstripy",Ntstripy);
257    if(fhBookTree->GetBranch("Istripy"))fhBookTree->SetBranchAddress("Istripy",Istripy);    if(fhBookTree->GetBranch("Istripy"))fhBookTree->SetBranchAddress("Istripy",Istripy);
258    if(fhBookTree->GetBranch("Qstripy"))fhBookTree->SetBranchAddress("Qstripy",Qstripy);    if(fhBookTree->GetBranch("Qstripy"))fhBookTree->SetBranchAddress("Qstripy",Qstripy);///////////////////////
259    if(fhBookTree->GetBranch("Ystripy"))fhBookTree->SetBranchAddress("Ystripy",Ystripy);    if(fhBookTree->GetBranch("Ystripy"))fhBookTree->SetBranchAddress("Ystripy",Ystripy);
260    if(fhBookTree->GetBranch("Nthcali"))fhBookTree->SetBranchAddress("Nthcali",&Nthcali);    if(fhBookTree->GetBranch("Nthcali"))fhBookTree->SetBranchAddress("Nthcali",&Nthcali);
261    if(fhBookTree->GetBranch("Icaplane"))fhBookTree->SetBranchAddress("Icaplane",Icaplane);    if(fhBookTree->GetBranch("Icaplane"))fhBookTree->SetBranchAddress("Icaplane",Icaplane);
# Line 177  Digitizer::Digitizer(TTree* tree, char* Line 273  Digitizer::Digitizer(TTree* tree, char*
273    if(fhBookTree->GetBranch("Nthnd"))fhBookTree->SetBranchAddress("Nthnd",&Nthnd);    if(fhBookTree->GetBranch("Nthnd"))fhBookTree->SetBranchAddress("Nthnd",&Nthnd);
274    if(fhBookTree->GetBranch("Itubend"))fhBookTree->SetBranchAddress("Itubend",Itubend);    if(fhBookTree->GetBranch("Itubend"))fhBookTree->SetBranchAddress("Itubend",Itubend);
275    if(fhBookTree->GetBranch("Iparnd"))fhBookTree->SetBranchAddress("Iparnd",Iparnd);    if(fhBookTree->GetBranch("Iparnd"))fhBookTree->SetBranchAddress("Iparnd",Iparnd);
276    if(fhBookTree->GetBranch("Xinnd"))fhBookTree->SetBranchAddress("Xinnd",Xinnd);    if(fhBookTree->GetBranch("Xinnd"))fhBookTree->SetBranchAddress("Xinnd",Xinnd);/////////////////////////
277    if(fhBookTree->GetBranch("Yinnd"))fhBookTree->SetBranchAddress("Yinnd",Yinnd);    if(fhBookTree->GetBranch("Yinnd"))fhBookTree->SetBranchAddress("Yinnd",Yinnd);
278    if(fhBookTree->GetBranch("Zinnd"))fhBookTree->SetBranchAddress("Zinnd",Zinnd);    if(fhBookTree->GetBranch("Zinnd"))fhBookTree->SetBranchAddress("Zinnd",Zinnd);
279    if(fhBookTree->GetBranch("Xoutnd"))fhBookTree->SetBranchAddress("Xoutnd",Xoutnd);    if(fhBookTree->GetBranch("Xoutnd"))fhBookTree->SetBranchAddress("Xoutnd",Xoutnd);
# Line 187  Digitizer::Digitizer(TTree* tree, char* Line 283  Digitizer::Digitizer(TTree* tree, char*
283    if(fhBookTree->GetBranch("Timend"))fhBookTree->SetBranchAddress("Timend",Timend);    if(fhBookTree->GetBranch("Timend"))fhBookTree->SetBranchAddress("Timend",Timend);
284    if(fhBookTree->GetBranch("Pathnd"))fhBookTree->SetBranchAddress("Pathnd",Pathnd);    if(fhBookTree->GetBranch("Pathnd"))fhBookTree->SetBranchAddress("Pathnd",Pathnd);
285    if(fhBookTree->GetBranch("P0nd"))fhBookTree->SetBranchAddress("P0nd",P0nd);    if(fhBookTree->GetBranch("P0nd"))fhBookTree->SetBranchAddress("P0nd",P0nd);
286    if(fhBookTree->GetBranch("Nthcard"))fhBookTree->SetBranchAddress("Nthcard",&Nthcard);    if(fhBookTree->GetBranch("Nthcard"))fhBookTree->SetBranchAddress("Nthcard",&Nthcard);/////////////////////
287    if(fhBookTree->GetBranch("Iparcard"))fhBookTree->SetBranchAddress("Iparcard",Iparcard);    if(fhBookTree->GetBranch("Iparcard"))fhBookTree->SetBranchAddress("Iparcard",Iparcard);
288    if(fhBookTree->GetBranch("Icard"))fhBookTree->SetBranchAddress("Icard",Icard);    if(fhBookTree->GetBranch("Icard"))fhBookTree->SetBranchAddress("Icard",Icard);
289    if(fhBookTree->GetBranch("Xincard"))fhBookTree->SetBranchAddress("Xincard",Xincard);    if(fhBookTree->GetBranch("Xincard"))fhBookTree->SetBranchAddress("Xincard",Xincard);
290    if(fhBookTree->GetBranch("Yincard"))fhBookTree->SetBranchAddress("Yincard",Yincard);    if(fhBookTree->GetBranch("Yincard"))fhBookTree->SetBranchAddress("Yincard",Yincard);
291    if(fhBookTree->GetBranch("Zincard"))fhBookTree->SetBranchAddress("Zincard",Zincard);    if(fhBookTree->GetBranch("Zincard"))fhBookTree->SetBranchAddress("Zincard",Zincard);
292    if(fhBookTree->GetBranch("Xoutcard"))fhBookTree->SetBranchAddress("Xoutcard",Xoutcard);    if(fhBookTree->GetBranch("Xoutcard"))fhBookTree->SetBranchAddress("Xoutcard",Xoutcard);
293    if(fhBookTree->GetBranch("Youtcard"))fhBookTree->SetBranchAddress("Youtcard",Youtcard);    if(fhBookTree->GetBranch("Youtcard"))fhBookTree->SetBranchAddress("Youtcard",Youtcard);/////////////////
294    if(fhBookTree->GetBranch("Zoutcard"))fhBookTree->SetBranchAddress("Zoutcard",Zoutcard);    if(fhBookTree->GetBranch("Zoutcard"))fhBookTree->SetBranchAddress("Zoutcard",Zoutcard);
295    if(fhBookTree->GetBranch("Erelcard"))fhBookTree->SetBranchAddress("Erelcard",Erelcard);    if(fhBookTree->GetBranch("Erelcard"))fhBookTree->SetBranchAddress("Erelcard",Erelcard);
296    if(fhBookTree->GetBranch("Timecard"))fhBookTree->SetBranchAddress("Timecard",Timecard);    if(fhBookTree->GetBranch("Timecard"))fhBookTree->SetBranchAddress("Timecard",Timecard);
297    if(fhBookTree->GetBranch("Pathcard"))fhBookTree->SetBranchAddress("Pathcard",Pathcard);    if(fhBookTree->GetBranch("Pathcard"))fhBookTree->SetBranchAddress("Pathcard",Pathcard);
298    if(fhBookTree->GetBranch("P0card"))fhBookTree->SetBranchAddress("P0card",P0card);    //  if(fhBookTree->GetBranch("P0card"))fhBookTree->SetBranchAddress("P0card",P0card);
299  //    fhBookTree->SetBranchStatus("*",0); //modified by E.Vannuccini 03/08  //    fhBookTree->SetBranchStatus("*",0); //modified by E.Vannuccini 03/08
300  }  }
301    
# Line 233  void Digitizer::Loop() { Line 329  void Digitizer::Loop() {
329    DigitizePSCU(length,0x13,fDataPSCU);    DigitizePSCU(length,0x13,fDataPSCU);
330    AddPadding();    AddPadding();
331    WriteTrackCalib();    WriteTrackCalib();
   
   DigitizeRunHeader();  
   WriteRunHeader();  
   
332    LoadMipCor();  // some initialization of parameters -not used now-    LoadMipCor();  // some initialization of parameters -not used now-
333    //  end loading, digitizing and writing tracker calibration    //  end loading, digitizing and writing tracker calibration
334    // TOF ------ read calibration file (get A1, A2, lambda1, lambda2)    // TOF ------ read calibration file (get A1, A2, lambda1, lambda2)
335    const int np=48;    const int np=48;
336    Float_t *atte1,*atte2,*lambda1,*lambda2;    float *atte1,*atte2,*lambda1,*lambda2;
337    atte1=(float *)malloc(np *sizeof(float));    atte1=(float *)malloc(np *sizeof(float));
338    atte2=(float *)malloc(np *sizeof(float));    atte2=(float *)malloc(np *sizeof(float));
339    lambda1=(float *)malloc(np *sizeof(float));    lambda1=(float *)malloc(np *sizeof(float));
340    lambda2=(float *)malloc(np *sizeof(float));    lambda2=(float *)malloc(np *sizeof(float));
341    LoadTOFCalib(np,atte1,atte2,lambda1,lambda2);    LoadTOFCalib(np,atte1,atte2,lambda1,lambda2);
342      attenAC = new TF1("fAttAC",".825+.64*atan(9.8/x)",0.,45.);
343    //end tof calib    //end tof calib
344    //    //
345    // loops over the events    // loops over the events
# Line 255  void Digitizer::Loop() { Line 348  void Digitizer::Loop() {
348    Int_t nentries = fhBookTree->GetEntriesFast();    Int_t nentries = fhBookTree->GetEntriesFast();
349    Long64_t nbytes = 0;    Long64_t nbytes = 0;
350    for (Int_t i=0; i<nentries;i++) {    for (Int_t i=0; i<nentries;i++) {
351      //       nbytes += fhBookTree->GetEntry(i);
352      nbytes += fhBookTree->GetEntry(i);       fEvent=i; //  cecilia for calo compress mode
353      // read detectors sequentially:        // read detectors sequentially:
354      // http://www.ts.infn.it/fileadmin/documents/physics/experiments/wizard/cpu/gen_arch/RM_Acquisition.pdf        // http://www.ts.infn.it/fileadmin/documents/physics/experiments/wizard/cpu/gen_arch/RM_Acquisition.pdf
355      // on pamelatov: /cvs/yoda/techmodel/physics/NeutronDetectorReader.cpp        // on pamelatov: /cvs/yoda/techmodel/physics/NeutronDetectorReader.cpp
356      //DigitizeTRIGGER();       DigitizeTOF(np,atte1,atte2,lambda1,lambda2);
357      DigitizeTOF(np,atte1,atte2,lambda1,lambda2);        DigitizeAC();
358      DigitizeAC();        DigitizeCALO();
359      DigitizeCALO();        DigitizeTrack();
360      DigitizeTrack();        DigitizeS4();
361      DigitizeS4();        DigitizeND();
362      DigitizeND();        //
363      //        // Add padding to 64 bits
364      // Add padding to 64 bits        //
365      //        AddPadding();
366      AddPadding();        //
367      //        // Create CPU header, we need packet type (0x10 = physics data) and packet length.
368      // Create CPU header, we need packet type (0x10 = physics data) and packet length.        //
369      //        UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer+fS4buffer)+fPadding+fTOFbuffer+fTRIGGERbuffer;
370      UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer+fS4buffer)+fPadding+fTOFbuffer+fTRIGGERbuffer;        //UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer)+fPadding+fTOFbuffer+fTRIGGERbuffer;
371      //UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer)+fPadding+fTOFbuffer+fTRIGGERbuffer;        DigitizePSCU(length,0x10,fDataPSCU);
372      DigitizePSCU(length,0x10,fDataPSCU);        if ((i%1000)==0)cout << "writing event " << i << endl;
373      if ( !i%100 ) std::cout << "writing event " << i << endl;        WriteData();
374      WriteData();    }
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];

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.23