HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoExcludeBadEvents.cxx
Go to the documentation of this file.
1 //
2 // File HarpoExcludeBadEvents.cxx
3 //
11 #include "HarpoExcludeBadEvents.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 #include "MakeNiceHisto.h"
21 
22 #include "TFile.h"
23 #include "TStyle.h"
24 #include "TCanvas.h"
25 #include "TLatex.h"
26 #include "TGraph.h"
27 #include "TF1.h"
28 #include "TMath.h"
29 #include "TSystem.h"
30 #include "TApplication.h"
31 
32 #include <cstdlib>
33 #include <cstring>
34 #include <cassert>
35 #include <fstream>
36 #include <iostream>
37 
38 ClassImp(HarpoExcludeBadEvents)
39 
40 void HarpoExcludeBadEvents::print()
41  {
42  unsigned int nd; // number of detectors
43  HarpoEventHeader *hdr = fEvt->GetHeader();
44 
45  assert(hdr != NULL);
46  hdr->print();
47 
48  for (nd = 0; nd < gkNDetectors; nd++) {
49  // if (fEvt->isdataExist(nd)) {
50  HarpoDccMap *plane = fEvt->GetDccMap(nd);
51  if (plane != NULL )plane->print();
52  }
53  }
54 
56 {
57  nEvents++;
58  if(nEvents%1000==0) Info("process","Event %ld",nEvents);
59 
60  for(Int_t ndet = 0; ndet<2; ndet++){
61  HarpoDccMap* m = fEvt->GetDccMap(ndet);
62  if ( m == NULL ) continue;
63 
64  Double_t qTot = 0;
65  for(Int_t i=0;i<NADC;i++){ //Time bins
66  if(i>80 && i<420) continue;
67  for(Int_t j=0;j<NCHAN;j++){ // Channels
68  Double_t q = m->GetData(j,i);
69  if(q<0) continue;
70  qTot += q;
71  }
72  }
73 
74  //std::cout << "qTot = " << qTot << std::endl;
75 
76  hQtotOut[ndet]->Fill(qTot);
77  if(qTot>1e5)
79  if(qTot>3e4 && qTot<1e5){
80  for(Int_t j=0;j<NCHAN;j++){ // Channels
81  for(Int_t i=0;i<NADC;i++){ //Time bins
82  Double_t q = m->GetData(j,i);
83  if(q<0) continue;
84  hMap[ndet]->Fill(i,j,q);
85  }
86  }
87  }
88  }
89 
90 }
91 
93 {
94  hMap[0] = new TH2F("hMapX","map;Time;Channel",512,0,512,288,0,288);
95  hMap[1] = new TH2F("hMapY","map;Time;Channel",512,0,512,288,0,288);
96 
97  const Int_t nbinsQcl = 200;
98  Double_t xminQcl = 10;
99  Double_t xmaxQcl = 1e7;
100  Double_t logxminQcl = TMath::Log(xminQcl);
101  Double_t logxmaxQcl = TMath::Log(xmaxQcl);
102  Double_t binwidthQcl = (logxmaxQcl-logxminQcl)/nbinsQcl;
103  Double_t xbinsQcl[nbinsQcl+1];
104  xbinsQcl[0] = xminQcl;
105  for (Int_t i=1;i<=nbinsQcl;i++)
106  xbinsQcl[i] = TMath::Exp(logxminQcl+i*binwidthQcl);
107 
108  hQtotOut[0] = new TH1F("hQtotOutX","",nbinsQcl,xbinsQcl);
109  hQtotOut[1] = new TH1F("hQtotOutY","",nbinsQcl,xbinsQcl);
110 
111 }
112 
113 void HarpoExcludeBadEvents::Save(char * /* mode*/ )
114 {
115 
116  // TApplication* app = new TApplication("App", 0, 0);
117  TCanvas* c = new TCanvas("c","",1200,800);
118  MakeNiceHisto(hQtotOut[0],c);
119  hQtotOut[1]->SetLineColor(kRed);
120  hQtotOut[1]->Draw("same");
121  c->SetLogx();
122  c->SetLogy();
123 
124  OpenHistFile("excludebadevents");
125 
126  hQtotOut[0]->Write();
127  hQtotOut[1]->Write();
128  hMap[0]->Write();
129  hMap[1]->Write();
130 
131 }
132 
#define NCHAN
Definition: HarpoDccMap.h:16
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Definition: HarpoDccMap.cxx:84
Dummy analysis to run as test and example. Give basic histograms of the data.
void SetEvAnaStatus(Int_t status)
Set Event Analise status.
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
TH1F * hQtotOut[2]
Redefine empty default.
TVirtualPad * MakeNiceHisto(TH1 *hist, TVirtualPad *c1, const char *opt, Bool_t copy)
void Save(char *mode=NULL)
#define NADC
Definition: HarpoDccMap.h:18
HarpoEventHeader * GetHeader()
Definition: HarpoEvent.cxx:80
HarpoEvent * fEvt
Definition: HarpoAnalyse.h:70
ULong_t nEvents
Definition: HarpoAnalyse.h:75
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:108