Commit 9e20a24a authored by Pierre Morfouace's avatar Pierre Morfouace
Browse files

Merge branch 'NPTool.2.dev' of https://gitlab.in2p3.fr/np/nptool into NPTool.2.dev

parents 8914836f a0d67fc6
Pipeline #127841 passed with stages
in 7 minutes and 41 seconds
......@@ -268,7 +268,7 @@ void NPL::DetectorManager::BuildPhysicalEvent(){
(it->second->*m_ClearEventPhysicsPtr)();
(it->second->*m_BuildPhysicalPtr)();
(it->second->*m_FillSpectra)();
if(m_CheckSpectra)
if(m_CheckSpectra) {
(it->second->*m_CheckSpectra)();
}
}
......
......@@ -57,18 +57,18 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector
// DSSD
int EventMultiplicity;
vector<int> EventType;
//vector<int> TowerNumber;
vector<int> TowerNumber;//
vector<int> DetectorNumber;
vector<int> Strip_Front;
vector<int> Strip_Back;
//vector<double> Strip_E;
vector<double> Strip_E;//
vector<double> Strip_T;
vector<double> Front_Energy;
vector<double> Back_Energy;
//vector<double> Half_Energy;
vector<double> Half_Energy;//
vector<double> Front_Time;
vector<double> Back_Time;
//vector<bool> Same_FBTime;
vector<bool> Same_FBTime;//
// Calorimeter
vector<double> Calor_E;
vector<double> Calor_T;
......@@ -240,8 +240,8 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector
Int_t m_CounterEvt[50]; //!
Int_t m_CounterHit[50]; //!
// physical events
vector<int> TowerNumber;
vector<double> Half_Energy;
//vector<int> TowerNumber;
//vector<double> Half_Energy;
//vector<bool> Same_FBTime;
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -57,16 +57,29 @@ class Strasse : public NPS::VDetector{
G4LogicalVolume* BuildInnerDetector();
G4LogicalVolume* BuildOuterDetector();
G4LogicalVolume* BuildElectronic();
G4LogicalVolume* BuildFrame();
G4LogicalVolume* BuildChamber();
G4LogicalVolume* BuildChamberFromCAD(string path);
G4LogicalVolume* BuildStars(string path);
G4LogicalVolume* BuildBlades(string path);
G4LogicalVolume* BuildBase(string path);
private:
G4LogicalVolume* m_InnerDetector;
G4LogicalVolume* m_OuterDetector;
G4LogicalVolume* m_Electronic;
G4LogicalVolume* m_Frame;
G4LogicalVolume* m_Stars;
G4LogicalVolume* m_Chamber;
G4LogicalVolume* m_Blades;
G4LogicalVolume* m_Base;
string ChamberPath;
string BasePath;
string StarsPath;
string BladesPath;
bool found_chamber;
bool found_blades;
bool found_stars;
bool found_base;
private:
// Initialize material used in detector definition
......@@ -78,6 +91,7 @@ class Strasse : public NPS::VDetector{
G4Material* m_MaterialAl ;
G4Material* m_MaterialVacuum ;
G4Material* m_MaterialPCB ;
G4Material* m_MaterialCu ;
// calculated dimension
double m_Active_InnerWafer_Width;
......@@ -141,8 +155,6 @@ class Strasse : public NPS::VDetector{
vector<double> m_Chamber_Z;
// Visualisation Attribute
//G4VisAttributes* m_VisTrap;
// Needed for dynamic loading of the library
public:
......@@ -153,9 +165,10 @@ class Strasse : public NPS::VDetector{
G4VisAttributes* SiliconVisAtt ;
G4VisAttributes* PCBVisAtt;
G4VisAttributes* PADVisAtt ;
G4VisAttributes* FrameVisAtt ;
G4VisAttributes* StarsVisAtt ;
G4VisAttributes* ChamberVisAtt ;
G4VisAttributes* GuardRingVisAtt ;
G4VisAttributes* BladeVisAtt ;
};
......
......@@ -66,7 +66,7 @@ G4bool PS_Interactions::ProcessHits(G4Step* aStep, G4TouchableHistory*){
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PS_Interactions::Initialize(G4HCofThisEvent*){
// Clear is called by EventAction
clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -76,7 +76,6 @@ void PS_Interactions::EndOfEvent(G4HCofThisEvent*){
for(unsigned int i = 0 ; i < size ; i++)
m_InterractionCoordinates->SetInteraction(m_DataVector[i]->GetEnergy(),m_DataVector[i]->GetTime(),m_DataVector[i]->GetPositionX(),m_DataVector[i]->GetPositionY(),m_DataVector[i]->GetPositionZ(),m_DataVector[i]->GetTheta()/deg,m_DataVector[i]->GetPhi()/deg);
clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......
......@@ -100,7 +100,7 @@ __EVENTTYPE__* DecodeD::getEvent()
void DecodeD::decodeEvent()
{
this -> Clear();
/*this -> */Clear();
switch (datatype) {
case D_ROOT:
if (cursor < length) {
......
......@@ -16,6 +16,10 @@
#include "DecodeD.h"
#include "DecodeT.h"
#define __RUN__ 3
#define __1DET__
#define __TEST_ZONE__
#undef __TEST_ZONE__
......@@ -105,15 +109,47 @@ int main(int argc, char** argv)
auto ccamPhys = (TComptonTelescopePhysics*) m_NPDetectorManager->GetDetector("ComptonTelescope");
ccamPhys->SetRawDataPointer(ccamData);
#ifdef __1DET__
ifstream is;
is.open("/disk/proto-data/data/20210510_Bi207/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-05-10_07_41_50.raw");
is.seekg(0, ios::end);
int len = is.tellg();
is.seekg(0, ios::beg);
char* buff = new char[len];
is.read(buff, len);
is.close();
DecodeR* DR = new DecodeR(false, buff);
while(DR -> getCursor() < len) {
DR -> decodeBlobMFM();
m_NPDetectorManager->ClearEventPhysics();
m_NPDetectorManager->ClearEventData();
ccamData -> SetCTCalorimeter(1, 4, DR->getPixelNumber(), DR->getTime(), DR->getData(), 64);
m_NPDetectorManager->BuildPhysicalEvent();
m_OutputTree->Fill();
m_NPDetectorManager->CheckSpectraServer();
}
delete DR;
delete [] buff;
m_NPDetectorManager -> WriteSpectra();
#else
// read data file/flux and fill ccamData object
std::cout << "Reading data\n";
DecodeR* DR = new DecodeR(false); // Instantiates DecodeR object reading calorimeter data flux
DecodeT* DT = new DecodeT(false); // Instantiates DecodeT object reading trigger data flux
DecodeD* DD = new DecodeD(false); // Instantiates DecodeD object reading DSSSD(s) data flux
// newframe_t* event;
//DD -> setTree("/disk/proto-data/data/20210304_run2/bb7_3309-7_cs137_20210304_14h35_conv.root");
#if __RUN__ == 0
DD -> setTree("../data/20210210_run1/bb7_3309-7_cs137-20210210_11h05_coinc_run1_conv.root");
#elif __RUN__ == 1
DD -> setTree("/disk/proto-data/data/20210210_run1/bb7_3309-7_cs137-20210210_11h05_coinc_run1_conv.root");
#elif __RUN__ == 2
DD -> setTree("/disk/proto-data/data/20210304_run2/bb7_3309-7_cs137_20210304_14h35_conv.root");
#elif __RUN__ == 3
DD -> setTree("/disk/proto-data/data/20210305_run3/bb7_3309-7_cs137_20210305_14h53_conv.root");
//DD -> setTree("../data/20210210_run1/bb7_3309-7_cs137-20210210_11h05_coinc_run1_conv.root");
#elif __RUN__ == 4
DD -> setTree("/disk/proto-data/data/20210407_run4/bb7_3309-7_cs137_20210407_14h53_conv.root");
#endif
int dlen = DD -> getLength();
int i = 0;// ROSMAP files loop counter
......@@ -126,8 +162,16 @@ int main(int argc, char** argv)
ifstream iros, itrig;
cout << "Loading data files " << std::flush;
#if __RUN__ == 0
itrig.open("../data/20210210_run1/mfm_trigger_202102101104.raw", ios::binary);
#elif __RUN__ == 1
itrig.open("/disk/proto-data/data/20210210_run1/mfm_trigger_202102101104.raw", ios::binary);
#elif __RUN__ == 2
#elif __RUN__ == 3
itrig.open("/disk/proto-data/data/20210305_run3/mfm_trigger_20210305_run3.raw", ios::binary);
//itrig.open("../data/20210210_run1/mfm_trigger_202102101104.raw", ios::binary);
#elif __RUN__ == 4
itrig.open("/disk/proto-data/data/20210407_run4/mfm_trigger_20210407_run4.raw", ios::binary);
#endif
itrig.seekg(0, ios::end);
int tlen = itrig.tellg();
itrig.seekg(0, ios::beg);
......@@ -136,8 +180,16 @@ int main(int argc, char** argv)
itrig.close();
cout << "... " << std::flush;
#if __RUN__ == 0
iros.open("../data/20210210_run1/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-02-10_10_04_59.raw.0001", ios::binary);
#elif __RUN__ == 1
iros.open("/disk/proto-data/data/20210210_run1/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-02-10_10_04_59.raw.0001", ios::binary);
#elif __RUN__ == 2
#elif __RUN__ == 3
iros.open("/disk/proto-data/data/20210305_run3/mfm_rosmap_20210305_run3.raw", ios::binary);
//iros.open("../data/20210210_run1/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-02-10_10_04_59.raw.0001", ios::binary);
#elif __RUN__ == 4
iros.open("/disk/proto-data/data/20210407_run4/mfm_rosmap_20210407_run4.raw", ios::binary);
#endif
iros.seekg(0, ios::end);
int rlen = iros.tellg();
iros.seekg(0, ios::beg);
......@@ -157,6 +209,22 @@ int main(int argc, char** argv)
resetCount = DT->getResetCount() - resetCount;
resetCount = -resetCount; // T B C !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cout << "Found reset count: " << resetCount << endl;
if (resetCount == 0) {
string ans;
cout << "reset count is 0. Continue ? y/[n]";
cin >> ans;
if (ans != "y" and ans != "Y") {
DT -> setRaw(tbuff);
DT -> decodeBlobMFM();
resetCount = DT -> getResetCount();
while (not(DT->hasTrigged(2))) {
DT -> decodeBlobMFM();
}
resetCount = DT->getResetCount() - resetCount;
cout << "Found reset count: " << resetCount << endl;
}
}
int cr, cd, tr, td;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
......@@ -261,7 +329,7 @@ int main(int argc, char** argv)
DR -> decodeBlobMFM();
//#ifdef __TEST_ZONE__
cout << "Entering test zone." << endl;
// cout << "Entering test zone." << endl;
//#else
DD -> rewind();
......@@ -271,7 +339,7 @@ int main(int argc, char** argv)
tr = DR -> getTime();
td = DD -> getTime();
while(DR -> getCursor() < rlen and DD -> getCursor() < dlen)
while(DR -> getCursor() < rlen and DD -> getCursor() < dlen and c < 10000)
{
if (cr == cd) {
#ifndef __TEST_ZONE__
......@@ -283,7 +351,6 @@ int main(int argc, char** argv)
//DR -> Dump();
//DD -> Dump();
c++;
cout << cc << " " << c /*<< "(" << cr << ", " << cd << ") : " << tr << " " << td*/ << "\n";
// Clear raw and physics data
m_NPDetectorManager->ClearEventPhysics();
m_NPDetectorManager->ClearEventData();
......@@ -307,6 +374,7 @@ int main(int argc, char** argv)
m_OutputTree->Fill();
cc++;
#endif
cout << cc << " " << c /*<< "(" << cr << ", " << cd << ") : " << tr << " " << td*/ << " |\t";
}
// check spectra
......@@ -353,7 +421,7 @@ int main(int argc, char** argv)
deltaT->Write();
}
fout->Close();
#endif
// Essential
#if __cplusplus > 199711L && NPMULTITHREADING
m_NPDetectorManager->StopThread();
......
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Target
THICKNESS= 150 mm
ANGLE= 0 deg
RADIUS= 15 mm
MATERIAL= LH2
X= 0 mm
Y= 0 mm
Z= 0 mm
NbSlices= 10
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1
Strasse Info
Inner_Wafer_Length= 124 mm
Inner_Wafer_Width= 32 mm
Inner_Wafer_Thickness= 200 micrometer
Inner_Wafer_AlThickness= 0.4 micrometer
Inner_Wafer_PADExternal= 0 mm
Inner_Wafer_PADInternal= 0 mm
Inner_Wafer_GuardRing= 1.0 mm
Inner_Wafer_TransverseStrips= 610
Inner_Wafer_LongitudinalStrips= 150
Inner_PCB_PortWidth= 1 mm
Inner_PCB_StarboardWidth= 1 mm
Inner_PCB_BevelAngle= 90 deg
Inner_PCB_UpstreamWidth= 12 mm
Inner_PCB_DownstreamWidth= 38 mm
Inner_PCB_MidWidth= 1 mm
Inner_PCB_Thickness= 2.4 mm
Inner_PCB_Ledge= 1 mm
Inner_PCB_Step= 2 mm
Outer_Wafer_Length= 123 mm
Outer_Wafer_Width= 64.6 mm
Outer_Wafer_Thickness= 300 micrometer
Outer_Wafer_AlThickness= 0.4 micrometer
Outer_Wafer_PADExternal= 0 mm
Outer_Wafer_PADInternal= 0 mm
Outer_Wafer_GuardRing= 1.0 mm
Outer_PCB_PortWidth= 1 mm
Outer_PCB_StarboardWidth= 1 mm
Outer_PCB_BevelAngle= 90 deg
Outer_PCB_UpstreamWidth= 40 mm
Outer_PCB_DownstreamWidth= 12 mm
Outer_PCB_MidWidth= 1 mm
Outer_PCB_Thickness= 2.4 mm
Outer_PCB_Ledge= 1 mm
Outer_PCB_Step= 2 mm
Outer_Wafer_TransverseStrips= 605
Outer_Wafer_LongitudinalStrips= 313
% unused if using CAD file (.stl) chamber
Chamber_Thickness= 3 mm
Chamber_Cylinder_Length= 360 mm
Chamber_Radius= 180 mm
Chamber_ExitTube_Radius= 79.5 mm
Chamber_ExitTube_Length= 100 mm
Chamber_Flange_Inner_Radius= 50 mm
Chamber_Sphere_Radius= 220 mm
Chamber_Sphere_Shift= 60 mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Alias InnerPhi
Action= Copy
% Value= 116
Value= -4 56 116 176 236 296
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Strasse Inner
Radius= 27.6 mm
Z= 76.5 mm
Phi= @InnerPhi deg
Shift= 3 mm
Ref= 0 0 0 mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Alias OuterPhi
Action= Copy
% Value= 0
Value= 0 60 120 180 240 300
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Strasse Outer
Radius= 58.5 mm
Z= 76.5 mm
Phi= @OuterPhi deg
Shift= 0 mm
Ref= 0 0 0 mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Strasse InactiveMaterial
Chamber= ./geometry/STRASSE_Chamber.stl
Stars= ./geometry/STRASSE_StarSupports.stl
Base= ./geometry/STRASSE_Base.stl
Blades= ./geometry/STRASSE_Blades.stl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1
%Catana CSV
% Path= geometry/Catana.csv
% Pos= 0 0 100 mm
% Rshift= 100 micrometer
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment