FairRoot/PandaRoot
PndGemMonitor.cxx
Go to the documentation of this file.
1 //* $Id: */
2 
3 // -------------------------------------------------------------------------
4 // ----- PndGemMonitor source file -----
5 // ----- Created 10/04/2013 by R. Karabowicz -----
6 // -------------------------------------------------------------------------
7 
16 #include "PndGemMonitor.h"
17 #include "PndGemSensor.h"
18 #include "PndGemSensorMonitor.h"
19 
20 #include <iostream>
21 
22 using std::cout;
23 using std::endl;
24 using std::flush;
25 using std::map;
26 using std::pair;
27 
29 // -------------------------------------------------------------------------
30 
31 // ----- Get Instance ----------------------------------------------------
33  if ( !fInstance){
34  std::cout<<"Info in (PndGemMonitor::Instance): Making a new instance using the framework."<<std::endl;
35  fInstance = new PndGemMonitor();
36  }
37  return fInstance;
38 }
39 // -------------------------------------------------------------------------
40 
41 // ----- Constructor -----------------------------------------------------
43  FairTask("GEM Monitor",0),
44  fGeoMan(),
45  fRtdb(),
46  fSensorList(NULL)
47  //,
48  // fSensorMap(0)
49 {
50  if(fInstance) return;
51  fInstance = this;
52  FairRun* run = FairRun::Instance();
53  if (run) {
54  this->SetName("PndGemMonitor");
55  this->SetTitle("FairTask");
56  run->AddTask((FairTask*)this);
57  }
58  else {
59  std::cout << "PndGemMonitor. No FairRun object found. If used in a macro take another constructor." << std::endl;
60  }
61 }
62 // -------------------------------------------------------------------------
63 
64 // ----- Create Sensor Monitor -------------------------------------------
66  if ( fSensorList == 0 )
67  fSensorList = new TObjArray();
68 
69  PndGemSensorMonitor* tempMonitor = new PndGemSensorMonitor(tempSensor);
70 
71  pair<Int_t, Int_t> a (tempMonitor->GetStationNr(),
72  tempMonitor->GetSensorNr ());
73  fSensorMap[a] = fSensorList->GetEntries();
74  fSensorList->Add(tempMonitor);
75  return 0; // ADDED, not clear the meaning of this Int_t function (Stefano)
76 }
77 // -------------------------------------------------------------------------
78 
79 // ----- Enable Digi -----------------------------------------------------
80 void PndGemMonitor::EnableDigi(Int_t eventNr, Int_t digiNr, PndGemDigi* tempDigi) {
81  pair<Int_t, Int_t> a (tempDigi->GetStationNr(),
82  tempDigi->GetSensorNr ());
84 
85  // sensor->ChannelLastActiveAt(tempDigi->GetChannelNr(),
86  // tempDigi->GetSide(),
87  // tempDigi->GetTimeStamp(),
88  // eventNr);
89 
90  sensor->ActivateChannel(tempDigi->GetChannelNr(),
91  tempDigi->GetSide(),
92  eventNr,
93  digiNr,
94  tempDigi->GetTimeStamp(),
95  tempDigi->GetCharge());
96 
97 
98  // // ----- How much time passed since last activation? ----------------------------------------------------
99  // Double_t PndGemSensorMonitor::ChannelLastActiveAt(Int_t channelNr, Int_t sideId, Double_t timeNow) {
100  // }
101  // // -------------------------------------------------------------------------
102 
103  // // ----- Last activation data ----------------------------------------------------
104  // Bool_t PndGemSensorMonitor::ChannelLastActivation(Int_t channelNr, Int_t sideId, Int_t& eventNr, Int_t& digiNr, Double_t& channelTime, Double_t& channelCharge) {
105  // }
106  // // -------------------------------------------------------------------------
107 
108 }
109 // -------------------------------------------------------------------------
110 
111 // ----- Return the last time the channel was active -----------------------------------------------------
112 Double_t PndGemMonitor::ChannelLastActiveAt(Int_t statNr, Int_t sensNr, Int_t sideId, Int_t chanNr) {
113  pair<Int_t, Int_t> a (statNr,sensNr);
115  // cout << "sensor is there " << sensor << " :" << endl;
116 
117  return sensor->ChannelLastActiveAt(chanNr,sideId);
118 }
119 // -------------------------------------------------------------------------
120 
121 // ----- Enable Cluster -----------------------------------------------------
122 void PndGemMonitor::EnableCluster(Int_t eventNr, Int_t clusterNr, PndGemCluster* tempCluster) {
123  pair<Int_t, Int_t> a (tempCluster->GetStationNr(),
124  tempCluster->GetSensorNr ());
126 
127  for ( Int_t ichan = tempCluster->GetClusterBeg() ; ichan <= tempCluster->GetClusterEnd() ; ichan++ ) {
128  sensor->ActivateChannel(ichan,
129  tempCluster->GetSide(),
130  eventNr,
131  clusterNr,
132  tempCluster->GetTimeStamp(),
133  tempCluster->GetCharge());
134  }
135 }
136 // -------------------------------------------------------------------------
137 
138 // ----- Print -----------------------------------------------------------
140  std::cout << "--- PndGemMonitor :: Print () ---" << std::endl;
141  std::cout << "--- " << fSensorList->GetEntries() << " sensors" << std::endl;
142  for ( Int_t isens = 0 ; isens < fSensorList->GetEntries() ; isens++ ) {
143  ((PndGemSensorMonitor*)fSensorList->At(isens))->Print();
144  }
145 
146  std::cout << "---------------------------------" << std::endl;
147 }
148 // -------------------------------------------------------------------------
static PndGemMonitor * fInstance
Definition: PndGemMonitor.h:59
Double_t ChannelLastActiveAt(Int_t channelNr, Int_t sideId, Double_t timeNow, Int_t eventNr=-1)
Int_t GetSensorNr() const
Definition: PndGemCluster.h:90
Int_t GetClusterBeg() const
Definition: PndGemCluster.h:95
cout<< "-----------------------------------------------> Quarter VOLUME<<endl;name="QuarterShape";QuarterShape=newTGeoArb8(name,dz,vertQuar);name="Quarter4Vol";TStringmedium="air";QuarterVol=newTGeoVolumeAssembly(name);name="SubunitShape";SubunitShape=newTGeoArb8(name,dz,vertSub);TStringmedium="air";name="SubunitVol";name1="SubunitVol1";name2="SubunitVol2";name3="SubunitVol3";name4="SubunitVol4";name5="SubunitVol5";name6="SubunitVol6";name7="SubunitVol7";name8="SubunitVol8";name9="SubunitVol9";SubunitVol=newTGeoVolumeAssembly(name);SubunitVol1=newTGeoVolumeAssembly(name1);SubunitVol2=newTGeoVolumeAssembly(name2);SubunitVol3=newTGeoVolumeAssembly(name3);SubunitVol4=newTGeoVolumeAssembly(name4);SubunitVol5=newTGeoVolumeAssembly(name5);SubunitVol6=newTGeoVolumeAssembly(name6);SubunitVol7=newTGeoVolumeAssembly(name7);SubunitVol8=newTGeoVolumeAssembly(name8);SubunitVol9=newTGeoVolumeAssembly(name9);name="BoxShape";BoxShape=newTGeoArb8(name,dz,vertBox);TStringmedium="air";name="BoxVol";BoxVol=newTGeoVolumeAssembly(name);name1="BoxVol1";name2="BoxVol2";name3="BoxVol3";name4="BoxVol4";BoxVol1=newTGeoVolumeAssembly(name1);BoxVol2=newTGeoVolumeAssembly(name2);BoxVol3=newTGeoVolumeAssembly(name3);BoxVol4=newTGeoVolumeAssembly(name4);for(Int_tb=0;b<kNumOfBoxes;b++){cout<<""<<endl;cout<<"---------------->BOXnumber:"<<b<<endl;if(b==0){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(-0.465518);}if(b==1){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(0.465518);}if(b==2){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(-0.465518);}if(b==3){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(0.465518);}TGeoCombiTrans*trrotBox=newTGeoCombiTrans(trBox,rotBox);name="BoxVol";name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol->AddNode(BoxVol,b,trrotBox);if(b==1){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol1->AddNode(BoxVol,b,trrotBox);}if(b==2){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol2->AddNode(BoxVol1,b,trrotBox);}if(b==0){name+=b;trrotBox-> SetName(name)
Int_t CreateSensorMonitor(const PndGemSensor &tempSensor)
Int_t run
Definition: autocutx.C:47
Int_t GetStationNr() const
Definition: PndGemDigi.h:84
PndTransMap * map
Definition: sim_emc_apd.C:99
Int_t GetSide() const
Definition: PndGemCluster.h:92
TGeoVolume * sensor
Double_t ChannelLastActiveAt(Int_t statNr, Int_t sensNr, Int_t sideId, Int_t chanNr)
Int_t GetStationNr() const
Definition: PndGemSensor.h:93
void EnableDigi(Int_t eventNr, Int_t digiNr, PndGemDigi *tempDigi)
Int_t GetSensorNr() const
Definition: PndGemDigi.h:86
h_MC_angle SetTitle("MC truth: opening angle of #pi^{0}")
Int_t a
Definition: anaLmdDigi.C:126
Double_t
void EnableCluster(Int_t eventNr, Int_t clusterNr, PndGemCluster *tempCluster)
static PndGemMonitor * Instance()
Double_t GetChannelNr() const
Definition: PndGemDigi.h:80
Int_t GetClusterEnd() const
Definition: PndGemCluster.h:96
TObjArray * fSensorList
Definition: PndGemMonitor.h:66
Int_t GetSensorNr() const
Definition: PndGemSensor.h:95
Double_t GetCharge() const
Definition: PndGemDigi.h:91
Digitization Parameter Class for GEM part.
Definition: PndGemMonitor.h:36
std::map< std::pair< Int_t, Int_t >, Int_t > fSensorMap
Definition: PndGemMonitor.h:67
Int_t GetSide() const
Definition: PndGemDigi.h:88
Double_t GetCharge() const
Definition: PndGemCluster.h:97
Int_t GetStationNr() const
Definition: PndGemCluster.h:88