- Timestamp:
- 12/05/12 09:45:15 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/marsmacros/mc2csv/MonteCarlo.h
r14657 r14725 2 2 #define MONTECARLO_H 3 3 4 /** A one line description of the class. 4 /*! \class MonteCarlo 5 * \brief Monte Carlo class to handle MC-Data from mars-root-file produced with ceres. 5 6 * 6 * #include " XX.h" <BR>7 * #include "MonteCarlo.h" <BR> 7 8 * -llib 8 9 * 9 * A longer description. 10 * Class can be used in Mars to load Monte Carlo data from a root-file 11 * containing Mars classes that where produced by CERES 10 12 * 11 13 * @see something … … 64 66 using namespace TMath; 65 67 66 struct pixel_t 68 struct pixel_t //struct gathering information of a camera pixel 67 69 { 68 int SoftId; 69 // int ChId; 70 unsigned short* rawData; 71 float pedestal; 70 int SoftId; //Mars Software ID of Pixel 71 // int ChId; //continous Hardware ID of Pixel 72 unsigned short* rawData; //array with raw data of slices* amplitudes 73 float pedestal; //amplitude of baseline 72 74 }; 73 75 … … 79 81 /** Default constructor. 80 82 */ 81 MonteCarlo(); 82 MonteCarlo(TString filename); 83 MonteCarlo(TString filename, TString evtsTreeName); 84 MonteCarlo(TString filename, TString evtsTreeName, TString headerTreeName); 83 MonteCarlo(); // Default constructor 84 /*! constructor 85 * \param filename name of mc data file that will to load 86 */ 87 MonteCarlo( TString filename); // name of mc data file will to load 88 /*! constructor 89 * \param filename name of mc data file that will to load 90 * \param evtsTreeName name of tree containg events 91 */ 92 MonteCarlo( TString filename, // name of mc data file will to load 93 TString evtsTreeName); // name of tree containg events 94 /*! constructor 95 * \param filename name of mc data file that will to load 96 * \param evtsTreeName name of tree containg events 97 * \param headerTreeName name of tree containg run meta data 98 */ 99 MonteCarlo( TString filename, // name of mc data file will to load 100 TString evtsTreeName, // name of tree containg events 101 TString headerTreeName);// name of tree containg meta data 85 102 86 103 … … 108 125 109 126 // OPERATIONS 127 private: 128 /*! Initiate all pointer Variables to NULL*/ 110 129 void InitVariables(); 111 130 131 public: 132 /*! Write Monte Carlo Data into a Csv-file WriteMc2Csv(filename) 133 * \param filename The Filename of the CSV File to which data will be written 134 */ 112 135 void WriteMc2Csv(TString filename ); 136 137 /*! write pixels' raw data for a given pixel into the given csv file 138 * \param pixelID Software ID of pixel 139 */ 113 140 void WritePixelData2Csv(int pixelID); 141 142 /*! loop over all pixels and call WritePixelData2Csv 143 */ 114 144 void WriteEventData2Csv(); 145 146 /*! write table headings for coulums with pixels' raw data 147 */ 115 148 void WriteEventDataInfo2Csv(); 149 150 /*! write table headings for coulums with event meta information 151 */ 116 152 void WriteEventHeaderInfo2Csv(); 153 154 /*! write meta information of current event to csv 155 */ 117 156 void WriteEventHeader2Csv(); 157 158 /*! write table headings for coulums with run meta information 159 */ 118 160 void WriteRunHeaderInfo2Csv(); 161 162 /*! write meta information of current run to csv 163 */ 119 164 void WriteRunHeader2Csv(); 165 166 /*! write the header of the csv file containing brief info about the converted mc file 167 */ 120 168 void WriteFileInfo2Csv(); 169 170 /*! write table headings for coulums with pixels' pedestal amplitude 171 */ 121 172 void WritePedestal2Csv(); 173 174 /*! write table headings for coulums with pixels' pedestal amplitude 175 */ 122 176 void WritePedestalInfo2Csv(); 123 177 124 178 125 179 // ACCESS 180 /*! set the verbosity level for verbosity cout on cmd-line 181 * \param verbLvl Votrbosity Level 182 */ 126 183 void SetVerbosityLevel(int verbLvl); 184 185 /*! Get the verbosity level for verbosity cout on cmd-line 186 */ 127 187 int GetVerbosityLevel(); 128 188 189 /*! Open the mars-root-file produced with ceres 190 */ 129 191 void OpenRootFile(); 192 193 /*! Close the mars-root-file produced with ceres 194 */ 130 195 void CloseRootFile(); 131 196 197 /*! Open csv-file to which data will be written 198 * \param fileName Filename of the csv-file e.g. "mc20120605.csv" 199 */ 132 200 void OpenCsvFile( TString fileName); 201 202 /*! Close csv-file to which data was be written 203 */ 133 204 void CloseCsvFile(); 134 205 206 /*! set according pointers to tree containing event information and its branches 207 * \param treeName Name of TTree containing event information 208 */ 135 209 void LoadEventTree( TString treeName); 210 211 /*! set according pointers to tree containing run information and its branches 212 * \param treeName Name of TTree containing run information 213 */ 136 214 void LoadHeaderTree(TString treeName); 137 215 216 /*! set values of members to according leafs in TTree for run meta data 217 */ 138 218 void ReadRunHeader(); 219 220 /*! set values of members to according leafs in TTree for event raw data 221 */ 139 222 void ReadEventRawData(); 223 224 /*! set values of members to according leafs in TTree for event meta data 225 */ 140 226 void ReadEventMetaData(); 227 228 /*! call ReadEventRawData() and ReadEventMetaData() for given event 229 * \param Event Event ID to read data 230 */ 141 231 void ReadEvent(int Event); 142 232 143 233 // INQUIRY 144 234 private: 235 /*! Verbostiy Level */ 145 236 int mVerbosityLvl; 237 /*! Whether the rootfile is open */ 146 238 bool mRootFileOpend; 147 239 240 /*! filename of output csv file */ 148 241 TString mCsvFileName; 242 /*! steam into csv output file */ 149 243 ofstream mCsv; 244 /*! filename of input root file */ 150 245 TString mFileName; 246 /*! pointer to input root file */ 151 247 TFile* mpRootFile; 248 /*! Array for pixels' raw data */ 152 249 pixel_t* mpPixel; 153 250 251 /*! pointer to event tree */ 154 252 TTree* mpEventTree; 253 /*! pointer to run header tree */ 155 254 TTree* mpHeaderTree; 156 255 157 //header data types 256 //run header tree branches 257 /*! mars class pointer to branch with same name in TTree */ 158 258 MParameterD* mpIntendedPulsePos; 259 /*! mars class pointer to branch with same name in TTree */ 159 260 MMcRunHeader* mpMcRunHeader; 261 /*! mars class pointer to branch with same name in TTree */ 160 262 MGeomCamFACT* mpGeomCam; 263 /*! mars class pointer to branch with same name in TTree */ 161 264 MRawRunHeader* mpRawRunHeader; 265 /*! mars class pointer to branch with same name in TTree */ 162 266 MCorsikaRunHeader* mpCorsikaRunHeader; 163 267 164 //Evt data types 268 //Event tree branches 269 /*! mars class pointer to branch with same name in TTree */ 165 270 MPedestalCam* mpElectronicNoise; 271 /*! mars class pointer to branch with same name in TTree */ 166 272 MRawEvtData* mpRawEventData; 273 /*! mars class pointer to branch with same name in TTree */ 167 274 MParameterD* mpIncidentAngle; 275 /*! mars class pointer to branch "MMcEvt" in TTree */ 168 276 MMcEvt* mpMcEventMetaData; 277 /*! mars class pointer to branch with same name in TTree */ 169 278 MRawEvtHeader* mpRawEventHeader; 279 /*! mars class pointer to branch with same name in TTree */ 170 280 MCorsikaEvtHeader* mpCorsikaEvtHeader; 171 281 172 unsigned short * mpSamples; // array with MC events raw data 282 // /*! array with MC events raw data */ 283 // unsigned short * mpSamples; // array with MC events raw data 284 /*! coulumn seperator in csv file */ 173 285 TString mSeparator; 174 286 175 287 //Run Meta Data 288 /*! number of entries(events) in event tree */ 176 289 int mNumberOfEntries; 290 /*! number of events in file NOT WORKING WITH CURRENT CERES VERSION */ 177 291 int mNumberOfEvents; 292 /*! position (slice) of simulated cherenkov pulse in pixel */ 178 293 float mIntendedPulsePos; 179 float mPedestalOffset;294 /*! number of showers simulated by corsika*/ 180 295 int mNumSimulatedShowers; 296 /*! total number of simulated camera pixels */ 181 297 int mNumberOfPixels; 298 /*! ??? */ 182 299 int mNumberOfSectors; 300 /*! ??? */ 183 301 int mNumberOfAreas; 302 /*! number of Samples (slices) -> simulated Region of interest */ 184 303 float mNumberOfSamples; 304 /*! simulated sampling frequency */ 185 305 float mSamplingFrequency; 306 /*! ??? */ 186 307 int mNumberOfEventsRead; 308 /*! ??? */ 187 309 float mCamDist; 310 /*! name of simulated source */ 188 311 const char* mSourceName; 312 /*! slope of simulated spectrum */ 189 313 float mSlopeSpectrum; 314 /*! minimum of simulated spectrum */ 190 315 float mEnergyMin; 316 /*! maximum of simulated spectrum */ 191 317 float mEnergyMax; 318 /*! minimum Zenidth of simulated showers */ 192 319 float mZdMin; 320 /*! maximum Zenidth of simulated showers */ 193 321 float mZdMax; 322 /*! minimum Azimuth of simulated showers */ 194 323 float mAzMin; 324 /*! maximum Azimuth of simulated showers */ 195 325 float mAzMax; 326 /*! file number from raw run header */ 196 327 unsigned int mFileNumber; 328 /*! corsika run number */ 197 329 int mRunNumber; 330 /*! runtype: e.g. Pedestal, data, calibration run,... */ 198 331 int mRunType; 332 /*! number of bytes per sample */ 199 333 int mNumberOfBytes; 200 334 201 335 //Event Meta Data 336 /*! Incident Angle */ 202 337 float mIncidentAngle; 338 /*! id of primary particle of shower */ 203 339 int mPartId; 340 /*! energy of primary particle of shower */ 204 341 float mEnergy; 342 /*! impact parameter of primary particle of shower */ 205 343 float mImpact; 344 /*! Telescope Phi of shower */ 206 345 float mTelescopePhi; 346 /*! Telescope Theta of shower */ 207 347 float mTelescopeTheta; 348 /*! Phi of shower */ 208 349 float mPhi; 350 /*! Theta of shower */ 209 351 float mTheta; 352 /*! name of primary particle of shower */ 210 353 TString mPartName; 354 /*! symbol of primary particle of shower */ 211 355 TString mPartSymbol; 356 /*! corsika event number */ 212 357 unsigned int mCorsikaEventNumber; 358 /*! Passed qe, coming from the shower */ 213 359 unsigned int mPhotElFromShower; 360 /*! usPhotElfromShower + mean of phe from NSB */ 214 361 unsigned int mPhotElinCamera; 362 /*! Number running from 0 to N-1, being N the number 363 * of times a Corsika event has been reused, by 364 * orienting the telescope in different ways or by 365 * setting it at a different location on the ground. */ 215 366 int mEvtReuse; 367 /*! Number of Events from DAQ */ 216 368 int mEventNumber; 369 /*! Number of 1st level tiggers between 2 events Used in MSimTrigger for the index of the trigger channel */ 217 370 float mNumTriggerLvl1; 371 /*! Number of 2nd level tiggers between 2 events */ 218 372 float mNumTriggerLvl2; 373 /*! [cm] z coordinate, first intercation height */ 219 374 float mFirstInteractionHeight; 375 /*! [GeV/c] "+west" "-east" */ 220 376 float mMomentumX; 377 /*! [GeV/c] "+south" "-north" 378 * (north denotes the magnet north which is defined to be in the geografic north!) 379 */ 221 380 float mMomentumY; 381 /*! [GeV/c] "+upwards" "-downwards" */ 222 382 float mMomentumZ; 383 /*! [rad] Zenith distance */ 223 384 float mZd; 385 /*! [rad] Azimuth (north=0; east=90) 386 * (north denotes the magnet north which is defined to be in the geografic north!) 387 */ 224 388 float mAz; 389 /*! [cm] Position of telescope on ground x / - impact parameter x */ 225 390 float mX; 391 /*! [cm] Position of telescope on gorund y / - impact parameter y */ 226 392 float mY; 393 /*! weighted number of photons arriving at observation level */ 227 394 // int mWeightedNumPhotons; 228 395
Note:
See TracChangeset
for help on using the changeset viewer.