StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
digmaps.cxx
1 // //
3 // DIGMAPS //
4 // //
5 // Main Class of DIGMAPS //
6 // Contains pointers to all other classes and to the root tree //
7 // units are all in micrometer. //
8 // //
9 // contains: //
10 // - Run() function (loop on all configurations) //
11 // - ActionPlot() function (plot a configuration) //
12 // - RunConfiguration() loop on all events for a given configuration //
13 // //
15 #include <digmaps.h>
16 #include <TStopwatch.h>
17 #include <TROOT.h> // for gROOT object
18 #include <TMath.h>
19 #include <TMatrixD.h>
20 #include <TCanvas.h>
21 #include <TGraph.h>
22 #include <TAxis.h>
23 #include <TRandom3.h>
24 #include <TFile.h>
25 #include <TTree.h>
26 #include <TBranch.h>
27 #include <TClonesArray.h>
28 #include <TPaveStats.h>
29 #include <string.h>
30 
31 #include "digresult.h"
32 #include "digaction.h"
33 #include "digadc.h"
34 #include "digbeam.h"
35 #include "digtransport.h"
36 #include "digevent.h"
37 #include "diginitialize.h"
38 #include "digparticle.h"
39 #include "digcluster.h"
40 #include "digplane.h"
41 #include "dighistograms.h"
42 
43 
44 extern Int_t GlobalSeed = 1;
45 
46 //==============================================================================
47 ClassImp(DIGMAPS)
48 DIGMAPS::DIGMAPS()
49  : TNamed("DIGMAPS","DIGMAPS title")
50 {
51  //
52  // default constructor
53  //
54 }
55 //______________________________________________________________________________
56 //
57 
58 DIGMAPS::DIGMAPS(char *name, char *title, TString aCP, TString aCFN, TString outp, TString outf, TString action ) : TNamed(name,title)
59 {
60  timer1.Start();
61  time_t seconds;
62  seconds = time(NULL);
63  gRandom->SetSeed(seconds);
64  GlobalSeed=seconds;
65  ColorChosen=1;
66 
67  SetConfigPathAndFileName(aCP,aCFN);
68  SetIsOutputfile(1);
69  SetOutputPathAndFileName(outp,outf) ;
70  SetfAction(action);
71  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
72  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
73  std::cout<<"++ ++"<<endl;
74  std::cout<<"++ ++"<<endl;
75  std::cout<<"++ WELCOME to DIGMAPS ++"<<endl;
76  std::cout<<"++ ++"<<endl;
77  std::cout<<"++ ++"<<endl;
78  std::cout<<"++ Version: 1.01 Date: March 29th 2011 ++"<<endl;
79  std::cout<<"++ Author: Auguste Besson abesson@in2p3.fr ++"<<endl;
80  std::cout<<"++ (WITH OUTPUT FILE) ++"<<endl;
81  std::cout<<"++ ++"<<endl;
82  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
83  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
84  fDIGPlaneArray=0;
85  fDIGADCArray=0;
86  fDIGBeamArray=0;
87  fDIGTransportArray=0;
88  fDIGResultArray=0;
89  ffile=0;
90  ftree=0;
91  fDIGInitialize=0;
92  fdigbeam=0;
93  fdigplane=0;
94  fdigadc=0;
95  fdigresult=0;
96 
97  Run();
98  timer1.Stop();
99  cout<<" REAL TIME = "<<timer1.RealTime()<<" ; CPU TIME = "<<timer1.CpuTime()<<endl;
100 
101 }
102 //______________________________________________________________________________
103 //
104 
105 DIGMAPS::DIGMAPS(char *name, char *title, TString aCP, TString aCFN , TString action ) : TNamed(name,title)
106 {
107  timer1.Start();
108 
109  time_t seconds;
110  seconds = time(NULL);
111  gRandom->SetSeed(seconds);
112  GlobalSeed=seconds;
113  ColorChosen=1;
114 
115  SetConfigPathAndFileName(aCP,aCFN);
116  SetIsOutputfile(0);
117  SetfAction(action);
118  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
119  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
120  std::cout<<"++ ++"<<endl;
121  std::cout<<"++ ++"<<endl;
122  std::cout<<"++ WELCOME to DIGMAPS ++"<<endl;
123  std::cout<<"++ ++"<<endl;
124  std::cout<<"++ ++"<<endl;
125  std::cout<<"++ Version: 1.01 Date: March 29th 2011 ++"<<endl;
126  std::cout<<"++ Author: Auguste Besson abesson@in2p3.fr ++"<<endl;
127  std::cout<<"++ (WITHOUT OUTPUT FILE) ++"<<endl;
128  std::cout<<"++ ++"<<endl;
129  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
130  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
131  fDIGPlaneArray=0;
132  fDIGADCArray=0;
133  fDIGBeamArray=0;
134  fDIGTransportArray=0;
135  fDIGResultArray=0;
136  ffile=0;
137  ftree=0;
138  fDIGInitialize=0;
139  fdigbeam=0;
140  fdigplane=0;
141  fdigadc=0;
142  fdigresult=0;
143 
144  Run();
145  timer1.Stop();
146 
147  cout<<" REAL TIME = "<<timer1.RealTime()<<" ; CPU TIME = "<<timer1.CpuTime()<<endl;
148 }
149 //______________________________________________________________________________
150 //
151 DIGMAPS::~DIGMAPS() { //
152  // virtual destructor
153  //
154 }
155 //______________________________________________________________________________
156 //
157 void DIGMAPS::Run()
158 {
159 
160  //--------read configuration
161  fDIGInitialize = new DIGInitialize("read","test",fConfigPath,fConfigFileName,fAction);
162  //print output in file:
163  std::streambuf* OldBuf=0;
164  std::cout<<"config file = "<<GetConfigPathAndFileName()<<endl;
165  if(GetIsOutputfile()==1){
166  std::cout<<"output file = "<<GetOutputPathAndFileName()<<endl;
167  fOutputFileStream.open(fOutputPathAndFileName, ios::out);
168 
169  OldBuf = std::cout.rdbuf(fOutputFileStream.rdbuf());
170  fDIGInitialize->PrintInfo();
171  }else{
172  std::cout<<"NO output file "<<endl;;
173  }
174  //---------------------------
175 
176  //--------Read action
177 
178  Char_t *myDoit =0; //= (fDIGInitialize->GetActionPar()).Doit;
179  Char_t *myModel=0; // = (fDIGInitialize->GetActionPar()).Model;
180  myDoit = strdup((fDIGInitialize->GetActionPar()).Doit);
181  myModel = strdup((fDIGInitialize->GetActionPar()).Model);
182 
183  DIGAction *aDIGAction =0;
184  aDIGAction = new DIGAction(myDoit,myModel);
185  SetAction(aDIGAction);
186 
187  std::cout<<" DIGMAPS:Run: Action ="<<myDoit<<" ; Model = "<<myModel<<endl;
188 
189  Int_t myAction = 0;
190  Char_t action[200] = "foresee";
191  // strlen(action);
192  if(!strncmp( action, myDoit,strlen(action)) ){
193  cout<<" WE CAN DO THAT !"<<endl;
194  myAction=1;
195  }
196  Char_t action2[200] = "plot";
197  if(!strncmp( action2, myDoit,strlen(action2)) ){
198  cout<<" WE CAN PLOT THAT !"<<endl;
199  myAction=2;
200  }
201 
202  //---compute number of Beams to create
203  Int_t TotalNumberOfBeams = 0;
204  TotalNumberOfBeams = (fDIGInitialize->GetBeamPar().NAngles);
205  std::cout<<" DIGMAPS:Run TotalNumberOfBeams = "<<TotalNumberOfBeams<<endl;
206  //---------------------------
207 
208  //---compute number of planes to create.
209  Int_t TotalNumberOfPlanes = 0;
210  TotalNumberOfPlanes = (fDIGInitialize->GetPlanePar().NGeom)
211  * (fDIGInitialize->GetPlanePar().NTemperature);
212  std::cout<<" DIGMAPS:Run TotalNumberOfPlanes = "<<TotalNumberOfPlanes<<endl;
213  //---------------------------
214 
215  //---compute number of ADCs to create
216  Int_t TotalNumberOfADCs = 0;
217  TotalNumberOfADCs = (fDIGInitialize->GetPlanePar().NADC);
218 
219  std::cout<<" DIGMAPS:Run TotalNumberOfADCs = "<<TotalNumberOfADCs<<endl;
220  //---------------------------
221  //---compute number of transport model to create
222  Int_t TotalNumberOfTransports = 0;
223  TotalNumberOfTransports = (fDIGInitialize->GetPlanePar().NTransport);
224 
225  std::cout<<" DIGMAPS:Run TotalNumberOfTransports = "<<TotalNumberOfTransports<<endl;
226 
227 
228 
229 
230  //-------create all Beams
231  fBeamN = TotalNumberOfBeams;
232  fDIGBeamArray = new TObjArray(fBeamN);
233  DIGBeam *aDIGBeam=0; // a pointer to an ADC
234  //---------------------------
235 
236  //-------create all planes
237  fPlanesN = TotalNumberOfPlanes;
238  fDIGPlaneArray = new TObjArray(fPlanesN);
239  DIGPlane *aDIGPlane=0; // a pointer to a plane
240  //---------------------------
241 
242  //-------create all ADCs
243  fADCN = TotalNumberOfADCs;
244  fDIGADCArray = new TObjArray(fADCN);
245  DIGADC *aDIGADC=0; // a pointer to an ADC
246  //---------------------------
247 
248 
249  //-------create all ADCs
250  fTransportN = TotalNumberOfTransports;
251  fDIGTransportArray = new TObjArray(fTransportN);
252  DIGTransport *aDIGTransport=0; // a pointer to a transport model
253  //---------------------------
254 
255  //----loop on all beams
256  for (Int_t ibeam = 0; ibeam < (fDIGInitialize->GetBeamPar().NAngles) ; ibeam++){
257  aDIGBeam = new DIGBeam(fDIGInitialize->GetBeamPar().RunNumber,
258  fDIGInitialize->GetBeamPar().NumberOfEvents,
259  fDIGInitialize->GetBeamPar().ParticleDensity,
260  fDIGInitialize->GetBeamPar().ThetaIncidentDeg[ibeam],
261  fDIGInitialize->GetBeamPar().PhiIncidentDeg[ibeam],
262  fDIGInitialize->GetBeamPar().BeamOption);
263  fDIGBeamArray->Add(aDIGBeam);
264  }
265  //---------------------------
266 
267  //----loop on all beams
268  /*
269  for (Int_t ibeam = 0; ibeam < TotalNumberOfBeams ; ibeam++){
270  ((DIGBeam*)fDIGBeamArray->At(ibeam))->PrintInfo();
271  GetBeam(ibeam)->PrintInfo();
272  }
273  */
274  //----loop on all ADCs
275  for (Int_t iADC = 0; iADC < (fDIGInitialize->GetPlanePar().NADC) ; iADC++){
276  // std::cout<<" "<<iADC<<" "<<(fDIGInitialize->GetPlanePar().NADC)<<endl;
277  //read ADC parameters
278  aDIGADC = new DIGADC();
279  aDIGADC->SetNbits(fDIGInitialize->GetADCPar(iADC).Nbits);
280  //std::cout<<"N bits "<<fDIGInitialize->GetADCPar(iADC).Nbits<<" "<<aDIGADC->GetNbits()<<endl;
281  aDIGADC->SetNThresholds(fDIGInitialize->GetADCPar(iADC).NThresholds);
282  //std::cout<<"NThresholds "<<fDIGInitialize->GetADCPar(iADC).NThresholds<<" "<<aDIGADC->GetNThresholds()<<endl;
283  aDIGADC->SetADC_linear(fDIGInitialize->GetADCPar(iADC).ADC_linear);
284  //std::cout<<"ADC_linear "<<fDIGInitialize->GetADCPar(iADC).ADC_linear<<" "<<aDIGADC->GetADC_linear()<<endl;
285  aDIGADC->SetLSB(fDIGInitialize->GetADCPar(iADC).LSB);
286  //std::cout<<"LSB "<<fDIGInitialize->GetADCPar(iADC).LSB<<" "<<aDIGADC->GetLSB() <<endl;
287  aDIGADC->SetElectron_Conversion(fDIGInitialize->GetADCPar(iADC).Electron_Conversion);
288  //std::cout<<"electron_Conversion "<<fDIGInitialize->GetADCPar(iADC).Electron_Conversion<<" "<<aDIGADC->GetElectron_Conversion() <<endl;
289  //for (Int_t i = 0; i <aDIGADC->GetNThresholds() ; i++){
290  // std::cout<<"tADC_thresholds n"<<i<<" ="<<fDIGInitialize->GetADCPar(iADC).ADC_thresholds[i]<<endl;
291  //}
292  aDIGADC->SetADC_thresholds( (fDIGInitialize->GetADCPar(iADC).ADC_thresholds),fDIGInitialize->GetADCPar(iADC).NThresholds);
293  //std::cout<<"tADC_thresholds " <<endl;
294  // aDIGADC->PrintInfo();
295  fDIGADCArray->Add(aDIGADC);
296  }
297 
298  // std::cout<<"2nd loop on ADCs"<<endl;
299  /*
300  for (Int_t iADC = 0; iADC < (fDIGInitialize->GetPlanePar().NADC) ; iADC++){
301  ((DIGADC*)fDIGADCArray->At(iADC))->PrintInfo();
302  }
303  */
304  //---------------------------
305  //----loop on all transport models
306  for (Int_t itrans = 0; itrans < (fDIGInitialize->GetPlanePar().NTransport) ; itrans++){
307  aDIGTransport = new DIGTransport();
308  aDIGTransport->SetChargeModel(fDIGInitialize->GetTransportPar(itrans).ChargeModel );
309  aDIGTransport->SetRangeLimit_InPitchUnit(fDIGInitialize->GetTransportPar(itrans).RangeLimit_InPitchUnit);
310  if(aDIGTransport->GetChargeModel()==1){
311  aDIGTransport->SetLorentz2DModel_Cp0(fDIGInitialize->GetTransportPar(itrans).Lorentz2DModel_Cp0);
312  aDIGTransport->SetLorentz2DModel_Cp1(fDIGInitialize->GetTransportPar(itrans).Lorentz2DModel_Cp1);
313  }
314  if(aDIGTransport->GetChargeModel()==2){
315  aDIGTransport->SetGauss2DModel_sigma1_Cp0(fDIGInitialize->GetTransportPar(itrans).Gauss2DModel_sigma1_Cp0);
316  aDIGTransport->SetGauss2DModel_sigma1_Cp1(fDIGInitialize->GetTransportPar(itrans).Gauss2DModel_sigma1_Cp1);
317  aDIGTransport->SetGauss2DModel_sigma2_Cp0(fDIGInitialize->GetTransportPar(itrans).Gauss2DModel_sigma2_Cp0);
318  aDIGTransport->SetGauss2DModel_sigma2_Cp1(fDIGInitialize->GetTransportPar(itrans).Gauss2DModel_sigma2_Cp1);
319  aDIGTransport->SetGauss2DModel_weight(fDIGInitialize->GetTransportPar(itrans).Gauss2DModel_weight);
320  }
321  if(aDIGTransport->GetChargeModel()==3){
322  aDIGTransport->SetLorGaussModel_Norm1_Cp0(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_Norm1_Cp0);
323  aDIGTransport->SetLorGaussModel_Norm1_Cp1(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_Norm1_Cp1);
324  aDIGTransport->SetLorGaussModel_Norm1_Cp2(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_Norm1_Cp2);
325  aDIGTransport->SetLorGaussModel_sigma_Cp0(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_sigma_Cp0);
326  aDIGTransport->SetLorGaussModel_sigma_Cp1(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_sigma_Cp1);
327  aDIGTransport->SetLorGaussModel_C_Cp0(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_C_Cp0);
328  aDIGTransport->SetLorGaussModel_C_Cp1(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_C_Cp1);
329  aDIGTransport->SetLorGaussModel_Norm_Cp0(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_Norm_Cp0);
330  aDIGTransport->SetLorGaussModel_Norm_Cp1(fDIGInitialize->GetTransportPar(itrans).LorGaussModel_Norm_Cp1);
331  }
332 
333  if(aDIGTransport->GetChargeModel()==4){
334  aDIGTransport->SetlorlorgausModel_Norm1_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_Norm1_Cp0);
335  aDIGTransport->SetlorlorgausModel_Norm1_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_Norm1_Cp1);
336  aDIGTransport->SetlorlorgausModel_x01_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_x01_Cp0);
337  aDIGTransport->SetlorlorgausModel_x01_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_x01_Cp1);
338  aDIGTransport->SetlorlorgausModel_sigmax1_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_sigmax1_Cp0);
339  aDIGTransport->SetlorlorgausModel_sigmax1_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_sigmax1_Cp1);
340  aDIGTransport->SetlorlorgausModel_y01_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_y01_Cp0);
341  aDIGTransport->SetlorlorgausModel_y01_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_y01_Cp1);
342  aDIGTransport->SetlorlorgausModel_sigmay1_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_sigmay1_Cp0);
343  aDIGTransport->SetlorlorgausModel_sigmay1_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_sigmay1_Cp1);
344  aDIGTransport->SetlorlorgausModel_Gamma_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_Gamma_Cp0);
345  aDIGTransport->SetlorlorgausModel_Gamma_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_Gamma_Cp1);
346  aDIGTransport->SetlorlorgausModel_x0_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_x0_Cp0);
347  aDIGTransport->SetlorlorgausModel_x0_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_x0_Cp1);
348  aDIGTransport->SetlorlorgausModel_y0_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_y0_Cp0);
349  aDIGTransport->SetlorlorgausModel_y0_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_y0_Cp1);
350  aDIGTransport->SetlorlorgausModel_norm_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_norm_Cp0);
351  aDIGTransport->SetlorlorgausModel_norm_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_norm_Cp1);
352  aDIGTransport->SetlorlorgausModel_normgaus2_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_normgaus2_Cp0);
353  aDIGTransport->SetlorlorgausModel_normgaus2_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_normgaus2_Cp1);
354  aDIGTransport->SetlorlorgausModel_sigma2_Cp0(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_sigma2_Cp0);
355  aDIGTransport->SetlorlorgausModel_sigma2_Cp1(fDIGInitialize->GetTransportPar(itrans).lorlorgausModel_sigma2_Cp1);
356  }
357  if(aDIGTransport->GetChargeModel()==5){
358  aDIGTransport->Setf1dimgauslor_Norm_g_1st(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_Norm_g_1st);
359  aDIGTransport->Setf1dimgauslor_x0_g_1st(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_x0_g_1st);
360  aDIGTransport->Setf1dimgauslor_sigma_g_1st(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_sigma_g_1st);
361  aDIGTransport->Setf1dimgauslor_Gamma_lor_1st(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_Gamma_lor_1st);
362  aDIGTransport->Setf1dimgauslor_x0_lor_1st(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_x0_lor_1st);
363  aDIGTransport->Setf1dimgauslor_norm_lor_1st(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_norm_lor_1st);
364  aDIGTransport->Setf1dimgauslor_Norm_g_2nd(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_Norm_g_2nd);
365  aDIGTransport->Setf1dimgauslor_x0_g_2nd(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_x0_g_2nd);
366  aDIGTransport->Setf1dimgauslor_sigma_g_2nd(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_sigma_g_2nd);
367  aDIGTransport->Setf1dimgauslor_Gamma_lor_2nd(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_Gamma_lor_2nd);
368  aDIGTransport->Setf1dimgauslor_x0_lor_2nd(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_x0_lor_2nd);
369  aDIGTransport->Setf1dimgauslor_norm_lor_2nd(fDIGInitialize->GetTransportPar(itrans).l1dimgauslor_norm_lor_2nd);
370  }
371  fDIGTransportArray->Add(aDIGTransport);
372  }
373 
374  for (Int_t igeom = 0; igeom < (fDIGInitialize->GetPlanePar().NGeom) ; igeom++){
375  for (Int_t itemp = 0; itemp < (fDIGInitialize->GetPlanePar().NTemperature) ; itemp++){
376  aDIGPlane = new DIGPlane();
377  aDIGPlane->SetPitch((fDIGInitialize->GetPlanePar().PitchX[igeom]),(fDIGInitialize->GetPlanePar().PitchY[igeom]));
378  aDIGPlane->SetNpixels((fDIGInitialize->GetPlanePar().NPixelsX),(fDIGInitialize->GetPlanePar().NPixelsY));
379  Float_t tempDimensionX = (fDIGInitialize->GetPlanePar().NPixelsX)*(fDIGInitialize->GetPlanePar().PitchX[igeom]);
380  Float_t tempDimensionY = (fDIGInitialize->GetPlanePar().NPixelsY)*(fDIGInitialize->GetPlanePar().PitchY[igeom]);
381  Float_t tempDimensionZ = (fDIGInitialize->GetPlanePar().EpitaxialThickness[igeom]);
382  aDIGPlane->SetDimensions(tempDimensionX,tempDimensionY,tempDimensionZ);
383  aDIGPlane->SetNoiseElectrons((fDIGInitialize->GetPlanePar().NoiseElectrons[igeom]));
384  aDIGPlane->SetTemperature((fDIGInitialize->GetPlanePar().Temperature[itemp]));
385  aDIGPlane->SetIonizationEnergy((fDIGInitialize->GetPlanePar().IonizationEnergy));
386  aDIGPlane->SetSegmentSize((fDIGInitialize->GetPlanePar().SegmentSize));
387  aDIGPlane->SetMaximumSegmentSize((fDIGInitialize->GetPlanePar().MaximumSegmentSize));
388  aDIGPlane->SetMaximumChargePerSegment((fDIGInitialize->GetPlanePar().MaximumChargePerSegment));
389  aDIGPlane->SetDiffusionMaximumRange((fDIGInitialize->GetPlanePar().DiffusionMaximumRangeInX),
390  (fDIGInitialize->GetPlanePar().DiffusionMaximumRangeInY));
391  aDIGPlane->SetReflexionCoefficient((fDIGInitialize->GetPlanePar().ReflexionCoefficient));
392  aDIGPlane->SetBasicModel_SigmaTenMicrons((fDIGInitialize->GetPlanePar().BasicModel_SigmaTenMicrons));
393 
394  fDIGPlaneArray->Add(aDIGPlane);
395  }
396  }
397 
398 
399  //------------compute total number of configurations
400  Int_t mynumberofconfigurations = TotalNumberOfBeams* TotalNumberOfPlanes *TotalNumberOfADCs*TotalNumberOfTransports;
401  SetNumberOfConfigurations(mynumberofconfigurations);
402 
403  //---------------------------
404  //----create the array of results:
405  fDIGResultArray = new TObjArray(mynumberofconfigurations);
406  DIGResult *aDIGResult=0;
407  for (Int_t ires = 0; ires < mynumberofconfigurations ; ires++){
408  aDIGResult = new DIGResult();
409  aDIGResult->SetIdealEfficiency(0.0);
410  fDIGResultArray->Add(aDIGResult);
411  }
412  //---------------------------
413 
414 
415  //---------------------------
416  if(myAction==1) {
417  //---------------------------
418 
419 
420  //----------create tree:
421  //----------create tree with all classes.
422  //TFile myfile("tree.root","RECREATE");
423  //TTree mytree("mytree","DIGMAPS tree");
424 
425  ffile = new TFile("tree.root","RECREATE");
426  ftree = new TTree("mytree","DIGMAPS tree");
427 
428  fdigbeam = new DIGBeam();
429  ftree->Branch("beam_branch","DIGBeam",&fdigbeam,32000,1);
430 
431  fdigplane = new DIGPlane();
432  ftree->Branch("plane_branch","DIGPlane",&fdigplane,32000,1);
433 
434  fdigadc = new DIGADC();
435  ftree->Branch("adc_branch","DIGADC",&fdigadc,32000,1);
436 
437  fdigtransport = new DIGTransport();
438  ftree->Branch("transport_branch","DIGTransport",&fdigtransport,32000,1);
439 
440  fdigevent = new DIGEvent();
441  ftree->Branch("event_branch","DIGEvent",&fdigevent,32000,99);
442 
443 
444  //---------------------------
445  Int_t iconfigcounter =0;
446  //-------------------------------------------------------------------------------------
447  //--------------Loop on all configurations.
448  //-------------------------------------------------------------------------------------
449  for (Int_t ibeam = 0; ibeam < TotalNumberOfBeams ; ibeam++){
450  for (Int_t iplane = 0; iplane < TotalNumberOfPlanes ; iplane++){
451  for (Int_t iadc = 0; iadc < TotalNumberOfADCs ; iadc++){
452  for (Int_t itransport = 0; itransport < TotalNumberOfTransports ; itransport++){
453  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
454  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
455  std::cout<<" "<<endl;
456  std::cout<<" Configuration number " <<iconfigcounter+1 <<" / "<< mynumberofconfigurations<<endl;
457  std::cout<<" ibeam "<<ibeam <<endl;
458  std::cout<<" iplane "<<iplane <<endl;
459  std::cout<<" iadc "<<iadc <<endl;
460  std::cout<<" itransport "<< itransport<<endl;
461  std::cout<<" "<<endl;
462  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
463  std::cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
464  RunConfiguration(iconfigcounter,ibeam,iplane,iadc,itransport);
465  iconfigcounter++;
466  }
467  }
468  }
469  }
470  ffile->Write();
471  delete fdigevent;
472  delete fdigbeam;
473  delete fdigplane;
474  delete fdigtransport;
475  delete fdigadc;
476  //-------------------------------------------------------------------------------------
477  }// end Action ==1
478 
479  if(myAction==2){
480  cout<<"Time to read the tree ! "<<endl;
481  ActionPlot();
482  }
483 
484 
485  PrintConfigurations();
486 
487  std::cout.rdbuf(OldBuf);
488  fOutputFileStream.close();
489 
490  PrintConfigurations();
491 
492 
493  cout<<" ... END"<<endl;
494 
495  /* time_t seconds;
496  seconds = time(NULL);
497  cout<<"TIME "<< seconds<<endl;
498  */
499 }
500 //______________________________________________________________________________
501 //
502 void DIGMAPS::ActionPlot()
503 {
504 
505 
506  //-------------------------------------------
507  //---------Declare histograms
508  //-------------------------------------------
509 
510  DIGHistograms::BookHistograms(GetNumberOfConfigurations());
511 
512 
513  //-------------------------------------------
514  //---------Open tree
515  //-------------------------------------------
516 
517  cout<<"Time to read the tree ! "<<endl;
518  ffile = new TFile("tree.root","READ");
519  // ftree = new TTree("mytree","DIGMAPS tree");
520  ftree=(TTree*) ffile->Get("mytree");
521 
522  DIGBeam *mydigBeam = new DIGBeam();
523  TBranch *branchdigBeam = ftree->GetBranch("beam_branch");
524  branchdigBeam->SetAddress(&mydigBeam);
525 
526  DIGPlane *mydigPlane = new DIGPlane();
527  TBranch *branchdigPlane= ftree->GetBranch("plane_branch");
528  branchdigPlane->SetAddress(&mydigPlane);
529 
530  DIGADC *mydigADC = new DIGADC();
531  TBranch *branchdigADC= ftree->GetBranch("adc_branch");
532  branchdigADC->SetAddress(&mydigADC);
533 
534  DIGTransport *mydigTransport = new DIGTransport();
535  TBranch *branchdigTransport= ftree->GetBranch("transport_branch");
536  branchdigTransport->SetAddress(&mydigTransport);
537 
538 
539 
540  DIGEvent *mydigEvent = new DIGEvent();
541  TBranch *branchdigEvent= ftree->GetBranch("event_branch");
542  branchdigEvent->SetAddress(&mydigEvent);
543 
544  Int_t NEVENT = (Int_t) ftree->GetEntries() ;
545 
546  Int_t MinEvent = 0;
547  Int_t MaxEvent = NEVENT;
548 
549 
550  Int_t Old_configuration = -1;
551  Int_t Current_configuration = 0;
552 
553  Float_t IdealEfficiency=-1;
554  Int_t TotalNumberOfParticles = 0;
555  Int_t TotalNumberOfClusters = 0;
556 
557 
558  // Int_t Former_configuration =0;
559  // **********************************************************************************
560  // ********* MAIN LOOP ***************
561  // **********************************************************************************
562  for ( Int_t ievt=MinEvent ; ievt<MaxEvent ; ievt++ ) {
563  ftree->GetEvent(ievt);
564  cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Event ievt "<<ievt<<endl;
565  //cout<<" DIGBEAM TEST:: GetThetaIncidentDeg "<<mydigBeam->GetThetaIncidentDeg()<<endl;
566  //cout<<" DIGPLANE TEST:: GetPitchX "<<mydigPlane->GetPitchX() <<endl;
567  //cout<<" DIGADC TEST:: GetNbits() "<<mydigADC->GetNbits() <<endl;
568 
569  //-------------------------------------------
570  //---------get the configuration and initialize if it's a new one.
571  //-------------------------------------------
572 
573  Current_configuration = mydigEvent->GetConfigurationNumber();
574 
575 
576  if(Current_configuration!=Old_configuration){
577  IdealEfficiency=-1;
578  TotalNumberOfParticles = 0;
579  TotalNumberOfClusters = 0;
580  Old_configuration=Current_configuration;
581  }
582 
583  //-------------------------------------------
584  //---------Get transport model and plot it
585  //-------------------------------------------
586 
587  //mydigTransport->GetChargeModel()
588 
589  // if model == 1 then store tels parametres.
590 
591  // create a function with such parametersxs
592  // On a deja: Double_t DIGMAPS::Lorentz2D(Double_t *x, Double_t *par){
593  // copier la 2xgaus2d et la lor+gauss
594 
595  // en fait il faudrait stocker une funtion plutot qu'un histo.
596 
597  // creer des histo 2d charge vs distance.
598 
599  //loop sur tous les clusters, acces a tous les pixels du cluster, acces a leur charge digitise et leur position,
600  //acces a la position de la trace, calcul de la distance
601  //remplissage de l'histo 2d.
602 
603  //-------------------------------------------
604  //---------loop on ADC thresholds
605  //-------------------------------------------
606  for ( Int_t i=0 ; i<mydigADC->GetNThresholds() ; i++ ) {
607  // cout<<"threshold "<<i<<" "<<mydigADC->GetADC_thresholds()[i]<<endl;
608  }
609  ((TH1F*) Ar_h1_ADC_LSB->At(Current_configuration))->Fill( mydigADC->GetLSB() );
610 
611  //-------------------------------------------
612  //---------Print info
613  //-------------------------------------------
614  mydigEvent->PrintInfo();
615 
616  //-------------------------------------------
617  //----------get particles of the event
618  //-------------------------------------------
619  TClonesArray *myDIGParticleArray = mydigEvent->GetParticle();
620  DIGParticle* TheParticle =0;
621  Int_t NbOfParticles = myDIGParticleArray->GetLast()+1 ;
622  TotalNumberOfParticles+=NbOfParticles;
623  Int_t j=0;
624  vector< Bool_t > ClusterAssociated;
625  ClusterAssociated.resize(mydigEvent->GetNClusters());
626  for (Int_t i = 0; i < mydigEvent->GetNClusters() ; i++){
627  ClusterAssociated[i]=false;
628  }
629 
630 
631  while(j<NbOfParticles) {
632  TheParticle=(DIGParticle*) myDIGParticleArray->At(j) ;
633  //TheParticle->PrintInfo();
634  cout<<" DIGITAL CHARGE "<<TheParticle->GetTotalDigitalCharge()<<endl;
635 
636 
637  ((TH1F*) Ar_h1_Particle_TotalAnalogCharge->At(Current_configuration))->Fill( TheParticle->GetTotalAnalogCharge() );
638  ((TH1F*) Ar_h1_Particle_TotalDigitalCharge->At(Current_configuration))->Fill( TheParticle->GetTotalDigitalCharge() );
639  ((TH1F*) Ar_h1_Particle_Energy_deposited->At(Current_configuration))->Fill( TheParticle->GetEnergy_deposited() );
640 
641 
642  ((TH2F*) Ar_h2_Particle_EnergyDeposited_vs_TotalAnalogCharge->At(Current_configuration))
643  ->Fill(TheParticle->GetTotalAnalogCharge(),TheParticle->GetEnergy_deposited());
644  ((TH2F*) Ar_h2_Particle_TotalDigitalCharge_vs_TotalAnalogCharge->At(Current_configuration))
645  ->Fill(TheParticle->GetTotalAnalogCharge(),TheParticle->GetTotalDigitalCharge());
646 
647 
648  //--------------loop on clusters and associate each particle to one cluster
649  TClonesArray *myDIGClusterArray = mydigEvent->GetCluster();
650  DIGCluster* TheCluster =0;
651  Int_t NbOfCluster = myDIGClusterArray->GetLast()+1 ;
652  TotalNumberOfClusters+=NbOfCluster;
653 
654  Int_t k=0;
655 
656  Float_t trackHitdistance = 100000000.0;
657  Int_t theclusterNumber = 0;
658  Double_t ClusterCoGX = 0.0;
659  Double_t ClusterCoGY = 0.0;
660  Double_t theClusterCoGX = 0.0;
661  Double_t theClusterCoGY = 0.0;
662  Float_t TrackX = (TheParticle->GetEntryX() + TheParticle->GetExitX())/2.0;
663  Float_t TrackY = (TheParticle->GetEntryY() + TheParticle->GetExitY())/2.0;
664 
665  while(k<NbOfCluster) {
666  TheCluster=(DIGCluster*) myDIGClusterArray->At(k) ;
667  ClusterCoGX = TheCluster->GetXposition_CoG();
668  ClusterCoGY = TheCluster->GetYposition_CoG();
669  if(TheCluster->GetTotalCharge()>0.){
670  Double_t currentdist = TMath::Sqrt((TrackX-ClusterCoGX)*(TrackX-ClusterCoGX) + (TrackY-ClusterCoGY)*(TrackY-ClusterCoGY));
671  if((currentdist<trackHitdistance)&&(ClusterAssociated[k]==false)){
672  theclusterNumber = k;
673  trackHitdistance = currentdist;
674  theClusterCoGX = ClusterCoGX;
675  theClusterCoGY = ClusterCoGY;
676  }
677  }
678  k++;
679  }
680  cout<<" DIGITAL CHARGE 2 "<<TheParticle->GetTotalDigitalCharge()<<endl;
681 
682  //--------------end loop on clusters
683  //--------------loop on the pixels of the cluster:
684  if(TheParticle->GetTotalDigitalCharge()>0){
685  TheCluster = (DIGCluster*) myDIGClusterArray->At(theclusterNumber);
686  Float_t ClusterTotalCharge = TheCluster->GetTotalCharge();
687  /*
688  for (Int_t ip = 0; ip < TheCluster->GetNpixels() ; ip++){
689  ClusterTotalCharge += TheCluster->GetDigitalCharge()[ip];
690  }
691  */
692  cout<<" DIGITAL CHARGE 2.1 "<<TheParticle->GetTotalDigitalCharge()<<endl;
693 
694  for (Int_t ip = 0; ip < TheCluster->GetNpixels() ; ip++){
695  Int_t Xpixnum;
696  Int_t Ypixnum;
697  Float_t Xpix;
698  Float_t Ypix;
699  // TrackX TrackY = particle position.
700  // TheCluster->GetPixelMap()[ip];
701  // TheCluster->GetDigitalCharge()[ip];
702  TheCluster->GetXYPixelNumber(Xpixnum,Ypixnum,mydigPlane,TheCluster->GetPixelMap()[ip]);
703  Xpix=(float(Xpixnum)+0.5) * mydigPlane->GetPitchX();
704  Ypix=(float(Ypixnum)+0.5) * mydigPlane->GetPitchY();
705  cout<<"-------------> "<<TrackX<<" "<<Xpix<<" "<<TrackY<<" "<<Ypix<<endl;
706  Float_t trackpixeldistance = TMath::Sqrt((TrackX-Xpix)*(TrackX-Xpix) + (TrackY-Ypix)*(TrackY-Ypix));
707  Float_t thepixelcharge = TheCluster->GetDigitalCharge()[ip];
708  Float_t thepixelchargeRelative = thepixelcharge/ClusterTotalCharge;
709  if(ClusterTotalCharge!=0.0){
710  ((TH2F*) Ar_h2_Charge_Q_over_Qtot_vs_distance->At(Current_configuration))
711  ->Fill(trackpixeldistance,thepixelchargeRelative);
712  ((TProfile*) Ar_Pr_Charge_Q_over_Qtot_vs_distance->At(Current_configuration))
713  ->Fill(trackpixeldistance,thepixelchargeRelative);
714  }
715  }
716  }
717  //--------------end loop on pixels
718  Float_t distancemax = 5.0*TMath::Sqrt(mydigPlane->GetPitchX()*mydigPlane->GetPitchX()+mydigPlane->GetPitchY()*mydigPlane->GetPitchY());
719  cout<<" DIGITAL CHARGE 3 "<<TheParticle->GetTotalDigitalCharge()<<endl;
720 
721  if(TheParticle->GetTotalDigitalCharge()>0.){
722  if(trackHitdistance < distancemax ){
723  ClusterAssociated[theclusterNumber]=true;
724  }
725 
726  ((TH1F*) Ar_h1_Resolution_ResidualX_CoG_true->At(Current_configuration))->Fill(TrackX - theClusterCoGX);
727  ((TH1F*) Ar_h1_Resolution_ResidualY_CoG_true->At(Current_configuration))->Fill(TrackY - theClusterCoGY);
728  ((TH1F*) Ar_h1_Resolution_Residualdist_CoG_true->At(Current_configuration))->Fill(trackHitdistance);
729  ((TH2F*) Ar_h2_Resolution_TruePosition->At(Current_configuration))->Fill(TrackX,TrackY);
730  ((TH2F*) Ar_h2_Resolution_TruePosition_modulo->At(Current_configuration))
731  ->Fill(TrackX-int(TrackX)+int(TrackX)%(int(mydigPlane->GetPitchX())) ,TrackY-int(TrackY)+int(TrackY)%(int(mydigPlane->GetPitchY())) );
732  ((TH2F*) Ar_h2_Resolution_CoG->At(Current_configuration))->Fill(ClusterCoGX,ClusterCoGY);
733  ((TH2F*) Ar_h2_Resolution_CoG_modulo->At(Current_configuration))
734  ->Fill(ClusterCoGX-int(ClusterCoGX)+int(ClusterCoGX)%(int(mydigPlane->GetPitchX())),ClusterCoGY-int(ClusterCoGY)+int(ClusterCoGY)%(int(mydigPlane->GetPitchY())));
735 
736  }
737  cout<<" DIGITAL CHARGE 4 "<<TheParticle->GetTotalDigitalCharge()<<endl;
738 
739  j++;
740  } //----end loop on particles
741  if(mydigEvent->GetNParticles() !=myDIGParticleArray->GetLast()+1){
742  cout<< "DIGEVENT TEST:: WARNING PROBLEM IN PARTICLE RECORDING"<<endl;
743  cout<<mydigEvent->GetNParticles()<<" != "<<myDIGParticleArray->GetLast()+1<<endl;
744  }else{
745  //cout<<mydigEvent->GetNParticles()<<" === "<<myDIGParticleArray->GetLast()+1<<endl;
746  }
747 
748  //-------------------------------------------
749  //----------get clusters of the event
750  //-------------------------------------------
751  TClonesArray *myDIGClusterArray = mydigEvent->GetCluster();
752  DIGCluster* TheCluster =0;
753  Int_t NbOfCluster = myDIGClusterArray->GetLast()+1 ;
754  Int_t k=0;
755 
756  if(mydigEvent->GetNClusters() !=myDIGClusterArray->GetLast()+1){
757  cout<< "DIGEVENT TEST:: WARNING PROBLEM IN CLUSTERS RECORDING"<<endl;
758  cout<<mydigEvent->GetNClusters()<<" != "<<myDIGClusterArray->GetLast()+1<<endl;
759  }else{
760  //cout<<mydigEvent->GetNClusters()<<" === "<<myDIGClusterArray->GetLast()+1<<endl;
761  }
762 
763  while(k<NbOfCluster) {
764  TheCluster=(DIGCluster*) myDIGClusterArray->At(k) ;
765  TheCluster->PrintInfo();
766 
767  ((TH1F*) Ar_h1_multiplicity_with_threshold_01->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(1));
768  ((TH1F*) Ar_h1_multiplicity_with_threshold_02->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(2));
769  ((TH1F*) Ar_h1_multiplicity_with_threshold_03->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(3));
770  ((TH1F*) Ar_h1_multiplicity_with_threshold_04->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(4));
771  ((TH1F*) Ar_h1_multiplicity_with_threshold_05->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(5));
772  ((TH1F*) Ar_h1_multiplicity_with_threshold_06->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(6));
773  ((TH1F*) Ar_h1_multiplicity_with_threshold_07->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(7));
774  ((TH1F*) Ar_h1_multiplicity_with_threshold_08->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(8));
775  ((TH1F*) Ar_h1_multiplicity_with_threshold_09->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(9));
776  ((TH1F*) Ar_h1_multiplicity_with_threshold_10->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(10));
777 
778  ((TH1F*) Ar_h1_multiplicity_with_threshold_15->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(15));
779  ((TH1F*) Ar_h1_multiplicity_with_threshold_20->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(20));
780  ((TH1F*) Ar_h1_multiplicity_with_threshold_25->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(25));
781  ((TH1F*) Ar_h1_multiplicity_with_threshold_30->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(30));
782  ((TH1F*) Ar_h1_multiplicity_with_threshold_40->At(Current_configuration))->Fill(TheCluster->GetMultiplicity(40));
783 
784  ((TH1F*) Ar_h1_Cluster_SeedDigitalCharge->At(Current_configuration))->Fill(float(TheCluster->GetDigitalCharge()[TheCluster->GetSeedPixelIndex()]) );
785  ((TH1F*) Ar_h1_Cluster_TotalDigitalCharge->At(Current_configuration))->Fill( TheCluster->GetTotalCharge() );
786  ((TH1F*) Ar_h1_Cluster_9x9DigitalCharge->At(Current_configuration))
787  ->Fill( TheCluster->GetDigitalCharge()[TheCluster->GetSeedPixelIndex()]+ TheCluster->Get1stCrownCharge(mydigPlane) );
788  ((TH1F*) Ar_h1_Cluster_1stCrownDigitalCharge->At(Current_configuration))->Fill(TheCluster->Get1stCrownCharge(mydigPlane));
789  ((TH1F*) Ar_h1_Cluster_2ndCrownDigitalCharge->At(Current_configuration))->Fill(TheCluster->Get2ndCrownCharge(mydigPlane));
790  ((TH1F*) Ar_h1_Cluster_4NeighboursDigitalCharge->At(Current_configuration))->Fill(TheCluster->Get4NeigboursCharge(mydigPlane));
791 
792 
793 
794  ((TH1F*) Ar_h1_test->At(Current_configuration))
795  ->Fill( (TheCluster->Get1stCrownCharge(mydigPlane) +TheCluster->Get2ndCrownCharge(mydigPlane)
796  +TheCluster->GetDigitalCharge()[TheCluster->GetSeedPixelIndex()]));
797 
798 
799  if( TheCluster->GetTotalCharge()!=0){
800  ((TH1F*) Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(Current_configuration))
801  ->Fill(TheCluster->GetDigitalCharge()[TheCluster->GetSeedPixelIndex()] / float(TheCluster->GetTotalCharge()) );
802  ((TH1F*) Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(Current_configuration))
803  ->Fill(TheCluster->Get1stCrownCharge(mydigPlane)/ float(TheCluster->GetTotalCharge()) );
804  ((TH1F*) Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(Current_configuration))
805  ->Fill(TheCluster->Get2ndCrownCharge(mydigPlane)/ float(TheCluster->GetTotalCharge()) );
806  ((TH1F*) Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(Current_configuration))
807  ->Fill(TheCluster->Get4NeigboursCharge(mydigPlane)/ float(TheCluster->GetTotalCharge()) );
808  }
809 
810  k++;
811  }
812 
813  //-------------------------------------------
814  //---------Get read out map of the event
815  //-------------------------------------------
816 
817  DIGReadoutmap *myDIGReadoutmap = mydigEvent->GetReadoutmap();
818  //myDIGReadoutmap->PrintInfo();
819  Int_t Nx = mydigPlane->GetNpixelsX();
820  Int_t Ny = mydigPlane->GetNpixelsY();
821  myDIGReadoutmap->PrintOuput(Nx,Ny);
822 
823  //-------------------------------------------
824  //---------compute current efficiency
825  //-------------------------------------------
826 
827  if(TotalNumberOfParticles!=0){
828  IdealEfficiency = float(TotalNumberOfClusters)/float(TotalNumberOfParticles);
829  GetResult(Current_configuration)->SetConfigNumber(Current_configuration);
830  GetResult(Current_configuration)->SetIdealEfficiency(IdealEfficiency);
831  }
832 
833 
834 
835 
836  }
837  // **********************************************************************************
838  // ********* END OF MAIN LOOP ***************
839  // **********************************************************************************
840 
841  //-------------------------------------------------------------------------------------
842  //--------------Compute results of the current configuration
843  //-------------------------------------------------------------------------------------
844  for ( Int_t ic=0 ; ic<GetNumberOfConfigurations() ; ic++ ) {
845 
846  ((TH1F*) Ar_h1_Efficiency_ideal->At(ic))->Fill(GetResult(ic)->GetIdealEfficiency());
847 
848  }
849 
850 }
851 //______________________________________________________________________________
852 //
853 void DIGMAPS::PlotAConfiguration(Int_t confignumber, Bool_t newcanvas)
854 {
855 
856 
857  if(newcanvas==1){
858  MainCanvas1 = new TCanvas("MainCanvas1","MainCanvas1",450,10,1000,950);
859  MainCanvas1->Divide(4,4);
860  MainCanvas1->Update();
861  MainCanvas2 = new TCanvas("MainCanvas2","MainCanvas2",550,10,1000,950);
862  MainCanvas2->Divide(2,4);
863  MainCanvas2->Update();
864  MainCanvas3 = new TCanvas("MainCanvas3","MainCanvas3",650,10,1000,950);
865  MainCanvas3->Divide(2,4);
866  MainCanvas3->Update();
867  MainCanvas4 = new TCanvas("MainCanvas4","MainCanvas4",750,10,1000,950);
868  MainCanvas4->Divide(2,4);
869  MainCanvas4->Update();
870  ColorChosen =1;
871 
872  }else{
873  ColorChosen++;
874  if(ColorChosen==2){ColorChosen++;}
875  // ColorChosen++;
876  }
877 
878  Float_t integ ;
879  Float_t AxisRange = 0.4;
880  //------------MainCanvas1
881  MainCanvas1->cd(1);
882  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_01->At(confignumber))->Integral();
883  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_01->At(confignumber))->Scale(1/integ);}
884  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
885  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(confignumber)))->SetLineColor(ColorChosen);
886  if(newcanvas==1){
887  (Ar_h1_multiplicity_with_threshold_01->At(confignumber))->Draw();
888  }else{
889  (Ar_h1_multiplicity_with_threshold_01->At(confignumber))->Draw("same");
890  }
891  MainCanvas1->cd(2);
892  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_02->At(confignumber))->Integral();
893  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_02->At(confignumber))->Scale(1/integ);}
894  ((TH1F*)(Ar_h1_multiplicity_with_threshold_02->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
895  ((TH1F*)(Ar_h1_multiplicity_with_threshold_02->At(confignumber)))->SetLineColor(ColorChosen);
896  if(newcanvas==1){
897  (Ar_h1_multiplicity_with_threshold_02->At(confignumber))->Draw();
898  }else{
899  (Ar_h1_multiplicity_with_threshold_02->At(confignumber))->Draw("same");
900  }
901  MainCanvas1->cd(3);
902  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_03->At(confignumber))->Integral();
903  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_03->At(confignumber))->Scale(1/integ);}
904  ((TH1F*)(Ar_h1_multiplicity_with_threshold_03->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
905  ((TH1F*)(Ar_h1_multiplicity_with_threshold_03->At(confignumber)))->SetLineColor(ColorChosen);
906  if(newcanvas==1){
907  (Ar_h1_multiplicity_with_threshold_03->At(confignumber))->Draw();
908  }else{
909  (Ar_h1_multiplicity_with_threshold_03->At(confignumber))->Draw("same");
910  }
911  MainCanvas1->cd(4);
912  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_04->At(confignumber))->Integral();
913  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_04->At(confignumber))->Scale(1/integ);}
914  ((TH1F*)(Ar_h1_multiplicity_with_threshold_04->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
915  ((TH1F*)(Ar_h1_multiplicity_with_threshold_04->At(confignumber)))->SetLineColor(ColorChosen);
916  if(newcanvas==1){
917  (Ar_h1_multiplicity_with_threshold_04->At(confignumber))->Draw();
918  }else{
919  (Ar_h1_multiplicity_with_threshold_04->At(confignumber))->Draw("same");
920  }
921  MainCanvas1->cd(5);
922  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_05->At(confignumber))->Integral();
923  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_05->At(confignumber))->Scale(1/integ);}
924  ((TH1F*)(Ar_h1_multiplicity_with_threshold_05->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
925  ((TH1F*)(Ar_h1_multiplicity_with_threshold_05->At(confignumber)))->SetLineColor(ColorChosen);
926  if(newcanvas==1){
927  (Ar_h1_multiplicity_with_threshold_05->At(confignumber))->Draw();
928  }else{
929  (Ar_h1_multiplicity_with_threshold_05->At(confignumber))->Draw("same");
930  }
931  MainCanvas1->cd(6);
932  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_06->At(confignumber))->Integral();
933  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_06->At(confignumber))->Scale(1/integ);}
934  ((TH1F*)(Ar_h1_multiplicity_with_threshold_06->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
935  ((TH1F*)(Ar_h1_multiplicity_with_threshold_06->At(confignumber)))->SetLineColor(ColorChosen);
936  if(newcanvas==1){
937  (Ar_h1_multiplicity_with_threshold_06->At(confignumber))->Draw();
938  }else{
939  (Ar_h1_multiplicity_with_threshold_06->At(confignumber))->Draw("same");
940  }
941  MainCanvas1->cd(7);
942  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_07->At(confignumber))->Integral();
943  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_07->At(confignumber))->Scale(1/integ);}
944  ((TH1F*)(Ar_h1_multiplicity_with_threshold_07->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
945  ((TH1F*)(Ar_h1_multiplicity_with_threshold_07->At(confignumber)))->SetLineColor(ColorChosen);
946  if(newcanvas==1){
947  (Ar_h1_multiplicity_with_threshold_07->At(confignumber))->Draw();
948  }else{
949  (Ar_h1_multiplicity_with_threshold_07->At(confignumber))->Draw("same");
950  }
951  MainCanvas1->cd(8);
952  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_08->At(confignumber))->Integral();
953  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_08->At(confignumber))->Scale(1/integ);}
954  ((TH1F*)(Ar_h1_multiplicity_with_threshold_08->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
955  ((TH1F*)(Ar_h1_multiplicity_with_threshold_08->At(confignumber)))->SetLineColor(ColorChosen);
956  if(newcanvas==1){
957  (Ar_h1_multiplicity_with_threshold_08->At(confignumber))->Draw();
958  }else{
959  (Ar_h1_multiplicity_with_threshold_08->At(confignumber))->Draw("same");
960  }
961  MainCanvas1->cd(9);
962  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_09->At(confignumber))->Integral();
963  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_09->At(confignumber))->Scale(1/integ);}
964  ((TH1F*)(Ar_h1_multiplicity_with_threshold_09->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
965  ((TH1F*)(Ar_h1_multiplicity_with_threshold_09->At(confignumber)))->SetLineColor(ColorChosen);
966  if(newcanvas==1){
967  (Ar_h1_multiplicity_with_threshold_09->At(confignumber))->Draw();
968  }else{
969  (Ar_h1_multiplicity_with_threshold_09->At(confignumber))->Draw("same");
970  }
971  MainCanvas1->cd(10);
972  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_10->At(confignumber))->Integral();
973  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_10->At(confignumber))->Scale(1/integ);}
974  ((TH1F*)(Ar_h1_multiplicity_with_threshold_10->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
975  ((TH1F*)(Ar_h1_multiplicity_with_threshold_10->At(confignumber)))->SetLineColor(ColorChosen);
976  if(newcanvas==1){
977  (Ar_h1_multiplicity_with_threshold_10->At(confignumber))->Draw();
978  }else{
979  (Ar_h1_multiplicity_with_threshold_10->At(confignumber))->Draw("same");
980  }
981 
982  MainCanvas1->cd(11);
983  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_15->At(confignumber))->Integral();
984  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_15->At(confignumber))->Scale(1/integ);}
985  ((TH1F*)(Ar_h1_multiplicity_with_threshold_15->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
986  ((TH1F*)(Ar_h1_multiplicity_with_threshold_15->At(confignumber)))->SetLineColor(ColorChosen);
987  if(newcanvas==1){
988  (Ar_h1_multiplicity_with_threshold_15->At(confignumber))->Draw();
989  }else{
990  (Ar_h1_multiplicity_with_threshold_15->At(confignumber))->Draw("same");
991  }
992  MainCanvas1->cd(12);
993  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_20->At(confignumber))->Integral();
994  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_20->At(confignumber))->Scale(1/integ);}
995  ((TH1F*)(Ar_h1_multiplicity_with_threshold_20->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
996  ((TH1F*)(Ar_h1_multiplicity_with_threshold_20->At(confignumber)))->SetLineColor(ColorChosen);
997  if(newcanvas==1){
998  (Ar_h1_multiplicity_with_threshold_20->At(confignumber))->Draw();
999  }else{
1000  (Ar_h1_multiplicity_with_threshold_20->At(confignumber))->Draw("same");
1001  }
1002  MainCanvas1->cd(13);
1003  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_25->At(confignumber))->Integral();
1004  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_25->At(confignumber))->Scale(1/integ);}
1005  ((TH1F*)(Ar_h1_multiplicity_with_threshold_25->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
1006  ((TH1F*)(Ar_h1_multiplicity_with_threshold_25->At(confignumber)))->SetLineColor(ColorChosen);
1007  if(newcanvas==1){
1008  (Ar_h1_multiplicity_with_threshold_25->At(confignumber))->Draw();
1009  }else{
1010  (Ar_h1_multiplicity_with_threshold_25->At(confignumber))->Draw("same");
1011  }
1012  MainCanvas1->cd(14);
1013  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_30->At(confignumber))->Integral();
1014  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_30->At(confignumber))->Scale(1/integ);}
1015  ((TH1F*)(Ar_h1_multiplicity_with_threshold_30->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
1016  ((TH1F*)(Ar_h1_multiplicity_with_threshold_30->At(confignumber)))->SetLineColor(ColorChosen);
1017  if(newcanvas==1){
1018  (Ar_h1_multiplicity_with_threshold_30->At(confignumber))->Draw();
1019  }else{
1020  (Ar_h1_multiplicity_with_threshold_30->At(confignumber))->Draw("same");
1021  }
1022  MainCanvas1->cd(15);
1023  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_40->At(confignumber))->Integral();
1024  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_40->At(confignumber))->Scale(1/integ);}
1025  ((TH1F*)(Ar_h1_multiplicity_with_threshold_40->At(confignumber)))->SetAxisRange(0,AxisRange,"Y");
1026  ((TH1F*)(Ar_h1_multiplicity_with_threshold_40->At(confignumber)))->SetLineColor(ColorChosen);
1027  if(newcanvas==1){
1028  (Ar_h1_multiplicity_with_threshold_40->At(confignumber))->Draw();
1029  }else{
1030  (Ar_h1_multiplicity_with_threshold_40->At(confignumber))->Draw("same");
1031  }
1032 
1033 
1034  //------------MainCanvas2
1035  MainCanvas2->cd(1);
1036  ((TH1F*)Ar_h1_Cluster_SeedDigitalCharge->At(confignumber))->Draw("HIST");
1037  ((TH1F*)Ar_h1_Cluster_SeedDigitalCharge->At(confignumber))->Sumw2();
1038  integ = ((TH1F*)Ar_h1_Cluster_SeedDigitalCharge->At(confignumber))->Integral();
1039  if(integ!=0.0){((TH1F*)Ar_h1_Cluster_SeedDigitalCharge->At(confignumber))->Scale(1/integ);}
1040  ((TH1F*)Ar_h1_Cluster_SeedDigitalCharge->At(confignumber))->Fit("landau","","same");
1041 
1042  MainCanvas2->cd(2);
1043  ((TH1F*)Ar_h1_Cluster_TotalDigitalCharge->At(confignumber))->Draw("HIST");
1044  ((TH1F*)Ar_h1_Cluster_TotalDigitalCharge->At(confignumber))->Sumw2();
1045  integ = ((TH1F*)Ar_h1_Cluster_TotalDigitalCharge->At(confignumber))->Integral();
1046  if(integ!=0.0){((TH1F*)Ar_h1_Cluster_TotalDigitalCharge->At(confignumber))->Scale(1/integ);}
1047  ((TH1F*)Ar_h1_Cluster_TotalDigitalCharge->At(confignumber))->Fit("landau","","same");
1048 
1049  MainCanvas2->cd(3);
1050  ((TH1F*)Ar_h1_Particle_TotalAnalogCharge->At(confignumber))->Draw("HIST");
1051  ((TH1F*)Ar_h1_Particle_TotalAnalogCharge->At(confignumber))->Sumw2();
1052  integ = ((TH1F*)Ar_h1_Particle_TotalAnalogCharge->At(confignumber))->Integral();
1053  if(integ!=0.0){((TH1F*)Ar_h1_Particle_TotalAnalogCharge->At(confignumber))->Scale(1/integ);}
1054  ((TH1F*)Ar_h1_Particle_TotalAnalogCharge->At(confignumber))->Fit("landau","","same");
1055 
1056  MainCanvas2->cd(4);
1057  ((TH1F*)Ar_h1_Particle_TotalDigitalCharge->At(confignumber))->Draw("HIST");
1058  ((TH1F*)Ar_h1_Particle_TotalDigitalCharge->At(confignumber))->Sumw2();
1059  integ = ((TH1F*)Ar_h1_Particle_TotalDigitalCharge->At(confignumber))->Integral();
1060  if(integ!=0.0){((TH1F*)Ar_h1_Particle_TotalDigitalCharge->At(confignumber))->Scale(1/integ);}
1061  ((TH1F*)Ar_h1_Particle_TotalDigitalCharge->At(confignumber))->Fit("landau","","same");
1062 
1063  MainCanvas2->cd(5);
1064  ((TH1F*)Ar_h1_Particle_Energy_deposited->At(confignumber))->Draw("HIST");
1065  ((TH1F*)Ar_h1_Particle_Energy_deposited->At(confignumber))->Sumw2();
1066  integ = ((TH1F*)Ar_h1_Particle_Energy_deposited->At(confignumber))->Integral();
1067  if(integ!=0.0){((TH1F*)Ar_h1_Particle_Energy_deposited->At(confignumber))->Scale(1/integ);}
1068  ((TH1F*)Ar_h1_Particle_Energy_deposited->At(confignumber))->Fit("landau","","same");
1069 
1070  MainCanvas2->cd(6);
1071  ((TH2F*)Ar_h2_Particle_EnergyDeposited_vs_TotalAnalogCharge->At(confignumber))->Draw("colz");
1072 
1073  MainCanvas2->cd(7);
1074  ((TH2F*)Ar_h2_Particle_TotalDigitalCharge_vs_TotalAnalogCharge->At(confignumber))->Draw("colz");
1075 
1076  //------------MainCanvas3
1077  MainCanvas3->cd(1);
1078  ((TH1F*)(Ar_h1_Cluster_9x9DigitalCharge->At(confignumber)))->SetLineColor(ColorChosen);
1079  ((TH1F*)Ar_h1_Cluster_9x9DigitalCharge->At(confignumber))->Draw();
1080  MainCanvas3->cd(2);
1081  ((TH1F*)Ar_h1_Cluster_1stCrownDigitalCharge->At(confignumber))->SetLineColor(ColorChosen);
1082  if(newcanvas==1){
1083  ((TH1F*)Ar_h1_Cluster_1stCrownDigitalCharge->At(confignumber))->Draw();
1084  }else{
1085  ((TH1F*)Ar_h1_Cluster_1stCrownDigitalCharge->At(confignumber))->Draw("same");
1086  }
1087 
1088  MainCanvas3->cd(3);
1089  ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->SetMarkerSize(1.0);
1090  ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->SetMarkerStyle(1);
1091  ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->SetMarkerColor(ColorChosen);
1092  ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->SetLineColor(ColorChosen);
1093  if(newcanvas==1){
1094  ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw();
1095  }else{
1096  ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw("same");
1097  }
1098 
1099  MainCanvas3->cd(4);
1100  ((TProfile*)Ar_Pr_Charge_Q_over_Qtot_vs_distance->At(confignumber))->SetMarkerColor(ColorChosen);
1101  ((TProfile*)Ar_Pr_Charge_Q_over_Qtot_vs_distance->At(confignumber))->SetLineColor(ColorChosen);
1102  if(newcanvas==1){
1103  ((TProfile*)Ar_Pr_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw();
1104  }else{
1105  ((TProfile*)Ar_Pr_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw("same");
1106  }
1107 
1108  /*
1109  if(newcanvas==1){
1110  ((TH1F*)Ar_h1_Cluster_4NeighboursDigitalCharge->At(confignumber))->Draw();
1111  }else{
1112  ((TH1F*)Ar_h1_Cluster_4NeighboursDigitalCharge->At(confignumber))->Draw("same");
1113  }*/
1114 
1115  MainCanvas3->cd(5);
1116  integ = ((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->Integral();
1117  if(integ!=0.0){((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->Scale(1/integ);}
1118  ((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->SetAxisRange(0,0.07,"Y");
1119  ((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->SetLineColor(ColorChosen);
1120  if(newcanvas==1){
1121  ((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->Draw();
1122  }else{
1123  ((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->Draw("same");
1124  }
1125 
1126  MainCanvas3->cd(6);
1127  integ = ((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->Integral();
1128  if(integ!=0.0){((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->Scale(1/integ);}
1129  ((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->SetAxisRange(0,0.09,"Y");
1130  ((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->SetLineColor(ColorChosen);
1131  if(newcanvas==1){
1132  ((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->Draw();
1133  }else{
1134  ((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->Draw("same");
1135  }
1136 
1137  MainCanvas3->cd(7);
1138  integ = ((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->Integral();
1139  if(integ!=0.0){((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->Scale(1/integ);}
1140  ((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->SetAxisRange(0,0.10,"Y");
1141  ((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->SetLineColor(ColorChosen);
1142  if(newcanvas==1){
1143  ((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->Draw();
1144  }else{
1145  ((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->Draw("same");
1146  }
1147 
1148  MainCanvas3->cd(8);
1149  integ = ((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->Integral();
1150  if(integ!=0.0){((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->Scale(1/integ);}
1151  ((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->SetAxisRange(0,0.12,"Y");
1152  ((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->SetLineColor(ColorChosen);
1153  if(newcanvas==1){
1154  ((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->Draw();
1155  }else{
1156  ((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->Draw("same");
1157  }
1158 
1159 
1160  //------------MainCanvas4
1161  MainCanvas4->cd(1);
1162  ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(confignumber))->Draw();
1163  ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(confignumber))->Fit("gaus","","same");
1164  MainCanvas4->cd(2);
1165  ((TH1F*)Ar_h1_Resolution_ResidualY_CoG_true->At(confignumber))->Draw();
1166  ((TH1F*)Ar_h1_Resolution_ResidualY_CoG_true->At(confignumber))->Fit("gaus","","same");
1167  MainCanvas4->cd(3);
1168  ((TH1F*)Ar_h1_Resolution_Residualdist_CoG_true->At(confignumber))->Draw();
1169  MainCanvas4->cd(4);
1170  ((TH2F*)Ar_h2_Resolution_TruePosition->At(confignumber))->Draw("colz");
1171  AutoZoom((TH2F*)Ar_h2_Resolution_TruePosition->At(confignumber))->Draw("colz");
1172  MainCanvas4->cd(5);
1173  ((TH2F*)Ar_h2_Resolution_TruePosition_modulo->At(confignumber))->Draw("colz");
1174  AutoZoom((TH2F*)Ar_h2_Resolution_TruePosition_modulo->At(confignumber))->Draw("colz");
1175  MainCanvas4->cd(6);
1176  ((TH2F*)Ar_h2_Resolution_CoG->At(confignumber))->Draw("colz");
1177  AutoZoom((TH2F*)Ar_h2_Resolution_CoG->At(confignumber))->Draw("colz");
1178  MainCanvas4->cd(7);
1179  ((TH2F*)Ar_h2_Resolution_CoG_modulo->At(confignumber))->Draw("colz");
1180  AutoZoom(((TH2F*)Ar_h2_Resolution_CoG_modulo->At(confignumber)))->Draw("colz");
1181  MainCanvas4->cd(8);
1182 
1183 
1184  //------------
1185  MainCanvas1->Update();
1186  MainCanvas2->Update();
1187  MainCanvas3->Update();
1188  MainCanvas4->Update();
1189 
1190 }
1191 //______________________________________________________________________________
1192 //
1193 // Double_t Lorentz2D(Double_t *x, Double_t *par);
1194 // Double_t DIGMAPS::Lorentz2D(Double_t *x, Double_t *par){
1195 //x[0] = x
1196  //x[1] = y
1197  // par[0] = Gamma
1198  // par[1] = x0
1199 //.Sizeof()
1200 // sizeof(configlist)
1201 
1202 
1203 void DIGMAPS::PlotDigitalConfiguration(Bool_t newcanvas, Int_t *configlist, Int_t Nconfigs)
1204 {
1205  //Int_t Nconfigs = sizeof(configlist)/sizeof(configlist[0]);
1206  //cout<<configlist[0]<<" "<< configlist[1]<<endl;
1207  //cout<<" NCONFIGS "<<Nconfigs<<" "<< sizeof(configlist) <<" "<<sizeof(configlist[0]) <<endl;
1208  Float_t integ ;
1209  if(newcanvas==1){
1210  MainCanvas1 = new TCanvas("MainCanvas1","MainCanvas1",450,10,1000,950);
1211  MainCanvas2 = new TCanvas("MainCanvas2","MainCanvas2",550,10,1000,950);
1212  MainCanvas3 = new TCanvas("MainCanvas3","MainCanvas3",650,10,1000,950);
1213  MainCanvas4 = new TCanvas("MainCanvas4","MainCanvas4",750,10,1000,950);
1214  MainCanvas5 = new TCanvas("MainCanvas5","MainCanvas5",750,10,1000,950);
1215  MainCanvas5->Divide(2,4);
1216  MainCanvas5->Update();
1217 
1218  if(Nconfigs<=4){
1219  MainCanvas1->Divide(2,2);
1220  MainCanvas2->Divide(2,2);
1221  MainCanvas3->Divide(2,2);
1222  MainCanvas4->Divide(2,2);
1223  }else if(Nconfigs<=6){
1224  MainCanvas1->Divide(2,3);
1225  MainCanvas2->Divide(2,3);
1226  MainCanvas3->Divide(2,3);
1227  MainCanvas4->Divide(2,3);
1228  }else if(Nconfigs<=9){
1229  MainCanvas1->Divide(3,3);
1230  MainCanvas2->Divide(3,3);
1231  MainCanvas3->Divide(3,3);
1232  MainCanvas4->Divide(3,3);
1233  }else if(Nconfigs<=12){
1234  MainCanvas1->Divide(3,4);
1235  MainCanvas2->Divide(3,4);
1236  MainCanvas3->Divide(3,4);
1237  MainCanvas4->Divide(3,4);
1238  }else if(Nconfigs<=16){
1239  MainCanvas1->Divide(4,4);
1240  MainCanvas2->Divide(4,4);
1241  MainCanvas3->Divide(4,4);
1242  MainCanvas4->Divide(4,4);
1243  }else if(Nconfigs<=25){
1244  MainCanvas1->Divide(5,5);
1245  MainCanvas2->Divide(5,5);
1246  MainCanvas3->Divide(5,5);
1247  MainCanvas4->Divide(5,5);
1248  }else{
1249  cout<<" WARNING : Config list too big, please reduce the number of configs you want to plot"<<endl;
1250  MainCanvas1->Divide(5,5);
1251  MainCanvas2->Divide(5,5);
1252  MainCanvas3->Divide(5,5);
1253  MainCanvas4->Divide(5,5);
1254  }
1255  MainCanvas1->Update();
1256  MainCanvas2->Update();
1257  MainCanvas3->Update();
1258  MainCanvas4->Update();
1259  ColorChosen =1;
1260  }else{
1261  ColorChosen++;
1262  if(ColorChosen==2){ColorChosen++;}
1263  if(ColorChosen==5){ColorChosen++;}
1264  // ColorChosen++;
1265  }
1266  Int_t maxNconfigs = 25;
1267  if(Nconfigs>maxNconfigs){Nconfigs=maxNconfigs;}
1268 
1269  //------------MainCanvas1
1270  Int_t currentpad = 1;
1271  for (Int_t i=0 ; i<Nconfigs ; i++){
1272  MainCanvas1->cd(currentpad);
1273  integ =((TH1F*)Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->Integral();
1274  if(integ!=0.0){((TH1F*)Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->Scale(1/integ);}
1275  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetAxisRange(0,0.6,"Y");
1276  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetLineColor(ColorChosen);
1277  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetFillStyle(0);
1278  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetFillColor(1);
1279  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetMarkerColor(ColorChosen);
1280  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetMarkerStyle(2);
1281  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetMarkerSize(1);
1282  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetLineStyle(1);
1283  ((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->SetLineWidth(1);
1284  if(newcanvas==1){
1285  (Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->Draw("lp");
1286  gPad->Update();
1287  MainCanvas1->Update();
1288  TPaveStats *st = (TPaveStats*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->FindObject("stats");
1289  st->SetName("stat2");
1290  //MainCanvas1->Modified();
1291  }else{
1292  (Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->Draw("lp sames");
1293  gPad->Update();
1294  MainCanvas1->Update();
1295  TPaveStats *st = (TPaveStats*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->FindObject("stats");
1296  st->SetName("stat2");
1297  //MainCanvas1->Modified();
1298  }
1299  // cout<<" MULTI "<<i<<" "<<((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->GetMean()
1300  // <<" "<<((TH1F*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i])))->GetMeanError()<<endl;
1301 
1302  currentpad++;
1303  }
1304  //------------MainCanvas2
1305  currentpad = 1;
1306  for (Int_t i=0 ; i<Nconfigs ; i++){
1307  MainCanvas2->cd(currentpad);
1308  if(newcanvas==1){
1309  (Ar_h1_ADC_LSB->At(configlist[i]))->Draw();
1310  gPad->Update();
1311  }else{
1312  (Ar_h1_ADC_LSB->At(configlist[i]))->Draw("same");
1313  gPad->Update();
1314  }
1315  currentpad++;
1316  }
1317 
1318  //------------MainCanvas3
1319  currentpad = 1;
1320  for (Int_t i=0 ; i<Nconfigs ; i++){
1321  MainCanvas3->cd(currentpad);
1322  if(newcanvas==1){
1323  ( Ar_h1_Efficiency_ideal->At(configlist[i]))->Draw();
1324  gPad->Update();
1325  MainCanvas3->Update();
1326  }else{
1327  ( Ar_h1_Efficiency_ideal->At(configlist[i]))->Draw("sames");
1328  gPad->Update();
1329  MainCanvas3->Update();
1330  }
1331  currentpad++;
1332  }
1333 
1334  //------------MainCanvas4
1335  currentpad = 1;
1336  for (Int_t i=0 ; i<Nconfigs ; i++){
1337  MainCanvas4->cd(currentpad);
1338  if(newcanvas==1){
1339  ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(configlist[i]))->Draw();
1340  ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(configlist[i]))->Fit("gaus","","same");
1341  gPad->Update();
1342  MainCanvas4->Update();
1343  }else{
1344  ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(configlist[i]))->Draw("same");
1345  ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(configlist[i]))->Fit("gaus","","same");
1346  gPad->Update();
1347  MainCanvas4->Update();
1348  }
1349  currentpad++;
1350  }
1351 
1352 
1353 
1354 
1355 
1356  MainCanvas1->Update();
1357  MainCanvas2->Update();
1358  MainCanvas3->Update();
1359  MainCanvas4->Update();
1360 
1361  //------------Compute efficiency, average multiplicity, resolution, fake rate...
1362 
1363  //TClonesArray *myDIGResultArray = mydigEvent->GetParticle();
1364  //DIGResult* theresult = 0;
1365  // theresult = (DIGResult*)GetResult(configlist[i])->At(configlist[i]);
1366  //TheParticle=(DIGParticle*) myDIGParticleArray->At(j) ;
1367 
1368  for (Int_t i=0 ; i<Nconfigs ; i++){
1369  cout<<" i config[i] config eff"<<i<<" "<<configlist[i]<<" "<<GetResult(configlist[i])->GetConfigNumber()<<" "<<GetResult(configlist[i])->GetIdealEfficiency()<<endl;
1370  }
1371 
1372 }
1373 //______________________________________________________________________________
1374 //
1375 void DIGMAPS::PrintConfigurations()
1376 {
1377  // fNumberOfConfigurations
1378  Int_t iconfigcounter = 0;
1379  Int_t TotalNumberOfBeams = fBeamN;
1380  Int_t TotalNumberOfPlanes = fPlanesN;
1381  Int_t TotalNumberOfADCs =fADCN;
1382  Int_t TotalNumberOfTransports =fTransportN;
1383  std::cout<<"************************************************************** "<<endl;
1384  std::cout<<" List of all configurations "<<endl;
1385  std::cout<<"num |Thet|Phi |Pit x X y|epi |Nois|Temp|Nbits|lin|LSB |gain |Model|"<<endl;
1386  for (Int_t ibeam = 0; ibeam < TotalNumberOfBeams ; ibeam++){
1387  for (Int_t iplane = 0; iplane < TotalNumberOfPlanes ; iplane++){
1388  for (Int_t iadc = 0; iadc < TotalNumberOfADCs ; iadc++){
1389  for (Int_t itransport = 0; itransport < TotalNumberOfTransports ; itransport++){
1390 
1391  Char_t charac[800];
1392  sprintf(charac,"%4d|%4.1f|%4.1f|%4.1fX%4.1f|%4.1f|%4.1f|%4.1f|%2d |%d |%5.2f|%7.2f|%d |\n",
1393  iconfigcounter,
1394  GetBeam(ibeam)->GetThetaIncidentDeg(),
1395  GetBeam(ibeam)->GetPhiIncidentDeg(),
1396  GetPlane(iplane)->GetPitchX(),
1397  GetPlane(iplane)->GetPitchY(),
1398  GetPlane(iplane)->GetZdimension(),
1399  GetPlane(iplane)->GetNoiseElectrons(),
1400  GetPlane(iplane)->GetTemperature(),
1401  GetADC(iadc)->GetNbits(),
1402  GetADC(iadc)->GetADC_linear(),
1403  GetADC(iadc)->GetLSB(),
1404  GetADC(iadc)->GetElectron_Conversion(),
1405  GetTransport(itransport)->GetChargeModel())
1406  ;
1407  std::cout<<charac;
1408  iconfigcounter++;
1409  }
1410  }
1411  }
1412  }
1413  std::cout<<"num |Thet|Phi |Pit x X y|epi |Nois|Temp|Nbits|lin|LSB |gain |Model|"<<endl;
1414  std::cout<<"************************************************************** "<<endl;
1415 
1416 
1417 }
1418 //______________________________________________________________________________
1419 //
1420 void DIGMAPS::InspectEvent(Int_t EventNumber)
1421 {
1422  DIGAction *myAction = GetAction();
1423  Char_t *myDoit = myAction->GetDoit();
1424  Int_t myIntAction = 0;
1425  Char_t action2[200] = "plot";
1426  if(!strncmp( action2, myDoit,strlen(action2)) ){
1427  cout<<" WE CAN PLOT THAT !"<<endl;
1428  myIntAction=2;
1429  }else{
1430  cout<<" No action plot done before !"<<endl;
1431  return;
1432  }
1433 
1434  cout<<" Event number "<<EventNumber <<"is observed"<<endl;
1435 
1436 
1437  delete myAction;
1438  delete myDoit;
1439 
1440 }
1441 //______________________________________________________________________________
1442 //
1443 void DIGMAPS::RunConfiguration(Int_t configcounter, Int_t BeamNumber, Int_t PlaneNumber, Int_t ADCNumber, Int_t TransportNumber)
1444 {
1445  //compute visible surface.
1446  //compute active length, xlength, Y length, output position.
1447 
1448  //----compute density parameters
1449  //total surface in um^2
1450  Float_t totalsurface = (GetPlane(PlaneNumber)-> GetXdimension()) * (GetPlane(PlaneNumber)-> GetYdimension());
1451  // Compute Lambda value of the Poisson law for a given surface:
1452  Float_t Lambda_poisson = totalsurface * 0.000001 * (GetBeam(BeamNumber)->GetParticleDensity());
1453  Double_t xran,yran,zran;
1454 
1455 
1456  GlobalSeed++;
1457  TRandom3 *r3 = new TRandom3(GlobalSeed);
1458 
1459  Int_t NumberOfEvents = GetBeam(BeamNumber)->GetNumberOfEvents();
1460 
1461  //-------------------------------------------------------------------------------------
1462  //--------------Loop on events.
1463  //-------------------------------------------------------------------------------------
1464  DIGParticle *fdigparticle=0;
1465  //DIGReadoutmap *fdigreadoutmap=0;
1466  for (Int_t iEvent = 0; iEvent < NumberOfEvents ; iEvent++){
1467  fdigevent = new DIGEvent();
1468  //---generate incident particles.
1469  Int_t numberofparticles = 0;
1470  if(GetBeam(BeamNumber)->GetBeamOption()==1){
1471  numberofparticles = PoissonLaw( Lambda_poisson);
1472  }else{
1473  numberofparticles=1;
1474  }
1475 
1476  std::cout<<"-----event "<<iEvent<<" with "<<numberofparticles<<" particles produced"<<endl;
1477  //---------------------------------------------
1478  //--------------Loop on particles
1479  //---------------------------------------------
1480  for (Int_t ipart = 0; ipart < numberofparticles ; ipart++){
1481 
1482  //---------Energy deposition generation
1483  //-------------------
1484  //-----------Model 1:
1485  /*
1486  //Energy in e-:(800 e- on ten microns)
1487  Float_t Energy = LandauLaw(800.0,180.0);
1488  while(Energy>20000){
1489  cout<<"Energy too high -> Energy regenerated"<<Energy<<endl;
1490  Energy = LandauLaw(800.0,180.0);
1491  }
1492  //scale Energy with epitaxial thickness
1493  //Energy = Energy * GetPlane(PlaneNumber)->GetZdimension() / 10.0;
1494  //scale with incident angle
1495  Float_t mtotallentgh = (GetPlane(PlaneNumber)->GetZdimension())
1496  / TMath::Cos((GetBeam(BeamNumber)->GetThetaIncidentDeg())*PI/180.0);
1497  //rescale energy (e-) with effective pitch:
1498  Energy = Energy * mtotallentgh / 10.0;
1499  */
1500  //-------------------
1501  //-----------Model 2:
1502  //scale with incident angle
1503  Float_t mtotallentgh = (GetPlane(PlaneNumber)->GetZdimension())
1504  / TMath::Cos((GetBeam(BeamNumber)->GetThetaIncidentDeg())*PI/180.0);
1505  Float_t EnergyMPV = 800.0 * mtotallentgh / 10.0;
1506  Float_t EnergySIGMA = 180.0 * mtotallentgh / 10.0;
1507  Float_t Energy = LandauLaw(EnergyMPV,EnergySIGMA);
1508  while(Energy>20000){
1509  cout<<"Energy too high -> Energy regenerated"<<Energy<<endl;
1510  Energy = LandauLaw(EnergyMPV,EnergySIGMA);
1511  }
1512  //-------------------------
1513  //---------compute random entry point:
1514  if(GetBeam(BeamNumber)->GetBeamOption()==1){
1515  xran = r3->Rndm()*(GetPlane(PlaneNumber)-> GetXdimension());
1516  yran = r3->Rndm()*(GetPlane(PlaneNumber)-> GetYdimension());
1517  }else{
1518  xran = (float(GetPlane(PlaneNumber)->GetNpixelsX()/2) + r3->Rndm() )* (GetPlane(PlaneNumber)->GetPitchX());
1519  yran = (float(GetPlane(PlaneNumber)->GetNpixelsY()/2) + r3->Rndm() )* (GetPlane(PlaneNumber)->GetPitchY());
1520  }
1521  zran=0.0;
1522  Float_t thetapos = GetBeam(BeamNumber)->GetThetaIncidentDeg();
1523  Float_t phipos = GetBeam(BeamNumber)->GetPhiIncidentDeg();//r3->Rndm()*360.0;
1524  Float_t thetaposrad = thetapos*PI/180.0;
1525  Float_t phiposrad = phipos*PI/180.0;
1526  //compute exit position given the incident angle:
1527  Float_t totalXlength=(GetPlane(PlaneNumber)->GetZdimension()) *TMath::Tan(thetaposrad)*TMath::Cos(phiposrad);
1528  Float_t totalYlength=(GetPlane(PlaneNumber)->GetZdimension()) *TMath::Tan(thetaposrad)*TMath::Sin(phiposrad);
1529  Float_t outputXpos=xran+totalXlength;
1530  Float_t outputYpos=yran+totalYlength;
1531  Float_t outputZpos=(GetPlane(PlaneNumber)->GetZdimension());
1532 
1533  fdigparticle = new DIGParticle(xran,yran,zran,outputXpos,outputYpos,outputZpos,Energy);
1534  //---------charge generation
1535  fdigparticle->ComputeChargeDeposition(GetPlane(PlaneNumber)->GetSegmentSize(),
1536  GetPlane(PlaneNumber)->GetMaximumSegmentSize(),
1537  GetPlane(PlaneNumber)->GetMaximumChargePerSegment());
1538  //---------charge transport
1539  fdigparticle->ComputeChargeTransport(GetPlane(PlaneNumber),GetTransport(TransportNumber));
1540  //---------random noise (should be removed if one wants to avoid double noise on double hit pixels)
1541  fdigparticle->AddRandomNoise(GetPlane(PlaneNumber));
1542  //---------ADC (stored only for reference)
1543  fdigparticle->AnalogToDigitalconversion(GetADC(ADCNumber), GetPlane(PlaneNumber) );
1544  //fdigparticle->PrintInfo();
1545  //---------Add particle to fDIGParticleArray:
1546  //cout<<" TESTT 0 1 "<<ipart<<endl;
1547  fdigevent->AddParticle(*fdigparticle);
1548  std::vector<Float_t> chargevector;
1549  std::vector<Int_t> pixmapvector;
1550  chargevector = fdigparticle->GetAnalogCharge();
1551  pixmapvector = fdigparticle->GetPixelMap();
1552  for (Int_t ipix=0 ; ipix<fdigparticle->GetNpixels() ; ipix++){
1553  (fdigevent->GetReadoutmap())->UpdatePixel(chargevector[ipix], pixmapvector[ipix]);
1554  }
1555  //fdigparticle->Clear();
1556  delete fdigparticle;
1557  }
1558  //---------------------------------------------
1559  //----------end loop on particles
1560  //---------------------------------------------
1561  // fdigevent->PrintInfo();
1562 
1563  //---------Build readout map:
1564  (fdigevent->GetReadoutmap())->AnalogToDigitalconversion(GetADC(ADCNumber), GetPlane(PlaneNumber));
1565  //---------Build clusters:
1566  fdigevent->BuildTrueClusters(GetPlane(PlaneNumber));
1567  fdigevent->SetConfigurationNumber(configcounter);
1568  //---------Print Info on event if needed
1569  //fdigevent->PrintInfo();
1570  //---------P
1571  TClonesArray *particules = fdigevent->GetParticle();
1572  if( fdigevent->GetNParticles() != (particules->GetLast()+1)){
1573  cout<< "DIGMAPS 4::PrintInfo WARNING PROBLEM IN PARTICLES RECORDING"<<endl;
1574  }
1575  //--------- store event.
1576  fdigbeam = (DIGBeam*)GetBeam(BeamNumber)->Clone();
1577  fdigplane = (DIGPlane*)GetPlane(PlaneNumber)->Clone();
1578  fdigadc = (DIGADC*)GetADC(ADCNumber)->Clone();
1579  fdigtransport = (DIGTransport*)GetTransport(TransportNumber)->Clone();
1580  ftree->Fill();
1581 
1582  } //end loop on events
1583 
1584 
1585 
1586  delete r3;
1587 }
1588 //______________________________________________________________________________
1589 //
1590 void DIGMAPS::ChargeGeneration(DIGParticle& aDIGParticle, Float_t StartingSegmentSize, Float_t MaximumSegmentSize,
1591  Float_t MaximumChargePerSegment)
1592 {
1593  aDIGParticle.ComputeChargeDeposition(StartingSegmentSize, MaximumSegmentSize,MaximumChargePerSegment) ;
1594 }
1595 //______________________________________________________________________________
1596 //
1597 Int_t DIGMAPS::PoissonLaw(Float_t Lambda)
1598 {
1599  Int_t n;
1600  GlobalSeed++;
1601  TRandom3 *r3 = new TRandom3(GlobalSeed);
1602  //Float_t smear = r3->Rndm(245);
1603  n = r3->Poisson(Lambda);
1604 
1605  // TMath::PoissonI(x,Lambda)
1606  delete r3;
1607  return n;
1608 
1609 }
1610 //______________________________________________________________________________
1611 //
1612 Double_t DIGMAPS::LandauLaw(Double_t mean, Double_t sigma)
1613 {
1614  Double_t x;
1615  GlobalSeed++;
1616  TRandom3 *r3 = new TRandom3(GlobalSeed);
1617  //Float_t smear = r3->Rndm(245);
1618  x = r3->Landau(mean,sigma);
1619  // TMath::PoissonI(x,Lambda)
1620  delete r3;
1621  return x;
1622 }
1623 //______________________________________________________________________________
1624 //
1625 Double_t DIGMAPS::GaussianLaw(Double_t mean, Double_t sigma)
1626 {
1627  Double_t x;
1628  GlobalSeed++;
1629  TRandom3 *r3 = new TRandom3(GlobalSeed);
1630  //Float_t smear = r3->Rndm(245);
1631  x = r3->Gaus(mean,sigma);
1632  // TMath::PoissonI(x,Lambda)
1633  delete r3;
1634  return x;
1635 }
1636 //_______________________________________________________________________________________
1637 //
1638  Double_t DIGMAPS::Lorentz2D(Double_t *x, Double_t *par){
1639  //x[0] = x
1640  //x[1] = y
1641  // par[0] = Gamma
1642  // par[1] = x0
1643  // par[2] = y0
1644  // par[3] = norm
1645  if(par[0]>0){
1646  Double_t Pi = 3.141592653;
1647  return par[3]*par[0]/Pi/((x[0]-par[1])*(x[0]-par[1])+(x[1]-par[2])*(x[1]-par[2])+par[0]*par[0]) ;
1648  }else{
1649  return 0;
1650  }
1651 }
1652 //______________________________________________________________________________
1653 //
1654 void DIGMAPS::SetfAction(TString action)
1655 {
1656  fAction = action;
1657 }
1658 
1659 //______________________________________________________________________________
1660 //
1661 void DIGMAPS::SetIsOutputfile(Bool_t IsOutputfile)
1662 {
1663  fIsOutputfile = IsOutputfile;
1664 }
1665 //______________________________________________________________________________
1666 //
1667 void DIGMAPS::SetAction(DIGAction *aDIGAction)
1668 {
1669  fDIGAction = aDIGAction;
1670 }
1671 //______________________________________________________________________________
1672 //
1673 void DIGMAPS::SetNumberOfConfigurations(Int_t NumberOfConfiguration)
1674 {
1675  fNumberOfConfigurations = NumberOfConfiguration;
1676 }
1677 //______________________________________________________________________________
1678 //
1679 void DIGMAPS::SetConfigPath(TString aCP)
1680 {
1681  fConfigPath = aCP;
1682 }
1683 
1684 
1685 //______________________________________________________________________________
1686 //
1687 void DIGMAPS::SetConfigFileName(TString aCFN)
1688 {
1689  fConfigFileName = aCFN;
1690 }
1691 
1692 //______________________________________________________________________________
1693 //
1694 void DIGMAPS::SetConfigPathAndFileName()
1695 {
1696  fConfigPathAndFileName = fConfigPath + fConfigFileName;
1697 }
1698 
1699 //______________________________________________________________________________
1700 //
1701 void DIGMAPS::SetConfigPathAndFileName(TString aCP,TString aCFN)
1702 {
1703  fConfigPath = aCP;
1704  fConfigFileName = aCFN;
1705  fConfigPathAndFileName = fConfigPath + fConfigFileName;
1706 }
1707 //______________________________________________________________________________
1708 //
1709 TString DIGMAPS::GetConfigPath()
1710 {
1711  return fConfigPath;
1712 }
1713 //______________________________________________________________________________
1714 //
1715 TString DIGMAPS::GetConfigFileName()
1716 {
1717  return fConfigFileName;
1718 }
1719 //______________________________________________________________________________
1720 //
1721 TString DIGMAPS::GetConfigPathAndFileName()
1722 {
1723  return fConfigPathAndFileName;
1724 }
1725 
1726 
1727 
1728 
1729 
1730 
1731 
1732 //______________________________________________________________________________
1733 //
1734 void DIGMAPS::SetOutputPath(TString outp)
1735 {
1736  fOutputPath = outp;
1737 
1738 }
1739 
1740 
1741 //______________________________________________________________________________
1742 //
1743 void DIGMAPS::SetOutputFileName(TString outf)
1744 {
1745  fOutputFileName = outf;
1746 }
1747 
1748 //______________________________________________________________________________
1749 //
1750 void DIGMAPS::SetOutputPathAndFileName()
1751 {
1752  fOutputPathAndFileName = fOutputPath + fOutputFileName;
1753 }
1754 
1755 //______________________________________________________________________________
1756 //
1757 void DIGMAPS::SetOutputPathAndFileName(TString outp,TString outf)
1758 {
1759  fOutputPath = outp;
1760  fOutputFileName = outf;
1761  fOutputPathAndFileName = fOutputPath + fOutputFileName;
1762 }
1763 
1764 
1765 
1766 
1767 //______________________________________________________________________________
1768 //
1769 DIGPlane* DIGMAPS::GetPlane(Int_t aPlaneNumber){
1770  return (DIGPlane*)fDIGPlaneArray->At(aPlaneNumber);
1771 }
1772 //______________________________________________________________________________
1773 //
1774 DIGADC* DIGMAPS::GetADC(Int_t anADCNumber){
1775  return (DIGADC*)fDIGADCArray->At(anADCNumber);
1776 }
1777 //______________________________________________________________________________
1778 //
1779 DIGTransport* DIGMAPS::GetTransport(Int_t aTransportNumber){
1780  return (DIGTransport*)fDIGTransportArray->At(aTransportNumber);
1781 }
1782 //______________________________________________________________________________
1783 //
1784 DIGBeam* DIGMAPS::GetBeam(Int_t aBeamNumber){
1785  return (DIGBeam*)fDIGBeamArray->At(aBeamNumber);
1786 }
1787 //______________________________________________________________________________
1788 //
1789 void DIGMAPS::ReadTree(TString StringTree){
1790 
1791  cout<<StringTree<<endl;
1792 
1793 }
1794 
Definition: digadc.h:36
ADCParameter_t & GetADCPar(Int_t aPN)
don&#39;&#39;t put in streamer