16 #include <TStopwatch.h>
27 #include <TClonesArray.h>
28 #include <TPaveStats.h>
31 #include "digresult.h"
32 #include "digaction.h"
35 #include "digtransport.h"
37 #include "diginitialize.h"
38 #include "digparticle.h"
39 #include "digcluster.h"
41 #include "dighistograms.h"
44 extern Int_t GlobalSeed = 1;
49 : TNamed("
DIGMAPS","DIGMAPS title")
58 DIGMAPS::DIGMAPS(
char *name,
char *title, TString aCP, TString aCFN, TString outp, TString outf, TString action ) : TNamed(name,title)
63 gRandom->SetSeed(seconds);
67 SetConfigPathAndFileName(aCP,aCFN);
69 SetOutputPathAndFileName(outp,outf) ;
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;
99 cout<<
" REAL TIME = "<<timer1.RealTime()<<
" ; CPU TIME = "<<timer1.CpuTime()<<endl;
105 DIGMAPS::DIGMAPS(
char *name,
char *title, TString aCP, TString aCFN , TString action ) : TNamed(name,title)
110 seconds = time(NULL);
111 gRandom->SetSeed(seconds);
115 SetConfigPathAndFileName(aCP,aCFN);
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;
134 fDIGTransportArray=0;
147 cout<<
" REAL TIME = "<<timer1.RealTime()<<
" ; CPU TIME = "<<timer1.CpuTime()<<endl;
151 DIGMAPS::~DIGMAPS() {
161 fDIGInitialize =
new DIGInitialize(
"read",
"test",fConfigPath,fConfigFileName,fAction);
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);
169 OldBuf = std::cout.rdbuf(fOutputFileStream.rdbuf());
170 fDIGInitialize->PrintInfo();
172 std::cout<<
"NO output file "<<endl;;
180 myDoit = strdup((fDIGInitialize->GetActionPar()).Doit);
181 myModel = strdup((fDIGInitialize->GetActionPar()).Model);
184 aDIGAction =
new DIGAction(myDoit,myModel);
185 SetAction(aDIGAction);
187 std::cout<<
" DIGMAPS:Run: Action ="<<myDoit<<
" ; Model = "<<myModel<<endl;
190 Char_t action[200] =
"foresee";
192 if(!strncmp( action, myDoit,strlen(action)) ){
193 cout<<
" WE CAN DO THAT !"<<endl;
196 Char_t action2[200] =
"plot";
197 if(!strncmp( action2, myDoit,strlen(action2)) ){
198 cout<<
" WE CAN PLOT THAT !"<<endl;
203 Int_t TotalNumberOfBeams = 0;
204 TotalNumberOfBeams = (fDIGInitialize->GetBeamPar().NAngles);
205 std::cout<<
" DIGMAPS:Run TotalNumberOfBeams = "<<TotalNumberOfBeams<<endl;
209 Int_t TotalNumberOfPlanes = 0;
210 TotalNumberOfPlanes = (fDIGInitialize->GetPlanePar().NGeom)
211 * (fDIGInitialize->GetPlanePar().NTemperature);
212 std::cout<<
" DIGMAPS:Run TotalNumberOfPlanes = "<<TotalNumberOfPlanes<<endl;
216 Int_t TotalNumberOfADCs = 0;
217 TotalNumberOfADCs = (fDIGInitialize->GetPlanePar().NADC);
219 std::cout<<
" DIGMAPS:Run TotalNumberOfADCs = "<<TotalNumberOfADCs<<endl;
222 Int_t TotalNumberOfTransports = 0;
223 TotalNumberOfTransports = (fDIGInitialize->GetPlanePar().NTransport);
225 std::cout<<
" DIGMAPS:Run TotalNumberOfTransports = "<<TotalNumberOfTransports<<endl;
231 fBeamN = TotalNumberOfBeams;
232 fDIGBeamArray =
new TObjArray(fBeamN);
237 fPlanesN = TotalNumberOfPlanes;
238 fDIGPlaneArray =
new TObjArray(fPlanesN);
243 fADCN = TotalNumberOfADCs;
244 fDIGADCArray =
new TObjArray(fADCN);
250 fTransportN = TotalNumberOfTransports;
251 fDIGTransportArray =
new TObjArray(fTransportN);
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);
275 for (Int_t iADC = 0; iADC < (fDIGInitialize->GetPlanePar().NADC) ; iADC++){
279 aDIGADC->SetNbits(fDIGInitialize->
GetADCPar(iADC).Nbits);
281 aDIGADC->SetNThresholds(fDIGInitialize->
GetADCPar(iADC).NThresholds);
283 aDIGADC->SetADC_linear(fDIGInitialize->
GetADCPar(iADC).ADC_linear);
285 aDIGADC->SetLSB(fDIGInitialize->
GetADCPar(iADC).LSB);
287 aDIGADC->SetElectron_Conversion(fDIGInitialize->
GetADCPar(iADC).Electron_Conversion);
292 aDIGADC->SetADC_thresholds( (fDIGInitialize->
GetADCPar(iADC).ADC_thresholds),fDIGInitialize->
GetADCPar(iADC).NThresholds);
295 fDIGADCArray->Add(aDIGADC);
306 for (Int_t itrans = 0; itrans < (fDIGInitialize->GetPlanePar().NTransport) ; itrans++){
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);
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);
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);
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);
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);
371 fDIGTransportArray->Add(aDIGTransport);
374 for (Int_t igeom = 0; igeom < (fDIGInitialize->GetPlanePar().NGeom) ; igeom++){
375 for (Int_t itemp = 0; itemp < (fDIGInitialize->GetPlanePar().NTemperature) ; itemp++){
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));
394 fDIGPlaneArray->Add(aDIGPlane);
400 Int_t mynumberofconfigurations = TotalNumberOfBeams* TotalNumberOfPlanes *TotalNumberOfADCs*TotalNumberOfTransports;
401 SetNumberOfConfigurations(mynumberofconfigurations);
405 fDIGResultArray =
new TObjArray(mynumberofconfigurations);
407 for (Int_t ires = 0; ires < mynumberofconfigurations ; ires++){
409 aDIGResult->SetIdealEfficiency(0.0);
410 fDIGResultArray->Add(aDIGResult);
425 ffile =
new TFile(
"tree.root",
"RECREATE");
426 ftree =
new TTree(
"mytree",
"DIGMAPS tree");
429 ftree->Branch(
"beam_branch",
"DIGBeam",&fdigbeam,32000,1);
432 ftree->Branch(
"plane_branch",
"DIGPlane",&fdigplane,32000,1);
435 ftree->Branch(
"adc_branch",
"DIGADC",&fdigadc,32000,1);
438 ftree->Branch(
"transport_branch",
"DIGTransport",&fdigtransport,32000,1);
441 ftree->Branch(
"event_branch",
"DIGEvent",&fdigevent,32000,99);
445 Int_t iconfigcounter =0;
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);
474 delete fdigtransport;
480 cout<<
"Time to read the tree ! "<<endl;
485 PrintConfigurations();
487 std::cout.rdbuf(OldBuf);
488 fOutputFileStream.close();
490 PrintConfigurations();
493 cout<<
" ... END"<<endl;
502 void DIGMAPS::ActionPlot()
510 DIGHistograms::BookHistograms(GetNumberOfConfigurations());
517 cout<<
"Time to read the tree ! "<<endl;
518 ffile =
new TFile(
"tree.root",
"READ");
520 ftree=(TTree*) ffile->Get(
"mytree");
523 TBranch *branchdigBeam = ftree->GetBranch(
"beam_branch");
524 branchdigBeam->SetAddress(&mydigBeam);
527 TBranch *branchdigPlane= ftree->GetBranch(
"plane_branch");
528 branchdigPlane->SetAddress(&mydigPlane);
531 TBranch *branchdigADC= ftree->GetBranch(
"adc_branch");
532 branchdigADC->SetAddress(&mydigADC);
535 TBranch *branchdigTransport= ftree->GetBranch(
"transport_branch");
536 branchdigTransport->SetAddress(&mydigTransport);
541 TBranch *branchdigEvent= ftree->GetBranch(
"event_branch");
542 branchdigEvent->SetAddress(&mydigEvent);
544 Int_t NEVENT = (Int_t) ftree->GetEntries() ;
547 Int_t MaxEvent = NEVENT;
550 Int_t Old_configuration = -1;
551 Int_t Current_configuration = 0;
553 Float_t IdealEfficiency=-1;
554 Int_t TotalNumberOfParticles = 0;
555 Int_t TotalNumberOfClusters = 0;
562 for ( Int_t ievt=MinEvent ; ievt<MaxEvent ; ievt++ ) {
563 ftree->GetEvent(ievt);
564 cout<<
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Event ievt "<<ievt<<endl;
573 Current_configuration = mydigEvent->GetConfigurationNumber();
576 if(Current_configuration!=Old_configuration){
578 TotalNumberOfParticles = 0;
579 TotalNumberOfClusters = 0;
580 Old_configuration=Current_configuration;
606 for ( Int_t i=0 ; i<mydigADC->GetNThresholds() ; i++ ) {
609 ((TH1F*) Ar_h1_ADC_LSB->At(Current_configuration))->Fill( mydigADC->GetLSB() );
614 mydigEvent->PrintInfo();
619 TClonesArray *myDIGParticleArray = mydigEvent->GetParticle();
621 Int_t NbOfParticles = myDIGParticleArray->GetLast()+1 ;
622 TotalNumberOfParticles+=NbOfParticles;
624 vector< Bool_t > ClusterAssociated;
625 ClusterAssociated.resize(mydigEvent->GetNClusters());
626 for (Int_t i = 0; i < mydigEvent->GetNClusters() ; i++){
627 ClusterAssociated[i]=
false;
631 while(j<NbOfParticles) {
632 TheParticle=(
DIGParticle*) myDIGParticleArray->At(j) ;
634 cout<<
" DIGITAL CHARGE "<<TheParticle->GetTotalDigitalCharge()<<endl;
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() );
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());
649 TClonesArray *myDIGClusterArray = mydigEvent->GetCluster();
651 Int_t NbOfCluster = myDIGClusterArray->GetLast()+1 ;
652 TotalNumberOfClusters+=NbOfCluster;
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;
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;
680 cout<<
" DIGITAL CHARGE 2 "<<TheParticle->GetTotalDigitalCharge()<<endl;
684 if(TheParticle->GetTotalDigitalCharge()>0){
685 TheCluster = (
DIGCluster*) myDIGClusterArray->At(theclusterNumber);
686 Float_t ClusterTotalCharge = TheCluster->GetTotalCharge();
692 cout<<
" DIGITAL CHARGE 2.1 "<<TheParticle->GetTotalDigitalCharge()<<endl;
694 for (Int_t ip = 0; ip < TheCluster->GetNpixels() ; 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);
718 Float_t distancemax = 5.0*TMath::Sqrt(mydigPlane->GetPitchX()*mydigPlane->GetPitchX()+mydigPlane->GetPitchY()*mydigPlane->GetPitchY());
719 cout<<
" DIGITAL CHARGE 3 "<<TheParticle->GetTotalDigitalCharge()<<endl;
721 if(TheParticle->GetTotalDigitalCharge()>0.){
722 if(trackHitdistance < distancemax ){
723 ClusterAssociated[theclusterNumber]=
true;
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())));
737 cout<<
" DIGITAL CHARGE 4 "<<TheParticle->GetTotalDigitalCharge()<<endl;
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;
751 TClonesArray *myDIGClusterArray = mydigEvent->GetCluster();
753 Int_t NbOfCluster = myDIGClusterArray->GetLast()+1 ;
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;
763 while(k<NbOfCluster) {
764 TheCluster=(
DIGCluster*) myDIGClusterArray->At(k) ;
765 TheCluster->PrintInfo();
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));
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));
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));
794 ((TH1F*) Ar_h1_test->At(Current_configuration))
795 ->Fill( (TheCluster->Get1stCrownCharge(mydigPlane) +TheCluster->Get2ndCrownCharge(mydigPlane)
796 +TheCluster->GetDigitalCharge()[TheCluster->GetSeedPixelIndex()]));
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()) );
817 DIGReadoutmap *myDIGReadoutmap = mydigEvent->GetReadoutmap();
819 Int_t Nx = mydigPlane->GetNpixelsX();
820 Int_t Ny = mydigPlane->GetNpixelsY();
821 myDIGReadoutmap->PrintOuput(Nx,Ny);
827 if(TotalNumberOfParticles!=0){
828 IdealEfficiency = float(TotalNumberOfClusters)/float(TotalNumberOfParticles);
829 GetResult(Current_configuration)->SetConfigNumber(Current_configuration);
830 GetResult(Current_configuration)->SetIdealEfficiency(IdealEfficiency);
844 for ( Int_t ic=0 ; ic<GetNumberOfConfigurations() ; ic++ ) {
846 ((TH1F*) Ar_h1_Efficiency_ideal->At(ic))->Fill(GetResult(ic)->GetIdealEfficiency());
853 void DIGMAPS::PlotAConfiguration(Int_t confignumber, Bool_t newcanvas)
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();
874 if(ColorChosen==2){ColorChosen++;}
879 Float_t AxisRange = 0.4;
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);
887 (Ar_h1_multiplicity_with_threshold_01->At(confignumber))->Draw();
889 (Ar_h1_multiplicity_with_threshold_01->At(confignumber))->Draw(
"same");
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);
897 (Ar_h1_multiplicity_with_threshold_02->At(confignumber))->Draw();
899 (Ar_h1_multiplicity_with_threshold_02->At(confignumber))->Draw(
"same");
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);
907 (Ar_h1_multiplicity_with_threshold_03->At(confignumber))->Draw();
909 (Ar_h1_multiplicity_with_threshold_03->At(confignumber))->Draw(
"same");
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);
917 (Ar_h1_multiplicity_with_threshold_04->At(confignumber))->Draw();
919 (Ar_h1_multiplicity_with_threshold_04->At(confignumber))->Draw(
"same");
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);
927 (Ar_h1_multiplicity_with_threshold_05->At(confignumber))->Draw();
929 (Ar_h1_multiplicity_with_threshold_05->At(confignumber))->Draw(
"same");
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);
937 (Ar_h1_multiplicity_with_threshold_06->At(confignumber))->Draw();
939 (Ar_h1_multiplicity_with_threshold_06->At(confignumber))->Draw(
"same");
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);
947 (Ar_h1_multiplicity_with_threshold_07->At(confignumber))->Draw();
949 (Ar_h1_multiplicity_with_threshold_07->At(confignumber))->Draw(
"same");
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);
957 (Ar_h1_multiplicity_with_threshold_08->At(confignumber))->Draw();
959 (Ar_h1_multiplicity_with_threshold_08->At(confignumber))->Draw(
"same");
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);
967 (Ar_h1_multiplicity_with_threshold_09->At(confignumber))->Draw();
969 (Ar_h1_multiplicity_with_threshold_09->At(confignumber))->Draw(
"same");
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);
977 (Ar_h1_multiplicity_with_threshold_10->At(confignumber))->Draw();
979 (Ar_h1_multiplicity_with_threshold_10->At(confignumber))->Draw(
"same");
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);
988 (Ar_h1_multiplicity_with_threshold_15->At(confignumber))->Draw();
990 (Ar_h1_multiplicity_with_threshold_15->At(confignumber))->Draw(
"same");
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);
998 (Ar_h1_multiplicity_with_threshold_20->At(confignumber))->Draw();
1000 (Ar_h1_multiplicity_with_threshold_20->At(confignumber))->Draw(
"same");
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);
1008 (Ar_h1_multiplicity_with_threshold_25->At(confignumber))->Draw();
1010 (Ar_h1_multiplicity_with_threshold_25->At(confignumber))->Draw(
"same");
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);
1018 (Ar_h1_multiplicity_with_threshold_30->At(confignumber))->Draw();
1020 (Ar_h1_multiplicity_with_threshold_30->At(confignumber))->Draw(
"same");
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);
1028 (Ar_h1_multiplicity_with_threshold_40->At(confignumber))->Draw();
1030 (Ar_h1_multiplicity_with_threshold_40->At(confignumber))->Draw(
"same");
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");
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");
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");
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");
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");
1071 ((TH2F*)Ar_h2_Particle_EnergyDeposited_vs_TotalAnalogCharge->At(confignumber))->Draw(
"colz");
1074 ((TH2F*)Ar_h2_Particle_TotalDigitalCharge_vs_TotalAnalogCharge->At(confignumber))->Draw(
"colz");
1078 ((TH1F*)(Ar_h1_Cluster_9x9DigitalCharge->At(confignumber)))->SetLineColor(ColorChosen);
1079 ((TH1F*)Ar_h1_Cluster_9x9DigitalCharge->At(confignumber))->Draw();
1081 ((TH1F*)Ar_h1_Cluster_1stCrownDigitalCharge->At(confignumber))->SetLineColor(ColorChosen);
1083 ((TH1F*)Ar_h1_Cluster_1stCrownDigitalCharge->At(confignumber))->Draw();
1085 ((TH1F*)Ar_h1_Cluster_1stCrownDigitalCharge->At(confignumber))->Draw(
"same");
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);
1094 ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw();
1096 ((TH2F*)Ar_h2_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw(
"same");
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);
1103 ((TProfile*)Ar_Pr_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw();
1105 ((TProfile*)Ar_Pr_Charge_Q_over_Qtot_vs_distance->At(confignumber))->Draw(
"same");
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);
1121 ((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->Draw();
1123 ((TH1F*)Ar_h1_Cluster_SeedOverTotalDigitalCharge->At(confignumber))->Draw(
"same");
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);
1132 ((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->Draw();
1134 ((TH1F*)Ar_h1_Cluster_1stCrownOverTotalDigitalCharge->At(confignumber))->Draw(
"same");
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);
1143 ((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->Draw();
1145 ((TH1F*)Ar_h1_Cluster_2ndCrownOverTotalDigitalCharge->At(confignumber))->Draw(
"same");
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);
1154 ((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->Draw();
1156 ((TH1F*)Ar_h1_Cluster_4NeighboursOverTotalDigitalCharge->At(confignumber))->Draw(
"same");
1162 ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(confignumber))->Draw();
1163 ((TH1F*)Ar_h1_Resolution_ResidualX_CoG_true->At(confignumber))->Fit(
"gaus",
"",
"same");
1165 ((TH1F*)Ar_h1_Resolution_ResidualY_CoG_true->At(confignumber))->Draw();
1166 ((TH1F*)Ar_h1_Resolution_ResidualY_CoG_true->At(confignumber))->Fit(
"gaus",
"",
"same");
1168 ((TH1F*)Ar_h1_Resolution_Residualdist_CoG_true->At(confignumber))->Draw();
1170 ((TH2F*)Ar_h2_Resolution_TruePosition->At(confignumber))->Draw(
"colz");
1171 AutoZoom((TH2F*)Ar_h2_Resolution_TruePosition->At(confignumber))->Draw(
"colz");
1173 ((TH2F*)Ar_h2_Resolution_TruePosition_modulo->At(confignumber))->Draw(
"colz");
1174 AutoZoom((TH2F*)Ar_h2_Resolution_TruePosition_modulo->At(confignumber))->Draw(
"colz");
1176 ((TH2F*)Ar_h2_Resolution_CoG->At(confignumber))->Draw(
"colz");
1177 AutoZoom((TH2F*)Ar_h2_Resolution_CoG->At(confignumber))->Draw(
"colz");
1179 ((TH2F*)Ar_h2_Resolution_CoG_modulo->At(confignumber))->Draw(
"colz");
1180 AutoZoom(((TH2F*)Ar_h2_Resolution_CoG_modulo->At(confignumber)))->Draw(
"colz");
1185 MainCanvas1->Update();
1186 MainCanvas2->Update();
1187 MainCanvas3->Update();
1188 MainCanvas4->Update();
1203 void DIGMAPS::PlotDigitalConfiguration(Bool_t newcanvas, Int_t *configlist, Int_t Nconfigs)
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();
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);
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);
1255 MainCanvas1->Update();
1256 MainCanvas2->Update();
1257 MainCanvas3->Update();
1258 MainCanvas4->Update();
1262 if(ColorChosen==2){ColorChosen++;}
1263 if(ColorChosen==5){ColorChosen++;}
1266 Int_t maxNconfigs = 25;
1267 if(Nconfigs>maxNconfigs){Nconfigs=maxNconfigs;}
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);
1285 (Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->Draw(
"lp");
1287 MainCanvas1->Update();
1288 TPaveStats *st = (TPaveStats*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->FindObject(
"stats");
1289 st->SetName(
"stat2");
1292 (Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->Draw(
"lp sames");
1294 MainCanvas1->Update();
1295 TPaveStats *st = (TPaveStats*)(Ar_h1_multiplicity_with_threshold_01->At(configlist[i]))->FindObject(
"stats");
1296 st->SetName(
"stat2");
1306 for (Int_t i=0 ; i<Nconfigs ; i++){
1307 MainCanvas2->cd(currentpad);
1309 (Ar_h1_ADC_LSB->At(configlist[i]))->Draw();
1312 (Ar_h1_ADC_LSB->At(configlist[i]))->Draw(
"same");
1320 for (Int_t i=0 ; i<Nconfigs ; i++){
1321 MainCanvas3->cd(currentpad);
1323 ( Ar_h1_Efficiency_ideal->At(configlist[i]))->Draw();
1325 MainCanvas3->Update();
1327 ( Ar_h1_Efficiency_ideal->At(configlist[i]))->Draw(
"sames");
1329 MainCanvas3->Update();
1336 for (Int_t i=0 ; i<Nconfigs ; i++){
1337 MainCanvas4->cd(currentpad);
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");
1342 MainCanvas4->Update();
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");
1347 MainCanvas4->Update();
1356 MainCanvas1->Update();
1357 MainCanvas2->Update();
1358 MainCanvas3->Update();
1359 MainCanvas4->Update();
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;
1375 void DIGMAPS::PrintConfigurations()
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++){
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",
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())
1413 std::cout<<
"num |Thet|Phi |Pit x X y|epi |Nois|Temp|Nbits|lin|LSB |gain |Model|"<<endl;
1414 std::cout<<
"************************************************************** "<<endl;
1420 void DIGMAPS::InspectEvent(Int_t EventNumber)
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;
1430 cout<<
" No action plot done before !"<<endl;
1434 cout<<
" Event number "<<EventNumber <<
"is observed"<<endl;
1443 void DIGMAPS::RunConfiguration(Int_t configcounter, Int_t BeamNumber, Int_t PlaneNumber, Int_t ADCNumber, Int_t TransportNumber)
1450 Float_t totalsurface = (GetPlane(PlaneNumber)-> GetXdimension()) * (GetPlane(PlaneNumber)-> GetYdimension());
1452 Float_t Lambda_poisson = totalsurface * 0.000001 * (GetBeam(BeamNumber)->GetParticleDensity());
1453 Double_t xran,yran,zran;
1457 TRandom3 *r3 =
new TRandom3(GlobalSeed);
1459 Int_t NumberOfEvents = GetBeam(BeamNumber)->GetNumberOfEvents();
1466 for (Int_t iEvent = 0; iEvent < NumberOfEvents ; iEvent++){
1469 Int_t numberofparticles = 0;
1470 if(GetBeam(BeamNumber)->GetBeamOption()==1){
1471 numberofparticles = PoissonLaw( Lambda_poisson);
1473 numberofparticles=1;
1476 std::cout<<
"-----event "<<iEvent<<
" with "<<numberofparticles<<
" particles produced"<<endl;
1480 for (Int_t ipart = 0; ipart < numberofparticles ; ipart++){
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);
1514 if(GetBeam(BeamNumber)->GetBeamOption()==1){
1515 xran = r3->Rndm()*(GetPlane(PlaneNumber)-> GetXdimension());
1516 yran = r3->Rndm()*(GetPlane(PlaneNumber)-> GetYdimension());
1518 xran = (float(GetPlane(PlaneNumber)->GetNpixelsX()/2) + r3->Rndm() )* (GetPlane(PlaneNumber)->GetPitchX());
1519 yran = (float(GetPlane(PlaneNumber)->GetNpixelsY()/2) + r3->Rndm() )* (GetPlane(PlaneNumber)->GetPitchY());
1522 Float_t thetapos = GetBeam(BeamNumber)->GetThetaIncidentDeg();
1523 Float_t phipos = GetBeam(BeamNumber)->GetPhiIncidentDeg();
1524 Float_t thetaposrad = thetapos*PI/180.0;
1525 Float_t phiposrad = phipos*PI/180.0;
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());
1533 fdigparticle =
new DIGParticle(xran,yran,zran,outputXpos,outputYpos,outputZpos,Energy);
1535 fdigparticle->ComputeChargeDeposition(GetPlane(PlaneNumber)->GetSegmentSize(),
1536 GetPlane(PlaneNumber)->GetMaximumSegmentSize(),
1537 GetPlane(PlaneNumber)->GetMaximumChargePerSegment());
1539 fdigparticle->ComputeChargeTransport(GetPlane(PlaneNumber),GetTransport(TransportNumber));
1541 fdigparticle->AddRandomNoise(GetPlane(PlaneNumber));
1543 fdigparticle->AnalogToDigitalconversion(GetADC(ADCNumber), GetPlane(PlaneNumber) );
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]);
1556 delete fdigparticle;
1564 (fdigevent->GetReadoutmap())->AnalogToDigitalconversion(GetADC(ADCNumber), GetPlane(PlaneNumber));
1566 fdigevent->BuildTrueClusters(GetPlane(PlaneNumber));
1567 fdigevent->SetConfigurationNumber(configcounter);
1571 TClonesArray *particules = fdigevent->GetParticle();
1572 if( fdigevent->GetNParticles() != (particules->GetLast()+1)){
1573 cout<<
"DIGMAPS 4::PrintInfo WARNING PROBLEM IN PARTICLES RECORDING"<<endl;
1576 fdigbeam = (
DIGBeam*)GetBeam(BeamNumber)->Clone();
1577 fdigplane = (
DIGPlane*)GetPlane(PlaneNumber)->Clone();
1578 fdigadc = (
DIGADC*)GetADC(ADCNumber)->Clone();
1579 fdigtransport = (
DIGTransport*)GetTransport(TransportNumber)->Clone();
1590 void DIGMAPS::ChargeGeneration(
DIGParticle& aDIGParticle, Float_t StartingSegmentSize, Float_t MaximumSegmentSize,
1591 Float_t MaximumChargePerSegment)
1593 aDIGParticle.ComputeChargeDeposition(StartingSegmentSize, MaximumSegmentSize,MaximumChargePerSegment) ;
1597 Int_t DIGMAPS::PoissonLaw(Float_t Lambda)
1601 TRandom3 *r3 =
new TRandom3(GlobalSeed);
1603 n = r3->Poisson(Lambda);
1612 Double_t DIGMAPS::LandauLaw(Double_t mean, Double_t sigma)
1616 TRandom3 *r3 =
new TRandom3(GlobalSeed);
1618 x = r3->Landau(mean,sigma);
1625 Double_t DIGMAPS::GaussianLaw(Double_t mean, Double_t sigma)
1629 TRandom3 *r3 =
new TRandom3(GlobalSeed);
1631 x = r3->Gaus(mean,sigma);
1638 Double_t DIGMAPS::Lorentz2D(Double_t *x, Double_t *par){
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]) ;
1654 void DIGMAPS::SetfAction(TString action)
1661 void DIGMAPS::SetIsOutputfile(Bool_t IsOutputfile)
1663 fIsOutputfile = IsOutputfile;
1667 void DIGMAPS::SetAction(
DIGAction *aDIGAction)
1669 fDIGAction = aDIGAction;
1673 void DIGMAPS::SetNumberOfConfigurations(Int_t NumberOfConfiguration)
1675 fNumberOfConfigurations = NumberOfConfiguration;
1679 void DIGMAPS::SetConfigPath(TString aCP)
1687 void DIGMAPS::SetConfigFileName(TString aCFN)
1689 fConfigFileName = aCFN;
1694 void DIGMAPS::SetConfigPathAndFileName()
1696 fConfigPathAndFileName = fConfigPath + fConfigFileName;
1701 void DIGMAPS::SetConfigPathAndFileName(TString aCP,TString aCFN)
1704 fConfigFileName = aCFN;
1705 fConfigPathAndFileName = fConfigPath + fConfigFileName;
1709 TString DIGMAPS::GetConfigPath()
1715 TString DIGMAPS::GetConfigFileName()
1717 return fConfigFileName;
1721 TString DIGMAPS::GetConfigPathAndFileName()
1723 return fConfigPathAndFileName;
1734 void DIGMAPS::SetOutputPath(TString outp)
1743 void DIGMAPS::SetOutputFileName(TString outf)
1745 fOutputFileName = outf;
1750 void DIGMAPS::SetOutputPathAndFileName()
1752 fOutputPathAndFileName = fOutputPath + fOutputFileName;
1757 void DIGMAPS::SetOutputPathAndFileName(TString outp,TString outf)
1760 fOutputFileName = outf;
1761 fOutputPathAndFileName = fOutputPath + fOutputFileName;
1769 DIGPlane* DIGMAPS::GetPlane(Int_t aPlaneNumber){
1770 return (
DIGPlane*)fDIGPlaneArray->At(aPlaneNumber);
1774 DIGADC* DIGMAPS::GetADC(Int_t anADCNumber){
1775 return (
DIGADC*)fDIGADCArray->At(anADCNumber);
1779 DIGTransport* DIGMAPS::GetTransport(Int_t aTransportNumber){
1780 return (
DIGTransport*)fDIGTransportArray->At(aTransportNumber);
1784 DIGBeam* DIGMAPS::GetBeam(Int_t aBeamNumber){
1785 return (
DIGBeam*)fDIGBeamArray->At(aBeamNumber);
1789 void DIGMAPS::ReadTree(TString StringTree){
1791 cout<<StringTree<<endl;
ADCParameter_t & GetADCPar(Int_t aPN)
don''t put in streamer