HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoAnalyseVdrift.cxx
Go to the documentation of this file.
1 //
2 // File HarpoAnalyseVdrift.cxx
3 //
11 #include "HarpoAnalyseVdrift.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(HarpoAnalyseVdrift);
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 
59  if(!gHDetSet->isExist(PMM2)) return;
60 
61  Pmm2Event *anaEvt = static_cast<Pmm2Event *>(fEvt->GetDetEvent(PMM2));
62  // Int_t triggerType = anaEvt->GetTriggerType(); // Trigger line (with mesh, without, traversing tracks, ...)
63 
64  int imes;
65  int esize = anaEvt->GetHeader()->eventSize; // number of PMs hit
66  Pmm2MesVect * pm = anaEvt->GetMesurements(); // data for each included PM
67  Int_t hit[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
68  for(imes=0;imes<esize;imes++) {
69  int ch = pm->at(imes).getChNum(); // channel
70  if(ch<0 || ch>=16) continue;
71  hit[ch] = 1;
72  // int q = pm->at(imes).getCharge(); // charge
73  // hPmm2->Fill(ch,q);
74  }
75  Int_t isTT = 0;
76  if((hit[3] || hit[4]) && (hit[5] || hit[6]))
77  isTT = 1;
78 
79  // Process RAW data
80  for(Int_t ndet=0;ndet<2;ndet++) { // Detectors 0 and 1 = X and Y planes
81  if (!gHDetSet->isExist(ndet)) continue;
82  HarpoDccMap* m = fEvt->GetDccMap(ndet);
83  if ( m == NULL ) continue;
84 
85  Int_t tmin = 512, tmax = 0;
86  for(Int_t i=0;i<NADC;i++){ // Time bins
87  Double_t qtot = 0;
88  for(Int_t j=0;j<NCHAN;j++){ // Channels
89  Double_t q = m->GetData(j,i);
90  if(q <= -1000) continue;
91  qtot += q;
92  }
93  if(qtot<=0) continue;
94  if(isTT)
95  hQvT[ndet]->Fill(i,qtot);
96  if(qtot<=1000) continue;
97  if(i>tmax) tmax = i;
98  if(i<tmin) tmin = i;
99  }
100 
101  hTmin[ndet]->Fill(tmin);
102  hTmax[ndet]->Fill(tmax);
103  if(isTT)
104  hDeltaT[ndet]->Fill(tmax-tmin);
105 
106  fEvt->GetRecoEvent()->SetTmin(tmin);
108  }
109 
110 }
111 
113 {
114 
115  // Initialise histograms here
116  hTmin[0] = new TH1F("hTminX","",512,0,512);
117  hTmin[1] = new TH1F("hTminY","",512,0,512);
118  hTmax[0] = new TH1F("hTmaxX","",512,0,512);
119  hTmax[1] = new TH1F("hTmaxY","",512,0,512);
120  hDeltaT[0] = new TH1F("hDeltaTX","",512,0,512);
121  hDeltaT[1] = new TH1F("hDeltaTY","",512,0,512);
122 
123  hQvT[0] = new TH1F("hQvTX","",512,0,512);
124  hQvT[1] = new TH1F("hQvTY","",512,0,512);
125 
126 }
127 
128 void HarpoAnalyseVdrift::Save(char * /* mode */)
129  {
130 
131 
132  /* TFile *hf = */ OpenHistFile("vdrift");
133  // Save histograms here
134  hQvT[0]->Write();
135  hQvT[1]->Write();
136  hTmin[0]->Write();
137  hTmin[1]->Write();
138  hTmax[0]->Write();
139  hTmax[1]->Write();
140  hDeltaT[0]->Write();
141  hDeltaT[1]->Write();
142 
143  }
144 
Dcc Plane Y.
Definition: HarpoDet.h:20
HarpoRecoEvent * GetRecoEvent()
Definition: HarpoEvent.h:46
#define NCHAN
Definition: HarpoDccMap.h:16
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Definition: HarpoDccMap.cxx:84
void print()
Overloaded method which do all job.
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Definition: HarpoDetSet.h:33
void Save(char *mode=NULL)
UInt_t eventSize
Raw Event size.
Definition: HarpoDetEvent.h:28
Dummy analysis to run as test and example. Give basic histograms of the data.
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
HarpoDetEvent * GetDetEvent(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:93
Pmm2MesVect * GetMesurements()
Return pointer to decoded data.
Definition: Pmm2Event.cxx:78
TH1F * hQvT[2]
Redefine empty default.
#define NADC
Definition: HarpoDccMap.h:18
A class store HARPO raw PMM2 event buffer and header. End provide access metods to the row data...
Definition: Pmm2Event.h:19
const ULong_t tmax
virtual const EventHeader_t * GetHeader() const
Definition: HarpoDetEvent.h:38
HarpoEventHeader * GetHeader()
Definition: HarpoEvent.cxx:80
void SetTmax(Int_t val)
HarpoEvent * fEvt
Definition: HarpoAnalyse.h:70
ULong_t nEvents
Definition: HarpoAnalyse.h:75
void SetTmin(Int_t val)
Int_t getChNum() const
Definition: Pmm2Mes.h:28
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:108
A list of all mesurements in one Event for Pmm2 v2 card The class is place holder for all unpacked me...
Definition: Pmm2MesList.h:19
Pmm2Mes at(ULong_t idx)
Definition: Pmm2MesList.h:37
R__EXTERN HarpoDetSet * gHDetSet
Definition: HarpoDetSet.h:71