Changeset 4094 for trunk/MagicSoft/Mars/mtemp/mifae
- Timestamp:
- 05/18/04 10:16:45 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4087 r4094 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2004/05/18 Javier Rico 22 * library/MSrcPlace.[cc,h], library/MSrcRotate.[cc,h], 23 library/MSrcTranslate.[cc,h], library/MSrcPosFromFile.[cc,h] 24 - Add the possibility of having different input and output 25 MSrcPosCam containers (CONSTRUCTORS HAVE CHANGED!) 26 - Move the creation of internal histogram to PreProcess, so that 27 it can be configured before creation. Now configurable: whether 28 histo must be created or not (fCreateHisto), histo bin size 29 (fHistoBinPrec), histogram name (fHistoName), with corresponding 30 getters and setters 31 - Update documentation 32 33 * library/MSrcPosFromFile.cc 34 - If no position has been measured for the first analyzed run, use 35 the one of the first run in file instead. 36 37 * programs/falseSource.cc 38 - Change obsolete MSrcPosCam predefinitions for modern 39 MSrcTranslate objects, which allow relative displacement of the 40 source position from a previously assigned one. 41 - Add flag for relative translation 42 - Include control histograms (hOn[Off]SrcPos) for the source 43 position 44 45 * programs/falsesource.datacard 46 - Add datacard SRCABS for relative/absolute source translation 47 48 * programs/srcPos.cc 49 - Avoid creation of internal histograms for the translation 20 50 21 51 2004/05/17 Javier Rico -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.cc
r4087 r4094 66 66 // 67 67 // Default constructor. The first argument is the name of the internal histo, 68 // the second (third) argument is the name of a container 69 // containing the source position in the camera plain, MScrPosCam (MDCA). 70 // The default is "MSrcPosCam" ("MDCA"). 71 // 72 MSrcPlace::MSrcPlace(const char* histname, const char* srcPos, const char* dca, const char *name, const char *title) 73 : fSrcPos(NULL), fDCA(NULL) 68 // the second (third) argument is the name of the input (output) container 69 // containing the source position in the camera plain. Fourth argument is the 70 // name of the output MDCA container. 71 // 72 MSrcPlace::MSrcPlace(const char* srcPosIn, const char* srcPosOut, const char* dca, const char *name, const char *title) 73 : fSrcPosIn(NULL), fSrcPosOut(NULL), fDCA(NULL), fHistoName("SrcPosHist"), 74 fHistoBinPrec(1.), fHistPos(NULL) 74 75 { 75 76 fName = name ? name : gsDefName.Data(); 76 77 fTitle = title ? title : gsDefTitle.Data(); 77 78 78 fSrcPosName = srcPos; 79 fDCAName = dca; 80 81 const Float_t cameraSize = 600; //[mm] 82 const Float_t binPrecision = 1; //[mm] ~ 0.0033 deg 83 const UInt_t nbins = (UInt_t)(cameraSize*2/binPrecision); 84 85 fHistPos = new TH2F(histname,"",nbins,-cameraSize,cameraSize,nbins,-cameraSize,cameraSize); 79 fSrcPosInName = srcPosIn; 80 fSrcPosOutName = srcPosOut; 81 fDCAName = dca; 86 82 87 83 fMode=kOn; 84 fCreateHisto=kTRUE; 88 85 } 89 86 // ------------------------------------------------------------------------- … … 103 100 void MSrcPlace::SavePosIntoHisto() 104 101 { 105 fHistPos->Fill(fSrcPos->GetX(),fSrcPos->GetY()); 102 if(fHistPos) 103 fHistPos->Fill(fSrcPosOut->GetX(),fSrcPosOut->GetY()); 106 104 } 107 105 // ------------------------------------------------------------------------- … … 111 109 void MSrcPlace::ReadPosFromHisto() 112 110 { 113 Axis_t x; 114 Axis_t y; 115 116 fHistPos->GetRandom2(x,y); 117 fSrcPos->SetXY(x,y); 118 fDCA->SetRefPoint(x,y); 111 if(fHistPos) 112 { 113 Axis_t x; 114 Axis_t y; 115 116 fHistPos->GetRandom2(x,y); 117 fSrcPosOut->SetXY(x,y); 118 fDCA->SetRefPoint(x,y); 119 } 119 120 } 120 121 // ------------------------------------------------------------------------- … … 125 126 Int_t MSrcPlace::PreProcess(MParList* pList) 126 127 { 127 // look for/create MSrcPosCam 128 fSrcPos = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fSrcPosName), "MSrcPosCam"); 129 if (!fSrcPos) 130 { 131 *fLog << warn << AddSerialNumber(fSrcPosName) << " [MSrcPosCam] not found... creating default container." << endl; 132 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fSrcPosName)); 133 if(!fSrcPos) 128 // create (if needed and requested) internal histogram 129 if(fCreateHisto && !fHistPos) 130 { 131 const Float_t cameraSize = 600; //[mm] 132 const UInt_t nbins = (UInt_t)(cameraSize*2/fHistoBinPrec); 133 fHistPos = new TH2F(fHistoName,"",nbins,-cameraSize,cameraSize,nbins,-cameraSize,cameraSize); 134 fHistPos->SetDirectory(0); 135 *fLog << inf << "MSrcPlace::PreProcess Message: internal histogram " << fHistoName << " created with " << nbins << "x" << nbins << " bins" << endl; 136 } 137 138 // look for/create input MSrcPosCam 139 fSrcPosIn = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fSrcPosInName), "MSrcPosCam"); 140 if (!fSrcPosIn) 141 { 142 *fLog << warn << AddSerialNumber(fSrcPosInName) << " [MSrcPosCam] not found... creating default container." << endl; 143 fSrcPosIn = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fSrcPosInName)); 144 if(!fSrcPosIn) 145 return kFALSE; 146 } 147 148 // look for/create output MSrcPosCam 149 fSrcPosOut = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fSrcPosOutName), "MSrcPosCam"); 150 if (!fSrcPosOut) 151 { 152 *fLog << warn << AddSerialNumber(fSrcPosOutName) << " [MSrcPosCam] not found... creating default container." << endl; 153 fSrcPosOut = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fSrcPosOutName)); 154 if(!fSrcPosOut) 134 155 return kFALSE; 135 156 } … … 146 167 147 168 // check mode, look for a filled histogram in case kOff 148 if(fMode==kOn) 149 *fLog << inf << "MSrcPlace PreProcess Message: source postions will be stored in internal histo (" << fHistPos->GetName() << ")" << endl; 150 else 151 { 152 if(fHistPos->GetEntries()) 153 *fLog << inf << "MSrcPlace PreProcess Message: source postions will be read from internal histo (" << fHistPos->GetName() << ")" << endl; 169 if(fHistPos) 170 { 171 if(fMode==kOn) 172 *fLog << inf << "MSrcPlace PreProcess Message: source postions will be stored in internal histo (" << fHistPos->GetName() << ")" << endl; 154 173 else 155 174 { 156 *fLog << err << "MSrcPlace PreProcess Error: source postions attempted to be read from empty histo (" << fHistPos->GetName() << ")" << endl; 157 return kFALSE; 175 if(fHistPos->GetEntries()) 176 *fLog << inf << "MSrcPlace PreProcess Message: source postions will be read from internal histo (" << fHistPos->GetName() << ")" << endl; 177 else 178 { 179 *fLog << err << "MSrcPlace PreProcess Error: source postions attempted to be read from empty histo (" << fHistPos->GetName() << ")" << endl; 180 return kFALSE; 181 } 158 182 } 159 183 } … … 191 215 Int_t MSrcPlace::PostProcess() 192 216 { 193 if(fMode==kOn )217 if(fMode==kOn && fHistPos) 194 218 { 195 219 *fLog << inf << endl; -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.h
r4087 r4094 16 16 17 17 private: 18 MSrcPosCam* fSrcPos; // Pointer to the source position 19 MDCA* fDCA; // Pointer to the MDCA object 18 MSrcPosCam* fSrcPosIn; // Pointer to the input source position container 19 MSrcPosCam* fSrcPosOut; // Pointer to the output source position container 20 MDCA* fDCA; // Pointer to the output MDCA container 20 21 21 TString fSrcPosName; // Name of the MSrcPosCam object 22 TString fDCAName; // Name of the MDCA object 23 24 TH2F* fHistPos; // histogram of the used source positions 22 TString fSrcPosInName; // Name of the input MSrcPosCam object 23 TString fSrcPosOutName; // Name of the output MSrcPosCam object 24 TString fDCAName; // Name of the MDCA object 25 26 TString fHistoName; // Name of internal histogram 27 Float_t fHistoBinPrec; // [mm] internal histo bin size 28 29 TH2F* fHistPos; // histogram of the used source positions 25 30 OnOffMode_t fMode; // On/Off data mode (write/read to/from the histogram) 31 Bool_t fCreateHisto; // flag to decide whether internal histo is created or not 26 32 27 33 void SavePosIntoHisto(); … … 35 41 36 42 public: 37 MSrcPlace(const char* histname="HistSrcPos",38 const char* src="MSrcPosCam", const char* dca="MDCA",43 MSrcPlace(const char* srcin="MSrcPosCam",const char* srcout="MSrcPosCam", 44 const char* dcaout="MDCA", 39 45 const char* name=NULL, const char* title=NULL); 40 46 41 47 virtual ~MSrcPlace(); 42 48 43 void SetMode(OnOffMode_t mode) {fMode=mode;} 44 void SetSrcPosName(TString name) {fSrcPosName=name;} 45 void SetDCAName(TString name) {fDCAName=name;} 49 void SetMode(OnOffMode_t mode) {fMode=mode;} 50 void SetInputSrcPosName(TString name) {fSrcPosInName=name;} 51 void SetOutputSrcPosName(TString name) {fSrcPosOutName=name;} 52 void SetDCAName(TString name) {fDCAName=name;} 53 void SetInternalHistoName(TString name) {fHistoName=name;} 54 void SetInternalHistoBinSize(Float_t size){fHistoBinPrec=size;} 55 void SetCreateHisto(Bool_t inp=kTRUE) {fCreateHisto=inp;} 46 56 47 OnOffMode_t GetMode() {return fMode;} 48 TH2F* GetPositionHisto() {return fHistPos;} 49 MSrcPosCam* GetSrcPosCam() {return fSrcPos;} 50 MDCA* GetDCA() {return fDCA;} 57 OnOffMode_t GetMode() {return fMode;} 58 TH2F* GetPositionHisto() {return fHistPos;} 59 MSrcPosCam* GetInputSrcPosCam() {return fSrcPosIn;} 60 MSrcPosCam* GetOutputSrcPosCam() {return fSrcPosOut;} 61 MDCA* GetDCA() {return fDCA;} 62 TString GetInternalHistoName() {return fHistoName;} 51 63 52 64 virtual Int_t ComputeNewSrcPosition() {return kTRUE;} -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.cc
r4087 r4094 47 47 #include "MLogManip.h" 48 48 49 49 50 ClassImp(MSrcPosFromFile); 50 51 … … 61 62 // 62 63 MSrcPosFromFile::MSrcPosFromFile(TString cardpath, OnOffMode_t mode, const char *name, const char *title) 63 : MSrcPlace(TString(gsDefName+"Hist").Data()),fRawRunHeader(NULL), fSourcePositionFilePath(cardpath)64 : fRawRunHeader(NULL), fSourcePositionFilePath(cardpath) 64 65 { 65 66 fName = name ? name : gsDefName.Data(); … … 71 72 fRunMap=0x0; 72 73 73 fLastRun = 0; 74 fLastRun = 0; 75 fFirstRun = 0; 74 76 fLastValidSrcPosCam=0x0; 77 78 SetInternalHistoName(TString(fName)+"Hist"); 75 79 } 76 80 // ------------------------------------------------------------------------- … … 139 143 if(srcpos) 140 144 fLastValidSrcPosCam = srcpos; 145 else if(fLastValidSrcPosCam) 146 *fLog << inf << " not found in file. Taking previous position: "; 141 147 else 142 *fLog << inf << " not found in file. Taking previous position: ";143 144 if(fLastValidSrcPosCam)145 148 { 146 *fLog << inf << "\tX\t" << setprecision(3) << fLastValidSrcPosCam->GetX();147 *fLog << inf << "\tY\t" << setprecision(3) << fLastValidSrcPosCam->GetY() << endl;149 *fLog << warn << "MSrcPosFromFile::ComputeNewSrcPosition warning: no value for the first run. Taking first found run in file, run number " << fFirstRun << endl; 150 fLastValidSrcPosCam = (MSrcPosCam*)fRunMap->GetValue(run); 148 151 } 149 } 150 151 if(fLastValidSrcPosCam) 152 { 153 GetSrcPosCam()->SetXY(fLastValidSrcPosCam->GetX(),fLastValidSrcPosCam->GetY()); 154 GetDCA()->SetRefPoint(fLastValidSrcPosCam->GetX(),fLastValidSrcPosCam->GetY()); 155 } 156 else 157 { 158 *fLog << err << "MSrcPosFromFile::ComputeNewSrcPosition error: no value for the first run. Don't know what values to take" << endl; 159 return kFALSE; 160 } 152 153 *fLog << inf << "\tX\t" << setprecision(3) << fLastValidSrcPosCam->GetX(); 154 *fLog << inf << "\tY\t" << setprecision(3) << fLastValidSrcPosCam->GetY() << endl; 155 } 156 157 GetOutputSrcPosCam()->SetXY(fLastValidSrcPosCam->GetX(),fLastValidSrcPosCam->GetY()); 158 GetDCA()->SetRefPoint(fLastValidSrcPosCam->GetX(),fLastValidSrcPosCam->GetY()); 161 159 162 160 return kTRUE; … … 186 184 { 187 185 fin >> run >> x >> y; 186 if(!fFirstRun) fFirstRun=run; 188 187 if(fin.eof()) 189 188 break; -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.h
r4084 r4094 20 20 21 21 Int_t fNumRuns; 22 UInt_t fFirstRun; 22 23 UInt_t fLastRun; 23 24 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcRotate.cc
r4087 r4094 62 62 // ------------------------------------------------------------------------- 63 63 // 64 // Default constructor. The first (second) argument is the name of a container65 // containing the source position in the camera plain, MScrPosCam (MDCA).66 // The default is "MSrcPosCam" ("MDCA").67 // 68 MSrcRotate::MSrcRotate(const char* srcPos , const char* dca, const char *name, const char *title)69 : MSrcPlace(TString(gsDefName+"Hist").Data()),fRA(0), fDEC(0), fRefMJD(0), fRunNumber(0)64 // Default constructor. The first (second) argument is the name of the 65 // input (output) MSrcPosCam object containing the source position in the 66 // camera plain 67 // 68 MSrcRotate::MSrcRotate(const char* srcPosIn, const char* srcPosOut, const char* dca, const char *name, const char *title) 69 : fRA(0), fDEC(0), fRefMJD(0), fRunNumber(0) 70 70 { 71 71 fName = name ? name : gsDefName.Data(); 72 72 fTitle = title ? title : gsDefTitle.Data(); 73 73 74 SetSrcPosName(srcPos); 74 SetInputSrcPosName(srcPosIn); 75 SetOutputSrcPosName(srcPosOut); 75 76 SetDCAName(dca); 77 78 SetInternalHistoName(TString(fName)+"Hist"); 76 79 } 77 80 … … 176 179 Observation.RotationAngle(fRA,fDEC)-RefObservation.RotationAngle(fRA,fDEC) : 177 180 Observation.RotationAngle(fRA,fDEC) ; 178 MSrcPosCam* srcpos = GetSrcPosCam(); 181 MSrcPosCam* srcposIn = GetInputSrcPosCam(); 182 MSrcPosCam* srcposOut = GetOutputSrcPosCam(); 179 183 MDCA* dca = GetDCA(); 180 184 … … 182 186 Float_t s = TMath::Sin(rotationAngle); 183 187 // perform a rotation of -rotationAngle to move the source back to the "initial" position 184 Float_t newX = c*srcpos ->GetX()-s*srcpos->GetY();185 Float_t newY = s*srcpos ->GetX()+c*srcpos->GetY();188 Float_t newX = c*srcposIn->GetX()-s*srcposIn->GetY(); 189 Float_t newY = s*srcposIn->GetX()+c*srcposIn->GetY(); 186 190 187 191 #ifdef DEBUG 188 192 Double_t rotationAngleComp = fObservatory->RotationAngle(0.1256,2.63); 189 193 cout << "Event " << fEvtHeader->GetDAQEvtNumber() << endl; 190 cout << "newMJD=" << newMJD <<", rotationAngle=" << rotationAngle <<", rotationAngleComp=" << rotationAngleComp << ", oldX="<<fIniSrcPos .GetX()<< ", oldY="<<fIniSrcPos.GetY()<< ", newX="<<newX<< ", newY="<<newY << endl;194 cout << "newMJD=" << newMJD <<", rotationAngle=" << rotationAngle <<", rotationAngleComp=" << rotationAngleComp << ", oldX="<<fIniSrcPosIn.GetX()<< ", oldY="<<fIniSrcPosIn.GetY()<< ", newX="<<newX<< ", newY="<<newY << endl; 191 195 #endif 192 196 193 srcpos->SetX(newX); 194 srcpos->SetY(newY); 197 srcposOut->SetXY(newX,newY); 195 198 dca->SetRefPoint(newX,newY); 196 199 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcRotate.h
r4072 r4094 31 31 32 32 public: 33 MSrcRotate(const char* src="MSrcPosCam", const char* dca="MDCA", 33 MSrcRotate(const char* srcIn="MSrcPosCam",const char* srcOut="MSrcPosCam", 34 const char* dca="MDCA", 34 35 const char* name=NULL, const char* title=NULL); 35 36 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.cc
r4087 r4094 33 33 // Input Containers: 34 34 // MSrcPosCam 35 // [MDCA]36 35 // 37 36 // Output Containers: … … 62 61 // ------------------------------------------------------------------------- 63 62 // 64 // Default constructor. The first (second) argument is the name of a container65 // containing the source position in the camera plain, MScrPosCam (MDCA).66 // The default is "MSrcPosCam" ("MDCA").63 // Default constructor. The first (second) argument is the name of the 64 // input (output) MSrcPosCam object containing the source position in the 65 // camera plain 67 66 // 68 MSrcTranslate::MSrcTranslate(const char* srcPos , const char* dca, const char *name, const char *title)69 : MSrcPlace(TString(gsDefName+"Hist").Data()),fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE)67 MSrcTranslate::MSrcTranslate(const char* srcPosIn, const char* srcPosOut, const char* dca, const char *name, const char *title) 68 : fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE) 70 69 { 71 70 fName = name ? name : gsDefName.Data(); 72 71 fTitle = title ? title : gsDefTitle.Data(); 73 72 74 SetSrcPosName(srcPos); 73 SetInputSrcPosName(srcPosIn); 74 SetOutputSrcPosName(srcPosOut); 75 75 SetDCAName(dca); 76 77 SetInternalHistoName(TString(fName)+"Hist"); 76 78 } 77 79 … … 100 102 Double_t newX,newY; 101 103 102 MSrcPosCam* srcPos = GetSrcPosCam();103 MDCA* dca = GetDCA();104 104 MSrcPosCam* srcPosOut = GetOutputSrcPosCam(); 105 MDCA* dca = GetDCA(); 106 105 107 if(fTranslationIsRelative) 106 108 { 107 newX=srcPos->GetX()+fShiftX; 108 newY=srcPos->GetY()+fShiftY; 109 MSrcPosCam* srcPosIn = GetInputSrcPosCam(); 110 newX=srcPosIn->GetX()+fShiftX; 111 newY=srcPosIn->GetY()+fShiftY; 109 112 } 110 113 else … … 114 117 } 115 118 116 srcPos->SetX(newX); 117 srcPos->SetY(newY); 119 srcPosOut->SetXY(newX,newY); 118 120 dca->SetRefPoint(newX,newY); 119 121 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.h
r4087 r4094 17 17 18 18 public: 19 MSrcTranslate(const char* src="MSrcPosCam", const char* dca="MDCA", 19 MSrcTranslate(const char* srcIn="MSrcPosCam", const char* srcOut="MSrcPosCam", 20 const char* dca="MDCA", 20 21 const char* name=NULL, const char* title=NULL); 21 22 -
trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha.C
r4056 r4094 36 36 37 37 // ON data 38 // ton->Add("/disc01/HillasFiles/crabOnMisp3015_A.root"); 39 // ton->Add("/disc01/HillasFiles/crabOnMisp3015_B.root"); 40 // ton->Add("/disc01/HillasFiles/crabOnMisp3015_C.root"); 41 // ton->Add("/disc01/HillasFiles/crabOnMisp3015_D.root"); 42 // ton->Add("hillasCrab/crab20040215OnA.root"); 43 // ton->Add("hillasCrab/crab20040215OnB.root"); 44 // ton->Add("hillasCrab/crab20040215OnC.root"); 45 // ton->Add("hillasCrab/crab20040215OnD.root"); 46 // ton->Add("hillasCrab/crab20040215OnRotate2_-1.root"); 47 ton->Add("/disc01/HillasFiles/Mrk421/mrk421OnMisp3015_A.root"); 48 ton->Add("/disc01/HillasFiles/Mrk421/mrk421OnMisp3015_B.root"); 49 //ton->Add("/disc01/HillasFiles/Mrk421/mrk421OnMisp3015_C.root"); 50 // ton->Add("~aliu/MagicData/CrabNebula/2004_03_19/crabOn3015_A_-1-2.root"); 51 // ton->Add("~aliu/MagicData/CrabNebula/2004_03_19/crabOn3015_B_-1-1.root"); 52 //ton->Add("~aliu/MagicData/CrabNebula/2004_03_19/crabOn3015_C.root"); 38 ton->Add("/mnt/users/jrico/magic/mars/mars/mtemp/mifae/programs/srcPosPrueba.root"); 53 39 54 40 TChain* toff= new TChain("Parameters"); 55 41 56 42 // OFF data 57 //toff->Add("/disc01/HillasFiles/crabOffMisp3015_A.root"); 58 // toff->Add("/disc01/HillasFiles/crabOffMisp3015_B.root"); 59 // toff->Add("/disc01/HillasFiles/crabOffMisp3015_C.root"); 60 // toff->Add("/disc01/HillasFiles/crabOffMisp3015_D.root"); 61 // toff->Add("/disc01/HillasFiles/crabOffMisp3015_E.root"); 62 // toff->Add("/disc01/HillasFiles/crabOffMisp3015_F.root"); 63 // toff->Add("/disc01/HillasFiles/crabOffMisp3015_G.root"); 64 // toff->Add("/disc01/HillasFiles/crabOffMisp3015_H.root"); 65 // toff->Add("hillasCrab/crab20040215OffA.root"); 66 // toff->Add("hillasCrab/crab20040215OffB.root"); 67 // toff->Add("hillasCrab/crab20040215OffC.root"); 68 // toff->Add("hillasCrab/crab20040215OffD.root"); 69 // toff->Add("hillasCrab/crab20040215OffE.root"); 70 // toff->Add("hillasCrab/crab20040215OffF.root"); 71 // toff->Add("hillasCrab/crab20040215OffG.root"); 72 // toff->Add("hillasCrab/crab20040215OffH.root"); 73 // toff->Add("hillasCrab/crab20040215OffRotate2_-1.root"); 74 toff->Add("/disc01/HillasFiles/OffMrk421/mrk421OffMisp3015_A.root"); 75 toff->Add("/disc01/HillasFiles/OffMrk421/mrk421OffMisp3015_B.root"); 76 toff->Add("/disc01/HillasFiles/OffMrk421/mrk421OffMisp3015_C.root"); 77 // toff->Add("~aliu/MagicData/CrabNebula/2004_03_19/crabOff3015_-1-1.root"); 78 // toff->Add("~aliu/MagicData/CrabNebula/2004_03_19/crabOff3015_A.root"); 79 // toff->Add("~aliu/MagicData/CrabNebula/2004_03_19/crabOff3015_B.root"); 80 // toff->Add("~aliu/MagicData/CrabNebula/2004_03_19/crabOff3015_C.root"); 81 43 toff->Add("/mnt/users/jrico/magic/mars/mars/mtemp/mifae/programs/srcPosOffPrueba.root"); 82 44 83 45 TCanvas *c1 = new TCanvas("c1","c1",800,500); -
trunk/MagicSoft/Mars/mtemp/mifae/macros/signal.C
r4049 r4094 16 16 Float_t array[2]; 17 17 18 Int_t nbin2d = 10;18 Int_t nbin2d = 5; 19 19 Int_t ntotal = 2*nbin2d+1; 20 20 -
trunk/MagicSoft/Mars/mtemp/mifae/programs/falseSource.cc
r4045 r4094 16 16 17 17 #include "TString.h" 18 #include "TH 1F.h"18 #include "TH2F.h" 19 19 #include "TFile.h" 20 20 21 21 #include "MHillasSrcCalc.h" 22 22 #include "MSrcPosCam.h" 23 #include "MSrcTranslate.h" 23 24 #include "MHillasSrc.h" 24 25 #include "MSrcRotate.h" … … 43 44 TString offFile; 44 45 TString outputFile; 45 Bool_t kRotate=1; 46 Bool_t kRotate=1; 47 Bool_t kSrcPolicy=kFALSE; 46 48 Double_t fRA= -1.; 47 49 Double_t fDEC= -1.; … … 73 75 const Float_t alphamax = 90.; // maximum value in alpha (degrees) 74 76 const Float_t conver = 189./0.6; // conversion factor degrees to mm 77 const Float_t srclimit = field*conver; 78 const Float_t srcstep = 3.; 79 const Int_t nsrcbin = (Int_t) (srclimit/srcstep); 75 80 76 81 //----------------------------------------------------------------------------- … … 131 136 132 137 // create the histograms (empty) 133 TH1F *hOnAlpha[binning][binning]; 134 TH1F *hOffAlpha[binning][binning]; 138 TH1F* hOnAlpha[binning][binning]; 139 TH1F* hOffAlpha[binning][binning]; 140 TH2F* hOnSrcPos[binning]; 141 TH2F* hOffSrcPos[binning]; 142 135 143 for(Int_t i = -ival; i <= ival ; i++){ 136 144 for(Int_t j = -ival; j <= ival ; j++){ … … 144 152 hOffAlpha[i+ival][j+ival] = new TH1F(name, title, nbin, alphamin, alphamax); 145 153 154 if(j==0) 155 { 156 sprintf(name,"hOnSrcPos[%d]", i); 157 sprintf(title,"Source position (On data) (%d)", i); 158 hOnSrcPos[i+ival] = new TH2F(name, title, nsrcbin, -srclimit, srclimit, nsrcbin, -srclimit, srclimit); 159 160 sprintf(name,"hOffSrcPos[%d]", i); 161 sprintf(title,"Source position (Off data) (%d)", i); 162 hOffSrcPos[i+ival] = new TH2F(name, title, nsrcbin, -srclimit, srclimit, nsrcbin, -srclimit, srclimit); 163 } 146 164 } 147 165 } … … 154 172 155 173 // source dependent hillas containers/tasks 156 MHillasSrcCalc* csrc1[binning][binning];157 174 MSrcPosCam* source[binning][binning]; 158 175 MHillasSrc* hillasSrc[binning][binning]; 176 MSrcTranslate* srctranslate[binning][binning]; 159 177 MSrcRotate* srcrotate[binning][binning]; 178 MHillasSrcCalc* csrc1[binning][binning]; 160 179 161 180 // normal containers/classes … … 171 190 tlist.AddToList(&read); 172 191 173 Int_t k,l;174 192 char sourceName[100]; 175 193 char hillasSrcName[100]; 194 char translateName[100]; 195 char rotateName[100]; 176 196 177 197 // create the tasks/containers for the different source positions … … 186 206 if (i<0 && j<0) 187 207 { 188 k = -i;189 l = -j;208 Int_t k = -i; 209 Int_t l = -j; 190 210 sprintf(sourceName, "MSrcPosCam_Min%dMin%d", k, l); 191 211 sprintf(hillasSrcName, "MHillasSrc_Min%dMin%d", k, l); 212 sprintf(translateName, "MSrcTranslate_Min%dMin%d", k, l); 213 sprintf(rotateName, "MSrcRotate_Min%dMin%d", k, l); 192 214 } 193 215 194 216 if (i<0 && j>=0) 195 217 { 196 k = -i;218 Int_t k = -i; 197 219 sprintf(sourceName, "MSrcPosCam_Min%d%d", k, j); 198 220 sprintf(hillasSrcName, "MHillasSrc_Min%d%d", k, j); 221 sprintf(translateName, "MSrcTranslate_Min%d%d", k, j); 222 sprintf(rotateName, "MSrcRotate_Min%d%d", k, j); 199 223 } 200 224 201 225 if (i>=0 && j<0) 202 226 { 203 l = -j;227 Int_t l = -j; 204 228 sprintf(sourceName, "MSrcPosCam_%dMin%d", i, l); 205 229 sprintf(hillasSrcName, "MHillasSrc_%dMin%d", i, l); 230 sprintf(translateName, "MSrcTranslate_%dMin%d", i, l); 231 sprintf(rotateName, "MSrcRotate_%dMin%d", i, l); 206 232 } 207 233 … … 210 236 sprintf(sourceName, "MSrcPosCam_%d%d", i, j); 211 237 sprintf(hillasSrcName, "MHillasSrc_%d%d", i, j); 238 sprintf(translateName, "MSrcTranslate_%d%d", i, j); 239 sprintf(rotateName, "MSrcRotate_%d%d", i, j); 212 240 } 213 241 214 242 // include containers in parameter list 215 243 source[i+ival][j+ival] = new MSrcPosCam(sourceName); 216 source[i+ival][j+ival]->SetXY(xpos, ypos);217 244 plist.AddToList(source[i+ival][j+ival]); 218 source[i+ival][j+ival]->Print();219 245 220 246 hillasSrc[i+ival][j+ival] = new MHillasSrc(hillasSrcName); … … 222 248 223 249 // define the different tasks and include them in the task list 224 if(kRotate) 250 srctranslate[i+ival][j+ival] = new MSrcTranslate("MSrcPosCam",sourceName,"MDCA",translateName); 251 srctranslate[i+ival][j+ival]->SetTranslation(xpos,ypos); 252 srctranslate[i+ival][j+ival]->SetRelativeTranslation(kSrcPolicy); 253 srctranslate[i+ival][j+ival]->SetInternalHistoBinSize(5.); 254 srctranslate[i+ival][j+ival]->SetMode(MSrcPlace::kOn); 255 256 tlist.AddToList(srctranslate[i+ival][j+ival]); 257 258 if(kRotate && !kSrcPolicy) 225 259 { 226 srcrotate[i+ival][j+ival] = new MSrcRotate(sourceName );260 srcrotate[i+ival][j+ival] = new MSrcRotate(sourceName,sourceName,"MDCA",rotateName); 227 261 srcrotate[i+ival][j+ival]->SetRAandDEC(fRA,fDEC); 262 263 srctranslate[i+ival][j+ival]->SetCreateHisto(kFALSE); 264 srcrotate[i+ival][j+ival]->SetMode(MSrcPlace::kOn); 265 srcrotate[i+ival][j+ival]->SetInternalHistoBinSize(5.); 266 228 267 tlist.AddToList(srcrotate[i+ival][j+ival]); 229 268 } 269 else 270 srcrotate[i+ival][j+ival] = NULL; 271 230 272 231 273 TString HilName = "MHillas"; … … 266 308 hOnAlpha[i+ival][j+ival]->Fill(TMath::Abs(alpha)); 267 309 } 310 311 // fill source position histo 312 if(j==0) 313 hOnSrcPos[i+ival]->Fill(source[i+ival][j+ival]->GetX(),source[i+ival][j+ival]->GetY()); 268 314 } 269 315 if(++nread>nmaxevents) break; … … 278 324 FILL OFF-DATA HISTOS 279 325 *******************************************************************/ 326 for(Int_t i=-ival;i<=ival;i++) 327 for(Int_t j=-ival;j<=ival;j++) 328 { 329 if(srcrotate[i+ival][j+ival]) 330 srcrotate[i+ival][j+ival]->SetMode(MSrcPlace::kOff); 331 srctranslate[i+ival][j+ival]->SetMode(MSrcPlace::kOff); 332 } 333 280 334 281 335 MReadTree read2("Parameters", offFile); … … 306 360 hOffAlpha[i+ival][j+ival]->Fill(TMath::Abs(alpha)); 307 361 } 362 363 // fill source position histo 364 if(j==0) 365 hOffSrcPos[i+ival]->Fill(source[i+ival][j+ival]->GetX(),source[i+ival][j+ival]->GetY()); 308 366 } 309 367 if(++nread>nmaxevents) break; … … 319 377 hOnAlpha[i+ival][j+ival]->Write(); 320 378 hOffAlpha[i+ival][j+ival]->Write(); 379 if(j==0) 380 { 381 hOnSrcPos[i+ival]->Write(); 382 hOffSrcPos[i+ival]->Write(); 383 } 321 384 } 322 385 } … … 324 387 f->Close(); 325 388 389 for(Int_t i=-ival;i<=ival;i++) 390 for(Int_t j=-ival;j<=ival;j++) 391 { 392 if(srcrotate[i+ival][j+ival]) 393 delete srcrotate[i+ival][j+ival]; 394 delete srctranslate[i+ival][j+ival]; 395 delete source[i+ival][j+ival]; 396 delete hillasSrc[i+ival][j+ival]; 397 delete csrc1[i+ival][j+ival]; 398 } 326 399 } 327 400 //----------------------------------------------------------------------- … … 379 452 ifun >> kRotate; 380 453 454 // source movement policy flag 455 if(strcmp(word.Data(),"SRCABS")==0) 456 ifun >> kSrcPolicy; 457 458 381 459 // source celestial coordinates 382 460 if(strcmp(word.Data(),"SRCCOORDS")==0) … … 394 472 ifun >> binning; 395 473 396 397 474 // Number of bins in alpha plots 398 475 if(strcmp(word.Data(),"NBIN")==0) 399 476 ifun >> nbin; 400 401 402 403 477 404 478 // size cut … … 461 535 cout << "Off-data file name(s): " << offFile << endl; 462 536 cout << "Output file name: " << outputFile << endl; 463 cout << "De-rotation flag " << kRotate << endl; 464 cout << "Source celestial coordiantes (rad): RA = " << fRA << ", DEC = " << fDEC << endl; 537 if(kSrcPolicy) 538 cout << "Source position displaced with respect to the original existing one (no rotation applied)" << endl; 539 else 540 { 541 cout << "De-rotation flag " << kRotate << endl; 542 cout << "Source celestial coordiantes (rad): RA = " << fRA << ", DEC = " << fDEC << endl; 543 } 465 544 cout << "Field width (degrees): " << field << endl; 466 545 cout << "Field binning: " << binning << endl; -
trunk/MagicSoft/Mars/mtemp/mifae/programs/falsesource.datacard
r3973 r4094 4 4 5 5 // On-data file name pattern 6 ONFILES /mnt/users/jrico/magic/mars/Mars_Standard01/hillasCrab/crab20040215On*.root6 ONFILES ./srcPosPrueba.root 7 7 8 8 // Off-data file name pattern 9 OFFFILES /mnt/users/jrico/magic/mars/Mars_Standard01/hillasCrab/crab20040215Off*.root9 OFFFILES ./srcPosOffPrueba.root 10 10 11 11 // output file name 12 OUTFILE ./rotateprueba .root12 OUTFILE ./rotateprueba2.root 13 13 14 14 // rotation flag: … … 19 19 // source coordinates (RA DEC in rads) 20 20 SRCCOORDS 1.46 0.384 21 22 // Flag to determine whether source position is absolute (0) or relative to previous position (1) 23 // In case SRCABS=1, no rotation is carried out 24 SRCABS 1 21 25 22 26 // Width of examined field (degrees) -
trunk/MagicSoft/Mars/mtemp/mifae/programs/srcPos.cc
r4084 r4094 128 128 srctranslate.SetTranslation(xpos,ypos); 129 129 srctranslate.SetRelativeTranslation(kSrcPolicy); 130 srctranslate.SetCreateHisto(kFALSE); 130 131 srcrotate.SetRAandDECandRefMJD(fRA,fDEC,mjdpos); 131 132 srcrotate.SetMode(MSrcPlace::kOn); … … 164 165 165 166 tlist.PrintStatistics(); 166 167 167 168 168 // do off-data if input file was specified … … 196 196 197 197 tlist.PrintStatistics(); 198 199 198 } 200 199 //----------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mtemp/mifae/programs/srcpos.datacard
r4087 r4094 1 1 2 2 // Maximun number of on and off events to be processed) 3 NEVENTS 200003 NEVENTS 9999999 4 4 5 // Input file name pattern 5 // Input file name pattern (wildcards allowed) 6 6 INPUTFILES /mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/hillas/mrk20040215OnNoCalB.root 7 7
Note:
See TracChangeset
for help on using the changeset viewer.