HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoAnalyseXtalk.cxx
Go to the documentation of this file.
1 //
2 // File HarpoAnalyseXtalk.cxx
3 //
11 #include "HarpoAnalyseXtalk.h"
12 #include "HarpoConfig.h"
13 #include "HarpoDetSet.h"
14 #include "HarpoDebug.h"
15 #include "HarpoDccEvent.h"
16 #include "Pmm2Event.h"
17 #include "HarpoEvent.h"
18 #include "HarpoRecoEvent.h"
19 #include "HarpoSimEvent.h"
20 
21 #include "TFile.h"
22 #include "TStyle.h"
23 #include "TCanvas.h"
24 #include "TLatex.h"
25 #include "TGraph.h"
26 #include "TF1.h"
27 #include "TMath.h"
28 #include "TSystem.h"
29 
30 #include <cstdlib>
31 #include <cstring>
32 #include <cassert>
33 #include <fstream>
34 #include <iostream>
35 
36 ClassImp(HarpoAnalyseXtalk);
37 
39  {
40  unsigned int nd; // number of detectors
42 
43  assert(hdr != NULL);
44  hdr->print();
45 
46  for (nd = 0; nd < gkNDetectors; nd++) {
47  // if (fEvt->isdataExist(nd)) {
48  HarpoDccMap *plane = fEvt->GetDccMap(nd);
49  if (plane != NULL )plane->print();
50  }
51  }
52 
54 {
55  // Bool_t drawEvent = kFALSE;
56  nEvents++;
57 
58  // Process RAW data
59  for(Int_t ndet=0;ndet<2;ndet++) { // Detectors 0 and 1 = X and Y planes
60  if (!gHDetSet->isExist(ndet)) continue;
61  HarpoDccMap* m = fEvt->GetDccMap(ndet);
62  if ( m == NULL ) continue;
63 
64  Double_t qchprev = 0;
65  for(Int_t j=0;j<NCHAN;j++){ // Channels
66  Double_t qch = 0;
67  for(Int_t i=0;i<NADC;i++){ // Time bins
68  Double_t q = m->GetData(j,i);
69  if(q <= -1000) continue;
70  qch += q;
71  if(j<=0) continue;
72  Double_t qn = m->GetData(j-1,i);
73  hQvsQneighbour[ndet]->Fill(q,qn/q);
74  if(j<=3) continue;
75  Double_t qn3 = m->GetData(j-3,i);
76  hQvsQneighbour3[ndet]->Fill(q,qn3/q);
77  if(j%2 == 0)
78  hQvsQneighbour3e[ndet]->Fill(q,qn3/q);
79  else
80  hQvsQneighbour3o[ndet]->Fill(q,qn3/q);
81  }
82  hQchVsQneighbour[ndet]->Fill(qch,qchprev/qch);
83  qchprev = qch;
84  }
85  }
86 
87  // if(gHDetSet->isExist(PMM2)) { // PMm2 (trigger) data
88  // Pmm2Event *anaEvt = static_cast<Pmm2Event *>(fEvt->GetDetEvent(PMM2));
89  // Int_t triggerType = anaEvt->GetTriggerType(); // Trigger line (with mesh, without, traversing tracks, ...)
90 
91  // int imes;
92  // int esize = anaEvt->GetHeader()->eventSize; // number of PMs hit
93  // Pmm2MesVect * pm = anaEvt->GetMesurements(); // data for each included PM
94  // for(imes=0;imes<esize;imes++) {
95  // int ch = pm->at(imes).getChNum(); // channel
96  // int q = pm->at(imes).getCharge(); // charge
97  // hPmm2->Fill(ch,q);
98  // }
99  // }
100 
101  // //???????????????????????????????
102  // if(fEvt->GetRecoEvent()){ // Reconstructed data (clusters, tracks, matched tracks)
103  // HarpoRecoEvent* reco = fEvt->GetRecoEvent();
104  // // Clusters in the event (both X and Y directions)
105  // TClonesArray* clArray = reco->GetClustersArray();
106  // // Tracks in the event (both X and Y directions)
107  // TClonesArray* trArray = reco->GetTracksArray();
108  // // 3D tracks in the event (after X-Y matching)
109  // TClonesArray* tr3dArray = reco->GetReco3DArray();
110  // Int_t NtrX=reco->GetNtracksXEvt();
111  // Int_t NtrY=reco->GetNtracksYEvt();
112  // Int_t nCl = clArray->GetEntries();
113  // Int_t nTr = trArray->GetEntries();
114  // Int_t nTr3d = tr3dArray->GetEntries();
115  // for(Int_t icl = 0; icl<nCl; icl++){
116  // HarpoRecoClusters* cluster = (HarpoRecoClusters*)clArray->At(icl);
117  // Double_t q = cluster->GetQ();
118  // Int_t plane = cluster->GetPlane();
119  // hQcl[plane]->Fill(q);
120  // }
121  // for(Int_t itr = 0; itr<nTr; itr++){
122  // HarpoRecoTracks* track = (HarpoRecoTracks*)trArray->At(itr);
123  // Double_t id = track->GetNtrack();
124  // Double_t angle = track->GetAngleTrack();
125  // hAngle->Fill(angle);
126  // }
127  // for(Int_t itr = 0; itr<nTr3d; itr++){
128  // HarpoRecoReco3D* track = (HarpoRecoReco3D*)tr3dArray->At(itr);
129  // }
130  // }
131 
132 
133 
134 
135  // if (gHDetSet->isExist(SIMDET)){
136  // HarpoSimEvent *simEvt = (HarpoSimEvent *)(fEvt->GetDetEvent(SIMDET));
137  // Int_t nIonTr = simEvt->GetNtracks();
138  // TH1F* hTmp = new TH1F("hTmp","",512,0,512);
139  // for(Int_t i = 0; i<nIonTr; i++){
140  // TpcSimIonisationTrack* tr = simEvt->GetIonisationTrack(i);
141  // Int_t nPoints = tr->GetNpoints();
142  // for(Int_t j = 0; j<nPoints; j++){
143  // TpcSimIonisationPoint* point = tr->GetPoint(j);
144  // hTmp->Fill(point->GetZ(),point->GetNe());
145  // }
146  // }
147  // hTmp->Delete();
148  // }
149 }
150 
152 {
153 
154  // Initialise histograms here
155  hQvsQneighbour[0] = new TH2F("hQvsQneighbourX",";index;index;",4096,0,4096,200,0,5);
156  hQvsQneighbour[1] = new TH2F("hQvsQneighbourY",";index;index;",4096,0,4096,200,0,5);
157  hQvsQneighbour3[0] = new TH2F("hQvsQneighbour3X",";index;index;",4096,0,4096,200,0,5);
158  hQvsQneighbour3[1] = new TH2F("hQvsQneighbour3Y",";index;index;",4096,0,4096,200,0,5);
159  hQvsQneighbour3e[0] = new TH2F("hQvsQneighbour3eX",";index;index;",4096,0,4096,200,0,5);
160  hQvsQneighbour3e[1] = new TH2F("hQvsQneighbour3eY",";index;index;",4096,0,4096,200,0,5);
161  hQvsQneighbour3o[0] = new TH2F("hQvsQneighbour3oX",";index;index;",4096,0,4096,200,0,5);
162  hQvsQneighbour3o[1] = new TH2F("hQvsQneighbour3oY",";index;index;",4096,0,4096,200,0,5);
163 
164 
165  Int_t fNbins = 500;
166  Double_t fQmin = 10, fQmax = 1e5;
167 
168  const Int_t nbinsQcl = fNbins;
169  Double_t xminQcl = fQmin;
170  Double_t xmaxQcl = fQmax;
171  Double_t logxminQcl = TMath::Log(xminQcl);
172  Double_t logxmaxQcl = TMath::Log(xmaxQcl);
173  Double_t binwidthQcl = (logxmaxQcl-logxminQcl)/nbinsQcl;
174  Double_t xbinsQcl[nbinsQcl+1];
175  xbinsQcl[0] = xminQcl;
176  for (Int_t i=1;i<=nbinsQcl;i++)
177  xbinsQcl[i] = xminQcl + TMath::Exp(logxminQcl+i*binwidthQcl);
178 
179  hQchVsQneighbour[0] = new TH2F("hQchVsQneighbourX",";index;index;",nbinsQcl,xbinsQcl,200,0,5);
180  hQchVsQneighbour[1] = new TH2F("hQchVsQneighbourY",";index;index;",nbinsQcl,xbinsQcl,200,0,5);
181  }
182 
183 void HarpoAnalyseXtalk::Save(char * /* mode */)
184  {
185 
186 
187  /* TFile *hf = */ OpenHistFile("xtalk");
188  // Save histograms here
189  hQvsQneighbour[0]->Write();
190  hQvsQneighbour[1]->Write();
191  hQvsQneighbour3[0]->Write();
192  hQvsQneighbour3[1]->Write();
193  hQvsQneighbour3e[0]->Write();
194  hQvsQneighbour3e[1]->Write();
195  hQvsQneighbour3o[0]->Write();
196  hQvsQneighbour3o[1]->Write();
197  hQchVsQneighbour[0]->Write();
198  hQchVsQneighbour[1]->Write();
199 
200  }
201 
void Save(char *mode=NULL)
#define NCHAN
Definition: HarpoDccMap.h:16
TH2F * hQvsQneighbour3e[2]
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Definition: HarpoDccMap.cxx:84
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Definition: HarpoDetSet.h:33
Dummy analysis to run as test and example. Give basic histograms of the data.
TH2F * hQchVsQneighbour[2]
virtual void print()
FullEvent Header not scecific to the detectors The class is ....
virtual void print()
TFile * OpenHistFile(const char *ananame)
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
Definition: HarpoDccMap.h:29
void print()
Overloaded method which do all job.
#define NADC
Definition: HarpoDccMap.h:18
TH2F * hQvsQneighbour3o[2]
HarpoEventHeader * GetHeader()
Definition: HarpoEvent.cxx:80
HarpoEvent * fEvt
Definition: HarpoAnalyse.h:70
ULong_t nEvents
Definition: HarpoAnalyse.h:75
TH2F * hQvsQneighbour[2]
Redefine empty default.
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:108
R__EXTERN HarpoDetSet * gHDetSet
Definition: HarpoDetSet.h:71